Checkpoint commit - blips show up as a sidebar now instead of at the bottom master
authorJude N <juden@pwan.org>
Sun, 6 Aug 2017 16:32:30 +0000 (12:32 -0400)
committerJude N <juden@pwan.org>
Sun, 6 Aug 2017 16:32:30 +0000 (12:32 -0400)
TODO.md
mix.exs
mix.lock
rel/config.exs [new file with mode: 0644]
test/controllers/radar_data_point_controller_test.exs
web/router.ex
web/templates/radar/index.html.eex
web/templates/radar_data_point/new.html.eex

diff --git a/TODO.md b/TODO.md
index d68841e..57c48f5 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -1,5 +1,7 @@
 - Bugs:
   - Why's the trial and adopt ections so much larger than the asses and hold ?
+  - Is it a problem the index is potentially reset after adding/deleting blips ?
+  - Fix the ref table so items are printed out in order
 
 - Big Features
   - The ability to drag and drop items within the map
@@ -20,3 +22,5 @@
 - Move new-items and ref-table divs to a sliding panal
 
 - Resize the radar so its reactive (
+
+- Add an 'edit' tab along with the delete ?  Probably just easier to delete and reenter.
diff --git a/mix.exs b/mix.exs
index 3fc2fd7..3d89f8c 100644 (file)
--- a/mix.exs
+++ b/mix.exs
@@ -37,7 +37,8 @@ defmodule TechRadarEditor.Mixfile do
      {:phoenix_html, "~> 2.6"},
      {:phoenix_live_reload, "~> 1.0", only: :dev},
      {:gettext, "~> 0.11"},
-     {:cowboy, "~> 1.0"}]
+     {:cowboy, "~> 1.0"},
+     {:distillery, "~> 1.0"}]
   end
 
   # Aliases are shortcuts or tasks specific to the current project.
index 9c38e9c..edc8c17 100644 (file)
--- a/mix.lock
+++ b/mix.lock
@@ -3,6 +3,7 @@
   "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], [], "hexpm"},
   "db_connection": {:hex, :db_connection, "1.1.2", "2865c2a4bae0714e2213a0ce60a1b12d76a6efba0c51fbda59c9ab8d1accc7a8", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
   "decimal": {:hex, :decimal, "1.3.1", "157b3cedb2bfcb5359372a7766dd7a41091ad34578296e951f58a946fcab49c6", [:mix], [], "hexpm"},
+  "distillery": {:hex, :distillery, "1.4.1", "546d851bf27ae8fe0727e10e4fc4e146ad836eecee138263a60431e688044ed3", [], [], "hexpm"},
   "ecto": {:hex, :ecto, "2.1.4", "d1ba932813ec0e0d9db481ef2c17777f1cefb11fc90fa7c142ff354972dfba7e", [:mix], [{:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: true]}, {:decimal, "~> 1.2", [hex: :decimal, repo: "hexpm", optional: false]}, {:mariaex, "~> 0.8.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.13.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm"},
   "fs": {:hex, :fs, "0.9.2", "ed17036c26c3f70ac49781ed9220a50c36775c6ca2cf8182d123b6566e49ec59", [:rebar], [], "hexpm"},
   "gettext": {:hex, :gettext, "0.13.1", "5e0daf4e7636d771c4c71ad5f3f53ba09a9ae5c250e1ab9c42ba9edccc476263", [:mix], [], "hexpm"},
diff --git a/rel/config.exs b/rel/config.exs
new file mode 100644 (file)
index 0000000..f58fae2
--- /dev/null
@@ -0,0 +1,47 @@
+# Import all plugins from `rel/plugins`
+# They can then be used by adding `plugin MyPlugin` to
+# either an environment, or release definition, where
+# `MyPlugin` is the name of the plugin module.
+Path.join(["rel", "plugins", "*.exs"])
+|> Path.wildcard()
+|> Enum.map(&Code.eval_file(&1))
+
+use Mix.Releases.Config,
+    # This sets the default release built by `mix release`
+    default_release: :default,
+    # This sets the default environment used by `mix release`
+    default_environment: Mix.env()
+
+# For a full list of config options for both releases
+# and environments, visit https://hexdocs.pm/distillery/configuration.html
+
+
+# You may define one or more environments in this file,
+# an environment's settings will override those of a release
+# when building in that environment, this combination of release
+# and environment configuration is called a profile
+
+environment :dev do
+  set dev_mode: true
+  set include_erts: false
+  set cookie: :"NBhg=&2xapMkhKasblD2V3wWc}6H=JWAH3M;*_hl*@<2iI6co?Q8:}]$!2H`A)[("
+end
+
+environment :prod do
+  set include_erts: true
+  set include_src: false
+  set cookie: :"AObX{{4)q7^jvvp.qSlKVp$ZbrY?pa|%XJ5^f[Vw6Pnk@Ok.j4xU^/[dIC*S@^|E"
+end
+
+# You may define one or more releases in this file.
+# If you have not set a default release, or selected one
+# when running `mix release`, the first release in the file
+# will be used by default
+
+release :tech_radar_editor do
+  set version: current_version(:tech_radar_editor)
+  set applications: [
+    :runtime_tools
+  ]
+end
+
index d687e34..65a3b7f 100644 (file)
@@ -26,7 +26,7 @@ defmodule TechRadarEditor.RadarDataPointControllerTest do
     assert html_response(conn, 200) =~ "New radar data point"
   end
 
-  test "show s chosen resource", %{conn: conn} do
+  test "shows chosen resource", %{conn: conn} do
     radar_data_point = Repo.insert! %RadarDataPoint{}
     conn = get conn, radar_data_point_path(conn, :show, radar_data_point)
     assert html_response(conn, 200) =~ "Show radar data point"
index 7b20d95..49190e2 100644 (file)
@@ -15,14 +15,6 @@ defmodule TechRadarEditor.Router do
 
   scope "/", TechRadarEditor do
     pipe_through :browser # Use the default browser stack
-
-#    get "/", PageController, :index
-#    get "/radar", RadarController, :index
-
-#    get "/original", PageController, :index
-#    get "/", RadarController, :index
-#    post "/", RadarController, :create   # ????
-
     resources "/", RadarController, only: [:index, :create, :delete]
   end
 
index 28684e9..59da375 100644 (file)
 <body>
-  <div id="radar">
-  </div>
-  <div id="new-items">
-
-    <%= form_for @changeset, radar_path(@conn, :create), fn f -> %>
-      <table class="radar-input-table" >
-        <thead>
-          <tr class="radar-input-status-group">
-            <td>Quadrant</td>
-            <td>Cycle</td>
-            <td>Name</td>
-            <td>Description</td>
-            <td< /td>
-          </tr>
-        </thead>
-        <tr c>
-          <td>
-            <%= select f, :quadrant,  Enum.with_index(TechRadarEditor.RadarDataPoint.quadrants,1) %>
-          </td>
-          <td>
-            <%= select f, :cycle,  Enum.with_index(TechRadarEditor.RadarDataPoint.cycles,1) %>
-          </td>
-          <td>
-            <%= text_input f, :name %> 
-          </td>
-          <td>
-            <%= text_input f, :description %>
-          </td>
-          <td>
-            <%= hidden_input f, :is_new, value: "true"  %>
-            <%= submit "Add", class: "btn btn-primary" %>
-          </td>
-        </tr>
-      </table>
-    <% end %>
-  </div>
-  <div id="ref-table">
-  </div>
+    <div id="radar">
+    </div>
+    <div id="sidenav" class="sidenav">
+        <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
+        <div id="new-items">
+            <%= form_for @changeset, radar_path(@conn, :create), fn f -> %>
+            <table class="radar-input-table" >
+                <thead>
+                    <tr class="radar-input-status-group">
+                        <td>Quadrant</td>
+                        <td>Cycle</td>
+                        <td>Name</td>
+                        <td>Description</td>
+                        <td< /td>
+                    </tr>
+                </thead>
+                <tr c>
+                    <td>
+                        <%= select f, :quadrant,  Enum.with_index(TechRadarEditor.RadarDataPoint.quadrants,1) %>
+                    </td>
+                    <td>
+                        <%= select f, :cycle,  Enum.with_index(TechRadarEditor.RadarDataPoint.cycles,1) %>
+                    </td>
+                    <td>
+                        <%= text_input f, :name %> 
+                    </td>
+                    <td>
+                        <%= text_input f, :description %>
+                    </td>
+                    <td>
+                        <%= hidden_input f, :is_new, value: "true"  %>
+                        <%= submit "Add", class: "btn btn-primary" %>
+                    </td>
+                </tr>
+            </table>
+            <% end %>
+        </div>
+        <div id="ref-table">
+        </div>
+    </div>
 </body>
 <script>
-  var adopt = new tr.models.Cycle('Adopt', 0);
-  var trial = new tr.models.Cycle('Trial', 1);
-  var assess = new tr.models.Cycle('Assess', 2);
-  var hold = new tr.models.Cycle('Hold', 3);
-
-  var radar = new tr.models.Radar();
-  var toolsQuadrant = new tr.models.Quadrant('Tools');
-  var techniquesQuadrant = new tr.models.Quadrant('Techniques');
-  var platformsQuadrant = new tr.models.Quadrant('Platforms');
-  var languageFramework = new tr.models.Quadrant('Languages & Frameworks');
-
-  <% fn_blip_line = fn(p) -> "         new tr.models.Blip('" <> p.name <> "', "
-                             <> String.downcase(Enum.at(TechRadarEditor.RadarDataPoint.cycles, p.cycle-1))  <> ", "
-                             <> if(p.is_new, do: "true", else: "false")
-                             <> if(p.description != nil, do: ",'" <> p.description <> "'", else: "")
-                             <> ")"
-                           end 
-  %>
-
-  toolsQuadrant.add([
-<%= raw(Enum.join( Enum.map(@radar_quadrants[1], fn(p) -> fn_blip_line.(p) end),",\n")) %>
-  ]);
-
-  techniquesQuadrant.add([
-<%= raw(Enum.join( Enum.map(@radar_quadrants[2], fn(p) -> fn_blip_line.(p) end),",\n")) %>
-  ]);
-
-  platformsQuadrant.add([
-<%= raw(Enum.join( Enum.map(@radar_quadrants[3], fn(p) -> fn_blip_line.(p) end),",\n")) %>
-  ]);
-
-  languageFramework.add([
-<%= raw(Enum.join( Enum.map(@radar_quadrants[4], fn(p) -> fn_blip_line.(p) end),",\n")) %>
-  ]);
-
-  radar.setFirstQuadrant(toolsQuadrant);
-  radar.setSecondQuadrant(techniquesQuadrant);
-  radar.setThirdQuadrant(platformsQuadrant);
-  radar.setFourthQuadrant(languageFramework);
-
-  var innerWidth = window.innerWidth;
-  var innerHeight = window.innerHeight;
-
-  radarSize = Math.min(innerWidth-20, innerHeight-20, 1080);
-
-  var radarGraph = new tr.graphing.Radar(radarSize, radar);
-  radarGraph.init('#radar').plot();
-  var refTable = new tr.graphing.RefTable(radar);
-  refTable.init('#ref-table').render();
-
-  ref_table = document.getElementsByClassName('radar-ref-table')[0];
-  for (var i = 0, trow; trow = ref_table.rows[i]; i++) {
-      if (trow.cells.length == 3) {
-         var blip_number = trow.cells[0].textContent;
-         var new_cell = trow.insertCell(-1);
-         s_form = "<form action=\"/" + blip_number + "\" class=\"link\" method=\"post\">";
-         s_form += "<input name=\"_method\" type=\"hidden\" value=\"delete\">";
-         s_form += "<a class=\"btn btn-danger btn-xs\" data-confirm=\"Are you sure?\" data-submit=\"parent\" href=\"#\" rel=\"nofollow\">Delete</a>";
-         s_form += "<input type=\"hidden\" name=\"_csrf_token\" value=\"<%= get_csrf_token() %>\">";
-         s_form += "</form>";
-         // new_cell.innerHTML = "<a href='./delete/" + blip_number + "' class='btn btn-danger btn-xs'>Delete</a>";
-         new_cell.innerHTML = s_form;
-      };
-  };
-  
+var adopt = new tr.models.Cycle('Adopt', 0);
+var trial = new tr.models.Cycle('Trial', 1);
+var assess = new tr.models.Cycle('Assess', 2);
+var hold = new tr.models.Cycle('Hold', 3);
+
+var radar = new tr.models.Radar();
+var toolsQuadrant = new tr.models.Quadrant('Tools');
+var techniquesQuadrant = new tr.models.Quadrant('Techniques');
+var platformsQuadrant = new tr.models.Quadrant('Platforms');
+var languageFramework = new tr.models.Quadrant('Languages & Frameworks');
+
+<% fn_blip_line = fn(p) -> "         new tr.models.Blip('" <> p.name <> "', "
+                        <> String.downcase(Enum.at(TechRadarEditor.RadarDataPoint.cycles, p.cycle-1))  <> ", "
+                        <> if(p.is_new, do: "true", else: "false")
+                        <> if(p.description != nil, do: ",'" <> p.description <> "'", else: "")
+                        <> ")"
+                  end 
+%>
+
+toolsQuadrant.add([
+    <%= raw(Enum.join( Enum.map(@radar_quadrants[1], fn(p) -> fn_blip_line.(p) end),",\n")) %>
+]);
+
+techniquesQuadrant.add([
+    <%= raw(Enum.join( Enum.map(@radar_quadrants[2], fn(p) -> fn_blip_line.(p) end),",\n")) %>
+]);
+
+platformsQuadrant.add([
+    <%= raw(Enum.join( Enum.map(@radar_quadrants[3], fn(p) -> fn_blip_line.(p) end),",\n")) %>
+]);
+
+languageFramework.add([
+    <%= raw(Enum.join( Enum.map(@radar_quadrants[4], fn(p) -> fn_blip_line.(p) end),",\n")) %>
+]);
+
+radar.setFirstQuadrant(toolsQuadrant);
+radar.setSecondQuadrant(techniquesQuadrant);
+radar.setThirdQuadrant(platformsQuadrant);
+radar.setFourthQuadrant(languageFramework);
+
+var innerWidth = window.innerWidth;
+var innerHeight = window.innerHeight;
+
+radarSize = Math.min(innerWidth-20, innerHeight-20, 1080);
+
+var radarGraph = new tr.graphing.Radar(radarSize, radar);
+radarGraph.init('#radar').plot();
+var refTable = new tr.graphing.RefTable(radar);
+refTable.init('#ref-table').render();
+
+ref_table = document.getElementsByClassName('radar-ref-table')[0];
+for (var i = 0, trow; trow = ref_table.rows[i]; i++) {
+    if (trow.cells.length == 3) {
+        var blip_number = trow.cells[0].textContent;
+        var new_cell = trow.insertCell(-1);
+        s_form = "<form action=\"/" + blip_number + "\" class=\"link\" method=\"post\">";
+        s_form += "<input name=\"_method\" type=\"hidden\" value=\"delete\">";
+        s_form += "<a class=\"btn btn-danger btn-xs\" data-confirm=\"Are you sure?\" data-submit=\"parent\" href=\"#\" rel=\"nofollow\">Delete</a>";
+        s_form += "<input type=\"hidden\" name=\"_csrf_token\" value=\"<%= get_csrf_token() %>\">";
+        s_form += "</form>";
+        new_cell.innerHTML = s_form;
+    };
+};
+
+/* Set the width of the side navigation to 250px */
+function openNav() {
+    document.getElementById("sidenav").style.width = "80%";
+}
+
+/* Set the width of the side navigation to 0 */
+function closeNav() {
+    document.getElementById("sidenav").style.width = "0";
+} 
+
 </script>
 
+<button onclick="openNav()">Show Blips</button><br />
 <a href="/admin/radar_data_point">Admin Radar Data Point</a>
 
index 93f68e0..f0644cd 100644 (file)
@@ -1,4 +1,3 @@
-
 <h2>New radar data point</h2>
 
 <%= render "form.html", changeset: @changeset,