This commit is contained in:
r888888888
2013-05-07 17:58:27 -07:00
parent 5a1a3baa1c
commit 49de333b74
3 changed files with 19 additions and 3 deletions

View File

@@ -69,8 +69,6 @@ class WikiPagesController < ApplicationController
@wiki_page = WikiPage.find_by_title(params[:title])
if @wiki_page
redirect_to wiki_page_path(@wiki_page)
else
redirect_to new_wiki_page_path(:wiki_page => {:title => params[:title]})
end
end

View File

@@ -6,7 +6,7 @@ class WikiPage < ActiveRecord::Base
belongs_to :creator, :class_name => "User"
belongs_to :updater, :class_name => "User"
validates_uniqueness_of :title, :case_sensitive => false
validates_presence_of :title
validates_presence_of :title, :body
validate :validate_locker_is_janitor
attr_accessible :title, :body, :is_locked
has_one :tag, :foreign_key => "name", :primary_key => "title"

View File

@@ -0,0 +1,18 @@
<div id="c-wiki-pages">
<div id="a-show">
<%= render "sidebar" %>
<section id="content">
<h1 id="wiki-page-title"><%= params[:title] %></h1>
<div id="wiki-page-body" class="prose">
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(:wiki_page => {:title => params[:title]}) %>.</p>
</div>
</section>
</div>
</div>
<% content_for(:page_title) do %>
Wiki - <%= params[:title] %> - <%= Danbooru.config.app_name %>
<% end %>
<%= render "secondary_links" %>