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
ee2fe030
Commit
ee2fe030
authored
Jun 28, 2017
by
Kaspar Vollenweider
👻
Committed by
Kaspar
Jun 30, 2017
Browse files
temp commit with first_language
parent
82eceaa0
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/controllers/concerns/volunteer_attributes.rb
View file @
ee2fe030
...
...
@@ -8,7 +8,8 @@ module VolunteerAttributes
:profession
,
:education
,
:motivation
,
:experience
,
:expectations
,
:strengths
,
:skills
,
:interests
,
:state
,
:duration
,
:man
,
:woman
,
:family
,
:kid
,
:sport
,
:creative
,
:music
,
:culture
,
:training
,
:german_course
,
:adults
,
:teenagers
,
:children
,
:region
,
:state
:german_course
,
:adults
,
:teenagers
,
:children
,
:region
,
:state
,
:first_language
,
:title
,
first_language_attributes:
[
:id
,
:language
]
]
end
end
...
...
app/controllers/volunteers_controller.rb
View file @
ee2fe030
...
...
@@ -22,6 +22,8 @@ class VolunteersController < ApplicationController
def
create
@volunteer
=
Volunteer
.
new
(
volunteer_params
)
@volunteer
.
schedules
<<
Schedule
.
build
@volunteer
.
build_contact
authorize
@volunteer
if
@volunteer
.
save
redirect_to
@volunteer
,
notice:
t
(
'volunteer_created'
)
...
...
app/models/contact.rb
View file @
ee2fe030
...
...
@@ -2,6 +2,7 @@ class Contact < ApplicationRecord
belongs_to
:contactable
,
polymorphic:
true
,
optional:
true
validates
:last_name
,
presence:
true
,
if: :department?
validates
:first_name
,
:last_name
,
presence:
true
,
if: :volunteer?
has_many
:contact_emails
accepts_nested_attributes_for
:contact_emails
,
allow_destroy:
true
...
...
@@ -19,4 +20,8 @@ class Contact < ApplicationRecord
def
department?
contactable_type
==
'Department'
end
def
volunteer?
contactable_type
==
'Volunteer'
end
end
app/models/first_language.rb
0 → 100644
View file @
ee2fe030
class
FirstLanguage
<
LanguageSkill
end
app/models/volunteer.rb
View file @
ee2fe030
...
...
@@ -4,6 +4,7 @@ class Volunteer < ApplicationRecord
has_one
:contact
,
as: :contactable
accepts_nested_attributes_for
:contact
has_one
:first_language
acts_as_paranoid
...
...
app/views/volunteers/_form.html.slim
View file @
ee2fe030
...
...
@@ -30,6 +30,10 @@
.col-xs-12.col-md-6
=
f
.
input
:additional_nationality
,
as: :country
=
f
.
simple_fields_for
:first_language
do
|
language
|
.col-xs-12.col-md-6
=
language
.
input
:language
,
collection:
languages
,
label:
t_attr
(
:first_language
)
=
render
'language_skills/form'
,
f:
f
,
speaker:
@volunteer
.row
...
...
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