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
13599a60
Commit
13599a60
authored
Jul 06, 2017
by
Kaspar Vollenweider
👻
Committed by
Kaspar
Jul 07, 2017
Browse files
concern for automatic controller create, update, destroy notices
parent
b4a3e292
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/controllers/clients_controller.rb
View file @
13599a60
class
ClientsController
<
ApplicationController
include
NestedAttributes
include
ContactAttributes
include
MakeNotice
before_action
:set_client
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
...
...
@@ -24,7 +25,7 @@ class ClientsController < ApplicationController
@client
.
user
=
current_user
authorize
@client
if
@client
.
save
redirect_to
@client
,
notice
:
t
(
'client_created'
)
redirect_to
@client
,
make_
notice
else
render
:new
end
...
...
@@ -32,7 +33,7 @@ class ClientsController < ApplicationController
def
update
if
@client
.
update
(
client_params
)
redirect_to
@client
,
notice
:
t
(
'client_updated'
)
redirect_to
@client
,
make_
notice
else
render
:edit
end
...
...
@@ -40,7 +41,7 @@ class ClientsController < ApplicationController
def
destroy
@client
.
destroy
redirect_to
clients_url
,
notice
:
t
(
'client_destroyed'
)
redirect_to
clients_url
,
make_
notice
end
private
...
...
app/controllers/profiles_controller.rb
View file @
13599a60
class
ProfilesController
<
ApplicationController
include
ContactAttributes
include
MakeNotice
before_action
:set_profile
,
only:
[
:show
,
:edit
,
:update
]
...
...
@@ -16,7 +17,7 @@ class ProfilesController < ApplicationController
def
create
@profile
=
Profile
.
new
(
profile_params
)
if
@profile
.
save
redirect_to
@profile
,
notice
:
t
(
'profile_created'
)
redirect_to
@profile
,
make_
notice
else
render
:new
end
...
...
@@ -25,7 +26,7 @@ class ProfilesController < ApplicationController
def
update
if
@profile
.
update
(
profile_params
)
redirect_to
@profile
,
notice
:
t
(
'profile_updated'
)
redirect_to
@profile
,
make_
notice
else
render
:edit
unless
@profile
.
update
(
profile_params
)
end
...
...
app/controllers/volunteer_applications_controller.rb
View file @
13599a60
...
...
@@ -2,6 +2,7 @@ class VolunteerApplicationsController < ApplicationController
include
NestedAttributes
include
ContactAttributes
include
VolunteerAttributes
skip_before_action
:authenticate_user!
def
new
...
...
app/controllers/volunteers_controller.rb
View file @
13599a60
...
...
@@ -2,6 +2,8 @@ class VolunteersController < ApplicationController
include
NestedAttributes
include
ContactAttributes
include
VolunteerAttributes
include
MakeNotice
before_action
:set_volunteer
,
only:
[
:show
,
:edit
,
:update
,
:destroy
]
def
index
...
...
@@ -25,7 +27,7 @@ class VolunteersController < ApplicationController
@volunteer
.
registrar
=
current_user
authorize
@volunteer
if
@volunteer
.
save
redirect_to
@volunteer
,
notice
:
t
(
'volunteer_created'
)
redirect_to
@volunteer
,
make_
notice
else
render
:new
end
...
...
@@ -38,13 +40,13 @@ class VolunteersController < ApplicationController
redirect_to
volunteers_path
,
notice:
t
(
'invite_sent'
,
email:
@volunteer
.
contact
.
contact_emails
.
first
.
body
)
else
redirect_to
@volunteer
,
notice
:
t
(
'volunteer_updated'
)
redirect_to
@volunteer
,
make_
notice
end
end
def
destroy
@volunteer
.
destroy
redirect_to
volunteers_url
,
notice
:
t
(
'volunteer_destroyed'
)
redirect_to
volunteers_url
,
make_
notice
end
private
...
...
config/locales/de.yml
View file @
13599a60
...
...
@@ -191,9 +191,6 @@ de:
back
:
Zurück
change_my_password
:
Ihr Passwort ändern
change_password
:
Ihr Passwort ändern
client_created
:
KlientIn wurde erfolgreich erstellt.
client_destroyed
:
KlientIn wurde erfolgreich gelöscht.
client_updated
:
KlientIn wurde erfolgreich aktualisiert.
clients
:
Klienten
contact_info
:
Kontakt Informationen
contacts
:
...
...
@@ -216,9 +213,6 @@ de:
-
:month
-
:year
department_confirm_destroy
:
Sind Sie sicher das Sie den Standort löschen wollen?
department_created
:
Der Standort wurde erfolgreich erstellt.
department_destroyed
:
Der Standort wurde erfolgreich gelöscht.
department_updated
:
Der Standort wurde erfolgreich geändert.
departments
:
Standorte
devise
:
confirmations
:
...
...
@@ -346,8 +340,6 @@ de:
other_request
:
Sonstige Anforderungen an den Freiwilligen
password_reset_instructions
:
Ich möchte mein Passwort zurücksetzen
personal_background
:
Persönlicher Hintergrund
profile_created
:
Profil wurde erfolgreich erstellt.
profile_updated
:
Profil wurde erfolgreich aktualisiert.
region
:
&id-regions
canton
:
Kanton
city
:
Stadt
...
...
@@ -473,10 +465,7 @@ de:
users
:
Benutzer
voluntary_platform
:
Freiwilligen Plattform
volunteer_application
:
Freiwillige/n Bewerbung
volunteer_created
:
Freiwillige wurde erfolgreich erstellt.
volunteer_destroyed
:
Freiwillige wurde erfolgreich gelöscht.
volunteer_request
:
Anforderungen an den Freiwilligen
volunteer_updated
:
Freiwillige wurde erfolgreich aktualisiert.
volunteers
:
Freiwillige
wanna_apply
:
Möchten Sie sich als Freiwillige/n bewerben?
weekdays
:
...
...
config/locales/en.yml
View file @
13599a60
...
...
@@ -60,9 +60,6 @@ en:
back
:
Back
change_my_password
:
Change my password
change_password
:
Change your password
client_created
:
Client was successfully created.
client_destroyed
:
Client was successfully deleted.
client_updated
:
Client was successfully updated.
clients
:
Clients
contact_info
:
Contact information
contacts
:
...
...
@@ -74,9 +71,9 @@ en:
create_user
:
Create user
crud
:
c_action
:
create
:
'
%{model}
w
urde
erfolgreich
erstellt
.'
update
:
'
%{model}
w
urde
erfolgreich
geändert
.'
destroy
:
'
%{model}
w
urde
erfolgreich
gelöscht
.'
create
:
'
%{model}
w
as
successfully
created
.'
update
:
'
%{model}
w
as
successfully
updated
.'
destroy
:
'
%{model}
w
as
successfully
deleted
.'
title
:
add
:
'
Add
%{model}'
date
:
...
...
@@ -84,9 +81,6 @@ en:
-
:day
-
:month
-
:year
department_created
:
Department was successfully created.
department_destroyed
:
Department was successfully deleted.
department_updated
:
Department was successfully updated.
departments
:
Departments
devise
:
confirmations
:
...
...
@@ -219,8 +213,6 @@ en:
other_request
:
Other requests for volunteers
password_reset_instructions
:
I want to reset my password
personal_background
:
Personal background
profile_created
:
Profile was successfully created.
profile_updated
:
Profile was successfully updated.
region
:
&id-regions
canton
:
Canton
city
:
City
...
...
@@ -328,10 +320,7 @@ en:
users
:
Users
voluntary_platform
:
Voluntaries Platform
volunteer_application
:
Volunteer Application
volunteer_created
:
Volunteer was successfully created.
volunteer_destroyed
:
Volunteer was successfully deleted.
volunteer_request
:
Request for volunteers
volunteer_updated
:
Volunteer was successfully updated.
volunteers
:
Volunteers
wanna_apply
:
Do you want to apply as a volunteer?
weekdays
:
...
...
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