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
class
Admin::BroadcastMessagesController
<
Admin
::
ApplicationController
before_action
:
broadcast_messages
before_action
:
finder
,
only:
[
:edit
,
:update
,
:destroy
]
def
index
def
index
@broadcast_message
=
BroadcastMessage
.
new
@broadcast_messages
=
BroadcastMessage
.
reorder
(
"starts_at ASC"
).
page
(
params
[
:page
])
@broadcast_message
=
BroadcastMessage
.
new
end
def
edit
end
end
def
create
def
create
...
@@ -15,8 +19,16 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
...
@@ -15,8 +19,16 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
end
end
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
def
destroy
BroadcastMessage
.
find
(
params
[
:id
])
.
destroy
@broadcast_message
.
destroy
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_back_or_default
(
default:
{
action:
'index'
})
}
format
.
html
{
redirect_back_or_default
(
default:
{
action:
'index'
})
}
...
@@ -26,8 +38,8 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
...
@@ -26,8 +38,8 @@ class Admin::BroadcastMessagesController < Admin::ApplicationController
protected
protected
def
broadcast_messages
def
finder
@broadcast_message
s
||=
BroadcastMessage
.
order
(
"starts_at DESC"
).
page
(
params
[
:page
])
@broadcast_message
=
BroadcastMessage
.
find
(
params
[
:id
])
end
end
def
broadcast_message_params
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'
)
=
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
|
=
form_for
[
:admin
,
@broadcast_message
],
html:
{
class:
'broadcast-message-form form-horizontal js-requires-input'
}
do
|
f
|
-
if
@broadcast_message
.
errors
.
any?
-
if
@broadcast_message
.
errors
.
any?
...
@@ -10,18 +10,18 @@
...
@@ -10,18 +10,18 @@
.form-group
.form-group
=
f
.
label
:message
,
class:
'control-label'
=
f
.
label
:message
,
class:
'control-label'
.col-sm-10
.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
.form-group.js-toggle-colors-container
.col-sm-10.col-sm-offset-2
.col-sm-10.col-sm-offset-2
=
link_to
'Customize colors'
,
'#'
,
class:
'js-toggle-colors-link'
=
link_to
'Customize colors'
,
'#'
,
class:
'js-toggle-colors-link'
.form-group.js-toggle-colors-container.hide
.form-group.js-toggle-colors-container.hide
=
f
.
label
:color
,
"Background Color"
,
class:
'control-label'
=
f
.
label
:color
,
"Background Color"
,
class:
'control-label'
.col-sm-10
.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
.form-group.js-toggle-colors-container.hide
=
f
.
label
:font
,
"Font Color"
,
class:
'control-label'
=
f
.
label
:font
,
"Font Color"
,
class:
'control-label'
.col-sm-10
.col-sm-10
=
f
.
color_field
:font
,
value:
"#FFFFFF"
,
class:
"form-control"
=
f
.
color_field
:font
,
class:
"form-control"
.form-group
.form-group
=
f
.
label
:starts_at
,
class:
'control-label'
=
f
.
label
:starts_at
,
class:
'control-label'
.col-sm-10.datetime-controls
.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 @@
...
@@ -8,24 +8,30 @@
=
render
'form'
=
render
'form'
%br
.clearfix
-
if
@broadcast_messages
.
any?
-
if
@broadcast_messages
.
any?
%ul
.bordered-list.broadcast-messages
%table
.table
-
@broadcast_messages
.
each
do
|
broadcast_message
|
%thead
%li
%tr
.pull-right
%th
Status
-
if
broadcast_message
.
starts_at
%th
Preview
%strong
%th
Starts
#{
broadcast_message
.
starts_at
.
to_s
(
:short
)
}
%th
Ends
\...
%th
-
if
broadcast_message
.
ends_at
%tbody
%strong
-
@broadcast_messages
.
each
do
|
message
|
#{
broadcast_message
.
ends_at
.
to_s
(
:short
)
}
%tr
%td
=
link_to
[
:admin
,
broadcast_message
],
method: :delete
,
remote:
true
,
class:
'remove-row btn btn-xs'
do
=
message
.
status
%i
.fa.fa-times.cred
%td
=
broadcast_message
(
message
)
.message
=
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
=
paginate
@broadcast_messages
config/routes.rb
View file @
00e87004
...
@@ -219,7 +219,7 @@ Rails.application.routes.draw do
...
@@ -219,7 +219,7 @@ Rails.application.routes.draw do
get
:test
get
:test
end
end
resources
:broadcast_messages
,
only:
[
:index
,
:
cre
ate
,
:destroy
]
resources
:broadcast_messages
,
only:
[
:index
,
:
edit
,
:create
,
:upd
ate
,
:destroy
]
resource
:logs
,
only:
[
:show
]
resource
:logs
,
only:
[
:show
]
resource
:background_jobs
,
controller:
'background_jobs'
,
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