Skip to content
This repository has been archived by the owner on Oct 29, 2020. It is now read-only.

Neue 6.0 beta5 #3919

Merged
merged 7 commits into from
Feb 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,9 @@ function dosomething_campaign_add_signup_data_form_vars(&$node) {
if (!$sid) {
// Staff is viewing a campaign which they haven't signed up for.
$node->content['signup_data_form'] = array(
'#prefix' => '<div class="modal__block">',
'#markup' => "You haven't signed up for this campaign!",
'#suffix' => '</div>',
);
return;
}
Expand Down
66 changes: 40 additions & 26 deletions lib/modules/dosomething/dosomething_helpers/modal-links.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,45 @@
<?php if (isset($modals['faq'])): ?>
<div data-modal id="modal-faq" role="dialog">
<h2 class="heading -banner"><?php print t('FAQs'); ?></h2>
<?php foreach ($modals['faq'] as $item): ?>
<h4><?php print $item['header']; ?></h4>
<?php print $item['copy'] ?>
<?php endforeach; ?>
<div class="form-actions">
<a href="#" class="js-close-modal"><?php print t('Back to main page'); ?></a>
<div class="modal__block">
<?php foreach ($modals['faq'] as $item): ?>
<h4><?php print $item['header']; ?></h4>
<?php print $item['copy'] ?>
<?php endforeach; ?>
</div>
<div class="modal__block">
<div class="form-actions">
<a href="#" class="js-close-modal"><?php print t('Back to main page'); ?></a>
</div>
</div>
</div>
<?php endif; ?>

<?php if (isset($modals['more_facts'])): ?>
<div data-modal id="modal-facts" role="dialog">
<h2 class="heading -banner"><?php print t('Facts'); ?></h2>
<ul class="list">
<?php foreach ($modals['more_facts']['facts'] as $key => $fact): ?>
<li><?php print $fact['fact']; ?><sup><?php print $fact['footnotes']; ?></sup></li>
<?php endforeach; ?>
</ul>

<section class="sources">
<h3 class="__title js-toggle-sources"><?php print t('Sources'); ?></h3>
<ul class="__body legal">
<?php foreach ($modals['more_facts']['sources'] as $key => $source): ?>
<li><sup><?php print ($key + 1); ?></sup> <?php print $source; ?></li>
<?php endforeach; ?>
<div class="modal__block">
<ul class="list">
<?php foreach ($modals['more_facts']['facts'] as $key => $fact): ?>
<li><?php print $fact['fact']; ?><sup><?php print $fact['footnotes']; ?></sup></li>
<?php endforeach; ?>
</ul>
</section>
<div class="form-actions">
<a href="#" class="js-close-modal"><?php print t('Back to main page'); ?></a>
</div>

<div class="modal__block">
<section class="footnote">
<h4 class="js-footnote-toggle"><?php print t('Sources'); ?></h4>
<ul class="js-footnote-hidden">
<?php foreach ($modals['more_facts']['sources'] as $key => $source): ?>
<li><sup><?php print ($key + 1); ?></sup> <?php print $source; ?></li>
<?php endforeach; ?>
</ul>
</section>
</div>
<div class="modal__block">
<div class="form-actions">
<a href="#" class="js-close-modal"><?php print t('Back to main page'); ?></a>
</div>
</div>
</div>
<?php endif; ?>
Expand All @@ -57,11 +67,15 @@
<?php foreach ($modals['partner_info'] as $delta => $partner): ?>
<div data-modal id="modal-partner-<?php print $delta; ?>" role="dialog">
<h2 class="heading -banner"><?php print t('We &lt;3 @partner', array('@partner' => $partner['name'])); ?></h2>
<?php print $partner['copy']; ?>
<?php if (isset($partner['video'])): print $partner['video']; ?>
<?php elseif (isset($partner['image'])): print $partner['image']; endif; ?>
<div class="form-actions">
<a href="#" class="js-close-modal"><?php print t('Back to main page'); ?></a>
<div class="modal__block">
<?php print $partner['copy']; ?>
<?php if (isset($partner['video'])): print $partner['video']; ?>
<?php elseif (isset($partner['image'])): print $partner['image']; endif; ?>
</div>
<div class="modal__block">
<div class="form-actions">
<a href="#" class="js-close-modal"><?php print t('Back to main page'); ?></a>
</div>
</div>
</div>
<?php endforeach; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,18 +300,18 @@ function dosomething_signup_user_signup_data_form($form, &$form_state, $signup)
$copy = dosomething_signup_filter_form_submitted_copy($config['form_submitted_copy'], $timestamp);
// Display the form submitted copy:
$form['submitted_copy'] = array(
'#prefix' => '<p>',
'#prefix' => '<div class="modal__block"><p>',
'#markup' => $copy,
'#suffix' => '</p>',
'#suffix' => '</p></div>',
);
// Return form as is (without a submit button).
return $form;
}

$form['copy'] = array(
'#prefix' => '<p>',
'#prefix' => '<div class="modal__block"><p>',
'#markup' => $config['form_copy'],
'#suffix' => '</p>',
'#suffix' => '</div></p>',
);

// If we are collecting User address:
Expand All @@ -334,6 +334,8 @@ function dosomething_signup_user_signup_data_form($form, &$form_state, $signup)
// If we are collecting User school:
if ($config['collect_user_school']) {
$form['school_finder'] = array(
'#prefix' => '<div class="modal__block">',
'#suffix' => '</div>',
'#type' => 'fieldset',
'#attributes' => array(
'data-validate' => 'school_finder',
Expand Down Expand Up @@ -425,8 +427,8 @@ function dosomething_signup_user_signup_data_form($form, &$form_state, $signup)

$form['actions'] = array(
'#type' => 'markup',
'#prefix' => '<div class="form-actions">',
'#suffix' => '</div>',
'#prefix' => '<div class="modal__block"><div class="form-actions">',
'#suffix' => '</div></div>',
);

$form['actions']['submit'] = array(
Expand Down
4 changes: 3 additions & 1 deletion lib/themes/dosomething/paraneue_dosomething/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"tests"
],
"dependencies": {
"neue": "DoSomething/neue#6.0.0-beta4",
"neue": "DoSomething/neue#6.0.0-beta5",
"dosomething-validation": "DoSomething/validation#~0.1.0",
"dosomething-modal": "DoSomething/modal#~0.1.0",
"jquery": "1.8.3",
"mailcheck": "~1.0.3",
"html5shiv": "~3.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
function paraneue_dosomething_page_alter_login(&$page) {
if (!user_is_logged_in()){
$page['page_bottom']['login'] = array(
'#prefix' => '<div data-modal id="modal--login" role="dialog" hidden>',
'#suffix' => '</div>',
'#prefix' => '<div data-modal id="modal--login" role="dialog" hidden><div class="modal__block">',
'#suffix' => '</div></div>',
'login' => drupal_get_form('user_login_block')
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
function paraneue_dosomething_page_alter_register(&$page) {
if (!user_is_logged_in()){
$page['page_bottom']['register'] = array(
'#prefix' => '<div data-modal id="modal--register" role="dialog" hidden>',
'#suffix' => '</div>',
'#prefix' => '<div data-modal id="modal--register" role="dialog" hidden><div class="modal__block">',
'#suffix' => '</div></div>',
'register' => drupal_get_form('user_register_form')
);
}
Expand Down Expand Up @@ -44,7 +44,7 @@ function paraneue_dosomething_form_alter_register(&$form, &$form_state, $form_id
));
$form['legal-text'] = array(
'#type' => 'item',
'#markup' => '<p class="legal">' . $copy . '</p>',
'#markup' => '<p class="footnote">' . $copy . '</p>',
'#weight' => 501,
);

Expand Down
31 changes: 17 additions & 14 deletions lib/themes/dosomething/paraneue_dosomething/includes/form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ function paraneue_dosomething_form_element($variables) {
$element = &$variables['element'];
$output = theme_form_element($variables);

// If rendering a radio button, create rendered element for label
if($element['#type'] === 'radio') {
$variables['rendered_element'] = $element['#children'] . '<span class="option__indicator"></span>' . "\n";
$output = theme('form_element_label', $variables);
}
// If rendering a radio button or checkbox, create rendered element for label
if($element['#type'] === 'radio' || $element['#type'] === 'checkbox') {
// If not set to 'attribute' display setting, add an option indicator
if($element['#title_display'] !== 'attribute') {
$variables['rendered_element'] = $element['#children'] . '<span class="option__indicator"></span>' . "\n";
}
else {
$variables['rendered_element'] = $element['#children'] . "\n";
}

// If rendering a checkbox, create rendered element for label
if($element['#type'] === 'checkbox') {
$variables['rendered_element'] = $element['#children'] . '<span class="option__indicator"></span>' . "\n";
$output = theme('form_element_label', $variables);
}

Expand Down Expand Up @@ -59,12 +60,15 @@ function paraneue_dosomething_form_element_label($variables) {
$attributes['class'] = 'option -checkbox';
}
elseif ($element['#type'] === 'radio' && $element['#title_display'] !== 'attribute') {
dpm($element);
$attributes['class'] = 'option -radio';
}
else {
// If displaying with an attribute, use element's class
if ($element['#title_display'] === 'attribute' && !empty($element['#custom_label_class'])) {
$attributes['class'] = $element['#custom_label_class'];
}
// Style the label as class option to display inline with the element.
if ($element['#title_display'] === 'after') {
elseif ($element['#title_display'] === 'after') {
$attributes['class'] = 'element-label-after';
}
// Show label only to screen readers to avoid disruption in visual flows.
Expand All @@ -80,6 +84,7 @@ function paraneue_dosomething_form_element_label($variables) {
$attributes['for'] = $element['#id'];
}


// Return with rendered element if it exists
if (!empty($variables['rendered_element'])) {
return ' <label' . drupal_attributes($attributes) . '>' . $variables['rendered_element'] . $t('!title !required', array('!title' => $title, '!required' => $required)) . "</label>\n";
Expand Down Expand Up @@ -213,9 +218,8 @@ function paraneue_dosomething_form_alter_shirt_options(&$form, &$form_state, $fo
'data-validate-required' => '',
);
foreach ($form['item']['#options'] as $key => $option) {
$form['item'][$key]['#prefix'] = '<div class="media-options__item -radio">';
$form['item'][$key]['#suffix'] = '</div>';
$form['item'][$key]['#title_display'] = 'attribute';
$form['item'][$key]['#custom_label_class'] = array('media-option', '-radio');
}
$shirt_style_prefix = '<div data-validate="shirt_style" data-validate-required class="js-media-options">';
$shirt_style_suffix = '</div>';
Expand All @@ -225,9 +229,8 @@ function paraneue_dosomething_form_alter_shirt_options(&$form, &$form_state, $fo
$form['item_option']['#attributes'] = $shirt_size_attributes;
if (isset($form['item_additional'])) {
foreach ($form['item_additional']['#options'] as $key => $option) {
$form['item_additional'][$key]['#prefix'] = '<div class="media-options__item -radio">';
$form['item_additional'][$key]['#suffix'] = '</div>';
$form['item_additional'][$key]['#title_display'] = 'attribute';
$form['item_additional'][$key]['#custom_label_class'] = array('media-option', '-radio');
}
$form['item_additional_header']['#markup'] = '<h4>' . t("Your Friend's Shirt") . '</h4>';
$form['item_additional']['#prefix'] = $shirt_style_prefix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ function paraneue_dosomething_preprocess_node_campaign(&$vars) {
$closeButton = 'skip';
}

$js = 'require(["neue/modal"], function(Modal) { Modal.open( jQuery("#' . $id . '"), {animated: false, closeButton: "' . $closeButton . '", skipForm: "' . $skipForm . '"}); });';
$js = 'require(["modal"], function(Modal) { Modal.open( jQuery("#' . $id . '"), {animated: false, closeButton: "' . $closeButton . '", skipForm: "' . $skipForm . '"}); });';
drupal_add_js($js, 'inline');
}

Expand Down
16 changes: 8 additions & 8 deletions lib/themes/dosomething/paraneue_dosomething/js/Analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,38 @@
* Uses Google Analytics custom events API to fire events for client-side
* Modal and Form Validation flows.
*/
define(["neue/events"], function(Events) {
define(["validation", "modal"], function(Validation, Modal) {
"use strict";

// We'll only fire GA Custom Events if the GA object exists
if(typeof(_gaq) !== "undefined" && _gaq !== null) {
// Validation
Events.subscribe("Validation:InlineError", function(topic, args) {
Validation.Events.subscribe("Validation:InlineError", function(topic, args) {
_gaq.push(["_trackEvent", "Form", "Inline Validation Error", args, null, true]);
});

Events.subscribe("Validation:Suggestion", function(topic, args) {
Validation.Events.subscribe("Validation:Suggestion", function(topic, args) {
_gaq.push(["_trackEvent", "Form", "Suggestion", args, null, true]);
});

Events.subscribe("Validation:SuggestionUsed", function(topic, args) {
Validation.Events.subscribe("Validation:SuggestionUsed", function(topic, args) {
_gaq.push(["_trackEvent", "Form", "Suggestion Used", args, null, true]);
});

Events.subscribe("Validation:Submitted", function(topic, args) {
Validation.Events.subscribe("Validation:Submitted", function(topic, args) {
_gaq.push(["_trackEvent", "Form", "Submitted", args, null, false]);
});

Events.subscribe("Validation:SubmitError", function(topic, args) {
Validation.Events.subscribe("Validation:SubmitError", function(topic, args) {
_gaq.push(["_trackEvent", "Form", "Validation Error on submit", args, null, true]);
});

// Modals
Events.subscribe("Modal:Open", function(topic, args) {
Modal.Events.subscribe("Modal:Open", function(topic, args) {
_gaq.push(["_trackEvent", "Modal", "Open", "#" + args.attr("id"), null, true]);
});

Events.subscribe("Modal:Close", function(topic, args) {
Modal.Events.subscribe("Modal:Close", function(topic, args) {
_gaq.push(["_trackEvent", "Modal", "Close", "#" + args.attr("id"), null, true]);
});
}
Expand Down
14 changes: 8 additions & 6 deletions lib/themes/dosomething/paraneue_dosomething/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ define("app", function (require) {
var Reportback = require("reportback/Reportback");

// Initialize modules on load
require("neue/main");
require("neue");
require("modal");
require("validation");

require("campaign/SchoolFinder");
require("campaign/sources");
require("campaign/ImageUploader");
require("validation/auth");
require("validation/reportback");
require("validation/address");
require("validation/donate");
require("validators/auth");
require("validators/reportback");
require("validators/address");
require("validators/donate");
require("Analytics");
require("tiles");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ define(function(require) {

var $ = require("jquery");
var _ = require("lodash");
var Validation = require("neue/validation");
var Validation = require("validation");

var shouldValidateForm = true;
var resultTpl = _.template("<li><a class='js-schoolfinder-result' data-gsid='<%- gsid %>' href='#'><span><%- name %></span> <em><%- city %>, <%- state %></em></a></li>");
Expand Down
38 changes: 0 additions & 38 deletions lib/themes/dosomething/paraneue_dosomething/js/campaign/sources.js

This file was deleted.

Loading