awesome_admin_layout 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a87bb0e26832f381231cda7d2feecbfd0291a4b3
4
- data.tar.gz: 026e65ecdc919f9470c2d6ea83b5a38f23e8a323
3
+ metadata.gz: f5fa2bba6c312e2c990e1dc7560acdb9ed5d21a8
4
+ data.tar.gz: c618519d892b38e7e902010c774f5c1457668b34
5
5
  SHA512:
6
- metadata.gz: c024eda385110fc2be6c26b0ba245af9e190a99cbe7226238b342d99450f08c55e326f543b7d08f91dcd98594c1b85121a6728f8544d1bce33efa5b69fae1b1f
7
- data.tar.gz: a65fbcf3394de53784fcfc1279f513a3b70aacd9531498365e3f9c2ce91fe592a87bd5840b16d6fcd1b606351ae295b82a6603193c09d2b3c0c76f9a525a4703
6
+ metadata.gz: cc0fc9b72cb09b7696c6ecdbb43a75f31ba042c9a8380081b37deaa7f1b31c899a0b5175cffde782e249fcd3123734e23347934da96c2b7a12407af1a2068750
7
+ data.tar.gz: af837f5448e29a06d516086b4d863f61522213dc84ca60d32768cda79615aff8c3178031d79c90caec34e5f2ba55c38dff6a02b0aecf6e4f45caa328b4bc28db
@@ -1,3 +1,13 @@
1
+ ## 0.2.0 (August 13, 2015) ##
2
+
3
+ * Provides the `app/navigations` directory.
4
+
5
+ * Implement the navigation key.
6
+ You are able to define the multiple navigations.
7
+
8
+ * Improve the look and feel of the navigation.
9
+
10
+
1
11
  ## 0.1.2 (June 17, 2015) ##
2
12
 
3
13
  * Implement the functionality for the brand image.
data/README.md CHANGED
@@ -46,7 +46,7 @@ $ gem install awesome_admin_layout
46
46
  #= require awesome_admin_layout
47
47
  ```
48
48
 
49
- 4. Create a file named `awesome_admin_layout.rb` in `config/initializers`.
49
+ 4. Create a file into `app/navigations`.
50
50
  And writing the definitions as follows:
51
51
 
52
52
  ```ruby
@@ -54,9 +54,9 @@ $ gem install awesome_admin_layout
54
54
  # NOTE: if you only use this layout in admin controller,
55
55
  # you can write like this:
56
56
  #
57
- # `AwesomeAdminLayout.setup(only: Admin::ApplicationController)`
57
+ # `AwesomeAdminLayout.define(only: Admin::ApplicationController)`
58
58
  #
59
- AwesomeAdminLayout.setup do |controller|
59
+ AwesomeAdminLayout.define do |controller|
60
60
  navigation do
61
61
  brand 'AwesomeAdminLayout' do
62
62
  external_link controller.root_path
@@ -174,7 +174,7 @@ $ gem install awesome_admin_layout
174
174
  5. Use the helper method in your views.
175
175
 
176
176
  ```erb
177
- <%== render_admin_layout do %>
177
+ <%= render_admin_layout do %>
178
178
  <%# Put your main contents ... %>
179
179
  <% end %>
180
180
  ```
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ Dir.glob('lib/awesome_admin_layout/tasks/*.rake').each { |r| load r }
5
5
 
6
6
  Rake::TestTask.new(:test) do |t|
7
7
  t.libs << 'test'
8
- t.test_files = FileList['test/**/test_*.rb']
8
+ t.test_files = FileList['test/**/*_test.rb']
9
9
  end
10
10
 
11
11
  description = Rake::Task[:release].comment
@@ -21,6 +21,7 @@ $awesome_admin_layout-badge-bg: #479ccf !default;
21
21
  $awesome_admin_layout-badge-height: 25px !default;
22
22
  $awesome_admin_layout-notice-bg: #479ccf !default;
23
23
  $awesome_admin_layout-notice-size: 10px !default;
24
+ $awesome_admin_layout-icon-size: 20px !default;
24
25
 
25
26
  // Mixins
26
27
  @mixin awesome_admin_layout-display-flex() {
@@ -94,6 +95,12 @@ $awesome_admin_layout-notice-size: 10px !default;
94
95
  transition: $transitions;
95
96
  }
96
97
 
98
+ @mixin awesome_admin_layout-ellipsis {
99
+ white-space: nowrap;
100
+ overflow: hidden;
101
+ text-overflow: ellipsis;
102
+ }
103
+
97
104
  // Rules
98
105
  #awesome_admin_layout {
99
106
  }
@@ -108,6 +115,9 @@ $awesome_admin_layout-notice-size: 10px !default;
108
115
  bottom: 0;
109
116
  z-index: 300;
110
117
  overflow: hidden;
118
+ // for Firefox and iOS
119
+ // refs: http://stackoverflow.com/questions/12463658/parent-child-with-position-fixed-parent-overflowhidden-bug/23859719#23859719
120
+ clip: rect(0, auto, auto, 0);
111
121
 
112
122
  .awesome_admin_layout-wrapper {
113
123
  width: 100%;
@@ -164,6 +174,8 @@ $awesome_admin_layout-notice-size: 10px !default;
164
174
  margin-left: auto;
165
175
  margin-right: 20px;
166
176
  padding: 0;
177
+ width: $awesome_admin_layout-icon-size;
178
+ min-width: $awesome_admin_layout-icon-size;
167
179
  height: auto;
168
180
 
169
181
  i {
@@ -178,6 +190,10 @@ $awesome_admin_layout-notice-size: 10px !default;
178
190
  }
179
191
  }
180
192
 
193
+ .awesome_admin_layout-text {
194
+ @include awesome_admin_layout-ellipsis;
195
+ }
196
+
181
197
  .awesome_admin_layout-badge {
182
198
  @include awesome_admin_layout-border-radius(10px);
183
199
  font-size: smaller;
@@ -250,7 +266,8 @@ $awesome_admin_layout-notice-size: 10px !default;
250
266
 
251
267
  i {
252
268
  margin-right: 0.5em;
253
- width: 20px;
269
+ width: $awesome_admin_layout-icon-size;
270
+ min-width: $awesome_admin_layout-icon-size;
254
271
  color: $awesome_admin_layout-navigation-item-icon-color;
255
272
  font-size: larger;
256
273
  text-align: center;
@@ -308,6 +325,8 @@ $awesome_admin_layout-notice-size: 10px !default;
308
325
  top: 0;
309
326
  bottom: 0;
310
327
  z-index: 400;
328
+ overflow-x: hidden;
329
+ overflow-y: auto;
311
330
 
312
331
  &.open {
313
332
  @include awesome_admin_layout-transform(translate3d(65px, 0, 0));
@@ -28,13 +28,20 @@ module AwesomeAdminLayout
28
28
  @@script.instance_exec(context, &block)
29
29
  end
30
30
 
31
- def setup(options = {}, &block)
32
- @@request = options[:request]
33
- if defined? Rails
34
- (options[:only] || ActionController::Base).send(:before_filter, -> { AwesomeAdminLayout.awesome_admin_layout(self, &block) })
35
- else
36
- awesome_admin_layout(&block)
37
- end
31
+ def normal_define(&block)
32
+ awesome_admin_layout(&block)
38
33
  end
34
+
35
+ def eager_define(options = {}, &block)
36
+ (options[:only] || ActionController::Base).send(:before_filter, -> { AwesomeAdminLayout.awesome_admin_layout(self, &block) })
37
+ end
38
+
39
+ def define(options = {}, &block)
40
+ @@request = options.delete(:request)
41
+ defined?(Rails) ? eager_define(options, &block) : normal_define(&block)
42
+ end
43
+
44
+ # TODO: Deprecated
45
+ alias_method :setup, :define
39
46
  end
40
47
  end
@@ -7,5 +7,12 @@ module AwesomeAdminLayout
7
7
  ActiveSupport.on_load(:action_controller) do
8
8
  ActionController::Base.send(:extend, AwesomeAdminLayout::Helpers::ClassMethods)
9
9
  end
10
+
11
+ config.to_prepare do
12
+ engines = [Rails] + Rails::Engine.subclasses
13
+ engines.each do |engine|
14
+ Dir.glob(engine.root.join('app/navigations/**/*.rb')).each { |c| require_dependency(c) }
15
+ end
16
+ end
10
17
  end
11
18
  end
@@ -6,10 +6,10 @@ module AwesomeAdminLayout
6
6
  end
7
7
  end
8
8
 
9
- def render_admin_layout(&block)
10
- <<-HTML
9
+ def render_admin_layout(key = nil, &block)
10
+ html = <<-HTML
11
11
  <div id="awesome_admin_layout">
12
- #{AwesomeAdminLayout.script.to_html}
12
+ #{AwesomeAdminLayout.script.to_html(key)}
13
13
 
14
14
  <main class="awesome_admin_layout-main">
15
15
  <div class="awesome_admin_layout-navigation-toggle">
@@ -19,6 +19,8 @@ module AwesomeAdminLayout
19
19
  </main>
20
20
  </div>
21
21
  HTML
22
+ html = html.html_safe if html.respond_to? :html_safe
23
+ html
22
24
  end
23
25
  end
24
26
  end
@@ -27,6 +27,7 @@ module AwesomeAdminLayout
27
27
 
28
28
  begin
29
29
  recognized_path = engine_instance.routes.recognize_path(path_for_engine, options)
30
+ break
30
31
  rescue ActionController::RoutingError => e
31
32
  Rails.logger.debug "[#{engine}] ActionController::RoutingError: #{e.message}"
32
33
  end
@@ -4,12 +4,14 @@ require 'awesome_admin_layout/navigation/flex_divider'
4
4
 
5
5
  module AwesomeAdminLayout
6
6
  class Script
7
- def navigation(key = :default, &block)
7
+ def navigation(key = nil, &block)
8
+ key ||= :default
8
9
  Navigation.new(key, &block)
9
10
  end
10
11
 
11
- def to_s
12
- Navigation.find(:default)
12
+ def to_s(key = nil)
13
+ key ||= :default
14
+ Navigation.find(key).to_s
13
15
  end
14
16
 
15
17
  alias_method :to_html, :to_s
@@ -1,3 +1,3 @@
1
1
  module AwesomeAdminLayout
2
- VERSION = '0.1.2'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_admin_layout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YOSHIDA Hiroki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-17 00:00:00.000000000 Z
11
+ date: 2015-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slim
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  requirements: []
175
175
  rubyforge_project:
176
- rubygems_version: 2.2.2
176
+ rubygems_version: 2.4.5
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: Providing a simple way to add admin panel layout.