Skip to content

Commit

Permalink
[cmd:help] show "Preferences" button when missing button on the toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Aug 3, 2017
1 parent a1cba08 commit 6cf34da
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 5 deletions.
4 changes: 2 additions & 2 deletions css/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@
.elfinder-button-icon-menu { background-position: 0 -752px; }
.elfinder-button-icon-colwidth { background-position: 0 -768px; }
.elfinder-button-icon-fullscreen { background-position: 0 -784px; }
.elfinder-button-icon-unfullscreen{ background-position: 0 -800px; }
.elfinder-button-icon-unfullscreen { background-position: 0 -800px; }
.elfinder-button-icon-empty { background-position: 0 -848px; }
.elfinder-button-icon-undo { background-position: 0 -864px; }
.elfinder-button-icon-redo { background-position: 0 -880px; }
.elfinder-button-icon-pref { background-position: 0 -896px; }
.elfinder-button-icon-preference { background-position: 0 -896px; }

/* button with dropdown menu*/
.elfinder .elfinder-menubutton { overflow:visible; }
Expand Down
19 changes: 19 additions & 0 deletions js/commands/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@
parts = self.options.view || ['about', 'shortcuts', 'help', 'preference', 'debug'],
tabDebug, i, helpSource, tabBase, tabNav, tabs, delta;

// force enable 'preference' tab
if ($.inArray('preference') === -1) {
parts.push('preference');
}

// debug tab require jQueryUI Tabs Widget
if (! $.fn.tabs) {
if ((i = $.inArray(parts, 'debug')) !== false) {
Expand Down Expand Up @@ -396,3 +401,17 @@
};

}).prototype = { forceLoad : true }; // this is required command

elFinder.prototype.commands.preference = function() {

this.linkedCmds = ['help'];
this.alwaysEnabled = true;

this.getstate = function() {
return 0;
};

this.exec = function() {
this.fm.exec('help', void(0), {tab: 'preference'});
};};

1 change: 1 addition & 0 deletions js/i18n/elfinder.LANG.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
'cmdempty' : 'Empty the folder', // from v2.1.25 added 22.06.2017
'cmdundo' : 'Undo', // from v2.1.27 added 31.07.2017
'cmdredo' : 'Redo', // from v2.1.27 added 31.07.2017
'cmdpreference': 'Preferences', // from v2.1.27 added 03.08.2017

/*********************************** buttons ***********************************/
'btnClose' : 'Close',
Expand Down
3 changes: 2 additions & 1 deletion js/i18n/elfinder.en.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* English translation
* @author Troex Nevelin <troex@fury.scancode.ru>
* @author Naoki Sawada <hypweb@gmail.com>
* @version 2017-08-02
* @version 2017-08-03
*/
// elfinder.en.js is integrated into elfinder.(full|min).js by jake build
if (typeof elFinder === 'function' && elFinder.prototype.i18) {
Expand Down Expand Up @@ -151,6 +151,7 @@ if (typeof elFinder === 'function' && elFinder.prototype.i18) {
'cmdempty' : 'Empty the folder', // from v2.1.25 added 22.06.2017
'cmdundo' : 'Undo', // from v2.1.27 added 31.07.2017
'cmdredo' : 'Redo', // from v2.1.27 added 31.07.2017
'cmdpreference': 'Preferences', // from v2.1.27 added 03.08.2017

/*********************************** buttons ***********************************/
'btnClose' : 'Close',
Expand Down
3 changes: 2 additions & 1 deletion js/i18n/elfinder.jp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Japanese translation
* @author Tomoaki Yoshida <info@yoshida-studio.jp>
* @author Naoki Sawada <hypweb@gmail.com>
* @version 2017-08-02
* @version 2017-08-03
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
Expand Down Expand Up @@ -158,6 +158,7 @@
'cmdempty' : 'フォルダーを空に', // from v2.1.25 added 22.06.2017
'cmdundo' : '元に戻す', // from v2.1.27 added 31.07.2017
'cmdredo' : 'やり直し', // from v2.1.27 added 31.07.2017
'cmdpreference': '環境設定', // from v2.1.27 added 03.08.2017

/*********************************** buttons ***********************************/
'btnClose' : '閉じる',
Expand Down
14 changes: 13 additions & 1 deletion js/ui/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ $.fn.elfindertoolbar = function(fm, opts) {
}
}

if (!self.children().length) {
panel = $('<div class="ui-widget-content ui-corner-all elfinder-buttonset"/>');
name = 'preference';
if (cmd = commands[name]) {
button = 'elfinder'+cmd.options.ui;
buttons[name] = $('<div/>')[button](cmd);
textLabel && buttons[name].find('.elfinder-button-text').show();
panel.prepend(buttons[name]);
self.prepend(panel);
}
}

(! self.data('swipeClose') && self.children().length)? self.show() : self.hide();
fm.trigger('toolbarload').trigger('uiresize');
},
Expand Down Expand Up @@ -85,7 +97,7 @@ $.fn.elfindertoolbar = function(fm, opts) {
},
},{
label : fm.i18n('toolbarPref'),
icon : 'pref',
icon : 'preference',
callback : function() {
fm.exec('help', void(0), {tab: 'preference'});
}
Expand Down

0 comments on commit 6cf34da

Please sign in to comment.