Merge branch 'gallery_orbit' into desktop_devin
This commit is contained in:
commit
833349bf6c
|
@ -67,15 +67,15 @@
|
|||
<% end -%>
|
||||
<% end -%>
|
||||
|
||||
<%= content_tag :li, :class => active_for_controllers('orbit_galleries','/panel/gallery/back_end/tags') || active_for_app_auth("orbit_gallery") do -%>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_orbit_gallery_path %>
|
||||
<%= content_tag :li, :class => active_for_controllers('albums','album_images','gallery_categories','/panel/gallery/back_end/tags') || active_for_app_auth("gallery") do -%>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icons-picture') + t('admin.orbit_gallery'), panel_gallery_back_end_albums_path %>
|
||||
<%= 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.categories'), panel_gallery_back_end_categorylist_path), :class => active_for_action('/panel/gallery/back_end/categorylist','categorylist') %>
|
||||
<%= content_tag :li, link_to(t('gallery.categories'), panel_gallery_back_end_gallery_categories_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) %>
|
||||
<%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "Gallery"}))), :class => active_for_app_auth('gallery') if (is_admin? rescue nil) %>
|
||||
<% end -%>
|
||||
<% end %>
|
||||
<%#= content_tag :li, :class => active_for_controllers('assets', '/admin/asset_tags', 'asset_categories') do -%>
|
||||
|
|
|
@ -15,43 +15,43 @@ var galleryAPI = function(){
|
|||
$(document).ready(function(){
|
||||
bindHandlers();
|
||||
var passid = null;
|
||||
if(typeof g.urlVars['cat']!= "undefined"){
|
||||
g.loadArea = "albums";
|
||||
passid = g.urlVars['cat'];
|
||||
g.loadAlbums(g.urlVars['cat']);
|
||||
}else if(typeof g.urlVars['album']!= "undefined"){
|
||||
g.loadArea = "images";
|
||||
passid = g.urlVars['album'];
|
||||
g.loadImages(g.urlVars['album']);
|
||||
}else if(typeof g.urlVars['theater']!= "undefined"){
|
||||
g.loadArea = "theater";
|
||||
passid = g.urlVars['theater'];
|
||||
g.loadTheater(g.urlVars['theater']);
|
||||
}else if(typeof g.urlVars['edit']!= "undefined"){
|
||||
g.loadArea = "edit";
|
||||
passid = g.urlVars['edit'];
|
||||
g.editAlbum(g.urlVars['edit']);
|
||||
}else if(typeof g.urlVars['tag']!= "undefined"){
|
||||
g.loadArea = "albums";
|
||||
passid = g.urlVars['tag'];
|
||||
g.loadAlbums(g.urlVars['tag']);
|
||||
}else if(g.urlVars["locale"]){
|
||||
g.loadArea = "albums";
|
||||
g.loadAlbums("all");
|
||||
}else if(g.urlVars.length == 0) {
|
||||
g.loadArea = "albums";
|
||||
g.loadAlbums("all");
|
||||
}
|
||||
if(typeof callbackFn == "function"){
|
||||
callbackFn.call(this,g.loadArea,passid);
|
||||
}
|
||||
// if(typeof g.urlVars['cat']!= "undefined"){
|
||||
// g.loadArea = "albums";
|
||||
// passid = g.urlVars['cat'];
|
||||
// g.loadAlbums(g.urlVars['cat']);
|
||||
// }else if(typeof g.urlVars['album']!= "undefined"){
|
||||
// g.loadArea = "images";
|
||||
// passid = g.urlVars['album'];
|
||||
// g.loadImages(g.urlVars['album']);
|
||||
// }else if(typeof g.urlVars['theater']!= "undefined"){
|
||||
// g.loadArea = "theater";
|
||||
// passid = g.urlVars['theater'];
|
||||
// g.loadTheater(g.urlVars['theater']);
|
||||
// }else if(typeof g.urlVars['edit']!= "undefined"){
|
||||
// g.loadArea = "edit";
|
||||
// passid = g.urlVars['edit'];
|
||||
// g.editAlbum(g.urlVars['edit']);
|
||||
// }else if(typeof g.urlVars['tag']!= "undefined"){
|
||||
// g.loadArea = "albums";
|
||||
// passid = g.urlVars['tag'];
|
||||
// g.loadAlbums(g.urlVars['tag']);
|
||||
// }else if(g.urlVars["locale"]){
|
||||
// g.loadArea = "albums";
|
||||
// g.loadAlbums("all");
|
||||
// }else if(g.urlVars.length == 0) {
|
||||
// g.loadArea = "albums";
|
||||
// g.loadAlbums("all");
|
||||
// }
|
||||
// if(typeof callbackFn == "function"){
|
||||
// callbackFn.call(this,g.loadArea,passid);
|
||||
// }
|
||||
})
|
||||
var bindHandlers = function(){
|
||||
$("#filter .filter_btns a").click(function(){
|
||||
if(!$(this).hasClass("active")){
|
||||
$(this).addClass("active");
|
||||
if(g.urlVars.length == 0)
|
||||
window.location = "orbit_gallery?" + $(this).attr("href");
|
||||
window.location = "albums?" + $(this).attr("href");
|
||||
else
|
||||
window.location = window.location.href +"&"+ $(this).attr("href");
|
||||
}else{
|
||||
|
@ -86,7 +86,7 @@ var galleryAPI = function(){
|
|||
})
|
||||
}
|
||||
this.makeNewAlbum = function(){
|
||||
$.get("add_album",function(html){
|
||||
$.get("albums/new",function(html){
|
||||
rcom.modalWindow({loadHtml:html,width:400,height:320,"closeBtn":false},function(dom){
|
||||
dom.find("#album_name_save_btn").click(function(){
|
||||
var options ={
|
||||
|
@ -101,7 +101,7 @@ var galleryAPI = function(){
|
|||
}
|
||||
}
|
||||
if(options.cid){
|
||||
$.post("create_album",options,function(response){
|
||||
$.post("albums/create",options,function(response){
|
||||
if(g.loadArea == "albums")
|
||||
g.loadAlbums("all");
|
||||
rcom.modalWindowClose();
|
||||
|
@ -117,24 +117,20 @@ var galleryAPI = function(){
|
|||
}
|
||||
this.deleteAlbum = function(id){
|
||||
if(confirm("<%= I18n.t('gallery.del_album?') %>")){
|
||||
$.post("delete_album",{aid:id},function(){
|
||||
window.location = "orbit_gallery";
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
url : "albums/"+id,
|
||||
success : function(){
|
||||
window.location = "albums";
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.loadAlbums = function(id){
|
||||
g.loadFooterPanel(g.loadArea,id,function(headbtn){
|
||||
headbtn = $(headbtn);
|
||||
headbtn.click(function(){g.makeNewAlbum();})
|
||||
g.albumArea.find(".rghead .rgfn").html(headbtn);
|
||||
})
|
||||
|
||||
g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum()});
|
||||
g.albumArea.addClass('o_gallery');
|
||||
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();})
|
||||
|
||||
if(id!="all"){
|
||||
var cids = [];
|
||||
var tids = [];
|
||||
|
@ -160,9 +156,9 @@ var galleryAPI = function(){
|
|||
$.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><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></span></div>");
|
||||
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='albums/"+album._id+"'><img src='../../../assets/gallery/default.jpg' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></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><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></span></div>");
|
||||
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='albums/"+album._id+"'><img src='"+album.cover_path+"' width='120px' height='90px'/></a><span class='albumname'>"+album.name+"</span><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></span></div>");
|
||||
|
||||
var tag_string = "";
|
||||
for(tag in album.tag_names){
|
||||
|
@ -177,9 +173,6 @@ var galleryAPI = function(){
|
|||
}
|
||||
this.loadImages = function(id){
|
||||
var panelopen = false;
|
||||
g.loadFooterPanel(g.loadArea,id,function(headerPanel){
|
||||
headarea = $(headerPanel);
|
||||
g.albumArea.find(".rghead .rgfn").html(headarea);
|
||||
$('.bt-tag').click(function(){
|
||||
$(this).toggleClass("active");
|
||||
var $tag_panel = $('#tag_panel'),
|
||||
|
@ -221,9 +214,9 @@ var galleryAPI = function(){
|
|||
g.albumArea.find(".rghead .rgfn .bt-del").click(function(){
|
||||
g.deleteAlbum(id);
|
||||
})
|
||||
})
|
||||
$("#upload_panel_holder").remove();
|
||||
var uploadpanel = $('<div id="upload_panel_holder"><div class="rgfn"><a class="bt-cls btn btn-primary pull-right" title="Close" href="" onclick="return false;"><i class="icon-remove icon-white"></i>Close Panel</a></div></div>');
|
||||
var frame = $('<iframe id="upload_panel" width="100%" scrolling="no" height="294" frameborder="0" src="upload_panel"></iframe>');
|
||||
var frame = $('<iframe id="upload_panel" width="100%" scrolling="no" height="294" frameborder="0" src="'+id+'/upload_panel"></iframe>');
|
||||
uploadpanel.find(".bt-cls").click(function(){
|
||||
uploadpanel.hide("slide");
|
||||
frame.remove();
|
||||
|
@ -243,7 +236,7 @@ var galleryAPI = function(){
|
|||
g.albumArea.find("#imgholder").empty();
|
||||
$("#filter").remove();
|
||||
g.albumArea.css("margin-top","");
|
||||
$.getJSON("get_images",{aid:id},function(album){
|
||||
$.getJSON(id+"/get_images",function(album){
|
||||
$.each(album.images,function(i,image){
|
||||
var thumb = image.file.thumb.url;
|
||||
var $img = $("<div class='rgphoto'><a title='"+image.description+"' href='?theater="+image._id+"'><img src='"+thumb+"'/></a></div>");
|
||||
|
@ -494,12 +487,9 @@ var galleryAPI = function(){
|
|||
$("#filter").remove();
|
||||
g.albumArea.css("margin-top","");
|
||||
var albumid = $(theater).find("#main_pic").attr("data-content");
|
||||
g.loadFooterPanel(g.loadArea,id,function(head){
|
||||
head = $(head);
|
||||
g.albumArea.find(".rghead .rgfn").html(head);
|
||||
g.albumArea.find(".bt-back").attr("href","orbit_gallery?album="+albumid);
|
||||
g.albumArea.find(".bt-back").attr("href","album_images?album="+albumid);
|
||||
g.albumArea.find(".bt-edit").attr("href","orbit_gallery?edit="+albumid);
|
||||
})
|
||||
|
||||
g.albumArea.css("margin-bottom","0");
|
||||
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
|
||||
preparestage(albumid);
|
||||
|
@ -514,9 +504,11 @@ var galleryAPI = function(){
|
|||
|
||||
})
|
||||
$(".description_loader .edit_fn .bt-cover").click(function(){
|
||||
$(".bt-cover").removeClass("setcover");
|
||||
$(this).addClass("setcover");
|
||||
$.post("set_cover",{"imageid":$(this).attr("href"),"aid":id},function(){})
|
||||
$(".bt-cover").removeClass("setcover active btn-primary");
|
||||
$(".bt-cover span").removeClass("icon-white icon-star").addClass("icon-star-empty")
|
||||
$(".bt-cover[for="+$(this).attr("for")+"]").addClass("setcover active btn-primary");
|
||||
$(".bt-cover[for="+$(this).attr("for")+"]").find("span").removeClass("icon-star-empty").addClass("icon-white icon-star");
|
||||
$.post("set_cover",{"imageid":$(this).attr("for")},function(){})
|
||||
})
|
||||
$(".description_loader .edit_fn .bt-dels").click(function(){
|
||||
$(this)
|
||||
|
@ -546,15 +538,21 @@ var galleryAPI = function(){
|
|||
})
|
||||
$('.bt-tag').click(function(){
|
||||
$(this).toggleClass("active");
|
||||
var count = 0;
|
||||
$('.bt-tag').each(function(){
|
||||
if($(this).hasClass("active"))
|
||||
count++;
|
||||
})
|
||||
var $tag_panel = $('#tag_panel'),
|
||||
tag_panel_position = 0;
|
||||
if(count == 1)
|
||||
tag_panel_position = 0
|
||||
else if(count == 0){
|
||||
if( $tag_panel.css('right') == '0px' ){
|
||||
tag_panel_position = -200;
|
||||
}
|
||||
if(last_clicked == $(this))
|
||||
alert("same")
|
||||
else
|
||||
alert("no")
|
||||
}
|
||||
|
||||
$tag_panel.animate({'right':tag_panel_position}, 300);
|
||||
|
||||
g.albumArea
|
||||
|
@ -591,44 +589,45 @@ var galleryAPI = function(){
|
|||
g.albumArea.find(".rghead .rgfn .bt-save").show();
|
||||
})
|
||||
g.albumArea.find(".rghead .rgfn .bt-delete").click(function(){
|
||||
var deleteurl = $(this).attr("href");
|
||||
var images_to_delete = new Array();
|
||||
var delete_cover = false;
|
||||
var doms_to_delete = new Array();
|
||||
var thiscover = $(".description_loader .edit_fn .setcover").attr("href");
|
||||
var thiscover = $(".description_loader .edit_fn .setcover").attr("for");
|
||||
$(".description_loader .edit_fn .bt-dels").each(function(){
|
||||
if($(this).hasClass("setdelete")){
|
||||
images_to_delete.push($(this).attr("href"));
|
||||
doms_to_delete.push($(this).parent().parent());
|
||||
$(".tab_content .rgphoto_edit[data-content="+$(this).attr("href")+"]").each(function(){
|
||||
doms_to_delete.push($(this));
|
||||
})
|
||||
if(thiscover == $(this).attr("href"))
|
||||
delete_cover = true;
|
||||
}
|
||||
})
|
||||
if(confirm("Deleting "+images_to_delete.length+" image(s)?")){
|
||||
$.post("delete_images",{"images":images_to_delete,"delete_cover":delete_cover,"aid":id},function(response){
|
||||
if(response.success){
|
||||
$.ajax({
|
||||
data : {"images":images_to_delete,"delete_cover":delete_cover},
|
||||
type : "DELETE",
|
||||
url : deleteurl+"/"+id, // have to ask chris about delete resource
|
||||
success : function(){
|
||||
for(dom in doms_to_delete){
|
||||
doms_to_delete[dom].hide("slide",function(){$(this).remove();})
|
||||
}
|
||||
}
|
||||
g.albumArea.find(".rghead .rgfn .bt-delete").hide();
|
||||
}
|
||||
})
|
||||
// $.post("delete",{"images":images_to_delete,"delete_cover":delete_cover,"aid":id},function(response){
|
||||
// if(response.success){
|
||||
|
||||
// }
|
||||
// })
|
||||
}
|
||||
})
|
||||
}
|
||||
$("#filter").remove();
|
||||
g.albumArea.addClass('o_album_edit');
|
||||
g.albumArea.css("margin-top","");
|
||||
var head ='<a href="orbit_gallery?album='+id+'" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a></div>';
|
||||
head+='<a class="bt-del bt-delete btn btn-primary pull-right" onclick="return false;" style="display:none;" title="<%= I18n.t("gallery.delete_selected") %>" href=""><i class="icon-trash icon-white"></i><%= I18n.t("gallery.delete_selected") %></a>';
|
||||
head+='<a class="bt-save btn btn-primary pull-right" onclick="return false;" style="display:none;" title="Save" href=""><i class="icon-ok icon-white"></i>Save</a>';
|
||||
g.albumArea.find(".rghead .rgfn").html(head);
|
||||
g.albumArea.find("#imgholder").load("edit_album?aid="+id,function(data,response,xhr){
|
||||
if(xhr.status == 404){
|
||||
$(this).text("<%= I18n.t('gallery.album_not_found') %>");
|
||||
return false;
|
||||
}
|
||||
bindHandlers();
|
||||
})
|
||||
}
|
||||
this.saveTags = function(id,tagsfor){
|
||||
var tagids = new Array();
|
||||
|
|
|
@ -4,7 +4,7 @@ $(function () {
|
|||
|
||||
'use strict';
|
||||
// Initialize the jQuery File Upload widget:
|
||||
$('#fileupload').fileupload({"aid" : parent.g.urlVars['album']},{
|
||||
$('#fileupload').fileupload({
|
||||
acceptFileTypes:/(\.|\/)(jpe?g|png)$/i,
|
||||
headers:{
|
||||
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
|
||||
include AdminHelper
|
||||
|
||||
def theater
|
||||
picid = params["pic"]
|
||||
@image = GalleryImage.find(picid)
|
||||
@albumid = @image.gallery_album_id
|
||||
album = GalleryAlbum.find(@albumid)
|
||||
@images = album.gallery_images.all
|
||||
render :layout=>false
|
||||
end
|
||||
|
||||
def destroy
|
||||
images = params['images']
|
||||
images.each do |image|
|
||||
img = GalleryImage.find(image)
|
||||
img.delete
|
||||
end
|
||||
if params['delete_cover'] == "true"
|
||||
album = GalleryAlbum.find(params['id'])
|
||||
album.update_attributes(:cover=>"default")
|
||||
end
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def update_album
|
||||
# data = params['data']
|
||||
# album_name = params['name']
|
||||
# aid = params['aid']
|
||||
# data.each do |d|
|
||||
# image = GalleryImage.find(d[1][:id])
|
||||
# image.update_attributes(:description=>d[1][:text])
|
||||
# end
|
||||
# album = GalleryAlbum.find(aid)
|
||||
# album.update_attributes(:name => album_name)
|
||||
# album_names = params[:albumnm]
|
||||
# data = params[:data]
|
||||
# aid =params[:aid]
|
||||
# debugger
|
||||
# data.each do |d|
|
||||
# image = GalleryImage.find(d[1][:id])
|
||||
# @site_valid_locales.each do |locale|
|
||||
# image.description_translations[locale] = d[1][:text][locale]
|
||||
# end
|
||||
# image.save!
|
||||
# end
|
||||
|
||||
# album = GalleryAlbum.find(aid)
|
||||
|
||||
# @site_valid_locales.each_with_index do |locale,i|
|
||||
# album.name_translations[locale] = album_names[i]
|
||||
# end
|
||||
# album.save!
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@album.update_attributes(params[:gallery_albums])
|
||||
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def save_tags
|
||||
case params[:tag]
|
||||
when "album"
|
||||
@object = GalleryAlbum.find(params[:id])
|
||||
when "pic"
|
||||
@object = GalleryImage.find(params[:id])
|
||||
end
|
||||
@object.update_attributes({:tag_ids => params[:tids]})
|
||||
render :json => {"success"=> "true"}.to_json
|
||||
end
|
||||
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class Panel::Gallery::BackEnd::OrbitGalleriesController < OrbitBackendController
|
||||
class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController
|
||||
include AdminHelper
|
||||
|
||||
def index
|
||||
|
@ -12,29 +12,17 @@ include AdminHelper
|
|||
@tags = GalleryTag.all
|
||||
end
|
||||
|
||||
def new_category
|
||||
names = params['category']
|
||||
category = GalleryCategory.new
|
||||
I18n.locale = :en
|
||||
category.name = names['en']
|
||||
I18n.locale = :zh_tw
|
||||
category.name = names['zh_tw']
|
||||
category.save!
|
||||
render :json=>{"success"=>true,"id"=>category.id}.to_json
|
||||
def show
|
||||
if is_manager? || is_admin? || is_sub_manager?
|
||||
@authenticated = true #turn this value to false for view only
|
||||
else
|
||||
@authenticated = false
|
||||
end
|
||||
|
||||
def categorylist
|
||||
@categorylist = GalleryCategory.all
|
||||
#render :layout => false
|
||||
@tags = GalleryTag.all
|
||||
end
|
||||
|
||||
def gallery_category_delete
|
||||
@category = GalleryCategory.find(params['id'])
|
||||
@category.delete
|
||||
render :json=>{"success"=>"true"}.to_json
|
||||
end
|
||||
|
||||
def add_album
|
||||
def new
|
||||
if is_manager? || is_admin?
|
||||
@categorylist = GalleryCategory.all
|
||||
elsif is_sub_manager?
|
||||
|
@ -43,7 +31,7 @@ include AdminHelper
|
|||
render :layout => false
|
||||
end
|
||||
|
||||
def create_album
|
||||
def create
|
||||
category = GalleryCategory.find(params['cid'])
|
||||
albumnames = params["albumname"]
|
||||
albumdescs = params["albumdesc"]
|
||||
|
@ -107,26 +95,31 @@ include AdminHelper
|
|||
render :json=>@output.to_json
|
||||
end
|
||||
|
||||
def upload_image
|
||||
albumid = params['aid'];
|
||||
@album = GalleryAlbum.find(albumid)
|
||||
@files = params['files']
|
||||
a = Array.new
|
||||
@files.each do |file|
|
||||
@image = @album.gallery_images.new
|
||||
@image.file = file
|
||||
@image.save!
|
||||
a << {"thumbnail_url"=>@image.file.thumb.url}
|
||||
end
|
||||
render :json=>a.to_json
|
||||
def destroy
|
||||
album = GalleryAlbum.find(params[:id])
|
||||
album.delete
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def upload_panel
|
||||
render :layout => false
|
||||
def edit
|
||||
if is_manager? || is_admin? || is_sub_manager?
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@images = @album.gallery_images.all
|
||||
@album_name = @album.name_translations
|
||||
@cover = @album.cover
|
||||
@tags = GalleryTag.all
|
||||
end
|
||||
end
|
||||
|
||||
def set_cover
|
||||
album = GalleryAlbum.find(params[:album_id])
|
||||
image = GalleryImage.find(params[:imageid])
|
||||
album.update_attributes({:cover_path => image.file.thumb.url, :cover=>params[:imageid]})
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def get_images
|
||||
@album = GalleryAlbum.find(params["aid"])
|
||||
@album = GalleryAlbum.find(params[:album_id])
|
||||
@tag_names = Array.new
|
||||
@images = @album.gallery_images.all
|
||||
@output = Array.new
|
||||
|
@ -151,96 +144,21 @@ include AdminHelper
|
|||
render :json=>{"images" => @output, "tags" => @album.tag_ids, "tag_names" => @tag_names}.to_json
|
||||
end
|
||||
end
|
||||
|
||||
def theater
|
||||
picid = params["pic"]
|
||||
@image = GalleryImage.find(picid)
|
||||
@albumid = @image.gallery_album_id
|
||||
album = GalleryAlbum.find(@albumid)
|
||||
@images = album.gallery_images.all
|
||||
render :layout=>false
|
||||
end
|
||||
|
||||
def delete_album
|
||||
aid = params['aid']
|
||||
album = GalleryAlbum.find(aid)
|
||||
album.delete
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def edit_album
|
||||
if is_manager? || is_admin? || is_sub_manager?
|
||||
aid = params['aid']
|
||||
album = GalleryAlbum.find(aid)
|
||||
@images = album.gallery_images.all
|
||||
@album_name = album.name_translations
|
||||
@cover = album.cover
|
||||
def upload_panel
|
||||
@album = GalleryAlbum.find(params[:album_id])
|
||||
render :layout => false
|
||||
end
|
||||
def upload_image
|
||||
@album = GalleryAlbum.find(params[:album_id])
|
||||
@files = params['files']
|
||||
a = Array.new
|
||||
@files.each do |file|
|
||||
@image = @album.gallery_images.new
|
||||
@image.file = file
|
||||
@image.save!
|
||||
a << {"thumbnail_url"=>@image.file.thumb.url}
|
||||
end
|
||||
|
||||
def set_cover
|
||||
aid = params['aid']
|
||||
album = GalleryAlbum.find(aid)
|
||||
image = GalleryImage.find(params[:imageid])
|
||||
album.update_attributes({:cover_path => image.file.thumb.url, :cover=>params[:imageid]})
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def delete_images
|
||||
images = params['images']
|
||||
images.each do |image|
|
||||
img = GalleryImage.find(image)
|
||||
img.delete
|
||||
end
|
||||
if params['delete_cover'] == "true"
|
||||
album = GalleryAlbum.find(params['aid'])
|
||||
album.update_attributes(:cover=>"default")
|
||||
end
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def update_album
|
||||
# data = params['data']
|
||||
# album_name = params['name']
|
||||
# aid = params['aid']
|
||||
# data.each do |d|
|
||||
# image = GalleryImage.find(d[1][:id])
|
||||
# image.update_attributes(:description=>d[1][:text])
|
||||
# end
|
||||
# album = GalleryAlbum.find(aid)
|
||||
# album.update_attributes(:name => album_name)
|
||||
album_names = params[:albumnm]
|
||||
data = params[:data]
|
||||
aid =params[:aid]
|
||||
debugger
|
||||
data.each do |d|
|
||||
image = GalleryImage.find(d[1][:id])
|
||||
@site_valid_locales.each do |locale|
|
||||
image.description_translations[locale] = d[1][:text][locale]
|
||||
end
|
||||
image.save!
|
||||
end
|
||||
|
||||
album = GalleryAlbum.find(aid)
|
||||
|
||||
@site_valid_locales.each_with_index do |locale,i|
|
||||
album.name_translations[locale] = album_names[i]
|
||||
end
|
||||
album.save!
|
||||
|
||||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def save_tags
|
||||
case params[:tag]
|
||||
when "album"
|
||||
@object = GalleryAlbum.find(params[:id])
|
||||
when "pic"
|
||||
@object = GalleryImage.find(params[:id])
|
||||
end
|
||||
@object.update_attributes({:tag_ids => params[:tids]})
|
||||
render :json => {"success"=> "true"}.to_json
|
||||
render :json=>a.to_json
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
class Panel::Gallery::BackEnd::GalleryCategoriesController < OrbitBackendController
|
||||
|
||||
def index
|
||||
@categorylist = GalleryCategory.all
|
||||
#render :layout => false
|
||||
end
|
||||
|
||||
def new
|
||||
names = params['category']
|
||||
category = GalleryCategory.new
|
||||
I18n.locale = :en
|
||||
category.name = names['en']
|
||||
I18n.locale = :zh_tw
|
||||
category.name = names['zh_tw']
|
||||
category.save!
|
||||
render :json=>{"success"=>true,"id"=>category.id}.to_json
|
||||
end
|
||||
|
||||
def delete
|
||||
@category = GalleryCategory.find(params['id'])
|
||||
@category.delete
|
||||
render :json=>{"success"=>"true"}.to_json
|
||||
end
|
||||
|
||||
end
|
|
@ -8,7 +8,8 @@
|
|||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<form id="edit_album" action="update_album" method="post">
|
||||
<!-- <form id="edit_album" action="update_album" method="post"> -->
|
||||
<%= form_for @album, :url => panel_gallery_back_end_orbit_gallery_path(@album), :html => {:class => 'clear'} do |f| %>
|
||||
<div class="tab_content">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<% if i == 0 %>
|
||||
|
@ -27,7 +28,12 @@
|
|||
<div class="rgphoto_edit <%= locale %>">
|
||||
<a href="orbit_gallery?theater=<%= image.id %>"><img src="<%= image.file.thumb.url %>"></a>
|
||||
<div class="inputui rginput rgih98 w380">
|
||||
<textarea name="gallery_album_gallery_images_attributes[<%= x %>][description_translations][<%= locale %>]" class="txtchange" for="<%= image.id %>"><%= image.description_translations[locale] rescue nil %></textarea>
|
||||
<!-- <textarea name="gallery_album[gallery_images_attributes][<%= x %>][description_translations][<%= locale %>]" class="txtchange" for="<%= image.id %>"><%#= image.description_translations[locale] rescue nil %></textarea> -->
|
||||
<%= f.fields_for :gallery_images do |j| %>
|
||||
<%= j.fields_for :description_translations do |desc| %>
|
||||
<%= desc.text_area locale, :value => (image.description_translations[locale]) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="edit_fn">
|
||||
<% if image.id.to_s == @cover %>
|
||||
|
@ -44,7 +50,11 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<input type="submit" value="Submit" />
|
||||
</form>
|
||||
<!-- </form> -->
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
$("form#edit_album input[name=authenticity_token]").val($('meta[name="csrf-token"]').attr("content"));
|
||||
</script>
|
||||
|
||||
<!-- <div class="tab-pane in active">
|
||||
<div class="albumname_edit">
|
95
vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/index.html.erb
vendored
Normal file
95
vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/index.html.erb
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
|
||||
<%= stylesheet_link_tag "gallery" %>
|
||||
|
||||
<div id="orbit_gallery" class="rg">
|
||||
<div class="rgbody">
|
||||
<div id="imgholder">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- tag part -->
|
||||
<div id="tag_panel" class="my_scroll">
|
||||
<div class="scrollbar">
|
||||
<div class="track">
|
||||
<div class="thumb">
|
||||
<div class="end"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
@locales = Array.new
|
||||
@site_valid_locales.each do |locale|
|
||||
@locales << locale
|
||||
end
|
||||
%>
|
||||
<div class="viewport">
|
||||
<div class="overview">
|
||||
<ul class="tag_list" id="gallery_tag_list">
|
||||
<% if @authenticated %>
|
||||
<% @tags.each do |tag| %>
|
||||
<li data-content="<%= tag.id %>"><input id="tag_<%= tag.id %>" type="checkbox"><label for="tag_<%= tag.id %>"><%= tag[I18n.locale] %></label><span style="display:none;"><%= tag[@locales[1]] %> <%= tag[@locales[0]] %></span></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% if @authenticated %>
|
||||
<div class="tag_search"><div class="icon-search"></div><input type="text" value="<%= t('gallery.search_tags') %>" onblur="if(this.value=='')this.value='<%= t('gallery.search_tags') %>';" onfocus="if(this.value=='<%= t("gallery.search_tags") %>')this.value='';" id="tag_search_box"> <div class="tag_save"><a class="btn bt-save"><i class="icon-ok"></i><%= I18n.t("gallery.save") %></a></div></div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var $tag_panel = $('#tag_panel');
|
||||
orbit_bar_height = $('#orbit-bar').outerHeight();
|
||||
action_panel_height = $('.form-actions').outerHeight();
|
||||
window_height = $(window).height();
|
||||
|
||||
|
||||
$tag_panel.height( window_height - orbit_bar_height - 90 );
|
||||
$tag_panel.tinyscrollbar();
|
||||
|
||||
$(window).resize(function(){
|
||||
$tag_panel.tinyscrollbar_update('relative');
|
||||
$tag_panel.height( $(window).height() - orbit_bar_height - 90 );
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
<!-- tag end -->
|
||||
<div class="form-actions form-fixed pagination-right rghead">
|
||||
<div class="rgfn">
|
||||
<% if params[:theater] %>
|
||||
<a href="" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a>
|
||||
<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>
|
||||
<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.photo_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.photo_tag") %></a>
|
||||
<% else %>
|
||||
<a class="bt-back btn btn-primary pull-left" title="<%= I18n.t("gallery.back_to_albums") %>" href="albums"><i class="icon-arrow-left icon-white"></i><%= I18n.t("gallery.back_to_albums") %></a>
|
||||
<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.album_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.album_tag") %></ a>
|
||||
<% if @authenticated %>
|
||||
<a class="bt-add btn btn-primary pull-right" title="<%= I18n.t("gallery.add_images") %>" href="images" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_images") %></a>
|
||||
<a class="bt-del btn btn-primary pull-right" title="<%= I18n.t("gallery.del_album") %>" href="delete" onclick="return false;"><i class="icon-trash icon-white"></i><%= I18n.t("gallery.del_album") %></a>
|
||||
<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="albums/<%= params[:album] %>/edit" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "galleryAPI" %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||
var gallery = new galleryAPI();
|
||||
gallery.initialize();
|
||||
//gallery.loadAlbums(gallery.urlVars['cat']);
|
||||
gallery.loadArea = "images";
|
||||
gallery.loadImages("<%= params[:id] %>");
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
94
vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/show.html.erb
vendored
Normal file
94
vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/show.html.erb
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
|
||||
<%= stylesheet_link_tag "gallery" %>
|
||||
|
||||
<div id="orbit_gallery" class="rg">
|
||||
<div class="rgbody">
|
||||
<div id="imgholder">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- tag part -->
|
||||
<div id="tag_panel" class="my_scroll">
|
||||
<div class="scrollbar">
|
||||
<div class="track">
|
||||
<div class="thumb">
|
||||
<div class="end"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
@locales = Array.new
|
||||
@site_valid_locales.each do |locale|
|
||||
@locales << locale
|
||||
end
|
||||
%>
|
||||
<div class="viewport">
|
||||
<div class="overview">
|
||||
<ul class="tag_list" id="gallery_tag_list">
|
||||
<% if @authenticated %>
|
||||
<% @tags.each do |tag| %>
|
||||
<li data-content="<%= tag.id %>"><input id="tag_<%= tag.id %>" type="checkbox"><label for="tag_<%= tag.id %>"><%= tag[I18n.locale] %></label><span style="display:none;"><%= tag[@locales[1]] %> <%= tag[@locales[0]] %></span></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% if @authenticated %>
|
||||
<div class="tag_search"><div class="icon-search"></div><input type="text" value="<%= t('gallery.search_tags') %>" onblur="if(this.value=='')this.value='<%= t('gallery.search_tags') %>';" onfocus="if(this.value=='<%= t("gallery.search_tags") %>')this.value='';" id="tag_search_box"> <div class="tag_save"><a class="btn bt-save"><i class="icon-ok"></i><%= I18n.t("gallery.save") %></a></div></div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var $tag_panel = $('#tag_panel');
|
||||
orbit_bar_height = $('#orbit-bar').outerHeight();
|
||||
action_panel_height = $('.form-actions').outerHeight();
|
||||
window_height = $(window).height();
|
||||
|
||||
|
||||
$tag_panel.height( window_height - orbit_bar_height - 90 );
|
||||
$tag_panel.tinyscrollbar();
|
||||
|
||||
$(window).resize(function(){
|
||||
$tag_panel.tinyscrollbar_update('relative');
|
||||
$tag_panel.height( $(window).height() - orbit_bar_height - 90 );
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
<!-- tag end -->
|
||||
<div class="form-actions form-fixed pagination-right rghead">
|
||||
<div class="rgfn">
|
||||
<% if params[:theater] %>
|
||||
<a href="" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a>
|
||||
<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>
|
||||
<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.photo_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.photo_tag") %></a>
|
||||
<% else %>
|
||||
<a class="bt-back btn btn-primary pull-left" title="<%= I18n.t("gallery.back_to_albums") %>" href="albums"><i class="icon-arrow-left icon-white"></i><%= I18n.t("gallery.back_to_albums") %></a>
|
||||
<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.album_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.album_tag") %></ a>
|
||||
<% if @authenticated %>
|
||||
<a class="bt-add btn btn-primary pull-right" title="<%= I18n.t("gallery.add_images") %>" href="images" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_images") %></a>
|
||||
<a class="bt-del btn btn-primary pull-right" title="<%= I18n.t("gallery.del_album") %>" href="delete" onclick="return false;"><i class="icon-trash icon-white"></i><%= I18n.t("gallery.del_album") %></a>
|
||||
<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="../albums/<%= params[:id] %>/edit" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "galleryAPI" %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||
var gallery = new galleryAPI();
|
||||
gallery.initialize();
|
||||
gallery.loadArea = "images";
|
||||
gallery.loadImages("<%= params[:id] %>");
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
111
vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/upload_panel.html.erb
vendored
Executable file
111
vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/upload_panel.html.erb
vendored
Executable file
|
@ -0,0 +1,111 @@
|
|||
<html>
|
||||
<head>
|
||||
<%= csrf_meta_tag %>
|
||||
<%= javascript_include_tag "jquery-latest" %>
|
||||
<%= stylesheet_link_tag "jquery-ui" %>
|
||||
<%= stylesheet_link_tag "jquery.fileupload-ui.css" %>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id='scroller_for_panel'>
|
||||
<div id="fileupload">
|
||||
<%= form_for @album, :url => panel_gallery_back_end_album_path(@album), :html => {:class => 'clear'} do |f| %>
|
||||
|
||||
<!-- <form action="upload_image" method="POST" enctype="multipart/form-data"> -->
|
||||
<div class="fileupload-buttonbar">
|
||||
<label class="fileinput-button">
|
||||
<span>Add files...</span>
|
||||
<input type="file" name="files[]" multiple>
|
||||
</label>
|
||||
<!-- <input type="hidden" value="" name="aid" id="fileupload_aid" /> -->
|
||||
<button type="submit" class="start">Start upload</button>
|
||||
<button type="reset" class="cancel">Cancel upload</button>
|
||||
<!-- <button type="button" class="delete">Delete files</button>-->
|
||||
</div>
|
||||
<!-- </form> -->
|
||||
<% end %>
|
||||
<div class="fileupload-content">
|
||||
<table class="files"></table>
|
||||
<div class="fileupload-progressbar"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script id="template-upload" type="text/x-jquery-tmpl">
|
||||
<tr class="template-upload{{if error}} ui-state-error{{/if}}">
|
||||
<td class="preview"></td>
|
||||
<td class="name">{{if name}}${name}{{else}}Untitled{{/if}}</td>
|
||||
<td class="size">${sizef}</td>
|
||||
{{if error}}
|
||||
<td class="error" colspan="2">Error:
|
||||
{{if error === 'maxFileSize'}}File is too big
|
||||
{{else error === 'minFileSize'}}File is too small
|
||||
{{else error === 'acceptFileTypes'}}Filetype not allowed
|
||||
{{else error === 'maxNumberOfFiles'}}Max number of files exceeded
|
||||
{{else}}${error}
|
||||
{{/if}}
|
||||
</td>
|
||||
{{else}}
|
||||
<td class="progress"><div></div></td>
|
||||
<td class="start"><button>Start</button></td>
|
||||
{{/if}}
|
||||
<td class="cancel"><button>Cancel</button></td>
|
||||
</tr>
|
||||
</script>
|
||||
<script id="template-download" type="text/x-jquery-tmpl">
|
||||
<tr class="template-download{{if error}} ui-state-error{{/if}}">
|
||||
{{if error}}
|
||||
<td></td>
|
||||
<td class="name">${name}</td>
|
||||
<td class="size">${sizef}</td>
|
||||
<td class="error" colspan="2">Error:
|
||||
{{if error === 1}}File exceeds upload_max_filesize (php.ini directive)
|
||||
{{else error === 2}}File exceeds MAX_FILE_SIZE (HTML form directive)
|
||||
{{else error === 3}}File was only partially uploaded
|
||||
{{else error === 4}}No File was uploaded
|
||||
{{else error === 5}}Missing a temporary folder
|
||||
{{else error === 6}}Failed to write file to disk
|
||||
{{else error === 7}}File upload stopped by extension
|
||||
{{else error === 'maxFileSize'}}File is too big
|
||||
{{else error === 'minFileSize'}}File is too small
|
||||
{{else error === 'acceptFileTypes'}}Filetype not allowed
|
||||
{{else error === 'maxNumberOfFiles'}}Max number of files exceeded
|
||||
{{else error === 'uploadedBytes'}}Uploaded bytes exceed file size
|
||||
{{else error === 'emptyResult'}}Empty file upload result
|
||||
{{else}}${error}
|
||||
{{/if}}
|
||||
</td>
|
||||
{{else}}
|
||||
<td class="preview">
|
||||
{{if thumbnail_url}}
|
||||
<a href="${url}" target="_blank"><img src="${thumbnail_url}"></a>
|
||||
{{/if}}
|
||||
</td>
|
||||
<td class="name">
|
||||
<a href="${url}"{{if thumbnail_url}} target="_blank"{{/if}}>${name}</a>
|
||||
</td>
|
||||
<td class="size">${sizef}</td>
|
||||
<td colspan="2"></td>
|
||||
{{/if}}
|
||||
|
||||
</tr>
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$("input#fileupload_aid").val(parent.g.urlVars['album']);
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<%= javascript_include_tag "jquery-ui.min" %>
|
||||
<%= javascript_include_tag "jquery.tmpl.min" %>
|
||||
<%= javascript_include_tag "jquery.iframe-transport" %>
|
||||
<%= javascript_include_tag "jquery.fileupload" %>
|
||||
<%= javascript_include_tag "jquery.fileupload-ui" %>
|
||||
<%= javascript_include_tag "upload" %>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<!-- <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
|
||||
<script src="//ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
|
||||
<script src="../../js/gallery/jquery.iframe-transport.js"></script>
|
||||
<script src="../../js/gallery/jquery.fileupload.js"></script>
|
||||
<script src="../../js/gallery/jquery.fileupload-ui.js"></script>
|
||||
<script src="../../js/gallery/upload.js"></script> -->
|
126
vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/edit.html.erb
vendored
Normal file
126
vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/edit.html.erb
vendored
Normal file
|
@ -0,0 +1,126 @@
|
|||
<%= stylesheet_link_tag "gallery" %>
|
||||
<div id="orbit_gallery" class="rg">
|
||||
<div class="rgbody">
|
||||
<div id="imgholder">
|
||||
<ul class="breadcrumb">
|
||||
<li><span>Home</span><span class="divider">/</span></li>
|
||||
<li><span><%= t('admin.orbit_gallery') %></span><span class="divider">/</span></li>
|
||||
<li class="text-blue"><%= t('gallery.edit') %></li>
|
||||
</ul>
|
||||
<ul class="nav nav-tabs">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<li <%= ( i == 0 ) ? " class='active'" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<!-- <form id="edit_album" action="update_album" method="post"> -->
|
||||
<%= form_for @album, :url => panel_gallery_back_end_albums_path(@album), :html => {:class => 'clear'} do |f| %>
|
||||
<div class="tab_content">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<% if i == 0 %>
|
||||
<div class="<%= locale %> fade tab-pane in active">
|
||||
<% else %>
|
||||
<div class="<%= locale %> fade tab-pane" >
|
||||
<% end %>
|
||||
|
||||
<div class="albumname_edit">
|
||||
<label for=""><%= t("gallery.album_name") %></label>
|
||||
<div class="inputui rginput rgih26 w380"><input type="text" name="gallery_album[name_translations][<%= locale %>]" value="<%= @album_name[locale] %>" class="txtchange" /></div>
|
||||
</div>
|
||||
|
||||
<div class='description_loader'>
|
||||
<% @images.each_with_index do |image,x| %>
|
||||
<div class="rgphoto_edit <%= locale %>" data-content="<%= image.id %>">
|
||||
<a href="orbit_gallery?theater=<%= image.id %>"><img src="<%= image.file.thumb.url %>"></a>
|
||||
<div class="inputui rginput rgih98 w380">
|
||||
<!-- <textarea name="gallery_album[gallery_images_attributes][<%= x %>][description_translations][<%= locale %>]" class="txtchange" for="<%= image.id %>"><%#= image.description_translations[locale] rescue nil %></textarea> -->
|
||||
<%= f.fields_for :gallery_images do |j| %>
|
||||
<%= j.fields_for :description_translations do |desc| %>
|
||||
<%= desc.text_area locale, :value => (image.description_translations[locale] rescue nil ), :class => "txtchange" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="edit_fn">
|
||||
<% if image.id.to_s == @cover %>
|
||||
<a class="btn btn-primary rgbtsg bt-cover setcover active" onclick="return false;" title="<%= t("gallery.cover") %>" href="set_cover" for="<%= image.id %>"><span class="icon-star icon-white"></span></a>
|
||||
<% else %>
|
||||
<a class="btn rgbtsg bt-cover" onclick="return false;" title="<%= t("gallery.set_cover") %>" href="set_cover" for="<%= image.id %>"><span class="icon-star-empty"></span></a>
|
||||
<% end %>
|
||||
<a class="btn rgbtsg bt-tag" onclick="return false;" title="<%= t("gallery.photo_tag") %>" href="<%= image.id %>"><span class="icon-tags"></span></a>
|
||||
<a class="btn rgbtsg bt-dels" onclick="return false;" title="<%= t("gallery.delete") %>" href="<%= image.id %>"><span class="icon-trash"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="form-actions form-fixed pagination-right rghead">
|
||||
<div class="rgfn">
|
||||
<a href="../<%= params[:id] %>" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a>
|
||||
<a class="bt-del bt-delete btn btn-primary pull-right" onclick="return false;" style="display:none;" title="<%= I18n.t("gallery.delete_selected") %>" href="<%= panel_gallery_back_end_album_images_path %>"><i class="icon-trash icon-white"></i><%= I18n.t("gallery.delete_selected") %></a>
|
||||
<input type="submit" class="bt-save icon-ok btn btn-primary pull-right" style="display:none;" value="Save" /><i class="icon-ok icon-white"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </form> -->
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
$("form#edit_album input[name=authenticity_token]").val($('meta[name="csrf-token"]').attr("content"));
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<!-- tag part -->
|
||||
<div id="tag_panel" class="my_scroll">
|
||||
<div class="scrollbar">
|
||||
<div class="track">
|
||||
<div class="thumb">
|
||||
<div class="end"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
@locales = Array.new
|
||||
@site_valid_locales.each do |locale|
|
||||
@locales << locale
|
||||
end
|
||||
%>
|
||||
<div class="viewport">
|
||||
<div class="overview">
|
||||
<ul class="tag_list" id="gallery_tag_list">
|
||||
<% @tags.each do |tag| %>
|
||||
<li data-content="<%= tag.id %>"><input id="tag_<%= tag.id %>" type="checkbox"><label for="tag_<%= tag.id %>"><%= tag[I18n.locale] %></label><span style="display:none;"><%= tag[@locales[1]] %> <%= tag[@locales[0]] %></span></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tag_search"><div class="icon-search"></div><input type="text" value="<%= t('gallery.search_tags') %>" onblur="if(this.value=='')this.value='<%= t('gallery.search_tags') %>';" onfocus="if(this.value=='<%= t("gallery.search_tags") %>')this.value='';" id="tag_search_box"> <div class="tag_save"><a class="btn bt-save"><i class="icon-ok"></i><%= I18n.t("gallery.save") %></a></div></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var $tag_panel = $('#tag_panel');
|
||||
orbit_bar_height = $('#orbit-bar').outerHeight();
|
||||
action_panel_height = $('.form-actions').outerHeight();
|
||||
window_height = $(window).height();
|
||||
|
||||
$tag_panel.height( window_height - orbit_bar_height - 90 );
|
||||
$tag_panel.tinyscrollbar();
|
||||
|
||||
$(window).resize(function(){
|
||||
$tag_panel.tinyscrollbar_update('relative');
|
||||
$tag_panel.height( $(window).height() - orbit_bar_height - 90 );
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
<!-- tag end -->
|
||||
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "galleryAPI" %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||
var gallery = new galleryAPI();
|
||||
gallery.initialize();
|
||||
gallery.editAlbum("<%= params[:id] %>");
|
||||
</script>
|
|
@ -37,31 +37,8 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <table id="gallery_list" class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span1"></th>
|
||||
<th class="span2"></th>
|
||||
<th class="span2"></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_gallery" class="sort-holder">
|
||||
<tr>
|
||||
<td class="span1"></td>
|
||||
<td class="span2"></td>
|
||||
<td class="span2"></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table> -->
|
||||
|
||||
<div id="orbit_gallery" class="rg">
|
||||
<!-- <div class="rghead">
|
||||
<div class="rgfn">
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="rgbody">
|
||||
<div id="imgholder">
|
||||
|
||||
|
@ -119,35 +96,12 @@
|
|||
<!-- tag end -->
|
||||
<div class="form-actions form-fixed pagination-right rghead">
|
||||
<div class="rgfn">
|
||||
<!-- <a href="" class="btn btn-primary pull-right"><i class="icon-plus icon-white"></i>新增</a> -->
|
||||
<% if @authenticated %>
|
||||
<a class="btn btn-primary pull-right" title="<%= I18n.t("gallery.add_album") %>" href="albums" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_album") %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
galleryAPI.prototype.loadFooterPanel = function(area,id,callbackFn){
|
||||
var headarea = null;
|
||||
if(area == "images"){
|
||||
headarea = '<a class="bt-back btn btn-primary pull-left" title="<%= I18n.t("gallery.back_to_albums") %>" href="orbit_gallery"><i class="icon-arrow-left icon-white"></i><%= I18n.t("gallery.back_to_albums") %></a> ';
|
||||
headarea+='<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.album_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.album_tag") %></a>';
|
||||
<% if @authenticated %>
|
||||
headarea+='<a class="bt-add btn btn-primary pull-right" title="<%= I18n.t("gallery.add_images") %>" href="images" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_images") %></a> ';
|
||||
headarea+='<a class="bt-del btn btn-primary pull-right" title="<%= I18n.t("gallery.del_album") %>" href="delete" onclick="return false;"><i class="icon-trash icon-white"></i><%= I18n.t("gallery.del_album") %></a> ';
|
||||
headarea+='<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="orbit_gallery?edit='+id+'" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>';
|
||||
<% end %>
|
||||
}else if(area == "albums"){
|
||||
<% if @authenticated %>
|
||||
headarea = '<a class="btn btn-primary pull-right" title="<%= I18n.t("gallery.add_album") %>" href="albums" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_album") %></a>';
|
||||
<% end %>
|
||||
}else if (area == "theater"){
|
||||
headarea = '<a href="" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a></div>';
|
||||
headarea+= '<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>';
|
||||
headarea+= '<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.photo_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.photo_tag") %></a>';
|
||||
}
|
||||
if(typeof callbackFn == "function"){
|
||||
callbackFn.call(this,headarea);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "galleryAPI" %>
|
||||
<% end %>
|
||||
|
@ -156,6 +110,13 @@ galleryAPI.prototype.loadFooterPanel = function(area,id,callbackFn){
|
|||
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||
var gallery = new galleryAPI();
|
||||
gallery.initialize();
|
||||
if(typeof gallery.urlVars['cat']!= "undefined"){
|
||||
gallery.loadArea = "albums";
|
||||
gallery.loadAlbums(gallery.urlVars['cat']);
|
||||
}else{
|
||||
gallery.loadArea = "albums";
|
||||
g.loadAlbums("all");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
94
vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/show.html.erb
vendored
Normal file
94
vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/albums/show.html.erb
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
|
||||
<%= stylesheet_link_tag "gallery" %>
|
||||
|
||||
<div id="orbit_gallery" class="rg">
|
||||
<div class="rgbody">
|
||||
<div id="imgholder">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- tag part -->
|
||||
<div id="tag_panel" class="my_scroll">
|
||||
<div class="scrollbar">
|
||||
<div class="track">
|
||||
<div class="thumb">
|
||||
<div class="end"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
@locales = Array.new
|
||||
@site_valid_locales.each do |locale|
|
||||
@locales << locale
|
||||
end
|
||||
%>
|
||||
<div class="viewport">
|
||||
<div class="overview">
|
||||
<ul class="tag_list" id="gallery_tag_list">
|
||||
<% if @authenticated %>
|
||||
<% @tags.each do |tag| %>
|
||||
<li data-content="<%= tag.id %>"><input id="tag_<%= tag.id %>" type="checkbox"><label for="tag_<%= tag.id %>"><%= tag[I18n.locale] %></label><span style="display:none;"><%= tag[@locales[1]] %> <%= tag[@locales[0]] %></span></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<% if @authenticated %>
|
||||
<div class="tag_search"><div class="icon-search"></div><input type="text" value="<%= t('gallery.search_tags') %>" onblur="if(this.value=='')this.value='<%= t('gallery.search_tags') %>';" onfocus="if(this.value=='<%= t("gallery.search_tags") %>')this.value='';" id="tag_search_box"> <div class="tag_save"><a class="btn bt-save"><i class="icon-ok"></i><%= I18n.t("gallery.save") %></a></div></div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
var $tag_panel = $('#tag_panel');
|
||||
orbit_bar_height = $('#orbit-bar').outerHeight();
|
||||
action_panel_height = $('.form-actions').outerHeight();
|
||||
window_height = $(window).height();
|
||||
|
||||
|
||||
$tag_panel.height( window_height - orbit_bar_height - 90 );
|
||||
$tag_panel.tinyscrollbar();
|
||||
|
||||
$(window).resize(function(){
|
||||
$tag_panel.tinyscrollbar_update('relative');
|
||||
$tag_panel.height( $(window).height() - orbit_bar_height - 90 );
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
<!-- tag end -->
|
||||
<div class="form-actions form-fixed pagination-right rghead">
|
||||
<div class="rgfn">
|
||||
<% if params[:theater] %>
|
||||
<a href="" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a>
|
||||
<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>
|
||||
<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.photo_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.photo_tag") %></a>
|
||||
<% else %>
|
||||
<a class="bt-back btn btn-primary pull-left" title="<%= I18n.t("gallery.back_to_albums") %>" href="../albums"><i class="icon-arrow-left icon-white"></i><%= I18n.t("gallery.back_to_albums") %></a>
|
||||
<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.album_tag") %>" href="" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.album_tag") %></ a>
|
||||
<% if @authenticated %>
|
||||
<a class="bt-add btn btn-primary pull-right" title="<%= I18n.t("gallery.add_images") %>" href="images" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_images") %></a>
|
||||
<a class="bt-del btn btn-primary pull-right" title="<%= I18n.t("gallery.del_album") %>" href="delete" onclick="return false;"><i class="icon-trash icon-white"></i><%= I18n.t("gallery.del_album") %></a>
|
||||
<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="<%= params[:id] %>/edit" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "galleryAPI" %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||
var gallery = new galleryAPI();
|
||||
gallery.initialize();
|
||||
gallery.loadArea = "images";
|
||||
gallery.loadImages("<%= params[:id] %>");
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -9,18 +9,19 @@
|
|||
<body>
|
||||
<div id='scroller_for_panel'>
|
||||
<div id="fileupload">
|
||||
<form action="upload_image" method="POST" enctype="multipart/form-data">
|
||||
<%= form_for @album, :url => panel_gallery_back_end_upload_image_path(@album), :html => {:class => 'clear'} do |f| %>
|
||||
<div class="fileupload-buttonbar">
|
||||
<label class="fileinput-button">
|
||||
<span>Add files...</span>
|
||||
<input type="file" name="files[]" multiple>
|
||||
</label>
|
||||
<input type="hidden" value="" name="aid" id="fileupload_aid" />
|
||||
<input type="hidden" value="<%= params[:album_id] %>" name="album_id" id="fileupload_aid" />
|
||||
<button type="submit" class="start">Start upload</button>
|
||||
<button type="reset" class="cancel">Cancel upload</button>
|
||||
<!-- <button type="button" class="delete">Delete files</button>-->
|
||||
</div>
|
||||
</form>
|
||||
<!-- </form> -->
|
||||
<% end %>
|
||||
<div class="fileupload-content">
|
||||
<table class="files"></table>
|
||||
<div class="fileupload-progressbar"></div>
|
||||
|
@ -85,9 +86,7 @@
|
|||
|
||||
</tr>
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$("input#fileupload_aid").val(parent.g.urlVars['album']);
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
<%= javascript_include_tag "jquery-ui.min" %>
|
|
@ -2,23 +2,37 @@ Rails.application.routes.draw do
|
|||
namespace :panel do
|
||||
namespace :gallery do
|
||||
namespace :back_end do
|
||||
match "orbit_gallery" => "orbit_galleries#index"
|
||||
match "gallery_category_save" => "orbit_galleries#new_category"
|
||||
match "categorylist" => "orbit_galleries#categorylist"
|
||||
match "gallery_category_delete" => "orbit_galleries#gallery_category_delete"
|
||||
match "add_album" => "orbit_galleries#add_album"
|
||||
match "create_album" => "orbit_galleries#create_album"
|
||||
match "get_albums" => "orbit_galleries#get_albums"
|
||||
match "upload_image" => "orbit_galleries#upload_image"
|
||||
match "upload_panel" => "orbit_galleries#upload_panel"
|
||||
match "get_images" => "orbit_galleries#get_images"
|
||||
match "theater" => "orbit_galleries#theater"
|
||||
match "delete_album" => "orbit_galleries#delete_album"
|
||||
match "edit_album" => "orbit_galleries#edit_album"
|
||||
match "set_cover" => "orbit_galleries#set_cover"
|
||||
match "delete_images" => "orbit_galleries#delete_images"
|
||||
match "update_album" => "orbit_galleries#update_album"
|
||||
match "save_tags" => "orbit_galleries#save_tags"
|
||||
# match "orbit_gallery" => "orbit_galleries#index"
|
||||
|
||||
# match "add_album" => "orbit_galleries#add"
|
||||
# match "create_album" => "orbit_galleries#create_album"
|
||||
match "get_albums" => "albums#get_albums"
|
||||
match "upload_image" => "albums#upload_image"
|
||||
match "get_images" => "album_images#get_images"
|
||||
match "theater" => "album_images#theater"
|
||||
# match "delete_album" => "orbit_galleries#delete"
|
||||
# match "edit_album" => "orbit_galleries#edit"
|
||||
#match "set_cover" => "albums#set_cover"
|
||||
# match "delete_images" => "orbit_galleries#delete_images"
|
||||
# # match "update_album" => "orbit_galleries#update_album"
|
||||
match "save_tags" => "album_images#save_tags"
|
||||
|
||||
# match "categories" => "orbit_gallery_categories#index"
|
||||
# match "gallery_category_delete" => "orbit_gallery_categories#delete"
|
||||
# match "gallery_category_save" => "orbit_gallery_categories#new"
|
||||
|
||||
resources :albums do
|
||||
match "set_cover" => "albums#set_cover"
|
||||
match "get_images" => "albums#get_images"
|
||||
match "upload_panel" => "albums#upload_panel"
|
||||
|
||||
end
|
||||
resources :album_images do
|
||||
# match "delete" => "album_images#destroy"
|
||||
end
|
||||
|
||||
resources :gallery_categories
|
||||
|
||||
resources :tags
|
||||
end
|
||||
namespace :front_end do
|
||||
|
|
Loading…
Reference in New Issue