aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/AdminTools/template/public_controller.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-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;