many things, comments working.

This commit is contained in:
jomo
2013-06-24 13:29:39 +02:00
parent 7a894f4f6a
commit fb52e8bed2
44 changed files with 490 additions and 223 deletions

View File

@@ -1,5 +1,5 @@
<%= simple_form_for @post do |f|%>
<%= f.input :title %>
<%= f.input :text %>
<%= f.submit %>
<%= f.input :title, :label => false %>
<%= f.input :text, :label => false %>
<%= f.submit "Create Post" %>
<% end %>

View File

@@ -2,10 +2,19 @@
<div id="posts">
<% @posts.each do |p| %>
<div id="post">
<div id="post-title"><h2><%= link_to p.title, p %></h2><span class="comment-counter"><%= link_to pluralize(p.comments.count, "Comment"), p %></span></div>
<span class="post-info">by <%= link_to p.user.name, p.user %> on <%= p.created_at.strftime("%e. %b %Y") %></span>
<div id="post-content"><%= RbbCode.new.convert(p.text).html_safe %></div>
<div id="post-title">
<h2><%= link_to p.title, p %></h2>
<span class="comment-counter">
<%= link_to pluralize(p.comments.count, "Comment"), p %>
</span>
</div>
<span class="post-info">
by <%= link_to p.user.name, p.user %> on <%= p.created_at.strftime("%e. %b %Y") %>
</span>
<div id="post-content">
<%= RbbCode.new.convert(p.text).html_safe %>
</div>
</div>
<% end %>
<%= link_to 'New Blogpost', new_blogpost_path if current_user && current_user.rank >= Tools.rank_to_int(:mod) %>
<%= link_to 'Make new Post', new_blogpost_path if current_user && current_user.rank >= rank_to_int("mod") %>
</div>

View File

@@ -1,3 +1,3 @@
<h1>New Blogpost</h1>
<h1>New Post</h1>
<%= render 'form' %>

View File

@@ -1,6 +1,6 @@
<h1><%= @post.title %></h1>
<span class="post-info"><%= link_to @post.user.name, @post.user %> on <%= @post.created_at.strftime("%e. %b %Y") %>
<% if current_user.rank >= Tools.rank_to_int(:mod) %>
<% if current_user && current_user.rank >= rank_to_int("mod") %>
- <%= link_to "edit", edit_blogpost_path(@post.id) %>
<% end %>
</span>
@@ -9,19 +9,20 @@
</div>
<div id="comments">
<% @post.comments.each do |c| %>
<div class="comment">
<div class="comment <%= "author" if c.user == @post.user %>">
<span class="comment-info"><%= link_to c.user.name, c.user %> on <%= c.created_at.strftime("%e. %b %Y") %>
<% if current_user.rank >= Tools.rank_to_int(:mod) %>
<% if current_user && current_user.rank >= rank_to_int("mod") %>
- <%= link_to "edit", edit_blogpost_comment_path(c.id) %>
<% end %>
</span>
<div class="comment-content"><%= c.text %></div>
</div>
<% end %>
<% if current_user && current_user.rank >= Tools.rank_to_int(:visitor) %>
<% if current_user %>
<h3>New comment</h3>
<%= simple_form_for [@post, @comment] do |f| %>
<%= f.input :text, :label => false, :as => "text", :placeholder => "Comment" %><%= f.submit %>
<%= f.input :text, :label => false, :as => "text", :placeholder => "Comment" %>
<%= f.submit %>
<% end %>
<% end %>
</div>