wiki pages: fix error when force renaming wiki page.
Bug: force renaming a wiki page fails. Fix: use the wiki page id instead of the title in the update action.
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
<div id="form-content">
|
||||
<%= error_messages_for("wiki_page") %>
|
||||
|
||||
<%= simple_form_for(@wiki_page) do |f| %>
|
||||
<% if @wiki_page.new_record? %>
|
||||
<%= f.input :title, error: false, input_html: { data: { autocomplete: "tag" } } %>
|
||||
<% elsif CurrentUser.is_builder? %>
|
||||
<%= simple_form_for(@wiki_page, url: wiki_page_path(@wiki_page.id)) do |f| %>
|
||||
<% if CurrentUser.is_builder? %>
|
||||
<%= f.input :title, error: false, input_html: { data: { autocomplete: "tag" } }, hint: "Change to rename this wiki page. Move the tag and update any wikis linking to this page first." %>
|
||||
<% else %>
|
||||
<h1 id="wiki-page-title"><%= @wiki_page.pretty_title %></h1>
|
||||
@@ -26,8 +24,7 @@
|
||||
<%= f.input :skip_secondary_validations, as: :boolean, label: "Force rename", hint: "Ignore the renaming requirements" %>
|
||||
<% end %>
|
||||
|
||||
<%= f.button :submit, "Submit" %>
|
||||
<%= f.submit "Submit" %>
|
||||
<%= dtext_preview_button "wiki_page", "body" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<%= subnav_link_to "Posts (#{@wiki_page.tag.try(:post_count) || 0})", posts_path(:tags => @wiki_page.title) %>
|
||||
<%= subnav_link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %>
|
||||
<% if CurrentUser.is_member? %>
|
||||
<%= subnav_link_to "Edit", edit_wiki_page_path(@wiki_page), "data-shortcut": "e" %>
|
||||
<%= subnav_link_to "Edit", edit_wiki_page_path(@wiki_page.id), "data-shortcut": "e" %>
|
||||
<% end %>
|
||||
<% if CurrentUser.is_builder? && !@wiki_page.is_deleted? %>
|
||||
<%= subnav_link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :"data-shortcut" => "shift+d", :"data-confirm" => "Are you sure you want to delete this wiki page?" %>
|
||||
|
||||
@@ -9,7 +9,16 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "form" %>
|
||||
<%= error_messages_for("wiki_page") %>
|
||||
|
||||
<%= simple_form_for(@wiki_page) do |f| %>
|
||||
<%= f.input :title, error: false, input_html: { data: { autocomplete: "tag" } } %>
|
||||
<%= f.input :other_names_string, as: :text, input_html: { size: "30x1" }, label: "Other names (#{link_to_wiki "help", "help:translated_tags"})".html_safe, hint: "Names used for this tag on other sites such as Pixiv. Separate with spaces." %>
|
||||
<%= dtext_field "wiki_page", "body" %>
|
||||
<%= f.submit "Submit" %>
|
||||
<%= dtext_preview_button "wiki_page", "body" %>
|
||||
<% end %>
|
||||
|
||||
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
|
||||
<%= wiki_page_post_previews(@wiki_page) %>
|
||||
<% end %>
|
||||
|
||||
19
test/system/wiki_pages_test.rb
Normal file
19
test/system/wiki_pages_test.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class WikiPagesTest < ApplicationSystemTestCase
|
||||
context "renaming a wiki" do
|
||||
should "work" do
|
||||
@user = create(:user, level: User::Levels::BUILDER, created_at: 1.month.ago)
|
||||
@wiki = as(@user) { create(:wiki_page, title: "kancolle") }
|
||||
|
||||
signin @user
|
||||
visit wiki_page_path(@wiki)
|
||||
click_on "Edit"
|
||||
fill_in "Title", with: "kantai_collection"
|
||||
click_on "Submit"
|
||||
|
||||
assert_selector "#wiki-page-title", text: "kantai collection"
|
||||
assert_equal("kantai_collection", @wiki.reload.title)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user