effective_work_experience 0.0.2 → 0.0.4
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/README.md +49 -4
- data/app/models/concerns/effective_work_experience_summary.rb +18 -16
- data/app/models/concerns/effective_work_experience_user.rb +1 -1
- data/app/views/effective/work_experience_projects/show.html.haml +14 -0
- data/app/views/effective/work_experience_records/show.html.haml +14 -0
- data/lib/effective_work_experience/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 198d09800c65312ee58cb577f5e2f5e50d605e19ebf3f2b62b0f5fd6a1e8bca2
|
|
4
|
+
data.tar.gz: b6bc82fcf12e3113f9b1744501936c669937c981d5aa19d944fe1773650eeb7c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d20b2d8754827e003f485430e5738c34247f206eb1e268fbd1aca269c3065c102efc7a7796d69245966f3bfe0c641238a64ac8f0883d93141369077bbcc8549
|
|
7
|
+
data.tar.gz: fdb4f374f3dd84b70a9ec3e7d7406b713d0383253a79f49b812d7ad6d4804bd70cf4283593cd721d61592a4f4710dcc6e1d15758c994e7359812a0a6c0921b39
|
data/README.md
CHANGED
|
@@ -65,33 +65,78 @@ and configure it:
|
|
|
65
65
|
config.work_experience_summary_class_name = 'Bcsla::WorkExperienceSummary'
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
## Categories
|
|
69
|
+
|
|
70
|
+
Nothing works until there are categories and subcategories to record hours against — a new record
|
|
71
|
+
has one row per subcategory, so with none it is an empty form. Every application defines its own,
|
|
72
|
+
either from the admin screens or from its own seeds. See `db/seeds.rb` for an example set.
|
|
73
|
+
|
|
74
|
+
`minimum_hours` is optional on both. The work experience report shows a target and a percent
|
|
75
|
+
complete for each category and subcategory that has one, and just the hours to date for those that
|
|
76
|
+
don't.
|
|
77
|
+
|
|
68
78
|
## User
|
|
69
79
|
|
|
70
|
-
|
|
80
|
+
An intern's mentor is another user, so this gem needs one column on your users table. The install
|
|
81
|
+
migration does not add it. Write your own:
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
class AddWorkExperienceMentorToUsers < ActiveRecord::Migration[8.0]
|
|
85
|
+
def change
|
|
86
|
+
add_column :users, :work_experience_mentor_id, :integer
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Then add the following to your User model:
|
|
71
92
|
|
|
72
93
|
```ruby
|
|
73
94
|
effective_work_experience_user
|
|
74
95
|
```
|
|
75
96
|
|
|
76
|
-
|
|
97
|
+
which adds the `belongs_to :work_experience_mentor` for that column, plus:
|
|
77
98
|
|
|
78
|
-
- `work_experience_mentor` — the user who reviews my work experience summaries
|
|
79
99
|
- `work_experience_mentees` — the interns I am a mentor for
|
|
80
100
|
- `work_experience_outside_mentor` — my mentor when they don't have an account. A `has_one`.
|
|
81
101
|
- `work_experience_records`, `work_experience_entries`, `work_experience_projects`, `work_experience_summaries`, `mentee_work_experience_summaries`
|
|
82
102
|
- the `work_experience_hours`, `work_experience_hours_by_year` and `work_experience_total_hours_to_date` calculations
|
|
103
|
+
- `work_experience_intern?`, `work_experience_mentor?` and `work_experience_outside_mentor?`, used by the views and permissions below
|
|
83
104
|
|
|
84
105
|
An intern with an outside mentor has no `work_experience_mentor`, so their summaries are reviewed automatically on submit.
|
|
85
106
|
|
|
86
107
|
The summary's `user`, `mentor` and `supervisor` are polymorphic. A summary assigns its mentor from the user's `work_experience_mentor`, and its supervisor from the user's `supervisor` when your User model defines one.
|
|
87
108
|
|
|
109
|
+
### Who is an intern
|
|
110
|
+
|
|
111
|
+
`work_experience_intern?` is true once a user has any records or summaries. To have someone see the
|
|
112
|
+
intern dashboard before they've recorded anything, define `intern?` on your User model and it will
|
|
113
|
+
be used too:
|
|
114
|
+
|
|
115
|
+
```ruby
|
|
116
|
+
def intern?
|
|
117
|
+
membership.present? && membership.category.intern?
|
|
118
|
+
end
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Admin user form
|
|
122
|
+
|
|
88
123
|
Render the mentor fields from your own admin user form:
|
|
89
124
|
|
|
90
125
|
```haml
|
|
91
|
-
= render('
|
|
126
|
+
= render('admin/work_experience/user_fields', f: f, hint: 'Who can be a mentor')
|
|
92
127
|
```
|
|
93
128
|
|
|
94
129
|
This is the `work_experience_mentor` select plus an `f.has_many` builder for the one outside mentor.
|
|
130
|
+
The `work_experience_mentor_id` and `work_experience_outside_mentors_attributes` params are permitted
|
|
131
|
+
by effective_resources for free — there is nothing to add to your `effective_resource do` block.
|
|
132
|
+
|
|
133
|
+
Render an intern's records, projects, summaries and report as a tab on the same form:
|
|
134
|
+
|
|
135
|
+
```haml
|
|
136
|
+
- if user.work_experience_intern?
|
|
137
|
+
= tab Effective::WorkExperienceRecord, label: 'Work Experience' do
|
|
138
|
+
= render('admin/work_experience/user_work_experience', user: user)
|
|
139
|
+
```
|
|
95
140
|
|
|
96
141
|
## Dashboard
|
|
97
142
|
|
|
@@ -134,6 +134,24 @@ module EffectiveWorkExperienceSummary
|
|
|
134
134
|
validates :approve_work_experience_summary, acceptance: true
|
|
135
135
|
validates :recommendation, presence: true
|
|
136
136
|
end
|
|
137
|
+
|
|
138
|
+
def can_visit_step?(current_step)
|
|
139
|
+
return false if current_user == user && intern_steps.exclude?(current_step)
|
|
140
|
+
return false if current_user == mentor && mentor_steps.exclude?(current_step)
|
|
141
|
+
|
|
142
|
+
# Once submitted, the intern cannot go back and submit again
|
|
143
|
+
if was_submitted?
|
|
144
|
+
return false if [:start, :records, :projects, :submit].include?(current_step)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# Once reviewed, the mentor can go back and review again
|
|
148
|
+
if was_reviewed?
|
|
149
|
+
return [:review, :reviewed].include?(current_step)
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
can_revisit_completed_steps(current_step)
|
|
153
|
+
end
|
|
154
|
+
|
|
137
155
|
end
|
|
138
156
|
|
|
139
157
|
def to_s
|
|
@@ -172,22 +190,6 @@ module EffectiveWorkExperienceSummary
|
|
|
172
190
|
mentor.present? || user.try(:work_experience_outside_mentor?).present?
|
|
173
191
|
end
|
|
174
192
|
|
|
175
|
-
def can_visit_step?(current_step)
|
|
176
|
-
return false if current_user == user && intern_steps.exclude?(current_step)
|
|
177
|
-
return false if current_user == mentor && mentor_steps.exclude?(current_step)
|
|
178
|
-
|
|
179
|
-
# Once submitted, the intern cannot go back and submit again
|
|
180
|
-
if was_submitted?
|
|
181
|
-
return false if [:start, :records, :projects, :submit].include?(current_step)
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
# Once reviewed, the mentor can go back and review again
|
|
185
|
-
if was_reviewed?
|
|
186
|
-
return [:review, :reviewed].include?(current_step)
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
can_revisit_completed_steps(current_step)
|
|
190
|
-
end
|
|
191
193
|
|
|
192
194
|
def total_hours_to_date
|
|
193
195
|
user.work_experience_total_hours_to_date(month: end_on)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
- resource = (@_effective_resource || Effective::Resource.new(controller_path))
|
|
2
|
+
- @resource = instance_variable_get('@' + resource.name) if resource.name
|
|
3
|
+
|
|
4
|
+
- if @resource
|
|
5
|
+
- content_for :resource_buttons do
|
|
6
|
+
.resource-buttons
|
|
7
|
+
= render_resource_buttons(@resource, show: false)
|
|
8
|
+
|
|
9
|
+
= render_resource_partial(@resource)
|
|
10
|
+
|
|
11
|
+
.my-4
|
|
12
|
+
|
|
13
|
+
.form-actions
|
|
14
|
+
= link_to 'Return to Dashboard', return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
- resource = (@_effective_resource || Effective::Resource.new(controller_path))
|
|
2
|
+
- @resource = instance_variable_get('@' + resource.name) if resource.name
|
|
3
|
+
|
|
4
|
+
- if @resource
|
|
5
|
+
- content_for :resource_buttons do
|
|
6
|
+
.resource-buttons
|
|
7
|
+
= render_resource_buttons(@resource, show: false)
|
|
8
|
+
|
|
9
|
+
= render_resource_partial(@resource)
|
|
10
|
+
|
|
11
|
+
.my-4
|
|
12
|
+
|
|
13
|
+
.form-actions
|
|
14
|
+
= link_to 'Return to Dashboard', return_to_dashboard_path, class: 'btn btn-lg btn-primary btn-block'
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: effective_work_experience
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Code and Effect
|
|
@@ -262,9 +262,11 @@ files:
|
|
|
262
262
|
- app/views/effective/work_experience_projects/_fields.html.haml
|
|
263
263
|
- app/views/effective/work_experience_projects/_form.html.haml
|
|
264
264
|
- app/views/effective/work_experience_projects/_work_experience_project.html.haml
|
|
265
|
+
- app/views/effective/work_experience_projects/show.html.haml
|
|
265
266
|
- app/views/effective/work_experience_records/_fields.html.haml
|
|
266
267
|
- app/views/effective/work_experience_records/_form.html.haml
|
|
267
268
|
- app/views/effective/work_experience_records/_work_experience_record.html.haml
|
|
269
|
+
- app/views/effective/work_experience_records/show.html.haml
|
|
268
270
|
- app/views/effective/work_experience_reports/_work_experience_report.html.haml
|
|
269
271
|
- app/views/effective/work_experience_reports/show.html.haml
|
|
270
272
|
- app/views/effective/work_experience_summaries/_content.html.haml
|