front ends updates
This commit is contained in:
parent
a42a651f90
commit
3749e919cb
|
@ -51,7 +51,8 @@ class PagesController < ApplicationController
|
|||
options = ''
|
||||
options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
|
||||
options << "&preview=#{params[:preview]}" unless params[:preview].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}preview=#{params[:preview]}" unless params[:preview].blank?
|
||||
options << "#{options.blank? ? '?' : '&'}controller_action=#{params[:controller_action]}" unless params[:controller_action].blank?
|
||||
redirect_to(url + options) unless save_from_no_lang_for_page
|
||||
end
|
||||
|
||||
|
|
|
@ -227,7 +227,7 @@ Orbit::Application.routes.draw do
|
|||
|
||||
match '/desktop/temp_func/'=>'desktop#temp_func'
|
||||
|
||||
match '/panel/:app_name/front_end/:app_action/:id' => 'pages#show_from_link', :constraints => lambda { |request|
|
||||
match '/panel/:app_name/front_end/:app_action/:id/*controller_action' => 'pages#show_from_link', :constraints => lambda { |request|
|
||||
!request.query_string.include?("inner=true")
|
||||
}
|
||||
|
||||
|
|
|
@ -189,6 +189,7 @@ module ParserCommon
|
|||
if (content["main"] == "true" && !page.module_app.nil?)
|
||||
ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}"
|
||||
ret << "/#{params[:id]}" if params[:id] && !params[:id].eql?(page.id.to_s)
|
||||
ret << "/#{params[:controller_action]}" if params[:controller_action] && params[:id]
|
||||
ret << "?inner=true&page_id=#{page.id}&category_id=#{category}&tag_id=#{tag}&preview=#{params[:preview]}&page_main=#{params[:page_main]}&search_query=#{params[:search_query]}&name=#{params[:name]}"
|
||||
ret << "'></div>"
|
||||
else
|
||||
|
|
|
@ -568,36 +568,7 @@ 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;
|
||||
// }
|
||||
// })
|
||||
// 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();
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// })
|
||||
|
||||
}
|
||||
g.albumArea.addClass('o_album_edit');
|
||||
var imageTagArray = null;
|
||||
|
|
|
@ -28,7 +28,6 @@ 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('=');
|
||||
|
@ -46,7 +45,7 @@ var galleryAPI = function(){
|
|||
}else{
|
||||
var cids = "all";
|
||||
}
|
||||
$.getJSON("panel/gallery/front_end/get_albums",{cid:cids,tid:tids,"inner":true},function(categories){
|
||||
$.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') %>")
|
||||
|
@ -70,7 +69,7 @@ var galleryAPI = function(){
|
|||
this.loadImages = function(id){
|
||||
g.albumArea.addClass('o_album');
|
||||
g.albumArea.find("#imgholder").empty();
|
||||
$.getJSON("panel/gallery/front_end/albums/"+id+"/imgs",function(album){
|
||||
$.getJSON("panel/gallery/front_end/albums/"+id+"/imgs",{inner:true},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') %>")
|
||||
|
@ -82,7 +81,7 @@ var galleryAPI = function(){
|
|||
this.loadTheater = function(id){
|
||||
var imageArray;
|
||||
var imagecount = 0;
|
||||
var picHeight = 0;
|
||||
// var picHeight = 0;
|
||||
var bindHandlers = function(){
|
||||
var $slidelist = $('.slidelist'),
|
||||
$rslide = $('.rslide'),
|
||||
|
@ -90,26 +89,9 @@ var galleryAPI = function(){
|
|||
$img = $("#main_pic img"),
|
||||
wHeight = $(window).height();
|
||||
|
||||
$("#main_pic").height(picHeight);
|
||||
$("#main_pic").height("auto");
|
||||
$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;
|
||||
if(tags.length > 0 && g.tagList.find("li").length == 0){
|
||||
|
@ -131,29 +113,8 @@ var galleryAPI = function(){
|
|||
g.tagList.find("input").attr("checked",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(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 ){
|
||||
|
@ -235,7 +196,7 @@ var galleryAPI = function(){
|
|||
$rslide.removeClass("fullscreen");
|
||||
$(".slidectrl .browserfullscreen").hide();
|
||||
$img.css({"padding":""})
|
||||
$("#main_pic").height(picHeight );
|
||||
$("#main_pic").height("auto");
|
||||
}else{
|
||||
$("#main_pic").height(wHeight);
|
||||
// $img.height("100%");
|
||||
|
@ -249,7 +210,7 @@ var galleryAPI = function(){
|
|||
var pageurl = dom.attr('href');
|
||||
|
||||
$img.fadeOut(200,function(){
|
||||
$img.attr({"src":dom.attr("data-content"),"height":picHeight+"px"});
|
||||
$img.attr({"src":dom.attr("data-content"),"height":"auto"});
|
||||
$img.fadeIn(200);
|
||||
if($rslide.hasClass("fullscreen")){
|
||||
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||
|
@ -257,7 +218,9 @@ var galleryAPI = function(){
|
|||
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||
$slidelist.find("ul").hide();
|
||||
if(rcom.getInternetExplorerVersion() == -1){
|
||||
|
||||
if(pageurl!=window.location){
|
||||
pageurl = "gallery?id="+pageurl+"&controller_action=theater";
|
||||
window.history.pushState({path:pageurl},'',pageurl);
|
||||
}
|
||||
}else{
|
||||
|
@ -292,7 +255,7 @@ var galleryAPI = function(){
|
|||
}
|
||||
|
||||
var preparestage = function(albumid){
|
||||
$.getJSON("../"+albumid+"/imgs",function(album){
|
||||
$.getJSON("panel/gallery/front_end/albums/"+albumid+"/imgs",{"inner":true},function(album){
|
||||
imageArray = eval(album.images);
|
||||
$.each(album.images,function(i,image){
|
||||
if(image._id == id)
|
||||
|
@ -316,148 +279,11 @@ var galleryAPI = function(){
|
|||
}
|
||||
|
||||
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());
|
||||
// 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");
|
||||
$(this).addClass("setcover");
|
||||
$.post("set_cover",{"imageid":$(this).attr("href"),"aid":id},function(){})
|
||||
})
|
||||
$(".description_loader .edit_fn .bt-dels").click(function(){
|
||||
$(this)
|
||||
.toggleClass("setdelete btn-danger active")
|
||||
.find('span').toggleClass('icon-white');
|
||||
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 .en .txtchange").each(function(){
|
||||
// var thisid = $(this).attr("for");
|
||||
// dataArray.push({"id":thisid,"text":{"en":$(this).val(),"zh_tw":$(".description_loader .zh_tw .txtchange[for="+thisid+"]").val()}});
|
||||
// })
|
||||
// var albumnm = Array();
|
||||
// $(".albumname_edit .txtchange").each(function(){
|
||||
// albumnm.push($(this).val())
|
||||
// })
|
||||
// var dataArray = $("form#edit_album").serialize();
|
||||
// $.post("update_album",{"data":dataArray},function(){
|
||||
|
||||
// })
|
||||
|
||||
})
|
||||
$('.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(imageArray[imagecount]._id,g.loadArea);
|
||||
})
|
||||
var tempval;
|
||||
$(".txtchange").focus(function(){
|
||||
tempval = $(this).val();
|
||||
}).keyup(function(){
|
||||
if($(this).val() != tempval)
|
||||
g.albumArea.find(".rghead .rgfn .bt-save").show();
|
||||
})
|
||||
g.albumArea.find(".rghead .rgfn .bt-delete").click(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(){
|
||||
if($(this).hasClass("setdelete")){
|
||||
images_to_delete.push($(this).attr("href"));
|
||||
doms_to_delete.push($(this).parent().parent());
|
||||
if(thiscover == $(this).attr("href"))
|
||||
delete_cover = true;
|
||||
}
|
||||
})
|
||||
if(confirm("Deleting "+images_to_delete.length+" image(s)?")){
|
||||
$.post("delete_images",{"images":images_to_delete,"delete_cover":delete_cover,"aid":id},function(response){
|
||||
if(response.success){
|
||||
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');
|
||||
g.albumArea.css("margin-top","");
|
||||
var head ='<a href="orbit_gallery?album='+id+'" class="bt-back btn pull-left" title="<%= I18n.t("gallery.back_to_photos") %>"><i class="icon-arrow-left icon-black"></i><%= I18n.t("gallery.back_to_photos") %></a></div>';
|
||||
head+='<a class="bt-del bt-delete btn btn-primary pull-right" onclick="return false;" style="display:none;" title="<%= I18n.t("gallery.delete_selected") %>" href=""><i class="icon-trash icon-white"></i><%= I18n.t("gallery.delete_selected") %></a>';
|
||||
head+='<a class="bt-save btn btn-primary pull-right" onclick="return false;" style="display:none;" title="Save" href=""><i class="icon-ok icon-white"></i>Save</a>';
|
||||
g.albumArea.find(".rghead .rgfn").html(head);
|
||||
g.albumArea.find("#imgholder").load("edit_album?aid="+id,function(data,response,xhr){
|
||||
if(xhr.status == 404){
|
||||
$(this).text("<%= I18n.t('gallery.album_not_found') %>");
|
||||
return false;
|
||||
}
|
||||
bindHandlers();
|
||||
})
|
||||
}
|
||||
this.saveTags = function(id,tagsfor){
|
||||
var tagids = new Array();
|
||||
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";
|
||||
|
|
|
@ -12,24 +12,6 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
|||
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"]
|
||||
|
@ -81,7 +63,7 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
|||
|
||||
|
||||
def imgs
|
||||
@album = GalleryAlbum.find(params[:album_id])
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@images = @album.gallery_images.all
|
||||
@output = Array.new
|
||||
@images.each do |values|
|
||||
|
@ -106,7 +88,7 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
|||
|
||||
def theater
|
||||
@tags = GalleryTag.all
|
||||
@image = GalleryImage.find(params[:album_id])
|
||||
@image = GalleryImage.find(params[:id])
|
||||
@albumid = @image.gallery_album_id
|
||||
@album = GalleryAlbum.find(@albumid)
|
||||
@images = @album.gallery_images.all
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</div>
|
||||
<!-- tag part -->
|
||||
<div class="taglist">
|
||||
<h3 class="taglist_title"><%= t('gallery.album_tag') %></h3>
|
||||
<h3 class="taglist_title"><%= t('gallery.photo_tag') %></h3>
|
||||
<ul>
|
||||
|
||||
</ul>
|
||||
|
@ -40,14 +40,14 @@
|
|||
<!-- 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>
|
||||
<a class="bt-back rgbt" title="<%= I18n.t("gallery.back_to_albums") %>" href="gallery?id=<%= @albumid %>"><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 "jquery.tinyscrollbar" %>
|
||||
<%= javascript_include_tag "rss" %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
</div>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "galleryAPI" %>
|
||||
<%= javascript_include_tag "jquery.tinyscrollbar" %>
|
||||
<% end %>
|
||||
<div class="taglist"> <!-- add "album_tags" or "photo_tags" class to .taglist -->
|
||||
|
|
|
@ -41,11 +41,11 @@ Rails.application.routes.draw do
|
|||
# match "delete_images" => "orbit_galleries#delete_images"
|
||||
# match "update_album" => "orbit_galleries#update_album"
|
||||
# match "save_tags" => "orbit_galleries#save_tags"
|
||||
match "theater/:id" => "albums#theater"
|
||||
|
||||
resources :albums do
|
||||
match "imgs" => "albums#imgs"
|
||||
|
||||
member do
|
||||
get "imgs"
|
||||
get "theater"
|
||||
end
|
||||
end
|
||||
resources :album_images
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue