This commit is contained in:
2014-07-30 10:15:40 +05:30
parent f5beed1264
commit 1871c64e6c
35 changed files with 429 additions and 12 deletions

View File

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

View File

@@ -0,0 +1 @@
$("#<%= @beispiel.divid %>").replaceWith("<%= escape_javascript ( render @beispiel ) %>")

View File

@@ -0,0 +1 @@
$("<%= '#' + @beispiel.divid %>").replaceWith("<%= escape_javascript render @beispiel %>")

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

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

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

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