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
37ba5beb
Commit
37ba5beb
authored
Aug 11, 2017
by
Chrysanthi Lagodimou
Browse files
adapt availability to client, profile & volunteer
parent
c3dcca8a
Changes
26
Hide whitespace changes
Inline
Side-by-side
app/controllers/clients_controller.rb
View file @
37ba5beb
class
ClientsController
<
ApplicationController
include
AvailabilityAttributes
include
NestedAttributes
include
ContactAttributes
include
MakeNotice
...
...
@@ -61,7 +62,8 @@ class ClientsController < ApplicationController
:entry_year
,
:gender_request
,
:age_request
,
:other_request
,
:birth_year
,
:salutation
,
:nationality
,
:permit
,
:goals
,
:education
,
:interests
,
:state
,
:comments
,
:involved_authority
,
:competent_authority
,
:actual_activities
,
language_skills_attributes
,
relatives_attributes
,
contact_attributes
language_skills_attributes
,
relatives_attributes
,
contact_attributes
,
availability_attributes
)
end
end
app/controllers/concerns/availability_attributes.rb
0 → 100644
View file @
37ba5beb
module
AvailabilityAttributes
extend
ActiveSupport
::
Concern
included
do
def
availability_attributes
[
:flexible
,
:morning
,
:afternoon
,
:evening
,
:workday
,
:weekend
,
:detailed_description
]
end
end
end
app/controllers/concerns/volunteer_attributes.rb
View file @
37ba5beb
...
...
@@ -10,7 +10,7 @@ module VolunteerAttributes
:music
,
:culture
,
:training
,
:german_course
,
:teenagers
,
:children
,
:state
,
:working_percent
,
:volunteer_experience_desc
,
:dancing
,
:health
,
:cooking
,
:excursions
,
:women
,
:unaccompanied
,
:zurich
,
:other_offer
,
:other_offer_desc
,
:own_kids
,
contact_attributes
,
language_skills_attributes
:own_kids
,
contact_attributes
,
language_skills_attributes
,
availability_attributes
]
end
end
...
...
app/controllers/profiles_controller.rb
View file @
37ba5beb
class
ProfilesController
<
ApplicationController
include
AvailabilityAttributes
include
ContactAttributes
include
MakeNotice
...
...
@@ -41,7 +42,7 @@ class ProfilesController < ApplicationController
def
profile_params
params
.
require
(
:profile
).
permit
(
:user_id
,
:picture
,
:profession
,
:avatar
,
contact_attributes
contact_attributes
,
availability_attributes
)
end
end
app/controllers/volunteer_applications_controller.rb
View file @
37ba5beb
class
VolunteerApplicationsController
<
ApplicationController
include
AvailabilityAttributes
include
NestedAttributes
include
ContactAttributes
include
VolunteerAttributes
...
...
app/controllers/volunteers_controller.rb
View file @
37ba5beb
class
VolunteersController
<
ApplicationController
include
AvailabilityAttributes
include
NestedAttributes
include
ContactAttributes
include
VolunteerAttributes
...
...
@@ -71,8 +72,6 @@ class VolunteersController < ApplicationController
def
volunteer_params
params
.
require
(
:volunteer
).
permit
(
volunteer_attributes
,
:rejection_type
,
:rejection_text
,
:trial_period
,
:intro_course
,
:doc_sent
,
:bank_account
,
:evaluation
,
:flexible
,
:morning
,
:afternoon
,
:evening
,
:workday
,
:weekend
,
:detailed_description
)
:trial_period
,
:intro_course
,
:doc_sent
,
:bank_account
,
:evaluation
)
end
end
app/helpers/application_helper.rb
View file @
37ba5beb
module
ApplicationHelper
def
availability_collection
[
:flexible
,
:morning
,
:afternoon
,
:evening
,
:workday
,
:weekend
]
end
def
simple_error_notice
(
f
)
boostrap_row
(
f
.
error_notification
)
if
f
.
error_notification
.
present?
end
...
...
app/models/volunteer.rb
View file @
37ba5beb
...
...
@@ -82,7 +82,6 @@ class Volunteer < ApplicationRecord
:dancing
,
:health
,
:cooking
,
:excursions
,
:women
,
:teenagers
,
:children
,
:other_offer
].
freeze
REJECTIONS
=
[
:us
,
:her
,
:other
].
freeze
AVAILABILITY
=
[
:flexible
,
:morning
,
:afternoon
,
:evening
,
:workday
,
:weekend
].
freeze
def
self
.
first_languages
[
...
...
app/views/assignments/find_client.html.slim
View file @
37ba5beb
...
...
@@ -20,6 +20,8 @@ h3= t_attr(:single_accompaniment, Volunteer)
-
else
i
.glyphicon.glyphicon-remove.text-danger
=
render
'availability/show'
,
available:
@volunteer
.row
.col-xs-12
h1
=
t
(
'clients_need_accompanying'
)
...
...
app/views/availability/_form.html.slim
0 → 100644
View file @
37ba5beb
-
availability_collection
.
each
do
|
availability
|
.col-xs-6.col-md-3
=
f
.
input
availability
,
label:
t
(
"availability.
#{
availability
}
"
)
.col-xs-12
=
f
.
input
:detailed_description
,
label:
t
(
"availability.detailed_description"
)
app/views/availability/_show.html.slim
0 → 100644
View file @
37ba5beb
.table-responsive
table
.table.table-striped
thead
tr
-
availability_collection
.
each
do
|
availability
|
th
.text-center
=
t
(
"availability.
#{
availability
}
"
)
tbody
tr
-
availability_collection
.
each
do
|
availability
|
td
.text-center
-
if
available
.
read_attribute
(
availability
)
i
.glyphicon.glyphicon-ok.text-success
-
else
i
.glyphicon.glyphicon-remove.text-danger
-
if
available
.
detailed_description?
.table-responsive
table
.table.table-no-border-top
tbody
tr
td
=
t
(
"availability.detailed_description"
)
td
=
available
.
detailed_description
app/views/clients/_form.html.slim
View file @
37ba5beb
...
...
@@ -44,6 +44,11 @@
=
f
.
input
:involved_authority
=
f
.
input
:competent_authority
.row
.col-xs-12
h3
=
t
(
'general_availability'
)
=
render
'availability/form'
,
f:
f
.row
.col-xs-12
=
f
.
button
:submit
,
class:
'btn btn-success'
app/views/clients/show.html.slim
View file @
37ba5beb
...
...
@@ -71,5 +71,8 @@
td
=
t_attr
(
:comments
)
td
=
@client
.
comments
h3
=
t
(
'general_availability'
)
=
render
'availability/show'
,
available:
@client
=
form_navigation_btn
:edit
=
form_navigation_btn
:back
app/views/profiles/_form.html.slim
View file @
37ba5beb
...
...
@@ -10,6 +10,11 @@
=
f
.
input
:profession
.row
.col-xs-12
h3
=
t
(
'general_availability'
)
=
render
'availability/form'
,
f:
f
.row
.col-xs-12
=
f
.
button
:submit
,
class:
'btn btn-success'
app/views/profiles/show.html.slim
View file @
37ba5beb
...
...
@@ -15,6 +15,9 @@
td
=
t_attr
(
:profession
)
td
=
@profile
.
profession
h3
=
t
(
'general_availability'
)
=
render
'availability/show'
,
available:
@profile
=
form_navigation_btn
:edit
.row
.col-xs-12
...
...
app/views/volunteers/_form.html.slim
View file @
37ba5beb
...
...
@@ -104,9 +104,5 @@ h3= t_attr(:single_accompaniment, Volunteer)
.row
.col-xs-12
h3
=
t_attr
(
:volunteer_availability
,
Volunteer
)
-
Volunteer
::
AVAILABILITY
.
each
do
|
availability
|
.col-xs-6.col-md-3
=
f
.
input
availability
.col-xs-12
=
f
.
input
:detailed_description
h3
=
t
(
'volunteer_availability'
)
=
render
'availability/form'
,
f:
f
app/views/volunteers/show.html.slim
View file @
37ba5beb
...
...
@@ -135,30 +135,8 @@ h3= t_attr(:group_accompaniment)
td
=
t_attr
(
:other_offer_desc
)
td
=
@volunteer
.
other_offer_desc
h3
=
t_attr
(
:volunteer_availability
)
.table-responsive
table
.table.table-striped
thead
tr
-
Volunteer
::
AVAILABILITY
.
each
do
|
availability
|
th
.text-center
=
t_attr
(
availability
)
tbody
tr
-
Volunteer
::
AVAILABILITY
.
each
do
|
availability
|
td
.text-center
-
if
@volunteer
.
read_attribute
(
availability
)
i
.glyphicon.glyphicon-ok.text-success
-
else
i
.glyphicon.glyphicon-remove.text-danger
-
if
@volunteer
.
detailed_description?
.table-responsive
table
.table.table-no-border-top
tbody
tr
td
=
t_attr
(
:detailed_description
)
td
=
@volunteer
.
detailed_description
h3
=
t
(
'volunteer_availability'
)
=
render
'availability/show'
,
available:
@volunteer
-
if
@volunteer
.
assignments
.
any?
.row
...
...
config/locales/de.yml
View file @
37ba5beb
...
...
@@ -96,7 +96,6 @@ de:
additional_nationality
:
Zusätzliche Nationalität
additional_phone_numbers
:
Zusätzliche Telefonnummern
address
:
Adresse
afternoon
:
Nachmittags
avatar
:
Foto
bank_account
:
Kontodaten eingetragen
birth_year
:
Jahrgang
...
...
@@ -107,19 +106,16 @@ de:
creative
:
Kreativ
culture
:
Kultur
dancing
:
Tanz
detailed_description
:
Genauere Angaben
doc_sent
:
Dossier Freiwillige engagiert verschickt
education
:
Ausbildung
email
:
Email
evaluation
:
Abschlussevaluation erhalten
evening
:
Abends
excursions
:
Ausflüge
expectations
:
Erwartungen
experience
:
Erfahrung
family
:
Familie
first_language
:
Muttersprache
first_name
:
Vorname
flexible
:
Flexibel
full_name
:
Name
german_course
:
Deutsch-Kurs
group_accompaniment
:
Gruppenangebote in AOZ-Einrichtungen
...
...
@@ -130,7 +126,6 @@ de:
languages
:
Sprachen
last_name
:
Nachname
man
:
Mann
morning
:
Morgens
music
:
Musik
nationality
:
Nationalität
other_offer
:
Anderes (bitte beschreiben)
...
...
@@ -152,12 +147,9 @@ de:
training
:
Bildung
trial_period
:
Probezeitbericht erhalten
unaccompanied
:
Unbegleitete Minderjährige
volunteer_availability
:
Wann sind Sie für einen Freiwilligeneinsatz verfügbar?
volunteer_experience_desc
:
Falls sie bereits Erfahrungen mit Freiwilligenarbeit haben, bitte diese genauer erläutern.
weekend
:
Wochenende
woman
:
Frau
women
:
Frauen
workday
:
Werktags
working_percent
:
Stellenprozent
zip
:
Postleitzahl
zurich
:
Kurzbegleitungen bei Wohnungsbezug in Zürich-Stadt
...
...
@@ -268,6 +260,14 @@ de:
what
:
Was?
zurich
:
Zürich
assignments
:
Begleitungen
availability
:
afternoon
:
Nachmittags
detailed_description
:
Genauere Angaben
evening
:
Abends
flexible
:
Flexibel
morning
:
Morgens
weekend
:
Wochenende
workday
:
Werktags
available_volunteers
:
Verfügbare Freiwillige
back
:
Zurück
category
:
&id-categories
...
...
@@ -412,6 +412,7 @@ de:
all
:
Alle
no_matter
:
Geschlecht egal
same
:
Geschlecht gleich
general_availability
:
Wann sind Sie verfügbar?
get_back
:
Wir werden uns bald bei Ihnen melden.
helpers
:
submit
:
...
...
config/locales/en.yml
View file @
37ba5beb
...
...
@@ -23,27 +23,22 @@ en:
additional_email_addresses
:
Additional email addresses
additional_phone_numbers
:
Additional phone numbers
address
:
Address
afternoon
:
Afternoon
bank_account
:
Bank account details entered
children
:
Children
cooking
:
Cooking
creative
:
Creative
culture
:
Culture
dancing
:
Dancing
detailed_description
:
Detailed Description
doc_sent
:
Engaged volunteer's documents sent
evaluation
:
Final evaluation
evening
:
Evening
excursions
:
Excursions
family
:
Family
flexible
:
Flexible
full_name
:
Name
german_course
:
German course
health
:
Health
intro_course
:
Introductory course
kid
:
Kid
man
:
Man
morning
:
Morning
music
:
Music
other_offer
:
Other (please describe)
other_offer_desc
:
Description
...
...
@@ -56,12 +51,9 @@ en:
training
:
Training
trial_period
:
Trial period report
unaccompanied
:
Unaccompanied minors
volunteer_availability
:
What times are you available for voluntary engagement?
volunteer_experience_desc
:
If you have any experiences with voluntary work, please describe here.
weekend
:
Weekend
woman
:
Woman
women
:
Women
workday
:
Workday
working_percent
:
Employment rate (in Percent)
zurich
:
Support for moving in Zurich City
volunteer_email
:
...
...
@@ -136,6 +128,14 @@ en:
what
:
Was?
zurich
:
Zürich
assignments
:
Assignments
availability
:
afternoon
:
Afternoon
detailed_description
:
Detailed Description
evening
:
Evening
flexible
:
Flexible
morning
:
Morning
weekend
:
Weekend
workday
:
Workday
available_volunteers
:
Available volunteers
back
:
Back
category
:
&id-categories
...
...
@@ -278,6 +278,7 @@ en:
all
:
All
no_matter
:
"
gender
doesn't
matter"
same
:
gender same
general_availability
:
When are you available?
get_back
:
We will soon get back to you.
helpers
:
submit
:
...
...
db/migrate/20170810163327_add_availability_to_clients.rb
0 → 100644
View file @
37ba5beb
class
AddAvailabilityToClients
<
ActiveRecord
::
Migration
[
5.1
]
def
change
add_column
:clients
,
:flexible
,
:boolean
,
default:
false
add_column
:clients
,
:morning
,
:boolean
,
default:
false
add_column
:clients
,
:afternoon
,
:boolean
,
default:
false
add_column
:clients
,
:evening
,
:boolean
,
default:
false
add_column
:clients
,
:workday
,
:boolean
,
default:
false
add_column
:clients
,
:weekend
,
:boolean
,
default:
false
add_column
:clients
,
:detailed_description
,
:text
end
end
Prev
1
2
Next
Write
Preview
Markdown
is supported
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