updated readme
This commit is contained in:
41
app/views/categories/_form.html.erb
Normal file
41
app/views/categories/_form.html.erb
Normal file
@@ -0,0 +1,41 @@
|
||||
<div class="module">
|
||||
<div class="module_header"><%= action_name.humanize %> Category</div>
|
||||
<div class="module_subheader smaller"></div>
|
||||
<div class="module_body">
|
||||
<%= form_for @category do |f| %>
|
||||
<% if @category.errors.any? %>
|
||||
<% flash.now[:error] = @category.errors.full_messages.join(', and ') %>
|
||||
<% end %>
|
||||
<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 :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", forums_path %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
1
app/views/categories/edit.html.erb
Normal file
1
app/views/categories/edit.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render :partial => 'form' %>
|
||||
47
app/views/categories/index.html.erb
Normal file
47
app/views/categories/index.html.erb
Normal file
@@ -0,0 +1,47 @@
|
||||
<div class="right controls"><%= link_to "New Forum Category", new_category_path if can? :create, Category %></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 if can? :create, Forum %>
|
||||
<%= link_to "Edit Category", edit_category_path(category) if can? :manage, category %>
|
||||
<%= link_to "Delete Category", category_path(category), :confirm => "Are you sure you want to delete this category?", :method => :delete if can? :manage, category %>
|
||||
</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/categories/new.html.erb
Normal file
1
app/views/categories/new.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render :partial => 'form' %>
|
||||
12
app/views/devise/confirmations/new.html.erb
Normal file
12
app/views/devise/confirmations/new.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<h2>Resend confirmation instructions</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
|
||||
<p><%= f.submit "Resend confirmation instructions" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "devise/shared/links" %>
|
||||
@@ -0,0 +1,5 @@
|
||||
<p>Welcome <%= @resource.email %>!</p>
|
||||
|
||||
<p>You can confirm your account through the link below:</p>
|
||||
|
||||
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
|
||||
@@ -0,0 +1,8 @@
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
|
||||
|
||||
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
|
||||
|
||||
<p>If you didn't request this, please ignore this email.</p>
|
||||
<p>Your password won't change until you access the link above and create a new one.</p>
|
||||
7
app/views/devise/mailer/unlock_instructions.html.erb
Normal file
7
app/views/devise/mailer/unlock_instructions.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<p>Hello <%= @resource.email %>!</p>
|
||||
|
||||
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
|
||||
|
||||
<p>Click the link below to unlock your account:</p>
|
||||
|
||||
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
|
||||
16
app/views/devise/passwords/edit.html.erb
Normal file
16
app/views/devise/passwords/edit.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<h2>Change your password</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= f.hidden_field :reset_password_token %>
|
||||
|
||||
<p><%= f.label :password, "New password" %><br />
|
||||
<%= f.password_field :password %></p>
|
||||
|
||||
<p><%= f.label :password_confirmation, "Confirm new password" %><br />
|
||||
<%= f.password_field :password_confirmation %></p>
|
||||
|
||||
<p><%= f.submit "Change my password" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "devise/shared/links" %>
|
||||
12
app/views/devise/passwords/new.html.erb
Normal file
12
app/views/devise/passwords/new.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<h2>Forgot your password?</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
|
||||
<p><%= f.submit "Send me reset password instructions" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "devise/shared/links" %>
|
||||
25
app/views/devise/registrations/edit.html.erb
Normal file
25
app/views/devise/registrations/edit.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
|
||||
<p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
||||
<%= f.password_field :password %></p>
|
||||
|
||||
<p><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></p>
|
||||
|
||||
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
||||
<%= f.password_field :current_password %></p>
|
||||
|
||||
<p><%= f.submit "Update" %></p>
|
||||
<% end %>
|
||||
|
||||
<h3>Cancel my account</h3>
|
||||
|
||||
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
21
app/views/devise/registrations/new.html.erb
Normal file
21
app/views/devise/registrations/new.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<h2>Sign up</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<p><%= f.label :username %><br />
|
||||
<%= f.text_field :username %></p>
|
||||
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
|
||||
<p><%= f.label :password %><br />
|
||||
<%= f.password_field :password %></p>
|
||||
|
||||
<p><%= f.label :password_confirmation %><br />
|
||||
<%= f.password_field :password_confirmation %></p>
|
||||
|
||||
<p><%= f.submit "Sign up" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "devise/shared/links" %>
|
||||
17
app/views/devise/sessions/new.html.erb
Normal file
17
app/views/devise/sessions/new.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
<h2>Sign in</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
|
||||
<p><%= f.label :password %><br />
|
||||
<%= f.password_field :password %></p>
|
||||
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
|
||||
<% end -%>
|
||||
|
||||
<p><%= f.submit "Sign in" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "devise/shared/links" %>
|
||||
25
app/views/devise/shared/_links.erb
Normal file
25
app/views/devise/shared/_links.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<%- if controller_name != 'sessions' %>
|
||||
<%= link_to "Sign in", new_session_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
||||
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
|
||||
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
||||
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
||||
<% end -%>
|
||||
|
||||
<%- if devise_mapping.omniauthable? %>
|
||||
<%- resource_class.omniauth_providers.each do |provider| %>
|
||||
<%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
|
||||
<% end -%>
|
||||
<% end -%>
|
||||
12
app/views/devise/unlocks/new.html.erb
Normal file
12
app/views/devise/unlocks/new.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<h2>Resend unlock instructions</h2>
|
||||
|
||||
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
|
||||
<p><%= f.label :email %><br />
|
||||
<%= f.email_field :email %></p>
|
||||
|
||||
<p><%= f.submit "Resend unlock instructions" %></p>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "devise/shared/links" %>
|
||||
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>
|
||||
57
app/views/layouts/application.html.erb
Normal file
57
app/views/layouts/application.html.erb
Normal file
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title>
|
||||
<%= stylesheet_link_tag "application", "forum-monster" %>
|
||||
<%= javascript_include_tag :defaults %>
|
||||
<%= csrf_meta_tag %>
|
||||
<%= yield(:head) %>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<%= content_tag :div, "This is just a demo, the database is reset every 24 hours.", :class => "demo_notice" %>
|
||||
</div>
|
||||
|
||||
<div id="header">
|
||||
<div id="logo">
|
||||
<%= image_tag "rails.png" %>
|
||||
<h1>Forum Monster</h1>
|
||||
A Ruby on Rails Forum Gem
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div id="menu_wrapper">
|
||||
<ul>
|
||||
<li><%= link_to "Forum Index", root_path %></li>
|
||||
<% if user_signed_in? %>
|
||||
<li><%= link_to "Logout", destroy_user_session_path, :method => :delete %></li>
|
||||
<% else %>
|
||||
<li><%= link_to "Login", new_user_session_path %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="bottom">
|
||||
<% if user_signed_in? %>
|
||||
Welcome <strong><%= current_user.username %></strong>, your last login was <%= time_ago_in_words(current_user.last_sign_in_at) %> ago
|
||||
<% else %>
|
||||
You are not logged in. Please <%= link_to "login", new_user_session_path %> or <%= link_to "register", new_user_registration_path %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<% flash.each do |name, msg| %>
|
||||
<%= content_tag :div, msg, :id => "flash_#{name}" %>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
</div>
|
||||
|
||||
<% if %w(categories forums topics posts).include? controller_name %>
|
||||
<div id="info_box">
|
||||
<p>
|
||||
Total number of registered users: <strong><%= User.count %></strong><br />
|
||||
Newest registered user: <%= link_to User.last.username %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</body>
|
||||
</html>
|
||||
26
app/views/posts/_form.html.erb
Normal file
26
app/views/posts/_form.html.erb
Normal file
@@ -0,0 +1,26 @@
|
||||
<div class="module">
|
||||
<div class="module_header"><%= action_name.humanize %> Post</div>
|
||||
<div class="module_subheader smaller"></div>
|
||||
<div class="module_body">
|
||||
<%= form_for [@topic, @post] do |f| %>
|
||||
<% if @post.errors.any? %>
|
||||
<% flash.now[:error] = @post.errors.full_messages.join(', and ') %>
|
||||
<% end %>
|
||||
<div class="fieldset">
|
||||
<span class="label indent smaller">
|
||||
<%= f.label :body %><br />
|
||||
<small>(Required)</small>
|
||||
</span>
|
||||
<span class="input indent smaller"><%= f.text_area :body, :cols => 60, :rows => 15 %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module_footer">
|
||||
<div class="fieldset">
|
||||
<span class="input"><%= f.submit "submit" %> or <%= link_to "cancel", topic_path(@post.topic) %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
1
app/views/posts/edit.html.erb
Normal file
1
app/views/posts/edit.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render :partial => 'form' %>
|
||||
1
app/views/posts/new.html.erb
Normal file
1
app/views/posts/new.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render :partial => 'form' %>
|
||||
36
app/views/topics/_form.html.erb
Normal file
36
app/views/topics/_form.html.erb
Normal file
@@ -0,0 +1,36 @@
|
||||
<%= form_for [@forum, @topic] do |f| %>
|
||||
<% if @topic.errors.any? %>
|
||||
<% flash.now[:error] = @topic.errors.full_messages.join(', and ') %>
|
||||
<% end %>
|
||||
<div class="module">
|
||||
<div class="module_header"><%= action_name.humanize %> Topic</div>
|
||||
<div class="module_subheader smaller"></div>
|
||||
<div class="module_body">
|
||||
<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>
|
||||
<% unless @topic.id %>
|
||||
<div class="fieldset">
|
||||
<span class="label indent smaller">
|
||||
<%= f.label :body %><br />
|
||||
<small>(Required)</small>
|
||||
</span>
|
||||
<span class="input indent smaller"><%= f.text_area :body, :cols => 60, :rows => 15 %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="module_footer">
|
||||
<div class="fieldset">
|
||||
<span class="input"><%= f.submit "submit" %> or <%= link_to "cancel", @topic.nil? ? @topic : @forum %></span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
1
app/views/topics/edit.html.erb
Normal file
1
app/views/topics/edit.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render :partial => 'form' %>
|
||||
1
app/views/topics/new.html.erb
Normal file
1
app/views/topics/new.html.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= render :partial => 'form' %>
|
||||
44
app/views/topics/show.html.erb
Normal file
44
app/views/topics/show.html.erb
Normal file
@@ -0,0 +1,44 @@
|
||||
<div class="right controls"><%= link_to "Back to Forum", forum_path(@topic.forum) %></div>
|
||||
<div class="module">
|
||||
<div class="module_header">
|
||||
<%= @topic.title %>
|
||||
<span class="right controls">
|
||||
<%= link_to "Edit", edit_topic_path(@topic) if can? :manage, @topic %>
|
||||
<%= link_to "Delete", @topic, :confirm => "Are you sure?", :method => :delete if can? :manage, @topic %>
|
||||
<%= link_to @topic.sticky ? "Unstick" : "Sticky", {:controller => 'topics', :action => 'update', :topic => {:sticky => @topic.sticky ? "false" : "true" }}, :method => :put if can? :moderate, @topic %>
|
||||
<%= link_to @topic.locked ? "Unlock" : "Lock", {:controller => 'topics', :action => 'update', :topic => {:locked => @topic.locked ? "false" : "true" }}, :method => :put if can? :moderate, @topic %>
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<table>
|
||||
<% @topic.posts.each do |post| %>
|
||||
<tr>
|
||||
<td class="post_author" rowspan="2">
|
||||
<span class="name"><%= post.user.username %></span>
|
||||
<span class="avatar"><%= image_tag post.user.gravatar_url %></span>
|
||||
<span class="info smaller">
|
||||
<p><strong><%= "Administrator" if post.user.admin? %></strong></p>
|
||||
Posts <%= post.user.posts.size %><br />
|
||||
Registered <%= post.user.created_at.to_s(:joined) %><br />
|
||||
</span>
|
||||
</td>
|
||||
<td class="post_header">
|
||||
<span class="left post_date smaller">Posted <%= post.created_at %></span>
|
||||
<span class="right controls">
|
||||
<%= link_to "Reply", new_topic_post_path(@topic) if can? :create, Topic %>
|
||||
<%= link_to "Quote", new_topic_post_path(@topic, :quote => post) if can? :create, Topic %>
|
||||
<%= link_to "Edit", edit_post_path(post) if can? :update, post %>
|
||||
<%= link_to "Delete", post, :confirm => "Are you sure?", :method => :delete if can? :destroy, post %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="post_body">
|
||||
<%= post.body.bbcode_to_html().html_safe %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="right controls"><p><%= link_to "Back to Forum", forum_path(@topic.forum) %></p></div>
|
||||
Reference in New Issue
Block a user