From: Jude N Date: Tue, 27 Jun 2017 03:52:08 +0000 (-0400) Subject: Checkpoint commit X-Git-Url: https://pwan.org/git/?p=tech-radar-editor.git;a=commitdiff_plain;h=fa39186cb771e6b81962f0e9328c6cb609f8871c Checkpoint commit --- diff --git a/TODO.md b/TODO.md index 609db16..0eab2ab 100644 --- a/TODO.md +++ b/TODO.md @@ -1,9 +1,21 @@ -- Create database - - quadrant: enum (tool, technique, platform, language) - - cycle: enum (adapt, trial, assess, hold) - - is_new: boolean - - name: string - - description: string +- Bugs: + - Top of 'Techniques is cut off' + - Right hand side is cut off a lot: only the 'H' of 'HOLD' is shown ! + - Bottom of the radar is truncated as well + +- Big Features + - The ability to drag and drop items within the map + - Would need to store the location of the items + - Ability to move maps into the future: + - Copy the radar but switch any 'is_new' items to False + - Any new items have 'is_new' set to true by default. + +- database + - Update README.md with steps for creating the database + - Surface the index number used ? + - Surface a 'Radar' table with name / index / + - Support showing different radars / multiple users / changes over time + - Allow saving radars under a different name. - Include 'ecto_enum' to support enums: https://github.com/gjaldon/ecto_enum#using-postgress-enum-type diff --git a/web/controllers/radar_controller.ex b/web/controllers/radar_controller.ex index 24b2e5a..44126db 100644 --- a/web/controllers/radar_controller.ex +++ b/web/controllers/radar_controller.ex @@ -3,9 +3,27 @@ defmodule TechRadarEditor.RadarController do alias TechRadarEditor.RadarDataPoint + def _make_quadrants(radar_data_points) do + List.foldl(radar_data_points, + %{1 => [], 2 => [], 3 => [], 4 => []}, + fn(p, acc) -> %{acc | p.quadrant => acc[p.quadrant] ++ [p]} end + ) + end + # http://www.cultivatehq.com/posts/how-to-set-different-layouts-in-phoenix/ def index(conn, _params) do - radar_data_points = Repo.all(RadarDataPoint) - render conn, "index.html", radar_data_points: radar_data_points, layout: {TechRadarEditor.LayoutView, "radar.html"} + radar_quadrants = _make_quadrants(Repo.all(RadarDataPoint)) + render conn, "index.html", radar_quadrants: radar_quadrants, layout: {TechRadarEditor.LayoutView, "radar.html"} + end + + # UNTESTED + def delete(conn, %{"id" => id}) do + radar_data_point = Repo.get!(RadarDataPoint, id) + Repo.delete!(radar_data_point) + + conn + |> put_flash(:info, "Radar data point " + id + " successfully deleted.") + |> redirect(to: radar_path(conn, :index), layout: {TechRadarEditor.LayoutView, "radar.html"} ) end + end diff --git a/web/models/radar_data_point.ex b/web/models/radar_data_point.ex index bb3580a..fb08bb3 100644 --- a/web/models/radar_data_point.ex +++ b/web/models/radar_data_point.ex @@ -27,7 +27,7 @@ defmodule TechRadarEditor.RadarDataPoint do end def cycles do - ["Adapt", "Trial", "Assess", "Hold"] + ["Adopt", "Trial", "Assess", "Hold"] end diff --git a/web/static/vendor/base.css b/web/static/vendor/base.css index cb1ac4f..7c56d53 100644 --- a/web/static/vendor/base.css +++ b/web/static/vendor/base.css @@ -2,7 +2,8 @@ body { font: 11px 'Open Sans'; } svg { - padding: 20px; } + padding: 00px; + } svg circle:nth-child(1) { stroke: none; fill: #eaeaea; } @@ -40,7 +41,7 @@ svg { svg text.fourth { fill: #8d2145; } svg text.first, svg text.second, svg text.third, svg text.fourth { - font-size: 16px; + font-size: 14px; font-weight: bold; } svg text.blip-text { font-size: 9px; @@ -71,3 +72,19 @@ svg { font-size: 20px; font-weight: bold; background: #fafafa; } + +.radar-input-table { + width: 1080px; + font-size: 16px; + line-height: 26px; + padding: 20px; } + .radar-input-table tr:nth-child(odd) { + background: #bababa; } + .radar-input-table tr:nth-child(even) { + background: #dadada; } + .radar-input-table td { + padding: 10px 15px; } + .radar-input-table tr.radar-input-status-group { + font-size: 20px; + font-weight: bold; + background: #fafafa; } diff --git a/web/templates/radar/index.html.eex b/web/templates/radar/index.html.eex index 7ef33f0..e2892e4 100644 --- a/web/templates/radar/index.html.eex +++ b/web/templates/radar/index.html.eex @@ -1,7 +1,51 @@
-
+
+ +
+ + + + + + + + + + + + + + + + + +
QuadrantCycleNameDescription
+ + + + + + + + + +
+
+
+
+
+ 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); + new_cell.innerHTML = "Delete" + }; + }; + Admin Radar Data Point diff --git a/web/templates/radar_data_point/form.html.eex b/web/templates/radar_data_point/form.html.eex index e1f22ba..211a7fb 100644 --- a/web/templates/radar_data_point/form.html.eex +++ b/web/templates/radar_data_point/form.html.eex @@ -1,3 +1,4 @@ + <%= form_for @changeset, @action, fn f -> %> <%= if @changeset.action do %>
@@ -14,7 +15,6 @@
<%= label f, :cycle, class: "control-label" %> <%= select f, :cycle, Enum.with_index(TechRadarEditor.RadarDataPoint.cycles,1), class: "form-control" %> - <%= error_tag f, :cycle %>