Revert "removecomments"

This reverts commit 6ee1468ce3.
This commit is contained in:
Andreas Stephanides
2014-10-17 09:54:39 +02:00
parent 3a8f84d9b4
commit 699517fb56
19 changed files with 296 additions and 5 deletions

View 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>

View 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 %>

View 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>

View File

@@ -0,0 +1,6 @@
<h1>Editing comment</h1>
<%= render 'form', object: @comment %>
<%= link_to 'Show', @comment %> |
<%= link_to 'Back', comments_path %>

View 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) %>")

View 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 %>

View 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) %>")

View File

@@ -0,0 +1,5 @@
<h1>New comment</h1>
<%= render partial: 'form', object: @comment %>
<%= link_to 'Back', comments_path %>

View File

@@ -0,0 +1 @@
$("#<%= @comment.formid %>").replaceWith("<%= escape_javascript render partial: "form", object: @comment %>")

View File

@@ -0,0 +1,6 @@
<p id="notice"><%= notice %></p>
<%= render @comment %>
<%= link_to 'Edit', edit_comment_path(@comment) %> |
<%= link_to 'Back', comments_path %>