fix user feedback controller test

This commit is contained in:
albert
2011-07-17 18:40:24 -04:00
parent 72e9da01b5
commit 98403d0cb7
17 changed files with 100 additions and 154 deletions

View File

@@ -1,7 +0,0 @@
<% if @user %>
<% content_for("subnavbar") do %>
<li><%= link_to "Add", :action => "create", :user_id => @user.id %></li>
<li><%= link_to "List for user", :action => "index", :user_id => @user.id %></li>
<li><%= link_to "List for all", :action => "index", :user_id => nil %></li>
<% end %>
<% end %>

View File

@@ -1,42 +0,0 @@
<div id="user-record">
<h4>Record</h4>
<table width="100%">
<thead>
<tr>
<th width="15%">User</th>
<th width="15%">Reporter</th>
<th width="15%">When</th>
<th width="50%">Body</th>
<th width="5%"></th>
</tr>
</thead>
<tbody>
<% @user_records.each do |rec| %>
<tr class="<%= rec.is_positive? ? 'positive-record' : 'negative-record' %>" id="record-<%= rec.id %>">
<td>
<% if @user %>
<%= link_to h(rec.user.pretty_name), :controller => "user", :action => "show", :id => rec.user_id %>
<% else %>
<%= link_to h(rec.user.pretty_name), :action => "index", :user_id => rec.user_id %>
<% end %>
</td>
<td><%= h(rec.reporter.pretty_name) %></td>
<td><%= time_ago_in_words(rec.created_at) %> ago</td>
<td><%= format_text(rec.body) %></td>
<td>
<% if @current_user.is_mod_or_higher? || @current_user.id == rec.reported_by %>
<%= link_to_function "Delete", "UserRecord.destroy(#{rec.id})" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<div id="paginator">
<%= will_paginate(@user_records) %>
</div>
<%= render :partial => "footer" %>
</div>

View File

@@ -1,29 +0,0 @@
<h4>Add Record for <%= h(@user.pretty_name) %></h4>
<div id="preview" style="margin-bottom: 1em;">
</div>
<% form_tag(:action => "create") do %>
<%= hidden_field_tag "user_id", @user.id %>
<table width="100%">
<tbody>
<tr>
<th width="10%"><label>Positive</label></th>
<td width="90%"><%= check_box "user_record", "is_positive" %></td>
</tr>
<tr>
<th><label>Reason</label></th>
<td><%= text_area "user_record", "body", :size => "20x8" %></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
<%= submit_tag "Submit" %>
<%= submit_to_remote "preview", "Preview", :url => {:action => "preview"}, :update => "preview", :method => :get %>
<%= button_to_function "Cancel", "location.back()" %>
</td>
</tr>
</tfoot>
</table>
<% end %>

View File

@@ -0,0 +1,6 @@
<% content_for(:secondary_links) do %>
<menu>
<li><%= link_to "New", new_user_feedback_path %></li>
<li><%= link_to "Listing", user_feedbacks_path %></li>
</menu>
<% end %>

View File

@@ -0,0 +1,32 @@
<div id="c-user-feedbacks">
<div id="a-index">
<h1>User Feedback</h1>
<table width="100%">
<thead>
<tr>
<th width="15%">User</th>
<th width="15%">Creator</th>
<th width="15%">When</th>
<th width="55%">Message</th>
</tr>
</thead>
<tbody>
<% @user_feedbacks.each do |feedback| %>
<tr>
<td><%= link_to feedback.user_name, user_feedback_path(feedback.user_id) %></td>
<td><%= feedback.creator.name %></td>
<td><%= time_ago_in_words(feedback.created_at) %> ago</td>
<td><%= format_text(feedback.body) %></td>
</tr>
<% end %>
</tbody>
</table>
<div class="paginator">
<%= numbered_paginator(@user_feedbacks) %>
</div>
<%= render "secondary_links" %>
</div>
</div>

View File

@@ -0,0 +1,17 @@
<div id="c-user-feedbacks">
<div id="a-new">
<h1>New User Feedback</h1>
<div id="preview">
</div>
<%= simple_form_for(@user_feedback) do |f| %>
<%= f.input :user_name %>
<%= f.input :category, :collection => ["positive", "neutral", "negative"] %>
<%= f.input :body %>
<%= f.button :submit %>
<%= f.button :submit, :value => "Preview" %>
<% end %>
</div>
</div>

View File

@@ -0,0 +1,14 @@
<div id="c-user-feedbacks">
<div id="a-show">
<h1>User Feedback For <%= @user_feedback.user_name %></h1>
<ul>
<li><strong>Creator</strong> <%= @user_feedback.creator.name %></li>
<li><strong>Date</strong> <%= @user_feedback.created_at %></li>
<li><strong>Category</strong> <%= @user_feedback.category %></li>
<li><strong>Message</strong> <%= format_text @user_feedback.body %></li>
</ul>
</div>
</div>
<%= render "secondary_links" %>