mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Added helper which provide ability to add your html to <head> tag
This commit is contained in:
parent
2c3b24c27f
commit
fc144ddd88
3 changed files with 27 additions and 0 deletions
|
@ -3,6 +3,7 @@ HEAD
|
|||
|
||||
- **Improve ActiveJob integration** - Web UI now shows ActiveJobs in a
|
||||
nicer format and job logging shows the actual class name [#2248, #2259]
|
||||
- Added helper which provide ability to add your html code to page `<head>` tag [#2270]
|
||||
- Web UI polling now uses Ajax to avoid page reload [#2266]
|
||||
- Add Sidekiq::Process#dump\_threads API to trigger TTIN output [#2247]
|
||||
|
||||
|
|
|
@ -20,6 +20,31 @@ module Sidekiq
|
|||
def filtering(*)
|
||||
end
|
||||
|
||||
# This view helper provide ability display you html code in
|
||||
# to head of page. Example:
|
||||
#
|
||||
# <% add_to_head do %>
|
||||
# <link rel="stylesheet" .../>
|
||||
# <meta .../>
|
||||
# <% end %>
|
||||
#
|
||||
def add_to_head(&block)
|
||||
@head_html ||= []
|
||||
@head_html << block if block_given?
|
||||
end
|
||||
|
||||
def display_custom_head
|
||||
return unless @head_html
|
||||
@head_html.map { |block| capture(&block) }.join
|
||||
end
|
||||
|
||||
# Simple capture method for erb templates. The origin was
|
||||
# capture method from sinatra-contrib library.
|
||||
def capture(&block)
|
||||
block.call
|
||||
eval('', block.binding)
|
||||
end
|
||||
|
||||
def locale
|
||||
lang = (request.env["HTTP_ACCEPT_LANGUAGE"] || 'en').split(',')[0].downcase
|
||||
strings[lang] ? lang : 'en'
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<script type="text/javascript" src="<%= root_path %>javascripts/application.js"></script>
|
||||
<script type="text/javascript" src="<%= root_path %>javascripts/locales/jquery.timeago.<%= locale %>.js"></script>
|
||||
<meta name="google" content="notranslate" />
|
||||
<%= display_custom_head %>
|
||||
</head>
|
||||
<body class="admin">
|
||||
<%= erb :_nav %>
|
||||
|
|
Loading…
Add table
Reference in a new issue