mighty_grid 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +7 -1
- data/.travis.yml +10 -3
- data/Appraisals +6 -3
- data/Gemfile +8 -3
- data/Rakefile +5 -6
- data/features/filtering.feature +14 -13
- data/features/step_definitions/steps.rb +4 -4
- data/features/support/capybara.rb +8 -0
- data/features/support/database_cleaner.rb +2 -2
- data/features/support/env.rb +4 -3
- data/features/support/paths.rb +4 -4
- data/gemfiles/rails_32.gemfile +9 -4
- data/gemfiles/rails_40.gemfile +7 -2
- data/gemfiles/rails_41.gemfile +7 -2
- data/lib/generators/mighty_grid/install_generator.rb +4 -2
- data/lib/generators/mighty_grid/templates/mighty_grid_config.rb +1 -1
- data/lib/mighty_grid/base.rb +30 -33
- data/lib/mighty_grid/column.rb +16 -18
- data/lib/mighty_grid/config.rb +1 -1
- data/lib/mighty_grid/engine.rb +1 -3
- data/lib/mighty_grid/filter_renderer.rb +24 -24
- data/lib/mighty_grid/grid_renderer.rb +8 -6
- data/lib/mighty_grid/helpers/mighty_grid_view_helpers.rb +71 -74
- data/lib/mighty_grid/kaminari_monkey_patching.rb +1 -1
- data/lib/mighty_grid/mighty_grid_controller.rb +4 -6
- data/lib/mighty_grid/mighty_grid_ext.rb +2 -2
- data/lib/mighty_grid/mighty_grid_misc.rb +2 -4
- data/lib/mighty_grid/version.rb +1 -1
- data/lib/mighty_grid.rb +1 -1
- data/mighty_grid.gemspec +11 -11
- data/spec/config_spec.rb +27 -27
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/stylesheets/application.css +16 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/users_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/company.rb +3 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/{fake_app/views/index.html.erb → dummy/app/views/users/index.html} +0 -6
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +31 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml.travis +28 -0
- data/spec/dummy/config/environment.rb +9 -0
- data/spec/dummy/config/environments/development.rb +38 -0
- data/spec/dummy/config/environments/production.rb +83 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/secret_token.rb +16 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +10 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/migrate/20140727125647_create_users.rb +12 -0
- data/spec/dummy/db/migrate/20140727141742_create_companies.rb +9 -0
- data/spec/dummy/db/schema.rb +31 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/lib/base_spec.rb +31 -54
- data/spec/lib/column_spec.rb +13 -13
- data/spec/lib/generators/install_generator_spec.rb +7 -7
- data/spec/spec_helper.rb +5 -3
- data/spec/support/capybara.rb +0 -4
- data/spec/support/database_cleaner.rb +1 -5
- metadata +94 -12
- data/spec/fake_app/config/database.yml.example +0 -14
- data/spec/fake_app/models/active_record.rb +0 -25
- data/spec/fake_app/models/config.rb +0 -5
- data/spec/fake_app/rails_app.rb +0 -39
@@ -9,7 +9,7 @@ module MightyGrid
|
|
9
9
|
@blank_slate_handler = nil
|
10
10
|
end
|
11
11
|
|
12
|
-
def column(attr_or_options = {}, options=nil, &block)
|
12
|
+
def column(attr_or_options = {}, options = nil, &block)
|
13
13
|
if attr_or_options.is_a?(Hash)
|
14
14
|
options = attr_or_options.symbolize_keys
|
15
15
|
else
|
@@ -41,19 +41,21 @@ module MightyGrid
|
|
41
41
|
opts.assert_valid_keys(options.keys)
|
42
42
|
options.merge!(opts)
|
43
43
|
|
44
|
-
@columns << MightyGrid::Column.new(
|
44
|
+
@columns << MightyGrid::Column.new(title: 'Actions') { |object| @grid.controller.render_to_string(partial: options[:partial], locals: { actions: options[:only], object: object }) }
|
45
45
|
end
|
46
46
|
|
47
47
|
def blank_slate(html_or_opts = nil, &block)
|
48
|
-
if (html_or_opts.is_a?(Hash) && html_or_opts.
|
48
|
+
if (html_or_opts.is_a?(Hash) && html_or_opts.key?(:partial) || html_or_opts.is_a?(String)) && !block_given?
|
49
49
|
@blank_slate_handler = html_or_opts
|
50
50
|
elsif html_or_opts.nil? && block_given?
|
51
51
|
@blank_slate_handler = block
|
52
52
|
else
|
53
|
-
|
53
|
+
fail MightyGridArgumentError.new("blank_slate accepts only a string, a block, or :partial => 'path_to_partial' ")
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def total_columns
|
57
|
+
def total_columns
|
58
|
+
@columns.count
|
59
|
+
end
|
58
60
|
end
|
59
|
-
end
|
61
|
+
end
|
@@ -1,12 +1,11 @@
|
|
1
1
|
module MightyGrid
|
2
2
|
module GridViewHelper
|
3
|
-
def grid(grid, opts={}, &block)
|
3
|
+
def grid(grid, opts = {}, &block)
|
4
4
|
define_grid(grid, opts, &block)
|
5
5
|
render_grid(grid)
|
6
6
|
end
|
7
7
|
|
8
|
-
def define_grid(grid, opts={}, &block)
|
9
|
-
|
8
|
+
def define_grid(grid, opts = {}, &block)
|
10
9
|
rendering = GridRenderer.new(grid, self)
|
11
10
|
|
12
11
|
block.call(rendering)
|
@@ -43,7 +42,6 @@ module MightyGrid
|
|
43
42
|
else
|
44
43
|
grid.output_buffer = blank_slate_template(rendering)
|
45
44
|
end
|
46
|
-
|
47
45
|
end
|
48
46
|
|
49
47
|
# Used after <tt>define_grid</tt> to actually output the grid HTML code.
|
@@ -54,112 +52,111 @@ module MightyGrid
|
|
54
52
|
end
|
55
53
|
|
56
54
|
# Creates a form to filter the data in the target grid.
|
57
|
-
def mighty_filter_for(grid, options={}, &block)
|
55
|
+
def mighty_filter_for(grid, options = {}, &block)
|
58
56
|
html_options = options[:html] ||= {}
|
59
57
|
html_options = MightyGrid::MgHTML.join_html_classes(html_options, 'mighty-grid-filter')
|
60
|
-
html_options[:method] = options.delete(:method) if options.
|
58
|
+
html_options[:method] = options.delete(:method) if options.key?(:method)
|
61
59
|
html_options[:method] ||= :get
|
62
60
|
|
63
61
|
filter = FilterRenderer.new(grid, self)
|
64
62
|
|
65
63
|
output = capture(filter, &block)
|
66
|
-
form_tag(options[:url] || {}, html_options){ output }
|
64
|
+
form_tag(options[:url] || {}, html_options) { output }
|
67
65
|
end
|
68
66
|
|
69
67
|
def blank_slate_template(rendering)
|
70
68
|
if rendering.blank_slate_handler.present?
|
71
69
|
case rendering.blank_slate_handler
|
72
|
-
when Proc
|
73
|
-
when String
|
74
|
-
when Hash
|
70
|
+
when Proc then rendering.blank_slate_handler.call
|
71
|
+
when String then rendering.blank_slate_handler
|
72
|
+
when Hash then render(rendering.blank_slate_handler)
|
75
73
|
end
|
76
74
|
else
|
77
75
|
content_tag :div, 'No records found'
|
78
76
|
end
|
79
77
|
end
|
80
78
|
|
81
|
-
def actions_template(rendering)
|
82
|
-
render(partial: 'mighty_grid/actions')
|
83
|
-
end
|
84
|
-
|
85
79
|
private
|
86
80
|
|
87
|
-
|
88
|
-
|
81
|
+
def header_grid_html(rendering, grid, options)
|
82
|
+
header_tr_html = MightyGrid::MgHTML.join_html_classes(options[:header_tr_html], MightyGrid.config.header_tr_class)
|
89
83
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
end
|
84
|
+
content_tag :thead do
|
85
|
+
content_tag :tr, header_tr_html do
|
86
|
+
rendering.columns.map do |column|
|
87
|
+
content_tag(:th, column.th_attrs) { grid_title_html(grid, column, options) }
|
88
|
+
end.join.html_safe
|
96
89
|
end
|
97
90
|
end
|
91
|
+
end
|
98
92
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
end
|
116
|
-
else
|
117
|
-
html_title = link_to(column.title.html_safe, "?#{grid_order_params(grid, column).to_query}")
|
93
|
+
def grid_title_html(grid, column, options)
|
94
|
+
if column.options[:ordering] && column.attribute.present?
|
95
|
+
order_asc = column.options[:order_asc] || options[:order_asc]
|
96
|
+
order_desc = column.options[:order_desc] || options[:order_desc]
|
97
|
+
order_active = grid.get_active_order_direction(grid_order_params(grid, column))
|
98
|
+
|
99
|
+
case options[:order_type]
|
100
|
+
when 'pair'
|
101
|
+
order_asc_class = MightyGrid::MgHTML.join_html_classes({}, (order_active == 'asc' ? options[:order_active_link_class] : nil), options[:order_asc_link_class])[:class]
|
102
|
+
order_desc_class = MightyGrid::MgHTML.join_html_classes({}, (order_active == 'desc' ? options[:order_active_link_class] : nil), options[:order_desc_link_class])[:class]
|
103
|
+
html_title = column.title
|
104
|
+
html_title += content_tag :div, class: options[:order_wrapper_class] do
|
105
|
+
html_order = get_order_html(grid, column, order_active, order_asc, 'asc', class: order_asc_class)
|
106
|
+
html_order += ' '
|
107
|
+
html_order += get_order_html(grid, column, order_active, order_desc, 'desc', class: order_desc_class)
|
108
|
+
html_order.html_safe
|
118
109
|
end
|
119
|
-
html_title.html_safe
|
120
110
|
else
|
121
|
-
|
111
|
+
if order_active
|
112
|
+
html_order = ' '
|
113
|
+
html_order += order_active == 'asc' ? order_asc : order_desc
|
114
|
+
end
|
115
|
+
html_title = link_to("#{column.title}#{html_order}".html_safe, "?#{grid_order_params(grid, column).to_query}")
|
122
116
|
end
|
117
|
+
html_title.html_safe
|
118
|
+
else
|
119
|
+
column.title.html_safe
|
123
120
|
end
|
121
|
+
end
|
124
122
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
131
|
-
html.html_safe
|
123
|
+
def get_order_html(grid, column, order_active, order_html, direction = nil, html_options = {})
|
124
|
+
if order_active == direction
|
125
|
+
html = content_tag :span, order_html.html_safe, html_options
|
126
|
+
else
|
127
|
+
html = link_to(order_html.html_safe, "?#{grid_order_params(grid, column, direction).to_query}", html_options)
|
132
128
|
end
|
129
|
+
html.html_safe
|
130
|
+
end
|
133
131
|
|
134
|
-
|
135
|
-
|
136
|
-
|
132
|
+
def grid_order_params(grid, column, direction = nil)
|
133
|
+
MightyGrid::MgHash.rec_merge(grid.params, grid.order_params(column.attribute, column.model, direction)).except('controller', 'action')
|
134
|
+
end
|
137
135
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
end
|
136
|
+
def body_grid_html(rendering, grid)
|
137
|
+
content_tag :tbody do
|
138
|
+
html_record = ''
|
139
|
+
grid.relation.each do |rel|
|
140
|
+
html_record += content_tag :tr do
|
141
|
+
rendering.columns.map { |column| content_tag :td, column.render(rel), column.attrs }.join.html_safe
|
145
142
|
end
|
146
|
-
html_record.html_safe
|
147
143
|
end
|
144
|
+
html_record.html_safe
|
148
145
|
end
|
146
|
+
end
|
149
147
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
end
|
158
|
-
html_pag.html_safe
|
148
|
+
def footer_grid_html(rendering, grid)
|
149
|
+
content_tag :tfoot do
|
150
|
+
content_tag :tr do
|
151
|
+
content_tag :td, colspan: rendering.total_columns do
|
152
|
+
html_pag = paginate(grid.relation, theme: MightyGrid.config.pagination_theme, param_name: "#{grid.name}[page]")
|
153
|
+
html_pag += content_tag :strong do
|
154
|
+
"#{grid.relation.offset_value + 1} – #{grid.relation.offset_value + grid.relation.size} of #{grid.relation.total_count}".html_safe
|
159
155
|
end
|
160
|
-
|
161
|
-
|
156
|
+
html_pag.html_safe
|
157
|
+
end
|
158
|
+
end.html_safe
|
162
159
|
end
|
163
|
-
|
160
|
+
end
|
164
161
|
end
|
165
|
-
end
|
162
|
+
end
|
@@ -1,16 +1,14 @@
|
|
1
1
|
module MightyGrid
|
2
|
-
|
3
2
|
module Controller
|
4
|
-
|
5
3
|
protected
|
6
4
|
|
7
5
|
attr_accessor :mighty_grid_instances
|
8
6
|
|
9
|
-
def init_grid(klass, opts={})
|
7
|
+
def init_grid(klass, opts = {})
|
10
8
|
cg = MightyGrid::Base.new(klass, self, opts)
|
11
|
-
|
12
|
-
|
9
|
+
@mighty_grid_instances = [] if @mighty_grid_instances.nil?
|
10
|
+
@mighty_grid_instances << cg
|
13
11
|
cg
|
14
12
|
end
|
15
13
|
end
|
16
|
-
end
|
14
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module MightyGrid
|
2
2
|
module MgHash
|
3
3
|
class << self
|
4
|
-
|
4
|
+
# A deep merge of two hashes.
|
5
5
|
# That is, if both hashes have the same key and the values are hashes, these two hashes should also be merged.
|
6
6
|
# Used for merging two sets of params.
|
7
7
|
def rec_merge(hash, other) #:nodoc:
|
@@ -30,4 +30,4 @@ module MightyGrid
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
33
|
-
end
|
33
|
+
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
module MightyGrid
|
2
|
-
|
3
2
|
module ExceptionsMixin #:nodoc:
|
4
3
|
def initialize(str) #:nodoc:
|
5
|
-
super("MightyGrid: "
|
4
|
+
super("MightyGrid: #{str}")
|
6
5
|
end
|
7
6
|
end
|
8
7
|
|
9
8
|
class MightyGridArgumentError < ArgumentError #:nodoc:
|
10
9
|
include ExceptionsMixin
|
11
10
|
end
|
12
|
-
|
13
|
-
end
|
11
|
+
end
|
data/lib/mighty_grid/version.rb
CHANGED
data/lib/mighty_grid.rb
CHANGED
data/mighty_grid.gemspec
CHANGED
@@ -4,23 +4,23 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'mighty_grid/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'mighty_grid'
|
8
8
|
spec.version = MightyGrid::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary = %q
|
12
|
-
spec.description = %q
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.authors = ['jurrick']
|
10
|
+
spec.email = ['jurianp@gmail.com']
|
11
|
+
spec.summary = %q(Flexible grid for Rails)
|
12
|
+
spec.description = %q(Flexible grid for Rails)
|
13
|
+
spec.homepage = 'http://github.com/jurrick/mighty_grid'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.5'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
|
+
spec.add_development_dependency 'rspec-rails', '~> 2.14.2'
|
24
24
|
spec.add_development_dependency 'appraisal'
|
25
25
|
|
26
26
|
spec.add_dependency 'kaminari', '~> 0.15.0'
|
data/spec/config_spec.rb
CHANGED
@@ -8,9 +8,9 @@ describe MightyGrid::Configuration do
|
|
8
8
|
its(:per_page) { should == 15 }
|
9
9
|
end
|
10
10
|
context 'configured via config block' do
|
11
|
-
before { MightyGrid.configure {|c| c.per_page = 17} }
|
11
|
+
before { MightyGrid.configure { |c| c.per_page = 17 } }
|
12
12
|
its(:per_page) { should == 17 }
|
13
|
-
after { MightyGrid.configure {|c| c.per_page = 15} }
|
13
|
+
after { MightyGrid.configure { |c| c.per_page = 15 } }
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -19,9 +19,9 @@ describe MightyGrid::Configuration do
|
|
19
19
|
its(:order_direction) { should == 'asc' }
|
20
20
|
end
|
21
21
|
context 'configured via config block' do
|
22
|
-
before { MightyGrid.configure {|c| c.order_direction = 'desc'} }
|
22
|
+
before { MightyGrid.configure { |c| c.order_direction = 'desc' } }
|
23
23
|
its(:order_direction) { should == 'desc' }
|
24
|
-
after { MightyGrid.configure {|c| c.order_direction = 'asc'} }
|
24
|
+
after { MightyGrid.configure { |c| c.order_direction = 'asc' } }
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -30,9 +30,9 @@ describe MightyGrid::Configuration do
|
|
30
30
|
its(:order_type) { should == 'single' }
|
31
31
|
end
|
32
32
|
context 'configured via config block' do
|
33
|
-
before { MightyGrid.configure {|c| c.order_type = 'pair'} }
|
33
|
+
before { MightyGrid.configure { |c| c.order_type = 'pair' } }
|
34
34
|
its(:order_type) { should == 'pair' }
|
35
|
-
after { MightyGrid.configure {|c| c.order_type = 'single'} }
|
35
|
+
after { MightyGrid.configure { |c| c.order_type = 'single' } }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -41,9 +41,9 @@ describe MightyGrid::Configuration do
|
|
41
41
|
its(:order_asc) { should == '↑' }
|
42
42
|
end
|
43
43
|
context 'configured via config block' do
|
44
|
-
before { MightyGrid.configure {|c| c.order_asc = '∧'} }
|
44
|
+
before { MightyGrid.configure { |c| c.order_asc = '∧' } }
|
45
45
|
its(:order_asc) { should == '∧' }
|
46
|
-
after { MightyGrid.configure {|c| c.order_asc = '↑'} }
|
46
|
+
after { MightyGrid.configure { |c| c.order_asc = '↑' } }
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -52,9 +52,9 @@ describe MightyGrid::Configuration do
|
|
52
52
|
its(:order_desc) { should == '↓' }
|
53
53
|
end
|
54
54
|
context 'configured via config block' do
|
55
|
-
before { MightyGrid.configure {|c| c.order_desc = '∨'} }
|
55
|
+
before { MightyGrid.configure { |c| c.order_desc = '∨' } }
|
56
56
|
its(:order_desc) { should == '∨' }
|
57
|
-
after { MightyGrid.configure {|c| c.order_desc = '↓'} }
|
57
|
+
after { MightyGrid.configure { |c| c.order_desc = '↓' } }
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -63,9 +63,9 @@ describe MightyGrid::Configuration do
|
|
63
63
|
its(:order_asc_link_class) { should == '' }
|
64
64
|
end
|
65
65
|
context 'configured via config block' do
|
66
|
-
before { MightyGrid.configure {|c| c.order_asc_link_class = 'btn'} }
|
66
|
+
before { MightyGrid.configure { |c| c.order_asc_link_class = 'btn' } }
|
67
67
|
its(:order_asc_link_class) { should == 'btn' }
|
68
|
-
after { MightyGrid.configure {|c| c.order_asc_link_class = ''} }
|
68
|
+
after { MightyGrid.configure { |c| c.order_asc_link_class = '' } }
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -74,9 +74,9 @@ describe MightyGrid::Configuration do
|
|
74
74
|
its(:order_active_link_class) { should == 'mg-order-active' }
|
75
75
|
end
|
76
76
|
context 'configured via config block' do
|
77
|
-
before { MightyGrid.configure {|c| c.order_active_link_class = 'btn-primary'} }
|
77
|
+
before { MightyGrid.configure { |c| c.order_active_link_class = 'btn-primary' } }
|
78
78
|
its(:order_active_link_class) { should == 'btn-primary' }
|
79
|
-
after { MightyGrid.configure {|c| c.order_active_link_class = ''} }
|
79
|
+
after { MightyGrid.configure { |c| c.order_active_link_class = '' } }
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -85,9 +85,9 @@ describe MightyGrid::Configuration do
|
|
85
85
|
its(:order_desc_link_class) { should == '' }
|
86
86
|
end
|
87
87
|
context 'configured via config block' do
|
88
|
-
before { MightyGrid.configure {|c| c.order_desc_link_class = 'btn'} }
|
88
|
+
before { MightyGrid.configure { |c| c.order_desc_link_class = 'btn' } }
|
89
89
|
its(:order_desc_link_class) { should == 'btn' }
|
90
|
-
after { MightyGrid.configure {|c| c.order_desc_link_class = ''} }
|
90
|
+
after { MightyGrid.configure { |c| c.order_desc_link_class = '' } }
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -96,9 +96,9 @@ describe MightyGrid::Configuration do
|
|
96
96
|
its(:order_wrapper_class) { should == '' }
|
97
97
|
end
|
98
98
|
context 'configured via config block' do
|
99
|
-
before { MightyGrid.configure {|c| c.order_wrapper_class = 'btn-group'} }
|
99
|
+
before { MightyGrid.configure { |c| c.order_wrapper_class = 'btn-group' } }
|
100
100
|
its(:order_wrapper_class) { should == 'btn-group' }
|
101
|
-
after { MightyGrid.configure {|c| c.order_wrapper_class = ''} }
|
101
|
+
after { MightyGrid.configure { |c| c.order_wrapper_class = '' } }
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
@@ -107,9 +107,9 @@ describe MightyGrid::Configuration do
|
|
107
107
|
its(:grid_name) { should == 'grid' }
|
108
108
|
end
|
109
109
|
context 'configured via config block' do
|
110
|
-
before { MightyGrid.configure {|c| c.grid_name = 'g1'} }
|
110
|
+
before { MightyGrid.configure { |c| c.grid_name = 'g1' } }
|
111
111
|
its(:grid_name) { should == 'g1' }
|
112
|
-
after { MightyGrid.configure {|c| c.grid_name = 'grid'} }
|
112
|
+
after { MightyGrid.configure { |c| c.grid_name = 'grid' } }
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -118,9 +118,9 @@ describe MightyGrid::Configuration do
|
|
118
118
|
its(:table_class) { should == '' }
|
119
119
|
end
|
120
120
|
context 'configured via config block' do
|
121
|
-
before { MightyGrid.configure {|c| c.table_class = 'table'} }
|
121
|
+
before { MightyGrid.configure { |c| c.table_class = 'table' } }
|
122
122
|
its(:table_class) { should == 'table' }
|
123
|
-
after { MightyGrid.configure {|c| c.table_class = ''} }
|
123
|
+
after { MightyGrid.configure { |c| c.table_class = '' } }
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -129,9 +129,9 @@ describe MightyGrid::Configuration do
|
|
129
129
|
its(:header_tr_class) { should == '' }
|
130
130
|
end
|
131
131
|
context 'configured via config block' do
|
132
|
-
before { MightyGrid.configure {|c| c.header_tr_class = 'active'} }
|
132
|
+
before { MightyGrid.configure { |c| c.header_tr_class = 'active' } }
|
133
133
|
its(:header_tr_class) { should == 'active' }
|
134
|
-
after { MightyGrid.configure {|c| c.header_tr_class = ''} }
|
134
|
+
after { MightyGrid.configure { |c| c.header_tr_class = '' } }
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
@@ -140,9 +140,9 @@ describe MightyGrid::Configuration do
|
|
140
140
|
its(:pagination_theme) { should == 'mighty_grid' }
|
141
141
|
end
|
142
142
|
context 'configured via config block' do
|
143
|
-
before { MightyGrid.configure {|c| c.pagination_theme = 'pagination1'} }
|
143
|
+
before { MightyGrid.configure { |c| c.pagination_theme = 'pagination1' } }
|
144
144
|
its(:pagination_theme) { should == 'pagination1' }
|
145
|
-
after { MightyGrid.configure {|c| c.pagination_theme = 'mighty_grid'} }
|
145
|
+
after { MightyGrid.configure { |c| c.pagination_theme = 'mighty_grid' } }
|
146
146
|
end
|
147
147
|
end
|
148
|
-
end
|
148
|
+
end
|
data/spec/dummy/Rakefile
ADDED
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require mighty_grid
|
16
|
+
//= require_tree .
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
+
* file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require mighty_grid
|
15
|
+
*= require_self
|
16
|
+
*/
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,7 +1,3 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head></head>
|
4
|
-
<body>
|
5
1
|
<%= mighty_filter_for @users_grid do |filter| %>
|
6
2
|
<%= filter.label :name %>
|
7
3
|
<%= filter.text_field :name %>
|
@@ -17,5 +13,3 @@
|
|
17
13
|
<% g.column :role %>
|
18
14
|
<% g.column :is_banned %>
|
19
15
|
<% end %>
|
20
|
-
</body>
|
21
|
-
</html>
|
data/spec/dummy/bin/rake
ADDED