- 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
+ - Why's the trial and adopt ections so much larger than the asses and hold ?
- Big Features
- The ability to drag and drop items within the map
- Include 'ecto_enum' to support enums: https://github.com/gjaldon/ecto_enum#using-postgress-enum-type
-- Get the d3.js libraries moved into the Phoenix framework
+- Move new-items and ref-table divs to a sliding panal
-- Update the tech-radar index form to generate the form based on the database contents
-
-- Update the /radar page to include input forms for each of the cycles
- - Only show the form if a '+' button is clicked on the cycle row / 'clicking '-' hides the input row
- - clicking '-' item next to a row deletes it / removes it from the radar
+- Resize the radar so its reactive (
test "GET /", %{conn: conn} do
conn = get conn, "/"
- assert html_response(conn, 200) =~ "Welcome to Phoenix!"
+ assert html_response(conn, 200) =~ "Pwan.co Radar"
end
end
use TechRadarEditor.ConnCase
alias TechRadarEditor.RadarDataPoint
- @valid_attrs %{cycle: 42, description: "some content", is_new: true, name: "some content", quadrant: 42}
+ @valid_attrs %{cycle: 2, description: "some content", is_new: true, name: "some content", quadrant: 2}
@invalid_attrs %{}
test "lists all entries on index", %{conn: conn} do
assert html_response(conn, 200) =~ "New radar data point"
end
- test "shows chosen resource", %{conn: conn} do
+ test "show s 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"
alias TechRadarEditor.RadarDataPoint
- @valid_attrs %{cycle: 42, description: "some content", is_new: true, name: "some content", quadrant: 42}
+ @valid_attrs %{cycle: 2, description: "some content", is_new: true, name: "some content", quadrant: 2}
@invalid_attrs %{}
test "changeset with valid attributes" do
changeset = RadarDataPoint.changeset(%RadarDataPoint{}, @invalid_attrs)
refute changeset.valid?
end
+
end
# http://www.cultivatehq.com/posts/how-to-set-different-layouts-in-phoenix/
def index(conn, _params) do
+ changeset = RadarDataPoint.changeset(%RadarDataPoint{})
radar_quadrants = _make_quadrants(Repo.all(RadarDataPoint))
- render conn, "index.html", radar_quadrants: radar_quadrants, layout: {TechRadarEditor.LayoutView, "radar.html"}
+ render conn, "index.html", radar_quadrants: radar_quadrants, changeset: changeset, layout: {TechRadarEditor.LayoutView, "radar.html"}
+ end
+
+ def create(conn, %{"radar_data_point" => radar_data_point_params}) do
+ changeset = RadarDataPoint.changeset(%RadarDataPoint{}, radar_data_point_params)
+
+ case Repo.insert(changeset) do
+ {:ok, _radar_data_point} ->
+ conn
+ |> put_flash(:info, "Radar data point created successfully.")
+ |> redirect(to: radar_path(conn, :index), layout: {TechRadarEditor.LayoutView, "radar.html"} )
+ {:error, changeset} ->
+ render(conn, "new.html", changeset: changeset)
+ end
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.")
+ |> put_flash(:info, "Radar data point " <> id <> " successfully deleted.")
|> redirect(to: radar_path(conn, :index), layout: {TechRadarEditor.LayoutView, "radar.html"} )
end
# get "/", PageController, :index
# get "/radar", RadarController, :index
- get "/original", PageController, :index
- get "/", RadarController, :index
+
+# get "/original", PageController, :index
+# get "/", RadarController, :index
+# post "/", RadarController, :create # ????
+
+ resources "/", RadarController, only: [:index, :create, :delete]
end
scope "/admin", TechRadarEditor do
fill: #000;
display: none; }
svg text.line-text {
+ font-size: 12px;
font-weight: bold;
text-transform: uppercase;
fill: #000; }
<html lang="en">
<head>
<meta charset="utf-8">
- <title>Thoughtworks Radar 2014</title>
+ <title>Pwan.co Radar 02017</title>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,700' rel='stylesheet' type='text/css'>
-<!-- <script src="chance.js"></script>
- <script src="d3.min.js"></script>
- <script src="tech-radar.min.js"></script> -->
-
<script src="<%= static_path(@conn, "/js/app.js") %>"></script>
-
<link href="<%= static_path(@conn, "/css/app.css") %>" rel="stylesheet" type="text/css" />
</head>
</div>
<div id="new-items">
- <form name="newBlip">
+ <%= form_for @changeset, radar_path(@conn, :create), fn f -> %>
<table class="radar-input-table" >
<thead>
<tr class="radar-input-status-group">
</thead>
<tr c>
<td>
- <select name="quadrant">
- <option value="1">Tool</option>
- <option value="2">Technique</option>
- <option value="3">Platform</option>
- <option value="4">Language</option>
- </select>
+ <%= select f, :quadrant, Enum.with_index(TechRadarEditor.RadarDataPoint.quadrants,1) %>
</td>
<td>
- <select name="cycle">
- <option value="1">Adopt</option>
- <option value="2">Trial</option>
- <option value="3">Assess</option>
- <option value="4">Hold</option>
- </select>
+ <%= select f, :cycle, Enum.with_index(TechRadarEditor.RadarDataPoint.cycles,1) %>
</td>
<td>
- <input type="text" name="name" />
+ <%= text_input f, :name %>
</td>
<td>
- <input type="text" name="description" />
+ <%= text_input f, :description %>
</td>
<td>
- <input name="Add" type="submit" value="Add" />
+ <%= hidden_input f, :is_new, value: "true" %>
+ <%= submit "Add", class: "btn btn-primary" %>
</td>
</tr>
</table>
- </form>
+ <% end %>
</div>
<div id="ref-table">
</div>
radar.setThirdQuadrant(platformsQuadrant);
radar.setFourthQuadrant(languageFramework);
- // var radarGraph = new tr.graphing.Radar(1080, radar);
- var radarGraph = new tr.graphing.Radar(1100, radar);
+ 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();
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 = "<a href='./delete/" + blip_number + "' class='btn btn-danger btn-xs'>Delete</a>"
+ 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;
};
};
+
<h2>New radar data point</h2>
<%= render "form.html", changeset: @changeset,
<li>
<strong>Quadrant:</strong>
- <%= Enum.at(TechRadarEditor.RadarDataPoint.quadrants, @radar_data_point.quadrant-1) %>
+ <%= if @radar_data_point.quadrant != nil, do: Enum.at(TechRadarEditor.RadarDataPoint.quadrants, @radar_data_point.quadrant-1), else: '' %>
</li>
<li>
<strong>Cycle:</strong>
- <%= Enum.at(TechRadarEditor.RadarDataPoint.cycles, @radar_data_point.cycle-1) %>
+ <%= if @radar_data_point.cycle != nil, do: Enum.at(TechRadarEditor.RadarDataPoint.cycles, @radar_data_point.cycle-1), else: '' %>
</li>
<li>