effective_work_experience 0.0.2 → 0.0.3

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: 4d811981a7c43b70ce9db5f3dcae39fa76aa9ef843c40bc4346d35d21c7c9f52
4
- data.tar.gz: 492455690ecfae1382073e48f214a1cc71fa0f45088f61238b3307b843aad243
3
+ metadata.gz: 5b1b17b8acb26be41f882c4aba1bd5546986dc12bed911b4ee7fba690d1dee4b
4
+ data.tar.gz: a40e92b082bc6217ee0c3fc11452b7c3aa36afa35b95571b3a140eccbedd1bbf
5
5
  SHA512:
6
- metadata.gz: 4f6892d5599fabb1fc93cbc2559b50251d983b5cd011efb411469feeb381d744086e668e5f38c638d946599044b99aede21a8a2c4b4ae33e35b35e632dec7aed
7
- data.tar.gz: 8e96bd6e05cc33f5a56ba1c0e28d4531bbd51fc093f57f02fd3ec22c71b45d6a492d9a23d16a87263eb8b2d26759a9c3c2177d04c93856b520b7e14d704547f5
6
+ metadata.gz: 4741e55d2afddd0d6e7478ee8adcd5fdcf8f3307e669fb4a84ff522efbd5657b583f22ccc295953dc41076c82b44619738b647df6a38e10b5b9bec6029fdd691
7
+ data.tar.gz: b283fcdc327b1353f89bc43ae92012271dd21a9307cf6a7c11801fccfc54a71df5bce0eee3a00c04c0747a55f61d6e5f6acbc6c575d5dac746696c02475c41f5
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
- Add the following to your User model:
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
- This requires a `work_experience_mentor_id` column on your users table, and adds:
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('effective/work_experience/user_fields', f: f)
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
 
@@ -66,7 +66,7 @@ module EffectiveWorkExperienceUser
66
66
  end
67
67
 
68
68
  def work_experience_intern?
69
- return true if try(:intern?)
69
+ return true if try(:intern?) || try(:pre_intern?)
70
70
  work_experience_records.present? || work_experience_summaries.present?
71
71
  end
72
72
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveWorkExperience
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect