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
b1a41cd9
Verified
Commit
b1a41cd9
authored
Feb 27, 2018
by
Kaspar Vollenweider
👻
Browse files
button_and_action
parent
bd261eda
Pipeline
#15313
failed with stage
in 24 minutes and 51 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/assets/stylesheets/_utility.scss
View file @
b1a41cd9
...
...
@@ -120,6 +120,27 @@
font-size
:
70%
;
}
h1
.small
{
font-size
:
floor
((
$font-size-base
*
2
.1
))
}
h2
.small
{
font-size
:
floor
((
$font-size-base
*
1
.8
))
}
h3
.small
{
font-size
:
floor
((
$font-size-base
*
1
.5
))
}
h4
.small
{
font-size
:
floor
((
$font-size-base
*
1
.4
))
}
h5
.small
{
font-size
:
floor
((
$font-size-base
*
1
.3
))
}
@mixin
a4
{
background
:
$white
;
height
:
$a4-long-side
;
...
...
app/assets/stylesheets/application.scss
View file @
b1a41cd9
@import
'utility'
;
@import
'bootstrap_custom'
;
@import
'utility'
;
@import
'bootstrap-datepicker3'
;
@import
"font-awesome"
;
@import
'jquery-ui/core'
;
...
...
app/controllers/volunteers_controller.rb
View file @
b1a41cd9
...
...
@@ -4,7 +4,7 @@ class VolunteersController < ApplicationController
include
ContactAttributes
include
VolunteerAttributes
before_action
:set_volunteer
,
only:
[
:show
,
:edit
,
:update
,
:terminate
]
before_action
:set_volunteer
,
only:
[
:show
,
:edit
,
:update
,
:terminate
,
:account
]
def
index
authorize
Volunteer
...
...
@@ -80,6 +80,22 @@ class VolunteersController < ApplicationController
@seeking_clients
=
@q
.
result
.
paginate
(
page:
params
[
:page
])
end
def
account
@volunteer
.
contact
.
assign_attributes
(
validate_email_format:
true
,
primary_email:
@volunteer
.
import
.
store
[
'haupt_person'
][
'email'
])
if
@volunteer
.
save
invite_volunteer_user
elsif
@volunteer
.
contact
.
errors
.
messages
[
:primary_email
].
any?
redirect_to
@volunteer
,
notice:
{
message:
'Die Mailadresse ist scheinbar nicht gültig'
,
model_message:
'Für einen Useraccount wird eine gültige Email benötigt.'
,
action_link:
{
text:
'Mailadresse konfigurieren'
,
path:
edit_volunteer_path
(
@volunteer
)
}
}
else
redirect_to
@volunteer
,
notice:
'Account erstellen fehlgeschlagen!'
end
end
private
def
not_resigned
...
...
app/models/contact.rb
View file @
b1a41cd9
class
Contact
<
ApplicationRecord
attr_accessor
:validate_email_format
before_save
:update_full_name
,
if: :full_name_changed?
,
unless: :department?
belongs_to
:contactable
,
polymorphic:
true
,
optional:
true
...
...
@@ -6,6 +8,9 @@ class Contact < ApplicationRecord
validates
:last_name
,
presence:
true
,
if: :validate_last_name?
validates
:first_name
,
presence:
true
,
if: :validate_first_name?
validates
:primary_email
,
presence:
true
,
if: :needs_primary_email?
validates
:primary_email
,
format:
{
with:
Devise
.
email_regexp
},
if: :validate_email_format
validates
:primary_phone
,
presence:
true
,
if: :needs_primary_phone?
validates
:street
,
:postal_code
,
:city
,
presence:
true
,
if: :needs_address?
...
...
app/policies/volunteer_policy.rb
View file @
b1a41cd9
...
...
@@ -21,6 +21,7 @@ class VolunteerPolicy < ApplicationPolicy
alias_method
:show?
,
:volunteer_managing_or_volunteers_profile?
alias_method
:edit?
,
:volunteer_managing_or_volunteers_profile?
alias_method
:update?
,
:volunteer_managing_or_volunteers_profile?
alias_method
:account?
,
:superadmin?
# supplementary policies
alias_method
:superadmin_privileges?
,
:superadmin?
...
...
app/views/volunteers/show.html.slim
View file @
b1a41cd9
...
...
@@ -38,7 +38,22 @@ nav.navbar.section-navigation
li
=
form_navigation_btn
:back
,
with_row:
false
unless
current_user
.
volunteer?
-
if
policy
(
Volunteer
).
superadmin_privileges?
h3
=
t
(
'checklist'
)
-
if
@volunteer
.
accepted?
&&
@volunteer
.
import
.
present?
-
if
@volunteer
.
user
.
present?
h2
.small
Importiert
p
.text-warning
Dieses
Freiwilligenprofil
wurde
von
Access
importiert
.
Ein
Useraccount
wurde
bereits
erstellt
.
-
if
@volunteer
.
user
.
blank?
&&
@volunteer
.
import
.
store
[
'haupt_person'
][
'email'
].
present?
h2
.small
Import
p
.text-warning
Dieses
Freiwilligenprofil
wurde
von
Access
importiert
.
h3
User
Account
erstellen
p
'
F
ür
die
Emailadresse
=
mail_to
"
#{
@volunteer
.
import
.
store
[
'haupt_person'
][
'email'
]
}
",
@volunteer
.import.store
['haupt_person']['email']
=
' einen '
=
link_to
"Account erstellen"
,
account_volunteer_path
(
@volunteer
),
method: :put
,
class:
'btn btn-default btn-xs'
h2
.small
=
t
(
'checklist'
)
.table-responsive
table
.table.table-no-border-top
tbody
...
...
config/routes.rb
View file @
b1a41cd9
...
...
@@ -97,6 +97,7 @@ Rails.application.routes.draw do
resources
:volunteers
,
except:
[
:destroy
],
concerns: :search
do
put
:terminate
,
on: :member
put
:account
,
on: :member
get
:find_client
,
on: :member
,
to:
'assignments#find_client'
get
:seeking_clients
,
on: :collection
...
...
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