first release
This commit is contained in:
5
app/views/blogposts/_form.html.erb
Normal file
5
app/views/blogposts/_form.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<%= simple_form_for @post do |f|%>
|
||||
<%= f.input :title %>
|
||||
<%= f.input :text %>
|
||||
<%= f.submit %>
|
||||
<% end %>
|
||||
6
app/views/blogposts/edit.html.erb
Normal file
6
app/views/blogposts/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing blogpost</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @blogpost %> |
|
||||
<%= link_to 'Back', blogposts_path %>
|
||||
11
app/views/blogposts/index.html.erb
Normal file
11
app/views/blogposts/index.html.erb
Normal file
@@ -0,0 +1,11 @@
|
||||
<h1>Blog</h1>
|
||||
<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>
|
||||
<% end %>
|
||||
<%= link_to 'New Blogpost', new_blogpost_path if current_user && current_user.rank >= Tools.rank_to_int(:mod) %>
|
||||
</div>
|
||||
3
app/views/blogposts/new.html.erb
Normal file
3
app/views/blogposts/new.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<h1>New Blogpost</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
27
app/views/blogposts/show.html.erb
Normal file
27
app/views/blogposts/show.html.erb
Normal file
@@ -0,0 +1,27 @@
|
||||
<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) %>
|
||||
- <%= link_to "edit", edit_blogpost_path(@post.id) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div id="post-content">
|
||||
<%= RbbCode.new.convert(@post.text).html_safe %>
|
||||
</div>
|
||||
<div id="comments">
|
||||
<% @post.comments.each do |c| %>
|
||||
<div class="comment">
|
||||
<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) %>
|
||||
- <%= 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) %>
|
||||
<h3>New comment</h3>
|
||||
<%= simple_form_for [@post, @comment] do |f| %>
|
||||
<%= f.input :text, :label => false, :as => "text", :placeholder => "Comment" %><%= f.submit %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user