Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Getting rid of useless views. Started to add the barebone admin view

  • Loading branch information...
commit 3ff3809b9c91c93b19b65d0d8b58d9b0d047bd93 1 parent b42dcfb
Austin Fonacier authored
View
3  .gitignore
@@ -1,2 +1,3 @@
db/*.sqlite3
-log/*.log
+log/*.log
+tmp/*
View
1  app/controllers/questions_controller.rb
@@ -84,5 +84,6 @@ def update
# /questions/admin
def admin
+ @questions = Question.ready_to_go
end
end
View
1  app/views/layouts/questions.html.erb
@@ -6,6 +6,7 @@
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>Questions: <%= controller.action_name %></title>
<%= stylesheet_link_tag 'scaffold' %>
+ <%= javascript_include_tag 'jquery', 'application' %>
</head>
<body>
View
11 app/views/questions/admin.html.haml
@@ -0,0 +1,11 @@
+%table
+ %tr
+ %th= "User Id"
+ %th= "Question"
+ %th= "Disable Question"
+ - @questions.each do |question|
+ %tr{:id => question.id}
+ %td= question.user_id
+ %td= question.question
+ %td= check_box_tag( 'disabled')
+
View
24 app/views/questions/edit.html.erb
@@ -1,24 +0,0 @@
-<h1>Editing question</h1>
-
-<% form_for(@question) do |f| %>
- <%= f.error_messages %>
-
- <p>
- <%= f.label :user_id %><br />
- <%= f.text_field :user_id %>
- </p>
- <p>
- <%= f.label :question %><br />
- <%= f.text_area :question %>
- </p>
- <p>
- <%= f.label :disable %><br />
- <%= f.check_box :disable %>
- </p>
- <p>
- <%= f.submit 'Update' %>
- </p>
-<% end %>
-
-<%= link_to 'Show', @question %> |
-<%= link_to 'Back', questions_path %>
View
24 app/views/questions/index.html.erb
@@ -1,24 +0,0 @@
-<h1>Listing questions</h1>
-
-<table>
- <tr>
- <th>User</th>
- <th>Question</th>
- <th>Disable</th>
- </tr>
-
-<% @questions.each do |question| %>
- <tr>
- <td><%=h question.user_id %></td>
- <td><%=h question.question %></td>
- <td><%=h question.disable %></td>
- <td><%= link_to 'Show', question %></td>
- <td><%= link_to 'Edit', edit_question_path(question) %></td>
- <td><%= link_to 'Destroy', question, :confirm => 'Are you sure?', :method => :delete %></td>
- </tr>
-<% end %>
-</table>
-
-<br />
-
-<%= link_to 'New question', new_question_path %>
View
23 app/views/questions/new.html.erb
@@ -1,23 +0,0 @@
-<h1>New question</h1>
-
-<% form_for(@question) do |f| %>
- <%= f.error_messages %>
-
- <p>
- <%= f.label :user_id %><br />
- <%= f.text_field :user_id %>
- </p>
- <p>
- <%= f.label :question %><br />
- <%= f.text_area :question %>
- </p>
- <p>
- <%= f.label :disable %><br />
- <%= f.check_box :disable %>
- </p>
- <p>
- <%= f.submit 'Create' %>
- </p>
-<% end %>
-
-<%= link_to 'Back', questions_path %>
View
18 app/views/questions/show.html.erb
@@ -1,18 +0,0 @@
-<p>
- <b>User:</b>
- <%=h @question.user_id %>
-</p>
-
-<p>
- <b>Question:</b>
- <%=h @question.question %>
-</p>
-
-<p>
- <b>Disable:</b>
- <%=h @question.disable %>
-</p>
-
-
-<%= link_to 'Edit', edit_question_path(@question) %> |
-<%= link_to 'Back', questions_path %>
View
5 config/environment.rb
@@ -16,10 +16,7 @@
# Specify gems that this application depends on and have them installed with rake gems:install
config.gem "json"
- # config.gem "bj"
- # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
- # config.gem "sqlite3-ruby", :lib => "sqlite3"
- # config.gem "aws-s3", :lib => "aws/s3"
+ config.gem "haml"
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named
View
0  app/views/questions/admin.html.erb → public/javascripts/application.js
File renamed without changes
View
0  public/jquery.js → public/javascripts/jquery.js
File renamed without changes
View
2  spec/controllers/questions_controller_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe QuestionsController do
-
+ integrate_views
def mock_question(stubs={})
@mock_question ||= mock_model(Question, stubs)
end
View
24 spec/views/questions/edit.html.erb_spec.rb
@@ -1,24 +0,0 @@
-require 'spec_helper'
-
-describe "/questions/edit.html.erb" do
- include QuestionsHelper
-
- before(:each) do
- assigns[:question] = @question = stub_model(Question,
- :new_record? => false,
- :user_id => 1,
- :question => "value for question",
- :disable => false
- )
- end
-
- it "renders the edit question form" do
- render
-
- response.should have_tag("form[action=#{question_path(@question)}][method=post]") do
- with_tag('input#question_user_id[name=?]', "question[user_id]")
- with_tag('textarea#question_question[name=?]', "question[question]")
- with_tag('input#question_disable[name=?]', "question[disable]")
- end
- end
-end
View
27 spec/views/questions/index.html.erb_spec.rb
@@ -1,27 +0,0 @@
-require 'spec_helper'
-
-describe "/questions/index.html.erb" do
- include QuestionsHelper
-
- before(:each) do
- assigns[:questions] = [
- stub_model(Question,
- :user_id => 1,
- :question => "value for question",
- :disable => false
- ),
- stub_model(Question,
- :user_id => 1,
- :question => "value for question",
- :disable => false
- )
- ]
- end
-
- it "renders a list of questions" do
- render
- response.should have_tag("tr>td", 1.to_s, 2)
- response.should have_tag("tr>td", "value for question".to_s, 2)
- response.should have_tag("tr>td", false.to_s, 2)
- end
-end
View
24 spec/views/questions/new.html.erb_spec.rb
@@ -1,24 +0,0 @@
-require 'spec_helper'
-
-describe "/questions/new.html.erb" do
- include QuestionsHelper
-
- before(:each) do
- assigns[:question] = stub_model(Question,
- :new_record? => true,
- :user_id => 1,
- :question => "value for question",
- :disable => false
- )
- end
-
- it "renders new question form" do
- render
-
- response.should have_tag("form[action=?][method=post]", questions_path) do
- with_tag("input#question_user_id[name=?]", "question[user_id]")
- with_tag("textarea#question_question[name=?]", "question[question]")
- with_tag("input#question_disable[name=?]", "question[disable]")
- end
- end
-end
View
19 spec/views/questions/show.html.erb_spec.rb
@@ -1,19 +0,0 @@
-require 'spec_helper'
-
-describe "/questions/show.html.erb" do
- include QuestionsHelper
- before(:each) do
- assigns[:question] = @question = stub_model(Question,
- :user_id => 1,
- :question => "value for question",
- :disable => false
- )
- end
-
- it "renders attributes in <p>" do
- render
- response.should have_text(/1/)
- response.should have_text(/value\ for\ question/)
- response.should have_text(/false/)
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.