From 6e809ff2b3f30c46649f99f71ec35fe69e592e7d Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Thu, 7 Nov 2013 14:13:55 +0800 Subject: [PATCH] changed the frontend loading to more rails specific. and also fixed the filter reload in thumbnali and summary view of members --- .../index_summary.html.erb | 4 +- .../index_thumbnail.html.erb | 4 +- .../javascripts/galleryAPI_frontend.js.erb | 46 +------------------ .../gallery/front_end/albums_controller.rb | 24 +--------- .../gallery/front_end/albums/_album.html.erb | 14 ++++++ .../gallery/front_end/albums/_image.html.erb | 5 ++ .../gallery/front_end/albums/index.html.erb | 29 ++---------- .../gallery/front_end/albums/show.html.erb | 36 ++------------- 8 files changed, 33 insertions(+), 129 deletions(-) create mode 100644 vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_album.html.erb create mode 100644 vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/_image.html.erb diff --git a/app/views/admin/users_new_interface/index_summary.html.erb b/app/views/admin/users_new_interface/index_summary.html.erb index 0bd2e4305..e54bf86b1 100644 --- a/app/views/admin/users_new_interface/index_summary.html.erb +++ b/app/views/admin/users_new_interface/index_summary.html.erb @@ -25,12 +25,12 @@
-
+
<%= render :partial => "filter"%> diff --git a/app/views/admin/users_new_interface/index_thumbnail.html.erb b/app/views/admin/users_new_interface/index_thumbnail.html.erb index df37ddf57..31fec4e92 100644 --- a/app/views/admin/users_new_interface/index_thumbnail.html.erb +++ b/app/views/admin/users_new_interface/index_thumbnail.html.erb @@ -25,12 +25,12 @@
-
+
<%= 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 374464019..d6eceb271 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,52 +32,8 @@ var galleryAPI = function(){ } } - $(document).ready(function(){ - //bindHandlers(); - }) - var bindHandlers = function(){ - - } + } - } - - this.loadAlbums = function(cids){ - g.albumArea.find(".rghead .rgfn a").click(function(){g.makeNewAlbum($(this).attr("href"))}); - g.albumArea.addClass('o_gallery'); - g.albumArea.find("#imgholder").empty(); - $.getJSON("/panel/gallery/front_end/get_albums",{"cid":cids,"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 = $("
"+album.name+" "+album.category_name+"
"); - else - var $img = $("
"+album.name+" "+album.category_name+"
"); - 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 22e66415b..ec8e8849a 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,31 +1,11 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController def index - @categories = params[:category_id] + @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"] - @albums = Array.new - @albums << GalleryAlbum.where(:category_id.in => @categoryids) - - - @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 = Category.find(values.category_id).title - - @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.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 a99f04aa5..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,35 +1,14 @@ - - <%= stylesheet_link_tag "gallery_frontend" %> -<%#= stylesheet_link_tag "gallery" %> - -<% 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 4f3c9e40c..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,42 +1,12 @@ - <%= stylesheet_link_tag "gallery_frontend" %>
-<% content_for :page_specific_javascript do %> - <%= javascript_include_tag "galleryAPI_frontend" %> - <%#= javascript_include_tag "jquery.tinyscrollbar" %> - <%= javascript_include_tag "rss" %> -<% end %> - - - - - - -