UI modifications
This commit is contained in:
parent
abd1a9ecbc
commit
69304fda43
app
vendor/built_in_modules/gallery/app
assets/javascripts
controllers/panel/gallery/back_end
views/panel/gallery/back_end/orbit_galleries
|
@ -47,7 +47,7 @@ function myFileBrowser(field_name, url, type, win) {
|
|||
var cmsURL = window.location.toString();
|
||||
cmsURL = cmsURL.split("/");
|
||||
cmsURL = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>";
|
||||
console.log(cmsURL);
|
||||
|
||||
// script URL - use an absolute path!
|
||||
if (cmsURL.indexOf("?") < 0) {
|
||||
//add the type as the only query parameter
|
||||
|
|
|
@ -70,11 +70,12 @@
|
|||
<%= content_tag :li, :class => active_for_controllers('orbit_galleries','tags') do -%>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_orbit_gallery_path %>
|
||||
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('orbit_gallery') ) do -%>
|
||||
<%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('orbit_galleries') ) do -%>
|
||||
<%#= content_tag :li, link_to(t('admin.ad.all_banners'), admin_ad_banners_path), :class => active_for_action('ad_banners', 'index') %>
|
||||
<%#= content_tag :li, link_to(t('admin.ad.new_banner'), new_admin_ad_banner_path), :class => active_for_action('ad_banners', 'new') %>
|
||||
<%#= content_tag :li, link_to(t('admin.ad.new_image'), new_ad_image_admin_ad_banners_path), :class => active_for_action('ad_images', 'new') %>
|
||||
<%= content_tag :li, link_to(t('gallery.tags'), panel_gallery_back_end_tags_path), :class => active_for_action('/panel/orbit_gallery/back_end/tags', 'index') %>
|
||||
<%= content_tag :li, link_to(t('gallery.categories'), panel_gallery_back_end_categorylist_path), :class => active_for_action('/panel/gallery/back_end/categorylist','categorylist') %>
|
||||
<%= content_tag :li, link_to(t('gallery.tags'), panel_gallery_back_end_tags_path), :class => active_for_action('/panel/gallery/back_end/tags', 'index') %>
|
||||
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "orbit_gallery"}))), :class => active_for_app_auth('orbit_gallery') if (is_admin? rescue nil) %>
|
||||
<% end -%>
|
||||
<% end %>
|
||||
|
|
|
@ -24,57 +24,26 @@ var galleryAPI = function(){
|
|||
}
|
||||
})
|
||||
var bindHandlers = function(){
|
||||
$("#gallery_panel a.btn").click(function(){
|
||||
switch ($(this).attr("href")){
|
||||
case "categories":
|
||||
g.initializeCategories();
|
||||
break;
|
||||
}
|
||||
});
|
||||
$("select#category_filter").change(function(){
|
||||
var val = $(this).val();
|
||||
window.location = "orbit_gallery?cat="+val;
|
||||
})
|
||||
}
|
||||
}
|
||||
$("#filter .filter_btns a").click(function(){
|
||||
if(!$(this).hasClass("active")){
|
||||
$(this).addClass("active");
|
||||
if(typeof g.urlVars['cat'] == "undefined")
|
||||
window.location = "orbit_gallery?" + $(this).attr("href");
|
||||
else
|
||||
window.location = window.location.href +"&"+ $(this).attr("href");
|
||||
}else{
|
||||
$(this).removeClass("active");
|
||||
var loc = window.location.href;
|
||||
var url = loc.replace($(this).attr("href")+"&","");
|
||||
if(url == loc)
|
||||
url = loc.replace($(this).attr("href"),"");
|
||||
|
||||
this.initializeCategories = function(){
|
||||
var deleteCategory = function(a){
|
||||
var cid = a.attr("href");
|
||||
$.post("gallery_category_delete",{id:cid},function(response){
|
||||
if(response.success)
|
||||
a.parent().hide("slide",function(){a.parent().remove();})
|
||||
})
|
||||
}
|
||||
|
||||
$.get("categorylist",function(html){
|
||||
rcom.modalWindow({loadHtml:html,width:"400","closeBtn":false},function(dom){
|
||||
dom.find("ul#category_list a.delete").click(function(){
|
||||
var a = $(this);
|
||||
deleteCategory(a);
|
||||
})
|
||||
dom.find("#category_save_btn").click(function(){
|
||||
var lang = {
|
||||
"en" : dom.find("#category_name_en").val(),
|
||||
"zh_tw" : dom.find("#category_name_zh_tw").val()
|
||||
};
|
||||
$.post("gallery_category_save",{"category":lang},function(response){
|
||||
if(response.success){
|
||||
var $li = $("<li class='hide'>"+lang.en+" <a href='"+response.id+"' class='btn delete' onclick='return false;'>Delete</a></li>");
|
||||
dom.find("ul#category_list").append($li);
|
||||
$li.show('slide');
|
||||
$li.find("a.delete").click(function(){
|
||||
deleteCategory($(this));
|
||||
})
|
||||
dom.find("input[type=text]").val("");
|
||||
if(url.charAt(url.length-1)=="&" || url.charAt(url.length-1)=="?")
|
||||
url = url.substr(0,url.length-1);
|
||||
window.location = url;
|
||||
}
|
||||
})
|
||||
})
|
||||
dom.find("#category_close_btn").click(function(){
|
||||
rcom.modalWindowClose();
|
||||
})
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
this.makeNewAlbum = function(){
|
||||
$.get("add_album",function(html){
|
||||
|
@ -121,14 +90,28 @@ var galleryAPI = function(){
|
|||
g.albumArea.find("#imgholder").empty();
|
||||
var $addsign = $('<div class="rgalbum"><a id="global_add" class="rgui bt-addnew" href="add" onclick="return false;">Add Album</a></div>');
|
||||
$addsign.find("a").click(function(){g.makeNewAlbum();})
|
||||
$.getJSON("get_albums",{cid:id},function(albums){
|
||||
$.each(albums,function(i,album){
|
||||
if(id!="all"){
|
||||
var ids = [];
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
for(var i = 0; i < hashes.length; i++){
|
||||
hash = hashes[i].split('=');
|
||||
ids.push(hash[1]);
|
||||
var href = "cat="+hash[1];
|
||||
$("#filter .filter_btns a[href='"+href+"']").addClass("active");
|
||||
}
|
||||
}else{
|
||||
var ids = "all";
|
||||
}
|
||||
$.getJSON("get_albums",{cid:ids},function(categories){
|
||||
$.each(categories,function(x,category){
|
||||
$.each(category,function(i,album){
|
||||
if(album.cover == "default")
|
||||
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='../../../assets/gallery/default.jpg' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span></div>");
|
||||
else
|
||||
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='"+album.cover_path+"' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span></div>");
|
||||
g.albumArea.find("#imgholder").append($img);
|
||||
})
|
||||
})
|
||||
g.albumArea.find("#imgholder").append($addsign);
|
||||
})
|
||||
}
|
||||
|
@ -166,6 +149,8 @@ var galleryAPI = function(){
|
|||
|
||||
g.albumArea.find(".rghead .rgfn").append(uploadpanel);
|
||||
g.albumArea.find("#imgholder").empty();
|
||||
$("#filter").remove();
|
||||
g.albumArea.css("margin-top","");
|
||||
var $addsign = $('<div class="rgalbum"><a id="global_add" class="rgui bt-addnew" href="add" onclick="return false;">Add Album</a></div>');
|
||||
$addsign.find("a").click(function(){showUploadPanel();})
|
||||
$.getJSON("get_images",{aid:id},function(images){
|
||||
|
@ -332,12 +317,14 @@ var galleryAPI = function(){
|
|||
$(this).text("<%= I18n.t('gallery.pic_not_found') %>.");
|
||||
return false;
|
||||
}
|
||||
$("#filter").remove();
|
||||
g.albumArea.css("margin-top","");
|
||||
var albumid = $(theater).find("#main_pic").attr("data-content");
|
||||
head.attr("href","orbit_gallery?album="+albumid);
|
||||
head1.attr("href","orbit_gallery?edit="+albumid);
|
||||
g.albumArea.find(".rghead .rgfn").html(head);
|
||||
g.albumArea.find(".rghead .rgfn").append(head1);
|
||||
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#gallery_panel").outerHeight() + $("#orbit_gallery .rghead").outerHeight());
|
||||
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .rghead").outerHeight());
|
||||
preparestage(albumid);
|
||||
})
|
||||
}
|
||||
|
@ -399,10 +386,13 @@ var galleryAPI = function(){
|
|||
}
|
||||
})
|
||||
}
|
||||
$("#filter").remove();
|
||||
g.albumArea.css("margin-top","");
|
||||
var head ='<a href="orbit_gallery?album='+id+'" class="rgui bt-back rgbt" title="<%= I18n.t("gallery.back_to_photos") %>"><span id="album_name_span"><%= I18n.t("gallery.back_to_photos") %></span></a></div>';
|
||||
head+='<a class="rgui bt-del bt-delete rgbt" onclick="return false;" style="display:none;" title="<%= I18n.t("gallery.delete_selected") %>" href=""><span><%= I18n.t("gallery.delete_selected") %></span></a>';
|
||||
head+='<a class="rgui bt-save rgbt" onclick="return false;" style="display:none;" title="Save" href=""><span>Save</span>';
|
||||
g.albumArea.find(".rghead .rgfn").html(head);
|
||||
|
||||
rcom.bindDomToHead($(".rghead"));
|
||||
g.albumArea.find("#imgholder").load("edit_album?aid="+id,function(data,response,xhr){
|
||||
if(xhr.status == 404){
|
||||
|
|
|
@ -18,7 +18,7 @@ class Panel::Gallery::BackEnd::OrbitGalleriesController < OrbitBackendController
|
|||
|
||||
def categorylist
|
||||
@categorylist = GalleryCategory.all
|
||||
render :layout => false
|
||||
#render :layout => false
|
||||
end
|
||||
|
||||
def gallery_category_delete
|
||||
|
@ -49,12 +49,15 @@ class Panel::Gallery::BackEnd::OrbitGalleriesController < OrbitBackendController
|
|||
end
|
||||
|
||||
def get_albums
|
||||
@categoryid = params["cid"]
|
||||
if @categoryid == "all"
|
||||
@albums = GalleryAlbum.all
|
||||
@categoryids = params["cid"]
|
||||
@albums = Array.new
|
||||
if @categoryids == "all"
|
||||
@albums << GalleryAlbum.all
|
||||
else
|
||||
category = GalleryCategory.find(@categoryid)
|
||||
@albums = category.gallery_albums.all
|
||||
@categoryids.each do |id|
|
||||
category = GalleryCategory.find(id)
|
||||
@albums << category.gallery_albums.all
|
||||
end
|
||||
end
|
||||
render :json=>@albums.to_json
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ class Panel::Gallery::BackEnd::TagsController < Admin::TagsController
|
|||
|
||||
def initialize
|
||||
super
|
||||
@app_title = 'orbit_gallery'
|
||||
@app_title = 'gallery'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -12,7 +12,40 @@
|
|||
<div class="modal-footer">
|
||||
<%= t("gallery.new_category")+"["+ t("gallery.english")+"]" %> : <input type="text" id="category_name_en"></text><br />
|
||||
<%= t("gallery.new_category") +"["+ t("gallery.chinese")+"]" %> : <input type="text" id="category_name_zh_tw"></text><br />
|
||||
<a href="#" class="btn" data-dismiss="modal" id="category_close_btn" onclick="return false;"><%= t("gallery.close") %></a>
|
||||
<a href="#" class="btn btn-primary" id="category_save_btn" onclick="return false;"><%= t("gallery.save_changes") %></a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
var deleteCategory = function(a){
|
||||
var cid = a.attr("href");
|
||||
$.post("gallery_category_delete",{id:cid},function(response){
|
||||
if(response.success)
|
||||
a.parent().hide("slide",function(){a.parent().remove();})
|
||||
})
|
||||
}
|
||||
$.get("categorylist",function(html){
|
||||
$("ul#category_list a.delete").click(function(){
|
||||
var a = $(this);
|
||||
deleteCategory(a);
|
||||
})
|
||||
$("#category_save_btn").click(function(){
|
||||
var lang = {
|
||||
"en" : $("#category_name_en").val(),
|
||||
"zh_tw" : $("#category_name_zh_tw").val()
|
||||
};
|
||||
$.post("gallery_category_save",{"category":lang},function(response){
|
||||
if(response.success){
|
||||
var $li = $("<li class='hide'>"+lang.en+" <a href='"+response.id+"' class='btn delete' onclick='return false;'>Delete</a></li>");
|
||||
$("ul#category_list").append($li);
|
||||
$li.show('slide');
|
||||
$li.find("a.delete").click(function(){
|
||||
deleteCategory($(this));
|
||||
})
|
||||
$("input[type=text]").val("");
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
|
@ -18,8 +18,10 @@
|
|||
</ul>
|
||||
<div class="filters">
|
||||
<div class="accordion-body collapse" id="collapse-categories">
|
||||
<div class="accordion-inner" data-toggle="buttons-checkbox">
|
||||
<a href="#" class="btn js_history">album categories</a>
|
||||
<div class="accordion-inner filter_btns" data-toggle="buttons-checkbox">
|
||||
<% @categorylist.each do |category| %>
|
||||
<a href="cat=<%= category.id %>" class="btn" onclick="return false;"><%= category.name %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="filter-clear">
|
||||
<a href="panel/gallery/back_end/orbit_gallery" class="btn js_history"><i class="icons-brush-large"></i>清除</a>
|
||||
|
@ -35,7 +37,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="gallery_list" class="table main-list">
|
||||
<!-- <table id="gallery_list" class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"></th>
|
||||
|
@ -52,23 +54,7 @@
|
|||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<div id="gallery_panel">
|
||||
<a class="btn" href="categories" onclick="return false;" ><%= t('gallery.manage_categories') %></a>
|
||||
<select id="category_filter">
|
||||
<option value=""><%= t("gallery.select_category") %></option>
|
||||
<option value="all"><%= t("gallery.all") %></option>
|
||||
<% @categorylist.each do |category| %>
|
||||
<% if @cid == category.id.to_s %>
|
||||
<option value='<%= category.id %>' selected><%= category.name %></option>
|
||||
<% else %>
|
||||
<option value='<%= category.id %>'><%= category.name %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
</table> -->
|
||||
<div id="orbit_gallery" class="rg">
|
||||
<div class="rghead">
|
||||
<div class="rgfn">
|
||||
|
|
Loading…
Reference in New Issue