active_admin_environment_tag 0.0.1 → 0.0.2

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: eb4256edbace75130114696bf24ed9ef5ed8e206
4
- data.tar.gz: 0a9e1d3a19d2c6dd6261a5221feb5a6f27612cdc
3
+ metadata.gz: 82a5e408da4a9e9a16b3ecd61396d048a52da016
4
+ data.tar.gz: 9d106ab32cdcd79299b2bdb7bdcae7de54195dda
5
5
  SHA512:
6
- metadata.gz: 856d4211b7322c5dc12fb450f84b7e7d82d8891d4af86e3d5e27982178270e5ecdb64d472f7b174d797a9ca886d4c30956ddd9e4e16003cbb1734f75c738d124
7
- data.tar.gz: 42795fac539937c7c81e34e8b9a805a5e492012bc93ea2c041060822db7180ae638f0529d13d6312acecd1e770d6da093727df86328883faf275b0a8ae018d81
6
+ metadata.gz: efbdd832aee3a517b65ee35a98c45ed6f921fe65226a46a2e5d6248ebaeb6ae74cc7421d5da7e3d90aa35270da31c8480e72840266f9f9047c24ed47da5073f2
7
+ data.tar.gz: 2ddd1794a71dae088d6608f3d5e3b96e7748a3d60d8eb70363cb6eb041323256246d4bb1a188e7621323e478fcc11843c80704fc4381e934bb3cd884a39968d2
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # ActiveAdminEnvironmentTag
2
+
3
+ An ActiveAdmin plugin that provides tags on the admin panel to indicate which environment your rails project is running in
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'active_admin_environment_tag'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Include the active admin environment tag stylesheet in the `active_admin.rb` initializer:
16
+
17
+ config.register_stylesheet 'active_admin_environment_tag'
18
+
19
+ ## Configuration
20
+
21
+ ActiveAdminEnvironmentTag is configured using an initializer:
22
+
23
+ ```ruby
24
+ ActiveAdminEnvironmentTag.configure do |config|
25
+ config.environment_colors = {
26
+ staging: '#FCBF34'
27
+ }
28
+ end
29
+ ```
30
+
31
+ ### environment_colors
32
+
33
+ By default, ActiveAdminEnvironmentTag uses the following colors for each of basic environments:
34
+
35
+ ```ruby
36
+ development: '#91CA4B',
37
+ production: '#fc1f27',
38
+ default: '#c9d6e3'
39
+ ```
40
+
41
+ You can override these colors (including the default) or specify other environments using the `environment_colors` option to provide a hash of environment names and colors. If ActiveAdminEnvironmentTag is run in a Rails environment that does not have a color associated with it, `default` is used.
42
+
43
+
44
+ ```ruby
45
+ config.environment_colors = {
46
+ staging: '#FCBF34'
47
+ }
48
+ ```
49
+
50
+ ### tag_position
51
+
52
+ By default, the environment tag will appear in the top left area of the screen, however you can display it in the bottom left of the screen by specifying
53
+
54
+ config.tag_position = :bottom_left
55
+
56
+
57
+ Currently no other positions are supported as the left margin of the screen is the only area where the tag does not overlap content.
58
+
59
+ ## Contributing
60
+
61
+ 1. Fork it ( https://github.com/greena13/active_admin_environment_tag/fork )
62
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
63
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
64
+ 4. Push to the branch (`git push origin my-new-feature`)
65
+ 5. Create a new Pull Request
@@ -1,9 +1,11 @@
1
1
  .active-admin-environment-tag {
2
2
  position: fixed;
3
- top: 175px;
4
- left: 0;
5
- border: none;
6
- width: 20px;
3
+ <% position = ActiveAdminEnvironmentTag.tag_placement %>
4
+
5
+ top: <%= position[:top] %>;
6
+ left: <%= position[:left] %>;
7
+ right: <%= position[:right] %>;
8
+ bottom: <%= position[:bottom] %>;
7
9
  }
8
10
 
9
11
  .active-admin-environment-tag > div {
@@ -15,10 +17,11 @@
15
17
 
16
18
  background-color: <%= ActiveAdminEnvironmentTag.environment_colors.fetch(Rails.env.to_s.to_sym, ActiveAdminEnvironmentTag.environment_colors[:default]) %>;
17
19
 
20
+ font-size: 15px;
18
21
  height: 20px;
19
- width: 100px;
22
+ width: 120px;
20
23
  text-align: center;
21
24
  padding: 5px;
22
- margin-left: -45px;
25
+ margin-left: -50px;
23
26
  overflow: scroll;
24
27
  }
@@ -7,6 +7,7 @@ module ActiveAdminEnvironmentTag
7
7
  end
8
8
 
9
9
  class << self
10
+ attr_accessor :tag_position
10
11
  attr_reader :environment_colors
11
12
 
12
13
  def configuration
@@ -19,6 +20,10 @@ module ActiveAdminEnvironmentTag
19
20
  @environment_colors.merge!(new_colours)
20
21
  end
21
22
 
23
+ def tag_placement
24
+ @tag_positions.fetch(@tag_position.to_sym, @tag_positions[:top_left])
25
+ end
26
+
22
27
  alias :config :configuration
23
28
  alias :configure :configuration
24
29
  end
@@ -28,6 +33,24 @@ module ActiveAdminEnvironmentTag
28
33
  production: '#fc1f27',
29
34
  default: '#c9d6e3'
30
35
  }
36
+
37
+ @tag_position = :top_left
38
+
39
+ @tag_positions = {
40
+ top_left: {
41
+ top: '170px',
42
+ left: 0,
43
+ right: 'inherit',
44
+ bottom: 'inherit'
45
+ },
46
+
47
+ bottom_left: {
48
+ top: 'inherit',
49
+ left: 0,
50
+ right: 'inherit',
51
+ bottom: '100px'
52
+ }
53
+ }
31
54
  end
32
55
 
33
56
 
@@ -39,7 +62,7 @@ module ActiveAdmin
39
62
  super style: "text-align: right;"
40
63
 
41
64
  div class: 'active-admin-environment-tag' do
42
- div Rails.env
65
+ div Rails.env.capitalize
43
66
  end
44
67
  end
45
68
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveAdminEnvironmentTag
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_admin_environment_tag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleck Greenham
@@ -49,6 +49,7 @@ files:
49
49
  - ".gitignore"
50
50
  - Gemfile
51
51
  - LICENSE.txt
52
+ - README.md
52
53
  - Rakefile
53
54
  - active_admin_environment_tag.gemspec
54
55
  - app/assets/stylesheets/active_admin_environment_tag.css.erb