gallery/app/views/admin/galleries/index.html.erb

67 lines
2.4 KiB
Plaintext

<% if @show_script %>
<%= stylesheet_link_tag "gallery" %>
<%= stylesheet_link_tag "lib/tags-groups" %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "lib/jquery-ui-1.10.0.custom.min" %>
<%= javascript_include_tag "jquery.masonry.min.js" %>
<%= javascript_include_tag "jquery.lite.image.resize.js" %>
<%= javascript_include_tag "gallery" %>
<script type="text/javascript">
var page_no = 2
var catch_flag = true
var max_page = <%= (@fiter_albums.length/50).ceil %>
$('.bottomnav').ready(function(){
function load_html_func(){
$('#load_html').text("<%= t('gallery.wait_time') %>")
if (catch_flag){
catch_flag = true;
$.ajax({
type : "get",
url : "<%= @url %>",
dataType : "text",
data:{page_no: page_no},
global:false,
success: function(data)
{
$('#orbit_gallery').append(data)
page_no++
catch_flag = true
if (max_page < page_no){
$('#load_html').hide()
}
$('#load_html').text("<%= t('gallery.load_html') %>")
},
error : function(data){
catch_flag = true
alert('please try again later.')
}
});
}
}
$('#load_html').click(load_html_func)
})
</script>
<% end %>
<%= render_filter @filter_fields, "orbit_gallery" %>
<div class="order-edit-notification">Albums re-ordering enabled.</div>
<%= render 'recreate_thumb' %>
<div class="rgbody" style='float: left;'>
<ul id="orbit_gallery" class="gallery clearfix" data-gallery-id="gallery"
style='display: inline-flex;flex-wrap: wrap;'>
<%= render :partial => "album", :collection => @albums %>
</ul>
</div>
<div class="bottomnav clearfix">
<div class="action pull-right">
<% if can_edit_or_delete?(nil) %>
<a href="#" class="btn btn-small btn-info order-btn-class" id="edit-order-btn"><%= t('gallery.edit_order') %></a>
<% end %>
<% if @fiter_albums.length > 50 %>
<button class="btn btn-small btn-info" id="load_html"><%= t('gallery.load_html') %></button>
<% end %>
</div>
</div>
<% else %>
<%= render :partial => "album", :collection => @albums %>
<% end %>