leather 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/views/leather/_dropdown_nav_item.html.haml +11 -0
- data/app/views/leather/_modal.html.haml +13 -0
- data/app/views/leather/_nav_item.html.haml +2 -0
- data/app/views/leather/_nav_list.html.haml +2 -0
- data/app/views/leather/_navbar.html.haml +46 -0
- data/lib/leather.rb +6 -0
- data/lib/leather/leather_helpers.rb +37 -0
- data/lib/leather/version.rb +1 -1
- metadata +26 -4
@@ -0,0 +1,11 @@
|
|
1
|
+
- id = Time.now.to_f
|
2
|
+
- if active
|
3
|
+
- css_class = 'active'
|
4
|
+
- else
|
5
|
+
- css_class = ''
|
6
|
+
%li{:class => 'dropdown ' + css_class}
|
7
|
+
%a.dropdown-toggle{:id => id, :href=>href, :data => {:target => '#', :toggle => 'dropdown'}}
|
8
|
+
= text
|
9
|
+
%b.caret
|
10
|
+
%ul.dropdown-menu{:role => 'menu', :aria => {:labelledby => id}}
|
11
|
+
= block
|
@@ -0,0 +1,13 @@
|
|
1
|
+
.modal.fade{ id: id }
|
2
|
+
.modal-dialog
|
3
|
+
.modal-content
|
4
|
+
.modal-header
|
5
|
+
%button.close{ data: { dismiss: "modal" }, type: "button" }
|
6
|
+
%span{ aria: { hidden: "true" } } ×
|
7
|
+
%span.sr-only Close
|
8
|
+
%h4.modal-title= title
|
9
|
+
.modal-body
|
10
|
+
= block
|
11
|
+
.modal-footer
|
12
|
+
%button.btn.btn-default{ data: { dismiss: "modal" }, type: "button" }= close_text
|
13
|
+
%button.btn.btn-primary{ type: "button" } Save changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
- container_mode = html_options[:container_mode]
|
2
|
+
- html_options[:container_mode] = nil
|
3
|
+
|
4
|
+
- case container_mode
|
5
|
+
- when :with
|
6
|
+
%nav.navbar.navbar-default
|
7
|
+
.container
|
8
|
+
.row.clearfix
|
9
|
+
.column.col-md-12
|
10
|
+
.navbar-header
|
11
|
+
%button.navbar-toggle{data:{toggle:'collapse', target:'#navbar-to-collapse'},type:'button'}
|
12
|
+
%span.sr-only
|
13
|
+
Toggle navigation
|
14
|
+
%span.icon-bar
|
15
|
+
%span.icon-bar
|
16
|
+
%span.icon-bar
|
17
|
+
= link_to title, brand_link, :class => 'navbar-brand'
|
18
|
+
.collapse.navbar-collapse#navbar-to-collapse
|
19
|
+
= block
|
20
|
+
- when :in
|
21
|
+
.container
|
22
|
+
.row.clearfix
|
23
|
+
.column.col-md-12
|
24
|
+
%nav.navbar.navbar-default
|
25
|
+
.navbar-header
|
26
|
+
%button.navbar-toggle{data:{toggle:'collapse', target:'#navbar-to-collapse'},type:'button'}
|
27
|
+
%span.sr-only
|
28
|
+
Toggle navigation
|
29
|
+
%span.icon-bar
|
30
|
+
%span.icon-bar
|
31
|
+
%span.icon-bar
|
32
|
+
= link_to title, brand_link, :class => 'navbar-brand'
|
33
|
+
.collapse.navbar-collapse#navbar-to-collapse
|
34
|
+
= block
|
35
|
+
- else
|
36
|
+
%nav.navbar.navbar-default
|
37
|
+
.navbar-header
|
38
|
+
%button.navbar-toggle{data:{toggle:'collapse', target:'#navbar-to-collapse'},type:'button'}
|
39
|
+
%span.sr-only
|
40
|
+
Toggle navigation
|
41
|
+
%span.icon-bar
|
42
|
+
%span.icon-bar
|
43
|
+
%span.icon-bar
|
44
|
+
= link_to title, brand_link, :class => 'navbar-brand'
|
45
|
+
.collapse.navbar-collapse#navbar-to-collapse
|
46
|
+
= block
|
data/lib/leather.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
require 'devise'
|
2
2
|
require 'bootstrap-sass'
|
3
3
|
require 'high_voltage'
|
4
|
+
require 'haml-rails'
|
4
5
|
|
5
6
|
module Leather
|
7
|
+
autoload :LeatherHelpers, "leather/leather_helpers"
|
8
|
+
|
6
9
|
class Engine < ::Rails::Engine
|
10
|
+
initializer "leather.helpers" do
|
11
|
+
ActionView::Base.send :include, Leather::LeatherHelpers
|
12
|
+
end
|
7
13
|
end
|
8
14
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Leather
|
2
|
+
module LeatherHelpers
|
3
|
+
def modal_toggle(text, id, html_options = {})
|
4
|
+
link_to text, "##{id}", data: { toggle: "modal" }, class: html_options[:class]
|
5
|
+
end
|
6
|
+
|
7
|
+
def modal(title = '', id = 'modal', close_text = 'Close', html_options = {}, &block)
|
8
|
+
render partial: 'leather/modal', locals: { id: id, close_text: close_text, title: title, block: capture(&block), html_options: html_options }
|
9
|
+
end
|
10
|
+
|
11
|
+
def nav_item(text, href, options = {})
|
12
|
+
render partial: 'leather/nav_item', locals: { text: text, href: href, options: options }
|
13
|
+
end
|
14
|
+
|
15
|
+
def nav_list(html_options = {}, &block)
|
16
|
+
render partial: 'leather/nav_list', locals: { block: capture(&block), html_options: html_options }
|
17
|
+
end
|
18
|
+
|
19
|
+
def navbar(title, brand_link, html_options = {}, &block)
|
20
|
+
render partial: 'leather/navbar', locals: { title: title, brand_link: brand_link, block: capture(&block), html_options: html_options }
|
21
|
+
end
|
22
|
+
|
23
|
+
def navbar_with_container(html_options = {}, &block)
|
24
|
+
html_options[:container_mode] = :with
|
25
|
+
navbar(html_options, &block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def navbar_in_container(html_options = {}, &block)
|
29
|
+
html_options[:container_mode] = :in
|
30
|
+
navbar(html_options, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
def dropdown_nav_item(text, href, active = false, &block)
|
34
|
+
render partial: 'leather/dropdown_nav_item', locals: { block: capture(&block), text: text, href: href, active: active }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/leather/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leather
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-07-
|
12
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -75,6 +75,22 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: haml-rails
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
78
94
|
- !ruby/object:Gem::Dependency
|
79
95
|
name: sqlite3
|
80
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,10 +155,16 @@ files:
|
|
139
155
|
- app/views/devise/sessions/new.html.erb
|
140
156
|
- app/views/devise/shared/_links.html.erb
|
141
157
|
- app/views/devise/shared/_welcome.html.erb
|
158
|
+
- app/views/leather/_dropdown_nav_item.html.haml
|
159
|
+
- app/views/leather/_modal.html.haml
|
160
|
+
- app/views/leather/_nav_item.html.haml
|
161
|
+
- app/views/leather/_nav_list.html.haml
|
162
|
+
- app/views/leather/_navbar.html.haml
|
142
163
|
- app/views/pages/_table.html.erb
|
143
164
|
- app/views/pages/home.html.erb
|
144
165
|
- app/views/pages/ui_kit.html.erb
|
145
166
|
- lib/generators/leather/install/install_generator.rb
|
167
|
+
- lib/leather/leather_helpers.rb
|
146
168
|
- lib/leather/version.rb
|
147
169
|
- lib/leather.rb
|
148
170
|
- lib/tasks/leather_tasks.rake
|
@@ -163,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
185
|
version: '0'
|
164
186
|
segments:
|
165
187
|
- 0
|
166
|
-
hash:
|
188
|
+
hash: -3954307566973743323
|
167
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
190
|
none: false
|
169
191
|
requirements:
|
@@ -172,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
194
|
version: '0'
|
173
195
|
segments:
|
174
196
|
- 0
|
175
|
-
hash:
|
197
|
+
hash: -3954307566973743323
|
176
198
|
requirements: []
|
177
199
|
rubyforge_project:
|
178
200
|
rubygems_version: 1.8.24
|