adminlte-generators 0.1.0 → 0.1.1

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: ff05ee523693517ca3b146b8c90a8bd360c235fb
4
- data.tar.gz: d80b1e94569cb6c6fc528a50573df140d243f617
3
+ metadata.gz: 3eea011223e5c1fbbe87cbd330931d43c29a7d96
4
+ data.tar.gz: 503eb833c0df8b24df7716b04524d8130d5caa56
5
5
  SHA512:
6
- metadata.gz: c3021010ed57d086d81bccbb1a0f8c9c1b476e61abc6494af078b8a71fd4c1858b1a722260f3c9b0b4ec24ce3ea7a081852afc04f9793a562b6373e50cb9392b
7
- data.tar.gz: e714d49bd0ad571eed48cb34b0eeeb371c212a323724b27aff6d83c4157836083339d60bf1d7544f6735f349fce5ab3832ea93989ad2abd22a24f39f06c4c6d2
6
+ metadata.gz: 107aa4856362bdce021814c6b0f60d529cb711feae6b18b311813077991b36a70597d1766a695721af5d5374f6f66557fc0f34143731f07199eb9899f1b971ad
7
+ data.tar.gz: 0b0a54d013fc86319adaa1b29d3a775a7e8a91a5ab9056f438f376d7622df847ad86e0933042655db1d8b7c238b9afcf02f03a2329902c00e1f18c413a49344d
data/README.md CHANGED
@@ -5,7 +5,7 @@ AdminLTE is a rich [Twitter Bootstrap](http://getbootstrap.com/) admin template.
5
5
 
6
6
  ## Installation
7
7
 
8
- Add this line to your application's Gemfile (you'll need (adminlte)[https://github.com/chukcha-wtf/adminlte] gem installed):
8
+ Add this line to your application's Gemfile, you'll need (adminlte)[https://github.com/chukcha-wtf/adminlte] gem installed:
9
9
 
10
10
  ```ruby
11
11
  gem 'adminlte'
@@ -46,18 +46,44 @@ You could provide a name for generated layout (usefull if you've got few layouts
46
46
 
47
47
  Simply run:
48
48
 
49
- rails generate bootstrap:install --layout_name=admin
49
+ rails generate adminlte:install --layout_name=admin
50
50
 
51
51
  #### Default skin
52
52
 
53
53
  AdminLTE comes with **blue** skin by default. If you wish to change it to **black** just run:
54
54
 
55
- rails generate bootstrap:install --skin=black
55
+ rails generate adminlte:install --skin=black
56
56
 
57
57
  #### Skip turbolinks
58
58
 
59
59
  Run the generator with option `--skip-turbolinks` to remove turbolinks references from the generated layout.
60
60
 
61
+ ## Helpers
62
+ Oh, btw you'll get 2 navigation helpers for free.
63
+
64
+ For sidebar links you could use `nav_link` helper:
65
+
66
+ ```ruby
67
+ <%= nav_link root_path do %>
68
+ <i class="fa fa-dashboard"></i> <span>Dashboard</span>
69
+ <% end %>
70
+ ```
71
+
72
+ And if you want to create a treeview, just use `treeview_link` helper:
73
+
74
+ ```ruby
75
+ <%= treeview_link 'Lots of links here' do %>
76
+ <%= nav_link you_shall_not_path do %>
77
+ <i class="fa fa-angle-double-right"></i>
78
+ One Way
79
+ <% end %>
80
+ <%= nav_link you_shall__path do %>
81
+ <i class="fa fa-angle-double-right"></i>
82
+ Another
83
+ <% end %>
84
+ <% end %>
85
+ ```
86
+
61
87
  ## Contributing
62
88
 
63
89
  1. Fork it ( https://github.com/[my-github-username]/adminlte-generators/fork )
@@ -66,5 +92,11 @@ Run the generator with option `--skip-turbolinks` to remove turbolinks reference
66
92
  4. Push to the branch (`git push origin my-new-feature`)
67
93
  5. Create a new Pull Request
68
94
 
95
+ ## Credits
96
+
97
+ * [AdminLTE](http://almsaeedstudio.com/AdminLTE)
98
+ * [bootstrap-generators](https://github.com/decioferreira/bootstrap-generators)
99
+
100
+
69
101
  ## TODO:
70
102
  Write tests for generators
@@ -2,7 +2,7 @@ require "rails"
2
2
 
3
3
  module Adminlte
4
4
  module Generators
5
- class Engine < ::Rails::Engine
5
+ class Engine < Rails::Engine
6
6
  config.app_generators.stylesheets false
7
7
 
8
8
  initializer 'adminlte-generators.setup', group: :all do |app|
@@ -10,6 +10,10 @@ module Adminlte
10
10
 
11
11
  app.config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/
12
12
  end
13
+
14
+ config.app_generators do |g|
15
+ g.templates.unshift File::expand_path('../templates', __FILE__)
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -1,5 +1,5 @@
1
1
  module Adminlte
2
2
  module Generators
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -20,6 +20,10 @@ module Adminlte
20
20
  copy_file "form_builder/_form.html.#{options[:template_engine]}", "lib/templates/#{options[:template_engine]}/scaffold/_form.html.#{options[:template_engine]}"
21
21
  end
22
22
 
23
+ def copy_nav_helper
24
+ copy_file "helpers/navigation_helper.rb", "app/helpers/nav_helper.rb"
25
+ end
26
+
23
27
  def create_layout
24
28
  template "layouts/dashboard.html.#{options[:template_engine]}", "app/views/layouts/#{options[:layout_name]}.html.#{options[:template_engine]}"
25
29
  template "layouts/_header.html.#{options[:template_engine]}", "app/views/layouts/_#{options[:layout_name]}_header.html.#{options[:template_engine]}"
@@ -0,0 +1,26 @@
1
+ module NavHelper
2
+ def nav_link(page, &link_text)
3
+ class_name = request.env['PATH_INFO'].match(page) ? 'active' : nil
4
+
5
+ content_tag(:li, class: class_name) do
6
+ link_to page do
7
+ link_text.call
8
+ end
9
+ end
10
+ end
11
+
12
+ def treeview_link(text, &links)
13
+ content = link_to('#') do
14
+ content_tag(:span, text) <<
15
+ content_tag(:i, '', class: "fa pull-right fa-angle-left")
16
+ end
17
+
18
+ content << content_tag(:ul, class: 'treeview-menu') do
19
+ links.call
20
+ end
21
+
22
+ content_tag :li, class: 'treeview' do
23
+ content
24
+ end
25
+ end
26
+ end
@@ -22,22 +22,18 @@
22
22
  <!-- /.search form -->
23
23
  <!-- sidebar menu: : style can be found in sidebar.less -->
24
24
  <ul class="sidebar-menu">
25
- <li class="active">
26
- <a href="#">
27
- <i class="fa fa-dashboard"></i> <span>Dashboard</span>
28
- </a>
29
- </li>
30
- <li class="treeview">
31
- <a href="#">
32
- <i class="fa fa-bar-chart-o"></i>
33
- <span>Charts</span>
34
- <i class="fa fa-angle-left pull-right"></i>
35
- </a>
36
- <ul class="treeview-menu">
37
- <li><a href="#"><i class="fa fa-angle-double-right"></i> Morris</a></li>
38
- <li><a href="#"><i class="fa fa-angle-double-right"></i> Flot</a></li>
39
- <li><a href="#"><i class="fa fa-angle-double-right"></i> Inline charts</a></li>
40
- </ul>
41
- </li>
25
+ <%%= nav_link root_path do %>
26
+ <i class="fa fa-dashboard"></i> <span>Dashboard</span>
27
+ <%% end %>
28
+ <%%= treeview_link 'Lots of links here' do %>
29
+ <%%= nav_link "#" do %>
30
+ <i class="fa fa-angle-double-right"></i>
31
+ One Way
32
+ <%% end %>
33
+ <%%= nav_link "#" do %>
34
+ <i class="fa fa-angle-double-right"></i>
35
+ Another
36
+ <%% end %>
37
+ <%% end %>
42
38
  </ul>
43
39
  </section>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adminlte-generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavlo Babenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-06 00:00:00.000000000 Z
11
+ date: 2015-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -85,6 +85,7 @@ files:
85
85
  - lib/generators/adminlte/install/templates/assets/stylesheets/adminlte_overrides.css
86
86
  - lib/generators/adminlte/install/templates/assets/stylesheets/adminlte_overrides.scss
87
87
  - lib/generators/adminlte/install/templates/form_builder/_form.html.erb
88
+ - lib/generators/adminlte/install/templates/helpers/navigation_helper.rb
88
89
  - lib/generators/adminlte/install/templates/layouts/_header.html.erb
89
90
  - lib/generators/adminlte/install/templates/layouts/_sidebar.html.erb
90
91
  - lib/generators/adminlte/install/templates/layouts/dashboard.html.erb