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.
Files changed (197) hide show
  1. data/.gitignore +5 -0
  2. data/.rspec +3 -1
  3. data/.rvmrc +1 -1
  4. data/.travis.yml +13 -5
  5. data/CHANGELOG.md +130 -7
  6. data/Gemfile +10 -1
  7. data/README.md +18 -20
  8. data/Rakefile +1 -1
  9. data/app/assets/javascripts/puffer/codemirror.js +4237 -2223
  10. data/app/assets/javascripts/puffer/codemirror/css.js +359 -18
  11. data/app/assets/javascripts/puffer/codemirror/htmlmixed.js +15 -14
  12. data/app/assets/javascripts/puffer/codemirror/javascript.js +91 -29
  13. data/app/assets/javascripts/puffer/codemirror/liquid.js +185 -0
  14. data/app/assets/javascripts/puffer/codemirror/xml.js +99 -27
  15. data/app/assets/javascripts/puffer/codemirror/yaml.js +95 -0
  16. data/app/assets/javascripts/puffer/liquid.js +28 -12
  17. data/app/assets/javascripts/puffer/matchbrackets.js +63 -0
  18. data/app/assets/javascripts/puffer/multiplex.js +95 -0
  19. data/app/assets/javascripts/puffer/puffer_pages.js +140 -44
  20. data/app/assets/stylesheets/puffer/codemirror.css +203 -67
  21. data/app/assets/stylesheets/puffer/codemirror/ambiance-mobile.css +6 -0
  22. data/app/assets/stylesheets/puffer/codemirror/ambiance.css +76 -0
  23. data/app/assets/stylesheets/puffer/codemirror/blackboard.css +25 -0
  24. data/app/assets/stylesheets/puffer/codemirror/cobalt.css +4 -4
  25. data/app/assets/stylesheets/puffer/codemirror/eclipse.css +1 -1
  26. data/app/assets/stylesheets/puffer/codemirror/elegant.css +2 -2
  27. data/app/assets/stylesheets/puffer/codemirror/erlang-dark.css +21 -0
  28. data/app/assets/stylesheets/puffer/codemirror/lesser-dark.css +44 -0
  29. data/app/assets/stylesheets/puffer/codemirror/monokai.css +4 -4
  30. data/app/assets/stylesheets/puffer/codemirror/neat.css +3 -3
  31. data/app/assets/stylesheets/puffer/codemirror/night.css +4 -4
  32. data/app/assets/stylesheets/puffer/codemirror/rubyblue.css +5 -5
  33. data/app/assets/stylesheets/puffer/codemirror/solarized.css +207 -0
  34. data/app/assets/stylesheets/puffer/codemirror/twilight.css +26 -0
  35. data/app/assets/stylesheets/puffer/codemirror/vibrant-ink.css +27 -0
  36. data/app/assets/stylesheets/puffer/codemirror/xq-dark.css +46 -0
  37. data/app/assets/stylesheets/puffer/puffer_pages.css +64 -35
  38. data/app/components/codemirror/form.html.erb +22 -6
  39. data/app/components/codemirror_component.rb +1 -8
  40. data/app/components/handlers/form.html.erb +8 -0
  41. data/app/components/handlers_component.rb +8 -0
  42. data/app/components/page_parts/_page_part.html.erb +6 -0
  43. data/app/components/page_parts/form.html.erb +8 -27
  44. data/app/components/page_parts_component.rb +1 -3
  45. data/app/components/render/_tree_page.html.erb +3 -2
  46. data/app/controllers/admin/layouts_controller.rb +1 -1
  47. data/app/controllers/admin/origins_controller.rb +3 -0
  48. data/app/controllers/admin/pages_controller.rb +1 -1
  49. data/app/controllers/admin/snippets_controller.rb +1 -1
  50. data/app/controllers/pages_controller.rb +3 -3
  51. data/app/helpers/puffer_pages_helper.rb +3 -3
  52. data/app/models/puffer_pages/layout.rb +2 -7
  53. data/app/models/puffer_pages/origin.rb +2 -0
  54. data/app/models/puffer_pages/page.rb +1 -117
  55. data/app/models/puffer_pages/page_part.rb +2 -22
  56. data/app/models/puffer_pages/snippet.rb +2 -5
  57. data/config/routes.rb +3 -0
  58. data/db/migrate/20120812100913_create_origins.rb +16 -0
  59. data/db/migrate/20120924120226_migrate_to_uuid.rb +126 -0
  60. data/db/migrate/20130110144030_add_handler_to_page_parts.rb +9 -0
  61. data/db/migrate/20130118064524_add_locales_to_pages.rb +9 -0
  62. data/gemfiles/Gemfile.rails-3-1 +7 -0
  63. data/gemfiles/Gemfile.rails-3-2 +7 -0
  64. data/gemfiles/Gemfile.rails-head +7 -0
  65. data/lib/puffer_pages.rb +43 -7
  66. data/lib/puffer_pages/backends.rb +16 -0
  67. data/{app/controllers/puffer_pages → lib/puffer_pages/backends/controllers}/layouts_base.rb +2 -5
  68. data/lib/puffer_pages/backends/controllers/origins_base.rb +43 -0
  69. data/lib/puffer_pages/backends/controllers/pages_base.rb +52 -0
  70. data/{app/controllers/puffer_pages → lib/puffer_pages/backends/controllers}/snippets_base.rb +2 -5
  71. data/lib/puffer_pages/backends/models/layout.rb +34 -0
  72. data/lib/puffer_pages/backends/models/mixins/importable.rb +42 -0
  73. data/lib/puffer_pages/backends/models/mixins/localable.rb +65 -0
  74. data/lib/puffer_pages/backends/models/mixins/renderable.rb +153 -0
  75. data/lib/puffer_pages/backends/models/mixins/translatable.rb +52 -0
  76. data/lib/puffer_pages/backends/models/origin.rb +59 -0
  77. data/lib/puffer_pages/backends/models/page.rb +221 -0
  78. data/lib/puffer_pages/backends/models/page_part.rb +71 -0
  79. data/lib/puffer_pages/backends/models/snippet.rb +34 -0
  80. data/lib/puffer_pages/engine.rb +13 -2
  81. data/lib/puffer_pages/extensions/context.rb +31 -0
  82. data/lib/puffer_pages/extensions/core.rb +1 -8
  83. data/lib/puffer_pages/extensions/pagenator.rb +69 -0
  84. data/lib/puffer_pages/extensions/renderer.rb +31 -0
  85. data/lib/puffer_pages/globalize/migrator.rb +23 -0
  86. data/lib/puffer_pages/handlers.rb +29 -0
  87. data/lib/puffer_pages/handlers/base.rb +21 -0
  88. data/lib/puffer_pages/handlers/yaml.rb +20 -0
  89. data/lib/puffer_pages/helpers.rb +14 -0
  90. data/lib/puffer_pages/liquid/backend.rb +16 -0
  91. data/lib/puffer_pages/liquid/file_system.rb +36 -12
  92. data/lib/puffer_pages/liquid/page_drop.rb +26 -23
  93. data/lib/puffer_pages/liquid/tags/array.rb +39 -0
  94. data/lib/puffer_pages/liquid/tags/{javascripts.rb → assets.rb} +13 -4
  95. data/lib/puffer_pages/liquid/tags/helper.rb +15 -0
  96. data/lib/puffer_pages/liquid/tags/include.rb +32 -0
  97. data/lib/puffer_pages/liquid/tags/javascript.rb +15 -0
  98. data/lib/puffer_pages/liquid/tags/partials.rb +22 -0
  99. data/lib/puffer_pages/liquid/tags/render.rb +28 -0
  100. data/lib/puffer_pages/liquid/tags/scope.rb +31 -0
  101. data/lib/puffer_pages/liquid/tags/super.rb +36 -0
  102. data/lib/puffer_pages/liquid/tags/translate.rb +56 -0
  103. data/lib/puffer_pages/liquid/tags/url.rb +53 -0
  104. data/lib/puffer_pages/liquid/tags/yield.rb +3 -1
  105. data/lib/puffer_pages/log_subscriber.rb +29 -0
  106. data/lib/puffer_pages/migrations.rb +31 -0
  107. data/lib/puffer_pages/renderer.rb +25 -0
  108. data/lib/puffer_pages/rspec/matchers.rb +27 -0
  109. data/lib/puffer_pages/rspec/matchers/render_page.rb +90 -0
  110. data/lib/puffer_pages/version.rb +1 -1
  111. data/puffer_pages.gemspec +18 -18
  112. data/spec/controllers/pages_controller_spec.rb +44 -0
  113. data/spec/controllers/puffer_pages_controller_spec.rb +194 -0
  114. data/spec/data/broken.json +8 -0
  115. data/spec/data/import.json +55 -0
  116. data/spec/data/localized.json +106 -0
  117. data/spec/data/unlocalized.json +82 -0
  118. data/spec/dummy/.rvmrc +1 -0
  119. data/spec/dummy/app/controllers/application_controller.rb +6 -0
  120. data/spec/dummy/app/views/layouts/sample.en.erb +1 -0
  121. data/spec/dummy/app/views/layouts/sample.ru.erb +1 -0
  122. data/spec/dummy/app/views/shared/_first.html.erb +1 -0
  123. data/spec/dummy/config/application.rb +21 -2
  124. data/spec/dummy/config/boot.rb +0 -2
  125. data/spec/dummy/config/database.yml +7 -1
  126. data/spec/dummy/config/environments/development.rb +11 -2
  127. data/spec/dummy/config/environments/pg_test.rb +6 -6
  128. data/spec/dummy/config/environments/production.rb +19 -3
  129. data/spec/dummy/config/environments/test.rb +6 -6
  130. data/spec/dummy/config/initializers/inflections.rb +5 -0
  131. data/spec/dummy/config/initializers/puffer_pages.rb +4 -0
  132. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  133. data/spec/dummy/config/initializers/wrap_parameters.rb +5 -3
  134. data/spec/dummy/config/routes.rb +2 -1
  135. data/spec/dummy/db/migrate/{20090422092419_create_pages.rb → 20130118071511_create_pages.rb} +1 -0
  136. data/spec/dummy/db/migrate/{20090504132337_create_page_parts.rb → 20130118071512_create_page_parts.rb} +1 -0
  137. data/spec/dummy/db/migrate/{20090506102004_create_layouts.rb → 20130118071513_create_layouts.rb} +1 -0
  138. data/spec/dummy/db/migrate/{20090510121824_create_snippets.rb → 20130118071514_create_snippets.rb} +1 -0
  139. data/spec/dummy/db/migrate/20130118071515_create_origins.rb +17 -0
  140. data/spec/dummy/db/migrate/20130118071516_migrate_to_uuid.rb +127 -0
  141. data/spec/dummy/db/migrate/20130118071517_add_handler_to_page_parts.rb +10 -0
  142. data/spec/dummy/db/migrate/20130118071518_add_locales_to_pages.rb +10 -0
  143. data/spec/dummy/db/migrate/20130118071519_add_translations.rb +9 -0
  144. data/spec/dummy/db/schema.rb +65 -17
  145. data/spec/fabricators/articles_fabricator.rb +2 -2
  146. data/spec/fabricators/layouts_fabricator.rb +24 -3
  147. data/spec/fabricators/origin_fabricator.rb +5 -0
  148. data/spec/fabricators/page_parts_fabricator.rb +17 -2
  149. data/spec/fabricators/pages_fabricator.rb +20 -5
  150. data/spec/fabricators/snippets_fabricator.rb +14 -3
  151. data/spec/lib/handlers/base_spec.rb +10 -0
  152. data/spec/lib/handlers/yaml_spec.rb +34 -0
  153. data/spec/lib/handlers_spec.rb +36 -0
  154. data/spec/lib/liquid/backend_spec.rb +20 -0
  155. data/spec/lib/liquid/interpolation_spec.rb +25 -0
  156. data/spec/lib/liquid/tags/include_spec.rb +38 -0
  157. data/spec/lib/liquid/tags/partials_spec.rb +39 -0
  158. data/spec/lib/liquid/tags/scope_spec.rb +18 -0
  159. data/spec/lib/liquid/tags/translate_spec.rb +107 -0
  160. data/spec/lib/liquid/tags_spec.rb +81 -0
  161. data/spec/lib/page_drop_spec.rb +65 -0
  162. data/spec/lib/pagenator_spec.rb +176 -0
  163. data/spec/lib/rspec/matchers/render_page_spec.rb +107 -0
  164. data/spec/models/puffer_pages/layout_spec.rb +15 -0
  165. data/spec/models/puffer_pages/localable_spec.rb +62 -0
  166. data/spec/models/puffer_pages/origin_spec.rb +112 -0
  167. data/spec/models/puffer_pages/page_part_spec.rb +14 -0
  168. data/spec/models/puffer_pages/page_spec.rb +307 -0
  169. data/spec/models/puffer_pages/renderable_spec.rb +84 -0
  170. data/spec/models/puffer_pages/snippet_spec.rb +15 -0
  171. data/spec/requests/origins_requests_spec.rb +37 -0
  172. data/spec/spec_helper.rb +7 -6
  173. metadata +349 -87
  174. data/Gemfile.lock +0 -176
  175. data/app/assets/javascripts/puffer/overlay.js +0 -51
  176. data/app/controllers/puffer_pages/pages_base.rb +0 -38
  177. data/app/models/layout.rb +0 -2
  178. data/app/models/page.rb +0 -2
  179. data/app/models/page_part.rb +0 -2
  180. data/app/models/snippet.rb +0 -2
  181. data/app/views/layouts/puffer_pages_layout.html.erb +0 -2
  182. data/config/puffer_routes.rb +0 -3
  183. data/gemfiles/Gemfile-rails-3.1 +0 -5
  184. data/gemfiles/Gemfile-rails-3.1.lock +0 -173
  185. data/gemfiles/Gemfile-rails-3.2 +0 -5
  186. data/gemfiles/Gemfile-rails-3.2.lock +0 -171
  187. data/lib/puffer_pages/extensions/controller.rb +0 -30
  188. data/lib/puffer_pages/extensions/mapper.rb +0 -23
  189. data/lib/puffer_pages/liquid/tags/page_attribute.rb +0 -39
  190. data/lib/puffer_pages/liquid/tags/stylesheets.rb +0 -38
  191. data/spec/controllers/articles_controller_spec.rb +0 -65
  192. data/spec/dummy/app/controllers/articles_controller.rb +0 -9
  193. data/spec/integration/navigation_spec.rb +0 -9
  194. data/spec/lib/drops_spec.rb +0 -55
  195. data/spec/lib/tags_spec.rb +0 -98
  196. data/spec/models/page_spec.rb +0 -235
  197. data/spec/puffer_pages_spec.rb +0 -7
@@ -1,5 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gemspec :path => '..'
4
-
5
- gem 'rails', '~> 3.2.0'
@@ -1,171 +0,0 @@
1
- PATH
2
- remote: /home/pyromaniac/work/opensource/puffer_pages
3
- specs:
4
- puffer_pages (0.1.1)
5
- liquid
6
- nested_set
7
- puffer
8
- rails (~> 3.1)
9
-
10
- GEM
11
- remote: http://rubygems.org/
12
- specs:
13
- actionmailer (3.2.1)
14
- actionpack (= 3.2.1)
15
- mail (~> 2.4.0)
16
- actionpack (3.2.1)
17
- activemodel (= 3.2.1)
18
- activesupport (= 3.2.1)
19
- builder (~> 3.0.0)
20
- erubis (~> 2.7.0)
21
- journey (~> 1.0.1)
22
- rack (~> 1.4.0)
23
- rack-cache (~> 1.1)
24
- rack-test (~> 0.6.1)
25
- sprockets (~> 2.1.2)
26
- activemodel (3.2.1)
27
- activesupport (= 3.2.1)
28
- builder (~> 3.0.0)
29
- activerecord (3.2.1)
30
- activemodel (= 3.2.1)
31
- activesupport (= 3.2.1)
32
- arel (~> 3.0.0)
33
- tzinfo (~> 0.3.29)
34
- activeresource (3.2.1)
35
- activemodel (= 3.2.1)
36
- activesupport (= 3.2.1)
37
- activesupport (3.2.1)
38
- i18n (~> 0.6)
39
- multi_json (~> 1.0)
40
- arel (3.0.0)
41
- bcrypt-ruby (3.0.1)
42
- builder (3.0.0)
43
- capybara (1.1.2)
44
- mime-types (>= 1.16)
45
- nokogiri (>= 1.3.3)
46
- rack (>= 1.0.0)
47
- rack-test (>= 0.5.4)
48
- selenium-webdriver (~> 2.0)
49
- xpath (~> 0.1.4)
50
- childprocess (0.3.1)
51
- ffi (~> 1.0.6)
52
- database_cleaner (0.7.1)
53
- diff-lcs (1.1.3)
54
- erubis (2.7.0)
55
- fabrication (1.2.0)
56
- ffi (1.0.11)
57
- forgery (0.5.0)
58
- guard (1.0.0)
59
- ffi (>= 0.5.0)
60
- thor (~> 0.14.6)
61
- guard-rspec (0.6.0)
62
- guard (>= 0.10.0)
63
- hike (1.2.1)
64
- i18n (0.6.0)
65
- journey (1.0.1)
66
- json (1.6.5)
67
- kaminari (0.13.0)
68
- actionpack (>= 3.0.0)
69
- activesupport (>= 3.0.0)
70
- railties (>= 3.0.0)
71
- libnotify (0.7.2)
72
- liquid (2.3.0)
73
- mail (2.4.1)
74
- i18n (>= 0.4.0)
75
- mime-types (~> 1.16)
76
- treetop (~> 1.4.8)
77
- mime-types (1.17.2)
78
- multi_json (1.0.4)
79
- mysql (2.8.1)
80
- nested_set (1.6.8)
81
- activerecord (>= 3.0.0)
82
- railties (>= 3.0.0)
83
- nokogiri (1.5.0)
84
- orm_adapter (0.0.6)
85
- pg (0.12.2)
86
- polyglot (0.3.3)
87
- puffer (0.1.1)
88
- kaminari
89
- orm_adapter
90
- rails (~> 3.1)
91
- rack (1.4.1)
92
- rack-cache (1.1)
93
- rack (>= 0.4)
94
- rack-ssl (1.3.2)
95
- rack
96
- rack-test (0.6.1)
97
- rack (>= 1.0)
98
- rails (3.2.1)
99
- actionmailer (= 3.2.1)
100
- actionpack (= 3.2.1)
101
- activerecord (= 3.2.1)
102
- activeresource (= 3.2.1)
103
- activesupport (= 3.2.1)
104
- bundler (~> 1.0)
105
- railties (= 3.2.1)
106
- railties (3.2.1)
107
- actionpack (= 3.2.1)
108
- activesupport (= 3.2.1)
109
- rack-ssl (~> 1.3.2)
110
- rake (>= 0.8.7)
111
- rdoc (~> 3.4)
112
- thor (~> 0.14.6)
113
- rake (0.9.2.2)
114
- rb-inotify (0.8.8)
115
- ffi (>= 0.5.0)
116
- rdoc (3.12)
117
- json (~> 1.4)
118
- rspec (2.8.0)
119
- rspec-core (~> 2.8.0)
120
- rspec-expectations (~> 2.8.0)
121
- rspec-mocks (~> 2.8.0)
122
- rspec-core (2.8.0)
123
- rspec-expectations (2.8.0)
124
- diff-lcs (~> 1.1.2)
125
- rspec-mocks (2.8.0)
126
- rspec-rails (2.8.1)
127
- actionpack (>= 3.0)
128
- activesupport (>= 3.0)
129
- railties (>= 3.0)
130
- rspec (~> 2.8.0)
131
- rubyzip (0.9.5)
132
- selenium-webdriver (2.18.0)
133
- childprocess (>= 0.2.5)
134
- ffi (~> 1.0.9)
135
- multi_json (~> 1.0.4)
136
- rubyzip
137
- sprockets (2.1.2)
138
- hike (~> 1.2)
139
- rack (~> 1.0)
140
- tilt (~> 1.1, != 1.3.0)
141
- sqlite3 (1.3.5)
142
- sqlite3-ruby (1.3.3)
143
- sqlite3 (>= 1.3.3)
144
- thor (0.14.6)
145
- tilt (1.3.3)
146
- treetop (1.4.10)
147
- polyglot
148
- polyglot (>= 0.3.1)
149
- tzinfo (0.3.31)
150
- xpath (0.1.4)
151
- nokogiri (~> 1.3)
152
-
153
- PLATFORMS
154
- ruby
155
-
156
- DEPENDENCIES
157
- bcrypt-ruby
158
- capybara (>= 0.4.0)
159
- database_cleaner
160
- fabrication
161
- forgery
162
- guard
163
- guard-rspec
164
- libnotify
165
- mysql
166
- pg
167
- puffer_pages!
168
- rails (~> 3.2.0)
169
- rb-inotify
170
- rspec-rails
171
- sqlite3-ruby
@@ -1,30 +0,0 @@
1
- module PufferPages
2
- module Extensions
3
- module ActionController
4
- module Base
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- helper_method :layout_page, :default_drops
9
- end
10
-
11
- def puffer_pages
12
- 'puffer_pages_layout'
13
- end
14
-
15
- def layout_page
16
- @layout_page ||= ::Page.find_layout_page(@layout_path.presence || request.path_info)
17
- end
18
-
19
- def default_drops page
20
- {
21
- :self => PufferPages::Liquid::PageDrop.new(page, page, self),
22
- :root => PufferPages::Liquid::PageDrop.new(page.root, page, self)
23
- }.stringify_keys
24
- end
25
- end
26
- end
27
- end
28
- end
29
-
30
- ActionController::Base.send :include, PufferPages::Extensions::ActionController::Base
@@ -1,23 +0,0 @@
1
- module PufferPages
2
- module Extensions
3
- module Mapper
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- class_attribute :_puffer_pages
8
- end
9
-
10
- def puffer_pages_options
11
- self.class._puffer_pages.presence || [{'(*path)' => 'pages#index', :as => 'puffer_page'}]
12
- end
13
-
14
- def puffer_pages *args
15
- options = args.extract_options!
16
- options.merge! :as => 'puffer_page'
17
- self.class._puffer_pages = args.push(options)
18
- end
19
- end
20
- end
21
- end
22
-
23
- ActionDispatch::Routing::Mapper.send :include, PufferPages::Extensions::Mapper
@@ -1,39 +0,0 @@
1
- module PufferPages
2
- module Liquid
3
- module Tags
4
-
5
- class PageAttribute < ::Liquid::Tag
6
- Syntax = /^(#{::Liquid::QuotedFragment})/
7
-
8
- def initialize(tag_name, markup, tokens)
9
- @tag_name = tag_name
10
-
11
- if markup =~ Syntax
12
- @page = $1
13
- elsif markup.blank?
14
- @page = 'self'
15
- else
16
- raise SyntaxError.new("Syntax Error in '#{tag_name}' - Valid syntax: #{tag_name} [page]")
17
- end
18
-
19
- super
20
- end
21
-
22
- def render(context)
23
- page = context[@page]
24
-
25
- context.stack do
26
- context['self'] = page
27
- ::Liquid::Template.parse(page[@tag_name]).render(context)
28
- end
29
- end
30
- end
31
-
32
- end
33
- end
34
- end
35
-
36
- Liquid::Template.register_tag('name', PufferPages::Liquid::Tags::PageAttribute)
37
- Liquid::Template.register_tag('title', PufferPages::Liquid::Tags::PageAttribute)
38
- Liquid::Template.register_tag('keywords', PufferPages::Liquid::Tags::PageAttribute)
39
- Liquid::Template.register_tag('description', PufferPages::Liquid::Tags::PageAttribute)
@@ -1,38 +0,0 @@
1
- module PufferPages
2
- module Liquid
3
- module Tags
4
-
5
- class Stylesheets < ::Liquid::Tag
6
- Syntax = /^(#{::Liquid::QuotedFragment}+)/
7
-
8
- def initialize(tag_name, markup, tokens)
9
- if markup =~ Syntax
10
- @paths = variables_from_string(markup)
11
- else
12
- raise SyntaxError.new("Syntax Error in 'stylesheets' - Valid syntax: stylesheets path [, path, path ...]")
13
- end
14
-
15
- super
16
- end
17
-
18
- def render(context)
19
- paths = @paths.map {|path| "'#{context[path]}'" }.join(', ')
20
- context.registers[:tracker].register "<%= stylesheet_link_tag #{paths} %>"
21
- end
22
-
23
- private
24
-
25
- def variables_from_string(markup)
26
- markup.split(',').map do |var|
27
- var.strip =~ /\s*(#{::Liquid::QuotedFragment})\s*/
28
- $1 ? $1 : nil
29
- end.compact
30
- end
31
-
32
- end
33
-
34
- end
35
- end
36
- end
37
-
38
- Liquid::Template.register_tag('stylesheets', PufferPages::Liquid::Tags::Stylesheets)
@@ -1,65 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ArticlesController do
4
-
5
- describe "GET show" do
6
- render_views
7
-
8
- before :each do
9
- @layout = Fabricate :layout, :name => 'foo_layout'
10
- @root = Fabricate :page, :layout_name => 'foo_layout'
11
- @articles_page = Fabricate :page, :slug => 'articles', :parent => @root
12
- @articles_wildcard = Fabricate :page, :slug => '%', :parent => @articles_page
13
-
14
- @article = Fabricate :article, :title => 'foo', :body => 'bar'
15
- end
16
-
17
- it "assigns @article" do
18
- get :show, :id => 'foo'
19
-
20
- assigns(:article).should == @article
21
- controller.layout_page.should == @articles_wildcard
22
- end
23
-
24
- it "renders the show template" do
25
- get :show, :id => 'foo'
26
-
27
- response.should render_template("show")
28
- end
29
-
30
- it "renders yield with db layout" do
31
- @layout.update_attributes :body => 'db - {% yield %} - db'
32
- get :show, :id => 'foo'
33
-
34
- response.body.should == 'db - foo - db'
35
- end
36
-
37
- it "renders yield with app layout" do
38
- @root.update_attributes :layout_name => 'articles'
39
- get :show, :id => 'foo'
40
-
41
- response.body.should == 'app - - app'
42
- end
43
-
44
- it "renders yield with app and db placeholder" do
45
- @root.update_attributes :layout_name => 'articles'
46
- @articles_wildcard.page_parts = [Fabricate(:page_part, :name => PufferPages.primary_page_part_name, :body => 'db - {% yield %} - db')]
47
- get :show, :id => 'foo'
48
-
49
- response.body.should == 'app - db - foo - db - app'
50
- end
51
-
52
- it "renders yield with param" do
53
- @root.update_attributes :layout_name => 'articles'
54
- @articles_wildcard.page_parts = [
55
- Fabricate(:page_part, :name => PufferPages.primary_page_part_name, :body => 'db - {% yield hello %} - db'),
56
- Fabricate(:page_part, :name => 'hello', :body => 'hello - {% yield %} - hello')
57
- ]
58
- get :show, :id => 'foo'
59
-
60
- response.body.should == 'app - db - hello - foo - hello - db - app'
61
- end
62
-
63
- end
64
-
65
- end
@@ -1,9 +0,0 @@
1
- class ArticlesController < ApplicationController
2
-
3
- layout :puffer_pages
4
-
5
- def show
6
- @article = Article.where(:slug => params[:id]).first
7
- end
8
-
9
- end
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Navigation" do
4
- include Capybara
5
-
6
- it "should be a valid app" do
7
- ::Rails.application.should be_a(Dummy::Application)
8
- end
9
- end
@@ -1,55 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Drops' do
4
-
5
- include RSpec::Rails::RequestExampleGroup
6
-
7
- def render_page(current_page, page = nil)
8
- get "/#{current_page.location}"
9
- current_page.render 'self' => PufferPages::Liquid::PageDrop.new(current_page, current_page, controller),
10
- 'page' => (PufferPages::Liquid::PageDrop.new(page, current_page, controller) if page)
11
- end
12
-
13
- describe 'page drop' do
14
-
15
- before :each do
16
- @root = Fabricate :page, :layout_name => 'foo_layout'
17
- @foo = Fabricate :page, :slug => 'hello', :parent => @root
18
- @bar = Fabricate :page, :slug => 'world', :parent => @foo
19
- @root.reload
20
- @foo.reload
21
- @bar.reload
22
- end
23
-
24
- it 'should render proper url and path' do
25
- @layout = Fabricate :layout, :name => 'foo_layout', :body => "{{ self.path }} {{ self.url }}"
26
-
27
- render_page(@bar).should == '/hello/world http://www.example.com/hello/world'
28
- end
29
-
30
- it 'should render page_part' do
31
- @bar.page_parts.create(:name => 'sidebar', :body => "{{ 'hello!' }}")
32
- @layout = Fabricate :layout, :name => 'foo_layout', :body => "{{ self.sidebar }}"
33
-
34
- render_page(@bar).should == "{{ 'hello!' }}"
35
- end
36
-
37
- it 'should render proper current?' do
38
- @layout = Fabricate :layout, :name => 'foo_layout', :body => "{{ page.current? }}"
39
-
40
- render_page(@foo, @foo).should == 'true'
41
- render_page(@foo, @root).should == 'false'
42
- render_page(@foo, @bar).should == 'false'
43
- end
44
-
45
- it 'should render proper ancestor?' do
46
- @layout = Fabricate :layout, :name => 'foo_layout', :body => "{{ page.ancestor? }}"
47
-
48
- render_page(@foo, @foo).should == 'false'
49
- render_page(@foo, @root).should == 'true'
50
- render_page(@foo, @bar).should == 'false'
51
- end
52
-
53
- end
54
-
55
- end