Skip to content

Commit

Permalink
Fixing tabbing wip
Browse files Browse the repository at this point in the history
  • Loading branch information
eads committed Jun 3, 2012
1 parent 5294874 commit f0abc31
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ button label {
display: inline;
}

@media ( min-width: 980px ) {
@media ( min-width: 768px ) {
#volunteer-sessions {
padding-bottom: 250px;
}
button {
width: auto;
}
.page-event label, .page-event .controls, .page-event .control-group {
display: inline-block;
}
.page-event input, .page-event select {
.page-event input {
width: auto;
}
.page-event label {
Expand Down Expand Up @@ -75,10 +78,12 @@ button label {
list-style-type: none;
margin: 0;
}
.page-event #volunteer-sessions .form-item input[type="text"],
.page-event #volunteer-sessions .form-item select {
.page-event #volunteer-sessions .form-item input[type="text"] {
width: 85%;
}
.page-event #volunteer-sessions .form-item select {
width: 100%;
}
.page-event #volunteer-sessions .volunteer-session-form {
clear: both;
float: left;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,13 @@
(function($) {

// Tweak volunteer UI
function volunteerUI() {
var width;
$('#volunteer-sessions select').each(function(i) {
width = $(this).parents('.form-item').width();
$(this).width(width);
});
$('.chzn-container').width(width);
$('.chzn-search input').width(width - 40);
$('.chzn-drop').width(width - 2);
$('#volunteer-sessions').css('padding-bottom', $('#volunteer-sessions').height() / 3 );
}

Drupal.behaviors.prepareVolunteerUI = {
attach: function(context) {
volunteerUI();
$(window).resize(volunteerUI);
$('input[type="text"]', context).on('focus click', function() {
$(this).select()
});
}
};

// jQuery plugin to invoke from AJAX callback
$.fn.scrollSessions = function() {
var pos = $(this).scrollTop();
if ($(this).scrollTop() < $(window).height() - 100) {
$.scrollTo( this, 400, {offset: -100} );
$('.form-item-field-session-hours-und-0-value input.ui-widget', this).focus();
}
return this;
}

// Toggle fields
Drupal.behaviors.toggleFields = {
attach: function(context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,6 @@ function townsquare_volunteer_permission() {
);
}

/**
* Implements hook_libraries_info().
*/
function townsquare_volunteer_libraries_info() {
$libraries = array();
$libraries['scrollto'] = array(
'title' => 'jQuery Scroll to library',
'version' => '1.4.2',
'files' => array(
'js' => array('jquery.scrollTo.js'),
),
);
return $libraries;
}

/**
* Implements hook_form_alter().
*/
Expand Down Expand Up @@ -291,7 +276,6 @@ function townsquare_volunteer_session_ajax_callback($form, $form_state) {
node_save($new_session);
$new_form = drupal_get_form('volunteer_session_node_form', $new_session);
$commands[] = ajax_command_append('#volunteer-sessions', drupal_render($new_form));
$commands[] = ajax_command_invoke('#volunteer-session-form-'. $node->nid, 'scrollSessions');
}
else {
if ($element['#parents'][0] == 'field_session_hours') {
Expand Down

0 comments on commit f0abc31

Please sign in to comment.