Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
35fdcd00
Commit
35fdcd00
authored
Jun 29, 2017
by
Kaspar Vollenweider
👻
Committed by
Kaspar
Jun 30, 2017
Browse files
record who filled the volunteer, if the volunteer didn't self apply
parent
2f50976c
Changes
7
Hide whitespace changes
Inline
Side-by-side
app/controllers/volunteers_controller.rb
View file @
35fdcd00
...
...
@@ -24,6 +24,7 @@ class VolunteersController < ApplicationController
@volunteer
=
Volunteer
.
new
(
volunteer_params
)
@volunteer
.
schedules
<<
Schedule
.
build
@volunteer
.
build_contact
@volunteer
.
registrar
=
current_user
authorize
@volunteer
if
@volunteer
.
save
redirect_to
@volunteer
,
notice:
t
(
'volunteer_created'
)
...
...
app/models/user.rb
View file @
35fdcd00
...
...
@@ -54,6 +54,10 @@ class User < ApplicationRecord
email
end
def
full_name
"
#{
profile
.
contact
.
first_name
}
#{
profile
.
contact
.
last_name
}
"
end
def
self
.
role_collection
ROLES_FOR_USER_CREATE
.
map
(
&
:to_sym
)
end
...
...
app/models/volunteer.rb
View file @
35fdcd00
class
Volunteer
<
ApplicationRecord
include
AssociatableFields
include
GenderCollection
include
FullName
has_one
:contact
,
as: :contactable
accepts_nested_attributes_for
:contact
...
...
@@ -19,6 +20,9 @@ class Volunteer < ApplicationRecord
STATES
=
[
REGISTERED
]
+
STATES_FOR_REVIEWED
belongs_to
:user
,
optional:
true
belongs_to
:registrar
,
optional:
true
,
class_name:
'User'
,
foreign_key:
'registrar_id'
has_attached_file
:avatar
,
styles:
{
thumb:
'100x100#'
}
validates
:state
,
inclusion:
{
in:
STATES
}
...
...
app/views/volunteers/_volunteer.html.slim
View file @
35fdcd00
...
...
@@ -19,6 +19,10 @@ tr
td
-
if
volunteer
.
contact
.
contact_emails
.
any?
=
link_to
volunteer
.
contact
.
contact_emails
.
first
.
body
-
if
volunteer
.
registrar
.
present?
=
volunteer
.
registrar
.
full_name
-
else
=
'Selbstanmelder'
td
=
link_to
t_action
(
:show
),
volunteer
td
=
link_to
t_action
(
:edit
),
edit_volunteer_path
(
volunteer
)
td
=
link_to
t_action
(
:destroy
),
volunteer
,
data:
{
confirm:
t_confirm_delete
(
volunteer
)
},
method: :delete
config/locales/de.yml
View file @
35fdcd00
...
...
@@ -127,6 +127,7 @@ de:
woman
:
Frau
working_percent
:
Stellenprozent
zip
:
Postleitzahl
registrar
:
Registrator
errors
:
models
:
profile
:
...
...
db/migrate/20170627103507_add_missing_fields_to_volunteers.rb
View file @
35fdcd00
...
...
@@ -5,6 +5,7 @@ class AddMissingFieldsToVolunteers < ActiveRecord::Migration[5.1]
t
.
text
:volunteer_experience_desc
t
.
string
:region_specific
t
.
remove
:skills
t
.
bigint
:registrar_id
end
change_table
:contacts
do
|
t
|
...
...
db/schema.rb
View file @
35fdcd00
...
...
@@ -174,7 +174,6 @@ ActiveRecord::Schema.define(version: 20170627103507) do
t
.
boolean
"experience"
t
.
text
"expectations"
t
.
text
"strengths"
t
.
text
"skills"
t
.
text
"interests"
t
.
string
"state"
,
default:
"registered"
t
.
string
"duration"
...
...
@@ -202,10 +201,10 @@ ActiveRecord::Schema.define(version: 20170627103507) do
t
.
bigint
"user_id"
t
.
string
"rejection_type"
t
.
text
"rejection_text"
t
.
boolean
"active"
t
.
string
"working_percent"
t
.
text
"volunteer_experience_desc"
t
.
string
"region_specific"
t
.
bigint
"registrar_id"
t
.
index
[
"deleted_at"
],
name:
"index_volunteers_on_deleted_at"
t
.
index
[
"user_id"
],
name:
"index_volunteers_on_user_id"
end
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment