stubbed in view code from old danbooru; only janitors can lock a wiki page
This commit is contained in:
5
app/views/wiki_pages/_form.html.erb
Normal file
5
app/views/wiki_pages/_form.html.erb
Normal file
@@ -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" %>
|
||||
8
app/views/wiki_pages/_recent_changes.html.erb
Normal file
8
app/views/wiki_pages/_recent_changes.html.erb
Normal file
@@ -0,0 +1,8 @@
|
||||
<section>
|
||||
<h1>Recent Changes (<%= link_to "all", wiki_pages_path(:meta_sort => "updated_at.desc") %>)</h1>
|
||||
<ul>
|
||||
<% WikiPage.recent.each do |page| %>
|
||||
<li class="tag-category-<%= page.category_name %>"><%= link_to page.pretty_title, wiki_page_path(page) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</section>
|
||||
16
app/views/wiki_pages/_secondary_links.html.erb
Normal file
16
app/views/wiki_pages/_secondary_links.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<% content_for(:secondary_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Listing", wiki_pages_path %></li>
|
||||
<li><%= link_to "New", new_wiki_page_path %></li>
|
||||
<li><%= link_to "Help", wiki_pages_path(:search => {:title_equals => "help:wiki"}) %></li>
|
||||
<% if @wiki_page %>
|
||||
<li>|</li>
|
||||
<li><%= link_to "Posts (#{Post.fast_count(@wiki_page.title)})", posts_path(:tags => @wiki_page.title) %></li>
|
||||
<li><%= link_to "History", wiki_page_versions_path(:search => {:wiki_page_id_equals => @wiki_page.id}) %></li>
|
||||
<li><%= link_to "Edit", edit_wiki_page_path(@wiki_page) %></li>
|
||||
<% if CurrentUser.is_moderator? %>
|
||||
<li><%= link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :confirm => "Do you want to delete this wiki page?" %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</menu>
|
||||
<% end %>
|
||||
10
app/views/wiki_pages/_sidebar.html.erb
Normal file
10
app/views/wiki_pages/_sidebar.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<aside id="sidebar">
|
||||
<section>
|
||||
<h1>Search</h1>
|
||||
<%= simple_form_for(@search) do |f| %>
|
||||
<%= f.input :title_contains %>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<%= render "recent_changes" %>
|
||||
</aside>
|
||||
@@ -0,0 +1,15 @@
|
||||
<div id="c-wiki-pages">
|
||||
<div id="a-edit">
|
||||
<%= render "sidebar" %>
|
||||
|
||||
<section id="content">
|
||||
<h1 id="wiki-page-title"><%= @wiki_page.pretty_title %> (Editing)</h1>
|
||||
<%= simple_form_for(@wiki_page) do |f| %>
|
||||
<%= render :partial => "form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<div id="c-wiki-pages">
|
||||
<div id="a-index">
|
||||
<%= render :partial => "sidebar" %>
|
||||
|
||||
<section id="content">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Last edited</th>
|
||||
</tr>
|
||||
<% @wiki_pages.each do |wiki_page| %>
|
||||
<tr>
|
||||
<td class="tag-category-<%= wiki_page.category_name %>"><%= link_to wiki_page.pretty_title, wiki_page_path(wiki_page, :nordirect => 1) %></td>
|
||||
<td><%= wiki_page.updated_at.strftime("%m/%d/%Y %I:%M") %> by <%= h wiki_page.creator.name %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<div id="paginator">
|
||||
<%= will_paginate(@wiki_pages) %>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<div id="c-wiki-pages">
|
||||
<div id="a-new">
|
||||
<%= render "sidebar" %>
|
||||
|
||||
<section id="content">
|
||||
<div id="preview">
|
||||
</div>
|
||||
|
||||
<%= simple_form_for(@wiki_page) do |f| %>
|
||||
<%= render :partial => "form", :locals => {:f => f} %>
|
||||
<% end %>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<div id="c-wiki-pages">
|
||||
<div id="a-show">
|
||||
<%= render "sidebar" %>
|
||||
|
||||
<section id="content">
|
||||
<h1 id="wiki-page-title"><%= @wiki_page.pretty_title %></h1>
|
||||
|
||||
<div id="wiki-page-body">
|
||||
<%= format_text(@wiki_page.body) %>
|
||||
</div>
|
||||
|
||||
<div id="wiki-page-posts">
|
||||
<%= @wiki_page.presenter.posts %>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wiki" id="wiki-show">
|
||||
<%= render :partial => "sidebar" %>
|
||||
|
||||
<h2 class="title"><%= @presenter.html_title %></h2>
|
||||
|
||||
<div id="body">
|
||||
<div style="margin-bottom: 1em;">
|
||||
<%= @presenter.html_body(self) %>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 1em;">
|
||||
<%= @presenter.html_posts(self) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for("footer") do %>
|
||||
<li>|</li>
|
||||
<% if @wiki_page.nil? %>
|
||||
<li><%= link_to "Posts (#{Post.fast_count(params[:title])})", :controller => "post", :action => "index", :tags => params[:title] %></li>
|
||||
<li><%= link_to "Edit", :controller => "wiki", :action => "edit", :title => params[:title] %></li>
|
||||
<% else %>
|
||||
<li><%= link_to "Posts (#{Post.fast_count(params[:title])})", :controller => "post", :action => "index", :tags => @title %></li>
|
||||
<li><%= link_to "History", :controller => "wiki", :action => "history", :title => @wiki_page.title %></li>
|
||||
<% if not @wiki_page.is_locked? %>
|
||||
<li><%= link_to "Edit", :controller => "wiki", :action => "edit", :title => @wiki_page.title, :version => @wiki_page.version %></li>
|
||||
<% end %>
|
||||
<% if @wiki_page.is_locked? %>
|
||||
<li><%= link_to "Unlock", {:controller => "wiki", :action => "unlock", :title => @wiki_page.title}, :method => "post" %></li>
|
||||
<% else %>
|
||||
<li><%= 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 %></li>
|
||||
<li><%= 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 %></li>
|
||||
<li><%= link_to "Lock", {:controller => "wiki", :action => "lock", :title => @wiki_page.title}, :method => :post %></li>
|
||||
<li><%= link_to "Rename", :action => "rename", :title => @wiki_page.title %></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "footer" %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user