frontend update

This commit is contained in:
Harry Bomrah 2012-09-03 21:49:35 +08:00
parent 202d736a5d
commit 4a12c9d6fb
17 changed files with 854 additions and 372 deletions

View File

@ -34,8 +34,6 @@ var galleryAPI = function(){
window.location = url;
}
})
}
$("#filter .filter-clear a").click(function(){
var loc = window.location.href;
var url = null;
@ -53,29 +51,23 @@ var galleryAPI = function(){
window.location = url;
})
}
}
this.makeNewAlbum = function(path){
$.get(path,function(html){
rcom.modalWindow({loadHtml:html,width:400,height:320,"closeBtn":false},function(dom){
// dom.find("#album_name_save_btn").click(function(){
// var options ={
// cid : dom.find("select#category_list").val(),
// albumname : {
// "en" : dom.find("#name_en").val(),
// "zh_tw" : dom.find("#name_zh_tw").val()
// },
// albumdesc : {
// "en" : dom.find("#desc_en").val(),
// "zh_tw" : dom.find("#desc_zh_tw").val()
// }
// }
// if(options.cid){
// $.post("albums/create",options,function(response){
// if(g.loadArea == "albums")
// g.loadAlbums("all");
// rcom.modalWindowClose();
// })
// }
// })
$("form#new_gallery_album").submit(function(){
var validated = true;
$(this).find(".error").removeClass("error");
$(this).find(".validate").each(function(){
if(!$(this).val()){
validated = false;
$(this).parent().addClass("error");
}
})
if(!validated)
return false;
})
dom.find("#album_name_close_btn").click(function(){
rcom.modalWindowClose();
})
@ -103,6 +95,7 @@ var galleryAPI = function(){
var cids = [];
var tids = [];
var href = null;
console.log(cids);
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
@ -123,6 +116,7 @@ var galleryAPI = function(){
$.getJSON("get_albums",{cid:cids,tid:tids},function(categories){
$.each(categories,function(x,category){
$.each(category,function(i,album){
album.description = (album.description?album.description:"<%= I18n.t('gallery.no_description') %>")
if(album.cover == "default")
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='../../../assets/gallery/default.jpg' /></a><span class='albumname'>"+album.name+"</span><span class='categoryname'>"+album.category_name+"</span><span class='tagnames'></span></div>");
else
@ -203,6 +197,7 @@ var galleryAPI = function(){
$.getJSON(id+"/imgs",function(album){
$.each(album.images,function(i,image){
var thumb = image.file.thumb.url;
image.description = (image.description?image.description:"<%= I18n.t('gallery.no_description') %>")
var $img = $("<div class='rgphoto'><a title='"+image.description+"' href='"+image.theater_link+"'><img src='"+thumb+"'/></a></div>");
g.albumArea.find("#imgholder").append($img);
})
@ -473,8 +468,8 @@ var galleryAPI = function(){
$(".description_loader .edit_fn .bt-cover").click(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");
$(this).addClass("setcover active btn-primary");
$(this).find("span").removeClass("icon-star-empty").addClass("icon-white icon-star");
$.post("set_cover",{"imageid":$(this).attr("for")});
})
$(".description_loader .edit_fn .bt-dels").click(function(){
@ -573,38 +568,37 @@ var galleryAPI = function(){
if($(this).val() != tempval)
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("for");
$(".description_loader .edit_fn .bt-dels").each(function(){
if($(this).hasClass("setdelete")){
images_to_delete.push($(this).attr("href"));
$(".tab_content .rgphoto_edit[data-content="+$(this).attr("href")+"]").each(function(){
doms_to_delete.push($(this));
})
if(thiscover == $(this).attr("href"))
delete_cover = true;
// 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("for");
// $(".description_loader .edit_fn .bt-dels").each(function(){
// if($(this).hasClass("setdelete")){
// images_to_delete.push($(this).attr("href"));
// $(".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)?")){
// $.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();
// }
// })
// }
// })
}
})
if(confirm("Deleting "+images_to_delete.length+" image(s)?")){
$.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();
}
})
}
})
}
$("#filter").remove();
g.albumArea.addClass('o_album_edit');
var imageTagArray = null;
$.getJSON("images_tags",function(data){

View File

@ -9,130 +9,26 @@ var galleryAPI = function(){
this.urlVars = rcom.getUrlVars();
this.albumArea = $("#orbit_gallery");
this.loadArea = null;
this.tagList = $("ul#gallery_tag_list");
this.tagList = $("ul#.tag_list");
// this.authenticated = false;
this.initialize = function(callbackFn){
$(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);
}
//bindHandlers();
})
var bindHandlers = function(){
$("#filter .filter_btns a").click(function(){
if(!$(this).hasClass("active")){
$(this).addClass("active");
if(g.urlVars.length == 0)
window.location = "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"),"");
if(url.charAt(url.length-1)=="&" || url.charAt(url.length-1)=="?")
url = url.substr(0,url.length-1);
window.location = url;
}
})
}
$("#filter .filter-clear a").click(function(){
var loc = window.location.href;
var url = null;
var forwhat = $(this).attr("for");
$("#filter ."+forwhat+" a.active").each(function(){
$(this).removeClass("active");
url = loc.replace($(this).attr("href")+"&","");
if(url == loc)
url = loc.replace($(this).attr("href"),"");
if(url.charAt(url.length-1)=="&" || url.charAt(url.length-1)=="?")
url = url.substr(0,url.length-1);
loc = url;
})
window.location = url;
})
}
this.makeNewAlbum = function(){
$.get("add_album",function(html){
rcom.modalWindow({loadHtml:html,width:400,height:320,"closeBtn":false},function(dom){
dom.find("#album_name_save_btn").click(function(){
var options ={
cid : dom.find("select#category_list").val(),
albumname : {
"en" : dom.find("#name_en").val(),
"zh_tw" : dom.find("#name_zh_tw").val()
},
albumdesc : {
"en" : dom.find("#desc_en").val(),
"zh_tw" : dom.find("#desc_zh_tw").val()
}
}
if(options.cid){
$.post("create_album",options,function(response){
if(g.loadArea == "albums")
g.loadAlbums("all");
rcom.modalWindowClose();
})
}
})
dom.find("#album_name_close_btn").click(function(){
rcom.modalWindowClose();
})
})
})
}
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").hide();
})
g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum($(this).attr("href"))});
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 = [];
var href = null;
console.log(cids);
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++){
hash = hashes[i].split('=');
@ -153,107 +49,35 @@ var galleryAPI = function(){
$.getJSON("panel/gallery/front_end/get_albums",{cid:cids,tid:tids,"inner":true},function(categories){
$.each(categories,function(x,category){
$.each(category,function(i,album){
album.description = (album.description?album.description:"<%= I18n.t('gallery.no_description') %>")
if(album.cover == "default")
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='?album="+album._id+"'><img src='../../../assets/gallery/default.jpg'/></a><span class='albumname'><a title='"+album.description+"' href='?album="+album._id+"'>"+album.name+"</a></span><span class='categoryname'><i class='icon-folder-close'></i> "+album.category_name+"</span><span class='tagnames'></span></div>");
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='../../../assets/gallery/default.jpg'/></a><span class='albumname'><a title='"+album.description+"' href='?album="+album._id+"'>"+album.name+"</a></span><span class='categoryname'><i class='icon-folder-close'></i> "+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+"'/></a><span class='albumname'><a title='"+album.description+"' href='?album="+album._id+"'>"+album.name+"</a></span><span class='categoryname'><i class='icon-folder-close'></i> "+album.category_name+"</span><span class='tagnames'></span></div>");
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><img src='"+album.cover_path+"'/></a><span class='albumname'><a title='"+album.description+"' href='?album="+album._id+"'>"+album.name+"</a></span><span class='categoryname'><i class='icon-folder-close'></i> "+album.category_name+"</span><span class='tagnames'></span></div>");
var tag_string = "";
for(tag in album.tag_names){
if(tag == album.tag_names.length-1)
tag_string+= '<span class="tags">' + album.tag_names[tag] + '</span>';
else
tag_string+= '<span class="tags">' + album.tag_names[tag] + ', </span>';
}
$img.find(".tagnames").html(tag_string);
g.albumArea.find("#imgholder").append($img);
})
})
// g.albumArea.find("#imgholder").append($addsign);
})
}
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'),
// tag_panel_position = 0;
// if( $tag_panel.css('right') == '0px' ){
// tag_panel_position = -200;
// }
// $tag_panel.animate({'right':tag_panel_position}, 300);
// g.albumArea
// .delay(200)
// .animate({'margin-right':tag_panel_position+200},300);
// return false;
// });
// g.albumArea.find("#tag_search_box").keyup(function(e){
// sval = $(this).val();
// if(sval == "<%= I18n.t('gallery.search_tags') %>")
// sval = "";
// sval = sval.replace(/(^\s*)|(\s*$)/g,'');
// if(sval){
// var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
// var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
// if ((re1.test(sval) && (re2.test(sval)))){
// $("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
// }else{
// $("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
// }
// }else{
// $("#gallery_tag_list li").slideDown();
// }
// })
// g.albumArea.find("#tag_panel .bt-save").click(function(){
// g.saveTags(id,g.loadArea);
// })
// g.albumArea.find(".rghead .rgfn .bt-add").click(function(){
// showUploadPanel();
// })
// g.albumArea.find(".rghead .rgfn .bt-del").click(function(){
// g.deleteAlbum(id);
// })
})
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>');
uploadpanel.find(".bt-cls").click(function(){
uploadpanel.hide("slide");
frame.remove();
g.loadImages(id);
panelopen = false;
})
var showUploadPanel = function(){
if(!panelopen){
uploadpanel.prepend(frame);
uploadpanel.show("slide");
panelopen = true;
}
}
g.albumArea.addClass('o_album');
// 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("panel/gallery/front_end/get_images",{aid:id,"inner":true},function(album){
$.getJSON("panel/gallery/front_end/albums/"+id+"/imgs",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>");
image.description = (image.description?image.description:"<%= I18n.t('gallery.no_description') %>")
var $img = $("<div class='rgphoto'><a title='"+image.description+"' href='"+image.theater_link+"'><img src='"+thumb+"'/></a></div>");
g.albumArea.find("#imgholder").append($img);
})
// g.tagList.find("input").attr("checked",false);
$.each(album.tags,function(i,tag){
// g.tagList.find("li[data-content="+tag+"] input").attr("checked",true);
})
// g.albumArea.find("#imgholder").append($addsign);
})
// g.albumArea.find("#imgholder").append($addsign);
// tag
}
this.loadTheater = function(id){
var imageArray;
@ -288,10 +112,24 @@ var galleryAPI = function(){
});
var updatePhotoTag = function(){
var tags = imageArray[imagecount].tag_ids;
if(tags.length > 0 && g.tagList.find("li").length == 0){
var tagnames = imageArray[imagecount].tag_names;
g.tagList.empty();
for(i in tagnames){
$li = $("<li><label>"+tagnames[i]+"</label><span style='display:none;'>"+tagnames[i]+"</span></li>");
g.tagList.append($li);
}
}else if(tags.length > 0 && g.tagList.find("li").length > 0) {
g.tagList.find("input").attr("checked",false);
for(tag in tags){
g.tagList.find("li[data-content="+tags[tag]+"] input").attr("checked",true);
}
}else if(tags.length == 0){
if(g.tagList.find("input").length == 0)
g.tagList.empty();
else
g.tagList.find("input").attr("checked",false);
}
}
g.albumArea.find("#tag_search_box").keyup(function(e){
sval = $(this).val();
@ -312,7 +150,9 @@ var galleryAPI = function(){
}
})
g.albumArea.find("#tag_panel .bt-save").click(function(){
g.saveTags(imageArray[imagecount]._id,g.loadArea);
g.saveTags(imageArray[imagecount]._id,"pic",function(tagids){
imageArray[imagecount].tag_ids = tagids;
})
})
$(".slidectrl a.togglelist").click(function(){
var rslide_h = $rslide.outerHeight();
@ -367,8 +207,14 @@ var galleryAPI = function(){
var el = document.documentElement,
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen;
rfs.call(el);
$rslide.addClass('browserFullScreen');
}
$(window).resize(function(){
if(window.innerWidth == screen.width && window.innerHeight == screen.height) {
$rslide.addClass('browserFullScreen');
} else {
$rslide.removeClass('browserFullScreen');
}
})
var nextpic = function(dom){
if(imagecount == imageArray.length - 1)
imagecount = 0;
@ -401,6 +247,7 @@ var galleryAPI = function(){
}
var changeImage = function(dom){
var pageurl = dom.attr('href');
$img.fadeOut(200,function(){
$img.attr({"src":dom.attr("data-content"),"height":picHeight+"px"});
$img.fadeIn(200);
@ -409,9 +256,13 @@ var galleryAPI = function(){
}
$slidelist.stop().animate({'height':'0px'}, 300);
$slidelist.find("ul").hide();
if(rcom.getInternetExplorerVersion() == -1){
if(pageurl!=window.location){
window.history.pushState({path:pageurl},'',pageurl);
}
}else{
window.location.hash = pageurl;
}
// $(".slideinfo b.info").text(imageArray[imagecount].title);
if($('.bt-tag').hasClass("active"))
updatePhotoTag();
@ -433,15 +284,15 @@ var galleryAPI = function(){
next = imagecount + 1;
prev = imagecount - 1;
}
$(".navN").attr({"href":"orbit_gallery?theater="+imageArray[next]._id,"data-content":imageArray[next].file.url});
$(".navP").attr({"href":"orbit_gallery?theater="+imageArray[prev]._id,"data-content":imageArray[prev].file.url});
$(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.url});
$(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.url});
};
if(imageArray.length > 1)
updateNavigation();
}
var preparestage = function(albumid){
$.getJSON("panel/gallery/front_end/get_images",{aid:albumid,"inner":true},function(album){
$.getJSON("../"+albumid+"/imgs",function(album){
imageArray = eval(album.images);
$.each(album.images,function(i,image){
if(image._id == id)
@ -450,25 +301,26 @@ var galleryAPI = function(){
bindHandlers();
})
}
g.albumArea.find("#imgholder").load("panel/gallery/front_end/theater?pic="+id+"&inner=true",function(theater,response,xhr){
if(xhr.status == 404){
$(this).text("<%= I18n.t('gallery.pic_not_found') %>.");
return false;
if(rcom.getInternetExplorerVersion()!=-1){
var url_constructor = window.location.href.split("/");
var url = "";
for(x=0;x<=url_constructor.length-1;x++){
if(x == url_constructor.length-1){
url+="#!/"+url_constructor[x];
}else{
url+=url_constructor[x]+"/";
}
}
$("#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","gallery?album="+albumid);
})
window.location.href = url;
}
var albumid = $("#main_pic").attr("data-content");
g.albumArea.find(".bt-back").attr("href","../albums/"+albumid);
g.albumArea.find(".bt-edit").attr("href","../albums/"+albumid+"/edit");
g.albumArea.css("margin-bottom","0");
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
preparestage(albumid);
});
}
this.editAlbum = function(id){

View File

@ -33,19 +33,8 @@ include AdminHelper
end
def create
# category = GalleryCategory.find(params['cid'])
# albumnames = params["albumname"]
# albumdescs = params["albumdesc"]
# album = category.gallery_albums.new
# I18n.locale = :en
# album.name = albumnames["en"]
# album.description = albumdescs["en"]
# I18n.locale = :zh_tw
# album.name = albumnames["zh_tw"]
# album.description = albumdescs["zh_tw"]
album = GalleryAlbum.new(params[:gallery_album])
album.save!
# render :json=>{"success"=>true,"id"=>album.id}.to_json
respond_to do |h|
h.js
end

View File

@ -0,0 +1,11 @@
class Panel::Gallery::FrontEnd::AlbumImagesController < OrbitWidgetController
def show
@tags = GalleryTag.all
@image = GalleryImage.find(params[:album_id])
@albumid = @image.gallery_album_id
@album = GalleryAlbum.find(@albumid)
@images = @album.gallery_images.all
end
end

View File

@ -0,0 +1,114 @@
class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
def index
end
def show
@album = GalleryAlbum.find(params[:id])
@tags = Array.new
@album.tag_ids.each do |tag|
@tags << GalleryTag.find(tag)[I18n.locale]
end
end
def new
if is_manager? || is_admin?
@categorylist = GalleryCategory.all
elsif is_sub_manager?
@categorylist = GalleryCategory.authed_for_user(current_user,"new_album")
end
@album = GalleryAlbum.new
render :layout => false
end
def create
album = GalleryAlbum.new(params[:gallery_album])
album.save!
respond_to do |h|
h.js
end
end
def get_albums
@categoryids = params["cid"]
@tags = params["tid"]
@albums = Array.new
if @categoryids == "all"
if @tags
if @tags.kind_of?(Array)
@tags.each do |tag|
@albums << GalleryAlbum.where(tag_ids: tag)
end
else
@albums << GalleryAlbum.where(tag_ids: @tags)
end
else
@albums << GalleryAlbum.all
end
else
@categoryids.each do |id|
category = GalleryCategory.find(id)
if @tags
if @tags.kind_of?(Array)
@tags.each do |tag|
@albums << category.gallery_albums.where(tag_ids: tag)
end
else
@albums << category.gallery_albums.where(tag_ids: @tags)
end
else
@albums << category.gallery_albums.all
end
end
end
@output = Array.new
@albums.each do |album|
@albs = Array.new
album.each do |values|
tags = Array.new
values.tag_ids.each do |tag|
tags << GalleryTag.find(tag)[I18n.locale]
end
category = GalleryCategory.find(values.gallery_category_id).name
@albs << {"_id"=>values.id,"show_path"=>panel_gallery_front_end_album_path(values),"cover"=>values.cover,"cover_path"=>values.cover_path,"description"=>values.description,"category_name"=>category,"gallery_category_id" => values.gallery_category_id,"name"=>values.name,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
end
@output << @albs
end
render :json=>@output.to_json
end
def imgs
@album = GalleryAlbum.find(params[:album_id])
@images = @album.gallery_images.all
@output = Array.new
@images.each do |values|
tags = Array.new
values.tag_ids.each do |tag|
tags << GalleryTag.find(tag)[I18n.locale]
end
@output << {"_id"=>values.id,"theater_link"=>panel_gallery_front_end_album_path(values)+"/theater","description"=>values.description,"title"=>values.title,"file"=>values.file,"gallery_album_id"=>values.gallery_album_id,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
end
render :json=>{"images" => @output}.to_json
end
def images_tags
album = GalleryAlbum.find(params[:album_id])
tags = Array.new
images = album.gallery_images.all
images.each do |image|
tags << {"id"=>image.id, "tags" => image.tag_ids}
end
render :json=>tags.to_json
end
end

View File

@ -44,56 +44,6 @@
</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 @authenticated %>
@ -113,6 +63,9 @@
if(typeof gallery.urlVars['cat']!= "undefined"){
gallery.loadArea = "albums";
gallery.loadAlbums(gallery.urlVars['cat']);
}else if(typeof gallery.urlVars['tag']!= "undefined"){
gallery.loadArea = "albums";
gallery.loadAlbums(gallery.urlVars['tag']);
}else{
gallery.loadArea = "albums";
g.loadAlbums("all");

View File

@ -4,7 +4,7 @@
</div>
<%= form_for @album, :url => {:action => "create"}, :remote => true do |f| %>
<div class="modal-body add-album">
<%= f.select(:gallery_category_id, GalleryCategory.all.collect {|p| [ p.name, p.id ] },{:prompt => t("gallery.select_category")}) %>
<div> <%= f.select(:gallery_category_id, GalleryCategory.all.collect {|p| [ p.name, p.id ] },{:prompt => t("gallery.select_category")},:class => "validate") %> </div>
<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>
@ -20,7 +20,7 @@
<% end %>
<p class="control-group">
<%= label_tag(locale, t("gallery.album_name")) %>
<%= name.text_field locale %>
<%= name.text_field locale, :class => "validate" %>
</p>
</div>
<% end %>
@ -44,7 +44,7 @@
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal" id="album_name_close_btn" onclick="return false;"><%= t("gallery.close") %></a>
<!-- <a href="#" class="btn btn-primary" id="album_name_save_btn" onclick="return false;"><%#= t("gallery.save_changes") %></a> -->
<%= f.submit t("gallery.save"), :class=> "btn btn-primary" %>
<%= f.submit t("gallery.save"), :class=> "btn btn-primary bt-form-save" %>
</div>
<% end %>
</div>

View File

@ -0,0 +1,65 @@
<%= stylesheet_link_tag "gallery_frontend" %>
<div id="orbit_gallery" class="rg">
<div class="rgbody">
<div id="imgholder">
<div class="rslide" style="position:relative; width:100%;">
<div class="rslideinside"><div id="loading" style="display:none;"></div>
<div class="comp" id='main_pic' data-content='<%= @image.gallery_album_id %>'><a href="" id="nextpic" class="navN" title="下一張" onclick="return false;" ><img src="<%= @image.file.url %>" alt="" /></a></div>
<div class="rslidenav">
<a href="" class="navP" title="上一張" onclick="return false;">Prev</a>
<a href="" class="navN" title="下一張" onclick="return false;">Next</a>
</div>
</div>
<div class="slidelist">
<ul id='galleryimagelist' style="display:none;">
<% @images.each_with_index do |image,i| %>
<li for="<%= i %>"><a href="<%= image.id %>" class="list_element" data-content="<%= image.file.url %>" onclick="return false;"><img src="<%= image.file.thumb.url %>" alt="" /></a></li>
<% end %>
</ul>
</div>
<div class="slidectrl">
<a href="" class="togglescreen" title="切換全螢幕" onclick="return false;">Screen</a>
<a href="" class="togglelist" title="顯示照片清單" onclick="return false;">List</a>
<a href="" class="browserfullscreen" title="顯示照片清單" onclick="return false;">F</a>
<div class="slideinfo">
<span class="info"><%= @image.description %></span>
</div>
</div>
</div>
</div>
</div>
<!-- tag part -->
<div class="taglist">
<h3 class="taglist_title"><%= t('gallery.album_tag') %></h3>
<ul>
</ul>
</div>
<!-- tag end -->
<div class="form-actions form-fixed pagination-right rghead">
<div class="rgfn">
<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>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "galleryAPI_frontend" %>
<%= javascript_include_tag "jquery.tinyscrollbar" %>
<%= javascript_include_tag "rss" %>
<% end %>
<script type="text/javascript">
galleryAPI.prototype.locale = "<%= I18n.locale %>";
var gallery = new galleryAPI();
gallery.initialize();
gallery.loadArea = "theater";
gallery.loadTheater("<%= params[:id] %>");
</script>

View 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> -->

View File

@ -0,0 +1,3 @@
var gal = new galleryAPI();
gal.loadAlbums("all");
rcom.modalWindowClose();

View File

@ -0,0 +1,137 @@
<%= 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_album_path(@album), :html => {:class => 'clear'} do |f| %>
<div class="tab_content">
<div class="albumname_edit">
<%= f.fields_for :name_translations do |name| %>
<%= f.label t("gallery.album_name") %>
<div class="inputui rginput rgih26 w380">
<% @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 %>
<%= name.text_field locale, :value => (@album_name[locale]), :class => "txtchange" %>
</div>
<% end %>
</div>
<% end %>
</div>
<div class='description_loader'>
<% @images.each_with_index do |image,x| %>
<div class="rgphoto_edit <%= locale %>" data-content="<%= image.id %>">
<%= link_to panel_gallery_back_end_album_image_path(image) do %>
<img src="<%= image.file.thumb.url %>" />
<% end %>
<div class="inputui rginput rgih98 w380">
<%= f.fields_for :gallery_images, image do |j| %>
<%= j.hidden_field :id, :value => (image.id) %>
<%= j.hidden_field :_destroy, :value => false, :class => "del_field" %>
<%= j.fields_for :description_translations do |desc| %>
<% @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 %>
<%= desc.text_area locale, :value => (image.description_translations[locale] rescue nil), :class => "txtchange" %>
</div>
<% end %>
<% end %>
<% end %>
</div>
<div class="edit_fn" no="<%= x %>">
<% 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>
<input type="hidden" name="delete_cover" value="false" class="del_cover" />
<div class="form-actions form-fixed pagination-right rghead">
<div class="rgfn">
<a href="<%= panel_gallery_back_end_album_path(@album) %>" 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>
<%= f.submit t('gallery.save'), :class=>'bt-save icon-ok btn btn-primary pull-right', :style=>"display:none;" %>
</div>
</div>
</div>
<% end %>
</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>

View File

@ -0,0 +1,42 @@
<%= stylesheet_link_tag "gallery_frontend" %>
<%#= stylesheet_link_tag "gallery" %>
<div id="orbit_gallery" class="rg">
<div class="rgbody">
<div id="imgholder">
</div>
</div>
<div class="rghead">
<div class="rgfn">
</div>
</div>
</div>
<script type="text/javascript">
</script>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "galleryAPI_frontend" %>
<%= javascript_include_tag "jquery.tinyscrollbar" %>
<%= javascript_include_tag "rss" %>
<% end %>
<script type="text/javascript">
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 if(typeof gallery.urlVars['tag']!= "undefined"){
gallery.loadArea = "albums";
gallery.loadAlbums(gallery.urlVars['tag']);
}else{
gallery.loadArea = "albums";
g.loadAlbums("all");
}
</script>

View File

@ -0,0 +1,51 @@
<div class="modal-window" id="categories">
<div class="modal-header">
<h3><%= t("gallery.add_album") %></h3>
</div>
<%= form_for @album, :url => {:action => "create"}, :remote => true do |f| %>
<div class="modal-body add-album">
<div> <%= f.select(:gallery_category_id, GalleryCategory.all.collect {|p| [ p.name, p.id ] },{:prompt => t("gallery.select_category")},:class => "validate") %> </div>
<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>
<div class="tab_content form-horizontal">
<%= f.fields_for :name_translations do |name| %>
<% @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 %>
<p class="control-group">
<%= label_tag(locale, t("gallery.album_name")) %>
<%= name.text_field locale, :class => "validate" %>
</p>
</div>
<% end %>
<% end %>
<%= f.fields_for :description_translations do |desc| %>
<% @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 %>
<p class="control-group">
<%= label_tag(locale, t("gallery.album_desc")) %>
<%= desc.text_field locale %>
</p>
</div>
<% end %>
<% end %>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn" data-dismiss="modal" id="album_name_close_btn" onclick="return false;"><%= t("gallery.close") %></a>
<!-- <a href="#" class="btn btn-primary" id="album_name_save_btn" onclick="return false;"><%#= t("gallery.save_changes") %></a> -->
<%= f.submit t("gallery.save"), :class=> "btn btn-primary bt-form-save" %>
</div>
<% end %>
</div>

View File

@ -0,0 +1,45 @@
<%= stylesheet_link_tag "gallery_frontend" %>
<div id="orbit_gallery" class="rg">
<div class="rgbody">
<div id="imgholder">
</div>
</div>
<!-- tag part -->
<!-- add "album_tags" or "photo_tags" class to .taglist -->
<div class="taglist">
<h3 class="taglist_title"><%= t('gallery.album_tag') %></h3>
<ul>
<% @tags.each do |tag|%>
<li><%= tag %></li>
<% end %>
</ul>
</div>
<!-- tag end -->
<div class="form-actions form-fixed pagination-right rghead">
<div class="rgfn">
<a class="bt-back rgbt" title="<%= I18n.t("gallery.back_to_albums") %>" href="gallery"><i class="icon-arrow-left"></i> <%= I18n.t("gallery.back_to_albums") %></a>
</div>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "galleryAPI_frontend" %>
<%= javascript_include_tag "jquery.tinyscrollbar" %>
<%= javascript_include_tag "rss" %>
<% end %>
<script type="text/javascript">
galleryAPI.prototype.locale = "<%= I18n.locale %>";
var gallery = new galleryAPI();
gallery.initialize();
gallery.loadArea = "images";
gallery.loadImages("<%= params[:id] %>");
</script>

View File

@ -0,0 +1,107 @@
<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_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="<%= 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> -->
<% 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>
</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> -->

View File

@ -31,3 +31,4 @@ en:
cover: Album Cover
set_cover: Set as Album Cover
sure?: "Are you sure?"
no_description: Description Unavailable

View File

@ -6,7 +6,6 @@ Rails.application.routes.draw do
match "upload_image" => "albums#upload_image"
match "save_tags" => "tags#save_tags"
match "albums/save_tags" => "tags#save_tags"
resources :albums do
match "set_cover" => "albums#set_cover"
match "imgs" => "albums#imgs"
@ -24,23 +23,31 @@ Rails.application.routes.draw do
end
namespace :front_end do
match "orbit_galleries" => "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 "get_albums" => "albums#get_albums"
# match "orbit_galleries" => "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 "theater/:id" => "album_images#show", :as => "theater_link_path"
resources :albums do
match "imgs" => "albums#imgs"
match "theater" => "album_images#show"
end
resources :album_images
end
end
end