wiki page, comment views

This commit is contained in:
albert
2011-03-13 03:54:32 -04:00
parent bd520f61f7
commit 4717726217
16 changed files with 134 additions and 77 deletions

View File

@@ -4,7 +4,7 @@ class WikiPage < ActiveRecord::Base
after_save :create_version
belongs_to :creator, :class_name => "User"
validates_uniqueness_of :title, :case_sensitive => false
validates_presence_of :body
validates_presence_of :body, :title
validate :validate_locker_is_janitor
attr_accessible :title, :body, :is_locked
scope :titled, lambda {|title| where(["title = ?", title.downcase.tr(" ", "_")])}

View File

@@ -0,0 +1,6 @@
<% content_for(:secondary_links) do %>
<menu>
<li><%= link_to "Listing", comments_path(:group_by => "post") %></li>
<li><%= link_to "Help", wiki_pages_path(:title => "help:comments") %></li>
</menu>
<% end %>

View File

@@ -9,3 +9,4 @@
</div>
</div>
<%= render "comments/secondary_links" %>

View File

@@ -5,3 +5,5 @@
<% end %>
</div>
</div>
<%= render "comments/secondary_links" %>

View File

@@ -11,3 +11,5 @@
<% end %>
</div>
</div>
<%= render "comments/secondary_links" %>

View File

@@ -2,7 +2,7 @@
<div id="a-index">
<%= render "search" %>
<table class="highlightable" width="100%">
<table class="striped" width="100%">
<thead>
<tr>
<th width="5%"></th>

View File

@@ -3,7 +3,7 @@
<%= render :partial => "wiki_pages/sidebar" %>
<section id="content">
<table width="100%">
<table width="100%" class="striped">
<thead>
<tr>
<th width="60%">Title</th>

View File

@@ -1,8 +1,27 @@
<% if @wiki_page.new_record? || CurrentUser.is_moderator? %>
<%= f.input :title %>
<% end %>
<%= f.input :body %>
<% if CurrentUser.is_janitor? %>
<%= f.input :is_locked %>
<% end %>
<%= f.button :submit, "Save" %><%= f.button :submit, "Cancel" %><%= f.button :submit, "Preview" %>
<div id="form-content">
<%= error_messages_for("wiki_page") %>
<%= simple_form_for(@wiki_page) do |f| %>
<%= f.input :title %>
<%= f.input :body %>
<% if CurrentUser.is_janitor? %>
<%= f.input :is_locked %>
<% end %>
<%= f.button :submit, "Submit" %>
<%= f.button :submit, "Preview" %>
<% end %>
</div>
<div id="form-aside">
<div id="preview">
<div class="content dtext">
</div>
<p><a href="#" name="toggle-preview">Hide</a></p>
</div>
<div id="dtext-help">
<%= render "dtext/help" %>
</div>
</div>

View File

@@ -1,19 +1,11 @@
<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>
<div id="preview" class="dtext">
</div>
<%= simple_form_for(@wiki_page) do |f| %>
<%= render :partial => "form", :locals => {:f => f} %>
<% end %>
<%= render "form" %>
</section>
<%= render "secondary_links" %>
</div>
</div>
<%= render "secondary_links" %>

View File

@@ -3,7 +3,7 @@
<%= render :partial => "sidebar" %>
<section id="content">
<table>
<table class="striped" width="100%">
<tr>
<th>Title</th>
<th>Last edited</th>

View File

@@ -1,16 +1,9 @@
<div id="c-wiki-pages">
<div id="a-new">
<%= render "sidebar" %>
<section id="content">
<h1>New Wiki Page</h1>
<div id="preview" class="dtext">
</div>
<%= simple_form_for(@wiki_page) do |f| %>
<%= render :partial => "form", :locals => {:f => f} %>
<% end %>
<%= render "form" %>
</section>
</div>
</div>