trusty-cms 3.6.2 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24864c3e48977b8fddef8d19648397a3cc11bc00a0f89b741d894d2f73ffc415
4
- data.tar.gz: '0083e090e5912e133a60aef312bdf47073a11381992872aa8e965be0e8d65c3a'
3
+ metadata.gz: 87d1aa29762eadcf31ca151549eb2fc9c92ca4f30d9d65a35b2cf73f5d1f2d41
4
+ data.tar.gz: 4eb4d1421a03c9bb20d7e894353b934495bdc7fc86d75bf8c4f4b25ce2b0c6b8
5
5
  SHA512:
6
- metadata.gz: 5d63ce3ffb5eef61ba9102a45b23e65396f7c6b285fe731f17321aa3ad348dcc3a61bdf2146788aa03d3b5bfc84981693bb069479f55301a37a254cf6d033d82
7
- data.tar.gz: e48758d3008942205ec5933932bf917ccc959c0f259700d232f6e3d465354979ed108b3c415d93f854ddf14ded356d72aedfbf81f7ca3c2f6c0ad59b3c5ebc63
6
+ metadata.gz: 2b3d8726f8da0998e568885be7e0003225f4af861bd8735b1ff0c50d76dbcd7a44a1b45516088372bbfa11786e86a8d93656f8a46db689fa4e84993f7a694d2a
7
+ data.tar.gz: 691acf119600c41670497c95765a83ebcc8262760657b8b6d74f1e6d3d66a1418580b5af3bb4ee458ec4f41d46750ef6c160a6bd87cc72656d7d4e44af1380c2
data/Gemfile CHANGED
@@ -13,7 +13,6 @@ gemspec
13
13
 
14
14
  group :development, :test do
15
15
  gem 'acts_as_list'
16
- gem 'codeclimate-test-reporter'
17
16
  gem 'database_cleaner'
18
17
  gem 'factory_bot_rails', '5.0.2'
19
18
  gem 'launchy', '~> 2.4.2'
@@ -23,4 +22,5 @@ group :development, :test do
23
22
  gem 'rails-observers'
24
23
  gem 'rspec-rails'
25
24
  gem 'sass-rails'
25
+ gem 'simplecov'
26
26
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- trusty-cms (3.6.2)
4
+ trusty-cms (3.7.0)
5
5
  RedCloth (= 4.3.2)
6
6
  acts_as_list (~> 0.9.5)
7
7
  acts_as_tree (>= 2.6.1, < 2.9.0)
@@ -96,10 +96,8 @@ GEM
96
96
  orm_adapter (~> 0.5.0)
97
97
  climate_control (0.2.0)
98
98
  cliver (0.3.2)
99
- cocaine (0.6.0)
100
- terrapin (= 0.6.0)
101
- codeclimate-test-reporter (1.0.9)
102
- simplecov (<= 0.13)
99
+ cocaine (0.5.8)
100
+ climate_control (>= 0.0.3, < 1.0)
103
101
  coderay (1.1.2)
104
102
  concurrent-ruby (1.1.5)
105
103
  crass (1.0.4)
@@ -109,7 +107,7 @@ GEM
109
107
  delocalize (1.2.0)
110
108
  rails (>= 2)
111
109
  diff-lcs (1.3)
112
- docile (1.1.5)
110
+ docile (1.3.2)
113
111
  erubi (1.8.0)
114
112
  erubis (2.7.0)
115
113
  execjs (2.7.0)
@@ -149,7 +147,7 @@ GEM
149
147
  multipart-post
150
148
  launchy (2.4.3)
151
149
  addressable (~> 2.3)
152
- libv8 (7.3.492.27.1)
150
+ libv8 (7.3.492.27.1-x86_64-linux)
153
151
  loofah (2.2.3)
154
152
  crass (~> 1.0.2)
155
153
  nokogiri (>= 1.5.9)
@@ -171,15 +169,15 @@ GEM
171
169
  multipart-post (2.1.1)
172
170
  mysql2 (0.5.2)
173
171
  nio4r (2.4.0)
174
- nokogiri (1.10.3)
172
+ nokogiri (1.10.4)
175
173
  mini_portile2 (~> 2.4.0)
176
174
  orm_adapter (0.5.0)
177
- paperclip (6.1.0)
175
+ paperclip (5.2.1)
178
176
  activemodel (>= 4.2.0)
179
177
  activesupport (>= 4.2.0)
178
+ cocaine (~> 0.5.5)
180
179
  mime-types
181
180
  mimemagic (~> 0.3.0)
182
- terrapin (~> 0.6.0)
183
181
  poltergeist (1.18.1)
184
182
  capybara (>= 2.1, < 4)
185
183
  cliver (~> 0.3.1)
@@ -232,8 +230,8 @@ GEM
232
230
  roadie (3.5.0)
233
231
  css_parser (~> 1.4)
234
232
  nokogiri (~> 1.8)
235
- roadie-rails (2.1.0)
236
- railties (>= 5.1, < 6.1)
233
+ roadie-rails (1.3.0)
234
+ railties (>= 3.0, < 5.3)
237
235
  roadie (~> 3.1)
238
236
  rspec-core (3.8.1)
239
237
  rspec-support (~> 3.8.0)
@@ -266,8 +264,8 @@ GEM
266
264
  sprockets-rails (>= 2.0, < 4.0)
267
265
  tilt (>= 1.1, < 3)
268
266
  sexp_processor (4.12.1)
269
- simplecov (0.13.0)
270
- docile (~> 1.1.0)
267
+ simplecov (0.17.0)
268
+ docile (~> 1.1)
271
269
  json (>= 1.8, < 3)
272
270
  simplecov-html (~> 0.10.0)
273
271
  simplecov-html (0.10.2)
@@ -280,8 +278,6 @@ GEM
280
278
  sprockets (>= 3.0.0)
281
279
  stringex (2.8.5)
282
280
  temple (0.8.1)
283
- terrapin (0.6.0)
284
- climate_control (>= 0.0.3, < 1.0)
285
281
  thor (0.20.3)
286
282
  thread_safe (0.3.6)
287
283
  tilt (2.0.9)
@@ -304,7 +300,6 @@ PLATFORMS
304
300
 
305
301
  DEPENDENCIES
306
302
  acts_as_list
307
- codeclimate-test-reporter
308
303
  database_cleaner
309
304
  factory_bot_rails (= 5.0.2)
310
305
  launchy (~> 2.4.2)
@@ -314,6 +309,7 @@ DEPENDENCIES
314
309
  rails-observers
315
310
  rspec-rails
316
311
  sass-rails
312
+ simplecov
317
313
  trusty-cms!
318
314
  trustygems (~> 0.2.0)
319
315
 
@@ -2,6 +2,6 @@ TRUSTY_CMS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..")) unle
2
2
 
3
3
  unless defined? TrustyCms::VERSION
4
4
  module TrustyCms
5
- VERSION = '3.6.2'
5
+ VERSION = '3.7.0'
6
6
  end
7
7
  end
@@ -8,7 +8,7 @@ class LayoutsExtension < TrustyCms::Extension
8
8
  ActionView::Base.send :include, ShareLayouts::Helpers::ActionView
9
9
 
10
10
  # Nested Layouts
11
- # Page.send :include, NestedLayouts::Tags::Core
11
+ Page.send :include, NestedLayouts::Tags::Core
12
12
 
13
13
  # HAML Layouts
14
14
  Layout.send :include, HamlLayouts::Models::Layout
@@ -0,0 +1,149 @@
1
+ module NestedLayouts
2
+ module Tags
3
+ module Core
4
+
5
+ include TrustyCms::Taggable
6
+
7
+ class TagError < StandardError; end
8
+
9
+ desc %{
10
+ Renders the contents of the tag inside of a "parent" layout, which is selected via the +name+
11
+ attribute. The contents of this tag are placed at a corresponding <r:content_for_layout/> tag
12
+ within the parent layout. This tag is intended to be used within your layouts, and should
13
+ only appear once per layout.
14
+
15
+ *Usage:*
16
+ <r:inside_layout name="master">
17
+ <div id="main-column">
18
+ <r:content_for_layout/>
19
+ </div>
20
+ </r:inside_layout>
21
+ }
22
+ tag 'inside_layout' do |tag|
23
+ if name = tag.attr['name']
24
+ # Prepare the stacks
25
+ tag.globals.nested_layouts_content_stack ||= []
26
+ tag.globals.nested_layouts_layout_stack ||= []
27
+
28
+ # Remember the original layout to support the +layout+ tag
29
+ tag.globals.page_original_layout ||= tag.globals.page.layout # Remember the original layout
30
+
31
+ # Find the layout
32
+ name.strip!
33
+ if layout = Layout.find_by_name(name)
34
+ # Track this layout on the stack
35
+ tag.globals.nested_layouts_layout_stack << name
36
+
37
+ # Save contents of inside_layout for later insertion
38
+ tag.globals.nested_layouts_content_stack << tag.expand
39
+
40
+ # Set the page layout that Trusty should use for rendering, which is different than the actual
41
+ # page's layout when layouts are nested. The final/highest +inside_layout+ tag will set or
42
+ # overwrite this value for the last time.
43
+ tag.globals.page.layout = layout
44
+ tag.globals.page.render
45
+ else
46
+ raise TagError.new(%{Error (nested_layouts): Parent layout "#{name.strip}" not found for "inside_layout" tag})
47
+ end
48
+ else
49
+ raise TagError.new(%{Error (nested_layouts): "inside_layout" tag must contain a "name" attribute})
50
+ end
51
+ end
52
+
53
+ desc %{
54
+ Allows nested layouts to target this layout. The contents of <r:inside_layout> tag blocks in another
55
+ layout will have their contents inserted at the location given by this tag (if they target this
56
+ layout). This tag also behaves like a standard <r:content/> tag if this layout is specified directly
57
+ by a page.
58
+
59
+ This tag is intended to be used inside layouts.
60
+
61
+ *Usage:*
62
+
63
+ <html>
64
+ <body>
65
+ <r:content_for_layout/>
66
+ </body>
67
+ </html>
68
+
69
+ }
70
+ tag 'content_for_layout' do |tag|
71
+ tag.globals.nested_layouts_content_stack ||= []
72
+
73
+ # return the saved content if any, or mimic a default +<r:content/>+ tag (render the body part)
74
+ tag.globals.nested_layouts_content_stack.pop || tag.globals.page.render_part('body')
75
+ end
76
+
77
+ desc %{
78
+ Return the layout name of the current page.
79
+
80
+ *Usage:*
81
+
82
+ <html>
83
+ <body id="<r:layout/>"
84
+ My body tag has an id corresponding to the layout I use. Sweet!
85
+ </body>
86
+ </html>
87
+ }
88
+ tag 'layout' do |tag|
89
+ current_layout_name(tag)
90
+ end
91
+
92
+ desc %{
93
+ output the contents of tag if layout equals name (support regex)
94
+
95
+ *Usage:*
96
+
97
+ <pre><code><r:if_layout name="(parent|parent_of_child)">
98
+ one of those layouts
99
+ </r:if_layout></code></pre>
100
+ }
101
+ tag 'if_layout' do |tag|
102
+ tag.expand if is_current_layout(tag)
103
+ end
104
+
105
+ desc %{
106
+ Output the contents of tag unless layout equals name (support regex)
107
+
108
+ *Usage:*
109
+
110
+ <pre><code><r:unless_layout name="parent">
111
+ not the parent layotu
112
+ </r:unless_layout></code></pre>
113
+ }
114
+ tag 'unless_layout' do |tag|
115
+ tag.expand unless is_current_layout(tag)
116
+ end
117
+
118
+ tag 'body' do |tag|
119
+ %{<body id="#{tag.locals.page.slug.gsub('/','')}" class="#{current_layout_name(tag)}#{tag.attr['class'].present? ? " #{tag.attr['class']}" : nil}">#{tag.expand}</body>}
120
+ end
121
+
122
+ protected
123
+
124
+ def current_layout_name(tag)
125
+ result = ''
126
+
127
+ if layout = tag.globals.page_original_layout
128
+ result = layout.name
129
+ elsif layout = tag.globals.page.layout
130
+ result = layout.name
131
+ end
132
+
133
+ result
134
+ end
135
+
136
+ def is_current_layout(tag)
137
+ if tag.attr['name'].nil?
138
+ raise TagError.new(%{Error (nested_layouts): "if_layout" tag must contain a "name" attribute})
139
+ end
140
+
141
+ layout = tag.globals.page_original_layout || tag.globals.page.layout
142
+ search = %r{#{tag.attr['name']}}
143
+
144
+ (layout.name =~ search).present?
145
+ end
146
+
147
+ end
148
+ end
149
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trusty-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.2
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TrustyCms CMS dev team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-06 00:00:00.000000000 Z
11
+ date: 2019-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -1009,6 +1009,7 @@ files:
1009
1009
  - spec/dummy/config/routes.rb
1010
1010
  - spec/dummy/config/secrets.yml
1011
1011
  - spec/dummy/db/schema.rb
1012
+ - spec/dummy/log/test.log
1012
1013
  - spec/dummy/package.json
1013
1014
  - spec/dummy/public/404.html
1014
1015
  - spec/dummy/public/422.html
@@ -1047,6 +1048,7 @@ files:
1047
1048
  - vendor/extensions/layouts-extension/lib/haml_layouts/models/layout.rb
1048
1049
  - vendor/extensions/layouts-extension/lib/haml_layouts/models/page.rb
1049
1050
  - vendor/extensions/layouts-extension/lib/layouts/engine.rb
1051
+ - vendor/extensions/layouts-extension/lib/nested_layouts/tags/core.rb
1050
1052
  - vendor/extensions/layouts-extension/lib/share_layouts/controllers/action_controller.rb
1051
1053
  - vendor/extensions/layouts-extension/lib/share_layouts/helpers/action_view.rb
1052
1054
  - vendor/extensions/layouts-extension/lib/tasks/layouts_extension_tasks.rake
@@ -1128,54 +1130,55 @@ signing_key:
1128
1130
  specification_version: 4
1129
1131
  summary: A no-fluff content management system designed for small teams.
1130
1132
  test_files:
1133
+ - spec/ci/database.mysql.yml
1134
+ - spec/controllers/application_controller_spec.rb
1135
+ - spec/controllers/users_controller_spec.rb
1136
+ - spec/controllers/welcome_controller_spec.rb
1137
+ - spec/dummy/README.rdoc
1131
1138
  - spec/dummy/Rakefile
1132
- - spec/dummy/package.json
1133
- - spec/dummy/bin/setup
1134
- - spec/dummy/bin/rake
1135
- - spec/dummy/bin/rails
1136
1139
  - spec/dummy/bin/bundle
1137
- - spec/dummy/public/500.html
1138
- - spec/dummy/public/404.html
1139
- - spec/dummy/public/422.html
1140
- - spec/dummy/public/favicon.ico
1140
+ - spec/dummy/bin/rails
1141
+ - spec/dummy/bin/rake
1142
+ - spec/dummy/bin/setup
1143
+ - spec/dummy/config/application.rb
1144
+ - spec/dummy/config/boot.rb
1145
+ - spec/dummy/config/database.yml
1146
+ - spec/dummy/config/environment.rb
1147
+ - spec/dummy/config/environments/development.rb
1141
1148
  - spec/dummy/config/environments/production.rb
1142
1149
  - spec/dummy/config/environments/test.rb
1143
- - spec/dummy/config/environments/development.rb
1144
- - spec/dummy/config/locales/en.yml
1145
- - spec/dummy/config/database.yml
1146
- - spec/dummy/config/initializers/wrap_parameters.rb
1147
- - spec/dummy/config/initializers/trusty_cms_config.rb
1150
+ - spec/dummy/config/initializers/assets.rb
1151
+ - spec/dummy/config/initializers/backtrace_silencers.rb
1152
+ - spec/dummy/config/initializers/cookies_serializer.rb
1153
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
1148
1154
  - spec/dummy/config/initializers/inflections.rb
1149
1155
  - spec/dummy/config/initializers/mime_types.rb
1150
- - spec/dummy/config/initializers/filter_parameter_logging.rb
1151
- - spec/dummy/config/initializers/backtrace_silencers.rb
1152
1156
  - spec/dummy/config/initializers/session_store.rb
1153
- - spec/dummy/config/initializers/cookies_serializer.rb
1154
- - spec/dummy/config/initializers/assets.rb
1155
- - spec/dummy/config/application.rb
1156
- - spec/dummy/config/secrets.yml
1157
+ - spec/dummy/config/initializers/trusty_cms_config.rb
1158
+ - spec/dummy/config/initializers/wrap_parameters.rb
1159
+ - spec/dummy/config/locales/en.yml
1157
1160
  - spec/dummy/config/routes.rb
1158
- - spec/dummy/config/boot.rb
1159
- - spec/dummy/config/environment.rb
1161
+ - spec/dummy/config/secrets.yml
1160
1162
  - spec/dummy/config.ru
1161
1163
  - spec/dummy/db/schema.rb
1162
- - spec/dummy/README.rdoc
1164
+ - spec/dummy/log/test.log
1165
+ - spec/dummy/package.json
1166
+ - spec/dummy/public/404.html
1167
+ - spec/dummy/public/422.html
1168
+ - spec/dummy/public/500.html
1169
+ - spec/dummy/public/favicon.ico
1163
1170
  - spec/dummy/yarn.lock
1164
- - spec/controllers/users_controller_spec.rb
1165
- - spec/controllers/welcome_controller_spec.rb
1166
- - spec/controllers/application_controller_spec.rb
1167
- - spec/rails_helper.rb
1168
- - spec/routing/welcome_routing_spec.rb
1169
- - spec/fixtures/users.yml
1170
- - spec/spec_helper.rb
1171
- - spec/models/layout_spec.rb
1172
- - spec/ci/database.mysql.yml
1173
- - spec/features/pages_spec.rb
1174
- - spec/features/config_spec.rb
1175
- - spec/features/admin_login_spec.rb
1176
- - spec/features/layouts_spec.rb
1171
+ - spec/factories/layout.rb
1177
1172
  - spec/factories/page.rb
1178
1173
  - spec/factories/page_part.rb
1179
1174
  - spec/factories/user.rb
1180
- - spec/factories/layout.rb
1175
+ - spec/features/admin_login_spec.rb
1176
+ - spec/features/config_spec.rb
1177
+ - spec/features/layouts_spec.rb
1178
+ - spec/features/pages_spec.rb
1179
+ - spec/fixtures/users.yml
1180
+ - spec/models/layout_spec.rb
1181
+ - spec/rails_helper.rb
1182
+ - spec/routing/welcome_routing_spec.rb
1183
+ - spec/spec_helper.rb
1181
1184
  - spec/support/custom_actions.rb