effective_committees 0.5.1 → 0.6.0
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/datatables/admin/effective_committee_files_datatable.rb +2 -0
- data/app/models/effective/committee_file.rb +7 -3
- data/app/views/admin/committee_members/_form_committee_member.html.haml +2 -2
- data/app/views/effective/committees/_dashboard_activity.html.haml +3 -4
- data/app/views/effective/committees/_form.html.haml +1 -1
- data/db/migrate/101_create_effective_committees.rb +2 -0
- data/lib/effective_committees/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 687b287a684219a3c2f0214c4639db991e8a5cb02566179c555326f4436e5a3d
|
4
|
+
data.tar.gz: 28fb6cf8554ada01a148d4ceac2bb2abc453f8a20c8122ba2aee226f95b7c479
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9614f730cfc7c9bf4aa56ceb4363235e8082016273bee4c3623fac416d1ec8cdd9790f3e230bef4b20491c817ad960ff7c38c3341780dbb7136f36721f4fa0a
|
7
|
+
data.tar.gz: 55379c626f837d6ed6f69698c2c7cac186af00d12021c6e1e800dd3caedb39286d66f0896f3f32db6d18e0ec923293693dd7bf0b9cf87c0fbfe6302a1750138f
|
@@ -18,11 +18,14 @@ module Effective
|
|
18
18
|
file_id :integer
|
19
19
|
file_created_at :datetime
|
20
20
|
|
21
|
+
position :integer
|
22
|
+
|
21
23
|
timestamps
|
22
24
|
end
|
23
25
|
|
24
|
-
before_validation do
|
25
|
-
self.committee ||= committee_folder
|
26
|
+
before_validation(if: -> { committee_folder.present? }) do
|
27
|
+
self.committee ||= committee_folder.committee
|
28
|
+
self.position ||= (committee_folder.committee_files.map { |obj| obj.position }.compact.max || -1) + 1
|
26
29
|
end
|
27
30
|
|
28
31
|
before_validation(if: -> { file.attached? }) do
|
@@ -30,10 +33,11 @@ module Effective
|
|
30
33
|
end
|
31
34
|
|
32
35
|
scope :deep, -> { with_attached_file.includes(:committee, :committee_folder) }
|
33
|
-
scope :sorted, -> { order(:
|
36
|
+
scope :sorted, -> { order(:position) }
|
34
37
|
|
35
38
|
validates :title, presence: true
|
36
39
|
validates :file, presence: true
|
40
|
+
validates :position, presence: true, if: -> { committee_folder.present? }
|
37
41
|
|
38
42
|
def to_s
|
39
43
|
title.presence || 'file'
|
@@ -15,7 +15,7 @@
|
|
15
15
|
= f.select :user_ids, current_user.class.all, label: 'Select user(s)', required: true, ajax_url: ajax_url
|
16
16
|
|
17
17
|
- if inline_datatable? && inline_datatable.attributes[:user_id].present?
|
18
|
-
= f.select :committee_ids, Effective::Committee.sorted.all, label: "Select #{
|
18
|
+
= f.select :committee_ids, Effective::Committee.sorted.all, label: "Select #{committee_label}(s)"
|
19
19
|
|
20
20
|
- unless inline_datatable?
|
21
21
|
= f.select :committee_id, Effective::Committee.sorted.all
|
@@ -29,7 +29,7 @@
|
|
29
29
|
|
30
30
|
.row
|
31
31
|
.col= f.date_field :start_on
|
32
|
-
.col= f.date_field :end_on, hint: 'End dating will remove access'
|
32
|
+
.col= f.date_field :end_on, hint: 'End dating will remove access', date_linked: false
|
33
33
|
|
34
34
|
- if EffectiveCommittees.use_effective_roles
|
35
35
|
= f.checks :roles, EffectiveRoles.roles_collection(f.object, skip_disabled: true)
|
@@ -11,15 +11,14 @@
|
|
11
11
|
- committee_folder = log.associated.try(:committee_folder) || log.associated
|
12
12
|
- link_to_committee_folder = link_to(committee_folder, effective_committees.committee_committee_folder_path(committee, committee_folder))
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
- committee_file = log.associated.try(:file).try(:blob)
|
15
|
+
- link_to_file = link_to(log.associated, (committee_file ? url_for(committee_file) : '#'))
|
16
16
|
|
17
17
|
- if logs.length == 1 && log.associated_type == 'Effective::CommitteeFolder'
|
18
18
|
%li Folder #{link_to_committee_folder} was added to #{link_to_committee}.
|
19
19
|
|
20
20
|
- elsif logs.length == 1 && log.associated_type == 'Effective::CommitteeFile'
|
21
|
-
%li File {
|
22
|
-
-# %li File #{link_to_file} was added to #{link_to_committee} → #{link_to_committee_folder}.
|
21
|
+
%li File #{link_to_file} was added to #{link_to_committee} → #{link_to_committee_folder}.
|
23
22
|
|
24
23
|
- elsif logs.length > 1 && logs.all? { |log| log.associated_type == 'Effective::CommitteeFile' }
|
25
24
|
%li #{logs.length} files were added to #{link_to_committee} → #{link_to_committee_folder}.
|