framework7-rails 0.7.4.0 → 0.9.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +50 -45
- data/app/helpers/app_helper.rb +1 -1
- data/app/helpers/bar_helper.rb +45 -0
- data/app/helpers/bar_item_helper.rb +105 -0
- data/app/helpers/content_block_helper.rb +66 -0
- data/app/helpers/framework7_helper.rb +26 -0
- data/app/helpers/list_block_helper.rb +180 -0
- data/app/helpers/pages_helper.rb +66 -0
- data/app/helpers/panel_helper.rb +27 -0
- data/app/helpers/toolbar_helper.rb +52 -0
- data/app/helpers/views_helper.rb +36 -0
- data/app/presenters/framework7/base_presenter.rb +24 -0
- data/framework7-rails.gemspec +5 -1
- data/lib/framework7.rb +6 -0
- data/lib/framework7/rails/version.rb +1 -1
- data/lib/generators/f7/install/examples/examples_generator.rb +17 -0
- data/lib/generators/f7/install/examples/templates/app/controllers/examples_controller.rb +16 -0
- data/lib/generators/f7/install/examples/templates/app/views/examples/about.html.erb +27 -0
- data/lib/generators/f7/install/examples/templates/app/views/examples/form.html.erb +227 -0
- data/lib/generators/f7/install/examples/templates/app/views/examples/index.html.erb +80 -0
- data/lib/generators/f7/install/examples/templates/app/views/examples/services.html.erb +27 -0
- data/lib/generators/f7/install/install_generator.rb +1 -1
- data/lib/generators/f7/install/templates/application.css +1 -0
- data/lib/generators/f7/layout/layout_generator.rb +17 -3
- data/lib/generators/f7/layout/templates/layout.html.erb +9 -82
- data/lib/generators/f7/layout/templates/setup.coffee +10 -0
- data/lib/generators/f7/layout/templates/setup.js +12 -0
- data/vendor/assets/javascripts/framework7.js +5859 -1140
- data/vendor/assets/stylesheets/framework7.css +2569 -244
- data/vendor/assets/stylesheets/framework7.rtl.css +427 -0
- data/vendor/assets/stylesheets/framework7.themes.css +279 -0
- metadata +56 -15
- data/lib/generators/f7/layout/templates/app.js.coffee.erb +0 -77
- data/vendor/assets/images/i-form-checkbox-black.png +0 -0
- data/vendor/assets/images/i-form-checkbox-blue.png +0 -0
- data/vendor/assets/images/i-form-checkbox-white.png +0 -0
- data/vendor/assets/images/i-form-radio-black.png +0 -0
- data/vendor/assets/images/i-form-radio-blue.png +0 -0
- data/vendor/assets/images/i-form-radio-white.png +0 -0
- data/vendor/assets/javascripts/framework7.min.js +0 -16
- data/vendor/assets/stylesheets/framework7.min.css +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2ba8e602132ea3cb757f45c6e4804b0fc467c9b
|
4
|
+
data.tar.gz: 2b292a842226449526496ec5c85953f136c57144
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f29aa1226eac22f9555991ff787326b16c1fdfb17eccb0ac5e0d37295cf1afe27d71778b1a014b98e6c14f92bc109dd221df778cf08de81dc2972aa08ea1df9
|
7
|
+
data.tar.gz: 2a70ef7cb2876d16a5cb08168c442869a62ef6674615af2a2381cf77cf66b1f3a06317e6759e3a4b092f742a5221edcc4399dd59d9c5556a10ae241e8b595ae4
|
data/README.md
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/framework7-rails.svg)](http://badge.fury.io/rb/framework7-rails)
|
4
4
|
|
5
5
|
Brings the excellent [Framework7](https://github.com/nolimits4web/framework7/)
|
6
|
-
into the Rails 3.1
|
6
|
+
into the Rails 3.1.x - 4.x Asset Pipeline.
|
7
7
|
|
8
|
-
The gem version number
|
8
|
+
The gem version number `x.y.z` is kept in sync with the version of Framework7
|
9
9
|
being supported.
|
10
10
|
|
11
11
|
## Installation
|
@@ -13,6 +13,10 @@ being supported.
|
|
13
13
|
Add this line to your application's Gemfile:
|
14
14
|
|
15
15
|
gem 'framework7-rails'
|
16
|
+
|
17
|
+
If you want bleeding edge, not yet in ruby gems version, add this instead:
|
18
|
+
|
19
|
+
gem 'framework7-rails', :git => 'https://github.com/twss/framework7-rails.git'`
|
16
20
|
|
17
21
|
And then execute:
|
18
22
|
|
@@ -30,8 +34,6 @@ The easiest way to set up ready for use is to use the generator
|
|
30
34
|
|
31
35
|
You can do it manually if you want to, as outlined below:
|
32
36
|
|
33
|
-
### Development/Debugging
|
34
|
-
|
35
37
|
In your application.js file, add the line:
|
36
38
|
|
37
39
|
//= require framework7
|
@@ -39,16 +41,7 @@ In your application.js file, add the line:
|
|
39
41
|
In your application.css file, add the line:
|
40
42
|
|
41
43
|
*= require framework7
|
42
|
-
|
43
|
-
### Production
|
44
|
-
|
45
|
-
In your application.js file, add the line:
|
46
|
-
|
47
|
-
//= require framework7.min
|
48
|
-
|
49
|
-
In your application.css file, add the line:
|
50
|
-
|
51
|
-
*= require framework7.min
|
44
|
+
*= require framework7.theme
|
52
45
|
|
53
46
|
## Generators
|
54
47
|
|
@@ -60,33 +53,30 @@ This generator will add the necessary require statements as outlined above.
|
|
60
53
|
|
61
54
|
This sets up an application-level layout, and will generate two files:
|
62
55
|
|
63
|
-
app/assets/javascripts/<app_name>.js
|
56
|
+
app/assets/javascripts/<app_name>.js or app/assets/javascripts/<app_name>.coffee
|
64
57
|
app/views/layouts/application.html.erb
|
65
|
-
|
66
|
-
The javascript file creates a wrapping class around the main `Framework7` class.
|
67
|
-
This new class is named after your application, an instance is created with the
|
68
|
-
lower camel-cased application.
|
69
58
|
|
70
|
-
|
59
|
+
For now, at least, the javascript generated has been scaled back, to be:
|
71
60
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
contactsApp = new ContactsApp();
|
61
|
+
```javascript
|
62
|
+
window.F7H = {
|
63
|
+
app: new Framework7(),
|
64
|
+
dom: Dom7
|
65
|
+
};
|
79
66
|
|
80
|
-
|
81
|
-
|
67
|
+
window.Phone = {
|
68
|
+
Views: {}
|
69
|
+
};
|
70
|
+
|
71
|
+
Phone.Views.Main = F7H.app.addView('.view-main', {
|
72
|
+
dynamicNavbar: true
|
73
|
+
});
|
74
|
+
```
|
75
|
+
|
76
|
+
### f7:install:examples
|
77
|
+
|
78
|
+
*Removed, as they didn't really add anything of value.*
|
82
79
|
|
83
|
-
app = contactsApp.getInstance();
|
84
|
-
|
85
|
-
This may be necessary for future plans, but not too sure. For now it will be
|
86
|
-
left in, but you can always fallback to the Framework7 native way of doing
|
87
|
-
things by using the above line and never touching that `contactsApp` variable
|
88
|
-
again.
|
89
|
-
|
90
80
|
### And there's more...
|
91
81
|
|
92
82
|
To find out about the rest of the generators, be sure to
|
@@ -95,21 +85,36 @@ be updated as more become available.
|
|
95
85
|
|
96
86
|
## Helpers
|
97
87
|
|
98
|
-
|
99
|
-
|
88
|
+
Refer to the [wiki] for the usage/documentation.
|
89
|
+
|
90
|
+
* [f7_app]
|
91
|
+
* [f7_views]
|
92
|
+
* [f7_view]
|
93
|
+
* [f7_navbar]
|
94
|
+
* [f7_pages]
|
95
|
+
* [f7_page]
|
100
96
|
|
101
97
|
## Future Improvements
|
102
98
|
|
103
|
-
|
104
|
-
|
99
|
+
In the immediate future we'd like to:
|
100
|
+
|
101
|
+
* Make the code a bit more DRY.
|
102
|
+
* Move all the grunt work out of the helpers, into Presenters/Decorators.
|
103
|
+
* Add javascript generation for the more dynamic elements.
|
105
104
|
|
106
105
|
## Contributing
|
107
106
|
|
108
|
-
1. Fork it (
|
109
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
110
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
111
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
112
|
-
5. Create new Pull Request
|
107
|
+
1. Fork it [http://github.com/twss/framework7-rails/fork](http://github.com/twss/framework7-rails/fork).
|
108
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
109
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
110
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
111
|
+
5. Create new Pull Request.
|
113
112
|
|
114
113
|
|
115
114
|
[wiki]: https://github.com/twss/framework7-rails/wiki "wiki"
|
115
|
+
[f7_app]: https://github.com/twss/framework7-rails/wiki/helpers/f7_app
|
116
|
+
[f7_navbar]: https://github.com/twss/framework7-rails/wiki/helpers/f7_navbar
|
117
|
+
[f7_page]: https://github.com/twss/framework7-rails/wiki/helpers/f7_page
|
118
|
+
[f7_pages]: https://github.com/twss/framework7-rails/wiki/helpers/f7_pages
|
119
|
+
[f7_view]: https://github.com/twss/framework7-rails/wiki/helpers/f7_view
|
120
|
+
[f7_views]: https://github.com/twss/framework7-rails/wiki/helpers/f7_views
|
data/app/helpers/app_helper.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
module BarHelper
|
2
|
+
|
3
|
+
@f7_bartype = nil
|
4
|
+
@has_labels = false
|
5
|
+
|
6
|
+
def f7_navbar(html_options={}, &block)
|
7
|
+
@f7_bartype = :navbar
|
8
|
+
|
9
|
+
html_options[:class] = ([html_options[:class]] || []) << @f7_bartype
|
10
|
+
|
11
|
+
content_tag :div, html_options do
|
12
|
+
content_tag :div, :class => ['navbar-inner'] do
|
13
|
+
yield if block_given?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def f7_toolbar(options={}, &block)
|
19
|
+
@f7_bartype = :toolbar
|
20
|
+
css_classes = []
|
21
|
+
css_classes << @f7_bartype
|
22
|
+
css_classes += [options[:class]] if options[:class]
|
23
|
+
css_classes.flatten!
|
24
|
+
|
25
|
+
@f7_bartype = :tabbar if options[:type].to_s.include?('tabbar')
|
26
|
+
|
27
|
+
if @f7_bartype == :tabbar
|
28
|
+
css_classes << 'tabbar'
|
29
|
+
if options[:type] == :tabbar_labels
|
30
|
+
css_classes << 'tabbar-labels'
|
31
|
+
@has_labels = true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
options[:class] = css_classes
|
35
|
+
div_options = options.reject { |k, v| [:type].include? k }
|
36
|
+
|
37
|
+
content_tag :div, div_options do
|
38
|
+
content_tag :div, :class => ['toolbar-inner'] do
|
39
|
+
yield if block_given?
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module BarItemHelper
|
2
|
+
|
3
|
+
def f7_bar_item(title_or_options, options=nil, &block)
|
4
|
+
output = []
|
5
|
+
if title_or_options.class == Hash
|
6
|
+
options = title_or_options
|
7
|
+
title = options[:title]
|
8
|
+
else
|
9
|
+
title = title_or_options
|
10
|
+
options ||= {}
|
11
|
+
options[:title] = title
|
12
|
+
end
|
13
|
+
|
14
|
+
position = (options[:position] || :left) unless @f7_bartype == :tabbar
|
15
|
+
transition = options[:tansition]
|
16
|
+
|
17
|
+
css_classes = []
|
18
|
+
css_classes << position
|
19
|
+
css_classes << [transition].flatten if options[:transition]
|
20
|
+
options[:class] = ([options[:class]] || []) + css_classes
|
21
|
+
|
22
|
+
html_options = options.reject { |k, v| [:position, :title].include? k }
|
23
|
+
|
24
|
+
if block_given?
|
25
|
+
output << capture(&block)
|
26
|
+
else
|
27
|
+
if options[:href]
|
28
|
+
link_options = options.select { |k, v| [:title, :href, :icon, :badge].include? k.to_sym }
|
29
|
+
output << f7_bar_link(link_options)
|
30
|
+
else
|
31
|
+
output << title
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
if @f7_bartype == :tabbar
|
36
|
+
output.join("\n").html_safe
|
37
|
+
else
|
38
|
+
content_tag :div, :class => css_classes do
|
39
|
+
output.join("\n").html_safe
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def f7_bar_link(title_or_options, options=nil)
|
45
|
+
output = []
|
46
|
+
link_classes = []
|
47
|
+
|
48
|
+
if title_or_options.class == Hash
|
49
|
+
options = title_or_options
|
50
|
+
title = options[:title]
|
51
|
+
else
|
52
|
+
title = title_or_options
|
53
|
+
options ||= {}
|
54
|
+
end
|
55
|
+
|
56
|
+
href = options[:href] || '#'
|
57
|
+
icon = options[:icon]
|
58
|
+
|
59
|
+
if @f7_bartype == :tabbar
|
60
|
+
link_classes << 'tab-link'
|
61
|
+
else
|
62
|
+
link_classes << :link
|
63
|
+
end
|
64
|
+
|
65
|
+
link_classes << 'icon-only' if title.blank?
|
66
|
+
options[:class] = ([options[:class]] || []) + link_classes
|
67
|
+
|
68
|
+
link_attr = options.reject { |k, v| [:title, :icon, :badge].include? k }
|
69
|
+
|
70
|
+
span_class = (@f7_bartype == :tabbar ? {:class => 'tabbar-label'} : nil)
|
71
|
+
|
72
|
+
if icon.blank?
|
73
|
+
content_tag :a, title, link_attr
|
74
|
+
else
|
75
|
+
badge = nil
|
76
|
+
link_options = {}
|
77
|
+
if @f7_bartype == :tabbar
|
78
|
+
if options[:badge].kind_of? Hash
|
79
|
+
badge_data = options[:badge]
|
80
|
+
badge_classes = [:badge]
|
81
|
+
badge_classes << badge_data[:class] unless badge_data[:class].blank?
|
82
|
+
badge = content_tag :span, badge_data[:text], :class => badge_classes
|
83
|
+
else
|
84
|
+
badge = content_tag :span, options[:badge], :class => [:badge, 'badge-red']
|
85
|
+
end
|
86
|
+
link = link_icon_i(options[:icon], badge)
|
87
|
+
end
|
88
|
+
puts " has labels: #{@has_labels ? 'true' : 'false'}"
|
89
|
+
content_tag :a, :href => href, :class => link_classes do
|
90
|
+
output << link_icon_i(options[:icon], badge)
|
91
|
+
output << content_tag(:span, title, span_class) if !title.blank? && @has_labels
|
92
|
+
output.join("\n").html_safe
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
def link_icon_i(icon)
|
100
|
+
if icon
|
101
|
+
content_tag :i, '', :class => ['icon', icon]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module ContentBlockHelper
|
2
|
+
|
3
|
+
def f7_content_block(*args, &block)
|
4
|
+
output = []
|
5
|
+
title = nil
|
6
|
+
options = {}
|
7
|
+
if args.count > 0
|
8
|
+
if (args.first.kind_of?(String) || args.first.kind_of?(Symbol))
|
9
|
+
title = args.first
|
10
|
+
options = args.second || {}
|
11
|
+
elsif arg.first.kind_of? Hash
|
12
|
+
options = args.first
|
13
|
+
title = options[:title]
|
14
|
+
options = options.reject { |k,v| k == :title }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
output << content_block_title_div(title) unless title.nil?
|
18
|
+
output << content_block_div(options) do
|
19
|
+
yield if block_given?
|
20
|
+
end
|
21
|
+
output.join("\n").html_safe
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def content_block_div(options, &block)
|
29
|
+
format = []
|
30
|
+
output = []
|
31
|
+
css_classes = []
|
32
|
+
css_classes << "content-block"
|
33
|
+
|
34
|
+
if options[:format]
|
35
|
+
format = [options[:format]].flatten!.map { |v| v.to_sym }
|
36
|
+
if format.include? :inset
|
37
|
+
css_classes << "inset"
|
38
|
+
elsif format.include? :tablet_inset
|
39
|
+
css_classes << "tablet-inset"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
css_classes += [options[:class]] if options[:class]
|
43
|
+
|
44
|
+
options.reject! { |k, v| [:class, :format].include? k }
|
45
|
+
options[:class] = css_classes.uniq
|
46
|
+
|
47
|
+
content_tag :div, options do
|
48
|
+
if format.include? :inner
|
49
|
+
content_tag :div, :class => [ 'content-block-inner' ] do
|
50
|
+
output << capture(&block) if block_given?
|
51
|
+
output.join("\n").html_safe
|
52
|
+
end
|
53
|
+
else
|
54
|
+
output << capture(&block) if block_given?
|
55
|
+
output.join("\n").html_safe
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
def content_block_title_div(title)
|
63
|
+
content_tag :div, title, :class => [ 'content-block-title' ]
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Framework7Helper
|
2
|
+
def present(object, klass = nil)
|
3
|
+
klass ||= "#{object.class}Presenter".constantize if Rails.const_defined?("#{object.class}Presenter")
|
4
|
+
klass ||= "Framework7::#{object.class.name.demodulize}Presenter".constantize
|
5
|
+
presenter = klass.new(object, self)
|
6
|
+
yield presenter if block_given?
|
7
|
+
presenter
|
8
|
+
end
|
9
|
+
|
10
|
+
# def f7_link(name = nil, options = nil, html_options = nil, &block)
|
11
|
+
# if name.blank?
|
12
|
+
# if html_options[:class]
|
13
|
+
# html_options[:class] = ['link', 'icon-only'].merge!(html_options[:class])
|
14
|
+
# else
|
15
|
+
# html_options[:class] = ['link', 'icon-only']
|
16
|
+
# end
|
17
|
+
|
18
|
+
# if options[:icon]
|
19
|
+
# icon = options[:icon]
|
20
|
+
# name = content_tag(:i, '', :class => ['icon', "icon-#{icon}"])
|
21
|
+
# options.reject! { |k, v| k == :icon }
|
22
|
+
# end
|
23
|
+
# else
|
24
|
+
# link_to name, options, html_options, block
|
25
|
+
# end
|
26
|
+
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
module ListBlockHelper
|
2
|
+
|
3
|
+
def f7_list_block(*args, &block)
|
4
|
+
output = []
|
5
|
+
title = nil
|
6
|
+
options = {}
|
7
|
+
if args.count > 0
|
8
|
+
if (args.first.kind_of?(String) || args.first.kind_of?(Symbol))
|
9
|
+
title = args.first
|
10
|
+
options = args.second || {}
|
11
|
+
elsif arg.first.kind_of? Hash
|
12
|
+
options = args.first
|
13
|
+
title = options[:title]
|
14
|
+
options = options.reject{ |k,v| k == :title }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
list_block_div(options) do
|
18
|
+
concat content_block_title_div(title) unless title.blank?
|
19
|
+
concat list_block_ul(&block)
|
20
|
+
concat list_block_label(options) unless options[:label].blank?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def f7_list_divider(title_or_options, options = nil, &block)
|
26
|
+
if title_or_options.class == Hash
|
27
|
+
options = title_or_options if options.nil?
|
28
|
+
title_or_options = options[:title]
|
29
|
+
end
|
30
|
+
title = title_or_options
|
31
|
+
|
32
|
+
content_tag :li do
|
33
|
+
content_tag :div, title, :class => ['item-divider']
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
def f7_list_group(title_or_options, options = nil, &block)
|
40
|
+
if title_or_options.class == Hash
|
41
|
+
options = title_or_options if options.nil?
|
42
|
+
title_or_options = options[:title]
|
43
|
+
end
|
44
|
+
title = title_or_options
|
45
|
+
|
46
|
+
content_tag :div, :class => ["list-group"] do
|
47
|
+
concat list_group_title title unless title.blank?
|
48
|
+
yield if block_given?
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
def f7_list_group_title(title, options = {}, &block)
|
54
|
+
list_group_li(title, options)
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
def f7_list_item(title, options = {}, &block)
|
60
|
+
content_tag :li do
|
61
|
+
css_classes = ["item-content"]
|
62
|
+
tag = options[:href] ? :a : :div
|
63
|
+
css_classes << "item-link" if tag == :a
|
64
|
+
css_classes.concat(options[:class]) if options[:class]
|
65
|
+
|
66
|
+
tag_options = options.reject { |k, v| [:title, :icon, :after].include? k }
|
67
|
+
tag_options[:class] = css_classes
|
68
|
+
|
69
|
+
content_tag tag, tag_options do
|
70
|
+
concat list_icon_i(options[:icon]) if options[:icon]
|
71
|
+
concat list_item_inner(title, options)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def list_block_div(options={}, &block)
|
81
|
+
output = []
|
82
|
+
css_classes = ["list-block"]
|
83
|
+
if options[:format]
|
84
|
+
format = [options[:format]].flatten.map { |v| v.to_sym }
|
85
|
+
if format.include? :inset
|
86
|
+
css_classes << "inset"
|
87
|
+
elsif format.include? :tablet_inset
|
88
|
+
css_classes << "tablet-inset"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
css_classes += [options[:class]] if options[:class]
|
92
|
+
|
93
|
+
block_options = options.reject { |k, v| [:class, :format, :label].include? k }
|
94
|
+
block_options[:class] = css_classes.uniq
|
95
|
+
|
96
|
+
content_tag :div, block_options do
|
97
|
+
output << capture(&block) if block_given?
|
98
|
+
output.join("\n").html_safe
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
def list_block_ul(&block)
|
105
|
+
content_tag :ul do
|
106
|
+
yield if block_given?
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
def list_group_title(title, options={})
|
113
|
+
content_tag :li, title, :class => ["list-group-title"]
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
def list_item_inner(title, options={})
|
119
|
+
content_tag :div, :class => ["item-inner"] do
|
120
|
+
concat content_tag :div, title, :class => ["item-title"]
|
121
|
+
concat list_item_inner_div(options)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
def list_item_inner_div(options={}, &block)
|
128
|
+
if options[:after] || options[:badge]
|
129
|
+
content_tag :div, :class => ['item-after'] do
|
130
|
+
if options[:after]
|
131
|
+
if options[:after].kind_of? Hash
|
132
|
+
after = options[:after].first
|
133
|
+
case after[0].to_sym
|
134
|
+
when :icon
|
135
|
+
klass = "icon #{after[1]}"
|
136
|
+
concat content_tag(:span, '', :class => klass)
|
137
|
+
when :badge
|
138
|
+
badge_or_options = after[1]
|
139
|
+
if badge_or_options.kind_of? Hash
|
140
|
+
badge_data = badge_or_options
|
141
|
+
badge_classes = [:badge]
|
142
|
+
badge_classes << badge_data[:class] unless badge_data[:class].blank?
|
143
|
+
badge = content_tag :span, badge_data[:text], :class => badge_classes
|
144
|
+
else
|
145
|
+
badge = content_tag :span, badge_or_options, :class => [:badge, 'badge-red']
|
146
|
+
end
|
147
|
+
when :text
|
148
|
+
concat after[1]
|
149
|
+
end
|
150
|
+
else
|
151
|
+
concat "#{options[:after]}"
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
def list_item_badge(value, options={})
|
161
|
+
content_tag :span, value, :class => ["badge"]
|
162
|
+
end
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
def list_icon_i(icon)
|
167
|
+
content_tag :div, :class => ['item-media'] do
|
168
|
+
content_tag :i, '', :class => ['icon', icon]
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
def list_block_label(options={}, &block)
|
175
|
+
content_tag :div, :class => "list-block-label" do
|
176
|
+
content_tag :p, options[:label] if options[:label]
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
end
|