diff --git a/app/views/static/500.html.erb b/app/views/static/500.html.erb
new file mode 100644
index 000000000..a6d96744c
--- /dev/null
+++ b/app/views/static/500.html.erb
@@ -0,0 +1,7 @@
+<%= @ex.class.to_s %> exception raised
+
+ <%= @ex.message %>
+ <%- @ex.backtrace.each do |b| -%>
+ <%= b %>
+ <%- end -%>
+
diff --git a/app/views/static/overloaded.html.erb b/app/views/static/overloaded.html.erb
new file mode 100644
index 000000000..487eaa802
--- /dev/null
+++ b/app/views/static/overloaded.html.erb
@@ -0,0 +1,11 @@
+
+ <%= print_advertisement("horizontal") %>
+
+
+
“No one else could gain admittance here, because this entrance was meant solely for you. I am now going to shut it.”
+
+
+
You have to login to view this page.
+
You can create a free basic account .
+
Learn more about accounts .
+
diff --git a/app/views/static/terms_of_service.html.erb b/app/views/static/terms_of_service.html.erb
new file mode 100644
index 000000000..a8231eb21
--- /dev/null
+++ b/app/views/static/terms_of_service.html.erb
@@ -0,0 +1,60 @@
+
+
+
Terms of Service
+
By accessing the "<%= CONFIG["app_name"] %>" website ("Site") you agree to the following terms of service. If you do not agree to these terms, then please do not access the Site.
+
+
+ The Site reserves the right to change these terms at any time.
+ If you are a minor, then you will not use the Site.
+ The Site is presented to you AS IS, without any warranty, express or implied. You will not hold the Site or its staff members liable for damages caused by the use of the site.
+ The Site reserves the right to delete or modify your account, or any content you have posted to the site.
+ You will make a best faith effort to upload only high quality anime-related images.
+ You have read the <%= link_to "tagging guidelines", :controller => "help", :action => "tags" %>.
+
+
+
+
Post/Comment Limiting
+
You cannot upload a post or comment during the first week of signing up.
+
After the initial period, you can post up to one comment an hour and a variable number of posts based on how many of your previous uploads were approved or deleted.
+
+
+
+
Prohibited Content
+
In addition, you may not use the Site to upload any of the following:
+
+ Non-anime: Photographs of American porn actresses, for example, are prohibited. Photographs of cosplayers, figures, or prominent figures in the industry are acceptable.
+ Furry: Any image or movie where a person's skin is made of fur or scales.
+ Watermarked: Any image where a person who is not the original copyright owner has placed a watermark on the image.
+ Poorly compressed: Any image where compression artifacts are easily visible.
+ Grotesque: Any depiction of extreme mutilation, extreme bodily distension, feces, or bodies that are far outside the realm of normal human proportion (for example, breasts or penises that are larger than two heads in size).
+ Manga: Uploading entire manga or doujinshi chapters is discouraged. Individual pages can be uploaded if they meet the quality criterion.
+ Nude Filter: Images that have been edited by someone other than the original creator to remove clothing or censorship. These typically feature crude drawings of breasts or genitalia laid on top of the original image.
+
+
+
+
+
+
Copyright Infringement
+
+
If you believe a post infringes upon your copyright, please send an email to the <%= mail_to CONFIG["admin_contact"], "webmaster", :encode => "hex" %> with the following pieces of information:
+
+ The URL of the infringing post.
+ Proof that you own the copyright.
+ An email address that will be provided to the person who uploaded the infringing post to facilitate communication.
+
+
+
+
+
Privacy Policy
+
+
The Site will not disclose the IP address, email address, password, or DMails of any user except to the staff.
+
The Site is allowed to make public everything else, including but not limited to: uploaded posts, favorited posts, comments, forum posts, wiki edits, and note edits.
+
+
+
+
Agreement
+
By clicking on the "I Agree" link, you have read all the terms and have agreed to them.
+
<%= link_to("I Agree", params[:url] || "/", :onclick => "Cookie.put('tos', '1')") %> | <%= link_to("Cancel", "/") %>
+
+
+
diff --git a/app/views/tag_aliases/index.html.erb b/app/views/tag_aliases/index.html.erb
index e69de29bb..7bcd92515 100644
--- a/app/views/tag_aliases/index.html.erb
+++ b/app/views/tag_aliases/index.html.erb
@@ -0,0 +1,92 @@
+
+ <% form_tag({:action => "index"}, :method => :get) do %>
+ <%= text_field_tag "query", params[:query] %>
+ <%= submit_tag "Search Aliases" %>
+ <%= submit_tag "Search Implications" %>
+ <% end %>
+
+
+
+ <% form_tag(:action => "update") do %>
+
+
+
+
+ Alias
+ To
+ Reason
+
+
+
+
+
+ <% if @current_user.is_admin_or_higher? %>
+ <%= button_to_function "Select pending", "$$('.pending').each(function(x) {x.checked = true})" %>
+ <%= submit_tag "Approve" %>
+ <%= button_to_function "Delete", "$('reason-box').show(); $('reason').focus()" %>
+ <%= submit_tag "Fix" %>
+ <%= button_to_function "Add", "$('add-box').show().scrollTo(); $('tag_alias_name').focus()" %>
+
+
+ Reason:
+ <%= text_field_tag "reason", "", :size => 40 %>
+ <%= submit_tag "Delete" %>
+
+ <% end %>
+
+
+
+
+
+ <% @aliases.each do |a| %>
+
+ >
+ <%= link_to h(a.name), :controller => "post", :action => "index", :tags => a.name %> (<%= Tag.find_by_name(a.name).post_count rescue 0 %>)
+ <%= link_to h(a.alias_name), :controller => "post", :action => "index", :tags => a.alias_name %> (<%= Tag.find(a.alias_id).post_count rescue 0 %>)
+ <%= format_text(a.reason) %>
+
+ <% end %>
+
+
+ <% end %>
+
+
+<% if @current_user.is_admin_or_higher? %>
+ style="display: none;"<% end %>>
+ <% form_tag(:action => "create") do %>
+
Add Alias
+
+ <% unless @current_user.is_anonymous? %>
+ <%= hidden_field_tag "tag_alias[creator_id]", @current_user.id %>
+ <% end %>
+
+
+
+ Name
+ <%= text_field "tag_alias", "name", :size => 40, :value => params[:from_name] %>
+
+
+ Alias to
+ <%= text_field "tag_alias", "alias", :size => 40, :value => params[:to_name] %>
+
+
+ Reason
+ <%= text_area "tag_alias", "reason", :size => "40x2", :value => params[:reason] %>
+
+
+ <%= submit_tag "Submit" %>
+
+
+ <% end %>
+
+<% end %>
+
+
+ <%= will_paginate(@aliases) %>
+
+
+<% content_for("subnavbar") do %>
+ <%= link_to "List", :controller => "tag_alias", :action => "index" %>
+ <%= link_to "Add", :controller => "tag_alias", :action => "new" %>
+ <%= link_to "Help", :controller => "help", :action => "tag_aliases" %>
+<% end %>
diff --git a/app/views/tag_aliases/new.html.erb b/app/views/tag_aliases/new.html.erb
index e69de29bb..98d58afe5 100644
--- a/app/views/tag_aliases/new.html.erb
+++ b/app/views/tag_aliases/new.html.erb
@@ -0,0 +1,20 @@
+<% form_tag(:controller => "forum", :action => "create") do %>
+ You can create a forum thread to suggest the creation of an alias.
+
+
+ From
+ <%= text_field "tag_alias", "name", :size => 40 %>
+
+
+ To
+ <%= text_field "tag_alias", "alias", :size => 40 %>
+
+
+ Reason
+ <%= text_area "tag_alias", "reason", :rows => 10, :cols => 60 %>
+
+
+ <%= submit_tag "Submit" %>
+
+
+<% end %>
diff --git a/app/views/tag_implications/index.html.erb b/app/views/tag_implications/index.html.erb
index e69de29bb..9a6ada9c9 100644
--- a/app/views/tag_implications/index.html.erb
+++ b/app/views/tag_implications/index.html.erb
@@ -0,0 +1,95 @@
+
+ <% form_tag({:action => "index"}, :method => :get) do %>
+ <%= text_field_tag "query", params[:query] %>
+ <%= submit_tag "Search Implications" %>
+ <%= submit_tag "Search Aliases" %>
+ <% end %>
+
+
+<% form_tag(:action => "update") do %>
+
+
+
+
+ Predicate
+ Consequent
+ Reason
+
+
+
+
+
+ <% if @current_user.is_admin_or_higher? %>
+ <%= button_to_function "Select pending", "$$('.pending').each(function(x) {x.checked = true})" %>
+ <%= submit_tag "Approve" %>
+ <%= button_to_function "Delete", "$('reason-box').show(); $('reason').focus()" %>
+ <% end %>
+
+ <% if @current_user.is_admin_or_higher? %>
+ <%= button_to_function "Add", "$('add-box').show().scrollTo(); $('tag_implication_predicate').focus()" %>
+ <% else %>
+ <%= button_to_function "Add", "window.location = '/forum/new?type=impl'" %>
+ <% end %>
+
+ <% if @current_user.is_admin_or_higher? %>
+
+ Reason:
+ <%= text_field_tag "reason", "", :size => 40 %>
+ <%= submit_tag "Delete" %>
+
+ <% end %>
+
+
+
+
+ <% @implications.each do |i| %>
+
+ >
+ <%= link_to h(i.predicate.name), :controller => "post", :action => "index", :tags => i.predicate.name %> (<%= i.predicate.post_count %>)
+ <%= link_to h(i.consequent.name), :controller => "post", :action => "index", :tags => i.consequent.name %> (<%= i.consequent.post_count %>)
+ <%= h i.reason %>
+
+ <% end %>
+
+
+<% end %>
+
+<% if @current_user.is_admin_or_higher? %>
+ style="display: none;"<% end %>>
+ <% form_tag(:action => "create") do %>
+
Add Implication
+ <% unless @current_user.is_anonymous? %>
+ <%= hidden_field_tag "tag_implication[creator_id]", @current_user.id %>
+ <% end %>
+
+
+
+ Predicate
+ <%= text_field "tag_implication", "predicate", :size => 40, :value => params[:from_name] %>
+
+
+ Consequent
+ <%= text_field "tag_implication", "consequent", :size => 40, :value => params[:to_name] %>
+
+
+ Reason
+ <%= text_area "tag_implication", "reason", :size => "40x2", :value => params[:reason] %>
+
+
+ <%= submit_tag "Submit" %>
+
+
+ <% end %>
+
+<% end %>
+
+
+ <%= will_paginate(@implications) %>
+
+
+<% content_for("subnavbar") do %>
+ <%= link_to "List", :controller => "tag_implication", :action => "index" %>
+ <%= link_to "Add", :controller => "tag_implication", :action => "new" %>
+ <%= link_to "Help", :controller => "help", :action => "tag_implications" %>
+<% end %>
+
diff --git a/app/views/tag_implications/new.html.erb b/app/views/tag_implications/new.html.erb
index e69de29bb..557d522ec 100644
--- a/app/views/tag_implications/new.html.erb
+++ b/app/views/tag_implications/new.html.erb
@@ -0,0 +1,20 @@
+<% form_tag(:controller => "forum", :action => "create") do %>
+ You can create a forum thread to suggest the creation of an implication.
+
+
+ From
+ <%= text_field "tag_implication", "predicate", :size => 40 %>
+
+
+ To
+ <%= text_field "tag_implication", "consequent", :size => 40 %>
+
+
+ Reason
+ <%= text_area "tag_implication", "reason", :rows => 10, :cols => 60 %>
+
+
+ <%= submit_tag "Submit" %>
+
+
+<% end %>
diff --git a/app/views/tag_subscriptions/index.html.erb b/app/views/tag_subscriptions/index.html.erb
index e69de29bb..2d21bd9aa 100644
--- a/app/views/tag_subscriptions/index.html.erb
+++ b/app/views/tag_subscriptions/index.html.erb
@@ -0,0 +1,14 @@
+<% form_tag(:action => "update") do %>
+ Edit Tag Subscriptions
+
+ You can only create up to <%= CONFIG["max_tag_subscriptions"] %> groups and each group can have up to 20 tags.
+
+
+
+ <%= render :partial => "listing", :locals => {:tag_subscriptions => @tag_subscriptions} %>
+
+<% end %>
+
+<% content_for("subnavbar") do %>
+ <%= link_to "Help", :controller => "help", :action => "tag_subscriptions" %>
+<% end %>
diff --git a/app/views/tags/_search.html.erb b/app/views/tags/_search.html.erb
new file mode 100644
index 000000000..029da5b57
--- /dev/null
+++ b/app/views/tags/_search.html.erb
@@ -0,0 +1,8 @@
+
+ <%= simple_form_for(@search) do |f| %>
+ <%= f.input :name_matches, :required => false, :label => "Name" %>
+ <%= f.input :category_equals, :required => false, :label => "Category" %>
+ <%= f.input :meta_sort, :collection => [["Name", "name.asc"], ["Count", "post_count.desc"], ["Date", "created_at.desc"]], :label => "Sort", :required => false %>
+ <%= f.button :submit, "Search" %>
+ <% end %>
+
diff --git a/app/views/tags/_secondary_links.html.erb b/app/views/tags/_secondary_links.html.erb
new file mode 100644
index 000000000..5aa7011f9
--- /dev/null
+++ b/app/views/tags/_secondary_links.html.erb
@@ -0,0 +1,8 @@
+<% content_for(:secondary_links) do %>
+
+ <%= link_to "Listing", tags_path %>
+ <%= link_to "Aliases", tag_aliases_path %>
+ <%= link_to "Implications", tag_implications_path %>
+ <%= link_to "Help", wiki_pages_path(:search => {:title_equals => "help:tags"}) %>
+
+<% end %>
diff --git a/app/views/tags/edit.html.erb b/app/views/tags/edit.html.erb
deleted file mode 100644
index e69de29bb..000000000
diff --git a/app/views/tags/index.html.erb b/app/views/tags/index.html.erb
index e69de29bb..d1b92424a 100644
--- a/app/views/tags/index.html.erb
+++ b/app/views/tags/index.html.erb
@@ -0,0 +1,27 @@
+<%= render "search" %>
+
+
+
+
+ Count
+ Name
+
+
+
+ <% @tags.each do |tag| %>
+
+ <%= tag.post_count %>
+
+ <%= link_to("?", wiki_pages_path(:search => {:title_equals => tag.name})) %>
+ <%= link_to(tag.name, posts_path(:tags => tag.name)) %>
+
+
+ <% end %>
+
+
+
+
+ <%= will_paginate(@tags) %>
+
+
+<%= render "secondary_links" %>
diff --git a/app/views/tags/show.html.erb b/app/views/tags/show.html.erb
deleted file mode 100644
index e69de29bb..000000000
diff --git a/app/views/user_feedback/_secondary_links.html.erb b/app/views/user_feedback/_secondary_links.html.erb
new file mode 100644
index 000000000..38ecc2771
--- /dev/null
+++ b/app/views/user_feedback/_secondary_links.html.erb
@@ -0,0 +1,7 @@
+<% if @user %>
+ <% content_for("subnavbar") do %>
+ <%= link_to "Add", :action => "create", :user_id => @user.id %>
+ <%= link_to "List for user", :action => "index", :user_id => @user.id %>
+ <%= link_to "List for all", :action => "index", :user_id => nil %>
+ <% end %>
+<% end %>
diff --git a/app/views/user_feedback/index.html.erb b/app/views/user_feedback/index.html.erb
index e69de29bb..c4dfa2b96 100644
--- a/app/views/user_feedback/index.html.erb
+++ b/app/views/user_feedback/index.html.erb
@@ -0,0 +1,42 @@
+
+
Record
+
+
+
+
+ User
+ Reporter
+ When
+ Body
+
+
+
+
+ <% @user_records.each do |rec| %>
+
+
+ <% 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 %>
+
+ <%= h(rec.reporter.pretty_name) %>
+ <%= time_ago_in_words(rec.created_at) %> ago
+ <%= format_text(rec.body) %>
+
+ <% if @current_user.is_mod_or_higher? || @current_user.id == rec.reported_by %>
+ <%= link_to_function "Delete", "UserRecord.destroy(#{rec.id})" %>
+ <% end %>
+
+
+ <% end %>
+
+
+
+
+ <%= will_paginate(@user_records) %>
+
+
+ <%= render :partial => "footer" %>
+
diff --git a/app/views/user_feedback/new.html.erb b/app/views/user_feedback/new.html.erb
index e69de29bb..725c7462a 100644
--- a/app/views/user_feedback/new.html.erb
+++ b/app/views/user_feedback/new.html.erb
@@ -0,0 +1,29 @@
+Add Record for <%= h(@user.pretty_name) %>
+
+
+
+
+<% form_tag(:action => "create") do %>
+ <%= hidden_field_tag "user_id", @user.id %>
+
+
+
+ Positive
+ <%= check_box "user_record", "is_positive" %>
+
+
+ Reason
+ <%= text_area "user_record", "body", :size => "20x8" %>
+
+
+
+
+
+ <%= submit_tag "Submit" %>
+ <%= submit_to_remote "preview", "Preview", :url => {:action => "preview"}, :update => "preview", :method => :get %>
+ <%= button_to_function "Cancel", "location.back()" %>
+
+
+
+
+<% end %>
diff --git a/app/views/user_mailer/dmail.html.erb b/app/views/user_mailer/dmail_notice.html.erb
similarity index 100%
rename from app/views/user_mailer/dmail.html.erb
rename to app/views/user_mailer/dmail_notice.html.erb
diff --git a/app/views/user_maintenance/delete_account.html.erb b/app/views/user_maintenance/delete_account.html.erb
deleted file mode 100644
index 26b761822..000000000
--- a/app/views/user_maintenance/delete_account.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-Delete My Account
-
-In order to maintain accountability, accounts cannot be deleted on this site. If you're worried about someone searching for your name, you can rename your account. But any existing dmail, forum post, comment, or post will still be attributed to you.
-
-Exceptions will be made for cases of extreme harassment. This harassment must have occurred on this site, whether through dmails, comments, or forum posts. Please send a dmail to an admin with details and evidence of harassment.
diff --git a/app/views/wiki_page_versions/index.html.erb b/app/views/wiki_page_versions/index.html.erb
index e69de29bb..6a543d2f1 100644
--- a/app/views/wiki_page_versions/index.html.erb
+++ b/app/views/wiki_page_versions/index.html.erb
@@ -0,0 +1,70 @@
+<%= render :partial => "sidebar" %>
+
+
+ <% form_tag({:action => "diff"}, :method => :get) do %>
+ <%= hidden_field_tag "title", params[:title] %>
+
+
+
+
+ From
+ To
+ IP Address
+ Last edited
+
+
+
+
+ <%= submit_tag "Compare" %>
+
+
+
+ <% @wiki_pages.each_with_index do |wiki_page, i| %>
+
+ <%= radio_button_tag "from", wiki_page.version, i==1, :id => "from_#{wiki_page.version}" %>
+ <%= radio_button_tag "to", wiki_page.version, i==0, :id => "to_#{wiki_page.version}" %>
+
+ <% if @current_user.is_admin? %>
+ <%= h wiki_page.ip_addr %>
+ <% end %>
+
+ <%= link_to wiki_page.updated_at.strftime("%m/%d/%Y %I:%M"), :action => "show", :title => wiki_page.title, :version => wiki_page.version %> by <%= link_to h(wiki_page.author), :controller => "user", :action => "show", :id => wiki_page.user_id %>
+
+ <% end %>
+
+
+ <% end %>
+
+
+
+
+
+<%= render :partial => "footer" %>
diff --git a/app/views/wiki_pages/_form.html.erb b/app/views/wiki_pages/_form.html.erb
new file mode 100644
index 000000000..7cda6e1ec
--- /dev/null
+++ b/app/views/wiki_pages/_form.html.erb
@@ -0,0 +1,5 @@
+<%= f.input :title %>
+<%= f.input :body %>
+<% if CurrentUser. %>
+<%= f.input :is_locked %>
+<%= f.button :submit, "Save" %><%= f.button :submit, "Cancel" %><%= f.button :submit "Preview" %>
diff --git a/app/views/wiki_pages/_recent_changes.html.erb b/app/views/wiki_pages/_recent_changes.html.erb
new file mode 100644
index 000000000..43b2a154e
--- /dev/null
+++ b/app/views/wiki_pages/_recent_changes.html.erb
@@ -0,0 +1,8 @@
+
+ Recent Changes (<%= link_to "all", wiki_pages_path(:meta_sort => "updated_at.desc") %>)
+
+ <% WikiPage.recent.each do |page| %>
+ <%= link_to page.pretty_title, wiki_page_path(page) %>
+ <% end %>
+
+
diff --git a/app/views/wiki_pages/_secondary_links.html.erb b/app/views/wiki_pages/_secondary_links.html.erb
new file mode 100644
index 000000000..03e95b18a
--- /dev/null
+++ b/app/views/wiki_pages/_secondary_links.html.erb
@@ -0,0 +1,16 @@
+<% content_for(:secondary_links) do %>
+
+ <%= link_to "Listing", wiki_pages_path %>
+ <%= link_to "New", new_wiki_page_path %>
+ <%= link_to "Help", wiki_pages_path(:search => {:title_equals => "help:wiki"}) %>
+ <% if @wiki_page %>
+ |
+ <%= link_to "Posts (#{Post.fast_count(@wiki_page.title)})", posts_path(:tags => @wiki_page.title) %>
+ <%= link_to "History", wiki_page_versions_path(:search => {:wiki_page_id_equals => @wiki_page.id}) %>
+ <%= link_to "Edit", edit_wiki_page_path(@wiki_page) %>
+ <% if CurrentUser.is_moderator? %>
+ <%= link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :confirm => "Do you want to delete this wiki page?" %>
+ <% end %>
+ <% end %>
+
+<% end %>
diff --git a/app/views/wiki_pages/_sidebar.html.erb b/app/views/wiki_pages/_sidebar.html.erb
new file mode 100644
index 000000000..06b86cccb
--- /dev/null
+++ b/app/views/wiki_pages/_sidebar.html.erb
@@ -0,0 +1,10 @@
+
diff --git a/app/views/wiki_pages/edit.html.erb b/app/views/wiki_pages/edit.html.erb
index e69de29bb..19031c7dd 100644
--- a/app/views/wiki_pages/edit.html.erb
+++ b/app/views/wiki_pages/edit.html.erb
@@ -0,0 +1,15 @@
+
+
+ <%= render "sidebar" %>
+
+
+ <%= @wiki_page.pretty_title %> (Editing)
+ <%= simple_form_for(@wiki_page) do |f| %>
+ <%= render :partial => "form", :locals => {:f => f} %>
+ <% end %>
+
+
+ <%= render "secondary_links" %>
+
+
+
diff --git a/app/views/wiki_pages/index.html.erb b/app/views/wiki_pages/index.html.erb
index e69de29bb..09a98d9ae 100644
--- a/app/views/wiki_pages/index.html.erb
+++ b/app/views/wiki_pages/index.html.erb
@@ -0,0 +1,26 @@
+
+
+ <%= render :partial => "sidebar" %>
+
+
+
+
+ Title
+ Last edited
+
+ <% @wiki_pages.each do |wiki_page| %>
+
+ <%= link_to wiki_page.pretty_title, wiki_page_path(wiki_page, :nordirect => 1) %>
+ <%= wiki_page.updated_at.strftime("%m/%d/%Y %I:%M") %> by <%= h wiki_page.creator.name %>
+
+ <% end %>
+
+
+
+ <%= will_paginate(@wiki_pages) %>
+
+
+
+
+
+<%= render "secondary_links" %>
diff --git a/app/views/wiki_pages/new.html.erb b/app/views/wiki_pages/new.html.erb
index e69de29bb..2c1ccccdb 100644
--- a/app/views/wiki_pages/new.html.erb
+++ b/app/views/wiki_pages/new.html.erb
@@ -0,0 +1,16 @@
+
+
+ <%= render "sidebar" %>
+
+
+
+
+
+ <%= simple_form_for(@wiki_page) do |f| %>
+ <%= render :partial => "form", :locals => {:f => f} %>
+ <% end %>
+
+
+
+
+<%= render "secondary_links" %>
diff --git a/app/views/wiki_pages/show.html.erb b/app/views/wiki_pages/show.html.erb
index e69de29bb..a97054753 100644
--- a/app/views/wiki_pages/show.html.erb
+++ b/app/views/wiki_pages/show.html.erb
@@ -0,0 +1,57 @@
+
+
+ <%= render "sidebar" %>
+
+
+ <%= @wiki_page.pretty_title %>
+
+
+ <%= format_text(@wiki_page.body) %>
+
+
+
+ <%= @wiki_page.presenter.posts %>
+
+
+
+
+
+
+ <%= render :partial => "sidebar" %>
+
+
<%= @presenter.html_title %>
+
+
+
+ <%= @presenter.html_body(self) %>
+
+
+
+ <%= @presenter.html_posts(self) %>
+
+
+
+ <% content_for("footer") do %>
+
|
+ <% if @wiki_page.nil? %>
+
<%= link_to "Posts (#{Post.fast_count(params[:title])})", :controller => "post", :action => "index", :tags => params[:title] %>
+
<%= link_to "Edit", :controller => "wiki", :action => "edit", :title => params[:title] %>
+ <% else %>
+
<%= link_to "Posts (#{Post.fast_count(params[:title])})", :controller => "post", :action => "index", :tags => @title %>
+
<%= link_to "History", :controller => "wiki", :action => "history", :title => @wiki_page.title %>
+ <% if not @wiki_page.is_locked? %>
+
<%= link_to "Edit", :controller => "wiki", :action => "edit", :title => @wiki_page.title, :version => @wiki_page.version %>
+ <% end %>
+ <% if @wiki_page.is_locked? %>
+
<%= link_to "Unlock", {:controller => "wiki", :action => "unlock", :title => @wiki_page.title}, :method => "post" %>
+ <% else %>
+
<%= link_to "Revert", {:controller => "wiki", :action => "revert", :title => @wiki_page.title, :version => @wiki_page.version}, :confirm => "Are you sure you want to revert to this page?", :method => :post %>
+
<%= link_to "Delete", {:controller => "wiki", :action => "destroy", :title => @wiki_page.title}, :confirm => "Are you sure you want to delete this page (and all versions)?", :method => :post %>
+
<%= link_to "Lock", {:controller => "wiki", :action => "lock", :title => @wiki_page.title}, :method => :post %>
+
<%= link_to "Rename", :action => "rename", :title => @wiki_page.title %>
+ <% end %>
+ <% end %>
+ <% end %>
+
+ <%= render :partial => "footer" %>
+
diff --git a/db/migrate/20100204214746_create_posts.rb b/db/migrate/20100204214746_create_posts.rb
index bd409003d..3216bea02 100644
--- a/db/migrate/20100204214746_create_posts.rb
+++ b/db/migrate/20100204214746_create_posts.rb
@@ -3,6 +3,8 @@ class CreatePosts < ActiveRecord::Migration
create_table :posts do |t|
t.timestamps
+ t.column :up_score, :integer, :null => false, :default => 0
+ t.column :down_score, :integer, :null => false, :default => 0
t.column :score, :integer, :null => false, :default => 0
t.column :source, :string
t.column :md5, :string, :null => false
diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb
index 487d00a76..25dd657da 100644
--- a/test/unit/wiki_page_test.rb
+++ b/test/unit/wiki_page_test.rb
@@ -2,9 +2,6 @@ require_relative '../test_helper'
class WikiPageTest < ActiveSupport::TestCase
setup do
- user = Factory.create(:user)
- CurrentUser.user = user
- CurrentUser.ip_addr = "127.0.0.1"
MEMCACHE.flush_all
end
@@ -14,50 +11,75 @@ class WikiPageTest < ActiveSupport::TestCase
end
context "A wiki page" do
- should "normalize its title" do
- wp = Factory.create(:wiki_page, :title => "HOT POTATO")
- assert_equal("hot_potato", wp.title)
+ context "updated by a janitor" do
+ setup do
+ @user = Factory.create(:janitor_user)
+ CurrentUser.user = @user
+ CurrentUser.ip_addr = "127.0.0.1"
+ @wiki_page = Factory.create(:wiki_page)
+ end
+
+ should "allow the is_locked attribute to be updated" do
+ @wiki_page.update_attributes(:is_locked => true)
+ @wiki_page.reload
+ assert_equal(true, @wiki_page.is_locked?)
+ end
end
- should "search by title" do
- Factory.create(:wiki_page, :title => "HOT POTATO")
- matches = WikiPage.titled("hot potato")
- assert_equal(1, matches.count)
- assert_equal("hot_potato", matches.first.title)
- end
-
- should "create versions" do
- wp = nil
+ context "updated by a regular user" do
+ setup do
+ @user = Factory.create(:user)
+ CurrentUser.user = @user
+ CurrentUser.ip_addr = "127.0.0.1"
+ @wiki_page = Factory.create(:wiki_page, :title => "HOT POTATO")
+ end
- assert_difference("WikiPageVersion.count") do
- wp = Factory.create(:wiki_page, :title => "xxx")
+ should "not allow the is_locked attribute to be updated" do
+ @wiki_page.update_attributes(:is_locked => true)
+ assert_equal(["Is locked can be modified by janitors only"], @wiki_page.errors.full_messages)
+ @wiki_page.reload
+ assert_equal(false, @wiki_page.is_locked?)
+ end
+
+ should "normalize its title" do
+ assert_equal("hot_potato", @wiki_page.title)
end
- assert_difference("WikiPageVersion.count") do
- wp.title = "yyy"
- wp.save
+ should "search by title" do
+ matches = WikiPage.titled("hot potato")
+ assert_equal(1, matches.count)
+ assert_equal("hot_potato", matches.first.title)
end
- end
-
- should "revert to a prior version" do
- wp = Factory.create(:wiki_page, :title => "xxx")
- wp.title = "yyy"
- wp.save
- version = WikiPageVersion.first
- wp.revert_to!(version)
- wp.reload
- assert_equal("xxx", wp.title)
- end
-
- should "differentiate between updater and creator" do
- user = Factory.create(:user)
- wp = Factory.create(:wiki_page, :title => "xxx")
- CurrentUser.scoped(user, "127.0.0.1") do
- wp.title = "yyy"
- wp.save
+
+ should "create versions" do
+ assert_difference("WikiPageVersion.count") do
+ @wiki_page = Factory.create(:wiki_page, :title => "xxx")
+ end
+
+ assert_difference("WikiPageVersion.count") do
+ @wiki_page.title = "yyy"
+ @wiki_page.save
+ end
+ end
+
+ should "revert to a prior version" do
+ @wiki_page.title = "yyy"
+ @wiki_page.save
+ version = WikiPageVersion.first
+ @wiki_page.revert_to!(version)
+ @wiki_page.reload
+ assert_equal("hot_potato", @wiki_page.title)
+ end
+
+ should "differentiate between updater and creator" do
+ another_user = Factory.create(:user)
+ CurrentUser.scoped(another_user, "127.0.0.1") do
+ @wiki_page.title = "yyy"
+ @wiki_page.save
+ end
+ version = WikiPageVersion.first
+ assert_not_equal(@wiki_page.creator_id, version.updater_id)
end
- version = WikiPageVersion.first
- assert_not_equal(wp.creator_id, version.updater_id)
end
end
end