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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
00e87004
Commit
00e87004
authored
Dec 31, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Broadcast Messages can now be edited
Closes #3046
parent
540ae3c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
28 deletions
+49
-28
app/controllers/admin/broadcast_messages_controller.rb
app/controllers/admin/broadcast_messages_controller.rb
+17
-5
app/views/admin/broadcast_messages/_form.html.haml
app/views/admin/broadcast_messages/_form.html.haml
+5
-5
app/views/admin/broadcast_messages/edit.html.haml
app/views/admin/broadcast_messages/edit.html.haml
+3
-0
app/views/admin/broadcast_messages/index.html.haml
app/views/admin/broadcast_messages/index.html.haml
+23
-17
config/routes.rb
config/routes.rb
+1
-1
No files found.
app/controllers/admin/broadcast_messages_controller.rb
View file @
00e87004
class
Admin::BroadcastMessagesController
<
Admin
::
ApplicationController
before_action
:
broadcast_messages
before_action
:
finder
,
only:
[
:edit
,
:update
,
:destroy
]
def
index
@broadcast_message
=
BroadcastMessage
.
new
@broadcast_messages
=
BroadcastMessage
.
reorder
(
"starts_at ASC"
).
page
(
params
[
:page
])
@broadcast_message
=
BroadcastMessage
.
new
end
def
edit
end
def
create
...
...
@@ -15,8 +19,16 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
end
end
def
update
if
@broadcast_message
.
update
(
broadcast_message_params
)
redirect_to
admin_broadcast_messages_path
,
notice:
'Broadcast Message was successfully updated.'
else
render
:edit
end
end
def
destroy
BroadcastMessage
.
find
(
params
[
:id
])
.
destroy
@broadcast_message
.
destroy
respond_to
do
|
format
|
format
.
html
{
redirect_back_or_default
(
default:
{
action:
'index'
})
}
...
...
@@ -26,8 +38,8 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
protected
def
broadcast_messages
@broadcast_message
s
||=
BroadcastMessage
.
order
(
"starts_at DESC"
).
page
(
params
[
:page
])
def
finder
@broadcast_message
=
BroadcastMessage
.
find
(
params
[
:id
])
end
def
broadcast_message_params
...
...
app/views/admin/broadcast_messages/_form.html.haml
View file @
00e87004
.broadcast-message-preview
.broadcast-message-preview
{
style:
broadcast_message_style
(
@broadcast_message
)
}
=
icon
(
'bullhorn'
)
%span
Your message here
%span
=
@broadcast_message
.
message
||
"Your message here"
=
form_for
[
:admin
,
@broadcast_message
],
html:
{
class:
'broadcast-message-form form-horizontal js-requires-input'
}
do
|
f
|
-
if
@broadcast_message
.
errors
.
any?
...
...
@@ -10,18 +10,18 @@
.form-group
=
f
.
label
:message
,
class:
'control-label'
.col-sm-10
=
f
.
text_area
:message
,
class:
"form-control"
,
rows:
2
,
required:
true
=
f
.
text_area
:message
,
class:
"form-control
js-quick-submit
"
,
rows:
2
,
required:
true
.form-group.js-toggle-colors-container
.col-sm-10.col-sm-offset-2
=
link_to
'Customize colors'
,
'#'
,
class:
'js-toggle-colors-link'
.form-group.js-toggle-colors-container.hide
=
f
.
label
:color
,
"Background Color"
,
class:
'control-label'
.col-sm-10
=
f
.
color_field
:color
,
value:
"#E75E40"
,
class:
"form-control"
=
f
.
color_field
:color
,
class:
"form-control"
.form-group.js-toggle-colors-container.hide
=
f
.
label
:font
,
"Font Color"
,
class:
'control-label'
.col-sm-10
=
f
.
color_field
:font
,
value:
"#FFFFFF"
,
class:
"form-control"
=
f
.
color_field
:font
,
class:
"form-control"
.form-group
=
f
.
label
:starts_at
,
class:
'control-label'
.col-sm-10.datetime-controls
...
...
app/views/admin/broadcast_messages/edit.html.haml
0 → 100644
View file @
00e87004
-
page_title
"Broadcast Messages"
=
render
'form'
app/views/admin/broadcast_messages/index.html.haml
View file @
00e87004
...
...
@@ -8,24 +8,30 @@
=
render
'form'
%br
.clearfix
-
if
@broadcast_messages
.
any?
%ul
.bordered-list.broadcast-messages
-
@broadcast_messages
.
each
do
|
broadcast_message
|
%li
.pull-right
-
if
broadcast_message
.
starts_at
%strong
#{
broadcast_message
.
starts_at
.
to_s
(
:short
)
}
\...
-
if
broadcast_message
.
ends_at
%strong
#{
broadcast_message
.
ends_at
.
to_s
(
:short
)
}
=
link_to
[
:admin
,
broadcast_message
],
method: :delete
,
remote:
true
,
class:
'remove-row btn btn-xs'
do
%i
.fa.fa-times.cred
.message
=
broadcast_message
.
message
%table
.table
%thead
%tr
%th
Status
%th
Preview
%th
Starts
%th
Ends
%th
%tbody
-
@broadcast_messages
.
each
do
|
message
|
%tr
%td
=
message
.
status
%td
=
broadcast_message
(
message
)
%td
=
message
.
starts_at
.
to_s
(
:iso861
)
%td
=
message
.
ends_at
.
to_s
(
:iso861
)
%td
=
link_to
icon
(
'pencil-square-o'
),
edit_admin_broadcast_message_path
(
message
),
title:
'Edit'
,
class:
'btn btn-xs'
=
link_to
icon
(
'times'
),
admin_broadcast_message_path
(
message
),
method: :delete
,
remote:
true
,
title:
'Remove'
,
class:
'js-remove-tr btn btn-xs btn-danger'
=
paginate
@broadcast_messages
config/routes.rb
View file @
00e87004
...
...
@@ -219,7 +219,7 @@ Rails.application.routes.draw do
get
:test
end
resources
:broadcast_messages
,
only:
[
:index
,
:
cre
ate
,
:destroy
]
resources
:broadcast_messages
,
only:
[
:index
,
:
edit
,
:create
,
:upd
ate
,
:destroy
]
resource
:logs
,
only:
[
:show
]
resource
:background_jobs
,
controller:
'background_jobs'
,
only:
[
:show
]
...
...
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