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
6baa382e
Verified
Commit
6baa382e
authored
Mar 01, 2018
by
Kaspar Vollenweider
👻
Browse files
finalizing assigning email only thru input field
parent
bf8a3d7f
Pipeline
#15385
failed with stage
in 27 minutes and 22 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/controllers/volunteers_controller.rb
View file @
6baa382e
...
...
@@ -82,9 +82,11 @@ class VolunteersController < ApplicationController
def
account
@volunteer
.
contact
.
assign_attributes
(
validate_email_format:
true
,
primary_email:
@
volunteer
.
import
.
store
[
'haupt_person'
][
'
email
'
])
primary_email:
volunteer
_params
[
:contact_attributes
][
:primary_
email
])
if
@volunteer
.
save
invite_volunteer_user
redirect_back
(
fallback_location:
volunteer_path
(
@volunteer
),
notice:
'Freiwillige/r erhält eine Accountaktivierungs-Email.'
)
elsif
@volunteer
.
contact
.
errors
.
messages
[
:primary_email
].
any?
redirect_to
@volunteer
,
notice:
{
message:
'Die Mailadresse ist scheinbar nicht gültig'
,
...
...
app/models/import.rb
View file @
6baa382e
...
...
@@ -20,4 +20,16 @@ class Import < ApplicationRecord
def
self
.
find_by_hauptperson
(
hauptperson_id
)
with_deleted
.
find_by
(
'store @> ?'
,
{
haupt_person:
{
pk_Hauptperson:
hauptperson_id
}
}.
to_json
)
end
def
volunteer?
importable_type
==
'Volunteer'
end
def
email
@email
||=
store
[
'haupt_person'
][
'email'
]
if
volunteer?
end
def
email_valid?
@email_valid
||=
email
.
match
(
Devise
.
email_regexp
)
if
volunteer?
&&
email
.
present?
end
end
app/views/volunteers/_import_account_invite.html.slim
View file @
6baa382e
...
...
@@ -4,14 +4,19 @@ p.text-warning Dieses Freiwilligenprofil wurde von Access importiert.
p
.text-warning
Ein
Useraccount
wurde
bereits
erstellt
.
-
elsif
volunteer
.
user
.
blank?
&&
volunteer
.
accepted?
h3
.small
User
Account
erstellen
-
if
volunteer
.
import
.
store
[
'haupt_person'
][
'email'
].
present?
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'
-
if
volunteer
.
import
.
email_valid?
p
Für
die
Emailadresse
#{
mail_to
"#{volunteer.import.email}"
,
volunteer
.
import
.
email
}
einen
Account
erstellen
-
elsif
volunteer
.
import
.
email
.
present?
p
.text-danger
Scheinbar
ist
die
importierte
Mailadresse
nicht
gültig
.
-
else
=
simple_form_for
(
volunteer
,
url:
account_volunteer_path
(
volunteer
))
do
|
f
|
=
f
.
simple_fields_for
(
:contact
)
|
c
|
p
.text-warning
Es
wird
eine
gültige
Emailadresse
des
Freiwilligen
benötigt,
um
einen
Useraccount
zu
erstellen
.
p
Bitte
stellen
Sie
sicher
das
die
importierte
Mailadresse
des
Freiwilligen
korrekt
ist
.
=
simple_form_for
(
volunteer
,
url:
account_volunteer_path
(
volunteer
),
method: :put
)
do
|
f
|
.row
=
f
.
simple_fields_for
(
:contact
)
do
|
c
|
.form-group.col-xs-12.col-md-4
=
c
.
label
:primary_email
=
c
.
input_field
:primary_email
,
value:
volunteer
.
import
.
email_valid?
?
volunteer
.
import
.
email
:
''
,
class:
'form-control'
=
f
.
button
:submit
,
value:
'Account mit angegebener Email erstellen'
app/views/volunteers/_volunteer.html.slim
View file @
6baa382e
...
...
@@ -14,8 +14,13 @@ tr
td
=
volunteer
.
expectations
td
=
volunteer
.
interests
-
if
policy
(
Volunteer
).
show_acceptance?
td
.button-acceptance
=
link_to
t
(
".acceptance.
#{
volunteer
.
acceptance
}
"
),
'#'
,
class
:
"btn
btn-xs
btn-acceptance-
#{
volunteer
.
acceptance
}
"
td
.button-acceptance.index-action-cell
=
link_to
t
(
".acceptance.
#{
volunteer
.
acceptance
}
"
),
'#'
,
class:
"btn btn-xs btn-acceptance-
#{
volunteer
.
acceptance
}
"
-
if
!
volunteer
.
external
&&
volunteer
.
user
.
blank?
span
Kein
Login
-
if
volunteer
.
import
.
present?
span
Importiert
td
=
volunteer
.
external?
?
t_attr
(
:external
)
:
t_attr
(
:internal
)
td
-
if
volunteer
.
self_applicant?
...
...
app/views/volunteers/show.html.slim
View file @
6baa382e
...
...
@@ -39,7 +39,7 @@ nav.navbar.section-navigation
-
if
policy
(
Volunteer
).
superadmin_privileges?
-
if
@volunteer
.
import
.
present?
=
render
'import_acount_invite'
,
volunteer:
@volunteer
=
render
'import_ac
c
ount_invite'
,
volunteer:
@volunteer
h2
.small
=
t
(
'checklist'
)
...
...
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