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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: effc4579e15d6bbbf45ffb1113ebb129a0d809b9e600da98c3b10c5a70e2d385
4
- data.tar.gz: 25ffa06fe7742f83f08fbac7c79521aa3b2155deb2639fa36559164bfc243c14
3
+ metadata.gz: 687b287a684219a3c2f0214c4639db991e8a5cb02566179c555326f4436e5a3d
4
+ data.tar.gz: 28fb6cf8554ada01a148d4ceac2bb2abc453f8a20c8122ba2aee226f95b7c479
5
5
  SHA512:
6
- metadata.gz: 1593abb4700a2d23026405da7a7acfb82e042eac5a856bb84efb37afcbb7592817bcb53ab0f5870a10965258d905f9d06deaecd2af976adac4c244e6736417f5
7
- data.tar.gz: 9bc7a3f7dc8aed23178a8e8d11704e09b470bd782e13a947de3bf2f6f13f1530ec71d6e636499bf4f07b71b7c3a9d97a01ec49f195a39b3726e7303100013540
6
+ metadata.gz: d9614f730cfc7c9bf4aa56ceb4363235e8082016273bee4c3623fac416d1ec8cdd9790f3e230bef4b20491c817ad960ff7c38c3341780dbb7136f36721f4fa0a
7
+ data.tar.gz: 55379c626f837d6ed6f69698c2c7cac186af00d12021c6e1e800dd3caedb39286d66f0896f3f32db6d18e0ec923293693dd7bf0b9cf87c0fbfe6302a1750138f
@@ -1,6 +1,8 @@
1
1
  module Admin
2
2
  class EffectiveCommitteeFilesDatatable < Effective::Datatable
3
3
  datatable do
4
+ reorder :position
5
+
4
6
  col :updated_at, visible: false
5
7
  col :created_at, visible: false
6
8
 
@@ -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&.committee
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(:title) }
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 #{commitee_label}(s)"
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
- -# TODO - this errors out if it isn't on the dashboard
15
- -# link_to_file = link_to(log.associated, main_app.url_for(log.associated.try(:file)))
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 {filename} was added to #{link_to_committee} &rarr; #{link_to_committee_folder}.
22
- -# %li File #{link_to_file} was added to #{link_to_committee} &rarr; #{link_to_committee_folder}.
21
+ %li File #{link_to_file} was added to #{link_to_committee} &rarr; #{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} &rarr; #{link_to_committee_folder}.
@@ -1,5 +1,5 @@
1
1
  = tabs do
2
- = tab(commitee_label) do
2
+ = tab(committee_label) do
3
3
  = render 'effective/committees/form_committee', committee: committee
4
4
 
5
5
  - if committee.persisted?
@@ -72,6 +72,8 @@ class CreateEffectiveCommittees < ActiveRecord::Migration[6.0]
72
72
  t.string :title
73
73
  t.text :notes
74
74
 
75
+ t.integer :position
76
+
75
77
  t.datetime :updated_at
76
78
  t.datetime :created_at
77
79
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveCommittees
2
- VERSION = '0.5.1'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_committees
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect