View only update
This commit is contained in:
parent
33bc430df5
commit
99096c4ac0
|
@ -1,7 +1,3 @@
|
|||
<%# encoding: utf-8 %>
|
||||
// refresh the imagesArray
|
||||
// viewonly tags
|
||||
|
||||
$.extend($.expr[':'], {
|
||||
'containsi': function (elem, i, match, array) {
|
||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||
|
@ -302,10 +298,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();
|
||||
|
@ -326,7 +336,12 @@ var galleryAPI = function(){
|
|||
}
|
||||
})
|
||||
g.albumArea.find("#tag_panel .bt-save").click(function(){
|
||||
g.saveTags(imageArray[imagecount]._id,g.loadArea);
|
||||
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"));
|
||||
})
|
||||
imageArray[imagecount].tag_ids = tagids;
|
||||
})
|
||||
$(".slidectrl a.togglelist").click(function(){
|
||||
var rslide_h = $rslide.outerHeight();
|
||||
|
@ -381,8 +396,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;
|
||||
|
@ -522,11 +543,8 @@ var galleryAPI = function(){
|
|||
// })
|
||||
|
||||
})
|
||||
var tag_panel_hidden = true;
|
||||
var last_clicked = null;
|
||||
$('.bt-tag').click(function(){
|
||||
$(this).toggleClass("active");
|
||||
|
||||
var $tag_panel = $('#tag_panel'),
|
||||
tag_panel_position = 0;
|
||||
if( $tag_panel.css('right') == '0px' ){
|
||||
|
@ -557,7 +575,6 @@ var galleryAPI = function(){
|
|||
}else{
|
||||
$("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
|
||||
}
|
||||
|
||||
}else{
|
||||
$("#gallery_tag_list li").slideDown();
|
||||
}
|
||||
|
|
|
@ -460,8 +460,8 @@ var galleryAPI = function(){
|
|||
g.loadFooterPanel(g.loadArea,id,function(head){
|
||||
head = $(head);
|
||||
g.albumArea.find(".rghead .rgfn").html(head);
|
||||
g.albumArea.find(".bt-back").attr("href","orbit_gallery?album="+albumid);
|
||||
g.albumArea.find(".bt-edit").attr("href","orbit_gallery?edit="+albumid);
|
||||
g.albumArea.find(".bt-back").attr("href","gallery?album="+albumid);
|
||||
|
||||
})
|
||||
g.albumArea.css("margin-bottom","0");
|
||||
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
class Panel::Gallery::BackEnd::OrbitGalleriesController < OrbitBackendController
|
||||
include AdminHelper
|
||||
@authenticated = false
|
||||
|
||||
def index
|
||||
if is_manager? || is_admin? || is_sub_manager?
|
||||
@authenticated = false #turn this value to false for view only
|
||||
@authenticated = true #turn this value to false for view only
|
||||
else
|
||||
@authenticated = false
|
||||
end
|
||||
|
@ -135,10 +135,13 @@ 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}
|
||||
end
|
||||
if is_manager? || is_admin? || is_sub_manager?
|
||||
@authenticated = true #turn this value to false for view only
|
||||
else
|
||||
@authenticated = false
|
||||
end
|
||||
if @authenticated
|
||||
render :json=>{"images" => @output, "tags" => @album.tag_ids}.to_json
|
||||
else
|
||||
|
|
Reference in New Issue