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
e9cb465c
Commit
e9cb465c
authored
Aug 18, 2017
by
Chrysanthi Lagodimou
Browse files
controllers, views, translations
parent
50d9f427
Changes
11
Hide whitespace changes
Inline
Side-by-side
app/controllers/hours_controller.rb
View file @
e9cb465c
...
...
@@ -24,7 +24,7 @@ class HoursController < ApplicationController
def
create
@hour
=
Hour
.
new
(
hour_params
)
authorize
@hour
if
@hour
.
save
!
if
@hour
.
save
redirect_to
@hour
,
make_notice
else
render
:new
...
...
@@ -33,7 +33,7 @@ class HoursController < ApplicationController
def
update
if
@hour
.
update
(
hour_params
)
redirect_to
@hour
,
notice:
make_notice
redirect_to
@hour
,
make_notice
else
render
:edit
end
...
...
@@ -41,7 +41,7 @@ class HoursController < ApplicationController
def
destroy
@hour
.
destroy
redirect_to
hours_url
,
notice:
make_notice
redirect_to
hours_url
,
make_notice
end
private
...
...
app/controllers/volunteers_controller.rb
View file @
e9cb465c
...
...
@@ -5,7 +5,7 @@ class VolunteersController < ApplicationController
include
VolunteerAttributes
include
MakeNotice
before_action
:set_volunteer
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
before_action
:set_volunteer
,
only:
[
:show
,
:edit
,
:update
,
:destroy
,
:volunteer_hours
]
def
index
authorize
Volunteer
...
...
@@ -62,6 +62,11 @@ class VolunteersController < ApplicationController
@seeking_clients
=
@q
.
result
.
paginate
(
page:
params
[
:page
])
end
def
volunteer_hours
authorize
Volunteer
@volunteer_hours
=
@volunteer
.
hours
end
private
def
invite_volunteer_user
...
...
app/policies/volunteer_policy.rb
View file @
e9cb465c
...
...
@@ -5,6 +5,7 @@ class VolunteerPolicy < ApplicationPolicy
alias_method
:destroy?
,
:superadmin?
alias_method
:seeking_clients?
,
:superadmin?
alias_method
:checklist?
,
:superadmin?
alias_method
:volunteer_hours?
,
:superadmin?
alias_method
:show?
,
:superadmin_or_volunteers_record?
alias_method
:edit?
,
:superadmin_or_volunteers_record?
...
...
app/views/hours/_hour.html.slim
View file @
e9cb465c
td
=
hour
.
meeting_date
td
=
hour
.
duration
td
=
hour
.
activity
td
=
hour
.
comments
=
render
'index_actions'
,
subject:
hour
tr
td
=
l
(
hour
.
meeting_date
)
td
=
hour
.
duration
td
=
hour
.
activity
td
=
hour
.
comments
=
render
'index_actions'
,
subject:
hour
,
controller_name:
'hours'
app/views/hours/_hours_block.html.slim
View file @
e9cb465c
...
...
@@ -3,17 +3,11 @@
table
.table.table-striped
thead
tr
th
M
eeting
date
th
Duration
th
Activity
th
Comments
th
=
t_attr
(
:m
eeting
_
date
,
Hour
)
th
=
t_attr
(
:duration
,
Hour
)
th
=
t_attr
(
:activity
,
Hour
)
th
=
t_attr
(
:comments
,
Hour
)
th
colspan
=
'3'
tbody
-
hours
.
each
do
|
hour
|
tr
td
=
hour
.
meeting_date
td
=
hour
.
duration
td
=
hour
.
activity
td
=
hour
.
comments
=
render
'index_actions'
,
subject:
hour
=
render
hours
app/views/hours/show.html.slim
View file @
e9cb465c
p
#notice
=
notice
.row
.col-xs-12
.table-responsive
table
.table.table-no-border-top
tbody
tr
td
=
t_model
(
Volunteer
)
td
=
@hour
.
assignment
.
volunteer
.
contact
.
full_name
tr
td
=
t_model
(
Client
)
td
=
@hour
.
assignment
.
client
.
contact
.
full_name
tr
td
=
t_attr
(
:meeting_date
)
td
=
l
(
@hour
.
meeting_date
)
tr
td
=
t_attr
(
:duration
)
td
=
@hour
.
duration
tr
td
=
t_attr
(
:activity
)
td
=
@hour
.
activity
tr
td
=
t_attr
(
:comments
)
td
=
@hour
.
comments
p
strong
Meeting
date:
=
@hour
.
meeting_date
p
strong
Duration:
=
@hour
.
duration
p
strong
Activity:
=
@hour
.
activity
p
strong
Comments:
=
@hour
.
comments
=
link_to
'Edit'
,
edit_hour_path
(
@hour
)
'
|
=
link_to
'Back'
,
hours_path
=
form_navigation_btn
:edit
=
form_navigation_btn
:back
app/views/volunteers/show.html.slim
View file @
e9cb465c
...
...
@@ -2,13 +2,18 @@
.col-xs-12
h1
=
@volunteer
.
contact
.
full_name
-
if
policy
(
Volunteer
).
seeking_clients?
&
@volunteer
.
seeking_clients?
.row
.col-xs-12
.row
-
if
policy
(
Volunteer
).
supervisor?
.col-xs-12.col-md-3
=
render
'journals/journal_block'
,
journaled_for:
@volunteer
-
if
policy
(
Volunteer
).
seeking_clients?
&
@volunteer
.
seeking_clients?
.col-xs-12.col-md-3
=
button_link
t_title
(
:new
,
Assignment
),
new_assignment_path
(
volunteer_id:
@volunteer
)
-
if
policy
(
Volunteer
).
supervisor?
=
render
'journals/journal_block'
,
journaled_for:
@volunteer
-
if
@volunteer
.
assignments
.
any?
.col-xs-12.col-md-3
=
button_link
t_title
(
:new
,
Hour
),
new_hour_url
(
volunteer_id:
@volunteer
)
.col-xs-12.col-md-3
=
button_link
t_title
(
:index
,
Hour
),
volunteer_hours_volunteer_path
(
@volunteer
)
-
if
policy
(
Volunteer
).
checklist?
h3
=
t
(
'checklist'
)
...
...
@@ -149,9 +154,6 @@ h3= t('volunteer_availability')
.col-xs-12
#assignments
h3
=
t
(
'assignments'
)
=
render
'assignments/volunteer_index'
,
assignments:
@volunteer
.
assignments
.row
.col-xs-12
=
button_link
t_title
(
:new
,
Hour
),
new_hour_url
(
volunteer_id:
@volunteer
)
-
if
current_user
.
volunteer?
=
button_link
t
(
'edit_profile'
),
edit_volunteer_path
(
@volunteer
)
...
...
app/views/volunteers/volunteer_hours.html.slim
0 → 100644
View file @
e9cb465c
.row
.col-xs-12
h1
=
t_title
(
:index
,
Hour
)
=
render
'hours/hours_block'
,
hours:
@volunteer_hours
config/locales/de.yml
View file @
e9cb465c
...
...
@@ -69,6 +69,12 @@ de:
department_manager
:
Standort Betreuer
name
:
Name
user
:
User
hour
:
activity
:
Tätigkeit / Was wurde gemacht
assignment
:
Begleitung
comments
:
Bemerkungen / Gab es etwas Besonderes
duration
:
Dauer des Treffens / des Kurses (in Stunden)
meeting_date
:
Datum des Treffens / des Kurses
journal
:
<<
:
*id-generic_keys
author
:
Author
...
...
@@ -192,6 +198,7 @@ de:
client
:
Klient/in
contact
:
Kontakt
department
:
Standort
hour
:
Stunde
journal
:
Journal
language_skill
:
Sprachkompetenz
profile
:
Profil
...
...
config/locales/en.yml
View file @
e9cb465c
...
...
@@ -76,6 +76,7 @@ en:
client
:
Client
contact
:
Contact
department
:
Department
hour
:
Hour report
journal
:
Journal
language_skill
:
Language skill
profile
:
Profile
...
...
config/routes.rb
View file @
e9cb465c
...
...
@@ -17,6 +17,7 @@ Rails.application.routes.draw do
resources
:volunteers
do
get
:seeking_clients
,
on: :collection
get
:find_client
,
on: :member
,
to:
'assignments#find_client'
get
:volunteer_hours
,
on: :member
resources
:journals
end
resources
:volunteer_emails
...
...
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