forked from bofh/fetsite
pagination update
This commit is contained in:
@@ -1,41 +1,50 @@
|
||||
<div id="<%= beispiel.divid %>" class="contentbox">
|
||||
<div class="row-fluid">
|
||||
<div class="span8">
|
||||
<div class="row-fluid">
|
||||
<div class="span8">
|
||||
|
||||
<b><%=link_to ffi1_icon("note20")+" " + beispiel.name, beispiel.beispieldatei.url, title: beispiel.desc %></b>
|
||||
<b><%=link_to ffi1_icon("note20")+" " + beispiel.name, beispiel.beispieldatei.url, title: beispiel.desc %></b>
|
||||
|
||||
<%= 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), remote: true
|
||||
else
|
||||
"liked by " + beispiel.get_likes.size.to_s
|
||||
end
|
||||
%>
|
||||
<%= 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), remote: true
|
||||
else
|
||||
"liked by " + beispiel.get_likes.size.to_s
|
||||
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) , remote: true
|
||||
else
|
||||
"disliked by " + beispiel.get_dislikes.size.to_s
|
||||
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) , remote: true
|
||||
else
|
||||
"disliked by " + beispiel.get_dislikes.size.to_s
|
||||
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 %>
|
||||
<%= link_to "Refresh", beispiel, remote: true %></br>
|
||||
</span>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<%= beispiel.desc %>
|
||||
</div>
|
||||
</div>
|
||||
<%= link_to "comment" , new_comment_path( commentable_type: "Beispiel", commentable_id: beispiel.id), remote:true if can? :comment, beispiel %>
|
||||
<%= 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 %>
|
||||
<%= link_to "Refres1h", beispiel_path(beispiel,show_comments: true), remote: true %></br>
|
||||
</span>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<%= beispiel.desc %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= link_to "comment" , new_comment_path( commentable_type: "Beispiel", commentable_id: beispiel.id), remote:true if can? :comment, beispiel %>
|
||||
<%= link_to "comments:.."+beispiel.comments.count().to_s, comments_path(commentable_type: "Beispiel", commentable_id: beispiel.id), remote:true, id: Comment.switchshowid_for(beispiel) %>
|
||||
<div id="<%= Comment.formid_for(beispiel) %>">
|
||||
</div>
|
||||
<% unless beispiel.comments.roots.empty? %>
|
||||
<div class="row-fluid"><div class="span12"><%= render partial:"comments/comments", object: beispiel.comments.order(:created_at).roots.reverse_order %></div></div>
|
||||
<% end %>
|
||||
<% unless beispiel.comments.roots.empty? %>
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div id="<%= Comment.wrapid_for(beispiel)%>">
|
||||
<%= render partial:"comments/comments", object: beispiel.comments.order(:created_at).roots.reverse_order if params[:show_comments] %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -1,17 +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.user.try(:email) %></b> (<%= I18n.l(comment.created_at) %>):
|
||||
|
||||
<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 id="<%= Comment.formid_for(comment) %>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,4 +6,7 @@
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% if comments.first.root? %>
|
||||
<%= paginate comments, :remote=>true , :theme=>'twitter-bootstrap'%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
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) %>")
|
||||
@@ -1,4 +1,5 @@
|
||||
<h1>Listing comments</h1>
|
||||
<%= render partial:"comments/comments", object: @comments %>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
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) %>")
|
||||
@@ -21,7 +21,7 @@
|
||||
<% end %>
|
||||
</ul>
|
||||
<div id="infinite-scrolling">
|
||||
<%= will_paginate @neuigkeiten %>
|
||||
<%= paginate @neuigkeiten, theme:'twitter-bootstrap' %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -32,7 +32,9 @@
|
||||
</ul>
|
||||
|
||||
<div id="infinite-scrolling">
|
||||
<%= will_paginate @neuigkeiten %>
|
||||
<%= paginate @neuigkeiten, theme:'twitter-bootstrap' %>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="span3">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
$('#neuigkeiten').append('<%= j render @neuigkeiten, :wrap_in => :li %>');
|
||||
<% if @neuigkeiten.next_page %>
|
||||
$('.pagination').replaceWith('<%= j will_paginate @neuigkeiten %>');
|
||||
$('.pagination').replaceWith('<%= j paginate @neuigkeiten, theme: 'twitter-bootstrap' %>');
|
||||
<% else %>
|
||||
$(window).off('scroll');
|
||||
$('.pagination').remove();
|
||||
|
||||
Reference in New Issue
Block a user