adminlte-generators 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +35 -3
- data/lib/adminlte-generators.rb +5 -1
- data/lib/adminlte/generators/version.rb +1 -1
- data/lib/generators/adminlte/install/install_generator.rb +4 -0
- data/lib/generators/adminlte/install/templates/helpers/navigation_helper.rb +26 -0
- data/lib/generators/adminlte/install/templates/layouts/_sidebar.html.erb +13 -17
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eea011223e5c1fbbe87cbd330931d43c29a7d96
|
4
|
+
data.tar.gz: 503eb833c0df8b24df7716b04524d8130d5caa56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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
|
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
|
data/lib/adminlte-generators.rb
CHANGED
@@ -2,7 +2,7 @@ require "rails"
|
|
2
2
|
|
3
3
|
module Adminlte
|
4
4
|
module Generators
|
5
|
-
class 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
|
@@ -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
|
-
|
26
|
-
<
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
<i class="fa fa-angle-
|
35
|
-
|
36
|
-
|
37
|
-
|
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.
|
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-
|
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
|