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
Jérome Perrin
gitlab-ce
Commits
dd501aa7
Commit
dd501aa7
authored
Nov 12, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Broadcast messages scaffold in admin area
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
f1ecf53c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
0 deletions
+73
-0
app/assets/stylesheets/gitlab_bootstrap/forms.scss
app/assets/stylesheets/gitlab_bootstrap/forms.scss
+6
-0
app/controllers/admin/broadcast_messages_controller.rb
app/controllers/admin/broadcast_messages_controller.rb
+23
-0
app/models/broadcast_message.rb
app/models/broadcast_message.rb
+2
-0
app/views/admin/broadcast_messages/index.html.haml
app/views/admin/broadcast_messages/index.html.haml
+41
-0
config/routes.rb
config/routes.rb
+1
-0
No files found.
app/assets/stylesheets/gitlab_bootstrap/forms.scss
View file @
dd501aa7
...
...
@@ -49,3 +49,9 @@ fieldset legend {
font-size
:
16px
;
margin-bottom
:
10px
;
}
.datetime-controls
{
select
{
width
:
100px
;
}
}
app/controllers/admin/broadcast_messages_controller.rb
0 → 100644
View file @
dd501aa7
class
Admin::BroadcastMessagesController
<
Admin
::
ApplicationController
before_filter
:broadcast_messages
def
index
@broadcast_message
=
BroadcastMessage
.
new
end
def
create
@broadcast_message
=
BroadcastMessage
.
new
(
params
[
:broadcast_message
])
if
@broadcast_message
.
save
redirect_to
admin_broadcast_messages_path
,
notice:
'Broadcast Message was successfully created.'
else
render
:index
end
end
protected
def
broadcast_messages
@broadcast_messages
||=
BroadcastMessage
.
order
(
"starts_at DESC"
).
page
(
params
[
:page
])
end
end
app/models/broadcast_message.rb
View file @
dd501aa7
...
...
@@ -2,4 +2,6 @@ class BroadcastMessage < ActiveRecord::Base
attr_accessible
:alert_type
,
:ends_at
,
:message
,
:starts_at
validates
:message
,
presence:
true
validates
:starts_at
,
presence:
true
validates
:ends_at
,
presence:
true
end
app/views/admin/broadcast_messages/index.html.haml
0 → 100644
View file @
dd501aa7
%h3
.page-title
Broadcast Messages
%p
.light
Broadcast messages displayed for every user and can be used to notify application about scheduled maintenance.
%hr
=
form_for
[
:admin
,
@broadcast_message
]
do
|
f
|
-
if
@broadcast_message
.
errors
.
any?
.alert.alert-error
-
@broadcast_message
.
errors
.
full_messages
.
each
do
|
msg
|
%p
=
msg
.control-group
=
f
.
label
:message
.controls
=
f
.
text_area
:message
,
class:
"input-xxlarge"
,
rows:
2
,
required:
true
.control-group
=
f
.
label
:starts_at
.controls.datetime-controls
=
f
.
datetime_select
:starts_at
.control-group
=
f
.
label
:ends_at
.controls.datetime-controls
=
f
.
datetime_select
:ends_at
.form-actions
=
f
.
submit
"Add broadcast message"
,
class:
"btn btn-create"
-
if
@broadcast_messages
.
any?
%ul
.bordered-list
-
@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
)
}
.message
=
broadcast_message
.
message
=
paginate
@broadcast_messages
config/routes.rb
View file @
dd501aa7
...
...
@@ -86,6 +86,7 @@ Gitlab::Application.routes.draw do
get
:test
end
resources
:broadcast_messages
,
only:
[
:index
,
:create
]
resource
:logs
,
only:
[
:show
]
resource
:background_jobs
,
controller:
'background_jobs'
,
only:
[
:show
]
resources
:projects
,
constraints:
{
id:
/[a-zA-Z.\/0-9_\-]+/
},
only:
[
:index
,
: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