From 9dec959aee19846ab45d23334df1c6194969070c Mon Sep 17 00:00:00 2001
From: Connor Turland <connorturland@gmail.com>
Date: Wed, 30 Jul 2014 01:02:47 -0400
Subject: [PATCH] more restructuring. reorganizing views files to make more
 sense, be grouped logically

---
 .../javascripts/metamaps/Metamaps.GlobalUI.js |  5 +++-
 app/views/in_metacode_sets/_form.html.erb     | 25 -------------------
 app/views/in_metacode_sets/edit.html.erb      |  6 -----
 app/views/in_metacode_sets/index.html.erb     | 25 -------------------
 app/views/in_metacode_sets/new.html.erb       |  5 ----
 app/views/in_metacode_sets/show.html.erb      | 15 -----------
 ..._ga.html.erb => _googleanalytics.html.erb} |  0
 app/views/layouts/_lightboxes.html.erb        | 12 ++++-----
 .../_newmap.html.erb}                         |  0
 app/views/layouts/application.html.erb        |  2 +-
 app/views/{maps => main}/_homemap.html.erb    |  0
 app/views/main/home.html.erb                  |  2 +-
 app/views/mappings/create.js.erb              |  4 ---
 app/views/mappings/destroy.js.erb             |  5 ----
 app/views/mappings/edit.html.erb              |  4 ---
 app/views/mappings/index.html.erb             |  4 ---
 app/views/mappings/new.html.erb               |  4 ---
 app/views/mappings/show.html.erb              |  4 ---
 app/views/maps/show.html.erb                  |  4 +--
 .../{layouts => shared}/_cheatsheet.html.erb  |  0
 .../_filterbymetacode.html.erb                |  0
 .../_forkmap.html.erb}                        |  0
 .../_metacodeoptions.html.erb                 |  0
 .../_switchmetacodes.html.erb                 |  0
 app/views/synapses/_new.html.erb              |  3 ---
 app/views/topics/_new.html.erb                |  5 ----
 app/views/topics/show.html.erb                |  4 +--
 27 files changed, 16 insertions(+), 122 deletions(-)
 delete mode 100644 app/views/in_metacode_sets/_form.html.erb
 delete mode 100644 app/views/in_metacode_sets/edit.html.erb
 delete mode 100644 app/views/in_metacode_sets/index.html.erb
 delete mode 100644 app/views/in_metacode_sets/new.html.erb
 delete mode 100644 app/views/in_metacode_sets/show.html.erb
 rename app/views/layouts/{_ga.html.erb => _googleanalytics.html.erb} (100%)
 rename app/views/{maps/_new.html.erb => layouts/_newmap.html.erb} (100%)
 rename app/views/{maps => main}/_homemap.html.erb (100%)
 delete mode 100644 app/views/mappings/create.js.erb
 delete mode 100644 app/views/mappings/destroy.js.erb
 delete mode 100644 app/views/mappings/edit.html.erb
 delete mode 100644 app/views/mappings/index.html.erb
 delete mode 100644 app/views/mappings/new.html.erb
 delete mode 100644 app/views/mappings/show.html.erb
 rename app/views/{layouts => shared}/_cheatsheet.html.erb (100%)
 rename app/views/{main => shared}/_filterbymetacode.html.erb (100%)
 rename app/views/{maps/_fork.html.erb => shared/_forkmap.html.erb} (100%)
 rename app/views/{main => shared}/_metacodeoptions.html.erb (100%)
 rename app/views/{layouts => shared}/_switchmetacodes.html.erb (100%)

diff --git a/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js b/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js
index 0dff8295..8e4ae2ae 100644
--- a/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js
+++ b/app/assets/javascripts/metamaps/Metamaps.GlobalUI.js
@@ -75,6 +75,8 @@ Metamaps.GlobalUI = {
             event.preventDefault();
             return false;
         });
+        
+        $('#lightbox_screen, #lightbox_close').click(self.closeLightbox);
 
         // hide notices after 10 seconds
         $('.notice.metamaps').delay(10000).fadeOut('fast');
@@ -105,9 +107,10 @@ Metamaps.GlobalUI = {
         }
     },
 
-    closeLightbox: function () {
+    closeLightbox: function (event) {
         var self = Metamaps.GlobalUI;
         
+        if (event) event.preventDefault();
         $('#lightbox_overlay').hide();
         
         if (self.lightbox === 'forkmap') Metamaps.GlobalUI.CreateMap.reset('fork_map');
diff --git a/app/views/in_metacode_sets/_form.html.erb b/app/views/in_metacode_sets/_form.html.erb
deleted file mode 100644
index 8af37701..00000000
--- a/app/views/in_metacode_sets/_form.html.erb
+++ /dev/null
@@ -1,25 +0,0 @@
-<%= form_for(@in_metacode_set) do |f| %>
-  <% if @in_metacode_set.errors.any? %>
-    <div id="error_explanation">
-      <h2><%= pluralize(@in_metacode_set.errors.count, "error") %> prohibited this in_metacode_set from being saved:</h2>
-
-      <ul>
-      <% @in_metacode_set.errors.full_messages.each do |msg| %>
-        <li><%= msg %></li>
-      <% end %>
-      </ul>
-    </div>
-  <% end %>
-
-  <div class="field">
-    <%= f.label :metacode %><br />
-    <%= f.text_field :metacode %>
-  </div>
-  <div class="field">
-    <%= f.label :metacode_set %><br />
-    <%= f.text_field :metacode_set %>
-  </div>
-  <div class="actions">
-    <%= f.submit %>
-  </div>
-<% end %>
diff --git a/app/views/in_metacode_sets/edit.html.erb b/app/views/in_metacode_sets/edit.html.erb
deleted file mode 100644
index c94b7b78..00000000
--- a/app/views/in_metacode_sets/edit.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<h1>Editing in_metacode_set</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Show', @in_metacode_set %> |
-<%= link_to 'Back', in_metacode_sets_path %>
diff --git a/app/views/in_metacode_sets/index.html.erb b/app/views/in_metacode_sets/index.html.erb
deleted file mode 100644
index 57753a5d..00000000
--- a/app/views/in_metacode_sets/index.html.erb
+++ /dev/null
@@ -1,25 +0,0 @@
-<h1>Listing in_metacode_sets</h1>
-
-<table>
-  <tr>
-    <th>Metacode</th>
-    <th>Metacode set</th>
-    <th></th>
-    <th></th>
-    <th></th>
-  </tr>
-
-<% @in_metacode_sets.each do |in_metacode_set| %>
-  <tr>
-    <td><%= in_metacode_set.metacode %></td>
-    <td><%= in_metacode_set.metacode_set %></td>
-    <td><%= link_to 'Show', in_metacode_set %></td>
-    <td><%= link_to 'Edit', edit_in_metacode_set_path(in_metacode_set) %></td>
-    <td><%= link_to 'Destroy', in_metacode_set, method: :delete, data: { confirm: 'Are you sure?' } %></td>
-  </tr>
-<% end %>
-</table>
-
-<br />
-
-<%= link_to 'New In metacode set', new_in_metacode_set_path %>
diff --git a/app/views/in_metacode_sets/new.html.erb b/app/views/in_metacode_sets/new.html.erb
deleted file mode 100644
index 0e1d596b..00000000
--- a/app/views/in_metacode_sets/new.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<h1>New in_metacode_set</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Back', in_metacode_sets_path %>
diff --git a/app/views/in_metacode_sets/show.html.erb b/app/views/in_metacode_sets/show.html.erb
deleted file mode 100644
index 2b69e016..00000000
--- a/app/views/in_metacode_sets/show.html.erb
+++ /dev/null
@@ -1,15 +0,0 @@
-<p id="notice"><%= notice %></p>
-
-<p>
-  <b>Metacode:</b>
-  <%= @in_metacode_set.metacode %>
-</p>
-
-<p>
-  <b>Metacode set:</b>
-  <%= @in_metacode_set.metacode_set %>
-</p>
-
-
-<%= link_to 'Edit', edit_in_metacode_set_path(@in_metacode_set) %> |
-<%= link_to 'Back', in_metacode_sets_path %>
diff --git a/app/views/layouts/_ga.html.erb b/app/views/layouts/_googleanalytics.html.erb
similarity index 100%
rename from app/views/layouts/_ga.html.erb
rename to app/views/layouts/_googleanalytics.html.erb
diff --git a/app/views/layouts/_lightboxes.html.erb b/app/views/layouts/_lightboxes.html.erb
index 0328db16..1d6d2d3e 100644
--- a/app/views/layouts/_lightboxes.html.erb
+++ b/app/views/layouts/_lightboxes.html.erb
@@ -6,7 +6,7 @@
 
 <div id="lightbox_overlay">
   <div id="lightbox_main">
-    <a id="lightbox_close" onclick="Metamaps.GlobalUI.closeLightbox(); return false;" href="#"></a>
+    <a id="lightbox_close" href="#"></a>
     <div id="lightbox_content">
       
       <div class="lightboxContent" id="about">
@@ -35,7 +35,7 @@
       </div>
       
       <div class="lightboxContent" id="cheatsheet">
-        <%= render :partial => 'layouts/cheatsheet' %>
+        <%= render :partial => 'shared/cheatsheet' %>
       </div>    
       
       <% if authenticated? %>
@@ -51,22 +51,22 @@
       
         <% # this is the create new map form %>
         <div class="lightboxContent" id="newmap">  
-          <%= render :partial => 'maps/new' %>
+          <%= render :partial => 'layouts/newmap' %>
         </div>
       
         <% if (controller_name == "maps" || controller_name == "topics" ) && action_name == "show"  %>
         <div class="lightboxContent" id="forkmap">  
-          <%= render :partial => 'maps/fork' %>
+          <%= render :partial => 'shared/forkmap' %>
         </div>
 
         <div class="lightboxContent" id="switchMetacodes">
-          <%= render :partial => 'layouts/switchmetacodes' %>
+          <%= render :partial => 'shared/switchmetacodes' %>
         </div>
         <% end %>
       <% end %>
       
     </div>
   </div>
-  <div id="lightbox_screen" onclick="Metamaps.GlobalUI.closeLightbox();return false;" style="height: 100%;"></div>
+  <div id="lightbox_screen" style="height: 100%;"></div>
 </div>
 
diff --git a/app/views/maps/_new.html.erb b/app/views/layouts/_newmap.html.erb
similarity index 100%
rename from app/views/maps/_new.html.erb
rename to app/views/layouts/_newmap.html.erb
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index caed06b6..4d6360f3 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -93,6 +93,6 @@
       BAROMETER.load('Scqak8nyHdFEkezKMNeQp');
     </script>
   <%= render :partial => 'layouts/lightboxes' %>
-  <%= render :partial => 'layouts/ga' if Rails.env.production? %>
+  <%= render :partial => 'layouts/googleanalytics' if Rails.env.production? %>
 </body>
 </html>
diff --git a/app/views/maps/_homemap.html.erb b/app/views/main/_homemap.html.erb
similarity index 100%
rename from app/views/maps/_homemap.html.erb
rename to app/views/main/_homemap.html.erb
diff --git a/app/views/main/home.html.erb b/app/views/main/home.html.erb
index edfa02fa..b03a4843 100644
--- a/app/views/main/home.html.erb
+++ b/app/views/main/home.html.erb
@@ -64,7 +64,7 @@
     <figure id="homeFigure">
     <% @maps.each_with_index do |map, index| %>
       <% first = index == 0 ? true : false %>
-      <%= render :partial => 'maps/homemap', :locals => { :map => map, :first => first } %>
+      <%= render :partial => 'main/homemap', :locals => { :map => map, :first => first } %>
     <% end %>
     </figure>
   </div>
diff --git a/app/views/mappings/create.js.erb b/app/views/mappings/create.js.erb
deleted file mode 100644
index ef8b6089..00000000
--- a/app/views/mappings/create.js.erb
+++ /dev/null
@@ -1,4 +0,0 @@
-/*
- * @file
- * This javascript is returned and executed when you create a new mapping.
- */
diff --git a/app/views/mappings/destroy.js.erb b/app/views/mappings/destroy.js.erb
deleted file mode 100644
index a8653340..00000000
--- a/app/views/mappings/destroy.js.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-/*
- * @file
- * The javascript returned when destroy is called in the mappings controller
- * Unused
- */
diff --git a/app/views/mappings/edit.html.erb b/app/views/mappings/edit.html.erb
deleted file mode 100644
index 0151d668..00000000
--- a/app/views/mappings/edit.html.erb
+++ /dev/null
@@ -1,4 +0,0 @@
-<%#
-  # @file
-  # This code renders the edit form for mappings. Unused.
-  #%>
diff --git a/app/views/mappings/index.html.erb b/app/views/mappings/index.html.erb
deleted file mode 100644
index 17643309..00000000
--- a/app/views/mappings/index.html.erb
+++ /dev/null
@@ -1,4 +0,0 @@
-<%#
-  # @file
-  # This view could show an index of all mappings, but is unused.
-  #%>
diff --git a/app/views/mappings/new.html.erb b/app/views/mappings/new.html.erb
deleted file mode 100644
index 39dd3eb1..00000000
--- a/app/views/mappings/new.html.erb
+++ /dev/null
@@ -1,4 +0,0 @@
-<%#
-  # @file
-  # This file is a form for creating new mappings. Unused.
-  #%>
diff --git a/app/views/mappings/show.html.erb b/app/views/mappings/show.html.erb
deleted file mode 100644
index 14785fb4..00000000
--- a/app/views/mappings/show.html.erb
+++ /dev/null
@@ -1,4 +0,0 @@
-<%#
-  # @file
-  # This would show a mapping but instead is unused.
-  #%>
diff --git a/app/views/maps/show.html.erb b/app/views/maps/show.html.erb
index 8354eb7e..d3e0ebb2 100644
--- a/app/views/maps/show.html.erb
+++ b/app/views/maps/show.html.erb
@@ -41,7 +41,7 @@
   <div class="sidebarFilterBox">
     <h3 class="filterByMetacode">Filter By Metacode</h3><span class="showAll">all</span><span class="hideAll">none</span>
     <div class="clearfloat"></div>
-    <%= render :partial => 'main/filterbymetacode' %>
+    <%= render :partial => 'shared/filterbymetacode' %>
   </div>
 </div>
 
@@ -72,7 +72,7 @@
   <% end %>
 
   <% # for populating the change metacode list on the topic card %>
-  <%= render :partial => 'main/metacodeoptions' %>
+  <%= render :partial => 'shared/metacodeoptions' %>
 <% end %>
 
 
diff --git a/app/views/layouts/_cheatsheet.html.erb b/app/views/shared/_cheatsheet.html.erb
similarity index 100%
rename from app/views/layouts/_cheatsheet.html.erb
rename to app/views/shared/_cheatsheet.html.erb
diff --git a/app/views/main/_filterbymetacode.html.erb b/app/views/shared/_filterbymetacode.html.erb
similarity index 100%
rename from app/views/main/_filterbymetacode.html.erb
rename to app/views/shared/_filterbymetacode.html.erb
diff --git a/app/views/maps/_fork.html.erb b/app/views/shared/_forkmap.html.erb
similarity index 100%
rename from app/views/maps/_fork.html.erb
rename to app/views/shared/_forkmap.html.erb
diff --git a/app/views/main/_metacodeoptions.html.erb b/app/views/shared/_metacodeoptions.html.erb
similarity index 100%
rename from app/views/main/_metacodeoptions.html.erb
rename to app/views/shared/_metacodeoptions.html.erb
diff --git a/app/views/layouts/_switchmetacodes.html.erb b/app/views/shared/_switchmetacodes.html.erb
similarity index 100%
rename from app/views/layouts/_switchmetacodes.html.erb
rename to app/views/shared/_switchmetacodes.html.erb
diff --git a/app/views/synapses/_new.html.erb b/app/views/synapses/_new.html.erb
index 50ecc35c..e1e7d176 100644
--- a/app/views/synapses/_new.html.erb
+++ b/app/views/synapses/_new.html.erb
@@ -6,8 +6,5 @@
 <div class="anypage">
 	<%= form_for Synapse.new, url: synapses_url, remote: true do |form| %>
     <%= form.text_field :desc, :placeholder => "describe the connection..." %>
-    <%= form.hidden_field :topic1id, :value => 0 %>
-    <%= form.hidden_field :topic2id, :value => 0 %>
-    <%= form.hidden_field :grabSynapse, :value => "null" %>
 	<% end %>
 </div>
diff --git a/app/views/topics/_new.html.erb b/app/views/topics/_new.html.erb
index e3421ec3..7aa13eb3 100644
--- a/app/views/topics/_new.html.erb
+++ b/app/views/topics/_new.html.erb
@@ -24,11 +24,6 @@
     <% end %>
   </div> 
   <%= form.text_field :name, :maxlength => 140, :placeholder => "title..." %>
-  <%= form.hidden_field :metacode, :value => "Action" %>
-  <%= form.hidden_field :x, :value => 0 %>
-  <%= form.hidden_field :y, :value => 0 %>
-  <%= form.hidden_field :grabTopic, :value => "null" %>
-  <%= form.hidden_field :addSynapse, :value => false %>
   <div id="metacodeImgTitle"></div>
   <div class="clearfloat"></div>
 <% end %>
diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb
index 703af0a5..9179143c 100644
--- a/app/views/topics/show.html.erb
+++ b/app/views/topics/show.html.erb
@@ -29,7 +29,7 @@
   <div class="sidebarFilterBox">
     <h3 class="filterByMetacode">Filter By Metacode</h3><span class="showAll">all</span><span class="hideAll">none</span>
     <div class="clearfloat"></div>
-    <%= render :partial => 'main/filterbymetacode' %>
+    <%= render :partial => 'shared/filterbymetacode' %>
   </div>
 </div>
 
@@ -51,7 +51,7 @@
 <% if authenticated? %>
   <%= render :partial => 'topics/new' %>
   <%= render :partial => 'synapses/new' %>
-  <%= render :partial => 'main/metacodeoptions' %>
+  <%= render :partial => 'shared/metacodeoptions' %>
 <% end %>
 
 <script>