Merge remote-tracking branch 'PayBas/ticket/12541' into develop-ascraeus

* PayBas/ticket/12541:
  [ticket/12541] Activate attachments tab when files are dropped into textarea

Conflicts:
	phpBB/styles/prosilver/template/forum_fn.js
This commit is contained in:
Cesar G 2014-06-04 23:07:02 -07:00
commit 49c875413c
2 changed files with 31 additions and 16 deletions

View file

@ -586,6 +586,11 @@ uploader.bind('FilesAdded', function(up, files) {
return; return;
} }
// Switch the active tab if the style supports it
if (typeof activateSubPanel == 'function') {
activateSubPanel('attach-panel');
}
// Show the file list if there aren't any files currently. // Show the file list if there aren't any files currently.
if (!$('#file-list-container').is(':visible')) { if (!$('#file-list-container').is(':visible')) {
$('#file-list-container').show(100); $('#file-list-container').show(100);

View file

@ -104,14 +104,19 @@ jQuery(document).ready(function() {
show_panel = this.getAttribute('data-show-panel'); show_panel = this.getAttribute('data-show-panel');
if (panels.length) { if (panels.length) {
subPanels(show_panel); activateSubPanel(show_panel, panels);
childNodes.click(function () { childNodes.click(function () {
subPanels(this.getAttribute('data-subpanel')); activateSubPanel(this.getAttribute('data-subpanel'), panels);
return false; return false;
}); });
} }
});
});
function subPanels(p) { /**
* Activate specific subPanel
*/
function activateSubPanel(p, panels) {
var i; var i;
if (typeof(p) === 'string') { if (typeof(p) === 'string') {
@ -119,13 +124,18 @@ jQuery(document).ready(function() {
} }
$('input[name="show_panel"]').val(show_panel); $('input[name="show_panel"]').val(show_panel);
if (typeof(panels) === 'undefined') {
panels = [];
jQuery('.sub-panels a[data-subpanel]').each(function() {
panels.push(this.getAttribute('data-subpanel'));
});
}
for (i = 0; i < panels.length; i++) { for (i = 0; i < panels.length; i++) {
jQuery('#' + panels[i]).css('display', panels[i] === show_panel ? 'block' : 'none'); jQuery('#' + panels[i]).css('display', panels[i] === show_panel ? 'block' : 'none');
jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === show_panel); jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === show_panel);
} }
} }
});
});
/** /**
* Call print preview * Call print preview