forked from bofh/fetsite
comments
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
<div class="row-fluid contentbox">
|
||||
<div id="<%= beispiel.divid %>" class="contentbox">
|
||||
<div class="row-fluid">
|
||||
<div class="span8">
|
||||
|
||||
<b><%=link_to ffi1_icon("note20")+" " + beispiel.name, beispiel.beispieldatei.url, title: beispiel.desc %></b>
|
||||
@@ -7,7 +7,7 @@
|
||||
<%= I18n.t("file.size") + ": " + (beispiel.beispieldatei.size/1024.0).round(2).to_s %>KiB <br>
|
||||
<span class="linklist"><%=
|
||||
if can?(:like, beispiel)
|
||||
link_to ffi1_icon("like3")+" like" + "("+beispiel.get_likes.size.to_s+")", like_beispiel_path(beispiel),title: "liked by " + ((current_user.liked?(beispiel)) ? ("you and " + ((beispiel.get_likes.size - 1).to_s + " others")) : beispiel.get_likes.size.to_s)
|
||||
link_to ffi1_icon("like3")+" like" + "("+beispiel.get_likes.size.to_s+")", like_beispiel_path(beispiel),title: "liked by " + ((current_user.liked?(beispiel)) ? ("you and " + ((beispiel.get_likes.size - 1).to_s + " others")) : beispiel.get_likes.size.to_s), remote: true
|
||||
else
|
||||
"liked by " + beispiel.get_likes.size.to_s
|
||||
end
|
||||
@@ -15,7 +15,7 @@ end
|
||||
|
||||
<%=
|
||||
if can?(:dislike, beispiel)
|
||||
link_to ffi1_icon("dislike")+" dislike" + "("+beispiel.get_dislikes.size.to_s+")", dislike_beispiel_path(beispiel),title:"disliked by " + ((current_user.disliked?(beispiel)) ? ("you and " + ((beispiel.get_dislikes.size - 1).to_s + " others")) : beispiel.get_dislikes.size.to_s)
|
||||
link_to ffi1_icon("dislike")+" dislike" + "("+beispiel.get_dislikes.size.to_s+")", dislike_beispiel_path(beispiel),title:"disliked by " + ((current_user.disliked?(beispiel)) ? ("you and " + ((beispiel.get_dislikes.size - 1).to_s + " others")) : beispiel.get_dislikes.size.to_s) , remote: true
|
||||
else
|
||||
"disliked by " + beispiel.get_dislikes.size.to_s
|
||||
end
|
||||
@@ -23,10 +23,17 @@ end
|
||||
%>
|
||||
|
||||
<%= link_to ff_icon("icon-pencil")+" edit", edit_beispiel_path(beispiel) if can? :edit, beispiel%>
|
||||
<%= link_to ff_icon("icon-remove")+" delete", beispiel_path(beispiel), :method=>:delete, :data=>{:confirm=>I18n.t('beispiel.sure')} if can? :delete, beispiel %></br>
|
||||
<%= link_to ff_icon("icon-remove")+" delete", beispiel_path(beispiel), :method=>:delete, :data=>{:confirm=>I18n.t('beispiel.sure')} if can? :delete, beispiel %>
|
||||
<%= link_to "Refresh", beispiel, remote: true %></br>
|
||||
</span>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<%= beispiel.desc %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid"><div class="span12"><%= render partial:"comments/comments", object: beispiel.comments.roots %></div></div>
|
||||
<%= link_to "comment" , new_comment_path( commentable_type: "Beispiel", commentable_id: beispiel.id), remote:true %>
|
||||
<div id="<%= Comment.formid_for(beispiel) %>">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
1
app/views/beispiele/refresh.js.erb
Normal file
1
app/views/beispiele/refresh.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#<%= @beispiel.divid %>").replaceWith("<%= escape_javascript ( render @beispiel ) %>")
|
||||
1
app/views/beispiele/show.js.erb
Normal file
1
app/views/beispiele/show.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("<%= '#' + @beispiel.divid %>").replaceWith("<%= escape_javascript render @beispiel %>")
|
||||
12
app/views/comments/_comment.html.erb
Normal file
12
app/views/comments/_comment.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<div id="<%= comment.divid %>">
|
||||
<a class="pull-left media-object" href="#"><%= image_tag comment.thumb_url %></a>
|
||||
<div class="media-body">
|
||||
<b><%= comment.user.try(:email) %></b> (<%= I18n.l(comment.created_at) %>): <%= comment.text %>
|
||||
<%= link_to "comment" , new_comment_path( commentable_type: "Comment", commentable_id: comment.id), remote:true %>
|
||||
<%= render partial:"comments/comments", object: comment.children if comment.children.size >0 %>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="<%= Comment.formid_for(comment) %>">
|
||||
</div>
|
||||
</div>
|
||||
7
app/views/comments/_comments.html.erb
Normal file
7
app/views/comments/_comments.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="contentbox">
|
||||
<ul class="unstyled media-list">
|
||||
<% comments.each do |c| %>
|
||||
<li class="media"><%= render c %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
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 %>
|
||||
21
app/views/comments/index.html.erb
Normal file
21
app/views/comments/index.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<h1>Listing comments</h1>
|
||||
|
||||
<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 %>
|
||||
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