Merge branch 'gallery_orbit' into desktop_devin
This commit is contained in:
commit
a2da065ce6
|
@ -10,41 +10,9 @@ var galleryAPI = function(){
|
|||
this.albumArea = $("#orbit_gallery");
|
||||
this.loadArea = null;
|
||||
this.tagList = $("ul#gallery_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);
|
||||
// }
|
||||
})
|
||||
var bindHandlers = function(){
|
||||
$("#filter .filter_btns a").click(function(){
|
||||
|
@ -85,8 +53,8 @@ var galleryAPI = function(){
|
|||
window.location = url;
|
||||
})
|
||||
}
|
||||
this.makeNewAlbum = function(){
|
||||
$.get("albums/new",function(html){
|
||||
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 ={
|
||||
|
@ -128,7 +96,7 @@ var galleryAPI = function(){
|
|||
}
|
||||
|
||||
this.loadAlbums = function(id){
|
||||
g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum()});
|
||||
g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum($(this).attr("href"))});
|
||||
g.albumArea.addClass('o_gallery');
|
||||
g.albumArea.find("#imgholder").empty();
|
||||
if(id!="all"){
|
||||
|
@ -156,10 +124,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='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>");
|
||||
var $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><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='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 $img = $("<div class='rgalbum'><a title='"+album.description+"' href='"+album.show_path+"'><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){
|
||||
tag_string+= '<span class="label label-tags">' + album.tag_names[tag] + '</span>';
|
||||
|
@ -168,7 +135,6 @@ var galleryAPI = function(){
|
|||
g.albumArea.find("#imgholder").append($img);
|
||||
})
|
||||
})
|
||||
// g.albumArea.find("#imgholder").append($addsign);
|
||||
})
|
||||
}
|
||||
this.loadImages = function(id){
|
||||
|
@ -206,7 +172,7 @@ var galleryAPI = function(){
|
|||
}
|
||||
})
|
||||
g.albumArea.find("#tag_panel .bt-save").click(function(){
|
||||
g.saveTags(id,g.loadArea);
|
||||
g.saveTags(id,"album");
|
||||
})
|
||||
g.albumArea.find(".rghead .rgfn .bt-add").click(function(){
|
||||
showUploadPanel();
|
||||
|
@ -236,10 +202,10 @@ var galleryAPI = function(){
|
|||
g.albumArea.find("#imgholder").empty();
|
||||
$("#filter").remove();
|
||||
g.albumArea.css("margin-top","");
|
||||
$.getJSON(id+"/get_images",function(album){
|
||||
$.getJSON(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>");
|
||||
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);
|
||||
|
@ -253,11 +219,8 @@ var galleryAPI = function(){
|
|||
g.tagList.append($li);
|
||||
})
|
||||
}
|
||||
// g.albumArea.find("#imgholder").append($addsign);
|
||||
})
|
||||
// g.albumArea.find("#imgholder").append($addsign);
|
||||
// tag
|
||||
|
||||
})
|
||||
}
|
||||
this.loadTheater = function(id){
|
||||
var imageArray;
|
||||
|
@ -330,13 +293,10 @@ var galleryAPI = function(){
|
|||
}
|
||||
})
|
||||
g.albumArea.find("#tag_panel .bt-save").click(function(){
|
||||
g.saveTags(imageArray[imagecount]._id,g.loadArea)
|
||||
var tagids = new Array();
|
||||
g.tagList.find("li input:checked").each(function(){
|
||||
tagids.push($(this).parent().attr("data-content"));
|
||||
})
|
||||
g.saveTags(imageArray[imagecount]._id,"pic",function(tagids){
|
||||
imageArray[imagecount].tag_ids = tagids;
|
||||
})
|
||||
})
|
||||
$(".slidectrl a.togglelist").click(function(){
|
||||
var rslide_h = $rslide.outerHeight();
|
||||
if ( $slidelist.height() < 1 ){
|
||||
|
@ -462,15 +422,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("get_images",{aid:albumid},function(album){
|
||||
$.getJSON("../albums/"+albumid+"/imgs",function(album){
|
||||
imageArray = eval(album.images);
|
||||
$.each(album.images,function(i,image){
|
||||
if(image._id == id)
|
||||
|
@ -479,36 +439,28 @@ var galleryAPI = function(){
|
|||
bindHandlers();
|
||||
})
|
||||
}
|
||||
g.albumArea.find("#imgholder").load("theater?pic="+id,function(theater,response,xhr){
|
||||
if(xhr.status == 404){
|
||||
$(this).text("<%= I18n.t('gallery.pic_not_found') %>.");
|
||||
return false;
|
||||
}
|
||||
$("#filter").remove();
|
||||
g.albumArea.css("margin-top","");
|
||||
var albumid = $(theater).find("#main_pic").attr("data-content");
|
||||
g.albumArea.find(".bt-back").attr("href","album_images?album="+albumid);
|
||||
g.albumArea.find(".bt-edit").attr("href","orbit_gallery?edit="+albumid);
|
||||
|
||||
|
||||
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){
|
||||
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 active btn-primary");
|
||||
$(".bt-cover span").removeClass("icon-white icon-star").addClass("icon-star-empty")
|
||||
$(".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(){})
|
||||
$.post("set_cover",{"imageid":$(this).attr("for")});
|
||||
})
|
||||
$(".description_loader .edit_fn .bt-dels").click(function(){
|
||||
$(this)
|
||||
|
@ -536,13 +488,24 @@ var galleryAPI = function(){
|
|||
// })
|
||||
|
||||
})
|
||||
var current_element_for_tags = null;
|
||||
var current_element_no = null;
|
||||
$('.bt-tag').click(function(){
|
||||
var has_class = false;
|
||||
if($(this).hasClass("active"))
|
||||
has_class = true;
|
||||
|
||||
$('.bt-tag').removeClass("active");
|
||||
$(this).toggleClass("active");
|
||||
var count = 0;
|
||||
$('.bt-tag').each(function(){
|
||||
if($(this).hasClass("active"))
|
||||
count++;
|
||||
})
|
||||
if(has_class){
|
||||
$(this).removeClass("active");
|
||||
count = 0;
|
||||
}
|
||||
var $tag_panel = $('#tag_panel'),
|
||||
tag_panel_position = 0;
|
||||
if(count == 1)
|
||||
|
@ -559,6 +522,16 @@ var galleryAPI = function(){
|
|||
.delay(200)
|
||||
.animate({'margin-right':tag_panel_position+200},300);
|
||||
|
||||
current_element_for_tags = $(this).attr("href");
|
||||
if(count == 1){
|
||||
current_element_no = $(this).parent().attr("no");
|
||||
if(imageTagArray[current_element_no].id == current_element_for_tags){
|
||||
g.tagList.find("input").attr("checked",false);
|
||||
for(tag in imageTagArray[current_element_no].tags){
|
||||
g.tagList.find("li[data-content="+imageTagArray[current_element_no].tags[tag]+"] input").attr("checked",true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
g.albumArea.find("#tag_search_box").keyup(function(e){
|
||||
|
@ -579,7 +552,9 @@ var galleryAPI = function(){
|
|||
}
|
||||
})
|
||||
g.albumArea.find("#tag_panel .bt-save").click(function(){
|
||||
g.saveTags(imageArray[imagecount]._id,g.loadArea);
|
||||
g.saveTags(current_element_for_tags,"pic",function(tagids){
|
||||
imageTagArray[current_element_no].tags = tagids;
|
||||
})
|
||||
})
|
||||
var tempval;
|
||||
$(".txtchange").focus(function(){
|
||||
|
@ -616,32 +591,25 @@ var galleryAPI = function(){
|
|||
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 imageTagArray = null;
|
||||
$.getJSON("images_tags",function(data){
|
||||
imageTagArray = eval(data);
|
||||
})
|
||||
bindHandlers();
|
||||
}
|
||||
this.saveTags = function(id,tagsfor){
|
||||
this.saveTags = function(id,tagsfor,callbackFn){
|
||||
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(){
|
||||
|
||||
$.post("../save_tags",{"id":id,"tag":tagsfor,"tids":tagids},function(){
|
||||
if(typeof callbackFn == "function")
|
||||
callbackFn.call(this,tagids);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
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
|
||||
def show
|
||||
if is_manager? || is_admin? || is_sub_manager?
|
||||
@authenticated = true #turn this value to false for view only
|
||||
else
|
||||
@authenticated = false
|
||||
end
|
||||
@tags = GalleryTag.all
|
||||
@image = GalleryImage.find(params[:id])
|
||||
@albumid = @image.gallery_album_id
|
||||
@album = GalleryAlbum.find(@albumid)
|
||||
@images = @album.gallery_images.all
|
||||
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
images = params['images']
|
||||
|
@ -57,15 +63,5 @@ class Panel::Gallery::BackEnd::AlbumImagesController < OrbitBackendController
|
|||
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
|
||||
|
|
|
@ -18,7 +18,7 @@ include AdminHelper
|
|||
else
|
||||
@authenticated = false
|
||||
end
|
||||
@categorylist = GalleryCategory.all
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@tags = GalleryTag.all
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,6 @@ include AdminHelper
|
|||
album.name = albumnames["zh_tw"]
|
||||
album.description = albumdescs["zh_tw"]
|
||||
album.save!
|
||||
#x = category.gallery_albums.create({name: params['albumname'],description: params['albumdesc']})
|
||||
render :json=>{"success"=>true,"id"=>album.id}.to_json
|
||||
end
|
||||
|
||||
|
@ -88,7 +87,7 @@ include AdminHelper
|
|||
tags << GalleryTag.find(tag)[I18n.locale]
|
||||
end
|
||||
category = GalleryCategory.find(values.gallery_category_id).name
|
||||
@albs << {"_id"=>values.id,"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}
|
||||
@albs << {"_id"=>values.id,"show_path"=>panel_gallery_back_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
|
||||
|
@ -118,7 +117,7 @@ include AdminHelper
|
|||
render :json =>{"success"=>true}.to_json
|
||||
end
|
||||
|
||||
def get_images
|
||||
def imgs
|
||||
@album = GalleryAlbum.find(params[:album_id])
|
||||
@tag_names = Array.new
|
||||
@images = @album.gallery_images.all
|
||||
|
@ -128,7 +127,7 @@ include AdminHelper
|
|||
values.tag_ids.each do |tag|
|
||||
tags << GalleryTag.find(tag)[I18n.locale]
|
||||
end
|
||||
@output << {"_id"=>values.id,"description"=>values.description,"title"=>values.title,"file"=>values.file,"gallery_album_id"=>values.gallery_album_id,"tag_ids"=>values.tag_ids,"tag_names"=>tags}
|
||||
@output << {"_id"=>values.id,"theater_link"=>panel_gallery_back_end_album_image_path(values),"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
|
||||
if is_manager? || is_admin? || is_sub_manager?
|
||||
@authenticated = true #turn this value to false for view only
|
||||
|
@ -160,6 +159,30 @@ include AdminHelper
|
|||
end
|
||||
render :json=>a.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
|
||||
|
||||
def update
|
||||
debugger
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
#album.update_attributes(params[:gallery_album])
|
||||
if is_manager? || is_admin? || is_sub_manager?
|
||||
@authenticated = true #turn this value to false for view only
|
||||
else
|
||||
@authenticated = false
|
||||
end
|
||||
|
||||
@tags = GalleryTag.all
|
||||
render :action => :show
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -4,5 +4,15 @@ class Panel::Gallery::BackEnd::TagsController < Admin::TagsController
|
|||
super
|
||||
@app_title = 'gallery'
|
||||
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
|
||||
|
|
|
@ -4,7 +4,30 @@
|
|||
<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 -->
|
||||
|
@ -59,19 +82,11 @@
|
|||
<!-- 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 %>
|
||||
<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="<%= edit_panel_gallery_back_end_album_path(@album) %>" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>
|
||||
<% end %>
|
||||
<a class="bt-tag btn btn-primary pull-right" title="<%= I18n.t("gallery.photo_tag") %>" href="#tags" ><i class="icon-tag icon-white"></i><%= I18n.t("gallery.photo_tag") %></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -84,8 +99,8 @@
|
|||
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||
var gallery = new galleryAPI();
|
||||
gallery.initialize();
|
||||
gallery.loadArea = "images";
|
||||
gallery.loadImages("<%= params[:id] %>");
|
||||
gallery.loadArea = "theater";
|
||||
gallery.loadTheater("<%= params[:id] %>");
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<% 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| %>
|
||||
<%= form_for @album, :url => panel_gallery_back_end_album_path(@album), :html => {:class => 'clear'} do |f| %>
|
||||
<div class="tab_content">
|
||||
<% @site_valid_locales.each_with_index do |locale, i| %>
|
||||
<% if i == 0 %>
|
||||
|
@ -23,23 +23,29 @@
|
|||
<% 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>
|
||||
<%= f.fields_for :name_translations do |name| %>
|
||||
<%= f.label t("gallery.album_name") %>
|
||||
<div class="inputui rginput rgih26 w380">
|
||||
<%= name.text_field locale, :value => (@album_name[locale]), :class => "txtchange" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</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>
|
||||
<%= link_to panel_gallery_back_end_album_image_path(image) do %>
|
||||
<img src="<%= image.file.thumb.url %>" />
|
||||
<% end %>
|
||||
<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.hidden_field :id, :value => (image.id) %>
|
||||
<%= j.fields_for :description_translations do |desc| %>
|
||||
<%= desc.text_area locale, :value => (image.description_translations[locale] rescue nil ), :class => "txtchange" %>
|
||||
<%= desc.text_area locale, :value => (image.description_translations[locale] rescue nil), :class => "txtchange" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="edit_fn">
|
||||
<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 %>
|
||||
|
@ -55,18 +61,14 @@
|
|||
<% 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 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>
|
||||
<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>
|
||||
<%= f.submit t('gallery.save'), :class=>'bt-save icon-ok btn btn-primary pull-right', :style=>"display:none;" %>
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
||||
</div>
|
||||
<!-- tag part -->
|
||||
<div id="tag_panel" class="my_scroll">
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
<div class="form-actions form-fixed pagination-right rghead">
|
||||
<div class="rgfn">
|
||||
<% 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>
|
||||
<a class="btn btn-primary pull-right" title="<%= I18n.t("gallery.add_album") %>" href="<%= new_panel_gallery_back_end_album_path %>" onclick="return false;"><i class="icon-plus icon-white"></i><%= I18n.t("gallery.add_album") %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -59,18 +59,12 @@
|
|||
<!-- 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-back btn btn-primary pull-left" title="<%= I18n.t("gallery.back_to_albums") %>" href="<%= panel_gallery_back_end_albums_path %>"><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 %>
|
||||
<a class="bt-edit btn btn-primary pull-right" title="<%= I18n.t("gallery.edit") %>" href="<%= edit_panel_gallery_back_end_album_path(@album) %>" ><i class="icon-pencil icon-white"></i><%= I18n.t("gallery.edit") %></a>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,38 +2,22 @@ Rails.application.routes.draw do
|
|||
namespace :panel do
|
||||
namespace :gallery do
|
||||
namespace :back_end do
|
||||
# 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"
|
||||
match "save_tags" => "tags#save_tags"
|
||||
match "albums/save_tags" => "tags#save_tags"
|
||||
|
||||
resources :albums do
|
||||
match "set_cover" => "albums#set_cover"
|
||||
match "get_images" => "albums#get_images"
|
||||
match "imgs" => "albums#imgs"
|
||||
match "upload_panel" => "albums#upload_panel"
|
||||
|
||||
end
|
||||
resources :album_images do
|
||||
# match "delete" => "album_images#destroy"
|
||||
match "images_tags" => "albums#images_tags"
|
||||
end
|
||||
|
||||
resources :album_images
|
||||
resources :gallery_categories
|
||||
|
||||
resources :tags
|
||||
|
||||
end
|
||||
namespace :front_end do
|
||||
match "orbit_galleries" => "orbit_galleries#index"
|
||||
|
|
Reference in New Issue