Rensselaer Center for Open Source Software

Fix some issues with the new edit menu code

12 files changed, 27 lines added, 29 lines removed

Make sure that the arrow icons are always displayed, and that menus are aligned in the requested way.

Changes

--- app/assets/javascripts/menu.js c45dbdae360cfbcbdc998b45e172cc30915add84
+++ app/assets/javascripts/menu.js e2cb47f1ae6c1053ba772ca488a32fab114f2cfd
@@ -23,25 +23,25 @@
-  var $anchor = $("#" + anchorid),
-      $arrow = $("#" + anchorid + ' .arrow'),
-      $menu = $("#" + menuid),
-      $page = $(':not(#' + menuid + ', #' + anchorid + ')');
+  var $anchor = $("#" + anchorid);
+  var $arrow = $("#" + anchorid + " .menuicon");
+  var $menu = $("#" + menuid);
+  var $page = $(":not(#" + menuid + ", #" + anchorid + ")");
-    $page.unbind('click', hide);
+    $page.off("click", hide);
-      e.stopPropagation();
-      e.preventDefault();
-      if ($menu.is(':visible')) {
-          $menu.hide();
-          $page.unbind('click', hide);
-      } else {
-          openMenu($anchor, $menu.show(), 'left');
-          $page.bind('click', hide);
-      }
+    e.stopPropagation();
+    e.preventDefault();
+    if ($menu.is(":visible")) {
+      $menu.hide();
+      $page.off("click", hide);
+    } else {
+      openMenu($anchor, $menu.show(), align);
+      $page.on("click", hide);
+    }
--- app/assets/stylesheets/common.css.scss c45dbdae360cfbcbdc998b45e172cc30915add84
+++ app/assets/stylesheets/common.css.scss e2cb47f1ae6c1053ba772ca488a32fab114f2cfd
@@ -366,7 +366,7 @@
-.arrow {
+.menuicon {
@@ -381,17 +381,17 @@
-  border-top: 0;
+  border-top: 0px;
-  margin: 0;
-  padding: 0;
+  margin: 0px;
+  padding: 0px;
-  margin: 0;
+  margin: 0px;
--- app/assets/stylesheets/ltr.css.scss c45dbdae360cfbcbdc998b45e172cc30915add84
+++ app/assets/stylesheets/ltr.css.scss e2cb47f1ae6c1053ba772ca488a32fab114f2cfd
@@ -80,7 +80,7 @@
-.arrow {
+.menuicon {
--- app/assets/stylesheets/rtl.css.scss c45dbdae360cfbcbdc998b45e172cc30915add84
+++ app/assets/stylesheets/rtl.css.scss e2cb47f1ae6c1053ba772ca488a32fab114f2cfd
@@ -80,7 +80,7 @@
-.arrow {
+.menuicon {
--- app/views/browse/_map.html.erb c45dbdae360cfbcbdc998b45e172cc30915add84
+++ app/views/browse/_map.html.erb e2cb47f1ae6c1053ba772ca488a32fab114f2cfd
@@ -11,12 +11,12 @@
-  <%= link_to(h(t("browse.map.edit.area")) + '<span class="arrow">&#x25be;</span>'.html_safe, { :controller => :site, :action => :edit }, { :id => "area_edit", :class => "geolink bbox" }) %>
-    <%= link_to("", { :controller => :site, :action => :index }, { :id => "object_larger_map", :class => "geolink object" }) %>
+    <%= link_to(t("browse.map.larger." + map.class.to_s.downcase), { :controller => :site, :action => :index }, { :id => "object_larger_map", :class => "geolink object" }) %>
-    <%= link_to(h("")  + '<span class="arrow">&#x25be;</span>'.html_safe, { :controller => :site, :action => :edit }, { :id => "object_edit", :class => "geolink object" }) %>
@@ -110,6 +110,9 @@
+        $("#object_larger_map").hide();
+        $("#object_edit").hide();
+
@@ -129,7 +132,6 @@
-            <% unless map.instance_of? Changeset -%>
@@ -140,9 +142,8 @@
-            $("#object_larger_map").html("<%=j t('browse.map.larger.' + map.class.to_s.downcase) %>");
-            $("#object_edit").html("<%=j t('browse.map.edit.' + map.class.to_s.downcase) %>");
-            <% end -%>
+            $("#object_larger_map").show();
+            $("#object_edit").show();
--- app/views/layouts/site.html.erb c45dbdae360cfbcbdc998b45e172cc30915add84
+++ app/views/layouts/site.html.erb e2cb47f1ae6c1053ba772ca488a32fab114f2cfd
@@ -37,7 +37,7 @@
-        <li><%= link_to h(t('layouts.edit')) + '<span class="arrow">&#x25be;</span>'.html_safe, {:controller => 'site', :action => 'edit'}, {:id => 'editanchor', :title => t('javascripts.site.edit_tooltip'), :class => editclass} %></li>
Tom Hughes
Jumpstart • 56 weeks ago