forked from bofh/fetsite
19
app/views/comments/_comment.html.erb
Normal file
19
app/views/comments/_comment.html.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<div id="<%= comment.divid %>">
|
||||
<a class="pull-left media-object" href="#"><%= image_tag comment.thumb_url %></a>
|
||||
<div class="media-body">
|
||||
|
||||
<b><%= (!comment.anonym) ? comment.user.try(:email) : "Anonym" %></b> (<%= I18n.l(comment.created_at) %>) <%= link_to ffi1_icon("remove9"), comment, method: :delete, data: { confirm: 'Are you sure?' } %>:
|
||||
<p><%= comment.text %>
|
||||
<% if can?(:comment, comment.commentable) %>
|
||||
<br><%= link_to "comment" , new_comment_path( commentable_type: "Comment", commentable_id: comment.id), remote:true %>
|
||||
<% end %>
|
||||
</p>
|
||||
<div id="<%= Comment.formid_for(comment) %>">
|
||||
</div>
|
||||
|
||||
<%= render partial:"comments/comments", object: comment.children.order(:created_at).reverse_order if comment.children.size >0 %>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
12
app/views/comments/_comments.html.erb
Normal file
12
app/views/comments/_comments.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<% unless comments.empty? %>
|
||||
<div class="contentbox" style="border-right:none;border-bottom:none; border-top:none">
|
||||
<ul class="unstyled media-list">
|
||||
<% comments.each do |c| %>
|
||||
<li class="media"><%= render c %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% if comments.first.root? %>
|
||||
<%= paginate comments, :remote=>true , :theme=>'twitter-bootstrap'%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
14
app/views/comments/_form.html.erb
Normal file
14
app/views/comments/_form.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<div id="<%= form.formid %>">
|
||||
<%= semantic_form_for form , remote:true, html: {class: "form-inline"} do |f| %>
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :commentable_id, as: :hidden %>
|
||||
<%= f.input :commentable_type, as: :hidden %>
|
||||
<%= f.input :text, as: :string %>
|
||||
<%= f.input :anonym %>
|
||||
<% end %>
|
||||
|
||||
<%= f.actions do %>
|
||||
<%= f.action :submit, :as => :input %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
6
app/views/comments/edit.html.erb
Normal file
6
app/views/comments/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing comment</h1>
|
||||
|
||||
<%= render 'form', object: @comment %>
|
||||
|
||||
<%= link_to 'Show', @comment %> |
|
||||
<%= link_to 'Back', comments_path %>
|
||||
3
app/views/comments/hide.js.erb
Normal file
3
app/views/comments/hide.js.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
$("#<%= Comment.wrapid_for(@commentable) %>").html("<%= escape_javascript "" %>")
|
||||
|
||||
$("#<%= Comment.switchshowid_for(@commentable) %>").attr("href","<%= escape_javascript comments_path(commentable_type: @commentable.class.to_s, commentable_id: @commentable.id) %>")
|
||||
22
app/views/comments/index.html.erb
Normal file
22
app/views/comments/index.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<h1>Listing comments</h1>
|
||||
<%= render partial:"comments/comments", object: @comments %>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @comments.each do |comment| %>
|
||||
<tr>
|
||||
<td><%= link_to 'Show', comment %></td>
|
||||
<td><%= link_to 'Edit', edit_comment_path(comment) %></td>
|
||||
<td><%= link_to 'Destroy', comment, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New Comment', new_comment_path %>
|
||||
2
app/views/comments/index.js.erb
Normal file
2
app/views/comments/index.js.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
$("#<%= Comment.wrapid_for(@commentable) %>").html("<%= escape_javascript render partial:"comments/comments", object: @comments %>")
|
||||
$("#<%= Comment.switchshowid_for(@commentable) %>").attr("href","<%= escape_javascript hide_comments_path(commentable_type: @commentable.class.to_s, commentable_id: @commentable.id) %>")
|
||||
5
app/views/comments/new.html.erb
Normal file
5
app/views/comments/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New comment</h1>
|
||||
|
||||
<%= render partial: 'form', object: @comment %>
|
||||
|
||||
<%= link_to 'Back', comments_path %>
|
||||
1
app/views/comments/new.js.erb
Normal file
1
app/views/comments/new.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#<%= @comment.formid %>").replaceWith("<%= escape_javascript render partial: "form", object: @comment %>")
|
||||
6
app/views/comments/show.html.erb
Normal file
6
app/views/comments/show.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<%= render @comment %>
|
||||
|
||||
<%= link_to 'Edit', edit_comment_path(@comment) %> |
|
||||
<%= link_to 'Back', comments_path %>
|
||||
Reference in New Issue
Block a user