Skip to content

Commit

Permalink
upgrade jqueryui to 1.9b1, closes: #9493 refs: #9492
Browse files Browse the repository at this point in the history
wins:
* we now have a tooltip widget
* no more having both jqueryui 1.8 and alpha 1.9
  stuff on the same page

for more info:
http://blog.jqueryui.com/2012/06/jquery-ui-1-9-beta/
info about tooltips:
http://wiki.jqueryui.com/w/page/12138112/Tooltip

test plan:
interact with as many jquery ui widgets as possible
e.g.: wiki sidebar (the tabs and accordion), gradebook2
(and all of its dialogs), date pickers, help dialog, etc

Change-Id: I2c1c0d761a99c972fd8ae704ee3782140955ce3c
Reviewed-on: https://gerrit.instructure.com/12258
Tested-by: Jenkins <[email protected]>
Reviewed-by: Jon Jensen <[email protected]>
  • Loading branch information
ryankshaw committed Aug 13, 2012
1 parent 81dc9b7 commit 8403f9a
Show file tree
Hide file tree
Showing 61 changed files with 7,543 additions and 6,406 deletions.
1 change: 0 additions & 1 deletion app/coffeescripts/bundles/common.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ require [
# other stuff several bundles use
'media_comments'
'order'
'jqueryui/effects/core'
'jqueryui/effects/drop'
'jqueryui/progressbar'
'jqueryui/tabs'
Expand Down
4 changes: 2 additions & 2 deletions app/coffeescripts/gradebook2/Gradebook.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,8 @@ define [
@buildRows()

# don't show the "show attendance" link in the dropdown if there's no attendance assignments
unless (_.detect @gradeGrid.getColumns(), (col) -> col.object?.submission_types == "attendance")
$settingsMenu.find('#show_attendance').hide()
unless (_.detect @assignments, (a) -> (''+a.submission_types) == "attendance")
$settingsMenu.find('#show_attendance').closest('li').hide()

@$columnArrangementTogglers = $('#gradebook-toolbar [data-arrange-columns-by]').bind 'click', (event) =>
event.preventDefault()
Expand Down
6 changes: 3 additions & 3 deletions app/coffeescripts/jquery.kylemenu.coffee
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
define [
'jquery'
'jquery.ui.menu.inputmenu'
'vendor/jquery.ui.popup-1.9'
'vendor/jquery.ui.button-1.9'
], ($, _inputmenu, _popup, _button) ->
'jqueryui/button'
'jqueryui/popup'
], ($) ->

class KyleMenu
constructor: (trigger, options) ->
Expand Down
6 changes: 3 additions & 3 deletions app/stylesheets/jqueryui/_jquery.ui.tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@
font-weight: bold;
text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
&.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px;
&.ui-tabs-active { margin-bottom: 0; padding-bottom: 1px;
// need to override filter or bg gradiant will remain in IE
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(enabled = false)";
background: $bgColorContent;
border-color: $borderColorContent;
box-shadow: none;
a { color: $fcDefault; }
}
&.ui-tabs-selected, &.ui-state-disabled, &.ui-state-processing {
&.ui-tabs-active, &.ui-state-disabled, &.ui-state-processing {
a { cursor: text; }
}
}
}
.ui-tabs-nav li a, &.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs-nav li a, &.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs-panel { display: block; padding: 1em 1.4em;
background-color: $bgColorContent;
border-width: 0 1px 1px 1px;
Expand Down
1 change: 0 additions & 1 deletion config/build.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
'vendor/jquery.spin',
'jquery.google-analytics',
'vendor/jquery.ba-hashchange',
'vendor/jqueryui/effects/core',
'vendor/jqueryui/effects/drop',
'compiled/jquery.rails_flash_notifications',
'translations/scribd',
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/assignments.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ define([
$group.find(".padding").show();
var doWeighting = $("#class_weighting_policy").attr('checked');
$group.find(".assignment_list").sortable(assignment_sortable_options);
$(".assignment_group .assignment_list").sortable('option', 'connectWith', '.assignment_group .assignment_list');
$("#groups.groups_editable .assignment_group .assignment_list").sortable('option', 'connectWith', '.assignment_group .assignment_list');
editGroup($group);
});
$(".edit_group_link").click(function(event) {
Expand Down
16 changes: 8 additions & 8 deletions public/javascripts/context_modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ define([
$item.loadingImage('remove');
var $module = $("#context_module_" + data.content_tag.context_module_id);
modules.addItemToModule($module, data.content_tag);
$module.find(".context_module_items").sortable('refresh');
$module.find(".context_module_items.ui-sortable").sortable('refresh');
modules.updateAssignmentData();
}, function(data) {
});
Expand Down Expand Up @@ -666,7 +666,7 @@ define([
$(this).loadingImage('remove');
var $module = $("#context_module_" + data.content_tag.context_module_id);
var $item = modules.addItemToModule($module, data.content_tag);
$module.find(".context_module_items").sortable('refresh');
$module.find(".context_module_items.ui-sortable").sortable('refresh');
if (data.content_tag.content_id != 0) {
modules.updateAllItemInstances(data.content_tag);
}
Expand Down Expand Up @@ -700,8 +700,8 @@ define([
var $module = $("#context_module_blank").clone(true).attr('id', 'context_module_new');
$("#context_modules").append($module);
$module.find(".context_module_items").sortable(modules.sortable_module_options);
$("#context_modules").sortable('refresh');
$("#context_modules .context_module .context_module_items").each(function() {
$("#context_modules.ui-sortable").sortable('refresh');
$("#context_modules .context_module .context_module_items.ui-sortable").each(function() {
$(this).sortable('refresh');
$(this).sortable('option', 'connectWith', '.context_module_items');
});
Expand All @@ -725,15 +725,15 @@ define([
options.submit = function(item_data) {
var $module = $("#context_module_" + module.id);
var $item = modules.addItemToModule($module, item_data);
$module.find(".context_module_items").sortable('refresh');
$module.find(".context_module_items.ui-sortable").sortable('refresh');
var url = $module.find(".add_module_item_link").attr('rel');
$item.loadingImage({image_size: 'small'});
$.ajaxJSON(url, 'POST', item_data, function(data) {
$item.loadingImage('remove');
$item.remove();
data.content_tag.type = item_data['item[type]'];
modules.addItemToModule($module, data.content_tag);
$module.find(".context_module_items").sortable('refresh');
$module.find(".context_module_items.ui-sortable").sortable('refresh');
modules.updateAssignmentData();
});
};
Expand Down Expand Up @@ -990,7 +990,7 @@ define([
modules.addItemToModule($module, item.content_tag);
next();
} else {
$module.find(".context_module_items").sortable('refresh');
$module.find(".context_module_items.ui-sortable").sortable('refresh');
toggle(true);
modules.updateProgressionState($module);
$("#context_modules").triggerHandler('slow_load');
Expand All @@ -1003,7 +1003,7 @@ define([
for(var idx in data) {
modules.addItemToModule($module, data[idx].content_tag);
}
$module.find(".context_module_items").sortable('refresh');
$module.find(".context_module_items.ui-sortable").sortable('refresh');
toggle();
modules.updateProgressionState($module);
}
Expand Down
11 changes: 8 additions & 3 deletions public/javascripts/course_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
define([
'i18n!course_settings',
'jquery' /* $ */,
'underscore',
'jquery.ajaxJSON' /* ajaxJSON */,
'jquery.instructure_date_and_time' /* parseFromISO, date_field */,
'jquery.instructure_forms' /* formSubmit, fillFormData, getFormData, formErrors */,
Expand All @@ -34,7 +35,7 @@ define([
'jqueryui/autocomplete' /* /\.autocomplete/ */,
'jqueryui/sortable' /* /\.sortable/ */,
'jqueryui/tabs' /* /\.tabs/ */
], function(I18n, $) {
], function(I18n, $, _) {

var GradePublishing = {
status: null,
Expand Down Expand Up @@ -116,9 +117,13 @@ define([
$course_form = $("#course_form"),
$hashtag_form = $(".hashtag_form"),
$course_hashtag = $("#course_hashtag"),
$enrollment_dialog = $("#enrollment_dialog");
$enrollment_dialog = $("#enrollment_dialog"),
$tabBar = $("#course_details_tabs"),
// as of jqueryui 1.9, the cookie trumps the fragment :(. so we hack
// around that here
initialTab = _.indexOf(_.pluck($tabBar.find('> ul a'), 'hash'), location.hash);

$("#course_details_tabs").tabs({cookie: {}}).show();
$tabBar.tabs({cookie: {}, active: initialTab >= 0 ? initialTab : null}).show();

$add_section_form.formSubmit({
required: ['course_section[name]'],
Expand Down
97 changes: 63 additions & 34 deletions public/javascripts/jquery.ui.menu.inputmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*/
define([
'jquery',
'vendor/jquery.ui.menu-1.9'
], function( $, _menu ) {
'jqueryui/menu'
], function( $ ) {

var proto = $.ui.menu.prototype,
originalRefresh = proto.refresh;
Expand All @@ -20,31 +20,41 @@ $.extend( proto, {
var that = this;
var items = this.element.find( "li.ui-menu-item" );
var inputGroupLabeled = false;

this.element.bind( "click.menu", function( event ) {
if( !new RegExp(/^a$/i).test(event.target.tagName) ) event.preventDefault();
});

var inputIDCount = 0;
this.element.find( "input[type='checkbox'], input[type='radio']" ).each( function() {
var labelElement = $( this ).closest( "label" );
if( labelElement.length ) {
$( this ).insertBefore( labelElement );

if( !$( this ).attr( "id" ) ) {
$( this ).attr( "id", "ui-input-" + inputIDCount++ );
}

labelElement.attr( "for", $( this ).attr( "id" ) );
}
});
this.element.bind( "menufocus", function( event ) {
var textInput = $( event.target ).find( "a.ui-state-focus" ).children( "input[type='text']" );
if ( textInput.length )
textInput[0].focus();
})
.bind( "menublur", function( event ) {
var textInput = $( event.target ).find( "input[type='text']:focus" );
if ( textInput.length )
textInput[0].blur();
});

items.children( "a" ).each( function( index, item ) {
var current = $( item ), parent = current.parent();

if( current.children().is( "input[type='checkbox'], input[type='radio']" ) ) {
current.closest( "ul" ).addClass( "ui-menu-icons" );

if( current.children( "input[type='checkbox']" ).is( ":checked" ) ) {
current.prepend( '<span class="ui-icon ui-icon-check"></span>' );
parent.attr({
Expand All @@ -69,7 +79,7 @@ $.extend( proto, {
"aria-checked": "false"
});
}

if( current.children().is( "input[type='radio']" ) ) {
parent.attr( "radio-group", current.children( "input[type='radio']" ).attr( "name" ) );
}
Expand All @@ -78,26 +88,27 @@ $.extend( proto, {
parent.prev()
.addClass( "ui-state-disabled" )
.html( "<span class='ui-menu-input-group'>" + parent.prev().text() + "</span>" )
.bind( "click.menu", false )
.after( '<li class="ui-menu-item"><hr /></li>' );
.bind( "click.menu", function( event ) {
return false;
}).after( "<li><hr /></li>" );
inputGroupLabeled = true;
}
else if( parent.prev().length && !parent.prev().children( "a" ).children().is( "input[type='checkbox'], input[type='radio']" ) ) {
parent.before( "<li><hr /></li>" );
}

if( inputGroupLabeled && parent.next().length && !parent.next().children( "a" ).children().is( "input[type='checkbox'], input[type='radio']" ) ) {
parent.after( "<li><hr /></li>" );
inputGroupLabeled = false;
}
else if( parent.next().length && !parent.next().children( "a" ).children().is( "input[type='checkbox'], input[type='radio']" ) ) {
parent.after( "<li><hr /></li>" );
}

current.children( "input[type='checkbox'], input[type='radio']" ).hide();
}
});

items.bind( "keydown.menu", function( event ) {
if( event.keyCode === $.ui.keyCode.SPACE ) {
if ( that.active.children( "a" ).children().is( "input[type='checkbox'], input[type='radio']" ) ) {
Expand All @@ -107,41 +118,59 @@ $.extend( proto, {
event.preventDefault();
}
});

items.find( "input[type='text']" ).bind( "keydown", function( event ) {
event.stopPropagation();
if( event.keyCode === $.ui.keyCode.UP ) {
that.element.trigger( "focus" );
this.blur();
that.focus( event, $( this ).closest( ".ui-menu-item").prev() );
}
if( event.keyCode === $.ui.keyCode.DOWN ) {
that.element.trigger( "focus" );
this.blur();
that.focus( event, $( this ).closest( ".ui-menu-item").next() );
}
})
.bind( "click", function( event ) {
event.stopPropagation();
});
},
select: function( event ) {
// save active reference before closeAll triggers blur
// Save active reference before collapseAll triggers blur
var ui = {
item: this.active
// Selecting a menu item removes the active item causing multiple clicks to be missing an item
item: this.active || $( event.target ).closest( ".ui-menu-item" )
};

if( this.active.children( "a" ).children().is( "input[type='checkbox']" ) ) {
if( this.active.attr( "aria-checked" ) === "false" ) {
this.active.children( "a" ).prepend( '<span class="ui-icon ui-icon-check"></span>' );
this.active.attr( "aria-checked", "true" );
this.active.children( "a" ).children( "input[type='checkbox']" ).prop( "checked", "checked" ).trigger('change');
} else if( this.active.attr( "aria-checked") === "true" ) {
this.active.children( "a" ).children( "span.ui-icon-check" ).remove();
this.active.attr( "aria-checked", "false" );
this.active.children( "a" ).children( "input[type='checkbox']" ).removeAttr( "checked" ).trigger('change');
if( ui.item.children( "a" ).children().is( "input[type='checkbox']" ) ) {
if( ui.item.attr( "aria-checked" ) === "false" ) {
ui.item.children( "a" ).prepend( '<span class="ui-icon ui-icon-check"></span>' );
ui.item.attr( "aria-checked", "true" );
ui.item.children( "a" ).children( "input[type='checkbox']" ).prop( "checked", "checked" ).trigger('change');
} else if( ui.item.attr( "aria-checked") === "true" ) {
ui.item.children( "a" ).children( "span.ui-icon-check" ).remove();
ui.item.attr( "aria-checked", "false" );
ui.item.children( "a" ).children( "input[type='checkbox']" ).removeAttr( "checked" ).trigger('change');
}
}

if( this.active.children( "a" ).children().is( "input[type='radio']" ) ) {
if( this.active.attr( "aria-checked" ) === "false" ) {
this.active.children( "a" ).children( "span.ui-icon-radio-off" ).toggleClass( "ui-icon-radio-on ui-icon-radio-off" );
this.active.attr( "aria-checked", "true" );
this.active.children( "a" ).children( "input[type='radio']" ).prop( "checked", "checked" ).trigger('change');
this.active.siblings( "[radio-group=" + $( this.active ).attr( "radio-group" ) + "]" ).each( function() {
if( ui.item.children( "a" ).children().is( "input[type='radio']" ) ) {
if( ui.item.attr( "aria-checked" ) === "false" ) {
ui.item.children( "a" ).children( "span.ui-icon-radio-off" ).toggleClass( "ui-icon-radio-on ui-icon-radio-off" );
ui.item.attr( "aria-checked", "true" );
ui.item.children( "a" ).children( "input[type='radio']" ).prop( "checked", "checked" ).trigger('change');
ui.item.siblings( "[radio-group=" + $( ui.item ).attr( "radio-group" ) + "]" ).each( function() {
$( this ).attr( "aria-checked", "false" );
$( this ).children( "a" ).children( "span.ui-icon-radio-on" ).toggleClass( "ui-icon-radio-on ui-icon-radio-off" );
$( this ).children( "a" ).children( "input[type='radio']" ).removeAttr( "checked" );
});
}
}
if( !this.active.children( "a" ).children().is( "input[type='checkbox'], input[type='radio']" ) ) this.collapseAll();

if( !ui.item.children( "a" ).children().is( "input[type='checkbox'], input[type='radio']" ) ) this.collapseAll();
this._trigger( "select", event, ui );
}
});

});
});
6 changes: 3 additions & 3 deletions public/javascripts/learning_outcomes.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ define([
$("#outcomes .outcome_group:first").append($group.show());
$("#outcomes .outcome_group:first .child_outcomes").sortable('refresh');
$group.find('.child_outcomes').sortable(outcomes.sortableOptions);
$(".outcome_group .child_outcomes").sortable('option', 'connectWith', '.child_outcomes');
$("#outcomes .outcome_group .child_outcomes").sortable('option', 'connectWith', '.child_outcomes');
}
group.asset_string = $.underscore("learning_outcome_group_" + group.id);
$group.find("textarea.description").val(group.description);
Expand Down Expand Up @@ -183,10 +183,10 @@ define([
outcomes.hideEditOutcomeGroup();
if(!$group || $group.length === 0) {
$group = $("#group_blank").clone(true).attr('id', 'group_new');
$("#outcomes .child_outcomes:first").append($group.show());
$("#outcomes .outcome_group:first .child_outcomes").sortable('refresh');
$("#outcomes .child_outcomes:first").append($group.show());
$group.find('.child_outcomes').sortable(outcomes.sortableOptions);
$(".outcome_group .child_outcomes").sortable('option', 'connectWith', '.child_outcomes');
$("#outcomes .outcome_group .child_outcomes").sortable('option', 'connectWith', '.child_outcomes');
}
var $form = $("#edit_outcome_group_form");
$form.attr('action', $group.find(".edit_group_link").attr('href'));
Expand Down
Loading

0 comments on commit 8403f9a

Please sign in to comment.