From c577ccfe3b69aa5343def91ca5121ff8e9aac4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Sun, 4 Aug 2024 03:00:00 +0800 Subject: [PATCH] Add select_albums. --- app/controllers/admin/galleries_controller.rb | 5 + .../galleries/_select_albums_form.html.erb | 198 ++++++++++++++++++ .../admin/galleries/select_albums.html.erb | 85 ++++++++ config/routes.rb | 3 + 4 files changed, 291 insertions(+) create mode 100644 app/views/admin/galleries/_select_albums_form.html.erb create mode 100644 app/views/admin/galleries/select_albums.html.erb diff --git a/app/controllers/admin/galleries_controller.rb b/app/controllers/admin/galleries_controller.rb index 9e1f0c4..5be9481 100644 --- a/app/controllers/admin/galleries_controller.rb +++ b/app/controllers/admin/galleries_controller.rb @@ -660,6 +660,11 @@ class Admin::GalleriesController < OrbitAdminController end end + def select_albums + filter_album() + @category_id_albums_maps = @fiter_albums.group_by{|album| album.category_id} + end + private def crop_but_no_backup(image) fname = image.file.path diff --git a/app/views/admin/galleries/_select_albums_form.html.erb b/app/views/admin/galleries/_select_albums_form.html.erb new file mode 100644 index 0000000..d1462dd --- /dev/null +++ b/app/views/admin/galleries/_select_albums_form.html.erb @@ -0,0 +1,198 @@ +<% unless @include_js_css_flag %> + <%= javascript_include_tag "lib/checkbox.card.js" %> + <%= stylesheet_link_tag 'basic/global' %> + <%= stylesheet_link_tag 'member_select' %> + + <% @include_js_css_flag = true %> +<% end %> +<% index = '' unless defined?(index) %> +
+ +
+
+ <% albums.each do |album| %> + + x + <% if album.cover == "default" %> + <%= image_tag "gallery/default.jpg" %> + <% else %> + + <% end %> +

<%= album.name %>

+ <%= hidden_field_tag field, album.id %> +
+ <% end %> +
+ <%= t(:add) %> +
+
+ \ No newline at end of file diff --git a/app/views/admin/galleries/select_albums.html.erb b/app/views/admin/galleries/select_albums.html.erb new file mode 100644 index 0000000..56d106b --- /dev/null +++ b/app/views/admin/galleries/select_albums.html.erb @@ -0,0 +1,85 @@ + + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index fcf9e33..dbdc552 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -76,6 +76,9 @@ Rails.application.routes.draw do get "excel_format" post "importimages" end + collection do + post 'select_albums' + end end resources :images post "galleries/upload_image" => "galleries#upload_image"