Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* better humanization of file size values * more translations * separated Dialog component ... maybe travells further away * fixed filtering for no result hiding the widget all together * added dialog triggered by the paste event to change the filename of the clipboard content being uploaded
- Loading branch information
1 parent
d3368e7
commit d3e63c5
Showing
12 changed files
with
399 additions
and
201 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
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
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
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
112 changes: 112 additions & 0 deletions
112
pub/System/TopicInteractionPlugin/dialog.uncompressed.js
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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
(c)opyright 2017 Michael Daum http://michaeldaumconsulting.com | ||
are listed in the AUTHORS file in the root of this distribution. | ||
NOTE: Please extend that file, not this notice. | ||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. For | ||
more details read LICENSE in the root of this distribution. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
As per the GPL, removal of this notice is prohibited. | ||
*/ | ||
|
||
/*eslint-disable no-console */ | ||
|
||
"use strict"; | ||
var Dialog; | ||
|
||
(function($) { | ||
|
||
var defaults = { | ||
"template": "metadata", | ||
"debug": false | ||
}; | ||
|
||
/* constructor **********************************************************/ | ||
Dialog = function(opts) { | ||
var self = this; | ||
|
||
self.opts = $.extend({}, defaults, opts); | ||
}; | ||
|
||
/* shortcut *************************************************************/ | ||
Dialog.load = function(opts) { | ||
var dialog = new Dialog(opts); | ||
return dialog.load(); | ||
}; | ||
|
||
/* logger ***************************************************************/ | ||
Dialog.prototype.log = function() { | ||
var self = this, args; | ||
|
||
if (!console || !self.opts.debug) { | ||
return; | ||
} | ||
|
||
args = $.makeArray(arguments); | ||
args.unshift("DIALOG:"); | ||
console.log.apply(console, args); | ||
}; | ||
|
||
|
||
/* load *****************************************************************/ | ||
Dialog.prototype.load = function(params) { | ||
var self = this, | ||
opts = $.extend({}, self.opts, params), | ||
$dialog = typeof(opts.id) === 'undefined'?undefined:$(opts.id), | ||
data, | ||
dfd = $.Deferred(); | ||
|
||
self.log("called load() opts=",opts); | ||
|
||
function callback(elem) { | ||
if (typeof(opts.init) === 'function') { | ||
opts.init.call(elem); | ||
} | ||
} | ||
|
||
if ($dialog && $dialog.length) { | ||
$dialog.dialog("open"); | ||
$dialog.find("form").resetForm(); | ||
callback($dialog); | ||
dfd.resolve($dialog); | ||
} else { | ||
|
||
data = $.extend({}, opts.data, { | ||
name: opts.template, | ||
expand: opts.expand, | ||
topic: foswiki.getPreference("WEB")+"."+foswiki.getPreference("TOPIC") | ||
}); | ||
|
||
$.ajax({ | ||
url: foswiki.getScriptUrl("rest", "RenderPlugin", "template"), | ||
data: data, | ||
dataType: 'html', | ||
success: function(data) { | ||
var $dialog = $(data); | ||
$dialog.on("dialogopen", function() { | ||
callback($dialog); | ||
dfd.resolve($dialog); | ||
}); | ||
$dialog.appendTo("body"); | ||
}, | ||
error: function(xhr, status, err) { | ||
dfd.reject($dialog, status, err); | ||
} | ||
}); | ||
} | ||
|
||
return dfd.promise(); | ||
}; | ||
})(jQuery); |
Oops, something went wrong.