<%= render :partial => "filter"%>
diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb
index 0290b50a2..c105ea7c3 100644
--- a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb
+++ b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI_frontend.js.erb
@@ -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 = $("
");
- else
- var $img = $("
");
- var tag_string = "";
- for(tag in album.tag_names){
- if(tag == album.tag_names.length-1)
- tag_string+= '
' + album.tag_names[tag] + '';
- else
- tag_string+= '
' + album.tag_names[tag] + ', ';
- }
- $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 = $("
");
- g.albumArea.find("#imgholder").append($img);
- })
- })
- }
this.loadTheater = function(id){
var imageArray;
var imagecount = 0;
diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb
index 3924ab7e1..b6fab8602 100644
--- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb
+++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/front_end/albums_controller.rb
@@ -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
diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_album.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_album.html.erb
new file mode 100644
index 000000000..0da18169b
--- /dev/null
+++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_album.html.erb
@@ -0,0 +1,14 @@
+
\ No newline at end of file
diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_image.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_image.html.erb
new file mode 100644
index 000000000..304b942f4
--- /dev/null
+++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_image.html.erb
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/index.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/index.html.erb
index 7f7ce0ef8..cdb0669a0 100644
--- a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/index.html.erb
+++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/index.html.erb
@@ -1,42 +1,14 @@
-
-
<%= stylesheet_link_tag "gallery_frontend" %>
-<%#= stylesheet_link_tag "gallery" %>
-
-
+ <% @albums.each do |album| %>
+ <%= render :partial => "album", :object => album %>
+ <% end %>
-
-
-
-
-<% content_for :page_specific_javascript do %>
- <%= javascript_include_tag "galleryAPI_frontend" %>
- <%= javascript_include_tag "jquery.tinyscrollbar" %>
- <%= javascript_include_tag "rss" %>
-<% end %>
-
+
diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/show.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/show.html.erb
index 10520358f..29ffc8cf5 100644
--- a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/show.html.erb
+++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/show.html.erb
@@ -1,45 +1,12 @@
-
<%= stylesheet_link_tag "gallery_frontend" %>
-
+ <% @images.each do |image| %>
+ <%= render :partial => "image", :object => image %>
+ <% end %>
-
-
-
-
<%= t('gallery.album_tag') %>
-
- <% @tags.each do |tag|%>
- - <%= tag %>
- <% end %>
-
-
-
-
-<% content_for :page_specific_javascript do %>
- <%= javascript_include_tag "galleryAPI_frontend" %>
- <%= javascript_include_tag "jquery.tinyscrollbar" %>
- <%= javascript_include_tag "rss" %>
-<% end %>
-
-
-
-
-
-
-