bh 1.3.5 → 6.0.0
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 +5 -5
- data/CHANGELOG.md +8 -0
- data/README.md +8 -138
- data/app/assets/stylesheets/bh.css +29 -0
- data/app/javascript/controllers/bh/theme_controller.js +17 -0
- data/app/views/bh/_grid.html.erb +6 -0
- data/app/views/bh/_table.html.erb +46 -0
- data/bh.gemspec +5 -31
- data/gemfiles/Gemfile.rails-3.x +0 -1
- data/lib/bh/bootstrap_helpers.rb +131 -0
- data/lib/bh/engine.rb +13 -0
- data/lib/bh/version.rb +3 -1
- data/lib/bh.rb +6 -14
- data/spec/spec_helper.rb +1 -1
- metadata +14 -298
- data/examples/middleman/.gitignore +0 -18
- data/examples/middleman/Gemfile +0 -6
- data/examples/middleman/config.rb +0 -1
- data/examples/middleman/source/index.html.erb +0 -158
- data/examples/padrino/Gemfile +0 -9
- data/examples/padrino/app/app.rb +0 -16
- data/examples/padrino/app/views/index.html.erb +0 -155
- data/examples/padrino/config/apps.rb +0 -5
- data/examples/padrino/config/boot.rb +0 -8
- data/examples/padrino/config.ru +0 -5
- data/examples/rails/.gitignore +0 -12
- data/examples/rails/Gemfile +0 -5
- data/examples/rails/app/controllers/application_controller.rb +0 -6
- data/examples/rails/app/controllers/users_controller.rb +0 -2
- data/examples/rails/app/models/user.rb +0 -15
- data/examples/rails/app/views/application/index.html.erb +0 -160
- data/examples/rails/bin/rails +0 -4
- data/examples/rails/config/application.rb +0 -12
- data/examples/rails/config/boot.rb +0 -3
- data/examples/rails/config/environment.rb +0 -5
- data/examples/rails/config/environments/development.rb +0 -7
- data/examples/rails/config/routes.rb +0 -4
- data/examples/rails/config/secrets.yml +0 -22
- data/examples/rails/config.ru +0 -4
- data/examples/rails/log/.keep +0 -0
- data/lib/bh/classes/alert_box.rb +0 -35
- data/lib/bh/classes/base.rb +0 -125
- data/lib/bh/classes/button.rb +0 -58
- data/lib/bh/classes/button_to.rb +0 -33
- data/lib/bh/classes/cdn.rb +0 -35
- data/lib/bh/classes/dropdown.rb +0 -56
- data/lib/bh/classes/icon.rb +0 -34
- data/lib/bh/classes/link_to.rb +0 -26
- data/lib/bh/classes/modal.rb +0 -68
- data/lib/bh/classes/nav.rb +0 -37
- data/lib/bh/classes/navbar.rb +0 -78
- data/lib/bh/classes/panel.rb +0 -72
- data/lib/bh/classes/panel_row.rb +0 -13
- data/lib/bh/classes/progress_bar.rb +0 -89
- data/lib/bh/classes/stack.rb +0 -19
- data/lib/bh/classes/vertical.rb +0 -27
- data/lib/bh/core_ext/middleman.rb +0 -24
- data/lib/bh/core_ext/padrino.rb +0 -25
- data/lib/bh/core_ext/rails/base_helper.rb +0 -21
- data/lib/bh/core_ext/rails/form/base_helper.rb +0 -150
- data/lib/bh/core_ext/rails/form/check_box_helper.rb +0 -35
- data/lib/bh/core_ext/rails/form/field_helper.rb +0 -15
- data/lib/bh/core_ext/rails/form/fields_for_helper.rb +0 -23
- data/lib/bh/core_ext/rails/form/fieldset_helper.rb +0 -16
- data/lib/bh/core_ext/rails/form/file_field_helper.rb +0 -15
- data/lib/bh/core_ext/rails/form/legend_helper.rb +0 -17
- data/lib/bh/core_ext/rails/form/radio_button_helper.rb +0 -19
- data/lib/bh/core_ext/rails/form/select_helper.rb +0 -16
- data/lib/bh/core_ext/rails/form/static_control_helper.rb +0 -43
- data/lib/bh/core_ext/rails/form/submit_helper.rb +0 -23
- data/lib/bh/core_ext/rails/form_builder.rb +0 -46
- data/lib/bh/core_ext/rails/form_for_helper.rb +0 -41
- data/lib/bh/core_ext/railtie.rb +0 -27
- data/lib/bh/helpers/alert_box_helper.rb +0 -40
- data/lib/bh/helpers/button_helper.rb +0 -40
- data/lib/bh/helpers/button_to_helper.rb +0 -65
- data/lib/bh/helpers/cdn_helper.rb +0 -46
- data/lib/bh/helpers/dropdown_helper.rb +0 -49
- data/lib/bh/helpers/glyphicon_helper.rb +0 -18
- data/lib/bh/helpers/horizontal_helper.rb +0 -35
- data/lib/bh/helpers/icon_helper.rb +0 -27
- data/lib/bh/helpers/link_to_helper.rb +0 -59
- data/lib/bh/helpers/modal_helper.rb +0 -55
- data/lib/bh/helpers/nav_helper.rb +0 -36
- data/lib/bh/helpers/navbar_helper.rb +0 -48
- data/lib/bh/helpers/panel_helper.rb +0 -53
- data/lib/bh/helpers/panel_row_helper.rb +0 -28
- data/lib/bh/helpers/progress_bar_helper.rb +0 -55
- data/lib/bh/helpers/vertical_helper.rb +0 -33
- data/lib/bh/views/bh/_alert_dismiss_button.html +0 -4
- data/lib/bh/views/bh/_dropdown.html.erb +0 -9
- data/lib/bh/views/bh/_dropdown_split.html.erb +0 -10
- data/lib/bh/views/bh/_modal.html.erb +0 -14
- data/lib/bh/views/bh/_navbar.html.erb +0 -5
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
-
<%= stylesheet_link_tag font_awesome_css, bootstrap_css, bootstrap_theme_css %>
|
|
8
|
-
<title>Bh test page (Padrino)</title>
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<div class='container'>
|
|
12
|
-
|
|
13
|
-
<h1>Alerts</h1>
|
|
14
|
-
|
|
15
|
-
<!-- Try setting different :dismissible and :context options -->
|
|
16
|
-
<%= alert_box 'You accepted the Terms of service.' %>
|
|
17
|
-
|
|
18
|
-
<% alert_box context: :warning, dismissible: true, id: 'alert', class: :en, data: {js: 1} do %>
|
|
19
|
-
<em>Thanks!</em> You accepted the <%= link_to 'Terms of service', '/#terms' %>.
|
|
20
|
-
<% end %>
|
|
21
|
-
|
|
22
|
-
<h1>Panels</h1>
|
|
23
|
-
|
|
24
|
-
<!-- Try setting different :title, :tag and :context options -->
|
|
25
|
-
<%= panel 'You accepted the Terms of service', title: 'Thanks', tag: :aside %>
|
|
26
|
-
|
|
27
|
-
<% panel heading: 'Thanks', context: :info, id: 'panel', class: :en, data: {js: 1} do %>
|
|
28
|
-
<div class='panel-body'>You accepted the Terms of service. <%= icon :ok %></div>
|
|
29
|
-
<% end %>
|
|
30
|
-
|
|
31
|
-
<h1>Panel rows</h1>
|
|
32
|
-
|
|
33
|
-
<!-- Try setting a different :column_class option -->
|
|
34
|
-
<% panel_row column_class: 'col-sm-12' do %>
|
|
35
|
-
<%= panel 'Plain full-width panel' %>
|
|
36
|
-
<% end %>
|
|
37
|
-
|
|
38
|
-
<% panel_row column_class: 'col-sm-6', id: 'panel-row', class: :en, data: {js: 1} do %>
|
|
39
|
-
<%= panel 'John Smith', title: 'User', context: :info %>
|
|
40
|
-
<% panel title: 'Phone' do %>
|
|
41
|
-
<div class='panel-body'><%= icon :earphone %> 323-555-5555</div>
|
|
42
|
-
<% end %>
|
|
43
|
-
<% end %>
|
|
44
|
-
|
|
45
|
-
<h1>Modals</h1>
|
|
46
|
-
|
|
47
|
-
<!-- Try setting different :title, :size, :button or :context options -->
|
|
48
|
-
<%= modal 'Do what you want!', button: {size: :small, context: :info} %>
|
|
49
|
-
|
|
50
|
-
<% modal title: 'Terms of service', size: :large, id: 'modal', button: {class: :en} do %>
|
|
51
|
-
<div class="modal-body">Please accept the Terms of service.</div>
|
|
52
|
-
<div class="modal-footer"><button type="button" class="btn btn-primary">Accept</button></div>
|
|
53
|
-
<% end %>
|
|
54
|
-
|
|
55
|
-
<h1>Navs</h1>
|
|
56
|
-
|
|
57
|
-
<% nav do %>
|
|
58
|
-
<li class='active'>
|
|
59
|
-
<%= link_to 'Home', '/' %>
|
|
60
|
-
</li>
|
|
61
|
-
<li>
|
|
62
|
-
<%= link_to 'Profile', '/#profile' %>
|
|
63
|
-
</li>
|
|
64
|
-
<li>
|
|
65
|
-
<%= link_to 'Settings', '/#settings' %>
|
|
66
|
-
</li>
|
|
67
|
-
<% end %>
|
|
68
|
-
|
|
69
|
-
<br />
|
|
70
|
-
<!-- Try setting different :layout or :as options -->
|
|
71
|
-
<% nav as: :pills, layout: :stacked, id: 'my-nav', data: {value: 1} do %>
|
|
72
|
-
<li class='active'>
|
|
73
|
-
<%= link_to 'Home', '/' %>
|
|
74
|
-
</li>
|
|
75
|
-
<li>
|
|
76
|
-
<%= link_to 'Profile', '/#profile' %>
|
|
77
|
-
</li>
|
|
78
|
-
<li>
|
|
79
|
-
<%= link_to 'Settings', '/#settings' %>
|
|
80
|
-
</li>
|
|
81
|
-
<% end %>
|
|
82
|
-
|
|
83
|
-
<h1>Navbars</h1>
|
|
84
|
-
|
|
85
|
-
<!-- Try adding a horizontal element and setting different :inverted, :fluid, :position or :padding options -->
|
|
86
|
-
<% navbar inverted: true do %>
|
|
87
|
-
<% vertical do %>
|
|
88
|
-
<%= link_to 'Home', '/' %>
|
|
89
|
-
<% end %>
|
|
90
|
-
<% end %>
|
|
91
|
-
|
|
92
|
-
<% navbar id: 'navbar' do %>
|
|
93
|
-
<% vertical id: 'vertical', class: :en, data: {js: 1} do %>
|
|
94
|
-
<%= link_to 'Home', '/' %>
|
|
95
|
-
<% end %>
|
|
96
|
-
<% horizontal class: :en, data: {js: 2} do %>
|
|
97
|
-
<% nav class: 'navbar-left' do %>
|
|
98
|
-
<%= link_to 'Profile', '/#profile' %>
|
|
99
|
-
<%= link_to 'Settings', '/#settings' %>
|
|
100
|
-
<% end %>
|
|
101
|
-
<% end %>
|
|
102
|
-
<% end %>
|
|
103
|
-
|
|
104
|
-
<h1>Buttons</h1>
|
|
105
|
-
|
|
106
|
-
<!-- Try setting different :context, :size and :layout options -->
|
|
107
|
-
<%= button 'Menu' %>
|
|
108
|
-
|
|
109
|
-
<% button context: :warning, id: 'button', class: :en, data: {js: 1} do %>
|
|
110
|
-
Your <em>personal</em> menu
|
|
111
|
-
<% end %>
|
|
112
|
-
|
|
113
|
-
<h1>Dropdowns</h1>
|
|
114
|
-
|
|
115
|
-
<!-- Try setting different :split, :direction, :align, :groupable, :layout, :context or :size options -->
|
|
116
|
-
<% dropdown 'Menu', direction: :up, context: :success, align: :right do %>
|
|
117
|
-
<%= link_to 'Home', '/' %>
|
|
118
|
-
<%= link_to 'Profile', '/#profile' %>
|
|
119
|
-
<%= link_to 'Settings', '/#settings' %>
|
|
120
|
-
<% end %>
|
|
121
|
-
|
|
122
|
-
<% dropdown 'Menu', split: true, id: 'dropdown', button: {class: :en} do %>
|
|
123
|
-
<li role="presentation"><a href="#">Home</a></li>
|
|
124
|
-
<li role="presentation"><a href="#"><%= content_tag :em, 'Profile' %></a></li>
|
|
125
|
-
<% end %>
|
|
126
|
-
|
|
127
|
-
<h1>Progress bars</h1>
|
|
128
|
-
|
|
129
|
-
<!-- Try passing multiple values with different :percentage, :label, :context, :striped, :animated options -->
|
|
130
|
-
<%= progress_bar [{percentage: 75, striped: true}, {percentage: 20, context: :warning, label: true}] %>
|
|
131
|
-
|
|
132
|
-
<%= progress_bar({percentage: 30, id: 'bar', data: {js: 1}}, id: 'container', class: :en) %>
|
|
133
|
-
|
|
134
|
-
<h1>Icons</h1>
|
|
135
|
-
|
|
136
|
-
<!-- Try setting a different :library option -->
|
|
137
|
-
<%= icon :user %>
|
|
138
|
-
|
|
139
|
-
<%= icon :user, library: :font_awesome, class: 'fa-2x', id: 'icon', data: {value: 1} %>
|
|
140
|
-
|
|
141
|
-
<h1>Button to</h1>
|
|
142
|
-
|
|
143
|
-
<%= button_to 'New', '#new', submit_options: {class: 'b'}, class: 'f', method: :get %>
|
|
144
|
-
<br />
|
|
145
|
-
<%= button_to 'New', '#new', submit_options: {class: 'b'}, class: 'f', method: :get, context: :primary %>
|
|
146
|
-
|
|
147
|
-
<% button_to '/#edit', method: :get, context: :link, submit_options: {id: 'my-btn-to', data: {value: 1}} do %>
|
|
148
|
-
Button <strong>styled</strong> as a link
|
|
149
|
-
<% end %>
|
|
150
|
-
|
|
151
|
-
</div>
|
|
152
|
-
<%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js' %>
|
|
153
|
-
<%= javascript_include_tag bootstrap_js %>
|
|
154
|
-
</body>
|
|
155
|
-
</html>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
RACK_ENV = ENV['RACK_ENV'] ||= 'development' unless defined?(RACK_ENV)
|
|
2
|
-
PADRINO_ROOT = File.expand_path('../..', __FILE__) unless defined?(PADRINO_ROOT)
|
|
3
|
-
|
|
4
|
-
require 'rubygems' unless defined?(Gem)
|
|
5
|
-
require 'bundler/setup'
|
|
6
|
-
Bundler.require(:default, RACK_ENV)
|
|
7
|
-
|
|
8
|
-
Padrino.load!
|
data/examples/padrino/config.ru
DELETED
data/examples/rails/.gitignore
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
|
2
|
-
#
|
|
3
|
-
# If you find yourself ignoring temporary files generated by your text editor
|
|
4
|
-
# or operating system, you probably want to add a global ignore instead:
|
|
5
|
-
# git config --global core.excludesfile '~/.gitignore_global'
|
|
6
|
-
|
|
7
|
-
# Ignore bundler config.
|
|
8
|
-
/.bundle
|
|
9
|
-
|
|
10
|
-
# Ignore all logfiles and tempfiles.
|
|
11
|
-
/log/*.log
|
|
12
|
-
/tmp
|
data/examples/rails/Gemfile
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
class User
|
|
2
|
-
include ActiveModel::Validations
|
|
3
|
-
include ActiveModel::Conversion
|
|
4
|
-
extend ActiveModel::Naming
|
|
5
|
-
|
|
6
|
-
attr_accessor :email, :password, :remember_me, :phone, :subscribe, :avatar
|
|
7
|
-
|
|
8
|
-
def persisted?
|
|
9
|
-
true
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def id
|
|
13
|
-
2
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7
|
-
<%= stylesheet_link_tag font_awesome_css, bootstrap_css, bootstrap_theme_css %>
|
|
8
|
-
<title>Bh test page (Rails)</title>
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<div class='container'>
|
|
12
|
-
|
|
13
|
-
<h1>Alerts</h1>
|
|
14
|
-
|
|
15
|
-
<!-- Try setting different :dismissible and :context options -->
|
|
16
|
-
<%= alert_box 'You accepted the Terms of service.' %>
|
|
17
|
-
|
|
18
|
-
<%= alert_box context: :warning, dismissible: true, id: 'alert', class: :en, data: {js: 1} do %>
|
|
19
|
-
<em>Thanks!</em> You accepted the <%= link_to 'Terms of service', '/#terms' %>.
|
|
20
|
-
<% end %>
|
|
21
|
-
|
|
22
|
-
<h1>Panels</h1>
|
|
23
|
-
|
|
24
|
-
<!-- Try setting different :title, :tag and :context options -->
|
|
25
|
-
<%= panel 'You accepted the Terms of service', title: 'Thanks', tag: :aside %>
|
|
26
|
-
|
|
27
|
-
<%= panel heading: 'Thanks', context: :info, id: 'panel', class: :en, data: {js: 1} do %>
|
|
28
|
-
<div class='panel-body'>You accepted the Terms of service. <%= icon :ok %></div>
|
|
29
|
-
<% end %>
|
|
30
|
-
|
|
31
|
-
<h1>Panel rows</h1>
|
|
32
|
-
|
|
33
|
-
<!-- Try setting a different :column_class option -->
|
|
34
|
-
<%= panel_row column_class: 'col-sm-12' do %>
|
|
35
|
-
<%= panel 'Plain full-width panel' %>
|
|
36
|
-
<% end %>
|
|
37
|
-
|
|
38
|
-
<%= panel_row column_class: 'col-sm-6', id: 'panel-row', class: :en, data: {js: 1} do %>
|
|
39
|
-
<%= panel 'John Smith', title: 'User', context: :info %>
|
|
40
|
-
<%= panel title: 'Phone' do %>
|
|
41
|
-
<div class='panel-body'><%= icon :earphone %> 323-555-5555</div>
|
|
42
|
-
<% end %>
|
|
43
|
-
<% end %>
|
|
44
|
-
|
|
45
|
-
<h1>Modals</h1>
|
|
46
|
-
|
|
47
|
-
<!-- Try setting different :title, :size, :button or :context options -->
|
|
48
|
-
<%= modal 'Do what you want!', button: {size: :small, context: :info} %>
|
|
49
|
-
|
|
50
|
-
<%= modal title: 'Terms of service', size: :large, id: 'modal', button: {class: :en} do %>
|
|
51
|
-
<div class="modal-body">Please accept the Terms of service.</div>
|
|
52
|
-
<div class="modal-footer"><button type="button" class="btn btn-primary">Accept</button></div>
|
|
53
|
-
<% end %>
|
|
54
|
-
|
|
55
|
-
<h1>Navs</h1>
|
|
56
|
-
|
|
57
|
-
<!-- Try setting different :layout or :as options -->
|
|
58
|
-
<%= nav do %>
|
|
59
|
-
<%= link_to 'Home', '/' %>
|
|
60
|
-
<%= link_to 'Users', '/#users' %>
|
|
61
|
-
<%= link_to 'Profile', '/#profile' %>
|
|
62
|
-
<% end %>
|
|
63
|
-
|
|
64
|
-
<br />
|
|
65
|
-
|
|
66
|
-
<%= nav as: :pills, id: 'nav', class: :en, data: {js: 1} do %>
|
|
67
|
-
<li class="active"><a href="/">Home</a></li>
|
|
68
|
-
<%= link_to 'Users', '/#users' %>
|
|
69
|
-
<%= link_to 'Profile', '/#profile' %>
|
|
70
|
-
<% end %>
|
|
71
|
-
|
|
72
|
-
<h1>Navbars</h1>
|
|
73
|
-
|
|
74
|
-
<!-- Try adding a horizontal element and setting different :inverted, :fluid, :position or :padding options -->
|
|
75
|
-
<%= navbar inverted: true do %>
|
|
76
|
-
<%= vertical do %>
|
|
77
|
-
<%= link_to 'Home', '/' %>
|
|
78
|
-
<% end %>
|
|
79
|
-
<% end %>
|
|
80
|
-
|
|
81
|
-
<%= navbar id: 'navbar' do %>
|
|
82
|
-
<%= vertical id: 'vertical', class: :en, data: {js: 1} do %>
|
|
83
|
-
<%= link_to 'Home', '/' %>
|
|
84
|
-
<% end %>
|
|
85
|
-
<%= horizontal class: :en, data: {js: 2} do %>
|
|
86
|
-
<%= nav class: 'navbar-left' do %>
|
|
87
|
-
<%= link_to 'Profile', '/#profile' %>
|
|
88
|
-
<%= link_to 'Settings', '/#settings' %>
|
|
89
|
-
<% end %>
|
|
90
|
-
<% end %>
|
|
91
|
-
<% end %>
|
|
92
|
-
|
|
93
|
-
<h1>Buttons</h1>
|
|
94
|
-
|
|
95
|
-
<!-- Try setting different :context, :size and :layout options -->
|
|
96
|
-
<%= button 'Menu' %>
|
|
97
|
-
|
|
98
|
-
<%= button context: :warning, id: 'button', class: :en, data: {js: 1} do %>
|
|
99
|
-
Your <em>personal</em> menu
|
|
100
|
-
<% end %>
|
|
101
|
-
|
|
102
|
-
<h1>Dropdowns</h1>
|
|
103
|
-
|
|
104
|
-
<!-- Try setting different :split, :direction, :align, :groupable, :layout, :context or :size options -->
|
|
105
|
-
<%= dropdown 'Menu', direction: :up, context: :success, align: :right do %>
|
|
106
|
-
<%= link_to 'Home', '/' %>
|
|
107
|
-
<%= link_to 'Profile', '/#profile' %>
|
|
108
|
-
<%= link_to 'Settings', '/#settings' %>
|
|
109
|
-
<% end %>
|
|
110
|
-
|
|
111
|
-
<%= dropdown 'Menu', split: true, id: 'dropdown', button: {class: :en} do %>
|
|
112
|
-
<li role="presentation"><a href="#">Home</a></li>
|
|
113
|
-
<li role="presentation"><a href="#"><%= content_tag :em, 'Profile' %></a></li>
|
|
114
|
-
<% end %>
|
|
115
|
-
|
|
116
|
-
<h1>Progress bars</h1>
|
|
117
|
-
|
|
118
|
-
<!-- Try passing multiple values with different :percentage, :label, :context, :striped, :animated options -->
|
|
119
|
-
<%= progress_bar [{percentage: 75, striped: true}, {percentage: 20, context: :warning, label: true}] %>
|
|
120
|
-
|
|
121
|
-
<%= progress_bar({percentage: 30, id: 'bar', data: {js: 1}}, id: 'container', class: :en) %>
|
|
122
|
-
|
|
123
|
-
<h1>Icons</h1>
|
|
124
|
-
|
|
125
|
-
<!-- Try setting a different :library option -->
|
|
126
|
-
<%= icon :user %>
|
|
127
|
-
|
|
128
|
-
<%= icon :user, library: :font_awesome, class: 'fa-2x', id: 'icon', data: {value: 1} %>
|
|
129
|
-
|
|
130
|
-
<h1>Button to</h1>
|
|
131
|
-
|
|
132
|
-
<%= button_to 'New', '#new', class: 'b', form_class: 'f', method: :get %>
|
|
133
|
-
<br />
|
|
134
|
-
<%= button_to 'New', '#new', class: 'b', form_class: 'f', method: :get, context: :primary %>
|
|
135
|
-
|
|
136
|
-
<%= button_to '/#edit', method: :get, context: :link, id: 'my-btn-to', data: {value: 1} do %>
|
|
137
|
-
Button <strong>styled</strong> as a link
|
|
138
|
-
<% end %>
|
|
139
|
-
|
|
140
|
-
<h1>Forms</h1>
|
|
141
|
-
|
|
142
|
-
<%= form_for User.new, url: '/', method: :get, layout: :basic do |f| %>
|
|
143
|
-
<%= f.legend 'User detail' %>
|
|
144
|
-
<%= f.email_field :email, label: 'E-mail address' %>
|
|
145
|
-
<%= f.password_field :password, placeholder: 'Your Password' %>
|
|
146
|
-
<%= f.file_field :avatar %>
|
|
147
|
-
<%= f.fieldset 'Newsletter' do %>
|
|
148
|
-
<%= f.radio_button :subscribe, true, label: 'Subscribe to newsletter' %>
|
|
149
|
-
<%= f.radio_button :subscribe, false, label: 'Do not subscribe to newsletter' %>
|
|
150
|
-
<% end %>
|
|
151
|
-
<%= f.telephone_field :phone, suffix: '☏' %>
|
|
152
|
-
<%= f.check_box :remember_me, checked: true %>
|
|
153
|
-
<%= f.submit 'Sign in' %>
|
|
154
|
-
<% end %>
|
|
155
|
-
|
|
156
|
-
</div>
|
|
157
|
-
<%= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js' %>
|
|
158
|
-
<%= javascript_include_tag bootstrap_js %>
|
|
159
|
-
</body>
|
|
160
|
-
</html>
|
data/examples/rails/bin/rails
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
|
2
|
-
|
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
|
5
|
-
|
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
|
8
|
-
# You can use `rake secret` to generate a secure secret key.
|
|
9
|
-
|
|
10
|
-
# Make sure the secrets in this file are kept private
|
|
11
|
-
# if you're sharing your code publicly.
|
|
12
|
-
|
|
13
|
-
development:
|
|
14
|
-
secret_key_base: 4d85d117bf624cdf5a8a3baedcba52fdfb6b1e3fa92e39c4170f8ac25824a3a59a68f14b17227181acd5141255cf2ac1a63bd22662e187c0f1653a1b8e399e2c
|
|
15
|
-
|
|
16
|
-
test:
|
|
17
|
-
secret_key_base: b182bca1180765aeec063200f2666b1a4c854f0d93d5840764a7bb19c06ba9ba4003c57624f24fac936dd6828796687c667ca9e3dbb33e85737a771fcaa819f9
|
|
18
|
-
|
|
19
|
-
# Do not keep production secrets in the repository,
|
|
20
|
-
# instead read values from the environment.
|
|
21
|
-
production:
|
|
22
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
data/examples/rails/config.ru
DELETED
data/examples/rails/log/.keep
DELETED
|
File without changes
|
data/lib/bh/classes/alert_box.rb
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
require 'bh/classes/base'
|
|
2
|
-
|
|
3
|
-
module Bh
|
|
4
|
-
module Classes
|
|
5
|
-
class AlertBox < Base
|
|
6
|
-
# @return [#to_s] the content-related class to assign to the alert box.
|
|
7
|
-
def context_class
|
|
8
|
-
AlertBox.contexts[@options.fetch :context, @options[:priority]]
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
# @return [#to_s] the HTML to show a dismissible button for the alert box.
|
|
12
|
-
def dismissible_button
|
|
13
|
-
if @options[:dismissible] || @options[:priority]
|
|
14
|
-
path = '../../views/bh/_alert_dismiss_button.html'
|
|
15
|
-
File.read File.expand_path(path, __FILE__)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
private
|
|
20
|
-
|
|
21
|
-
# @return [Hash<Symbol, String>] the class that Bootstrap requires to
|
|
22
|
-
# append to an alert box based on its context.
|
|
23
|
-
def self.contexts
|
|
24
|
-
HashWithIndifferentAccess.new(:'alert-info').tap do |klass|
|
|
25
|
-
klass[:alert] = :'alert-danger'
|
|
26
|
-
klass[:danger] = :'alert-danger'
|
|
27
|
-
klass[:info] = :'alert-info'
|
|
28
|
-
klass[:notice] = :'alert-success'
|
|
29
|
-
klass[:success] = :'alert-success'
|
|
30
|
-
klass[:warning] = :'alert-warning'
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
data/lib/bh/classes/base.rb
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
require 'bh/classes/stack'
|
|
2
|
-
require 'ostruct'
|
|
3
|
-
require 'active_support'
|
|
4
|
-
require 'active_support/core_ext'
|
|
5
|
-
|
|
6
|
-
module Bh
|
|
7
|
-
# @api private
|
|
8
|
-
module Classes
|
|
9
|
-
class Base
|
|
10
|
-
def initialize(app = nil, *args, &block)
|
|
11
|
-
@app = app
|
|
12
|
-
@concat = block_given? && @app.respond_to?(:concat_content)
|
|
13
|
-
@options = extract_options_from(*args, &block).dup
|
|
14
|
-
@content = extract_content_from *args, &block
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def extract!(*keys)
|
|
18
|
-
@attributes = @options.slice! *keys
|
|
19
|
-
@options.any?
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def merge!(attributes = {})
|
|
23
|
-
html_attributes.deep_merge! attributes
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def append_class!(new_class, hash = html_attributes, attribute = :class)
|
|
27
|
-
existing_class = hash[attribute]
|
|
28
|
-
hash[attribute] = [existing_class, new_class].compact.join ' '
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def append_class_to!(key, new_class)
|
|
32
|
-
append_class! new_class, (html_attributes[key] ||= {})
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def prepend_html!(html)
|
|
36
|
-
@content = safe_join [html, @content]
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def render_tag(tag)
|
|
40
|
-
render content_tag(tag)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def render_partial(partial)
|
|
44
|
-
file = File.expand_path "../../views/bh/_#{partial}.html.erb", __FILE__
|
|
45
|
-
template = ERB.new(File.read file)
|
|
46
|
-
assigns = OpenStruct.new attributes.merge(content: @content)
|
|
47
|
-
render template.result(assigns.instance_eval{ binding &nil }).html_safe
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def tag
|
|
51
|
-
:div
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def attributes
|
|
55
|
-
@attributes || @options
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def content
|
|
59
|
-
items = Array.wrap(@content).map do |item|
|
|
60
|
-
item.is_a?(Base) ? item.content_tag(item.tag) : item
|
|
61
|
-
end
|
|
62
|
-
items.all?(&:html_safe?) ? safe_join(items) : items.join
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def content_tag(tag)
|
|
66
|
-
@app.content_tag tag, content, attributes
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def url
|
|
70
|
-
@url
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def extract_from(option, attributes = [])
|
|
74
|
-
if @options[option]
|
|
75
|
-
@attributes[option] = @options[option].except *attributes
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
private
|
|
80
|
-
|
|
81
|
-
def safe_join(array = [])
|
|
82
|
-
array.compact.join("\n").html_safe
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def stack(&block)
|
|
86
|
-
Stack.unshift self
|
|
87
|
-
yield.tap{ Stack.shift }
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def html_attributes
|
|
91
|
-
@html_attributes || attributes
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def render(html)
|
|
95
|
-
@concat && html ? @app.concat_content(html) : html
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def extract_options_from(*args, &block)
|
|
99
|
-
args.shift unless block_given?
|
|
100
|
-
args.extract_options!
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def extract_content_from(*args, &block)
|
|
104
|
-
if block_given?
|
|
105
|
-
stack { capture_content &block }
|
|
106
|
-
else
|
|
107
|
-
args.shift
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
def extract_url_from(*args)
|
|
112
|
-
args.delete_at(block_given? ? 0 : 1)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def capture_content(&block)
|
|
116
|
-
content = @app.capture &block
|
|
117
|
-
if content.is_a? String
|
|
118
|
-
ActiveSupport::SafeBuffer.new.safe_concat(content)
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
include Classes
|
|
125
|
-
end
|