Add Admin/Nodes page
authorTom Clegg <tom@clinicalfuture.com>
Mon, 18 Nov 2013 19:21:30 +0000 (11:21 -0800)
committerTom Clegg <tom@clinicalfuture.com>
Mon, 18 Nov 2013 19:21:30 +0000 (11:21 -0800)
12 files changed:
apps/workbench/app/assets/javascripts/nodes.js.coffee [new file with mode: 0644]
apps/workbench/app/assets/stylesheets/nodes.css.scss [new file with mode: 0644]
apps/workbench/app/assets/stylesheets/scaffolds.css.scss [new file with mode: 0644]
apps/workbench/app/controllers/nodes_controller.rb [new file with mode: 0644]
apps/workbench/app/helpers/nodes_helper.rb [new file with mode: 0644]
apps/workbench/app/models/node.rb [new file with mode: 0644]
apps/workbench/app/views/layouts/application.html.erb
apps/workbench/config/routes.rb
apps/workbench/test/fixtures/nodes.yml [new file with mode: 0644]
apps/workbench/test/functional/nodes_controller_test.rb [new file with mode: 0644]
apps/workbench/test/unit/helpers/nodes_helper_test.rb [new file with mode: 0644]
apps/workbench/test/unit/node_test.rb [new file with mode: 0644]

diff --git a/apps/workbench/app/assets/javascripts/nodes.js.coffee b/apps/workbench/app/assets/javascripts/nodes.js.coffee
new file mode 100644 (file)
index 0000000..7615679
--- /dev/null
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
diff --git a/apps/workbench/app/assets/stylesheets/nodes.css.scss b/apps/workbench/app/assets/stylesheets/nodes.css.scss
new file mode 100644 (file)
index 0000000..7210602
--- /dev/null
@@ -0,0 +1,3 @@
+// Place all the styles related to the Nodes controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/apps/workbench/app/assets/stylesheets/scaffolds.css.scss b/apps/workbench/app/assets/stylesheets/scaffolds.css.scss
new file mode 100644 (file)
index 0000000..6ec6a8f
--- /dev/null
@@ -0,0 +1,69 @@
+body {
+  background-color: #fff;
+  color: #333;
+  font-family: verdana, arial, helvetica, sans-serif;
+  font-size: 13px;
+  line-height: 18px;
+}
+
+p, ol, ul, td {
+  font-family: verdana, arial, helvetica, sans-serif;
+  font-size: 13px;
+  line-height: 18px;
+}
+
+pre {
+  background-color: #eee;
+  padding: 10px;
+  font-size: 11px;
+}
+
+a {
+  color: #000;
+  &:visited {
+    color: #666;
+  }
+  &:hover {
+    color: #fff;
+    background-color: #000;
+  }
+}
+
+div {
+  &.field, &.actions {
+    margin-bottom: 10px;
+  }
+}
+
+#notice {
+  color: green;
+}
+
+.field_with_errors {
+  padding: 2px;
+  background-color: red;
+  display: table;
+}
+
+#error_explanation {
+  width: 450px;
+  border: 2px solid red;
+  padding: 7px;
+  padding-bottom: 0;
+  margin-bottom: 20px;
+  background-color: #f0f0f0;
+  h2 {
+    text-align: left;
+    font-weight: bold;
+    padding: 5px 5px 5px 15px;
+    font-size: 12px;
+    margin: -7px;
+    margin-bottom: 0px;
+    background-color: #c00;
+    color: #fff;
+  }
+  ul li {
+    font-size: 12px;
+    list-style: square;
+  }
+}
diff --git a/apps/workbench/app/controllers/nodes_controller.rb b/apps/workbench/app/controllers/nodes_controller.rb
new file mode 100644 (file)
index 0000000..36348d6
--- /dev/null
@@ -0,0 +1,2 @@
+class NodesController < ApplicationController
+end
diff --git a/apps/workbench/app/helpers/nodes_helper.rb b/apps/workbench/app/helpers/nodes_helper.rb
new file mode 100644 (file)
index 0000000..673b561
--- /dev/null
@@ -0,0 +1,2 @@
+module NodesHelper
+end
diff --git a/apps/workbench/app/models/node.rb b/apps/workbench/app/models/node.rb
new file mode 100644 (file)
index 0000000..e67dd9e
--- /dev/null
@@ -0,0 +1,3 @@
+class Node < ArvadosBase
+  attr_accessor :object
+end
index 1865aff0127cda26e204c9cd9e8a065c7580f2d6..54c9b94aa05080f39f94e6d39cb9f15548a7f8a4 100644 (file)
@@ -81,6 +81,7 @@
               <ul class="dropdown-menu">
                 <li><%= link_to 'Users', users_path %></li>
                 <li><%= link_to 'Groups', groups_path %></li>
+                <li><%= link_to 'Nodes', nodes_path %></li>
               </ul>
             </li>
             <% end %>
index f3cd099e7a56bdf6d37844646cb2a0aaa7e012ef..9f8486d755ff09c06ecb4c931d75649e67cdd40b 100644 (file)
@@ -1,4 +1,7 @@
 ArvadosWorkbench::Application.routes.draw do
+  resources :nodes
+
+
   resources :humans
 
 
diff --git a/apps/workbench/test/fixtures/nodes.yml b/apps/workbench/test/fixtures/nodes.yml
new file mode 100644 (file)
index 0000000..c63aac0
--- /dev/null
@@ -0,0 +1,11 @@
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
+
+# This model initially had no columns defined.  If you add columns to the
+# model remove the '{}' from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+#  column: value
diff --git a/apps/workbench/test/functional/nodes_controller_test.rb b/apps/workbench/test/functional/nodes_controller_test.rb
new file mode 100644 (file)
index 0000000..9962d9b
--- /dev/null
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class NodesControllerTest < ActionController::TestCase
+  setup do
+    @node = nodes(:one)
+  end
+
+  test "should get index" do
+    get :index
+    assert_response :success
+    assert_not_nil assigns(:nodes)
+  end
+
+  test "should get new" do
+    get :new
+    assert_response :success
+  end
+
+  test "should create node" do
+    assert_difference('Node.count') do
+      post :create, node: {  }
+    end
+
+    assert_redirected_to node_path(assigns(:node))
+  end
+
+  test "should show node" do
+    get :show, id: @node
+    assert_response :success
+  end
+
+  test "should get edit" do
+    get :edit, id: @node
+    assert_response :success
+  end
+
+  test "should update node" do
+    put :update, id: @node, node: {  }
+    assert_redirected_to node_path(assigns(:node))
+  end
+
+  test "should destroy node" do
+    assert_difference('Node.count', -1) do
+      delete :destroy, id: @node
+    end
+
+    assert_redirected_to nodes_path
+  end
+end
diff --git a/apps/workbench/test/unit/helpers/nodes_helper_test.rb b/apps/workbench/test/unit/helpers/nodes_helper_test.rb
new file mode 100644 (file)
index 0000000..13011de
--- /dev/null
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class NodesHelperTest < ActionView::TestCase
+end
diff --git a/apps/workbench/test/unit/node_test.rb b/apps/workbench/test/unit/node_test.rb
new file mode 100644 (file)
index 0000000..ccc3765
--- /dev/null
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class NodeTest < ActiveSupport::TestCase
+  # test "the truth" do
+  #   assert true
+  # end
+end