From 9027cd6d2eef754dee16a623d695c44f80689daf Mon Sep 17 00:00:00 2001 From: Connor Turland Date: Sun, 15 Jun 2014 14:39:42 -0400 Subject: [PATCH] closes #352 size of cheatsheet window, closes #351 remove topic and synapse create from cheatsheet on topic pages, closes #348 enter key creating undesirable line break --- app/assets/javascripts/bip.js | 17 ++++++++++++++++- app/assets/stylesheets/application.css | 1 + app/views/layouts/_cheatsheet.html.erb | 18 +++++++++++++++--- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/bip.js b/app/assets/javascripts/bip.js index 2c270e1d..ee804884 100644 --- a/app/assets/javascripts/bip.js +++ b/app/assets/javascripts/bip.js @@ -531,6 +531,9 @@ BestInPlaceEditor.forms = { this.element.find("input[type='button']").bind('click', {editor: this}, BestInPlaceEditor.forms.textarea.cancelButtonHandler); } this.element.find("textarea").bind('blur', {editor: this}, BestInPlaceEditor.forms.textarea.blurHandler); + // START METAMAPS CODE + this.element.find("textarea").bind('keydown', {editor: this}, BestInPlaceEditor.forms.textarea.keydownHandler); + // END METAMAPS CODE this.element.find("textarea").bind('keyup', {editor: this}, BestInPlaceEditor.forms.textarea.keyupHandler); this.blurTimer = null; this.userClicked = false; @@ -573,14 +576,26 @@ BestInPlaceEditor.forms = { event.data.editor.abortIfConfirm(); event.stopPropagation(); // Without this, click isn't handled }, - + + // START METAMAPS CODE + keydownHandler : function(event) { + if (event.keyCode == 13 && !event.shiftKey) { + event.preventDefault(); + event.stopPropagation(); + return false; + } + }, + // END METAMAPS CODE + keyupHandler : function(event) { if (event.keyCode == 27) { event.data.editor.abortIfConfirm(); } + // START METAMAPS CODE else if (event.keyCode == 13 && !event.shiftKey) { event.data.editor.update(); } + // END METAMAPS CODE } } }; diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 8ae1e33d..136d86fe 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -2034,6 +2034,7 @@ div.mapInfoStat { /* Cheatsheet */ #cheatSheet { width: 100%; + height: 350px; font-family: LatoLight, Arial, Sans-Serif; font-size: 17px; line-height: 21px; diff --git a/app/views/layouts/_cheatsheet.html.erb b/app/views/layouts/_cheatsheet.html.erb index 2c48addc..7c400857 100644 --- a/app/views/layouts/_cheatsheet.html.erb +++ b/app/views/layouts/_cheatsheet.html.erb @@ -10,10 +10,16 @@ <% if controller_name == "topics" && action_name == "show" %>
  • Topic View
  • <% end %> - <% if authenticated? && (controller_name == "maps" || controller_name == "topics" ) && action_name == "show" %> + <% if authenticated? && controller_name == "maps" && action_name == "show" %>
  • Creating Topics
  • + <% end %> + <% if authenticated? && (controller_name == "maps" || controller_name == "topics" ) && action_name == "show" %>
  • Editing Topics
  • + <% end %> + <% if authenticated? && controller_name == "maps" && action_name == "show" %>
  • Creating Synapses
  • + <% end %> + <% if authenticated? && (controller_name == "maps" || controller_name == "topics" ) && action_name == "show" %>
  • Editing Synapses
  • <% end %> <% if (controller_name == "maps" || controller_name == "topics" ) && action_name == "show" %> @@ -32,7 +38,7 @@ <% end %> - <% if authenticated? && (controller_name == "maps" || controller_name == "topics" ) && action_name == "show" %> + <% if authenticated? && controller_name == "maps" && action_name == "show" %>

    Creating Topics

    Double-click on canvas: Bring up the metacode spinner on the canvas.
    @@ -43,7 +49,9 @@
    Enter: create a new topic
    Gear Icon: open up metacode settings
    - + <% end %> + + <% if authenticated? && (controller_name == "maps" || controller_name == "topics" ) && action_name == "show" %>

    Editing Topics

    @@ -75,7 +83,9 @@
    *Hide/Remove/Delete topic within context menu
    + <% end %> + <% if authenticated? && controller_name == "maps" && action_name == "show" %>

    Creating Synapses

    Right-click & drag from one topic to another: open create synapse prompt
    @@ -85,7 +95,9 @@
    Enter: Create topic
    Enter: Create synapse
    + <% end %> + <% if authenticated? && (controller_name == "maps" || controller_name == "topics" ) && action_name == "show" %>

    Editing Synapses

    Double-click on synapse: open synapse card