changed the frontend loading to more rails specific. and also fixed the filter reload in thumbnali and summary view of members
Conflicts: vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/index.html.erb vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/show.html.erb
This commit is contained in:
parent
3f2c729528
commit
9ea8b536b5
|
@ -25,12 +25,12 @@
|
|||
<ul class="nav nav-pills filter-nav pull-right">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filter-group accordion-group">
|
||||
<div class="accordion-body collapse" id="collapse-status">
|
||||
<div class="accordion-body collapse" id="collapse-role">
|
||||
|
||||
<%= render :partial => "filter"%>
|
||||
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
<ul class="nav nav-pills filter-nav pull-right">
|
||||
<li class="accordion-group">
|
||||
<div class="accordion-heading">
|
||||
<a href="#collapse-status" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
<a href="#collapse-role" data-toggle="collapse" data-parent="#filter" class="accordion-toggle">Roles</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="filter-group accordion-group">
|
||||
<div class="accordion-body collapse" id="collapse-status">
|
||||
<div class="accordion-body collapse" id="collapse-role">
|
||||
|
||||
<%= render :partial => "filter"%>
|
||||
|
||||
|
|
|
@ -32,73 +32,8 @@ var galleryAPI = function(){
|
|||
}
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
//bindHandlers();
|
||||
})
|
||||
var bindHandlers = function(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.loadAlbums = function(id){
|
||||
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"){
|
||||
var cids = [];
|
||||
var tids = [];
|
||||
var href = null;
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
for(var i = 0; i < hashes.length; i++){
|
||||
hash = hashes[i].split('=');
|
||||
if(hash[0]=="cat"){
|
||||
cids.push(hash[1]);
|
||||
href = "cat="+hash[1];
|
||||
}else if(hash[0]=="tag"){
|
||||
tids.push(hash[1]);
|
||||
href = "tag="+hash[1];
|
||||
}
|
||||
$("#filter .filter_btns a[href='"+href+"']").addClass("active");
|
||||
}
|
||||
if(cids.length == 0)
|
||||
cids = "all";
|
||||
}else{
|
||||
var cids = "all";
|
||||
}
|
||||
$.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.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.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);
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
this.loadImages = function(id){
|
||||
g.albumArea.addClass('o_album');
|
||||
g.albumArea.find("#imgholder").empty();
|
||||
$.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') %>")
|
||||
var $img = $("<div class='rgphoto'><a title='"+image.description+"' href='"+image.theater_link+"'><img src='"+thumb+"'/></a></div>");
|
||||
g.albumArea.find("#imgholder").append($img);
|
||||
})
|
||||
})
|
||||
}
|
||||
this.loadTheater = function(id){
|
||||
var imageArray;
|
||||
var imagecount = 0;
|
||||
|
|
|
@ -1,55 +1,11 @@
|
|||
class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController
|
||||
def index
|
||||
@albums = GalleryAlbum.where(:category_id.in => params[:category_id])
|
||||
end
|
||||
|
||||
def show
|
||||
@album = GalleryAlbum.find(params[:id])
|
||||
@tags = Tag.find(@album.tagged_ids).map{|t| t.name}
|
||||
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(tagged_ids: tag)
|
||||
end
|
||||
else
|
||||
@albums << GalleryAlbum.where(tagged_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(tagged_ids: tag)
|
||||
end
|
||||
else
|
||||
@albums << category.gallery_albums.where(tagged_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 = Tag.find(values.tagged_ids).map{|t| t.name}
|
||||
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
|
||||
@images = @album.gallery_images
|
||||
end
|
||||
|
||||
def imgs
|
||||
|
|
14
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_album.html.erb
vendored
Normal file
14
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_album.html.erb
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
<div class='rgalbum'>
|
||||
<a title='<%= album.name %>' href='<%= panel_gallery_front_end_album_path(album) %>'>
|
||||
<% if album.cover == "default" %>
|
||||
<%= image_tag "gallery/default.jpg" %>
|
||||
<% else %>
|
||||
<img src="<%= album.cover_path %>">
|
||||
<% end %>
|
||||
</a>
|
||||
<span class='albumname'>
|
||||
<a title='<%= album.description %>' href='<%= panel_gallery_front_end_album_path(album) %>'><%= album.name %></a>
|
||||
</span>
|
||||
<span class='categoryname'><i class='icon-folder-close'></i><%= Category.find(album.category_id).title %></span>
|
||||
<span class='tagnames'></span>
|
||||
</div>
|
5
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_image.html.erb
vendored
Normal file
5
vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_image.html.erb
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<div class='rgphoto'>
|
||||
<a title='<%= image.description %>' href='<%= theater_panel_gallery_front_end_album_path(image) %>'>
|
||||
<img src='<%= image.file.thumb.url %>'/>
|
||||
</a>
|
||||
</div>
|
|
@ -1,42 +1,14 @@
|
|||
|
||||
|
||||
<%= stylesheet_link_tag "gallery_frontend" %>
|
||||
|
||||
<%#= stylesheet_link_tag "gallery" %>
|
||||
<div id="orbit_gallery" class="rg">
|
||||
|
||||
<div class="rgbody">
|
||||
<div id="imgholder">
|
||||
|
||||
<% @albums.each do |album| %>
|
||||
<%= render :partial => "album", :object => album %>
|
||||
<% end %>
|
||||
</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";
|
||||
gallery.loadAlbums("all");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
@ -1,45 +1,12 @@
|
|||
|
||||
<%= stylesheet_link_tag "gallery_frontend" %>
|
||||
|
||||
<div id="orbit_gallery" class="rg">
|
||||
<div class="rgbody">
|
||||
<div id="imgholder">
|
||||
|
||||
<% @images.each do |image| %>
|
||||
<%= render :partial => "image", :object => image %>
|
||||
<% end %>
|
||||
</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="<%= panel_gallery_front_end_albums_path %>"><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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue