From dee661f28068885bb29659ee97ff777eb4a9d712 Mon Sep 17 00:00:00 2001 From: David Eads Date: Wed, 13 Jun 2012 04:22:57 -0500 Subject: [PATCH] cleanup duration toggle and makefile --- .../townsquare_core/townsquare_core.module | 2 +- .../townsquare_volunteer/js/autocomplete.js | 7 ++-- .../js/townsquare_volunteer-session-edit.js | 39 +++++++------------ townsquare.make | 6 +-- 4 files changed, 22 insertions(+), 32 deletions(-) diff --git a/modules/townsquare/townsquare_core/townsquare_core.module b/modules/townsquare/townsquare_core/townsquare_core.module index 968986b..ca3758b 100644 --- a/modules/townsquare/townsquare_core/townsquare_core.module +++ b/modules/townsquare/townsquare_core/townsquare_core.module @@ -33,7 +33,7 @@ function townsquare_core_init() { * Fix silly features incompatibility with theme. */ function townsquare_core_custom_theme() { - if (arg(2) == 'features') { + if (arg(2) == 'features' || arg(2) == 'views') { return 'seven'; } } diff --git a/modules/townsquare/townsquare_volunteer/js/autocomplete.js b/modules/townsquare/townsquare_volunteer/js/autocomplete.js index 977c3d8..e4ad846 100644 --- a/modules/townsquare/townsquare_volunteer/js/autocomplete.js +++ b/modules/townsquare/townsquare_volunteer/js/autocomplete.js @@ -1,6 +1,7 @@ // Overide Drupal autocomplete methods -(function($) { -/** +(function($) { if (Drupal.jsAC) { + + /** * Handler for the "keydown" event. */ Drupal.jsAC.prototype.onkeydown = function (input, e) { @@ -115,4 +116,4 @@ Drupal.jsAC.prototype.found = function (matches) { } }; -})(jQuery); +}})(jQuery); diff --git a/modules/townsquare/townsquare_volunteer/js/townsquare_volunteer-session-edit.js b/modules/townsquare/townsquare_volunteer/js/townsquare_volunteer-session-edit.js index 32a0a28..ac08600 100644 --- a/modules/townsquare/townsquare_volunteer/js/townsquare_volunteer-session-edit.js +++ b/modules/townsquare/townsquare_volunteer/js/townsquare_volunteer-session-edit.js @@ -24,6 +24,7 @@ Drupal.behaviors.toggleFields = { $(this).change(function() { $('input, select, textarea', form) .not('name="field_session_user[und][0][target_id]"') + .not('name="field_session_duration[und][0][value]"') .not(':submit') .removeAttr('readonly'); @@ -31,34 +32,22 @@ Drupal.behaviors.toggleFields = { .removeAttr('disabled'); }); }); + $('.form-item-field-session-override-duration-und input').not(':disabled').each(function() { + var form = $(this).parents('form'); + var duration = $('input[name="field_session_duration[und][0][value]"]', form); + var hours = $('.form-item-field-session-hours-und-0-value input, .form-item-field-session-hours-und-0-value2 input', form); + if ($(this).is(':checked')) { + duration.removeAttr('readonly'); + hours.attr('readonly', true); + } + else { + duration.attr('readonly', true); + hours.removeAttr('readonly'); + } + }); } }; - - -TownsquareVolunteer = {} -TownsquareVolunteer.toggleDuration = function(field) { - var form = $(field).parents('form'); - var duration = $('.field-name-field-session-duration', form); - var hours = $('.form-item-field-session-hours-und-0-value, .form-item-field-session-hours-und-0-value2', form); - var checkbox = $('input:checked', field).not(':disabled'); //.attr('checked'); - if (!checkbox.length) { - duration.addClass('form-disabled'); - $('input', duration).attr('readonly', true); - - hours.removeClass('form-disabled'); - $('input', hours).removeAttr('readonly'); - $('button', hours).removeAttr('disabled'); - } else { - duration.removeClass('form-disabled'); - $('input', duration).removeAttr('readonly'); - - hours.addClass('form-disabled'); - $('input', hours).attr('readonly', true); - $('button', hours).attr('disabled', true); - } -} - /* Drupal AJAX overrides */ /** diff --git a/townsquare.make b/townsquare.make index 7e616b3..2ae9c15 100644 --- a/townsquare.make +++ b/townsquare.make @@ -3,7 +3,7 @@ core = 7.x projects[drupal][type] = core projects[drupal][version] = "7.12" -projects[addressfield][version] = "1.0-beta2" +projects[addressfield][version] = "1.0-beta3" projects[addressfield][subdir] = "contrib" projects[combobox][type] = "module" @@ -18,7 +18,7 @@ projects[ctools][subdir] = "contrib" projects[date][version] = "2.2" projects[date][subdir] = "contrib" -projects[devel][version] = "1.2" +projects[devel][version] = "1.3" projects[devel][subdir] = "contrib" projects[diff][version] = "2.0" @@ -27,7 +27,7 @@ projects[diff][subdir] = "contrib" projects[entity][version] = "1.0-rc1" projects[entity][subdir] = "contrib" -projects[entityreference][version] = "1.0-rc1" +projects[entityreference][version] = "1.0-rc3" projects[entityreference][subdir] = "contrib" projects[eva][version] = "1.1"