puffer_pages 0.1.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +3 -1
- data/.rvmrc +1 -1
- data/.travis.yml +13 -5
- data/CHANGELOG.md +130 -7
- data/Gemfile +10 -1
- data/README.md +18 -20
- data/Rakefile +1 -1
- data/app/assets/javascripts/puffer/codemirror.js +4237 -2223
- data/app/assets/javascripts/puffer/codemirror/css.js +359 -18
- data/app/assets/javascripts/puffer/codemirror/htmlmixed.js +15 -14
- data/app/assets/javascripts/puffer/codemirror/javascript.js +91 -29
- data/app/assets/javascripts/puffer/codemirror/liquid.js +185 -0
- data/app/assets/javascripts/puffer/codemirror/xml.js +99 -27
- data/app/assets/javascripts/puffer/codemirror/yaml.js +95 -0
- data/app/assets/javascripts/puffer/liquid.js +28 -12
- data/app/assets/javascripts/puffer/matchbrackets.js +63 -0
- data/app/assets/javascripts/puffer/multiplex.js +95 -0
- data/app/assets/javascripts/puffer/puffer_pages.js +140 -44
- data/app/assets/stylesheets/puffer/codemirror.css +203 -67
- data/app/assets/stylesheets/puffer/codemirror/ambiance-mobile.css +6 -0
- data/app/assets/stylesheets/puffer/codemirror/ambiance.css +76 -0
- data/app/assets/stylesheets/puffer/codemirror/blackboard.css +25 -0
- data/app/assets/stylesheets/puffer/codemirror/cobalt.css +4 -4
- data/app/assets/stylesheets/puffer/codemirror/eclipse.css +1 -1
- data/app/assets/stylesheets/puffer/codemirror/elegant.css +2 -2
- data/app/assets/stylesheets/puffer/codemirror/erlang-dark.css +21 -0
- data/app/assets/stylesheets/puffer/codemirror/lesser-dark.css +44 -0
- data/app/assets/stylesheets/puffer/codemirror/monokai.css +4 -4
- data/app/assets/stylesheets/puffer/codemirror/neat.css +3 -3
- data/app/assets/stylesheets/puffer/codemirror/night.css +4 -4
- data/app/assets/stylesheets/puffer/codemirror/rubyblue.css +5 -5
- data/app/assets/stylesheets/puffer/codemirror/solarized.css +207 -0
- data/app/assets/stylesheets/puffer/codemirror/twilight.css +26 -0
- data/app/assets/stylesheets/puffer/codemirror/vibrant-ink.css +27 -0
- data/app/assets/stylesheets/puffer/codemirror/xq-dark.css +46 -0
- data/app/assets/stylesheets/puffer/puffer_pages.css +64 -35
- data/app/components/codemirror/form.html.erb +22 -6
- data/app/components/codemirror_component.rb +1 -8
- data/app/components/handlers/form.html.erb +8 -0
- data/app/components/handlers_component.rb +8 -0
- data/app/components/page_parts/_page_part.html.erb +6 -0
- data/app/components/page_parts/form.html.erb +8 -27
- data/app/components/page_parts_component.rb +1 -3
- data/app/components/render/_tree_page.html.erb +3 -2
- data/app/controllers/admin/layouts_controller.rb +1 -1
- data/app/controllers/admin/origins_controller.rb +3 -0
- data/app/controllers/admin/pages_controller.rb +1 -1
- data/app/controllers/admin/snippets_controller.rb +1 -1
- data/app/controllers/pages_controller.rb +3 -3
- data/app/helpers/puffer_pages_helper.rb +3 -3
- data/app/models/puffer_pages/layout.rb +2 -7
- data/app/models/puffer_pages/origin.rb +2 -0
- data/app/models/puffer_pages/page.rb +1 -117
- data/app/models/puffer_pages/page_part.rb +2 -22
- data/app/models/puffer_pages/snippet.rb +2 -5
- data/config/routes.rb +3 -0
- data/db/migrate/20120812100913_create_origins.rb +16 -0
- data/db/migrate/20120924120226_migrate_to_uuid.rb +126 -0
- data/db/migrate/20130110144030_add_handler_to_page_parts.rb +9 -0
- data/db/migrate/20130118064524_add_locales_to_pages.rb +9 -0
- data/gemfiles/Gemfile.rails-3-1 +7 -0
- data/gemfiles/Gemfile.rails-3-2 +7 -0
- data/gemfiles/Gemfile.rails-head +7 -0
- data/lib/puffer_pages.rb +43 -7
- data/lib/puffer_pages/backends.rb +16 -0
- data/{app/controllers/puffer_pages → lib/puffer_pages/backends/controllers}/layouts_base.rb +2 -5
- data/lib/puffer_pages/backends/controllers/origins_base.rb +43 -0
- data/lib/puffer_pages/backends/controllers/pages_base.rb +52 -0
- data/{app/controllers/puffer_pages → lib/puffer_pages/backends/controllers}/snippets_base.rb +2 -5
- data/lib/puffer_pages/backends/models/layout.rb +34 -0
- data/lib/puffer_pages/backends/models/mixins/importable.rb +42 -0
- data/lib/puffer_pages/backends/models/mixins/localable.rb +65 -0
- data/lib/puffer_pages/backends/models/mixins/renderable.rb +153 -0
- data/lib/puffer_pages/backends/models/mixins/translatable.rb +52 -0
- data/lib/puffer_pages/backends/models/origin.rb +59 -0
- data/lib/puffer_pages/backends/models/page.rb +221 -0
- data/lib/puffer_pages/backends/models/page_part.rb +71 -0
- data/lib/puffer_pages/backends/models/snippet.rb +34 -0
- data/lib/puffer_pages/engine.rb +13 -2
- data/lib/puffer_pages/extensions/context.rb +31 -0
- data/lib/puffer_pages/extensions/core.rb +1 -8
- data/lib/puffer_pages/extensions/pagenator.rb +69 -0
- data/lib/puffer_pages/extensions/renderer.rb +31 -0
- data/lib/puffer_pages/globalize/migrator.rb +23 -0
- data/lib/puffer_pages/handlers.rb +29 -0
- data/lib/puffer_pages/handlers/base.rb +21 -0
- data/lib/puffer_pages/handlers/yaml.rb +20 -0
- data/lib/puffer_pages/helpers.rb +14 -0
- data/lib/puffer_pages/liquid/backend.rb +16 -0
- data/lib/puffer_pages/liquid/file_system.rb +36 -12
- data/lib/puffer_pages/liquid/page_drop.rb +26 -23
- data/lib/puffer_pages/liquid/tags/array.rb +39 -0
- data/lib/puffer_pages/liquid/tags/{javascripts.rb → assets.rb} +13 -4
- data/lib/puffer_pages/liquid/tags/helper.rb +15 -0
- data/lib/puffer_pages/liquid/tags/include.rb +32 -0
- data/lib/puffer_pages/liquid/tags/javascript.rb +15 -0
- data/lib/puffer_pages/liquid/tags/partials.rb +22 -0
- data/lib/puffer_pages/liquid/tags/render.rb +28 -0
- data/lib/puffer_pages/liquid/tags/scope.rb +31 -0
- data/lib/puffer_pages/liquid/tags/super.rb +36 -0
- data/lib/puffer_pages/liquid/tags/translate.rb +56 -0
- data/lib/puffer_pages/liquid/tags/url.rb +53 -0
- data/lib/puffer_pages/liquid/tags/yield.rb +3 -1
- data/lib/puffer_pages/log_subscriber.rb +29 -0
- data/lib/puffer_pages/migrations.rb +31 -0
- data/lib/puffer_pages/renderer.rb +25 -0
- data/lib/puffer_pages/rspec/matchers.rb +27 -0
- data/lib/puffer_pages/rspec/matchers/render_page.rb +90 -0
- data/lib/puffer_pages/version.rb +1 -1
- data/puffer_pages.gemspec +18 -18
- data/spec/controllers/pages_controller_spec.rb +44 -0
- data/spec/controllers/puffer_pages_controller_spec.rb +194 -0
- data/spec/data/broken.json +8 -0
- data/spec/data/import.json +55 -0
- data/spec/data/localized.json +106 -0
- data/spec/data/unlocalized.json +82 -0
- data/spec/dummy/.rvmrc +1 -0
- data/spec/dummy/app/controllers/application_controller.rb +6 -0
- data/spec/dummy/app/views/layouts/sample.en.erb +1 -0
- data/spec/dummy/app/views/layouts/sample.ru.erb +1 -0
- data/spec/dummy/app/views/shared/_first.html.erb +1 -0
- data/spec/dummy/config/application.rb +21 -2
- data/spec/dummy/config/boot.rb +0 -2
- data/spec/dummy/config/database.yml +7 -1
- data/spec/dummy/config/environments/development.rb +11 -2
- data/spec/dummy/config/environments/pg_test.rb +6 -6
- data/spec/dummy/config/environments/production.rb +19 -3
- data/spec/dummy/config/environments/test.rb +6 -6
- data/spec/dummy/config/initializers/inflections.rb +5 -0
- data/spec/dummy/config/initializers/puffer_pages.rb +4 -0
- data/spec/dummy/config/initializers/secret_token.rb +1 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +5 -3
- data/spec/dummy/config/routes.rb +2 -1
- data/spec/dummy/db/migrate/{20090422092419_create_pages.rb → 20130118071511_create_pages.rb} +1 -0
- data/spec/dummy/db/migrate/{20090504132337_create_page_parts.rb → 20130118071512_create_page_parts.rb} +1 -0
- data/spec/dummy/db/migrate/{20090506102004_create_layouts.rb → 20130118071513_create_layouts.rb} +1 -0
- data/spec/dummy/db/migrate/{20090510121824_create_snippets.rb → 20130118071514_create_snippets.rb} +1 -0
- data/spec/dummy/db/migrate/20130118071515_create_origins.rb +17 -0
- data/spec/dummy/db/migrate/20130118071516_migrate_to_uuid.rb +127 -0
- data/spec/dummy/db/migrate/20130118071517_add_handler_to_page_parts.rb +10 -0
- data/spec/dummy/db/migrate/20130118071518_add_locales_to_pages.rb +10 -0
- data/spec/dummy/db/migrate/20130118071519_add_translations.rb +9 -0
- data/spec/dummy/db/schema.rb +65 -17
- data/spec/fabricators/articles_fabricator.rb +2 -2
- data/spec/fabricators/layouts_fabricator.rb +24 -3
- data/spec/fabricators/origin_fabricator.rb +5 -0
- data/spec/fabricators/page_parts_fabricator.rb +17 -2
- data/spec/fabricators/pages_fabricator.rb +20 -5
- data/spec/fabricators/snippets_fabricator.rb +14 -3
- data/spec/lib/handlers/base_spec.rb +10 -0
- data/spec/lib/handlers/yaml_spec.rb +34 -0
- data/spec/lib/handlers_spec.rb +36 -0
- data/spec/lib/liquid/backend_spec.rb +20 -0
- data/spec/lib/liquid/interpolation_spec.rb +25 -0
- data/spec/lib/liquid/tags/include_spec.rb +38 -0
- data/spec/lib/liquid/tags/partials_spec.rb +39 -0
- data/spec/lib/liquid/tags/scope_spec.rb +18 -0
- data/spec/lib/liquid/tags/translate_spec.rb +107 -0
- data/spec/lib/liquid/tags_spec.rb +81 -0
- data/spec/lib/page_drop_spec.rb +65 -0
- data/spec/lib/pagenator_spec.rb +176 -0
- data/spec/lib/rspec/matchers/render_page_spec.rb +107 -0
- data/spec/models/puffer_pages/layout_spec.rb +15 -0
- data/spec/models/puffer_pages/localable_spec.rb +62 -0
- data/spec/models/puffer_pages/origin_spec.rb +112 -0
- data/spec/models/puffer_pages/page_part_spec.rb +14 -0
- data/spec/models/puffer_pages/page_spec.rb +307 -0
- data/spec/models/puffer_pages/renderable_spec.rb +84 -0
- data/spec/models/puffer_pages/snippet_spec.rb +15 -0
- data/spec/requests/origins_requests_spec.rb +37 -0
- data/spec/spec_helper.rb +7 -6
- metadata +349 -87
- data/Gemfile.lock +0 -176
- data/app/assets/javascripts/puffer/overlay.js +0 -51
- data/app/controllers/puffer_pages/pages_base.rb +0 -38
- data/app/models/layout.rb +0 -2
- data/app/models/page.rb +0 -2
- data/app/models/page_part.rb +0 -2
- data/app/models/snippet.rb +0 -2
- data/app/views/layouts/puffer_pages_layout.html.erb +0 -2
- data/config/puffer_routes.rb +0 -3
- data/gemfiles/Gemfile-rails-3.1 +0 -5
- data/gemfiles/Gemfile-rails-3.1.lock +0 -173
- data/gemfiles/Gemfile-rails-3.2 +0 -5
- data/gemfiles/Gemfile-rails-3.2.lock +0 -171
- data/lib/puffer_pages/extensions/controller.rb +0 -30
- data/lib/puffer_pages/extensions/mapper.rb +0 -23
- data/lib/puffer_pages/liquid/tags/page_attribute.rb +0 -39
- data/lib/puffer_pages/liquid/tags/stylesheets.rb +0 -38
- data/spec/controllers/articles_controller_spec.rb +0 -65
- data/spec/dummy/app/controllers/articles_controller.rb +0 -9
- data/spec/integration/navigation_spec.rb +0 -9
- data/spec/lib/drops_spec.rb +0 -55
- data/spec/lib/tags_spec.rb +0 -98
- data/spec/models/page_spec.rb +0 -235
- data/spec/puffer_pages_spec.rb +0 -7
@@ -0,0 +1,106 @@
|
|
1
|
+
{
|
2
|
+
"layouts": [{
|
3
|
+
"created_at": "2013-12-23T16:23:00Z",
|
4
|
+
"id": "404DF5860F01492EB470711FE3BE4535",
|
5
|
+
"name": "application",
|
6
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
7
|
+
"body_translations": {
|
8
|
+
"en": "Nulla suscipit ligula in lacus.",
|
9
|
+
"ru": "Morbi ut odio.",
|
10
|
+
"cn": "Donec ut mauris eget massa tempor convallis."
|
11
|
+
}
|
12
|
+
}],
|
13
|
+
"snippets": [{
|
14
|
+
"created_at": "2013-12-23T16:23:00Z",
|
15
|
+
"id": "C647D698E0D64A99BC8AA0C0A0F0BAEF",
|
16
|
+
"name": "lacus",
|
17
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
18
|
+
"body_translations": {
|
19
|
+
"en": "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla dapibus dolor vel est.",
|
20
|
+
"ru": "Curabitur gravida nisi at nibh.",
|
21
|
+
"cn": "Nam nulla."
|
22
|
+
}
|
23
|
+
}],
|
24
|
+
"pages": [{
|
25
|
+
"created_at": "2013-12-23T16:23:00Z",
|
26
|
+
"id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
|
27
|
+
"layout_name": "application",
|
28
|
+
"locales": {},
|
29
|
+
"name": "Nunc nisl.",
|
30
|
+
"parent_id": null,
|
31
|
+
"slug": null,
|
32
|
+
"status": "published",
|
33
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
34
|
+
"page_parts": [{
|
35
|
+
"created_at": "2013-12-23T16:23:00Z",
|
36
|
+
"handler": "html",
|
37
|
+
"id": "A0C54DBB446D4727903A2B6FA5D4C9E2",
|
38
|
+
"name": "body",
|
39
|
+
"page_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
|
40
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
41
|
+
"body_translations": {
|
42
|
+
"en": "PagePart: `body`, Page: ``",
|
43
|
+
"ru": "Nulla neque libero, convallis eget, eleifend luctus, ultricies eu, nibh.",
|
44
|
+
"cn": "Fusce posuere felis sed lacus."
|
45
|
+
}
|
46
|
+
}, {
|
47
|
+
"created_at": "2013-12-23T16:23:00Z",
|
48
|
+
"handler": "html",
|
49
|
+
"id": "EA1DE54674D1430894134AA9FDB603F3",
|
50
|
+
"name": "sidebar",
|
51
|
+
"page_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
|
52
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
53
|
+
"body_translations": {
|
54
|
+
"en": "PagePart: `sidebar`, Page: ``",
|
55
|
+
"ru": "Mauris enim leo, rhoncus sed, vestibulum sit amet, cursus id, turpis.",
|
56
|
+
"cn": "Vivamus vel nulla eget eros elementum pellentesque."
|
57
|
+
}
|
58
|
+
}]
|
59
|
+
}, {
|
60
|
+
"created_at": "2013-12-23T16:23:00Z",
|
61
|
+
"id": "58C3B16335C242E8B231E2B634D1B7EA",
|
62
|
+
"layout_name": null,
|
63
|
+
"locales": {},
|
64
|
+
"name": "Morbi non quam nec dui luctus rutrum.",
|
65
|
+
"parent_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
|
66
|
+
"slug": "first",
|
67
|
+
"status": "published",
|
68
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
69
|
+
"page_parts": [{
|
70
|
+
"created_at": "2013-12-23T16:23:00Z",
|
71
|
+
"handler": "html",
|
72
|
+
"id": "A0BC46E472FC45CB8C57F068685DEA3D",
|
73
|
+
"name": "body",
|
74
|
+
"page_id": "58C3B16335C242E8B231E2B634D1B7EA",
|
75
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
76
|
+
"body_translations": {
|
77
|
+
"en": "PagePart: `body`, Page: `first`",
|
78
|
+
"ru": "Nam ultrices, libero non mattis pulvinar, nulla pede ullamcorper augue, a suscipit nulla elit ac nulla.",
|
79
|
+
"cn": "Etiam justo."
|
80
|
+
}
|
81
|
+
}]
|
82
|
+
}, {
|
83
|
+
"created_at": "2013-12-23T16:23:00Z",
|
84
|
+
"id": "C8D5E74CE293403DAB5FBB5A89BDE6C5",
|
85
|
+
"layout_name": null,
|
86
|
+
"locales": {},
|
87
|
+
"name": "Donec dapibus.",
|
88
|
+
"parent_id": "58C3B16335C242E8B231E2B634D1B7EA",
|
89
|
+
"slug": "second",
|
90
|
+
"status": "published",
|
91
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
92
|
+
"page_parts": [{
|
93
|
+
"created_at": "2013-12-23T16:23:00Z",
|
94
|
+
"handler": "html",
|
95
|
+
"id": "504F931E6E8C495699BA5D4C9D1FAD06",
|
96
|
+
"name": "sidebar",
|
97
|
+
"page_id": "C8D5E74CE293403DAB5FBB5A89BDE6C5",
|
98
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
99
|
+
"body_translations": {
|
100
|
+
"en": "PagePart: `sidebar`, Page: `first/second`",
|
101
|
+
"ru": "Vivamus in felis eu sapien cursus vestibulum.",
|
102
|
+
"cn": "Aenean sit amet justo."
|
103
|
+
}
|
104
|
+
}]
|
105
|
+
}]
|
106
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
{
|
2
|
+
"layouts": [{
|
3
|
+
"created_at": "2013-12-23T16:23:00Z",
|
4
|
+
"id": "404DF5860F01492EB470711FE3BE4535",
|
5
|
+
"name": "application",
|
6
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
7
|
+
"body": "Nulla suscipit ligula in lacus."
|
8
|
+
}],
|
9
|
+
"snippets": [{
|
10
|
+
"created_at": "2013-12-23T16:23:00Z",
|
11
|
+
"id": "C647D698E0D64A99BC8AA0C0A0F0BAEF",
|
12
|
+
"name": "lacus",
|
13
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
14
|
+
"body": "Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nulla dapibus dolor vel est."
|
15
|
+
}],
|
16
|
+
"pages": [{
|
17
|
+
"created_at": "2013-12-23T16:23:00Z",
|
18
|
+
"id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
|
19
|
+
"layout_name": "application",
|
20
|
+
"locales": {},
|
21
|
+
"name": "Nunc nisl.",
|
22
|
+
"parent_id": null,
|
23
|
+
"slug": null,
|
24
|
+
"status": "published",
|
25
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
26
|
+
"page_parts": [{
|
27
|
+
"created_at": "2013-12-23T16:23:00Z",
|
28
|
+
"handler": "html",
|
29
|
+
"id": "A0C54DBB446D4727903A2B6FA5D4C9E2",
|
30
|
+
"name": "body",
|
31
|
+
"page_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
|
32
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
33
|
+
"body": "PagePart: `body`, Page: ``"
|
34
|
+
}, {
|
35
|
+
"created_at": "2013-12-23T16:23:00Z",
|
36
|
+
"handler": "html",
|
37
|
+
"id": "EA1DE54674D1430894134AA9FDB603F3",
|
38
|
+
"name": "sidebar",
|
39
|
+
"page_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
|
40
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
41
|
+
"body": "PagePart: `sidebar`, Page: ``"
|
42
|
+
}]
|
43
|
+
}, {
|
44
|
+
"created_at": "2013-12-23T16:23:00Z",
|
45
|
+
"id": "58C3B16335C242E8B231E2B634D1B7EA",
|
46
|
+
"layout_name": null,
|
47
|
+
"locales": {},
|
48
|
+
"name": "Morbi non quam nec dui luctus rutrum.",
|
49
|
+
"parent_id": "55E458FCA2BB4BA0B95AE99ACDDAF094",
|
50
|
+
"slug": "first",
|
51
|
+
"status": "published",
|
52
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
53
|
+
"page_parts": [{
|
54
|
+
"created_at": "2013-12-23T16:23:00Z",
|
55
|
+
"handler": "html",
|
56
|
+
"id": "A0BC46E472FC45CB8C57F068685DEA3D",
|
57
|
+
"name": "body",
|
58
|
+
"page_id": "58C3B16335C242E8B231E2B634D1B7EA",
|
59
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
60
|
+
"body": "PagePart: `body`, Page: `first`"
|
61
|
+
}]
|
62
|
+
}, {
|
63
|
+
"created_at": "2013-12-23T16:23:00Z",
|
64
|
+
"id": "C8D5E74CE293403DAB5FBB5A89BDE6C5",
|
65
|
+
"layout_name": null,
|
66
|
+
"locales": {},
|
67
|
+
"name": "Donec dapibus.",
|
68
|
+
"parent_id": "58C3B16335C242E8B231E2B634D1B7EA",
|
69
|
+
"slug": "second",
|
70
|
+
"status": "published",
|
71
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
72
|
+
"page_parts": [{
|
73
|
+
"created_at": "2013-12-23T16:23:00Z",
|
74
|
+
"handler": "html",
|
75
|
+
"id": "504F931E6E8C495699BA5D4C9D1FAD06",
|
76
|
+
"name": "sidebar",
|
77
|
+
"page_id": "C8D5E74CE293403DAB5FBB5A89BDE6C5",
|
78
|
+
"updated_at": "2013-12-23T16:23:00Z",
|
79
|
+
"body": "PagePart: `sidebar`, Page: `first/second`"
|
80
|
+
}]
|
81
|
+
}]
|
82
|
+
}
|
data/spec/dummy/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.3@puffer_pages --create
|
@@ -1,6 +1,12 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
protect_from_forgery
|
3
3
|
|
4
|
+
around_filter :locale_context
|
5
|
+
|
6
|
+
def locale_context &block
|
7
|
+
params[:locale].present? ? I18n.with_locale(params[:locale], &block) : block.call
|
8
|
+
end
|
9
|
+
|
4
10
|
def has_puffer_access? namespace
|
5
11
|
true
|
6
12
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
sample.en.erb
|
@@ -0,0 +1 @@
|
|
1
|
+
sample.ru.erb
|
@@ -0,0 +1 @@
|
|
1
|
+
shared/first content
|
@@ -2,7 +2,8 @@ require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
|
-
Bundler.require
|
5
|
+
Bundler.require :development
|
6
|
+
|
6
7
|
require "puffer_pages"
|
7
8
|
|
8
9
|
module Dummy
|
@@ -27,7 +28,9 @@ module Dummy
|
|
27
28
|
|
28
29
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
29
30
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
30
|
-
|
31
|
+
config.i18n.default_locale = :en
|
32
|
+
config.i18n.available_locales = [:ru, :en, :cn]
|
33
|
+
config.i18n.fallbacks = true
|
31
34
|
|
32
35
|
# Configure the default encoding used in templates for Ruby 1.9.
|
33
36
|
config.encoding = "utf-8"
|
@@ -35,7 +38,23 @@ module Dummy
|
|
35
38
|
# Configure sensitive parameters which will be filtered from the log file.
|
36
39
|
config.filter_parameters += [:password]
|
37
40
|
|
41
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
42
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
43
|
+
# like if you have constraints or database-specific column types
|
44
|
+
# config.active_record.schema_format = :sql
|
45
|
+
|
46
|
+
# Enforce whitelist mode for mass assignment.
|
47
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
48
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
49
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
50
|
+
# config.active_record.whitelist_attributes = true
|
51
|
+
|
38
52
|
# Enable the asset pipeline
|
39
53
|
config.assets.enabled = true
|
54
|
+
|
55
|
+
# Version of your assets, change this if you want to expire all your assets
|
56
|
+
config.assets.version = '1.0'
|
57
|
+
|
58
|
+
config.puffer_pages.raise_errors = true
|
40
59
|
end
|
41
60
|
end
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -6,12 +6,18 @@ development:
|
|
6
6
|
pool: 5
|
7
7
|
timeout: 5000
|
8
8
|
|
9
|
+
# development:
|
10
|
+
# adapter: mysql2
|
11
|
+
# database: puffer_pages_development
|
12
|
+
# usename: root
|
13
|
+
# encoding: utf8
|
14
|
+
|
9
15
|
# Warning: The database defined as "test" will be erased and
|
10
16
|
# re-generated from your development database when you run "rake".
|
11
17
|
# Do not set this db to the same as development or production.
|
12
18
|
test:
|
13
19
|
adapter: sqlite3
|
14
|
-
database:
|
20
|
+
database: ":memory:"
|
15
21
|
pool: 5
|
16
22
|
timeout: 5000
|
17
23
|
|
@@ -2,7 +2,7 @@ Dummy::Application.configure do
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
5
|
-
# every request.
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
7
7
|
config.cache_classes = false
|
8
8
|
|
@@ -22,9 +22,18 @@ Dummy::Application.configure do
|
|
22
22
|
# Only use best-standards-support built into browsers
|
23
23
|
config.action_dispatch.best_standards_support = :builtin
|
24
24
|
|
25
|
+
# Raise exception on mass assignment protection for Active Record models
|
26
|
+
# config.active_record.mass_assignment_sanitizer = :strict
|
27
|
+
|
28
|
+
# Log the query plan for queries taking more than this (works
|
29
|
+
# with SQLite, MySQL, and PostgreSQL)
|
30
|
+
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
31
|
+
|
25
32
|
# Do not compress assets
|
26
33
|
config.assets.compress = false
|
27
34
|
|
28
35
|
# Expands the lines which load the assets
|
29
|
-
config.assets.debug =
|
36
|
+
config.assets.debug = false
|
37
|
+
|
38
|
+
config.puffer_pages.raise_errors = true
|
30
39
|
end
|
@@ -2,9 +2,9 @@ Dummy::Application.configure do
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite.
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
6
|
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs.
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
@@ -29,11 +29,11 @@ Dummy::Application.configure do
|
|
29
29
|
# ActionMailer::Base.deliveries array.
|
30
30
|
config.action_mailer.delivery_method = :test
|
31
31
|
|
32
|
-
#
|
33
|
-
#
|
34
|
-
# like if you have constraints or database-specific column types
|
35
|
-
# config.active_record.schema_format = :sql
|
32
|
+
# Raise exception on mass assignment protection for Active Record models
|
33
|
+
# config.active_record.mass_assignment_sanitizer = :strict
|
36
34
|
|
37
35
|
# Print deprecation notices to the stderr
|
38
36
|
config.active_support.deprecation = :stderr
|
37
|
+
|
38
|
+
config.puffer_pages.raise_errors = true
|
39
39
|
end
|
@@ -14,9 +14,18 @@ Dummy::Application.configure do
|
|
14
14
|
# Compress JavaScripts and CSS
|
15
15
|
config.assets.compress = true
|
16
16
|
|
17
|
+
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
+
config.assets.compile = false
|
19
|
+
|
20
|
+
# Generate digests for assets URLs
|
21
|
+
config.assets.digest = true
|
22
|
+
|
23
|
+
# Defaults to Rails.root.join("public/assets")
|
24
|
+
# config.assets.manifest = YOUR_PATH
|
25
|
+
|
17
26
|
# Specifies the header that your server uses for sending files
|
18
|
-
#
|
19
|
-
config.action_dispatch.x_sendfile_header =
|
27
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
28
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
20
29
|
|
21
30
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
22
31
|
# config.force_ssl = true
|
@@ -24,8 +33,11 @@ Dummy::Application.configure do
|
|
24
33
|
# See everything in the log (default is :info)
|
25
34
|
# config.log_level = :debug
|
26
35
|
|
36
|
+
# Prepend all log lines with the following tags
|
37
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
38
|
+
|
27
39
|
# Use a different logger for distributed setups
|
28
|
-
# config.logger = SyslogLogger.new
|
40
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
29
41
|
|
30
42
|
# Use a different cache store in production
|
31
43
|
# config.cache_store = :mem_cache_store
|
@@ -48,4 +60,8 @@ Dummy::Application.configure do
|
|
48
60
|
|
49
61
|
# Send deprecation notices to registered listeners
|
50
62
|
config.active_support.deprecation = :notify
|
63
|
+
|
64
|
+
# Log the query plan for queries taking more than this (works
|
65
|
+
# with SQLite, MySQL, and PostgreSQL)
|
66
|
+
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
51
67
|
end
|
@@ -2,9 +2,9 @@ Dummy::Application.configure do
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite.
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
6
|
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs.
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
@@ -29,11 +29,11 @@ Dummy::Application.configure do
|
|
29
29
|
# ActionMailer::Base.deliveries array.
|
30
30
|
config.action_mailer.delivery_method = :test
|
31
31
|
|
32
|
-
#
|
33
|
-
#
|
34
|
-
# like if you have constraints or database-specific column types
|
35
|
-
# config.active_record.schema_format = :sql
|
32
|
+
# Raise exception on mass assignment protection for Active Record models
|
33
|
+
# config.active_record.mass_assignment_sanitizer = :strict
|
36
34
|
|
37
35
|
# Print deprecation notices to the stderr
|
38
36
|
config.active_support.deprecation = :stderr
|
37
|
+
|
38
|
+
config.puffer_pages.raise_errors = true
|
39
39
|
end
|
@@ -4,4 +4,4 @@
|
|
4
4
|
# If you change this key, all old signed cookies will become invalid!
|
5
5
|
# Make sure the secret is at least 30 characters and all random,
|
6
6
|
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
-
Dummy::Application.config.secret_token = '
|
7
|
+
Dummy::Application.config.secret_token = '8cf6d9f23949d20957da43a2b5b54c77d84a52592120f14e54969949efef0508ad8cb263ce3949a78ebff63b3143b237e26bc2d147609f831dc57204cecd2561'
|
@@ -4,9 +4,11 @@
|
|
4
4
|
# is enabled by default.
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json]
|
9
|
+
end
|
8
10
|
|
9
11
|
# Disable root element in JSON by default.
|
10
|
-
|
11
|
-
|
12
|
+
ActiveSupport.on_load(:active_record) do
|
13
|
+
self.include_root_in_json = false
|
12
14
|
end
|