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
834b9a83
Commit
834b9a83
authored
Jul 12, 2017
by
Chrysanthi Lagodimou
Browse files
without clients equivalent of need accompanying
parent
85831401
Changes
12
Hide whitespace changes
Inline
Side-by-side
app/controllers/volunteers_controller.rb
View file @
834b9a83
...
...
@@ -47,6 +47,11 @@ class VolunteersController < ApplicationController
redirect_to
volunteers_url
,
notice:
t
(
'volunteer_destroyed'
)
end
def
without_clients
@q
=
Volunteer
.
without_clients
.
ransack
(
params
[
:q
])
@without_clients
=
@q
.
result
end
private
def
invite_volunteer_user
...
...
app/policies/volunteer_policy.rb
View file @
834b9a83
...
...
@@ -42,6 +42,10 @@ class VolunteerPolicy < ApplicationPolicy
user
.
superadmin?
end
def
without_clients?
user
.
superadmin?
end
private
def
volunteers_owns_profile
...
...
app/views/volunteers/_columns.html.slim
0 → 100644
View file @
834b9a83
.table-responsive
table
.table.table-striped
thead
tr
th
=
sort_link
@q
,
:contact_title
th
=
sort_link
@q
,
:contact_last_name
,
t_attr
(
:full_name
,
Volunteer
)
th
=
sort_link
@q
,
:contact_city
th
=
sort_link
@q
,
:contact_postal_code
th
=
sort_link
@q
,
:contact_contact_emails_body
th
=
sort_link
@q
,
:date_of_birth
,
t_attr
(
:birth_year
,
Volunteer
)
th
=
sort_link
@q
,
:language_skills_language
,
t_attr
(
:first_language
,
Volunteer
)
th
=
t_attr
(
:languages
,
Volunteer
)
th
=
sort_link
@q
,
:education
th
=
sort_link
@q
,
:profession
th
=
sort_link
@q
,
:working_percent
th
=
sort_link
@q
,
:expectations
th
=
sort_link
@q
,
:interests
th
=
sort_link
@q
,
:state
th
colspan
=
'4'
tbody
=
render
volunteers
app/views/volunteers/_volunteer.html.slim
View file @
834b9a83
...
...
@@ -18,7 +18,8 @@ tr
=
volunteer
.
registrar
.
full_name
-
else
=
t
(
'volunteer_self_applicant'
)
td
=
link_to
t_action
(
:show
),
volunteer
td
=
link_to
t_model
(
Journal
),
{
controller:
'journals'
,
action:
'index'
,
volunteer_id:
volunteer
.
id
}
td
=
link_to
t_action
(
:edit
),
edit_volunteer_path
(
volunteer
)
td
=
link_to
t_action
(
:destroy
),
volunteer
,
confirm_deleting
(
volunteer
)
-
if
params
[
:action
]
==
'index'
td
=
link_to
t_action
(
:show
),
volunteer
td
=
link_to
t_model
(
Journal
),
{
controller:
'journals'
,
action:
'index'
,
volunteer_id:
volunteer
.
id
}
td
=
link_to
t_action
(
:edit
),
edit_volunteer_path
(
volunteer
)
td
=
link_to
t_action
(
:destroy
),
volunteer
,
confirm_deleting
(
volunteer
)
app/views/volunteers/_without_client.html.slim
0 → 100644
View file @
834b9a83
=
render
'volunteer'
,
volunteer:
without_client
app/views/volunteers/index.html.slim
View file @
834b9a83
...
...
@@ -5,27 +5,9 @@
.col-xs-6.col-md-4
=
form_navigation_btn
:new
,
with_row:
false
.col-xs-6.col-md-4.text-center
=
link_to
t
(
'volunteer_emails'
),
volunteer_emails_path
,
class:
'btn btn-default'
.col-xs-6.col-md-4.text-right
=
render
'state_select'
.table-responsive
table
.table.table-striped
thead
tr
th
=
sort_link
@q
,
:contact_title
th
=
sort_link
@q
,
:contact_last_name
,
t_attr
(
:full_name
,
Volunteer
)
th
=
sort_link
@q
,
:contact_city
th
=
sort_link
@q
,
:contact_postal_code
th
=
sort_link
@q
,
:contact_contact_emails_body
th
=
sort_link
@q
,
:date_of_birth
,
t_attr
(
:birth_year
,
Volunteer
)
th
=
sort_link
@q
,
:language_skills_language
,
t_attr
(
:first_language
,
Volunteer
)
th
=
t_attr
(
:languages
,
Volunteer
)
th
=
sort_link
@q
,
:education
th
=
sort_link
@q
,
:profession
th
=
sort_link
@q
,
:working_percent
th
=
sort_link
@q
,
:expectations
th
=
sort_link
@q
,
:interests
th
=
sort_link
@q
,
:state
th
colspan
=
'4'
tbody
=
render
@volunteers
=
render
'columns'
,
volunteers:
@volunteers
=
form_navigation_btn
:new
-
if
policy
(
Volunteer
).
destroy?
=
button_link
t
(
'without_clients'
),
without_clients_volunteers_url
app/views/volunteers/without_clients.html.slim
0 → 100644
View file @
834b9a83
.row
.col-xs-12
h1
=
t
(
'without_clients'
)
=
render
'columns'
,
volunteers:
@without_clients
config/locales/de.yml
View file @
834b9a83
...
...
@@ -543,6 +543,7 @@ de:
tuesday
:
Dienstag
wednesday
:
Mittwoch
when
:
Zeit
without_clients
:
Ohne Klienten
working_days
:
Arbeitstage
your_region
:
In welcher Region können Sie sich Ihren Einsatz vorstellen?
add_journal_entry
:
Journal Eintrag verfassen
...
...
config/locales/en.yml
View file @
834b9a83
...
...
@@ -387,6 +387,7 @@ en:
tuesday
:
Tuesday
wednesday
:
Wednesday
when
:
Time
without_clients
:
Without clients
working_days
:
Working days
your_expectations
:
What do you expect from a person who would accompany you / your volunteer work?
your_region
:
In which region can you imagine your employment?
...
...
config/routes.rb
View file @
834b9a83
...
...
@@ -16,6 +16,7 @@ Rails.application.routes.draw do
end
resources
:departments
resources
:volunteers
do
get
:without_clients
,
on: :collection
resources
:journals
end
resources
:volunteer_emails
...
...
test/models/volunteer_test.rb
View file @
834b9a83
...
...
@@ -18,4 +18,17 @@ class VolunteerTest < ActiveSupport::TestCase
new_volunteer
=
Volunteer
.
new
assert
new_volunteer
.
contact
.
present?
end
test
'volunteers without clients'
do
result
=
Volunteer
.
without_clients
assert_equal
[
@volunteer
],
result
.
to_a
end
test
'a volunteer with an assignment should not show up in without assignment'
do
@client
=
create
:client
@volunteer
.
create_assignment!
(
client:
@client
)
result
=
Volunteer
.
without_clients
assert_equal
[],
result
.
to_a
>>>>>>>
without
clients
equivalent
of
need
accompanying
end
end
test/policies/volunteer_policy_test.rb
View file @
834b9a83
...
...
@@ -30,4 +30,16 @@ class VolunteerPolicyTest < PolicyAssertions::Test
refute_permit
@department_manager
,
Volunteer
,
'index?'
refute_permit
@social_worker
,
Volunteer
,
'index?'
end
test
'Without clients: superadmin can see volunteers without clients'
do
assert_permit
@superadmin
,
Volunteer
,
'without_clients?'
end
test
'Without clients: social worker cannot see volunteers without clients'
do
refute_permit
@social_worker
,
Volunteer
,
'without_clients?'
end
test
'Without clients: department manager cannot see volunteers without clients'
do
refute_permit
@department_manager
,
Volunteer
,
'without_clients?'
end
end
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