updates for tagging and language fix

This commit is contained in:
Harry Bomrah 2012-08-20 22:00:57 +08:00
parent e86d5ab338
commit 6e90196b77
11 changed files with 346 additions and 146 deletions

View File

@ -1,31 +1,46 @@
<%# encoding: utf-8 %>
$.extend($.expr[':'], {
'containsi': function (elem, i, match, array) {
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
var galleryAPI = function(){
g = this;
this.urlVars = rcom.getUrlVars();
this.albumArea = $("#orbit_gallery");
this.loadArea = "";
this.loadArea = null;
this.tagList = $("ul#gallery_tag_list");
// this.authenticated = false;
this.initialize = function(){
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']);
g.loadArea = "albums";
}else if(typeof g.urlVars['album']!= "undefined"){
g.loadImages(g.urlVars['album']);
g.loadArea = "images";
passid = g.urlVars['album'];
g.loadImages(g.urlVars['album']);
}else if(typeof g.urlVars['theater']!= "undefined"){
g.loadTheater(g.urlVars['theater']);
g.loadArea = "theater";
passid = g.urlVars['theater'];
g.loadTheater(g.urlVars['theater']);
}else if(typeof g.urlVars['edit']!= "undefined"){
g.editAlbum(g.urlVars['edit']);
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.length == 0){
g.loadArea = "albums";
}else{
g.loadAlbums("all");
g.loadArea = "albums";
}
if(typeof callbackFn == "function"){
callbackFn.call(this,g.loadArea,passid);
}
})
var bindHandlers = function(){
@ -48,6 +63,7 @@ var galleryAPI = function(){
window.location = url;
}
})
}
$("#filter .filter-clear a").click(function(){
var loc = window.location.href;
@ -105,12 +121,15 @@ var galleryAPI = function(){
}
this.loadAlbums = function(id){
var headbtn = $('<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>');
headbtn.click(function(){g.makeNewAlbum();})
g.albumArea.find(".rghead .rgfn").html(headbtn);
g.loadFooterPanel(g.loadArea,id,function(headbtn){
headbtn = $(headbtn);
headbtn.click(function(){g.makeNewAlbum();})
g.albumArea.find(".rghead .rgfn").html(headbtn);
})
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();})
// 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 = [];
@ -137,43 +156,75 @@ 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></div>");
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><br /><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></div>");
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><br /><span class='tagnames'></span></div>");
var tag_string = "";
for(tag in album.tag_names){
tag_string+=album.tag_names[tag] + " ";
}
$img.find("span.tagnames").text(tag_string);
g.albumArea.find("#imgholder").append($img);
})
})
g.albumArea.find("#imgholder").append($addsign);
// 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);
var headarea = '<a class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_albums") %>" href="orbit_gallery"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_albums") %></a> ';
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>';
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>';
headarea = $(headarea);
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)))){
$("ul#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
}else{
$("ul#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
}
}else{
$("ul#gallery_tag_list li").slideDown();
}
})
g.albumArea.find("#tag_panel button.bt-save").click(function(){
g.saveTags(id,g.loadArea);
})
g.albumArea.find(".rghead .rgfn a.bt-add").click(function(){
showUploadPanel();
})
g.albumArea.find(".rghead .rgfn a.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="200" frameborder="0" src="upload_panel"></iframe>');
g.albumArea.find(".rghead .rgfn").html(headarea);
g.albumArea.find(".rghead .rgfn a.bt-add").click(function(){
showUploadPanel();
})
g.albumArea.find(".rghead .rgfn a.bt-del").click(function(){
g.deleteAlbum(id);
})
uploadpanel.find("a.bt-cls").click(function(){
uploadpanel.hide("slide");
frame.remove();
g.loadImages(id);
panelopen = false;
})
var panelopen = false;
var showUploadPanel = function(){
if(!panelopen){
uploadpanel.prepend(frame);
@ -186,35 +237,23 @@ var galleryAPI = function(){
g.albumArea.find("#imgholder").empty();
$("#filter").remove();
g.albumArea.css("margin-top","");
var $addsign = $('<div class="rgalbum"><a id="global_add" class="rgui bt-addnew" href="add" onclick="return false;">Add Album</a></div>');
$addsign.find("a").click(function(){showUploadPanel();})
$.getJSON("get_images",{aid:id},function(images){
$.each(images,function(i,image){
// var $addsign = $('<div class="rgalbum"><a id="global_add" class="rgui bt-addnew" href="add" onclick="return false;">Add Album</a></div>');
// $addsign.find("a").click(function(){showUploadPanel();})
$.getJSON("get_images",{aid:id},function(album){
$.each(album.images,function(i,image){
var thumb = image.file.thumb.url;
var $img = $("<div class='rgalbum'><a title='"+image.description+"' href='?theater="+image._id+"'><img src='"+thumb+"'/></a></div>");
g.albumArea.find("#imgholder").append($img);
})
g.albumArea.find("#imgholder").append($addsign);
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);
// g.albumArea.find("#imgholder").append($addsign);
// tag
$('.bt-tag').click(function(){
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;
});
}
this.loadTheater = function(id){
@ -231,6 +270,51 @@ var galleryAPI = function(){
$("#main_pic").height(picHeight);
$img.height("100%");
$('.bt-tag').click(function(){
if(!$(this).hasClass("active"))
updatePhotoTag();
$(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;
});
var updatePhotoTag = function(){
var tags = imageArray[imagecount].tag_ids;
g.tagList.find("input").attr("checked",false);
for(tag in tags){
g.tagList.find("li[data-content="+tags[tag]+"] input").attr("checked",true);
}
}
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)))){
$("ul#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
}else{
$("ul#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
}
}else{
$("ul#gallery_tag_list li").slideDown();
}
})
g.albumArea.find("#tag_panel button.bt-save").click(function(){
g.saveTags(imageArray[imagecount]._id,g.loadArea);
})
$(".slidectrl a.togglelist").click(function(){
var rslide_h = $rslide.outerHeight();
if ( $slidelist.height() < 1 ){
@ -328,10 +412,13 @@ var galleryAPI = function(){
window.history.pushState({path:pageurl},'',pageurl);
}
// $(".slideinfo b.info").text(imageArray[imagecount].title);
if($('.bt-tag').hasClass("active"))
updatePhotoTag();
$(".slideinfo span.info").text(imageArray[imagecount].description);
if(imageArray.length > 1)
updateNavigation();
})
}
var updateNavigation = function(){
var next, prev;
@ -353,19 +440,15 @@ var galleryAPI = function(){
}
var preparestage = function(albumid){
$.getJSON("get_images",{aid:albumid},function(images){
imageArray = eval(images);
$.each(images,function(i,image){
$.getJSON("get_images",{aid:albumid},function(album){
imageArray = eval(album.images);
$.each(album.images,function(i,image){
if(image._id == id)
imagecount = i;
})
bindHandlers();
})
}
var head = $('<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>');
var head1 = $('<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>');
var head2 = $('<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>');
g.albumArea.find("#imgholder").load("theater?pic="+id,function(theater,response,xhr){
if(xhr.status == 404){
$(this).text("<%= I18n.t('gallery.pic_not_found') %>.");
@ -374,16 +457,55 @@ var galleryAPI = function(){
$("#filter").remove();
g.albumArea.css("margin-top","");
var albumid = $(theater).find("#main_pic").attr("data-content");
head.attr("href","orbit_gallery?album="+albumid);
head1.attr("href","orbit_gallery?edit="+albumid);
g.albumArea.find(".rghead .rgfn").html(head);
g.albumArea.find(".rghead .rgfn").append(head1,head2);
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .rghead").outerHeight());
g.loadFooterPanel(g.loadArea,id,function(head){
head = $(head);
g.albumArea.find(".rghead .rgfn").html(head);
g.albumArea.find("a.bt-back").attr("href","orbit_gallery?album="+albumid);
g.albumArea.find("a.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);
});
}
// tag
this.editAlbum = function(id){
var bindHandlers = function(){
$(".nav .nav-tabs a").click(function(){
$(".tab_content .tab-pane").hide();
})
$(".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(){})
})
$(".description_loader .edit_fn .bt-dels").click(function(){
$(this).toggleClass("setdelete");
if($(".description_loader .edit_fn .setdelete").length > 0){
g.albumArea.find(".rghead .rgfn .bt-delete").show();
}else{
g.albumArea.find(".rghead .rgfn .bt-delete").hide();
}
})
g.albumArea.find(".rghead .rgfn .bt-save").click(function(){
// var dataArray = Array();
// $(".description_loader .txtchange").each(function(){
// dataArray.push({"id":$(this).attr("for"),"text": $(this).val()});
// })
// var albumnm = Array();
// $(".albumname_edit .txtchange").each(function(){
// albumnm.push($(this).val())
// })
var dataArray = $("form#edit_album").serialize();
$.post("update_album",{"aid":id,"data":dataArray},function(){
})
})
$('.bt-tag').click(function(){
$(this).toggleClass("active");
var $tag_panel = $('#tag_panel'),
tag_panel_position = 0;
@ -397,33 +519,26 @@ var galleryAPI = function(){
.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)))){
$("ul#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
}else{
$("ul#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
}
this.editAlbum = function(id){
var bindHandlers = 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(){})
})
$("#description_loader .edit_fn .bt-dels").click(function(){
$(this).toggleClass("setdelete");
if($("#description_loader .edit_fn .setdelete").length > 0){
g.albumArea.find(".rghead .rgfn .bt-delete").show();
}else{
g.albumArea.find(".rghead .rgfn .bt-delete").hide();
$("ul#gallery_tag_list li").slideDown();
}
})
g.albumArea.find(".rghead .rgfn .bt-save").click(function(){
var dataArray = Array();
$("#description_loader .txtchange").each(function(){
dataArray.push({"id":$(this).attr("for"),"text": $(this).val()});
})
albumnm = $(".albumname_edit #album_name_text").val();
$.post("update_album",{data:dataArray,"aid":id,"name":albumnm},function(){
})
g.albumArea.find("#tag_panel button.bt-save").click(function(){
g.saveTags(imageArray[imagecount]._id,g.loadArea);
})
var tempval;
$(".txtchange").focus(function(){
@ -436,8 +551,8 @@ var galleryAPI = function(){
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");
$("#description_loader .edit_fn .bt-dels").each(function(){
var thiscover = $(".description_loader .edit_fn .setcover").attr("href");
$(".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());
@ -471,5 +586,20 @@ var galleryAPI = function(){
bindHandlers();
})
}
}
this.saveTags = function(id,tagsfor){
var tagids = new Array();
g.tagList.find("li input:checked").each(function(){
tagids.push($(this).parent().attr("data-content"));
})
var tag = null;
if(g.loadArea == "images")
tag = "album";
else if(g.loadArea == "theater")
tag = "pic";
$.post("save_tags",{"id":id,"tag":tag,"tids":tagids},function(){
})
}
}
galleryAPI.prototype.locale = "en";

View File

@ -549,6 +549,12 @@ body.fullscreen, .fullscreen #container, .fullscreen #container2, .fullscreen #m
margin-left: 8px;
margin-right: 8px;
}
.tab_content .tab-pane{
display: none;
}
.tab_content .active{
display: block;
}
#orbit_gallery .btn { margin: 0; }
#orbit_gallery .rgfn .btn {
margin-left: 8px;

View File

@ -2,7 +2,7 @@ class Panel::Gallery::BackEnd::OrbitGalleriesController < OrbitBackendController
include AdminHelper
def index
if is_manager? || is_admin? || is_sub_manager?
@authenticated = true
@authenticated = true #turn this value to false for view only
else
@authenticated = false
end
@ -90,8 +90,20 @@ include AdminHelper
end
end
end
i = 0
@albums.each do |album|
album.each do |values|
# if values.tag_ids.kind_of?(Array)
tags = Array.new
values.tag_ids.each do |tag|
tags << GalleryTag.find(tag)[I18n.locale]
end
# end
values.tag_names = tags
values.save
end
i = i + 1
end
# @albums = GalleryAlbum.find("5017a7babd98eb049900000a")
# @albums.update_attributes({:tag_ids =>["501ba786bd98eb0232000126"]})
@ -118,8 +130,7 @@ include AdminHelper
def get_images
@album = GalleryAlbum.find(params["aid"])
@images = @album.gallery_images.all
render :json=>@images.to_json
render :json=>{"images" => @album.gallery_images.all, "tags" => @album.tag_ids}.to_json
end
def theater
@ -143,7 +154,7 @@ include AdminHelper
aid = params['aid']
album = GalleryAlbum.find(aid)
@images = album.gallery_images.all
@album_name = album.name
@album_name = album.name_translations
@cover = album.cover
render :layout => false
end
@ -171,16 +182,30 @@ include AdminHelper
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)
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])
debugger
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
album = GalleryAlbum.find(aid)
album.update_attributes(:name => album_name)
render :json =>{"success"=>true}.to_json
@object.update_attributes({:tag_ids => params[:tids]})
render :json => {"success"=> "true"}.to_json
end
end

View File

@ -6,6 +6,7 @@ class GalleryAlbum
field :description, localize: true
field :cover, default: "default"
field :cover_path
field :tag_names
belongs_to :gallery_category
has_and_belongs_to_many :tags, :class_name => "GalleryTag"

View File

@ -5,7 +5,7 @@ class GalleryImage
mount_uploader :file, GalleryUploader
field :title
field :description
field :description, localize: true
has_and_belongs_to_many :tags, :class_name => "GalleryTag"

View File

@ -2,9 +2,9 @@
<% @categorylist.each do |category| %>
<div class="tag clear">
<div class="tagitem">
<i class="icons-star"></i>
<i class="icon-folder-close"></i>
<% @site_valid_locales.each do |locale| %>
<span for="<%= locale %>"><%= category.name_translations[locale] %> </span>
<span class="value" for="<%= locale %>"><%= category.name_translations[locale] %> </span>
<% end %>
</div>
<div class="action">
@ -37,7 +37,7 @@
var parent = a.parent().parent();
var parenthtml = parent.html();
var tempdom = $("<div class='tagitem'></div>");
parent.find("span").each(function(){
parent.find("span.value").each(function(){
var locale = $(this).attr("for");
var lang = {
"en" : "English",

View File

@ -4,26 +4,42 @@
# from line 129
%>
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href=".zh_tw">中文</a></li>
<li><a data-toggle="tab" href=".en">英文</a></li>
<% i = 0 %>
<% @site_valid_locales.each do |locale| %>
<% if i == 0 %>
<li class="active"><a data-toggle="tab" href=".<%= locale %>"><%= locale %></a></li>
<% else %>
<li><a data-toggle="tab" href=".<%= locale %>"><%= locale %></a></li>
<% end %>
<% i = 1 %>
<% end %>
</ul>
<form id="edit_album">
<div class="tab_content">
<div class="zh_tw tab-pane in active">
<% i = 0 %>
<% @site_valid_locales.each do |locale| %>
<% if i == 0 %>
<div class="<%= locale %> fade tab-pane in active">
<% else %>
<div class="<%= locale %> fade tab-pane" >
<% end %>
<% i = 1 %>
<div class="albumname_edit">
<label for="">Album Name:</label>
<div class="inputui rginput rgih26 w380"><span><input type="text" id='album_name_text' value="<%= @album_name %>" class="txtchange" /></span></div>
<div class="inputui rginput rgih26 w380"><span><input type="text" name="edit_album[name][<%= locale %>]" value="<%= @album_name[locale] %>" class="txtchange" /></span></div>
</div>
<div id='description_loader'>
<div class='description_loader'>
<% @images.each do |image| %>
<div class="rgphoto_edit">
<a href="orbit_gallery?theater=<%= image.id %>"><img src="<%= image.file.thumb.url %>"></a>
<div class="inputui rginput rgih98 w380">
<span>
<textarea name="description_box" class="txtchange" for="<%= image.id%>"><%= image.description %></textarea>
<textarea name="edit[description][<%= locale %>]" class="txtchange" for="<%= image.id%>"><%= image.description_translations[locale] %></textarea>
</span>
</div>
<div class="edit_fn">
<a class="rgui rgbt rgbtsg bt-dels" onclick="return false;" title="Delete" href="<%= image.id %>">Delete</a>
<a class="rgui rgbt rgbtsg bt-tag" onclick="return false;" title="Tag" href="<%= image.id %>">Tag</a>
<% if image.id.to_s == @cover %>
<a class="rgui rgbt rgbtsg bt-cover setcover" onclick="return false;" title="Set Cover" href="<%= image.id %>">Set Cover</a>
<% else %>
@ -34,7 +50,9 @@
<% end %>
</div>
</div>
<!-- <div class="en tab-pane">
</form>
<% end %>
<!-- <div class="tab-pane in active">
<div class="albumname_edit">
<label for="">Album Name:</label>
<div class="inputui rginput rgih26 w380"><span><input type="text" id='album_name_text' value="<%= @album_name %>" class="txtchange" /></span></div>
@ -59,5 +77,5 @@
</div>
<% end %>
</div>
</div> -->
</div> -->
</div>

View File

@ -68,6 +68,7 @@
</div>
</div>
<!-- tag part -->
<% if @authenticated %>
<div id="tag_panel" class="my_scroll">
<div class="scrollbar">
<div class="track">
@ -76,35 +77,25 @@
</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">
<li><input id="tag1" type="checkbox"><label for="tag1">animal</label></li>
<li><input id="tag2" type="checkbox"><label for="tag2">animal</label></li>
<li><input id="tag3" type="checkbox"><label for="tag3">animal</label></li>
<li><input id="tag4" type="checkbox"><label for="tag4">animal</label></li>
<li><input id="tag5" type="checkbox"><label for="tag5">animal</label></li>
<li><input id="tag6" type="checkbox"><label for="tag6">animal</label></li>
<li><input id="tag7" type="checkbox"><label for="tag7">animal</label></li>
<li><input id="tag8" type="checkbox"><label for="tag8">animal</label></li>
<li><input id="tag9" type="checkbox"><label for="tag9">animal</label></li>
<li><input id="tag10" type="checkbox"><label for="tag10">animal</label></li>
<li><input id="tag11" type="checkbox"><label for="tag11">animal</label></li>
<li><input id="tag12" type="checkbox"><label for="tag12">animal</label></li>
<li><input id="tag13" type="checkbox"><label for="tag13">animal</label></li>
<li><input id="tag14" type="checkbox"><label for="tag14">animal</label></li>
<li><input id="tag15" type="checkbox"><label for="tag15">animal</label></li>
<li><input id="tag16" type="checkbox"><label for="tag16">animal</label></li>
<li><input id="tag17" type="checkbox"><label for="tag17">animal</label></li>
<li><input id="tag18" type="checkbox"><label for="tag18">animal</label></li>
<li><input id="tag19" type="checkbox"><label for="tag19">animal</label></li>
<li><input id="tag20" type="checkbox"><label for="tag20">animal</label></li>
<li><input id="tag21" type="checkbox"><label for="tag21">animal</label></li>
<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="Search Tags"></div>
<button class='bt-save' style="position:absolute; bottom: 0;">Save</button>
<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>
</div>
<% end %>
<script type="text/javascript">
var $tag_panel = $('#tag_panel');
orbit_bar_height = $('#orbit-bar').outerHeight();
@ -129,11 +120,37 @@
</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> ';
<% 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>';
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>';
<% 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 %>
<script type="text/javascript">
galleryAPI.prototype.locale = "<%= I18n.locale %>";
var gallery = new galleryAPI();
gallery.initialize();
</script>

View File

@ -27,4 +27,5 @@ en:
save: Save
cate_auth: Category Authorization
cancel: Cancel
search_tags: Search Tags

View File

@ -24,4 +24,5 @@ zh_tw:
del_album?: "刪除這本相簿嗎?"
album_not_found: "相簿不存在"
pic_not_found: "照片不存在"
search_tags: 搜索標籤

View File

@ -18,6 +18,7 @@ Rails.application.routes.draw do
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"
resources :tags
end
end