Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Initial controller & views for status admin
  • Loading branch information
djgraham committed Feb 1, 2012
1 parent 9206cae commit 6a29e5c
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/admin/statuses.js.coffee
@@ -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/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/admin/statuses.css.scss
@@ -0,0 +1,3 @@
// Place all the styles related to the admin/statuses controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
Binary file not shown.
13 changes: 13 additions & 0 deletions app/controllers/admin/statuses_controller.rb
@@ -0,0 +1,13 @@
class Admin::StatusesController < ApplicationController

respond_to :html

def index
@statuses = Status.all
end

def edit
@status = Status.find(params[:id])
end

end
2 changes: 2 additions & 0 deletions app/helpers/admin/statuses_helper.rb
@@ -0,0 +1,2 @@
module Admin::StatusesHelper
end
Binary file added app/views/admin/statuses/._form.html.erb.swp
Binary file not shown.
13 changes: 13 additions & 0 deletions app/views/admin/statuses/_form.html.erb
@@ -0,0 +1,13 @@
<%= semantic_form_for [:admin, @status] do |f| %>
<%= f.inputs do %>
<%= f.input :name %>
<%= f.input :colour %>
<% end %>
<%= f.buttons do %>
<%= f.commit_button 'Add Answer' %>
<% end %>
<% end %>

5 changes: 5 additions & 0 deletions app/views/admin/statuses/edit.html.erb
@@ -0,0 +1,5 @@
<h1>Edit status</h1>

<%= render :partial => "form" %>


18 changes: 18 additions & 0 deletions app/views/admin/statuses/index.html.erb
@@ -0,0 +1,18 @@
<h1>Statuses</h1>

<% if @statuses.size > 1 %>
<table>
<thead>
<th>Status name</th>
<th>Colour code</th>
</thead>
<tbody>
<% @statuses.each do |status| %>
<tr>
<td><%= link_to edit_admin_status(status), status.name %></td>
<td>#<%= status.colour %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
5 changes: 3 additions & 2 deletions config/routes.rb
@@ -1,7 +1,8 @@
MelbourneStatus::Application.routes.draw do


resources :statuses
namespace :admin do
resources :statuses
end
# The priority is based upon order of creation:
# first created -> highest priority.

Expand Down
5 changes: 5 additions & 0 deletions spec/controllers/admin/statuses_controller_spec.rb
@@ -0,0 +1,5 @@
require 'spec_helper'

describe Admin::StatusesController do

end
15 changes: 15 additions & 0 deletions spec/helpers/admin/statuses_helper_spec.rb
@@ -0,0 +1,15 @@
require 'spec_helper'

# Specs in this file have access to a helper object that includes
# the Admin::StatusesHelper. For example:
#
# describe Admin::StatusesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# helper.concat_strings("this","that").should == "this that"
# end
# end
# end
describe Admin::StatusesHelper do
pending "add some examples to (or delete) #{__FILE__}"
end

0 comments on commit 6a29e5c

Please sign in to comment.