diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b457b74d7..733bbac53 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -238,7 +238,7 @@ class ApplicationController < ActionController::Base redirect_to ret end - def get_sorted_and_filtered(object_class, query = nil, objects = nil) + def get_sorted_and_filtered(object_class, query = nil, objects = nil, pagination = true) if params[:filter] || params[:sort] || params[:new_filter] @filter = params[:filter] new_filter = params[:new_filter] @@ -345,7 +345,12 @@ class ApplicationController < ActionController::Base if (!user_signed_in? && object_class == "bulletin") objects = get_bulletins_for_open_backend(objects) end - Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10) + + if pagination + Kaminari.paginate_array(filter_authorized_objects(objects)).page(params[:page]).per(10) + else + filter_authorized_objects(objects) + end end def get_bulletins_for_open_backend(objects) diff --git a/app/controllers/default_widget_controller.rb b/app/controllers/default_widget_controller.rb index f79e513a5..60a252e76 100644 --- a/app/controllers/default_widget_controller.rb +++ b/app/controllers/default_widget_controller.rb @@ -99,7 +99,7 @@ class DefaultWidgetController< OrbitWidgetController end def get_filter_data - model = eval(@default_widget["query"]) + model = @default_widget["query"].classify.constantize if params[:filter_category_id].is_a? Array data = model.where(:category_id.in => params[:filter_category_id]) elsif params[:filter_category_id].is_a? String diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index febe7de86..999fdbce2 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -96,6 +96,7 @@ class PagesController < ApplicationController options << "#{options.blank? ? '?' : '&'}preview=#{params[:preview]}" unless params[:preview].blank? options << "#{options.blank? ? '?' : '&'}controller_action=#{params[:controller_action]}" unless params[:controller_action].blank? options << "#{options.blank? ? '?' : '&'}clicked_field_name=#{params[:clicked_field_name]}" unless params[:clicked_field_name].blank? + options << "#{options.blank? ? '?' : '&'}image_id=#{params[:image_id]}" unless params[:image_id].blank? redirect_to(url + options) unless save_from_no_lang_for_page end @@ -187,12 +188,9 @@ class PagesController < ApplicationController @item = Item.where(:category => category_ids).first else if params[:action] && params[:action] == "show_from_link" - default_widget = module_app.get_default_widget - if !default_widget.blank? - model = eval(params[:app_action].classify.constantize) + model = params[:app_action].classify.constantize item = model.find(params[:id]) @item = Item.where(:category => [item.category_id.to_s]).first - end end end diff --git a/lib/tasks/gallery.rake b/lib/tasks/gallery.rake new file mode 100644 index 000000000..aa966f1eb --- /dev/null +++ b/lib/tasks/gallery.rake @@ -0,0 +1,23 @@ +namespace :gallery do + task :migrate_albums => :environment do + @albums = GalleryAlbum.all + @albums.each do |album| + newalbum = Album.new + newalbum.name = album.name + newalbum.description = album.description + newalbum.cover = album.cover + newalbum.cover_path = album.cover_path + newalbum.tag_names = album.tag_names + newalbum.category_id = album.category_id + newalbum.save! + @images = album.gallery_images + @images.each do |image| + img = newalbum.album_images.new + img.title = image.title + img.description = image.description + img.file = image.file + img.save! + end + end + end +end \ No newline at end of file diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb index d4e5a6188..3d0f0f3f8 100644 --- a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js.erb @@ -228,8 +228,8 @@ var galleryAPI = function(){ next = imagecount + 1; prev = imagecount - 1; } - $(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.url}); - $(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.url}); + $(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.theater.url}); + $(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.theater.url}); }; if(imageArray.length > 1) updateNavigation(); 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 35d584e33..0a0cac306 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 @@ -19,7 +19,7 @@ var galleryAPI = function(){ if(photo_id){ var params = rcom.getUrlVars(); var url = window.location.href.split("?")[0]; - params["id"] = photo_id; + params["image_id"] = photo_id; for(i=0;i 1) updateNavigation(); diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb index ad5bc97c8..fd27850da 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb @@ -14,6 +14,7 @@ class Panel::Gallery::BackEnd::AlbumsController < OrbitBackendController @tags = get_tags category_ids = @categories.collect{|t| t.id} @albums = get_sorted_and_filtered("album", :category_id.in => category_ids) + end def show 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 d8375af86..adefd03a4 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 @@ -37,7 +37,7 @@ class Panel::Gallery::FrontEnd::AlbumsController < OrbitWidgetController end def theater - @image = AlbumImage.find(params[:id]) + @image = AlbumImage.find(params[:image_id]) @albumid = @image.album_id @album = Album.find(@albumid) @images = @album.album_images.all diff --git a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/widget/albums_controller.rb b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/widget/albums_controller.rb index 5c974815b..060520a77 100644 --- a/vendor/built_in_modules/gallery/app/controllers/panel/gallery/widget/albums_controller.rb +++ b/vendor/built_in_modules/gallery/app/controllers/panel/gallery/widget/albums_controller.rb @@ -24,18 +24,18 @@ class Panel::Gallery::Widget::AlbumsController < OrbitWidgetController if !@randoms.include?r @randoms << r image = @album_images[r] - values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url} + values = {"show_link"=>theater_panel_gallery_front_end_album_path(@album,:image_id=>image),"thumb"=>image.file.thumb.url} @images << values end end elsif @album_images.count == @total @album_images.each do |image| - values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url} + values = {"show_link"=>theater_panel_gallery_front_end_album_path(@album,:image_id=>image),"thumb"=>image.file.thumb.url} @images << values end else @album_images.each do |image| - values = {"show_link"=>theater_panel_gallery_front_end_album_path(image),"thumb"=>image.file.thumb.url} + values = {"show_link"=>theater_panel_gallery_front_end_album_path(@album,:image_id=>image),"thumb"=>image.file.thumb.url} @images << values end until @images.count == @total do diff --git a/vendor/built_in_modules/gallery/app/uploaders/gallery_uploader.rb b/vendor/built_in_modules/gallery/app/uploaders/gallery_uploader.rb index f5f0b78da..31c083163 100644 --- a/vendor/built_in_modules/gallery/app/uploaders/gallery_uploader.rb +++ b/vendor/built_in_modules/gallery/app/uploaders/gallery_uploader.rb @@ -53,6 +53,10 @@ class GalleryUploader < CarrierWave::Uploader::Base process :resize_to_fill => [200, 200] end + version :theater do + process :resize_to_limit => [1920, 1080] + end + # Add a white list of extensions which are allowed to be uploaded. # For images you might use something like this: # def extension_white_list diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/show.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/show.html.erb index 25553aa69..6079601ea 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/show.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/back_end/album_images/show.html.erb @@ -6,7 +6,7 @@
-
+
Prev Next @@ -15,7 +15,7 @@
@@ -30,34 +30,6 @@
- - <% if is_admin? %> - - -
-
-
-
-
-
-
-
- <% - @locales = Array.new - @site_valid_locales.each do |locale| - @locales << locale - end - %> - - <%# if @authenticated %> - - <%# end %> - -
- - <%end%> - -
<%= link_to (content_tag(:i,I18n.t("gallery.back_to_photos"),:class=>"icon-arrow-left icon-black")),"",:class=>"bt-back btn pull-left btn-primary",:title=>I18n.t("gallery.back_to_photos")%> 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 index 304b942f4..cc63575e3 100644 --- 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 @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/theater.html.erb b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/theater.html.erb index 854e36254..d89d1914a 100644 --- a/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/theater.html.erb +++ b/vendor/built_in_modules/gallery/app/views/panel/gallery/front_end/albums/theater.html.erb @@ -6,7 +6,7 @@
-
+
Prev Next @@ -15,7 +15,7 @@
@@ -58,7 +58,7 @@ var gallery = new galleryAPI(); gallery.initialize(); gallery.loadArea = "theater"; - gallery.loadTheater("<%= params[:id] %>"); + gallery.loadTheater("<%= params[:id] %>","<%= params[:image_id] %>");