forked from e621ng/e621ng
work on tag controller
This commit is contained in:
parent
5a2644f4a6
commit
37e1b8d9da
12
app/views/tags/edit.html.erb
Normal file
12
app/views/tags/edit.html.erb
Normal file
@ -0,0 +1,12 @@
|
||||
<div id="c-tags">
|
||||
<div id="a-edit">
|
||||
<h1>Tag: <%= @tag.name %></h1>
|
||||
|
||||
<%= simple_form_for(@tag) do |f| %>
|
||||
<%= f.input :category, :collection => Danbooru.config.canonical_tag_category_mapping.to_a %>
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
7
app/views/tags/show.html.erb
Normal file
7
app/views/tags/show.html.erb
Normal file
@ -0,0 +1,7 @@
|
||||
<div id="c-tags">
|
||||
<div id="a-show">
|
||||
<h1>Tag: <%= @tag.name %></h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
@ -163,6 +163,15 @@ module Danbooru
|
||||
}
|
||||
end
|
||||
|
||||
def canonical_tag_category_mapping
|
||||
@canonical_tag_category_mapping ||= {
|
||||
"General" => 0,
|
||||
"Artist" => 1,
|
||||
"Copyright" => 2,
|
||||
"Character" => 3
|
||||
}
|
||||
end
|
||||
|
||||
# Returns a hash maping numerical category values to their
|
||||
# string equivalent. Be sure to update the tag_category_mapping also.
|
||||
def reverse_tag_category_mapping
|
||||
|
@ -1,67 +0,0 @@
|
||||
require 'test_helper'
|
||||
|
||||
class UnapprovalsControllerTest < ActionController::TestCase
|
||||
context "The unapprovals controller" do
|
||||
setup do
|
||||
@user = Factory.create(:user)
|
||||
CurrentUser.user = @user
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
end
|
||||
|
||||
teardown do
|
||||
CurrentUser.user = nil
|
||||
CurrentUser.ip_addr = nil
|
||||
end
|
||||
|
||||
context "new action" do
|
||||
should "render" do
|
||||
get :new, {}, {:user_id => @user.id}
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "index action" do
|
||||
setup do
|
||||
@unapproval = Factory.create(:unapproval)
|
||||
end
|
||||
|
||||
should "render" do
|
||||
get :index, {}, {:user_id => @user.id}
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
context "with search parameters" do
|
||||
should "render" do
|
||||
get :index, {:search => {:post_id_equals => @unapproval.post_id}}, {:user_id => @user.id}
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "create action" do
|
||||
setup do
|
||||
@post = Factory.create(:post)
|
||||
end
|
||||
|
||||
should "create a new unapproval" do
|
||||
assert_difference("Unapproval.count", 1) do
|
||||
post :create, {:unapproval => {:post_id => @post.id, :reason => "xxx"}}, {:user_id => @user.id}
|
||||
assert_not_nil(assigns(:unapproval))
|
||||
assert_equal([], assigns(:unapproval).errors.full_messages)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "destroy action" do
|
||||
setup do
|
||||
@unapproval = Factory.create(:unapproval)
|
||||
end
|
||||
|
||||
should "delete an unapproval" do
|
||||
assert_difference "Unapproval.count", -1 do
|
||||
post :destroy, {:id => @unapproval.id}, {:user_id => @user.id}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user