aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/AdminTools/template/public_controller.js
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2014-08-23 11:47:32 +0000
committermistic100 <mistic@piwigo.org>2014-08-23 11:47:32 +0000
commit0c93a1c479329c3427808587a5d4ed84a0c3a497 (patch)
tree39fdc9d10aa63b84759e7b1466fae42cff4d9d33 /plugins/AdminTools/template/public_controller.js
parent84779415bd970c4850eaaa0573fb687d7f3e1bf4 (diff)
Ctrl+E opens the quick edit popup
git-svn-id: http://piwigo.org/svn/trunk@29255 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'plugins/AdminTools/template/public_controller.js')
-rw-r--r--plugins/AdminTools/template/public_controller.js96
1 files changed, 54 insertions, 42 deletions
diff --git a/plugins/AdminTools/template/public_controller.js b/plugins/AdminTools/template/public_controller.js
index 142cded3b..7a61b5c9c 100644
--- a/plugins/AdminTools/template/public_controller.js
+++ b/plugins/AdminTools/template/public_controller.js
@@ -241,7 +241,7 @@ var AdminTools = function($) {
// try to find background color matching text color
// there is a 1s delay to wait for jQuery Mobile initialization
- setTimeout(function() {
+ function bgColor() {
var bg_color = 'white';
var selectors = ['#the_page #content', '[data-role="page"]', 'body'];
@@ -254,19 +254,13 @@ var AdminTools = function($) {
}
$ato_edit.css('background-color', bg_color);
- }, 1000);
+ }
$ato_edit.find('.close-edit').on('click', function(e) {
$.colorbox.close()
e.preventDefault();
});
- if (is_picture) {
- $ato_edit.find('.datepicker').datepicker({
- dateFormat: 'yy-mm-dd'
- });
- }
-
$(".edit-quick").colorbox({
inline: true,
transition: 'none',
@@ -275,44 +269,62 @@ var AdminTools = function($) {
top: 50,
title: $ato_edit.attr('title'),
- onOpen: function() {
- if (!is_picture) return;
-
- // fetch tags list on first open
- if ($(this).data('tags-init')) return;
+ onComplete: function() {
+ setTimeout(function() {
+ $('#quick_edit_name').focus();
+ }, 0);
+ },
- $.ajax({
- method: 'POST',
- url: __this.urlWS + 'pwg.tags.getList',
- dataType: 'json',
- success: function(data) {
- var tags = [];
- // convert to custom format
- for (var i=0, l=data.result.tags.length; i<l; i++) {
- tags.push({
- id: '~~'+ data.result.tags[i].id +'~~',
- name: data.result.tags[i].name
- });
+ onOpen: function() {
+ bgColor();
+
+ if (is_picture) {
+ $ato_edit.find('.datepicker').datepicker({
+ dateFormat: 'yy-mm-dd'
+ });
+
+ // fetch tags list on first open
+ if ($(this).data('tags-init')) return;
+
+ $.ajax({
+ method: 'POST',
+ url: __this.urlWS + 'pwg.tags.getList',
+ dataType: 'json',
+ success: function(data) {
+ var tags = [];
+ // convert to custom format
+ for (var i=0, l=data.result.tags.length; i<l; i++) {
+ tags.push({
+ id: '~~'+ data.result.tags[i].id +'~~',
+ name: data.result.tags[i].name
+ });
+ }
+
+ $ato_edit.find('.tags').tokenInput(
+ tags,
+ $.extend({
+ animateDropdown: false,
+ preventDuplicates: true,
+ allowFreeTagging: true
+ }, tokeninput_lang)
+ );
+
+ $.colorbox.resize();
+ $(this).data('tags-init', true);
+ },
+ error: function(xhr, text, error) {
+ alert(text + ' ' + error);
}
-
- $ato_edit.find('.tags').tokenInput(
- tags,
- $.extend({
- animateDropdown: false,
- preventDuplicates: true,
- allowFreeTagging: true
- }, tokeninput_lang)
- );
-
- $.colorbox.resize();
- $(this).data('tags-init', true);
- },
- error: function(xhr, text, error) {
- alert(text + ' ' + error);
- }
- });
+ });
+ }
}
});
+
+ // Ctrl+E opens the quick edit
+ Mousetrap.bind('mod+e', function(e) {
+ e.preventDefault();
+ $(".edit-quick").click();
+ });
};
return this;