forked from pressflow/7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Patch #1420048 by nod_, droplet: fixed menu* JS indention.
- Loading branch information
Showing
2 changed files
with
38 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,46 @@ | ||
|
||
(function ($) { | ||
|
||
Drupal.behaviors.menuChangeParentItems = { | ||
attach: function (context, settings) { | ||
$('fieldset#edit-menu input').each(function () { | ||
$(this).change(function () { | ||
// Update list of available parent menu items. | ||
Drupal.menu_update_parent_list(); | ||
}); | ||
Drupal.behaviors.menuChangeParentItems = { | ||
attach: function (context, settings) { | ||
$('fieldset#edit-menu input').each(function () { | ||
$(this).change(function () { | ||
// Update list of available parent menu items. | ||
Drupal.menu_update_parent_list(); | ||
}); | ||
} | ||
}; | ||
}); | ||
} | ||
}; | ||
|
||
/** | ||
* Function to set the options of the menu parent item dropdown. | ||
*/ | ||
Drupal.menu_update_parent_list = function () { | ||
var values = []; | ||
/** | ||
* Function to set the options of the menu parent item dropdown. | ||
*/ | ||
Drupal.menu_update_parent_list = function () { | ||
var values = []; | ||
|
||
$('input:checked', $('fieldset#edit-menu')).each(function () { | ||
// Get the names of all checked menus. | ||
values.push(Drupal.checkPlain($.trim($(this).val()))); | ||
}); | ||
$('input:checked', $('fieldset#edit-menu')).each(function () { | ||
// Get the names of all checked menus. | ||
values.push(Drupal.checkPlain($.trim($(this).val()))); | ||
}); | ||
|
||
var url = Drupal.settings.basePath + 'admin/structure/menu/parents'; | ||
$.ajax({ | ||
url: location.protocol + '//' + location.host + url, | ||
type: 'POST', | ||
data: {'menus[]' : values}, | ||
dataType: 'json', | ||
success: function (options) { | ||
// Save key of last selected element. | ||
var selected = $('fieldset#edit-menu #edit-menu-parent :selected').val(); | ||
// Remove all exisiting options from dropdown. | ||
$('fieldset#edit-menu #edit-menu-parent').children().remove(); | ||
// Add new options to dropdown. | ||
jQuery.each(options, function(index, value) { | ||
$('fieldset#edit-menu #edit-menu-parent').append( | ||
$('<option ' + (index == selected ? ' selected="selected"' : '') + '></option>').val(index).text(value) | ||
); | ||
}); | ||
} | ||
}); | ||
}; | ||
var url = Drupal.settings.basePath + 'admin/structure/menu/parents'; | ||
$.ajax({ | ||
url: location.protocol + '//' + location.host + url, | ||
type: 'POST', | ||
data: {'menus[]' : values}, | ||
dataType: 'json', | ||
success: function (options) { | ||
// Save key of last selected element. | ||
var selected = $('fieldset#edit-menu #edit-menu-parent :selected').val(); | ||
// Remove all exisiting options from dropdown. | ||
$('fieldset#edit-menu #edit-menu-parent').children().remove(); | ||
// Add new options to dropdown. | ||
jQuery.each(options, function(index, value) { | ||
$('fieldset#edit-menu #edit-menu-parent').append( | ||
$('<option ' + (index == selected ? ' selected="selected"' : '') + '></option>').val(index).text(value) | ||
); | ||
}); | ||
} | ||
}); | ||
}; | ||
|
||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
(function ($) { | ||
|
||
Drupal.behaviors.menuFieldsetSummaries = { | ||
|