updated readme
This commit is contained in:
61
app/views/forums/_form.html.erb
Normal file
61
app/views/forums/_form.html.erb
Normal file
@@ -0,0 +1,61 @@
|
||||
<div class="module">
|
||||
<div class="module_header"><%= action_name.humanize %> Forum</div>
|
||||
<div class="module_subheader smaller">
|
||||
<em>To create a category, leave the category field unselected.</em>
|
||||
</div>
|
||||
<div class="module_body">
|
||||
<%= form_for @forum do |f| %>
|
||||
<% if @forum.errors.any? %>
|
||||
<% flash.now[:error] = @forum.errors.full_messages.join(', and ') %>
|
||||
<% end %>
|
||||
<div class="fieldset">
|
||||
<span class="label indent smaller">
|
||||
<%= f.label :category_id %><br />
|
||||
<small>(Required)</small>
|
||||
</span>
|
||||
<span class="input indent smaller">
|
||||
<%= f.collection_select :category_id, Category.all, :id, :title %>
|
||||
</span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="fieldset">
|
||||
<span class="label indent smaller">
|
||||
<%= f.label :title %><br />
|
||||
<small>(Required)</small>
|
||||
</span>
|
||||
<span class="input indent smaller"><%= f.text_field :title, :size => 75 %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="fieldset">
|
||||
<span class="label indent smaller">
|
||||
<%= f.label :description %><br />
|
||||
<small>(Required)</small>
|
||||
</span>
|
||||
<span class="input indent smaller"><%= f.text_area :description, :cols => 60, :rows => 5 %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="fieldset">
|
||||
<span class="label indent smaller">
|
||||
<%= f.label :position %>
|
||||
</span>
|
||||
<span class="input indent smaller"><%= f.text_field :position %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="fieldset">
|
||||
<span class="label indent smaller"></span>
|
||||
<span class="input indent smaller">
|
||||
<%= f.check_box :state %>
|
||||
<%= f.label :state %>
|
||||
</span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module_footer">
|
||||
<div class="fieldset">
|
||||
<span class="input"><%= f.submit "submit" %> or <%= link_to "cancel", @forum.nil? ? forum_path(@forum) : forums_path %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
1
app/views/forums/edit.html.erb
Normal file
1
app/views/forums/edit.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render :partial => 'form' %>
|
||||
46
app/views/forums/index.html.erb
Normal file
46
app/views/forums/index.html.erb
Normal file
@@ -0,0 +1,46 @@
|
||||
<div class="right controls"><%= link_to "New Forum/Category", new_forum_path %></div>
|
||||
<% @categories.each do |category| %>
|
||||
<div class="module">
|
||||
<div class="module_header">
|
||||
<%= category.title %>
|
||||
<span class="controls right smaller">
|
||||
<%= link_to "New Forum", new_forum_path %>
|
||||
<%= link_to "Edit Category", edit_forum_path(category) %>
|
||||
<%= link_to "Delete Category", forum_path(category), :confirm => "Are you sure you want to delete this category?", :method => :delete %>
|
||||
</span>
|
||||
</div>
|
||||
<% if category.forums.size > 0 %>
|
||||
<div>
|
||||
<table>
|
||||
<tr class="smaller">
|
||||
<th colspan="2" align="left">Forum</th>
|
||||
<th>Topics</th>
|
||||
<th>Posts</th>
|
||||
<th class="last_post" align="left">Last Post</th>
|
||||
</tr>
|
||||
<% category.forums.each do |forum| %>
|
||||
<tr>
|
||||
<td class="icon"><%= image_tag 'ruby.png' %></td>
|
||||
<td class="description">
|
||||
<%= link_to forum.title, forum_path(forum) %><br />
|
||||
<span class="smaller"><%= forum.description %></span><br />
|
||||
</td>
|
||||
<td class="counts smaller"><%= forum.topics.size %></td>
|
||||
<td class="counts smaller"><%= forum.posts.size - forum.topics.size %></td>
|
||||
<td class="last_post smaller">
|
||||
<% if forum.posts.size > 0 %>
|
||||
<%= forum.posts.last.created_at %><br />
|
||||
<%= forum.posts.last.user.username %>
|
||||
<% else %>
|
||||
No Topics / Posts
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="module_body">There are currently no forums.</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
1
app/views/forums/new.html.erb
Normal file
1
app/views/forums/new.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render :partial => 'form' %>
|
||||
48
app/views/forums/show.html.erb
Normal file
48
app/views/forums/show.html.erb
Normal file
@@ -0,0 +1,48 @@
|
||||
<div class="right controls"><%= link_to "Back to Forum List", forums_path if can? :create, Forum %></div>
|
||||
<div class="module">
|
||||
<div class="module_header">
|
||||
<%= @forum.title %>
|
||||
<span class="controls right">
|
||||
<%= link_to "New Topic", new_forum_topic_path(@forum) if can? :create, Topic %>
|
||||
<%= link_to "Edit Forum", edit_forum_path(@forum) if can? :manage, @forum %>
|
||||
<%= link_to "Delete Forum", forum_path(@forum), :confirm => "Are you sure you want to delete this forum?", :method => :delete if can? :manage, @forum %>
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<table>
|
||||
<% if @forum.topics.size > 0 %>
|
||||
<tr class="smaller">
|
||||
<th colspan="2" align="left">Topic</th>
|
||||
<th>Replies</th>
|
||||
<th>Views</th>
|
||||
<th class="last_post" align="left">Last Post</th>
|
||||
</tr>
|
||||
|
||||
<!-- No Topics -->
|
||||
<% else %>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<strong><p>There aren't any topics yet <%= link_to "create one", new_forum_topic_path(@forum) if can? :create, Topic %></p></strong>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% @forum.topics.each do |topic| %>
|
||||
<tr>
|
||||
<td class="icon"><%= image_tag 'ruby.png' %></td>
|
||||
<td class="description">
|
||||
<%= link_to topic.title, topic_path(topic) %><br />
|
||||
<span class="smaller">by <%= topic.user.username %></span>
|
||||
</td>
|
||||
<td class="counts smaller"><%= topic.posts.size - 1 %></td>
|
||||
<td class="counts smaller"><%= topic.hits %></td>
|
||||
<td class="last_post smaller">
|
||||
<%= topic.posts.last.created_at %><br />
|
||||
by <%= topic.posts.last.user.username %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right controls"><p><%= link_to "Back to Forum List", forums_path if can? :create, Forum %></p></div>
|
||||
Reference in New Issue
Block a user