effective_committees 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/admin/committee_files_controller.rb +22 -0
- data/app/datatables/admin/effective_committee_files_datatable.rb +34 -0
- data/app/views/admin/committee_folders/_form.html.haml +10 -1
- data/config/routes.rb +3 -1
- data/lib/effective_committees/version.rb +1 -1
- metadata +3 -3
- /data/app/assets/javascripts/{effective_committeesjs → effective_committees.js} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 88699e598899856a5e8ae15e693d7fc08516882f4f7cce171fb9b6cb8ef378a6
|
|
4
|
+
data.tar.gz: 2cf89c73550ec570c80e60ebe46dde173b3af8f7d8b558566e96a6e747c7f5d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b5b426c3d662e6d195a47e3d6a0543d161ef1d8cbf02ecf475ce89a4c01a283fd7fcb6d233fae69654defe300dda54da89cfc760c1a19bd85f4de70496222707
|
|
7
|
+
data.tar.gz: 90fcfdb34ad42faf64387bd98d9f35d14883b0a28748dae82d4134c33152b3d72c43d98eb1fbb0ac8001b6fd797645e47c21d1b3fea7029ecff8ca2ca8f7ad9e
|
|
@@ -5,6 +5,28 @@ module Admin
|
|
|
5
5
|
|
|
6
6
|
include Effective::CrudController
|
|
7
7
|
|
|
8
|
+
def bulk_move
|
|
9
|
+
committee_folder = Effective::CommitteeFolder.find_by_id(params[:committee_folder_id])
|
|
10
|
+
committee_files = Effective::CommitteeFile.sorted.where(id: params[:ids])
|
|
11
|
+
original_folder = Effective::CommitteeFolder.find_by_id(committee_files.first.committee_folder_id)
|
|
12
|
+
|
|
13
|
+
# Update the position of the files in the new folder
|
|
14
|
+
position = (committee_folder.committee_files.map { |file| file.position }.compact.max || -1) + 1
|
|
15
|
+
|
|
16
|
+
committee_files.each_with_index do |committee_file, index|
|
|
17
|
+
committee_file.update!(committee_folder: committee_folder, position: position + index)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Update the position of the files in the original folder
|
|
21
|
+
original_folder.committee_files.each_with_index do |committee_file, index|
|
|
22
|
+
committee_file.update!(position: index)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
render json: { status: 200, message: "Successfully moved #{committee_files.length} files to #{committee_folder.title}" }
|
|
26
|
+
rescue => e
|
|
27
|
+
render json: { status: 500, message: "Unable to move files: #{e.message}" }
|
|
28
|
+
end
|
|
29
|
+
|
|
8
30
|
private
|
|
9
31
|
|
|
10
32
|
def permitted_params
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
module Admin
|
|
2
2
|
class EffectiveCommitteeFilesDatatable < Effective::Datatable
|
|
3
|
+
bulk_actions do
|
|
4
|
+
committee_folder.parents.each do |committee_folder|
|
|
5
|
+
bulk_action(
|
|
6
|
+
"Move to #{committee_folder.title}",
|
|
7
|
+
effective_committees.bulk_move_admin_committee_files_path(committee_folder_id: committee_folder.id),
|
|
8
|
+
data: { confirm: "Move selected files to #{committee_folder.title}?" }
|
|
9
|
+
)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
if committee_folder.committee_folder.present? && committee_folder.committee_folders.present?
|
|
13
|
+
bulk_action_divider
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
committee_folder.children.each do |committee_folder|
|
|
17
|
+
bulk_action(
|
|
18
|
+
"Move to #{committee_folder.title}",
|
|
19
|
+
effective_committees.bulk_move_admin_committee_files_path(committee_folder_id: committee_folder.id),
|
|
20
|
+
data: { confirm: "Move selected files to #{committee_folder.title}?" }
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
3
25
|
datatable do
|
|
4
26
|
reorder :position
|
|
5
27
|
|
|
28
|
+
if attributes[:committee_folder_id].present?
|
|
29
|
+
bulk_actions_col
|
|
30
|
+
end
|
|
31
|
+
|
|
6
32
|
col :updated_at, visible: false
|
|
7
33
|
col :created_at, visible: false
|
|
8
34
|
|
|
@@ -28,5 +54,13 @@ module Admin
|
|
|
28
54
|
Effective::CommitteeFile.deep.all
|
|
29
55
|
end
|
|
30
56
|
|
|
57
|
+
def committee_folder
|
|
58
|
+
if attributes[:committee_folder_id].present?
|
|
59
|
+
@committee_folder ||= Effective::CommitteeFolder.find_by_id(attributes[:committee_folder_id])
|
|
60
|
+
else
|
|
61
|
+
@committee_folder ||= Effective::CommitteeFolder.new
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
31
65
|
end
|
|
32
66
|
end
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
+
- if committee_folder.persisted?
|
|
2
|
+
%p= admin_committees_parents(committee_folder)
|
|
3
|
+
|
|
1
4
|
= tabs do
|
|
2
5
|
- if committee_folder.persisted?
|
|
3
6
|
= tab 'Folder' do
|
|
4
7
|
%h3 Folders
|
|
8
|
+
%p.text-muted
|
|
9
|
+
%small Refresh the page after creating a new folder to move files to it.
|
|
10
|
+
|
|
5
11
|
- datatable = Admin::EffectiveCommitteeFoldersDatatable.new(committee_folder: committee_folder, committee: committee_folder.committee)
|
|
6
12
|
= render_datatable(datatable, inline: true, simple: true)
|
|
7
13
|
|
|
8
14
|
%h3 Files
|
|
15
|
+
%p.text-muted
|
|
16
|
+
%small Select the files, then use the Bulk Actions dropdown to move them to another folder
|
|
17
|
+
|
|
9
18
|
.mt-4= render('admin/committee_folders/form_bulk_upload', committee_folder: committee_folder)
|
|
10
19
|
|
|
11
20
|
- datatable = Admin::EffectiveCommitteeFilesDatatable.new(committee_folder: committee_folder, committee: committee_folder.committee)
|
|
12
|
-
= render_datatable(datatable, inline: true
|
|
21
|
+
= render_datatable(datatable, inline: true)
|
|
13
22
|
|
|
14
23
|
= tab 'Folder Details' do
|
|
15
24
|
= render 'admin/committee_folders/form_committee_folder', committee_folder: committee_folder
|
data/config/routes.rb
CHANGED
|
@@ -23,7 +23,9 @@ EffectiveCommittees::Engine.routes.draw do
|
|
|
23
23
|
resources :committees, except: [:show]
|
|
24
24
|
resources :committee_members, except: [:show]
|
|
25
25
|
resources :committee_folders, except: [:show]
|
|
26
|
-
resources :committee_files, except: [:show]
|
|
26
|
+
resources :committee_files, except: [:show] do
|
|
27
|
+
post :bulk_move, on: :collection
|
|
28
|
+
end
|
|
27
29
|
end
|
|
28
30
|
|
|
29
31
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: effective_committees
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Code and Effect
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -175,8 +175,8 @@ files:
|
|
|
175
175
|
- README.md
|
|
176
176
|
- Rakefile
|
|
177
177
|
- app/assets/config/effective_committees_manifest.js
|
|
178
|
+
- app/assets/javascripts/effective_committees.js
|
|
178
179
|
- app/assets/javascripts/effective_committees/base.js
|
|
179
|
-
- app/assets/javascripts/effective_committeesjs
|
|
180
180
|
- app/assets/stylesheets/effective_committees.scss
|
|
181
181
|
- app/assets/stylesheets/effective_committees/base.scss
|
|
182
182
|
- app/controllers/admin/committee_files_controller.rb
|
|
File without changes
|