additional functional tests, some controller fixes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class ArtistsController < ApplicationController
|
||||
before_filter :member_only
|
||||
before_filter :member_only, :except => [:index, :show]
|
||||
|
||||
def new
|
||||
@artist = Artist.new_with_defaults(params)
|
||||
@@ -48,7 +48,8 @@ class ArtistsController < ApplicationController
|
||||
|
||||
def revert
|
||||
@artist = Artist.find(params[:id])
|
||||
@artist.revert_to!(params[:version])
|
||||
@version = ArtistVersion.find(params[:version_id])
|
||||
@artist.revert_to!(@version)
|
||||
redirect_to artist_path(@artist), :notice => "Artist updated"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -20,6 +20,8 @@ class BansController < ApplicationController
|
||||
|
||||
def create
|
||||
@ban = Ban.new(params[:ban])
|
||||
@ban.banner_id = CurrentUser.id
|
||||
|
||||
if @ban.save
|
||||
redirect_to ban_path(@ban), :notice => "Ban created"
|
||||
else
|
||||
@@ -39,5 +41,6 @@ class BansController < ApplicationController
|
||||
def destroy
|
||||
@ban = Ban.find(params[:id])
|
||||
@ban.destroy
|
||||
redirect_to bans_path, :notice => "Ban destroyed"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,8 +19,7 @@ class CommentsController < ApplicationController
|
||||
@comment.save
|
||||
respond_with(@comment) do |format|
|
||||
format.html do
|
||||
flash[:notice] = "Comment posted"
|
||||
redirect_to posts_path(@comment.post)
|
||||
redirect_to post_path(@comment.post), :notice => "Comment posted"
|
||||
end
|
||||
|
||||
format.js
|
||||
|
||||
@@ -7,6 +7,7 @@ class Artist < ActiveRecord::Base
|
||||
belongs_to :creator, :class_name => "User"
|
||||
has_many :members, :class_name => "Artist", :foreign_key => "group_name", :primary_key => "name"
|
||||
has_many :urls, :dependent => :destroy, :class_name => "ArtistUrl"
|
||||
has_many :versions, :order => "artist_versions.id", :class_name => "ArtistVersion"
|
||||
has_one :wiki_page, :foreign_key => "title", :primary_key => "name"
|
||||
has_one :tag_alias, :foreign_key => "antecedent_name", :primary_key => "name"
|
||||
accepts_nested_attributes_for :wiki_page
|
||||
|
||||
@@ -38,6 +38,14 @@ class Ban < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
def user_name
|
||||
user ? user.name : nil
|
||||
end
|
||||
|
||||
def user_name=(username)
|
||||
self.user_id = User.name_to_id(username)
|
||||
end
|
||||
|
||||
def duration=(dur)
|
||||
self.expires_at = dur.to_i.days.from_now
|
||||
@duration = dur
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @artists.each do |artist| %>
|
||||
<% content_tag(:tr, :id => "artist-#{artist.id}") do %>
|
||||
<%= content_tag(:tr, :id => "artist-#{artist.id}") do %>
|
||||
<td>
|
||||
<%= link_to "P", posts_path(:tags => artist.name), :title => "Find posts for artist" %>
|
||||
<%= link_to "E", edit_artist_path(artist), :title => "Edit artist" %>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="bans">
|
||||
<div class="new">
|
||||
<h1>Edit Ban</h1>
|
||||
<%= render "form", :locals => {:ban => @ban} %>
|
||||
<%= render :partial => "form", :locals => {:ban => @ban} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<tbody>
|
||||
<% @bans.each do |ban| %>
|
||||
<tr id="ban-<%= ban.id %>">
|
||||
<td><%= ban.user_name %></td>
|
||||
<td><%= ban.user.name %></td>
|
||||
<td><%= ban.expires_at %></td>
|
||||
<td><%= ban.reason %></td>
|
||||
<td>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div class="bans">
|
||||
<div class="new">
|
||||
<h1>New Ban</h1>
|
||||
<%= render "form", :locals => {:ban => @ban} %>
|
||||
<%= render :partial => "form", :locals => {:ban => @ban} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="show">
|
||||
<h1>Show Ban</h1>
|
||||
<ul>
|
||||
<li><strong>User</strong>: <%= @ban.user_name %></li>
|
||||
<li><strong>User</strong>: <%= @ban.user.name %></li>
|
||||
<li><strong>Expires</strong>: <%= @ban.expires_at %></li>
|
||||
<li><strong>Reason</strong>: <%= @ban.reason %></li>
|
||||
</ul>
|
||||
|
||||
3
app/views/comment_votes/create.js.erb
Normal file
3
app/views/comment_votes/create.js.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<% if @error %>
|
||||
alert(<%= escape_javascript(@error.to_s) %>);
|
||||
<% end %>
|
||||
@@ -1,3 +0,0 @@
|
||||
if @error
|
||||
page.alert(@error.to_s)
|
||||
end
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="preview">
|
||||
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
|
||||
</div>
|
||||
<%= render "comments/partials/index/list", :locals => {:post => post, :comments => post.comments.recent.reverse, :show_header => true} %>
|
||||
<%= render :partial => "comments/partials/index/list", :locals => {:post => post, :comments => post.comments.recent.reverse, :show_header => true} %>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user