Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
EIP
Project Forum
Project Forum
Commits
5c827f3f
Verified
Commit
5c827f3f
authored
Nov 27, 2022
by
Martin Mladenov
Browse files
Improve email sending UI
parent
6a40870a
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/controllers/admin/course_editions_controller.rb
View file @
5c827f3f
...
...
@@ -17,7 +17,7 @@ module Admin
add_breadcrumb
'Editions'
,
admin_course_path
(
@course
)
end
before_action
only:
%i[show edit duplicate]
do
before_action
only:
%i[show edit duplicate
write_email
]
do
add_breadcrumb
@course_edition
.
display_name
,
admin_course_edition_path
(
@course
,
@course_edition
)
end
...
...
app/views/admin/course_editions/write_email/write_email.html.erb
View file @
5c827f3f
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<%
role_email
=
params
[
:type
]
==
'role'
%>
<%
recipient_name
=
role_email
?
"
#{
@course_specific_role
.
name
.
pluralize
}
"
:
params
[
:type
].
capitalize
%>
<h2>
<%=
"Email All
#{
params
[
:type
]
==
'role'
?
' Group '
:
''
}#{
recipient_name
}
"
%>
</h2>
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<%=
bootstrap_form_tag
url:
send_email_admin_course_edition_path
(
@course
,
@course_edition
,
type:
params
[
:type
],
role:
params
[
:role
])
do
|
f
|
%>
<%
if
role_email
%>
<p
class=
"txt-italic"
>
Note: This email will be sent to all users who have the
<%=
@course_specific_role
.
name
%>
role assigned
for at least one
<span
class=
"txt-bold"
>
group
</span>
.
Users who have it assigned for a project without groups will
<span
class=
"txt-bold"
>
not
</span>
receive
an email.
</p>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<%
role_email
=
params
[
:type
]
==
'role'
%>
<%
recipient_name
=
(
role_email
?
"Group
#{
@course_specific_role
.
name
.
pluralize
}
"
:
params
[
:type
].
capitalize
)
+
" in
#{
@course_edition
.
display_name
}
"
%>
<h2>
<%=
"Email All
#{
recipient_name
}
"
%>
</h2>
<div
class=
"panel-body"
>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<%=
bootstrap_form_tag
url:
send_email_admin_course_edition_path
(
@course
,
@course_edition
,
type:
params
[
:type
],
role:
params
[
:role
])
do
|
f
|
%>
<%
if
role_email
%>
<p
class=
"txt-italic"
>
Note: This email will be sent to all users who have the
<%=
@course_specific_role
.
name
%>
role
assigned
for at least one
<span
class=
"txt-bold"
>
group
</span>
.
Users who have it assigned for a project without groups will
<span
class=
"txt-bold"
>
not
</span>
receive
an email.
</p>
<%
end
%>
<%=
f
.
text_field
:from
,
required:
true
,
disabled:
true
,
value:
@course_edition
.
course_email
.
blank?
?
"
#{
current_user
.
full_name
}
<
#{
current_user
.
email
}
>"
:
"
#{
@course_edition
.
display_name
}
<
#{
@course_edition
.
course_email
}
>"
,
label:
(
'From '
+
popover
(
'You can change this by setting the course email in the course edition settings.'
)).
html_safe
%>
<%=
f
.
text_field
:to
,
required:
true
,
disabled:
true
,
value:
recipient_name
%>
<%=
f
.
text_field
:subject
,
required:
true
%>
<%=
f
.
text_area
:message
,
rows:
10
,
placeholder:
"Send a message to all
#{
recipient_name
}
. You will receive a copy of the email as well."
,
required:
true
%>
<div
class=
"d-flex justify-content-space-between"
>
<%=
link_to
admin_course_edition_path
(
@course_edition
.
course
,
@course_edition
),
class:
'btn btn-default'
do
%>
<%=
glyphicon
'chevron-left'
%>
Cancel
<%
end
%>
<%=
f
.
submit
'Send Message'
,
class:
'btn btn-primary'
%>
</div>
<%
end
%>
<%=
f
.
text_field
:from
,
required:
true
,
disabled:
true
,
value:
@course_edition
.
course_email
.
blank?
?
"
#{
current_user
.
full_name
}
<
#{
current_user
.
email
}
>"
:
"
#{
@course_edition
.
display_name
}
<
#{
@course_edition
.
course_email
}
>"
,
label:
(
'From '
+
popover
(
'You can change this by setting the course email in the course edition settings.'
)).
html_safe
%>
<%=
f
.
text_field
:subject
,
required:
true
%>
<%=
f
.
text_area
:message
,
rows:
10
,
placeholder:
"Send a message to all
#{
recipient_name
}
. You will receive a copy of the email as well."
,
required:
true
%>
<%=
f
.
submit
'Send Message'
,
class:
'btn btn-primary right'
%>
<%
end
%>
</div>
</div>
</div>
</div>
</div>
</div>
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