DrupalBin
Submit Code
About
Recent Posts
Code
27 min 46 sec
ago
Fix for double entries
44 min 34 sec
ago
Code
53 min 14 sec
ago
double entries
1 hour 4 min
ago
more
Tags
CCK
drupal
fapi
jquery
menu
module
Panels
php
simpletest
test
theme
views
more tags
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Create new account
Request new password
Log in using OpenID
Cancel OpenID login
Home
Fix for Panels show/hide panes js
View
Download
Fix
This fix will not be saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Source code:
*
/** Toggle pane show/hide button **/ Drupal.Panels.bindClickToggleHidden = function (o) { $('input.pane-toggle-hidden').unbind('click'); $('input.pane-toggle-hidden').click(function() { var id = $(this)[0].id.replace('edit-button-', '').replace('-show-hide', ''); var op = $(this)[0].title.replace(' this pane', ''); $.ajax({ type: "POST", url: Drupal.settings.panelsAjaxURL + "/toggle-hidden/" + $('#panel-did').val() + '/' + id + '/' + op, data: '', global: true, success: Drupal.Panels.Subform.bindAjaxResponse, error: function() { alert("An error occurred while attempting to toggle the pane's hidden status.")}, dataType: 'json' }); return false; }); } // it's just the extra else if I added, but i included the whole thing for completeness Drupal.Panels.Subform.bindAjaxResponse = function(data) { // On success, append the returned HTML to the panel's element. if (data.type == 'display') { // append the output $('#modalContent span.modal-title').html(data.title); $('#modalContent div.modal-content').html(data.output); // TODO this is the code that we want to see go away var url = data.url; if (!url) { url = Drupal.settings.panelsAjaxURL + '/submit-form/' + $('#panel-did').val(); } // Bind forms to ajax submit. $('div.panels-modal-content form').unbind('submit'); // be safe here. $('div.panels-modal-content form').submit(function() { $(this).ajaxSubmit({ url: url, data: '', method: 'post', after: Drupal.Panels.Subform.bindAjaxResponse, dataType: 'json' }); return false; }); // Bind links to ajax links. $('a.panels-modal-add-config').click(Drupal.Panels.Subform.bindClickAddLink); if ($('#override-title-checkbox').size()) { Drupal.Panels.Checkboxes.bindCheckbox('#override-title-checkbox', ['#override-title-textfield']); } if ($('#use-pager-checkbox').size()) { Drupal.Panels.Checkboxes.bindCheckbox('#use-pager-checkbox', ['#use-pager-textfield']); } // hack: allow collapsible textareas to work Drupal.Panels.Subform.bindCollapsible(); Drupal.Panels.Subform.bindAutocomplete(); } else if (data.type == 'add') { // Give it all the goodies that our existing panes have. $('#panel-pane-' + data.region).append(data.output); Drupal.Panels.attachPane('#panel-pane-' + data.id); Drupal.Panels.changed($('#panel-pane-' + data.id)); // dismiss the dialog $('#panels-modal').unmodalContent(); } else if (data.type == 'replace') { $('#panel-pane-' + data.id + ' .panel-pane-collapsible') .html(data.output) .each(Drupal.Panels.bindPortlet); Drupal.Panels.changed($('#panel-pane-' + data.id)); // dismiss the dialog $('#panels-modal').unmodalContent(); } else if (data.type == 'toggle-hidden') { if (data.op == '1') { var verb = 'Hide'; } else { var verb = 'Show'; } $('#panel-pane-' + data.id).toggleClass('hidden-pane'); $('#panel-pane-' + data.id + ' input.pane-hidden').attr({ title: verb + " this pane", alt: verb + " this pane", src: "icon-" + data.output + "pane.png" }); Drupal.Panels.changed($('#panel-pane-' + data.id)); } else { // just dismiss the dialog. $('#panels-modal').unmodalContent(); } }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal
Drupal 5
Drupal 6
HTML
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.