Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
71f7675c
Commit
71f7675c
authored
Aug 08, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display list of recipientgroups properly
- Use html5 validation - initiate create action
parent
859aa33a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
8 deletions
+18
-8
app/controllers/admin/emails_controller.rb
app/controllers/admin/emails_controller.rb
+7
-0
app/helpers/admin_email_helper.rb
app/helpers/admin_email_helper.rb
+2
-2
app/views/admin/emails/show.html.haml
app/views/admin/emails/show.html.haml
+4
-5
config/routes.rb
config/routes.rb
+1
-1
spec/routing/admin_routing_spec.rb
spec/routing/admin_routing_spec.rb
+4
-0
No files found.
app/controllers/admin/emails_controller.rb
View file @
71f7675c
class
Admin::EmailsController
<
Admin
::
ApplicationController
def
show
end
def
create
AdminEmailsWorker
.
perform_async
(
params
[
:recipients
],
params
[
:subject
],
params
[
:body
])
redirect_to
admin_email_path
,
notice:
'Email send'
end
protected
end
app/helpers/admin_email_helper.rb
View file @
71f7675c
...
...
@@ -2,7 +2,7 @@ module AdminEmailHelper
def
admin_email_grouped_recipient_options
options_for_select
([[
'Everyone'
,
'all'
]])
+
grouped_options_for_select
(
'Groups'
=>
Group
.
pluck
(
:name
,
:id
).
map
{
|
name
,
id
|
[
name
,
"group
_
#{
id
}
"
]
},
'Groups'
=>
Group
.
pluck
(
:name
,
:id
).
map
{
|
name
,
id
|
[
name
,
"group
-
#{
id
}
"
]
},
'Projects'
=>
grouped_project_list
)
end
...
...
@@ -12,7 +12,7 @@ module AdminEmailHelper
Group
.
includes
(
:projects
).
flat_map
do
|
group
|
group
.
human_name
group
.
projects
.
map
do
|
project
|
[
"
#{
group
.
human_name
}
/
#{
project
.
name
}
"
,
"project
_
#{
project
.
id
}
"
]
[
"
#{
group
.
human_name
}
/
#{
project
.
name
}
"
,
"project
-
#{
project
.
id
}
"
]
end
end
end
...
...
app/views/admin/emails/show.html.haml
View file @
71f7675c
...
...
@@ -7,17 +7,16 @@
.form-group
%label
.control-label
{
for: :subject
}
Subject
.col-sm-10
=
text_field_tag
:subject
,
''
,
class:
'form-control'
=
text_field_tag
:subject
,
''
,
class:
'form-control'
,
required:
true
.form-group
%label
.control-label
{
for: :body
}
Body
.col-sm-10
=
text_area_tag
:body
,
''
,
class:
'form-control'
,
rows:
15
=
text_area_tag
:body
,
''
,
class:
'form-control'
,
rows:
15
,
required:
true
.form-group
%label
.control-label
{
for: :recipients
}
Recipient
s
%label
.control-label
{
for: :recipients
}
Recipient
group
.col-sm-10
=
select_tag
:recipients
,
admin_email_grouped_recipient_options
,
class: :select2
=
select_tag
:recipients
,
admin_email_grouped_recipient_options
,
class: :select2
,
required:
true
.form-actions
=
submit_tag
'Send message'
,
class:
'btn btn-create'
config/routes.rb
View file @
71f7675c
...
...
@@ -86,7 +86,7 @@ Gitlab::Application.routes.draw do
resources
:broadcast_messages
,
only:
[
:index
,
:create
,
:destroy
]
resource
:logs
,
only:
[
:show
]
resource
:background_jobs
,
controller:
'background_jobs'
,
only:
[
:show
]
resource
:email
,
only:
[
:show
]
resource
:email
,
only:
[
:show
,
:create
]
resources
:projects
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
},
only:
[
:index
,
:show
]
do
member
do
...
...
spec/routing/admin_routing_spec.rb
View file @
71f7675c
...
...
@@ -123,4 +123,8 @@ describe Admin::EmailsController, "routing" do
it
"to #show"
do
get
(
"/admin/email"
).
should
route_to
(
'admin/emails#show'
)
end
it
"to #create"
do
post
(
"/admin/email"
).
should
route_to
(
'admin/emails#create'
)
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