diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-12 15:08:20 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-11-12 15:08:20 +0200 |
commit | c5b667351abcda4b5ac134873007a0ce47976e88 (patch) | |
tree | d72c2d04658447ec9d2d2d119e1b7d19635f0488 /app | |
parent | 963a31144b0d69af7b08e1912965a920636ce600 (diff) | |
download | gitlab-ce-c5b667351abcda4b5ac134873007a0ce47976e88.tar.gz |
Show broadcast message to users
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/common.scss | 7 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 4 | ||||
-rw-r--r-- | app/models/broadcast_message.rb | 4 | ||||
-rw-r--r-- | app/views/layouts/_broadcast.html.haml | 4 | ||||
-rw-r--r-- | app/views/layouts/application.html.haml | 1 | ||||
-rw-r--r-- | app/views/layouts/projects.html.haml | 1 |
6 files changed, 21 insertions, 0 deletions
diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 8cb8e1b3276..56dbd9ac433 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -351,3 +351,10 @@ table { @extend .btn-new; padding: 5px 15px; } + +.broadcast-message { + padding: 10px; + text-align: center; + background: #555; + color: #BBB; +} diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e2d97901410..02cc696c722 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -208,4 +208,8 @@ module ApplicationHelper line += "..." if lines.size > 1 line end + + def broadcast_message + BroadcastMessage.current + end end diff --git a/app/models/broadcast_message.rb b/app/models/broadcast_message.rb index 69636de90ef..5b0040f6ca3 100644 --- a/app/models/broadcast_message.rb +++ b/app/models/broadcast_message.rb @@ -4,4 +4,8 @@ class BroadcastMessage < ActiveRecord::Base validates :message, presence: true validates :starts_at, presence: true validates :ends_at, presence: true + + def self.current + where("ends_at > :now AND starts_at < :now", now: Time.zone.now).last + end end diff --git a/app/views/layouts/_broadcast.html.haml b/app/views/layouts/_broadcast.html.haml new file mode 100644 index 00000000000..4c4de743fdf --- /dev/null +++ b/app/views/layouts/_broadcast.html.haml @@ -0,0 +1,4 @@ +- if broadcast_message.present? + .broadcast-message + %i.icon-bullhorn + = broadcast_message.message diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 792fe5e4a28..92edc718235 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -2,6 +2,7 @@ %html{ lang: "en"} = render "layouts/head", title: "Dashboard" %body{class: "#{app_theme} application", :'data-page' => body_data_page } + = render "layouts/broadcast" = render "layouts/head_panel", title: "Dashboard" = render "layouts/flash" %nav.main-nav diff --git a/app/views/layouts/projects.html.haml b/app/views/layouts/projects.html.haml index 6d8bf9b710b..5ccb69769cd 100644 --- a/app/views/layouts/projects.html.haml +++ b/app/views/layouts/projects.html.haml @@ -2,6 +2,7 @@ %html{ lang: "en"} = render "layouts/head", title: @project.name_with_namespace %body{class: "#{app_theme} project", :'data-page' => body_data_page, :'data-project-id' => @project.id } + = render "layouts/broadcast" = render "layouts/head_panel", title: project_title(@project) = render "layouts/init_auto_complete" = render "layouts/flash" |