seminar2/custom_gallery/app/views/admin/custom_galleries/index.html.erb

87 lines
3.7 KiB
Plaintext

<% if @show_script %>
<%= stylesheet_link_tag "custom_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 "custom_gallery" %>
<script type="text/javascript">
var page_no = 2
var catch_flag = true
var max_page = <%= (@fiter_custom_albums.length/@limit_count).ceil rescue 1 %>
if( max_page > 1){
$("#edit-order-btn").hide();
}
$('.bottomnav').ready(function(){
function load_html_func(){
$('#load_html').text("<%= t('custom_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_custom_gallery').append(data)
page_no++
catch_flag = true
if (max_page < page_no){
$("#edit-order-btn").show();
$('#load_html').hide();
}
$('#load_html').text("<%= t('custom_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_custom_gallery" %>
<% custom_config = CustomAlbumConfig.where(:module=>params[:custom_module]).first %>
<% target_model = custom_config.bind_model.constantize %>
<h3><%= target_model.where(custom_config.uid_field=>params[:bind_uid]).first.send(custom_config.title_field) %></h3>
<div class="order-edit-notification">CustomAlbums re-ordering enabled.</div>
<%= render 'recreate_thumb' %>
<script type="text/javascript">
$(document).ready(function(){
$('form.update_custom_album_setting_form').submit(function(){
window.setTimeout(function(){alert('success')},500)
})
})
</script>
<%= form_tag '/admin/custom_galleries/update_custom_album_setting',remote: true,:class=>'update_custom_album_setting_form' do %>
<%= t('custom_gallery.custom_album_limit_for_one_page') %>:
<%= text_field_tag :custom_album_setting_limit, CustomAlbumSetting.first.limit,:placeholder => t('custom_gallery.blank_for_nil') %>
<input type="submit" value="<%= t('submit') %>">
<% end %>
<div class="rgbody" style='float: left;'>
<ul id="orbit_custom_gallery" class="custom_gallery clearfix" data-custom_gallery-id="custom_gallery"
style='display: inline-flex;flex-wrap: wrap;'>
<%= render :partial => "custom_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('custom_gallery.edit_order') %></a>
<% end %>
<% if @fiter_custom_albums.length > @limit_count %>
<button class="btn btn-small btn-info" id="load_html"><%= t('custom_gallery.load_html') %></button>
<% end %>
<a class="btn btn-small btn-primary" href="<%= (params[:custom_module].blank? ? "#{@module_app.key.pluralize}/new" : "#{params[:custom_module]}#{params[:bind_uid].present? ? ('-'+params[:bind_uid]) : ''}/new") %>"><%=t(:new_)%></a>
</div>
</div>
<% else %>
<%= render :partial => "custom_albums" %>
<% end %>