effective_cpd 0.1.10 → 0.1.11

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: 42fb9cbcba6674433f77a1b274d2855000a94724aa34fe8ded25177eb9171046
4
- data.tar.gz: 7c3fa8934b17b16a67b4fccbc2f29eba4b3af1beb66fb82b07706526dca8c60b
3
+ metadata.gz: 7ae72402afeab6ed8830a9951e48d0bf33494e0f5fc5133049aa652876aa367e
4
+ data.tar.gz: bbdad22b7cd86165bc476b0c9fc8615e42e4cea2cd6c7b0c9310927bac76b0d1
5
5
  SHA512:
6
- metadata.gz: 82101c275e55d097ced7a9f214758ae33886e319d38649be8997dae6cb62512239f78621ca3ab4e4be27738adc2c2ad2982b5f21a0fffed16a936526bb1aa9de
7
- data.tar.gz: a22f3d126c721f109e0e2fb3e32a5b9bec21caa6e8bd3f9196c010088d0be3e4534e7a47ecaa707df1547c2393ba4503b4f0f39ce47458a4ca77714c2219f120
6
+ metadata.gz: 51b58155d16e45298264fd9779a5b0ba3b3432261b4b8fabf88a04754182eef0d85975c3d853099eceb9e871eed13d03d4115d4bd1028f77891ca357b3801956
7
+ data.tar.gz: d2d7895e77c218b0a677d2601538e2b278b3518b25b0c60b0cfc3ed22a4462fb5e0a1ff634d5ff2d27fc75e1c36d116bcff0f5cfea6f826c061cc05e22fe883a
data/README.md CHANGED
@@ -197,11 +197,13 @@ if user.admin?
197
197
  can :manage, Effective::CpdCycle
198
198
  can :manage, Effective::CpdRule
199
199
 
200
+ can([:index, :show], Effective::CpdStatement)
201
+ can(:unsubmit, Effective::CpdStatement) { |statement| statement.completed? }
202
+
200
203
  can :manage, Effective::CpdAuditLevel
201
204
  can :manage, Effective::CpdAuditLevelSection
202
205
  can :manage, Effective::CpdAuditLevelQuestion
203
206
 
204
- can :manage, Effective::CpdStatement
205
207
  can :manage, Effective::CpdAudit
206
208
  can :manage, Effective::CpdAuditReview
207
209
  end
@@ -1,14 +1,8 @@
1
1
  const initialize_effective_cpd_activities = function() {
2
- const $obj = $('.cpd-statement-activities:not(.initialized)')
2
+ const $obj = $('#cpd-statement-activities,.cpd-statement-activities')
3
3
 
4
4
  if($obj.length > 0) {
5
- $(document).on('mousedown touchstart', function(event) { collapse_effective_cpd_activities() })
6
-
7
- // When we click outside the New Activity or Edit Activity
8
- $(document).on('mousedown touchstart', '.activities-new', function(event) { event.stopPropagation() });
9
- $(document).on('mousedown touchstart', '.statement-activity', function(event) { event.stopPropagation() });
10
-
11
- $obj.addClass('initialized')
5
+ $('body').addClass('effective-cpd-statement-activities')
12
6
  }
13
7
  };
14
8
 
@@ -50,6 +44,15 @@ $(document).on('click', '[data-cpd-collapse]', function(event) {
50
44
  collapse_effective_cpd_activities()
51
45
  });
52
46
 
47
+ // Click outside the activities anywehre on body
48
+ $(document).on('mousedown touchstart', 'body.effective-cpd-statement-activities', function(event) {
49
+ collapse_effective_cpd_activities()
50
+ });
51
+
52
+ // When we click outside the New Activity or Edit Activity
53
+ $(document).on('mousedown touchstart', 'body.effective-cpd-statement-activities .activities-new', function(event) { event.stopPropagation() });
54
+ $(document).on('mousedown touchstart', 'body.effective-cpd-statement-activities .statement-activity', function(event) { event.stopPropagation() });
55
+
53
56
  // Initializers
54
- $(document).ready(function() { initialize_effective_cpd_activities() });
55
- $(document).on('turbolinks:load', function() { initialize_effective_cpd_activities() });
57
+ $(document).ready(initialize_effective_cpd_activities);
58
+ $(document).on('turbolinks:load', initialize_effective_cpd_activities);
@@ -3,6 +3,8 @@
3
3
  .progress { height: 3px; }
4
4
  }
5
5
 
6
+ .cpd-statement-activity { padding: 0.5rem; }
7
+
6
8
  .statement-activity-content {
7
9
  a { color: inherit; }
8
10
  }
@@ -79,6 +79,11 @@ module Effective
79
79
  update!(submitted_at: Time.zone.now)
80
80
  end
81
81
 
82
+ # Called by admin only. This is an exceptional action
83
+ def unsubmit!
84
+ update!(wizard_steps: {}, submitted_at: nil, confirm_readonly: nil)
85
+ end
86
+
82
87
  def in_progress?
83
88
  submitted_at.blank?
84
89
  end
@@ -86,6 +91,7 @@ module Effective
86
91
  def completed?
87
92
  submitted_at.present?
88
93
  end
94
+ alias_method :submitted?, :completed?
89
95
 
90
96
  def required_score
91
97
  required_by_cycle = cpd_cycle&.required_score
@@ -2,6 +2,7 @@
2
2
  - cpd_activity = cpd_statement_activity.cpd_activity
3
3
  - rule = cpd_statement_activity.cpd_statement.cpd_cycle.rule_for(cpd_activity)
4
4
 
5
+ .float-right= link_to icon('x', class: 'small-1'), '#', 'data-cpd-collapse': true
5
6
  %p
6
7
  = cpd_statement_activity
7
8
  %br
data/config/routes.rb CHANGED
@@ -34,7 +34,9 @@ EffectiveCpd::Engine.routes.draw do
34
34
  resources :cpd_rules, only: [:index]
35
35
  resources :cpd_special_rules, except: [:show]
36
36
 
37
- resources :cpd_statements, only: [:index, :show]
37
+ resources :cpd_statements, only: [:index, :show] do
38
+ post :unsubmit, on: :member
39
+ end
38
40
 
39
41
  resources :cpd_audit_levels, except: [:show]
40
42
  resources :cpd_audit_level_questions, except: [:show]
@@ -1,3 +1,3 @@
1
1
  module EffectiveCpd
2
- VERSION = '0.1.10'
2
+ VERSION = '0.1.11'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_cpd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
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: 2021-05-27 00:00:00.000000000 Z
11
+ date: 2021-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails