From 14e6f164613097a8db59d3115573592c93462f38 Mon Sep 17 00:00:00 2001 From: Zachary Vance Date: Mon, 25 May 2015 16:07:20 -0700 Subject: [PATCH] Make shortcuts toggle work, global shortcuts work --- dist/flowy.js | 8 ++++---- dist/flowy.unwrapped.js | 8 ++++---- src/library/shortcut.js | 2 +- src/views/app.js | 2 +- src/views/todo.js | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dist/flowy.js b/dist/flowy.js index b99ef65..f4d420e 100644 --- a/dist/flowy.js +++ b/dist/flowy.js @@ -210,7 +210,7 @@ var Shortcut = (function(document, _) { }); }, shortcutPressed: function(shortcut, object) { - if (shortcut.action) return shortcut.action(object.element, shortcut, object.type, object.options); + if (shortcut.action) return shortcut.action(object.element, shortcut, object.type, object.options || {}); }, onNewShortcut: function(f) { this.onNewShortcutCallbacks.push(f); @@ -534,7 +534,7 @@ var TodoView = Backbone.View.extend({ }, expand: function() { console.log("Expand not implemented"); // TODO - this.model.toggleCollapsed(); // TODO: Display change + //this.model.toggleCollapsed(); // TODO: Display change not showing, this is bug return false; }, zoomIn: function() { @@ -555,7 +555,7 @@ var TodoView = Backbone.View.extend({ }, moveTo: function(loc, options) { loc = _.defaults({}, loc, { parent: this.model.getParent(this.model.collection), index: this.model.getParent(this.model.collection).findChild(this.model.id) }); - options = _.defaults({}, options, { + options = _.defaults({}, options, { keyboard: false, // Whether the action was done with keyboard vs mouse (affects UI focus) }); console.log("Move not implemented"); @@ -869,7 +869,7 @@ var AppView = Backbone.View.extend({ el: $("#todo-app"), shortcutObject: "global", events: { - 'Shortcut("toggleShortcuts", "Keyboard Shortcuts", "ctrl+?") > .text': 'toggleShortcuts', + 'Shortcut("toggleShortcuts", "Keyboard Shortcuts", "ctrl+shift+/") > .text': 'toggleShortcuts', 'Shortcut("toggleShowCompleted", "Not Done - Show/hide completed", "ctrl+o") > .text': 'toggleShowCompleted', 'Shortcut("search", "Not Done - Search", "esc") > .text': 'search', }, diff --git a/dist/flowy.unwrapped.js b/dist/flowy.unwrapped.js index acfa2a6..ffb2d2e 100644 --- a/dist/flowy.unwrapped.js +++ b/dist/flowy.unwrapped.js @@ -209,7 +209,7 @@ var Shortcut = (function(document, _) { }); }, shortcutPressed: function(shortcut, object) { - if (shortcut.action) return shortcut.action(object.element, shortcut, object.type, object.options); + if (shortcut.action) return shortcut.action(object.element, shortcut, object.type, object.options || {}); }, onNewShortcut: function(f) { this.onNewShortcutCallbacks.push(f); @@ -533,7 +533,7 @@ var TodoView = Backbone.View.extend({ }, expand: function() { console.log("Expand not implemented"); // TODO - this.model.toggleCollapsed(); // TODO: Display change + //this.model.toggleCollapsed(); // TODO: Display change not showing, this is bug return false; }, zoomIn: function() { @@ -554,7 +554,7 @@ var TodoView = Backbone.View.extend({ }, moveTo: function(loc, options) { loc = _.defaults({}, loc, { parent: this.model.getParent(this.model.collection), index: this.model.getParent(this.model.collection).findChild(this.model.id) }); - options = _.defaults({}, options, { + options = _.defaults({}, options, { keyboard: false, // Whether the action was done with keyboard vs mouse (affects UI focus) }); console.log("Move not implemented"); @@ -868,7 +868,7 @@ var AppView = Backbone.View.extend({ el: $("#todo-app"), shortcutObject: "global", events: { - 'Shortcut("toggleShortcuts", "Keyboard Shortcuts", "ctrl+?") > .text': 'toggleShortcuts', + 'Shortcut("toggleShortcuts", "Keyboard Shortcuts", "ctrl+shift+/") > .text': 'toggleShortcuts', 'Shortcut("toggleShowCompleted", "Not Done - Show/hide completed", "ctrl+o") > .text': 'toggleShowCompleted', 'Shortcut("search", "Not Done - Search", "esc") > .text': 'search', }, diff --git a/src/library/shortcut.js b/src/library/shortcut.js index 8c97dbd..7269b87 100644 --- a/src/library/shortcut.js +++ b/src/library/shortcut.js @@ -148,7 +148,7 @@ var Shortcut = (function(document, _) { }); }, shortcutPressed: function(shortcut, object) { - if (shortcut.action) return shortcut.action(object.element, shortcut, object.type, object.options); + if (shortcut.action) return shortcut.action(object.element, shortcut, object.type, object.options || {}); }, onNewShortcut: function(f) { this.onNewShortcutCallbacks.push(f); diff --git a/src/views/app.js b/src/views/app.js index dc92050..fa573e8 100644 --- a/src/views/app.js +++ b/src/views/app.js @@ -63,7 +63,7 @@ var AppView = Backbone.View.extend({ el: $("#todo-app"), shortcutObject: "global", events: { - 'Shortcut("toggleShortcuts", "Keyboard Shortcuts", "ctrl+?") > .text': 'toggleShortcuts', + 'Shortcut("toggleShortcuts", "Keyboard Shortcuts", "ctrl+shift+/") > .text': 'toggleShortcuts', 'Shortcut("toggleShowCompleted", "Not Done - Show/hide completed", "ctrl+o") > .text': 'toggleShowCompleted', 'Shortcut("search", "Not Done - Search", "esc") > .text': 'search', }, diff --git a/src/views/todo.js b/src/views/todo.js index 56feefd..f7816a1 100644 --- a/src/views/todo.js +++ b/src/views/todo.js @@ -144,7 +144,7 @@ var TodoView = Backbone.View.extend({ }, expand: function() { console.log("Expand not implemented"); // TODO - this.model.toggleCollapsed(); // TODO: Display change + //this.model.toggleCollapsed(); // TODO: Display change not showing, this is bug return false; }, zoomIn: function() { @@ -165,7 +165,7 @@ var TodoView = Backbone.View.extend({ }, moveTo: function(loc, options) { loc = _.defaults({}, loc, { parent: this.model.getParent(this.model.collection), index: this.model.getParent(this.model.collection).findChild(this.model.id) }); - options = _.defaults({}, options, { + options = _.defaults({}, options, { keyboard: false, // Whether the action was done with keyboard vs mouse (affects UI focus) }); console.log("Move not implemented"); -- 2.47.3