simple_table_for 0.1.1 → 0.2.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 +4 -4
- data/README.md +3 -1
- data/lib/simple_table_for/defaults.rb +11 -0
- data/lib/simple_table_for/helpers.rb +40 -0
- data/lib/simple_table_for/rails.rb +10 -0
- data/lib/simple_table_for/version.rb +1 -1
- data/lib/simple_table_for.rb +3 -59
- data/test/dummy/config/application.rb +4 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +338 -0
- data/test/dummy/test/controllers/posts_controller_test.rb +2 -7
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b208088ee644b17dd731b8cf5724348b62ab32d7
|
4
|
+
data.tar.gz: df5cbddee701c5ba3bb4fe085b9d503430b0df2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31c202cd5a104cc41c7c809a13284af657f11f8904660f32a2e3fbe402301ab094e6e4af197b4864a3ccade749afcbdc02bd28993dce8204d8f7ac1d4f45a936
|
7
|
+
data.tar.gz: 1e4545d2e0ae2364dfa0fe799479c678be51afa1409ead8cdad1077364f4e50674a38fa54b5b9fd931eb6d2337df03868cf9959b58f36a59d8ca324889153bae
|
data/README.md
CHANGED
@@ -41,7 +41,9 @@ You can also set default id and class for tables:
|
|
41
41
|
```ruby
|
42
42
|
# application.rb
|
43
43
|
class Application < Rails:Application
|
44
|
-
|
44
|
+
config.simple_table_for.defaults = {
|
45
|
+
class: 'table table-condensed table-striped table-bordered'
|
46
|
+
}
|
45
47
|
end
|
46
48
|
```
|
47
49
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module SimpleTableFor
|
2
|
+
module Helpers
|
3
|
+
# Creates a table field
|
4
|
+
# See table_for for details
|
5
|
+
def field(content, options = {})
|
6
|
+
content_tag :td, content, options
|
7
|
+
end
|
8
|
+
|
9
|
+
# Creates a table
|
10
|
+
# Usage:
|
11
|
+
# <%= table_for @posts, %w[Title Text Date Comments\ count -] do |post| %>
|
12
|
+
# <%= field post.title %>
|
13
|
+
# <%= field post.text %>
|
14
|
+
# <%= field post.date %>
|
15
|
+
# <%= field post.comments.count %>
|
16
|
+
# <%= field link_to('View', post) %>
|
17
|
+
# <% end %>
|
18
|
+
def table_for(collection, headers, options = {})
|
19
|
+
options = Defaults.get.merge options
|
20
|
+
|
21
|
+
content_tag :table, options do
|
22
|
+
concat (content_tag :thead do
|
23
|
+
content_tag :tr do
|
24
|
+
headers.map do |header|
|
25
|
+
concat(content_tag :th, header)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end)
|
29
|
+
|
30
|
+
concat (content_tag :tbody do
|
31
|
+
collection.map do |obj|
|
32
|
+
concat (content_tag :tr do
|
33
|
+
capture{ yield obj }
|
34
|
+
end)
|
35
|
+
end
|
36
|
+
end)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module SimpleTableFor
|
2
|
+
class ::Application < Rails::Application
|
3
|
+
config.simple_table_for = ActiveSupport::OrderedOptions.new
|
4
|
+
config.simple_table_for.defaults = ActiveSupport::OrderedOptions.new
|
5
|
+
|
6
|
+
config.after_initialize do |app|
|
7
|
+
Defaults.set app.config.simple_table_for.defaults
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/simple_table_for.rb
CHANGED
@@ -1,61 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
# See table for details
|
5
|
-
def field(content, options = {})
|
6
|
-
content_tag :td, content, id: options[:id], class: options[:class]
|
7
|
-
end
|
8
|
-
|
9
|
-
# Creates a table
|
10
|
-
# Usage:
|
11
|
-
# <%= table_for @posts, %w[Title Text Date Comments\ count -] do |post| %>
|
12
|
-
# <%= field post.title %>
|
13
|
-
# <%= field post.text %>
|
14
|
-
# <%= field post.date %>
|
15
|
-
# <%= field post.comments.count %>
|
16
|
-
# <%= field link_to('View', post) %>
|
17
|
-
# <% end %>
|
18
|
-
def table_for(collection, headers, options = {})
|
19
|
-
options = Defaults.get.merge options
|
20
|
-
|
21
|
-
content_tag :table, id: options[:id], class: options[:class] do
|
22
|
-
concat (content_tag :thead do
|
23
|
-
content_tag :tr do
|
24
|
-
headers.map do |header|
|
25
|
-
concat(content_tag :th, header)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end)
|
29
|
-
|
30
|
-
concat (content_tag :tbody do
|
31
|
-
collection.map do |obj|
|
32
|
-
concat (content_tag :tr do
|
33
|
-
capture{ yield obj }
|
34
|
-
end)
|
35
|
-
end
|
36
|
-
end)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# This class handles the default options
|
42
|
-
class Defaults
|
43
|
-
# Get de default options
|
44
|
-
def self.get
|
45
|
-
@defaults || defaults
|
46
|
-
end
|
47
|
-
|
48
|
-
# Set the default options
|
49
|
-
# SimpleTableFor::Defaults.set id: 'id', class: 'class'
|
50
|
-
def self.set(options)
|
51
|
-
@defaults = defaults.merge options
|
52
|
-
end
|
53
|
-
|
54
|
-
private
|
55
|
-
def self.defaults
|
56
|
-
{id: '', class: ''}
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
1
|
+
require_relative 'simple_table_for/defaults'
|
2
|
+
require_relative 'simple_table_for/rails'
|
3
|
+
require_relative 'simple_table_for/helpers'
|
60
4
|
|
61
5
|
ActionView::Base.send :include, SimpleTableFor::Helpers if defined? ActionView::Base
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/dummy/log/test.log
CHANGED
@@ -659,3 +659,341 @@ Processing by PostsController#index as HTML
|
|
659
659
|
Rendered posts/defaults.html.erb within layouts/application (3.4ms)
|
660
660
|
Completed 200 OK in 21ms (Views: 18.9ms | ActiveRecord: 1.6ms)
|
661
661
|
[1m[35m (0.1ms)[0m rollback transaction
|
662
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
663
|
+
[1m[35m (0.1ms)[0m begin transaction
|
664
|
+
[1m[36mFixture Delete (2.7ms)[0m [1mDELETE FROM "posts"[0m
|
665
|
+
[1m[35mFixture Insert (0.5ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-03-31 12:16:31', '2015-03-31 12:16:31', 980190962)
|
666
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-03-31 12:16:31', '2015-03-31 12:16:31', 298486374)[0m
|
667
|
+
[1m[35m (3.0ms)[0m commit transaction
|
668
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
669
|
+
---------------------------------------------
|
670
|
+
PostsControllerTest: test_should_render_table
|
671
|
+
---------------------------------------------
|
672
|
+
Processing by PostsController#index as HTML
|
673
|
+
Parameters: {"template"=>"render"}
|
674
|
+
[1m[35mPost Load (1.3ms)[0m SELECT "posts".* FROM "posts"
|
675
|
+
Rendered posts/render.html.erb within layouts/application (13.2ms)
|
676
|
+
Completed 200 OK in 127ms (Views: 125.5ms | ActiveRecord: 1.3ms)
|
677
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
678
|
+
[1m[35m (0.1ms)[0m begin transaction
|
679
|
+
-----------------------------------------------------------
|
680
|
+
PostsControllerTest: test_should_render_table_with_defaults
|
681
|
+
-----------------------------------------------------------
|
682
|
+
Processing by PostsController#index as HTML
|
683
|
+
Parameters: {"template"=>"defaults"}
|
684
|
+
[1m[36mPost Load (1.6ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
685
|
+
Rendered posts/defaults.html.erb within layouts/application (3.3ms)
|
686
|
+
Completed 200 OK in 21ms (Views: 18.6ms | ActiveRecord: 1.6ms)
|
687
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
688
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
689
|
+
[1m[35m (0.1ms)[0m begin transaction
|
690
|
+
[1m[36mFixture Delete (2.7ms)[0m [1mDELETE FROM "posts"[0m
|
691
|
+
[1m[35mFixture Insert (0.6ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:14:03', '2015-04-01 13:14:03', 980190962)
|
692
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:14:03', '2015-04-01 13:14:03', 298486374)[0m
|
693
|
+
[1m[35m (3.7ms)[0m commit transaction
|
694
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
695
|
+
-----------------------------------------------------------
|
696
|
+
PostsControllerTest: test_should_render_table_with_defaults
|
697
|
+
-----------------------------------------------------------
|
698
|
+
Processing by PostsController#index as HTML
|
699
|
+
Parameters: {"template"=>"defaults"}
|
700
|
+
[1m[35mPost Load (1.5ms)[0m SELECT "posts".* FROM "posts"
|
701
|
+
Rendered posts/defaults.html.erb within layouts/application (12.8ms)
|
702
|
+
Completed 200 OK in 160ms (Views: 158.4ms | ActiveRecord: 1.5ms)
|
703
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
704
|
+
[1m[35m (0.1ms)[0m begin transaction
|
705
|
+
---------------------------------------------
|
706
|
+
PostsControllerTest: test_should_render_table
|
707
|
+
---------------------------------------------
|
708
|
+
Processing by PostsController#index as HTML
|
709
|
+
Parameters: {"template"=>"render"}
|
710
|
+
[1m[36mPost Load (1.3ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
711
|
+
Rendered posts/render.html.erb within layouts/application (3.2ms)
|
712
|
+
Completed 200 OK in 21ms (Views: 18.9ms | ActiveRecord: 1.3ms)
|
713
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
714
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
715
|
+
[1m[35m (0.1ms)[0m begin transaction
|
716
|
+
[1m[36mFixture Delete (22.2ms)[0m [1mDELETE FROM "posts"[0m
|
717
|
+
[1m[35mFixture Insert (0.5ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:24:29', '2015-04-01 13:24:29', 980190962)
|
718
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:24:29', '2015-04-01 13:24:29', 298486374)[0m
|
719
|
+
[1m[35m (3.1ms)[0m commit transaction
|
720
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
721
|
+
---------------------------------------------
|
722
|
+
PostsControllerTest: test_should_render_table
|
723
|
+
---------------------------------------------
|
724
|
+
Processing by PostsController#index as HTML
|
725
|
+
Parameters: {"template"=>"render"}
|
726
|
+
[1m[35mPost Load (1.5ms)[0m SELECT "posts".* FROM "posts"
|
727
|
+
Rendered posts/render.html.erb within layouts/application (13.1ms)
|
728
|
+
Completed 200 OK in 148ms (Views: 146.5ms | ActiveRecord: 1.5ms)
|
729
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
730
|
+
[1m[35m (0.1ms)[0m begin transaction
|
731
|
+
-----------------------------------------------------------
|
732
|
+
PostsControllerTest: test_should_render_table_with_defaults
|
733
|
+
-----------------------------------------------------------
|
734
|
+
Processing by PostsController#index as HTML
|
735
|
+
Parameters: {"template"=>"defaults"}
|
736
|
+
[1m[36mPost Load (1.5ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
737
|
+
Rendered posts/defaults.html.erb within layouts/application (3.3ms)
|
738
|
+
Completed 200 OK in 20ms (Views: 18.8ms | ActiveRecord: 1.5ms)
|
739
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
740
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
741
|
+
[1m[35m (0.2ms)[0m begin transaction
|
742
|
+
[1m[36mFixture Delete (2.4ms)[0m [1mDELETE FROM "posts"[0m
|
743
|
+
[1m[35mFixture Insert (0.6ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:34:03', '2015-04-01 13:34:03', 980190962)
|
744
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:34:03', '2015-04-01 13:34:03', 298486374)[0m
|
745
|
+
[1m[35m (2.9ms)[0m commit transaction
|
746
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
747
|
+
---------------------------------------------
|
748
|
+
PostsControllerTest: test_should_render_table
|
749
|
+
---------------------------------------------
|
750
|
+
Processing by PostsController#index as HTML
|
751
|
+
Parameters: {"template"=>"render"}
|
752
|
+
[1m[35mPost Load (1.7ms)[0m SELECT "posts".* FROM "posts"
|
753
|
+
Rendered posts/render.html.erb within layouts/application (15.1ms)
|
754
|
+
Completed 200 OK in 142ms (Views: 139.8ms | ActiveRecord: 1.7ms)
|
755
|
+
[1m[36m (0.3ms)[0m [1mrollback transaction[0m
|
756
|
+
[1m[35m (0.1ms)[0m begin transaction
|
757
|
+
-----------------------------------------------------------
|
758
|
+
PostsControllerTest: test_should_render_table_with_defaults
|
759
|
+
-----------------------------------------------------------
|
760
|
+
Processing by PostsController#index as HTML
|
761
|
+
Parameters: {"template"=>"defaults"}
|
762
|
+
[1m[36mPost Load (1.9ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
763
|
+
Rendered posts/defaults.html.erb within layouts/application (4.0ms)
|
764
|
+
Completed 200 OK in 24ms (Views: 22.2ms | ActiveRecord: 1.9ms)
|
765
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
766
|
+
[1m[36mActiveRecord::SchemaMigration Load (2.1ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
767
|
+
[1m[35m (0.1ms)[0m begin transaction
|
768
|
+
[1m[36mFixture Delete (2.4ms)[0m [1mDELETE FROM "posts"[0m
|
769
|
+
[1m[35mFixture Insert (0.5ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:34:41', '2015-04-01 13:34:41', 980190962)
|
770
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:34:41', '2015-04-01 13:34:41', 298486374)[0m
|
771
|
+
[1m[35m (3.0ms)[0m commit transaction
|
772
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
773
|
+
-----------------------------------------------------------
|
774
|
+
PostsControllerTest: test_should_render_table_with_defaults
|
775
|
+
-----------------------------------------------------------
|
776
|
+
Processing by PostsController#index as HTML
|
777
|
+
Parameters: {"template"=>"defaults"}
|
778
|
+
[1m[35mPost Load (1.6ms)[0m SELECT "posts".* FROM "posts"
|
779
|
+
Rendered posts/defaults.html.erb within layouts/application (13.5ms)
|
780
|
+
Completed 200 OK in 134ms (Views: 132.2ms | ActiveRecord: 1.6ms)
|
781
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
782
|
+
[1m[35m (0.3ms)[0m begin transaction
|
783
|
+
---------------------------------------------
|
784
|
+
PostsControllerTest: test_should_render_table
|
785
|
+
---------------------------------------------
|
786
|
+
Processing by PostsController#index as HTML
|
787
|
+
Parameters: {"template"=>"render"}
|
788
|
+
[1m[36mPost Load (1.9ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
789
|
+
Rendered posts/render.html.erb within layouts/application (4.5ms)
|
790
|
+
Completed 200 OK in 25ms (Views: 23.1ms | ActiveRecord: 1.9ms)
|
791
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
792
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
793
|
+
[1m[35m (0.2ms)[0m begin transaction
|
794
|
+
[1m[36mFixture Delete (2.7ms)[0m [1mDELETE FROM "posts"[0m
|
795
|
+
[1m[35mFixture Insert (0.6ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:36:39', '2015-04-01 13:36:39', 980190962)
|
796
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:36:39', '2015-04-01 13:36:39', 298486374)[0m
|
797
|
+
[1m[35m (3.0ms)[0m commit transaction
|
798
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
799
|
+
-----------------------------------------------------------
|
800
|
+
PostsControllerTest: test_should_render_table_with_defaults
|
801
|
+
-----------------------------------------------------------
|
802
|
+
Processing by PostsController#index as HTML
|
803
|
+
Parameters: {"template"=>"defaults"}
|
804
|
+
[1m[35mPost Load (1.5ms)[0m SELECT "posts".* FROM "posts"
|
805
|
+
Rendered posts/defaults.html.erb within layouts/application (13.1ms)
|
806
|
+
Completed 200 OK in 123ms (Views: 121.5ms | ActiveRecord: 1.5ms)
|
807
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
808
|
+
[1m[35m (0.1ms)[0m begin transaction
|
809
|
+
---------------------------------------------
|
810
|
+
PostsControllerTest: test_should_render_table
|
811
|
+
---------------------------------------------
|
812
|
+
Processing by PostsController#index as HTML
|
813
|
+
Parameters: {"template"=>"render"}
|
814
|
+
[1m[36mPost Load (1.6ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
815
|
+
Rendered posts/render.html.erb within layouts/application (3.4ms)
|
816
|
+
Completed 200 OK in 22ms (Views: 19.7ms | ActiveRecord: 1.6ms)
|
817
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
818
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
819
|
+
[1m[35m (0.2ms)[0m begin transaction
|
820
|
+
[1m[36mFixture Delete (2.4ms)[0m [1mDELETE FROM "posts"[0m
|
821
|
+
[1m[35mFixture Insert (0.6ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:37:47', '2015-04-01 13:37:47', 980190962)
|
822
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:37:47', '2015-04-01 13:37:47', 298486374)[0m
|
823
|
+
[1m[35m (3.5ms)[0m commit transaction
|
824
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
825
|
+
---------------------------------------------
|
826
|
+
PostsControllerTest: test_should_render_table
|
827
|
+
---------------------------------------------
|
828
|
+
Processing by PostsController#index as HTML
|
829
|
+
Parameters: {"template"=>"render"}
|
830
|
+
[1m[35mPost Load (1.5ms)[0m SELECT "posts".* FROM "posts"
|
831
|
+
Rendered posts/render.html.erb within layouts/application (13.6ms)
|
832
|
+
Completed 200 OK in 128ms (Views: 126.2ms | ActiveRecord: 1.5ms)
|
833
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
834
|
+
[1m[35m (0.1ms)[0m begin transaction
|
835
|
+
-----------------------------------------------------------
|
836
|
+
PostsControllerTest: test_should_render_table_with_defaults
|
837
|
+
-----------------------------------------------------------
|
838
|
+
Processing by PostsController#index as HTML
|
839
|
+
Parameters: {"template"=>"defaults"}
|
840
|
+
[1m[36mPost Load (1.6ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
841
|
+
Rendered posts/defaults.html.erb within layouts/application (4.1ms)
|
842
|
+
Completed 200 OK in 22ms (Views: 20.2ms | ActiveRecord: 1.6ms)
|
843
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
844
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.0ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
845
|
+
[1m[35m (0.2ms)[0m begin transaction
|
846
|
+
[1m[36mFixture Delete (18.7ms)[0m [1mDELETE FROM "posts"[0m
|
847
|
+
[1m[35mFixture Insert (0.6ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:38:46', '2015-04-01 13:38:46', 980190962)
|
848
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:38:46', '2015-04-01 13:38:46', 298486374)[0m
|
849
|
+
[1m[35m (3.0ms)[0m commit transaction
|
850
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
851
|
+
---------------------------------------------
|
852
|
+
PostsControllerTest: test_should_render_table
|
853
|
+
---------------------------------------------
|
854
|
+
Processing by PostsController#index as HTML
|
855
|
+
Parameters: {"template"=>"render"}
|
856
|
+
[1m[35mPost Load (1.6ms)[0m SELECT "posts".* FROM "posts"
|
857
|
+
Rendered posts/render.html.erb within layouts/application (13.6ms)
|
858
|
+
Completed 200 OK in 124ms (Views: 122.0ms | ActiveRecord: 1.6ms)
|
859
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
860
|
+
[1m[35m (0.2ms)[0m begin transaction
|
861
|
+
-----------------------------------------------------------
|
862
|
+
PostsControllerTest: test_should_render_table_with_defaults
|
863
|
+
-----------------------------------------------------------
|
864
|
+
Processing by PostsController#index as HTML
|
865
|
+
Parameters: {"template"=>"defaults"}
|
866
|
+
[1m[36mPost Load (1.8ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
867
|
+
Rendered posts/defaults.html.erb within layouts/application (3.6ms)
|
868
|
+
Completed 200 OK in 21ms (Views: 19.2ms | ActiveRecord: 1.8ms)
|
869
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
870
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
871
|
+
[1m[35m (0.1ms)[0m begin transaction
|
872
|
+
[1m[36mFixture Delete (2.9ms)[0m [1mDELETE FROM "posts"[0m
|
873
|
+
[1m[35mFixture Insert (0.7ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:41:33', '2015-04-01 13:41:33', 980190962)
|
874
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:41:33', '2015-04-01 13:41:33', 298486374)[0m
|
875
|
+
[1m[35m (3.4ms)[0m commit transaction
|
876
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
877
|
+
---------------------------------------------
|
878
|
+
PostsControllerTest: test_should_render_table
|
879
|
+
---------------------------------------------
|
880
|
+
Processing by PostsController#index as HTML
|
881
|
+
Parameters: {"template"=>"render"}
|
882
|
+
[1m[35mPost Load (1.5ms)[0m SELECT "posts".* FROM "posts"
|
883
|
+
Rendered posts/render.html.erb within layouts/application (12.6ms)
|
884
|
+
Completed 200 OK in 122ms (Views: 120.1ms | ActiveRecord: 1.5ms)
|
885
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
886
|
+
[1m[35m (0.1ms)[0m begin transaction
|
887
|
+
-----------------------------------------------------------
|
888
|
+
PostsControllerTest: test_should_render_table_with_defaults
|
889
|
+
-----------------------------------------------------------
|
890
|
+
Processing by PostsController#index as HTML
|
891
|
+
Parameters: {"template"=>"defaults"}
|
892
|
+
[1m[36mPost Load (1.6ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
893
|
+
Rendered posts/defaults.html.erb within layouts/application (3.5ms)
|
894
|
+
Completed 200 OK in 22ms (Views: 20.0ms | ActiveRecord: 1.6ms)
|
895
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
896
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
897
|
+
[1m[35m (0.1ms)[0m begin transaction
|
898
|
+
[1m[36mFixture Delete (2.7ms)[0m [1mDELETE FROM "posts"[0m
|
899
|
+
[1m[35mFixture Insert (0.6ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:45:49', '2015-04-01 13:45:49', 980190962)
|
900
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:45:49', '2015-04-01 13:45:49', 298486374)[0m
|
901
|
+
[1m[35m (3.0ms)[0m commit transaction
|
902
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
903
|
+
---------------------------------------------
|
904
|
+
PostsControllerTest: test_should_render_table
|
905
|
+
---------------------------------------------
|
906
|
+
Processing by PostsController#index as HTML
|
907
|
+
Parameters: {"template"=>"render"}
|
908
|
+
[1m[35mPost Load (1.6ms)[0m SELECT "posts".* FROM "posts"
|
909
|
+
Rendered posts/render.html.erb within layouts/application (12.8ms)
|
910
|
+
Completed 200 OK in 124ms (Views: 121.8ms | ActiveRecord: 1.6ms)
|
911
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
912
|
+
[1m[35m (0.1ms)[0m begin transaction
|
913
|
+
-----------------------------------------------------------------------------------
|
914
|
+
PostsControllerTest: test_should_render_table_with_defaults_(set_in_application.rb)
|
915
|
+
-----------------------------------------------------------------------------------
|
916
|
+
Processing by PostsController#index as HTML
|
917
|
+
Parameters: {"template"=>"defaults"}
|
918
|
+
[1m[36mPost Load (1.6ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
919
|
+
Rendered posts/defaults.html.erb within layouts/application (3.5ms)
|
920
|
+
Completed 200 OK in 22ms (Views: 20.5ms | ActiveRecord: 1.6ms)
|
921
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
922
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.8ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
923
|
+
[1m[35m (0.1ms)[0m begin transaction
|
924
|
+
[1m[36mFixture Delete (2.5ms)[0m [1mDELETE FROM "posts"[0m
|
925
|
+
[1m[35mFixture Insert (0.7ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:49:05', '2015-04-01 13:49:05', 980190962)
|
926
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:49:05', '2015-04-01 13:49:05', 298486374)[0m
|
927
|
+
[1m[35m (3.6ms)[0m commit transaction
|
928
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
929
|
+
---------------------------------------------
|
930
|
+
PostsControllerTest: test_should_render_table
|
931
|
+
---------------------------------------------
|
932
|
+
Processing by PostsController#index as HTML
|
933
|
+
Parameters: {"template"=>"render"}
|
934
|
+
[1m[35mPost Load (1.7ms)[0m SELECT "posts".* FROM "posts"
|
935
|
+
Rendered posts/render.html.erb within layouts/application (13.1ms)
|
936
|
+
Completed 200 OK in 125ms (Views: 122.4ms | ActiveRecord: 1.7ms)
|
937
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
938
|
+
[1m[35m (0.2ms)[0m begin transaction
|
939
|
+
-----------------------------------------------------------------------------------
|
940
|
+
PostsControllerTest: test_should_render_table_with_defaults_(set_in_application.rb)
|
941
|
+
-----------------------------------------------------------------------------------
|
942
|
+
Processing by PostsController#index as HTML
|
943
|
+
Parameters: {"template"=>"defaults"}
|
944
|
+
[1m[36mPost Load (1.7ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
945
|
+
Rendered posts/defaults.html.erb within layouts/application (3.5ms)
|
946
|
+
Completed 200 OK in 21ms (Views: 18.8ms | ActiveRecord: 1.7ms)
|
947
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
948
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.5ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
949
|
+
[1m[35m (0.3ms)[0m begin transaction
|
950
|
+
[1m[36mFixture Delete (3.3ms)[0m [1mDELETE FROM "posts"[0m
|
951
|
+
[1m[35mFixture Insert (0.7ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:55:37', '2015-04-01 13:55:37', 980190962)
|
952
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 13:55:37', '2015-04-01 13:55:37', 298486374)[0m
|
953
|
+
[1m[35m (3.9ms)[0m commit transaction
|
954
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
955
|
+
-----------------------------------------------------------------------------------
|
956
|
+
PostsControllerTest: test_should_render_table_with_defaults_(set_in_application.rb)
|
957
|
+
-----------------------------------------------------------------------------------
|
958
|
+
Processing by PostsController#index as HTML
|
959
|
+
Parameters: {"template"=>"defaults"}
|
960
|
+
[1m[35mPost Load (1.6ms)[0m SELECT "posts".* FROM "posts"
|
961
|
+
Rendered posts/defaults.html.erb within layouts/application (13.2ms)
|
962
|
+
Completed 200 OK in 144ms (Views: 141.6ms | ActiveRecord: 1.6ms)
|
963
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
964
|
+
[1m[35m (0.1ms)[0m begin transaction
|
965
|
+
---------------------------------------------
|
966
|
+
PostsControllerTest: test_should_render_table
|
967
|
+
---------------------------------------------
|
968
|
+
Processing by PostsController#index as HTML
|
969
|
+
Parameters: {"template"=>"render"}
|
970
|
+
[1m[36mPost Load (1.7ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
971
|
+
Rendered posts/render.html.erb within layouts/application (3.6ms)
|
972
|
+
Completed 200 OK in 22ms (Views: 20.4ms | ActiveRecord: 1.7ms)
|
973
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
974
|
+
[1m[36mActiveRecord::SchemaMigration Load (1.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
975
|
+
[1m[35m (0.2ms)[0m begin transaction
|
976
|
+
[1m[36mFixture Delete (2.5ms)[0m [1mDELETE FROM "posts"[0m
|
977
|
+
[1m[35mFixture Insert (0.6ms)[0m INSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 14:07:36', '2015-04-01 14:07:36', 980190962)
|
978
|
+
[1m[36mFixture Insert (0.1ms)[0m [1mINSERT INTO "posts" ("title", "text", "created_at", "updated_at", "id") VALUES ('MyString', 'MyText', '2015-04-01 14:07:36', '2015-04-01 14:07:36', 298486374)[0m
|
979
|
+
[1m[35m (3.2ms)[0m commit transaction
|
980
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
981
|
+
---------------------------------------------
|
982
|
+
PostsControllerTest: test_should_render_table
|
983
|
+
---------------------------------------------
|
984
|
+
Processing by PostsController#index as HTML
|
985
|
+
Parameters: {"template"=>"render"}
|
986
|
+
[1m[35mPost Load (1.5ms)[0m SELECT "posts".* FROM "posts"
|
987
|
+
Rendered posts/render.html.erb within layouts/application (13.2ms)
|
988
|
+
Completed 200 OK in 123ms (Views: 120.6ms | ActiveRecord: 1.5ms)
|
989
|
+
[1m[36m (0.1ms)[0m [1mrollback transaction[0m
|
990
|
+
[1m[35m (0.3ms)[0m begin transaction
|
991
|
+
-----------------------------------------------------------------------------------
|
992
|
+
PostsControllerTest: test_should_render_table_with_defaults_(set_in_application.rb)
|
993
|
+
-----------------------------------------------------------------------------------
|
994
|
+
Processing by PostsController#index as HTML
|
995
|
+
Parameters: {"template"=>"defaults"}
|
996
|
+
[1m[36mPost Load (1.6ms)[0m [1mSELECT "posts".* FROM "posts"[0m
|
997
|
+
Rendered posts/defaults.html.erb within layouts/application (3.4ms)
|
998
|
+
Completed 200 OK in 25ms (Views: 23.1ms | ActiveRecord: 1.6ms)
|
999
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
@@ -21,13 +21,10 @@ class PostsControllerTest < ActionController::TestCase
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
test 'should render table with defaults' do
|
25
|
-
old_defaults = SimpleTableFor::Defaults.get
|
26
|
-
SimpleTableFor::Defaults.set({id: 'default-id', class: 'default-class'})
|
27
|
-
|
24
|
+
test 'should render table with defaults (set in application.rb)' do
|
28
25
|
get :index, template: :defaults
|
29
26
|
|
30
|
-
assert_select 'table
|
27
|
+
assert_select 'table.default-class' do
|
31
28
|
assert_select 'thead' do
|
32
29
|
assert_select 'tr' do
|
33
30
|
assert_select 'th'
|
@@ -40,7 +37,5 @@ class PostsControllerTest < ActionController::TestCase
|
|
40
37
|
end
|
41
38
|
end
|
42
39
|
end
|
43
|
-
|
44
|
-
SimpleTableFor::Defaults.set old_defaults
|
45
40
|
end
|
46
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_table_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Nering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -49,6 +49,9 @@ files:
|
|
49
49
|
- README.md
|
50
50
|
- Rakefile
|
51
51
|
- lib/simple_table_for.rb
|
52
|
+
- lib/simple_table_for/defaults.rb
|
53
|
+
- lib/simple_table_for/helpers.rb
|
54
|
+
- lib/simple_table_for/rails.rb
|
52
55
|
- lib/simple_table_for/version.rb
|
53
56
|
- lib/tasks/simple_table_for_tasks.rake
|
54
57
|
- test/dummy/README.rdoc
|