background: #ffffff;
}
-#shortcuts {
+#shortcuts-wrapper {
position: fixed;
- height: 100%;
- top: -2px;
+ bottom: -2px;
left: 10px;
width: 200px;
background: #ffffff;
+}
+
+.shortcuts {
border-collapse: collapse;
- border-spacing: 0;
- border: 0;
- padding: 0;
+ box-shadow: 0 2px 12px rgba(0,0,0,0.6);
+ display: block;
}
-.shortcut-description {
+.shortcuts .description {
background-color: #efefef;
max-width: 80px;
padding: 0 0 0 7px;
}
-.shortcut-keybinding {
+.shortcuts .keybinding {
padding: 0 0 0 7px;
}
border-top: 0;
border-bottom: 1px solid #aaa;
}
+
+#shortcuts-wrapper .title {
+ padding: 10px;
+ font-size: 100%;
+ border-bottom: 1px solid #979797
+ font-weight: bold;
+ background: -webkit-gradient( linear, left bottom, left top, color-stop(1, rgb(237,237,237)), color-stop(0, rgb(196,196,196)) );
+}
+
+#reset-button {
+ position: fixed;
+ bottom: 3px;
+ right: 3px;
+}
});
},
bindShortcutsDisplay: function(element, options) {
+ options = _.extend(options, { includeElement: false });
element.innerHTML = this.displayShortcuts(options);
var self = this;
this.onRebindShortcut(function() {
allowRebind: false, // Insert javascript to allow rebinding shortcuts
highlightRepeats: true, // Warn about shortcuts which are bound to multiple actions (if user can remap shortcuts) // TODO
shortcuts: _.sortBy(this.shortcuts, 'description'),
+ includeElement: true,
});
if (options.objectGrouping === "default") {
- var multipleObjectTypes = _.chain(shortcuts).pluck('object').unique().size().value() > 1;
+ var multipleObjectTypes = _.chain(options.shortcuts).pluck('object').unique().size().value() > 1;
options.objectGrouping = multipleObjectTypes;
}
- return '<table class="shortcuts">' + _.map(options.shortcuts, function(shortcut) {
- return _.template('<tr><td class="shortcut-description"><%= description %></td><td class="shortcut-keybinding"><%= keybindingHtml %></td></tr>')({
+ var inside = '<div class="title">Shortcuts</div><table class="shortcuts"><tbody>' + _.map(options.shortcuts, function(shortcut) {
+ return _.template('<tr><td class="description"><%= description %></td><td class="keybinding"><%= keybindingHtml %></td></tr>')({
description: shortcut.description,
keybindingHtml: this._displayKeybinding(shortcut, options)
});
- }, this).join("") + "</table>";
+ }, this).join("") + '</tbody></table>';
+ if (options.includeElement) return '<div id="shortcuts">' + inside + '</div>';
+ else return inside;
},
_displayKeybinding: function(shortcut, options) {
options = _.defaults({}, options, { displayMultiple: true, allowRebind: false });
e.save();
});
});
- Shortcut.bindShortcutsDisplay(this.$("#shortcuts")[0], {allowRebind: true});
+ Shortcut.bindShortcutsDisplay(this.$("#shortcuts-wrapper")[0], {allowRebind: true});
this.views = {}; // A list of views for each element in the collection
this.list.fetch();
this.render();
});
},
bindShortcutsDisplay: function(element, options) {
+ options = _.extend(options, { includeElement: false });
element.innerHTML = this.displayShortcuts(options);
var self = this;
this.onRebindShortcut(function() {
allowRebind: false, // Insert javascript to allow rebinding shortcuts
highlightRepeats: true, // Warn about shortcuts which are bound to multiple actions (if user can remap shortcuts) // TODO
shortcuts: _.sortBy(this.shortcuts, 'description'),
+ includeElement: true,
});
if (options.objectGrouping === "default") {
- var multipleObjectTypes = _.chain(shortcuts).pluck('object').unique().size().value() > 1;
+ var multipleObjectTypes = _.chain(options.shortcuts).pluck('object').unique().size().value() > 1;
options.objectGrouping = multipleObjectTypes;
}
- return '<table class="shortcuts">' + _.map(options.shortcuts, function(shortcut) {
- return _.template('<tr><td class="shortcut-description"><%= description %></td><td class="shortcut-keybinding"><%= keybindingHtml %></td></tr>')({
+ var inside = '<div class="title">Shortcuts</div><table class="shortcuts"><tbody>' + _.map(options.shortcuts, function(shortcut) {
+ return _.template('<tr><td class="description"><%= description %></td><td class="keybinding"><%= keybindingHtml %></td></tr>')({
description: shortcut.description,
keybindingHtml: this._displayKeybinding(shortcut, options)
});
- }, this).join("") + "</table>";
+ }, this).join("") + '</tbody></table>';
+ if (options.includeElement) return '<div id="shortcuts">' + inside + '</div>';
+ else return inside;
},
_displayKeybinding: function(shortcut, options) {
options = _.defaults({}, options, { displayMultiple: true, allowRebind: false });
e.save();
});
});
- Shortcut.bindShortcutsDisplay(this.$("#shortcuts")[0], {allowRebind: true});
+ Shortcut.bindShortcutsDisplay(this.$("#shortcuts-wrapper")[0], {allowRebind: true});
this.views = {}; // A list of views for each element in the collection
this.list.fetch();
this.render();
</head>
<body>
<div id="todo-app">
- A todo list:
<div id="todo-list">
</div>
<button id="reset-button">Everyone heard me say "reset button", right?</button>
- <div id="shortcuts">
- default shortcut text (should not see)
+ <div id="shortcuts-wrapper">
</div>
</div>
</body>
background: #ffffff;
}
-#shortcuts {
+#shortcuts-wrapper {
position: fixed;
- height: 100%;
- top: -2px;
+ bottom: -2px;
left: 10px;
width: 200px;
background: #ffffff;
+}
+
+.shortcuts {
border-collapse: collapse;
- border-spacing: 0;
- border: 0;
- padding: 0;
+ box-shadow: 0 2px 12px rgba(0,0,0,0.6);
+ display: block;
}
-.shortcut-description {
+.shortcuts .description {
background-color: #efefef;
max-width: 80px;
padding: 0 0 0 7px;
}
-.shortcut-keybinding {
+.shortcuts .keybinding {
padding: 0 0 0 7px;
}
border-top: 0;
border-bottom: 1px solid #aaa;
}
+
+#shortcuts-wrapper .title {
+ padding: 10px;
+ font-size: 100%;
+ border-bottom: 1px solid #979797
+ font-weight: bold;
+ background: -webkit-gradient( linear, left bottom, left top, color-stop(1, rgb(237,237,237)), color-stop(0, rgb(196,196,196)) );
+}
+
+#reset-button {
+ position: fixed;
+ bottom: 3px;
+ right: 3px;
+}
</head>
<body>
<div id="todo-app">
- A todo list:
<div id="todo-list">
</div>
- <button id="reset-button">Everyone heard me say "reset button", right?</button>
- <div id="shortcuts">
- default shortcut text (should not see)
+ <button id="reset-button">Initial setup / Reset</button>
+ <div id="shortcuts-wrapper">
</div>
</div>
</body>
});
},
bindShortcutsDisplay: function(element, options) {
+ options = _.extend(options, { includeElement: false });
element.innerHTML = this.displayShortcuts(options);
var self = this;
this.onRebindShortcut(function() {
allowRebind: false, // Insert javascript to allow rebinding shortcuts
highlightRepeats: true, // Warn about shortcuts which are bound to multiple actions (if user can remap shortcuts) // TODO
shortcuts: _.sortBy(this.shortcuts, 'description'),
+ includeElement: true,
});
if (options.objectGrouping === "default") {
- var multipleObjectTypes = _.chain(shortcuts).pluck('object').unique().size().value() > 1;
+ var multipleObjectTypes = _.chain(options.shortcuts).pluck('object').unique().size().value() > 1;
options.objectGrouping = multipleObjectTypes;
}
- return '<table class="shortcuts">' + _.map(options.shortcuts, function(shortcut) {
- return _.template('<tr><td class="shortcut-description"><%= description %></td><td class="shortcut-keybinding"><%= keybindingHtml %></td></tr>')({
+ var inside = '<div class="title">Shortcuts</div><table class="shortcuts"><tbody>' + _.map(options.shortcuts, function(shortcut) {
+ return _.template('<tr><td class="description"><%= description %></td><td class="keybinding"><%= keybindingHtml %></td></tr>')({
description: shortcut.description,
keybindingHtml: this._displayKeybinding(shortcut, options)
});
- }, this).join("") + "</table>";
+ }, this).join("") + '</tbody></table>';
+ if (options.includeElement) return '<div id="shortcuts">' + inside + '</div>';
+ else return inside;
},
_displayKeybinding: function(shortcut, options) {
options = _.defaults({}, options, { displayMultiple: true, allowRebind: false });
e.save();
});
});
- Shortcut.bindShortcutsDisplay(this.$("#shortcuts")[0], {allowRebind: true});
+ Shortcut.bindShortcutsDisplay(this.$("#shortcuts-wrapper")[0], {allowRebind: true});
this.views = {}; // A list of views for each element in the collection
this.list.fetch();
this.render();