adding a basic browser for the page/wiki section

git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@41 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7
master
andrew 2007-11-17 09:42:02 +00:00
parent 55fc5cc72d
commit f76b90af20
3 changed files with 24 additions and 7 deletions

View File

@ -7,9 +7,16 @@ class PagesController < ApplicationController
@page = Page.find_by_title 'HomePage'
@page ||= Page.create :title => 'HomePage',
:redcloth => 'Welcome to BarleySodas!'
@content_title = 'The Beer Wiki'
@secondary_title = 'Browsing all pages'
cond_ary = [ 'owner_id IS NULL' ]
cond_ary << "title <> 'HomePage'"
@pages, @wiki_pages = paginate :page, :per_page => 25,
:order => 'title ASC', :conditions => [ cond_ary.join(' AND ') ]
respond_to do |format|
format.html # index.rhtml
format.xml { render :xml => @page.to_xml }
end
end

View File

@ -1,20 +1,21 @@
<% simple ||= false -%>
<div class="hentry" id="article-<%= @page.id %>">
<h2 class="entry-title">
<%= @page.title %>
<span class="comment_count">Comment Size Here</span>
<% unless simple -%><span class="comment_count">Comment Size Here</span><% end -%>
</h2>
<div class="vcard">
<% unless simple -%><div class="vcard">
Posted by <span class="fn">Author Name Here</span>
</div>
</div><% end -%>
<br class="clear" />
<div class="entry-content">
<%= @page.html %>
</div>
<ul class="meta">
<% unless simple -%><ul class="meta">
<% if @page.tags.size > 0 -%><li>Tags: <%= @page.tag_names.join(' ') -%></li><% end -%>
<li>Version: <%= @page.version -%></li>
<% @page.owner.page_attributes.each do |x| -%>
<li><%= x -%></li>
<% end if @page.owner and @page.owner.respond_to?("page_attributes") %>
</ul>
</ul><% end -%>
</div>

View File

@ -1,4 +1,13 @@
<%= render :partial => 'page' -%>
<%= render :partial => 'page', :locals => { :simple => true } -%>
<% unless @wiki_pages.empty? -%>
<div class="hentry">
<ul>
<%= @wiki_pages.collect { |x| "<li>#{show_page_link(x, x.title)}</li>" } %>
</ul>
<%= render :partial => 'shared/pagination_links' %>
</div>
<% end -%>
<% content_for :sidebar do -%>
<%= new_page_link -%><br />