foreman_custom_banner 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 02f911ea973e0dcb2e12e767925392652d284401
4
- data.tar.gz: 02052eb52bd980e348a9888ca12520ae840549b4
3
+ metadata.gz: e174b459460db8214f2872c215c5eb0bdd0067c9
4
+ data.tar.gz: 3009a6be4af917f4ccce22855bb568bd54a10264
5
5
  SHA512:
6
- metadata.gz: 8e6dc5abe7d6e649dae13d5714159dde65a036344cce27e741a3b2821968d79d337a3d8f45516c03e11d5f31661853be0da30ebc68f9595cf53f9796b8d62161
7
- data.tar.gz: a3567f99de905c80dbbb39b63c1e582a3597774986711c3cbed7961997fbdfd392c2d6a3bbc9cdfe7e69d790dd3460176cd416b2fa8276ba1a8825952eee4a59
6
+ metadata.gz: a50302e6c005055e282522652bb5de41783c7f6c93dc2a4d003acb93fefc1ada65896c9ef720414be571464b70a8d56f14d8e063aca213c1f1e02509e0062051
7
+ data.tar.gz: 4a2db9cfd377f19a288a286ccaa88447ebff0ed5785f553cce318abbbdd28c767963221ba2795d129e23ca4e4244860b2b2abdaf6efa4d93b5d19212b7634a58
data/CHANGES.md CHANGED
@@ -1,3 +1,13 @@
1
+ # Version 0.0.3
2
+
3
+ * Included functionality to set a hyperlink in the custom banner to an external
4
+ page
5
+ * Fixed deprecated plugin initialization behavior
6
+ * Updated minimum Foreman version requirement to 1.9
7
+ * By default, the banner now appears on both the login page and in the Foreman
8
+ application. This can be disabled with a new option, ``custom_banner_on_login_page``,
9
+ in the ``Settings`` page.
10
+
1
11
  # Version 0.0.2
2
12
 
3
13
  * Simplify plug-in by removing decorator implementation and just calling settings
data/CONTRIBUTORS CHANGED
@@ -1,2 +1,3 @@
1
1
  github/jcmcken
2
2
  github/stbenjam
3
+ github/discreet
data/README.md CHANGED
@@ -1,19 +1,40 @@
1
- # foreman_custom_banner
1
+ # foreman\_custom\_banner
2
2
 
3
3
  A Foreman plugin which provides a configurable, custom banner for the Foreman UI.
4
4
 
5
5
  The purpose of this plugin is to provide a simple way to distinguish multiple
6
- installations of Foreman, e.g. a production vs. a development installation.
6
+ installations of Foreman, e.g. a production vs. a development installation. As
7
+ well as the possibility of a link to a "help" or "quick start" page.
7
8
 
8
- This looks something like:
9
+ # Installation
9
10
 
10
- ![foreman_custom_banner_preview](foreman_custom_banner.png)
11
+ * Build and install the rubygem
12
+ * Add ``install/foreman_custom_banner.rb`` into Foreman's ``bundler.d``
13
+ directory.
14
+ E.g. in the packaged Foreman installation, ``/usr/share/foreman/bundler.d``
15
+ * Restart the webserver hosting the Foreman application
11
16
 
12
- Customize the banner by altering the plugin settings within Foreman and refreshing your browser.
17
+ # Configuration
13
18
 
14
- ## Installation
19
+ You configure the custom banner from the `Settings` page on the `Custom Banner`
20
+ tab:
21
+
22
+ ![custom\_banner\_settings\_preview](doc/foreman_custom_banner_config.png)
23
+
24
+ With a default installation the custom banner would look like this:
25
+
26
+ ![default\_custom\_banner\_preview](doc/foreman_custom_banner_default_preview.png)
27
+
28
+ If you only wanted to have a banner text simply remove the `custom_banner_url`
29
+ and `custom_banner_url_text` values:
30
+
31
+ ![text\_custom\banner\_preview](doc/foreman_custom_banner_text_preview.png)
32
+
33
+ If you only wanted to have a banner url simply remove the `custom_banner_text`
34
+ value:
35
+
36
+ ![url\_custom\_banner\_preview](doc/foreman_custom_banner_url_preview.png)
37
+
38
+ You can alter the style of the custom banner by changing the values for the
39
+ `custom_banner_style` field. This field will accept any CSS style configuration
15
40
 
16
- * Build and install the rubygem.
17
- * Add ``install/foreman_custom_banner.rb`` into Foreman's ``bundler.d`` directory.
18
- E.g. in the packaged Foreman installation, ``/usr/share/foreman/bundler.d``.
19
- * Restart the webserver hosting the Foreman application.
@@ -5,11 +5,17 @@ class Setting::CustomBanner < ::Setting
5
5
 
6
6
  Setting.transaction do
7
7
  [
8
- self.set('custom_banner_text', N_('Text to set on the custom banner'),
8
+ self.set('custom_banner_text', N_('Text to set on the custom banner'),
9
9
  'Configure the custom banner in your Foreman settings!'),
10
+ self.set('custom_banner_url_text', N_('Text to set URL on custom banner'),
11
+ 'Source code for this plugin'),
12
+ self.set('custom_banner_url', N_('URL for custom banner text'),
13
+ 'https://github.com/jcmcken/foreman_custom_banner'),
10
14
  self.set('custom_banner_enabled', N_('Whether to enable the custom banner'), true),
11
15
  self.set('custom_banner_style', N_('CSS styling for the custom banner'),
12
16
  'text-align:center;background-color:green;color:white;font-weight:bold;'),
17
+ self.set('custom_banner_on_login_page',
18
+ N_('Whether to enable the custom banner on the login page'), true),
13
19
  ].compact.each { |s| self.create! s.update(:category => "Setting::CustomBanner") }
14
20
  end
15
21
 
@@ -2,3 +2,12 @@ Deface::Override.new(:virtual_path => 'home/_topbar',
2
2
  :name => 'add_custom_banner',
3
3
  :insert_before => 'div.navbar.navbar-default.navbar-outer',
4
4
  :template => 'home/_foreman_custom_header')
5
+
6
+ if Setting[:custom_banner_on_login_page]
7
+ Deface::Override.new(
8
+ :virtual_path => 'layouts/login',
9
+ :name => 'add_custom_banner',
10
+ :insert_before => 'div.login-page',
11
+ :template => 'home/_foreman_custom_header'
12
+ )
13
+ end
@@ -1,5 +1,17 @@
1
1
  <% if Setting[:custom_banner_enabled] -%>
2
+ <% if Setting[:custom_banner_url].empty? or Setting[:custom_banner_url_text].empty? -%>
2
3
  <div style="<%= h(Setting[:custom_banner_style]) %>">
3
4
  <%= h(Setting[:custom_banner_text]) %>
4
5
  </div>
6
+ <% elsif Setting[:custom_banner_text].empty? %>
7
+ <div style="<%= h(Setting[:custom_banner_style]) %>">
8
+ <a href="<%= h(Setting[:custom_banner_url]) %>" target="_blank"><%= h(Setting[:custom_banner_url_text]) %></a>
9
+ </div>
10
+ <% else %>
11
+ <div style="<%= h(Setting[:custom_banner_style]) %>">
12
+ <%= h(Setting[:custom_banner_text]) %>
13
+ <br>
14
+ <a href="<%= h(Setting[:custom_banner_url]) %>" target="_blank"><%= h(Setting[:custom_banner_url_text]) %></a>
15
+ </div>
16
+ <% end -%>
5
17
  <% end -%>
@@ -6,19 +6,19 @@
6
6
 
7
7
  Summary: Plugin for Foreman that adds a custom banner
8
8
  Name: %{?scl_prefix}rubygem-%{gem_name}
9
- Version: 0.0.2
9
+ Version: 0.0.3
10
10
  Release: 1%{?dist}
11
11
  Group: Development/Languages
12
12
  License: Apache License 2.0
13
13
  URL: https://github.com/jcmcken/foreman_custom_banner
14
14
  Source0: %{gem_name}-%{version}.gem
15
15
  Requires: %{?scl_prefix}ruby(abi) = %{rubyabi}
16
- Requires: %{?scl_prefix}ruby(rubygems)
17
- Requires: %{?scl_prefix}rubygem(deface)
16
+ Requires: %{?scl_prefix}ruby(rubygems)
17
+ Requires: %{?scl_prefix}rubygem(deface)
18
18
  %{?scl:BuildRequires: scl-utils-build}
19
19
  BuildRequires: %{?scl_prefix}ruby(abi) = %{rubyabi}
20
- BuildRequires: %{?scl_prefix}ruby(rubygems)
21
- BuildRequires: %{?scl_prefix}rubygems-devel
20
+ BuildRequires: %{?scl_prefix}ruby(rubygems)
21
+ BuildRequires: %{?scl_prefix}rubygems-devel
22
22
  BuildArch: noarch
23
23
  Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}
24
24
 
@@ -83,6 +83,8 @@ rm %{buildroot}/%{gem_instdir}/*.spec
83
83
 
84
84
 
85
85
  %changelog
86
+ * Thu Apr 14 2016 Jon McKenzie - 0.0.3-1
87
+ - Bump to 0.0.3.
86
88
  * Mon Feb 16 2015 Jon McKenzie - 0.0.2-1
87
89
  - Initial release.
88
90
  * Sat Oct 11 2014 Jon McKenzie - 0.0.1-1
@@ -7,9 +7,9 @@ module ForemanCustomBanner
7
7
  (Setting.table_exists? rescue(false))
8
8
  end
9
9
 
10
- initializer 'foreman_custom_banner.register_plugin', :after => :finisher_hook do |app|
10
+ initializer 'foreman_custom_banner.register_plugin', :before => :finisher_hook do |app|
11
11
  Foreman::Plugin.register :foreman_custom_banner do
12
- requires_foreman '>= 1.5'
12
+ requires_foreman '>= 1.9'
13
13
  end
14
14
  end
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanCustomBanner
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_custom_banner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon McKenzie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-14 00:00:00.000000000 Z
11
+ date: 2016-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface
@@ -40,8 +40,12 @@ files:
40
40
  - app/models/settings/custom_banner.rb
41
41
  - app/overrides/add_banner.rb
42
42
  - app/views/home/_foreman_custom_header.html.erb
43
+ - doc/foreman_custom_banner.png
44
+ - doc/foreman_custom_banner_config.png
45
+ - doc/foreman_custom_banner_default_preview.png
46
+ - doc/foreman_custom_banner_text_preview.png
47
+ - doc/foreman_custom_banner_url_preview.png
43
48
  - foreman_custom_banner.gemspec
44
- - foreman_custom_banner.png
45
49
  - foreman_custom_banner.spec
46
50
  - install/foreman_custom_banner.rb
47
51
  - lib/foreman_custom_banner.rb