locomotivecms 3.2.0.rc2 → 3.2.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
  SHA1:
3
- metadata.gz: 9ab195895e4193a300a633c0496606156308bdbe
4
- data.tar.gz: fc17f2fdaade351feb1c66e9aa67addea6ef3428
3
+ metadata.gz: 4bade9679c107681f6331eded20d257d26b15984
4
+ data.tar.gz: b1b3f52495e62d5875a3df43caec5fdfaa811a88
5
5
  SHA512:
6
- metadata.gz: a0d9827a76d2171a730e6273dd5769ee962652e4383bbd37e9a6a308e25098323db3f5bce4fdac884c300728c81003231109d74f4a83f7a68e234816748697ee
7
- data.tar.gz: 84ffc9549c927e87337f33a5c78b00d0423435e3a663cb9965557c68884c6e67d6a4b9bc2ee9f30de8a6d7465cbb24e37f3731f22c140718cdf121a43875695f
6
+ metadata.gz: b3acfde3cf399e738e0b5f138133302c7c8b67d116fc54c8a9fbe21180a7b3f051877faa32244326a8daa6a82c5017668d053301a53206c3402a55cb72df7d01
7
+ data.tar.gz: 976d3e537b9ff47402f5f70b700457f0f0de010ea6ab87fa8020b3c87bd010884df54fc435dc3cc47cdd56c780572e3a3af48570055dc943dc0222453bc444a4
data/Gemfile CHANGED
@@ -25,7 +25,7 @@ group :development do
25
25
  # gem 'locomotivecms_common', github: 'locomotivecms/common', ref: '257047b', require: false
26
26
 
27
27
  # gem 'locomotivecms_steam', path: '../gems/steam', require: false
28
- # gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: 'c17802c', require: false
28
+ # gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: 'a2cba33', require: false
29
29
 
30
30
  # gem 'locomotive_liquid', path: '../gems/liquid' # for Developers
31
31
  # gem 'locomotivecms_solid', path: '../gems/solid' # for Developers
@@ -10,6 +10,7 @@ module Locomotive
10
10
  helper Locomotive::SitesHelper
11
11
 
12
12
  before_filter :ensure_domains_list, only: :update
13
+ before_filter :ensure_url_redirections, only: :update
13
14
 
14
15
  def edit
15
16
  authorize @site
@@ -70,5 +71,9 @@ module Locomotive
70
71
  params[:site][:domains] = [] unless params[:site][:domains]
71
72
  end
72
73
 
74
+ def ensure_url_redirections
75
+ params[:site][:url_redirections] = [] unless params[:site][:url_redirections]
76
+ end
77
+
73
78
  end
74
79
  end
@@ -12,7 +12,9 @@ module Locomotive
12
12
  end
13
13
 
14
14
  def no_site
15
- render 'no_site', status: :not_found
15
+ respond_to do |format|
16
+ format.html { render 'no_site', status: :not_found }
17
+ end
16
18
  end
17
19
 
18
20
  end
@@ -2,7 +2,7 @@ module Locomotive
2
2
  class EditableControl < EditableElement
3
3
 
4
4
  ## fields ##
5
- field :content
5
+ field :content, localize: true
6
6
  field :default_content, type: Boolean, default: true
7
7
  field :options, type: Array, default: []
8
8
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  .row
19
19
 
20
- - if @editable_elements.empty?
20
+ - if @editable_elements.blank?
21
21
  - if @content_entry.nil?
22
22
  .col-md-12
23
23
  br
@@ -10,6 +10,7 @@ hr
10
10
  ul
11
11
  - @type.ordered_entries_custom_fields.each do |field|
12
12
  - value = @entry.send(field.name)
13
+ - next if value.nil?
13
14
  li
14
15
  strong= field.label
15
16
  | &nbsp;-&nbsp;
@@ -18,12 +18,13 @@ li id="node-#{page._id}" class=page.class_names
18
18
  = render partial: 'locomotive/shared/sidebar/page', collection: page.nodes
19
19
 
20
20
  - if page.templatized_children? && !page.templatized?
21
- li.list-entries
22
- = link_to content_entries_path(current_site, page.templatized_page.content_type.slug) do
23
- i.fa.fa-list-ul.icon
24
- span.text style="#{page.deeper_text_inline_style}"= t(:list_content_entries, name: page.content_type.name.pluralize, scope: 'locomotive.pages.index')
21
+ - if content_type = page.templatized_page.content_type
22
+ li.list-entries
23
+ = link_to content_entries_path(current_site, content_type.slug) do
24
+ i.fa.fa-list-ul.icon
25
+ span.text style="#{page.deeper_text_inline_style}"= t(:list_content_entries, name: content_type.name.pluralize, scope: 'locomotive.pages.index')
25
26
 
26
- li.new-entry.sidebar-list-add
27
- = link_to new_content_entry_path(current_site, page.templatized_page.content_type.slug) do
28
- i.fa.fa-plus.icon
29
- span.text style="#{page.deeper_text_inline_style}"= t(:new_content_entry, name: page.content_type.name.singularize, scope: 'locomotive.pages.index')
27
+ li.new-entry.sidebar-list-add
28
+ = link_to new_content_entry_path(current_site, content_type.slug) do
29
+ i.fa.fa-plus.icon
30
+ span.text style="#{page.deeper_text_inline_style}"= t(:new_content_entry, name: content_type.name.singularize, scope: 'locomotive.pages.index')
@@ -28,6 +28,8 @@ module Locomotive
28
28
  def with_form(type_slug, attributes, as_json, &block)
29
29
  load_content_type(type_slug)
30
30
 
31
+ useTempfiles(attributes)
32
+
31
33
  ::Mongoid::Fields::I18n.with_locale(self.locale) do
32
34
  form = Locomotive::API::Forms::ContentEntryForm.new(@content_type, attributes)
33
35
 
@@ -37,6 +39,15 @@ module Locomotive
37
39
  end
38
40
  end
39
41
 
42
+ def useTempfiles(attributes)
43
+ # kind of marshal/unmarshal mechanism :-)
44
+ attributes.each do |key, value|
45
+ if value.is_a?(Hash) && value['tempfile'].present? && value['tempfile'].is_a?(String) && value['filename'].present?
46
+ attributes[key]['tempfile'] = File.open(attributes[key]['tempfile'])
47
+ end
48
+ end
49
+ end
50
+
40
51
  def make_entity(entry, as_json)
41
52
  entity = entry.to_steam(@content_type)
42
53
  decorated_entity = Locomotive::Steam::Decorators::I18nDecorator.new(entity, locale)
@@ -29,7 +29,10 @@ Locomotive::Steam.configure do |config|
29
29
  config.middleware.delete Rack::Lint
30
30
  config.middleware.delete Rack::Session::Moneta
31
31
 
32
- %w(cache catch_error page_editing missing_translations wysihtml_css).each do |name|
32
+ require_relative 'steam/middlewares/catch_error'
33
+ config.middleware.insert_after Locomotive::Steam::Middlewares::Site, Locomotive::Steam::Middlewares::CatchError
34
+
35
+ %w(cache page_editing missing_translations wysihtml_css).each do |name|
33
36
  require_relative "steam/middlewares/#{name}"
34
37
  config.middleware.insert_after Locomotive::Steam::Middlewares::Page, Locomotive::Steam::Middlewares.const_get(name.camelize)
35
38
  end
@@ -2,5 +2,5 @@
2
2
  # MAJOR.MINOR.PATCH format.
3
3
  # 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0
4
4
  module Locomotive #:nodoc
5
- VERSION = '3.2.0.rc2'
5
+ VERSION = '3.2.0'
6
6
  end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe Locomotive::Steam::APIContentEntryService do
4
+
5
+ let(:site) { create(:site) }
6
+ let(:request_env) { instance_double('RequestEnv') }
7
+ let(:request) { instance_double('Request', ip: '127.0.0.1', env: request_env) }
8
+ let!(:content_type) { create('article content type', site: site).reload }
9
+ let(:service) { described_class.new(nil, nil, :en, request) }
10
+
11
+ before { expect(request_env).to receive(:[]).with('locomotive.site').and_return(site) }
12
+
13
+ describe '#create' do
14
+
15
+ let(:file) { Rack::Multipart::UploadedFile.new(FixturedAsset.path('5k.png'), 'image/png') }
16
+ let(:attributes) { { title: 'Hello world', body: 'Lorem ipsum...', picture: file } }
17
+
18
+ subject { service.create(content_type.slug, attributes, true) }
19
+
20
+ it 'persists the content entry' do
21
+ expect { subject }.to change(Locomotive::ContentEntry, :count).by(1)
22
+ expect(subject['picture']['url']).to eq '5k.png'
23
+ end
24
+
25
+ context 'marshalled picture' do
26
+
27
+ let(:file) {
28
+ {
29
+ 'content_type' => 'image/png',
30
+ 'original_filename' => '5k.png',
31
+ 'filename' => '5k.png',
32
+ 'tempfile' => FixturedAsset.path('5k.png')
33
+ }
34
+ }
35
+
36
+ it 'persists the content entry' do
37
+ expect(subject['picture']['url']).to eq '5k.png'
38
+ end
39
+
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -39,7 +39,7 @@ describe Locomotive::Steam::Middlewares::Cache do
39
39
 
40
40
  subject { middleware.send(:cache_key, steam_env) }
41
41
 
42
- it { expect(subject).to eq 'fd87f5b55149276bc20fcc26465d27c9' }
42
+ it { expect(subject).to eq 'e5bc074a017ba05e140a16185e3e38f7' }
43
43
 
44
44
  end
45
45
 
@@ -113,6 +113,10 @@ var wysihtml5ParserRules = {
113
113
  "tr": {
114
114
  "add_class": {
115
115
  "align": "align_text"
116
+ },
117
+ "check_attributes": {
118
+ "id": "any",
119
+ "class": "any"
116
120
  }
117
121
  },
118
122
  "strike": {},
@@ -131,6 +135,10 @@ var wysihtml5ParserRules = {
131
135
  "rename_tag": "div"
132
136
  },
133
137
  "h4": {
138
+ "check_attributes": {
139
+ "id": "any",
140
+ "class": "any"
141
+ },
134
142
  "add_class": {
135
143
  "align": "align_text"
136
144
  }
@@ -165,7 +173,12 @@ var wysihtml5ParserRules = {
165
173
  "command": {
166
174
  "remove": 1
167
175
  },
168
- "ul": {},
176
+ "ul": {
177
+ "check_attributes": {
178
+ "id": "any",
179
+ "class": "any"
180
+ }
181
+ },
169
182
  "progress": {
170
183
  "rename_tag": "span"
171
184
  },
@@ -174,6 +187,7 @@ var wysihtml5ParserRules = {
174
187
  },
175
188
  "iframe": {
176
189
  "check_attributes": {
190
+ "id": "any",
177
191
  "class": "any",
178
192
  "width": "any",
179
193
  "height": "any",
@@ -187,17 +201,19 @@ var wysihtml5ParserRules = {
187
201
  },
188
202
  "a": {
189
203
  "check_attributes": {
204
+ "id": "any",
190
205
  "target": "any",
191
206
  "href": "any", // if you compiled master manually then change this from 'url' to 'href'
192
207
  "title": "any",
193
208
  "class": "any",
194
- "data-*": "any"
195
- },
196
- "set_attributes": {
209
+ "data-*": "any",
210
+ "rel": "any"
197
211
  }
198
212
  },
199
213
  "img": {
200
214
  "check_attributes": {
215
+ "id": "any",
216
+ "class": "any",
201
217
  "width": "numbers",
202
218
  "title": "any",
203
219
  "alt": "any",
@@ -236,6 +252,10 @@ var wysihtml5ParserRules = {
236
252
  "rename_tag": "div"
237
253
  },
238
254
  "h1": {
255
+ "check_attributes": {
256
+ "id": "any",
257
+ "class": "any"
258
+ },
239
259
  "add_class": {
240
260
  "align": "align_text"
241
261
  }
@@ -244,6 +264,10 @@ var wysihtml5ParserRules = {
244
264
  "remove": 1
245
265
  },
246
266
  "tbody": {
267
+ "check_attributes": {
268
+ "id": "any",
269
+ "class": "any"
270
+ },
247
271
  "add_class": {
248
272
  "align": "align_text"
249
273
  }
@@ -254,9 +278,16 @@ var wysihtml5ParserRules = {
254
278
  "s": {
255
279
  "rename_tag": "span"
256
280
  },
257
- "li": {},
281
+ "li": {
282
+ "check_attributes": {
283
+ "id": "any",
284
+ "class": "any"
285
+ },
286
+ },
258
287
  "td": {
259
288
  "check_attributes": {
289
+ "id": "any",
290
+ "class": "any",
260
291
  "rowspan": "numbers",
261
292
  "colspan": "numbers"
262
293
  },
@@ -269,6 +300,7 @@ var wysihtml5ParserRules = {
269
300
  },
270
301
  "div": {
271
302
  "check_attributes": {
303
+ "id": "any",
272
304
  "class": "any",
273
305
  "data-*": "any"
274
306
  },
@@ -309,6 +341,10 @@ var wysihtml5ParserRules = {
309
341
  "remove": 1
310
342
  },
311
343
  "h5": {
344
+ "check_attributes": {
345
+ "id": "any",
346
+ "class": "any"
347
+ },
312
348
  "add_class": {
313
349
  "align": "align_text"
314
350
  }
@@ -331,6 +367,10 @@ var wysihtml5ParserRules = {
331
367
  }
332
368
  },
333
369
  "tfoot": {
370
+ "check_attributes": {
371
+ "id": "any",
372
+ "class": "any"
373
+ },
334
374
  "add_class": {
335
375
  "align": "align_text"
336
376
  }
@@ -358,6 +398,7 @@ var wysihtml5ParserRules = {
358
398
  },
359
399
  "span": {
360
400
  "check_attributes": {
401
+ "id": "any",
361
402
  "class": "any",
362
403
  "data-*": "any"
363
404
  }
@@ -383,7 +424,12 @@ var wysihtml5ParserRules = {
383
424
  "body": {
384
425
  "rename_tag": "div"
385
426
  },
386
- "ol": {},
427
+ "ol": {
428
+ "check_attributes": {
429
+ "id": "any",
430
+ "class": "any"
431
+ }
432
+ },
387
433
  "nobr": {
388
434
  "rename_tag": "span"
389
435
  },
@@ -401,6 +447,8 @@ var wysihtml5ParserRules = {
401
447
  // },
402
448
  "blockquote": {
403
449
  "check_attributes": {
450
+ "id": "any",
451
+ "class": "any",
404
452
  "cite": "url"
405
453
  }
406
454
  },
@@ -414,6 +462,10 @@ var wysihtml5ParserRules = {
414
462
  "rename_tag": "span"
415
463
  },
416
464
  "h3": {
465
+ "check_attributes": {
466
+ "id": "any",
467
+ "class": "any"
468
+ },
417
469
  "add_class": {
418
470
  "align": "align_text"
419
471
  }
@@ -438,6 +490,10 @@ var wysihtml5ParserRules = {
438
490
  "remove": 1
439
491
  },
440
492
  "thead": {
493
+ "check_attributes": {
494
+ "id": "any",
495
+ "class": "any"
496
+ },
441
497
  "add_class": {
442
498
  "align": "align_text"
443
499
  }
@@ -452,6 +508,10 @@ var wysihtml5ParserRules = {
452
508
  "remove": 1
453
509
  },
454
510
  "h6": {
511
+ "check_attributes": {
512
+ "id": "any",
513
+ "class": "any"
514
+ },
455
515
  "add_class": {
456
516
  "align": "align_text"
457
517
  }
@@ -461,6 +521,8 @@ var wysihtml5ParserRules = {
461
521
  },
462
522
  "th": {
463
523
  "check_attributes": {
524
+ "id": "any",
525
+ "class": "any",
464
526
  "rowspan": "numbers",
465
527
  "colspan": "numbers"
466
528
  },
@@ -510,7 +572,12 @@ var wysihtml5ParserRules = {
510
572
  "article": {
511
573
  "rename_tag": "div"
512
574
  },
513
- "cite": {},
575
+ "cite": {
576
+ "check_attributes": {
577
+ "id": "any",
578
+ "class": "any"
579
+ }
580
+ },
514
581
  "link": {
515
582
  "remove": 1
516
583
  },
@@ -530,6 +597,10 @@ var wysihtml5ParserRules = {
530
597
  "rename_tag": "span"
531
598
  },
532
599
  "h2": {
600
+ "check_attributes": {
601
+ "id": "any",
602
+ "class": "any"
603
+ },
533
604
  "add_class": {
534
605
  "align": "align_text"
535
606
  }
@@ -538,6 +609,10 @@ var wysihtml5ParserRules = {
538
609
  "rename_tag": "span"
539
610
  },
540
611
  "p": {
612
+ "check_attributes": {
613
+ "id": "any",
614
+ "class": "any"
615
+ },
541
616
  "add_class": {
542
617
  "align": "align_text"
543
618
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0.rc2
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-15 00:00:00.000000000 Z
11
+ date: 2016-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -156,28 +156,28 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 2.7.0.rc1
159
+ version: 2.7.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 2.7.0.rc1
166
+ version: 2.7.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: locomotivecms_steam
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 1.2.0.rc2
173
+ version: 1.2.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 1.2.0.rc2
180
+ version: 1.2.0
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: slim
183
183
  requirement: !ruby/object:Gem::Requirement
@@ -1243,6 +1243,7 @@ files:
1243
1243
  - spec/lib/action_view_spec.rb
1244
1244
  - spec/lib/core_ext_spec.rb
1245
1245
  - spec/lib/locomotive/configuration_spec.rb
1246
+ - spec/lib/locomotive/steam/services/api_content_entry_service_spec.rb
1246
1247
  - spec/lib/locomotive/steam/services/api_entry_submission_service_spec.rb
1247
1248
  - spec/lib/locomotive/steam/services/async_email_service_spec.rb
1248
1249
  - spec/lib/locomotive/steam/services/liquid_parser_with_cache_service_spec.rb
@@ -1365,9 +1366,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1365
1366
  version: '0'
1366
1367
  required_rubygems_version: !ruby/object:Gem::Requirement
1367
1368
  requirements:
1368
- - - ">"
1369
+ - - ">="
1369
1370
  - !ruby/object:Gem::Version
1370
- version: 1.3.1
1371
+ version: '0'
1371
1372
  requirements: []
1372
1373
  rubyforge_project:
1373
1374
  rubygems_version: 2.4.5.1
@@ -1390,6 +1391,7 @@ test_files:
1390
1391
  - spec/lib/action_view_spec.rb
1391
1392
  - spec/lib/core_ext_spec.rb
1392
1393
  - spec/lib/locomotive/configuration_spec.rb
1394
+ - spec/lib/locomotive/steam/services/api_content_entry_service_spec.rb
1393
1395
  - spec/lib/locomotive/steam/services/api_entry_submission_service_spec.rb
1394
1396
  - spec/lib/locomotive/steam/services/async_email_service_spec.rb
1395
1397
  - spec/lib/locomotive/steam/services/liquid_parser_with_cache_service_spec.rb