tenon 2.0.8 → 2.1.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: 6ae1738be1ba3a5fd9e133bdd0ab21ff7aceafcc
4
- data.tar.gz: 38e31b17de0dbef6d7eea5d008bde9359936834e
3
+ metadata.gz: 5d038aac13fadaa7aa5c313c3f6fae3a04b3dbe4
4
+ data.tar.gz: f6676fc0f4482456b33e0ef1c5f8f9aeaa89ff7f
5
5
  SHA512:
6
- metadata.gz: 3c2fc53005195ed3c24e2e7dafb76e7e4e54548dfcad882ed496396ed1ce74dcab9942a3aa922dcaf7a5e3fedcd6a18c8da35765f771eb08082418ed89136dca
7
- data.tar.gz: 50b2667b3f3d4e515373db2d2dc7b838232f41c056e06c41eaa44cdf1b3497f5ac2ffed10682617652525130368aea5c317d94654c18a16a2b73e19956d70076
6
+ metadata.gz: adbda739248022a53a9c728a062bbee68d970b50e8836b644b676b43ed38b54314dbdc744057e21ae32b3a5b225e53e181d39f9cb18e3e9be31d318066ccf6c4
7
+ data.tar.gz: b41cc35172c46ceaaa7c255f9120827128b9854c8462dd481f43723bcf78ff58e2d75e89f476e567f789b50cef008f43d6b3e46bcc677654f7c67db9dc273ddb
@@ -1,5 +1,7 @@
1
1
  module Tenon
2
2
  class ResourcesController < BaseController
3
+ serialization_scope :view_context
4
+
3
5
  wrap_parameters format: [:json]
4
6
  respond_to :html, :json, :js
5
7
  after_action :verify_authorized
@@ -16,12 +18,19 @@ module Tenon
16
18
  self.collection = filterer.filter
17
19
  self.collection = collection.paginate(per_page: 50, page: params[:page])
18
20
  self.collection = Tenon::PaginatingDecorator.decorate(collection)
19
- respond_with(
20
- collection,
21
- serializer: Tenon::PaginatingSerializer,
22
- each_serializer: ActiveModel::Serializer.serializer_for(klass.new),
23
- root: 'records'
24
- )
21
+ render json: collection,
22
+ each_serializer: serializer,
23
+ root: 'records',
24
+ adapter: :json,
25
+ meta: {
26
+ pagination: {
27
+ current_page: collection.current_page,
28
+ per_page: collection.per_page,
29
+ offset: collection.offset,
30
+ total_pages: collection.total_pages,
31
+ total_entries: collection.total_entries
32
+ }
33
+ }
25
34
  end
26
35
  end
27
36
  end
@@ -75,7 +84,7 @@ module Tenon
75
84
 
76
85
  format.json do
77
86
  if resource.valid?
78
- render json: resource
87
+ render json: resource, root: 'record', adapter: :json
79
88
  else
80
89
  render status: 422, json: { errors: resource.errors }
81
90
  end
@@ -103,7 +112,7 @@ module Tenon
103
112
 
104
113
  format.json do
105
114
  if resource.valid?
106
- render json: resource
115
+ render json: resource, root: 'record', adapter: :json
107
116
  else
108
117
  render status: 422, json: { errors: resource.errors }
109
118
  end
@@ -134,9 +143,8 @@ module Tenon
134
143
 
135
144
  private
136
145
 
137
- # Serializer Setup Methods
138
- def default_serializer_options
139
- { root: 'record', scope: view_context }
146
+ def serializer
147
+ ActiveModel::Serializer.serializer_for(klass.new)
140
148
  end
141
149
 
142
150
  # Override these to execute code after resources are loaded
@@ -17,7 +17,7 @@ module Tenon
17
17
  css_class = 'draft'
18
18
  data = {
19
19
  'modal-remote' => true,
20
- 'modal-handler' => 'Tenon.features.NewItemVersionHandler',
20
+ 'modal-handler' => 'NewItemVersionHandler',
21
21
  'modal-title' => 'Save Draft'
22
22
  }
23
23
  link_to path, class: css_class, data: data do
@@ -36,7 +36,7 @@ module Tenon
36
36
  data = {
37
37
  'modal-remote' => true,
38
38
  'modal-title' => 'Load Draft',
39
- 'modal-handler' => 'Tenon.features.ItemVersionIndexHandler'
39
+ 'modal-handler' => 'ItemVersionIndexHandler'
40
40
  }
41
41
  link_to 'Load Draft', path, class: 'delete-link', data: data
42
42
  end
@@ -16,7 +16,7 @@ module Tenon
16
16
  klass.to_s.underscore
17
17
  end
18
18
 
19
- def attributes
19
+ def attributes(*args)
20
20
  super.merge(default_attributes)
21
21
  end
22
22
 
@@ -28,9 +28,9 @@ module Tenon
28
28
  title: object.title,
29
29
  to_param: object.to_param,
30
30
  resource_type: resource_type,
31
- edit_path: scope.polymorphic_path([:edit, object]),
32
- update_path: scope.polymorphic_path(object),
33
- destroy_path: scope.polymorphic_path(object)
31
+ edit_path: view_context.polymorphic_path([:edit, object]),
32
+ update_path: view_context.polymorphic_path(object),
33
+ destroy_path: view_context.polymorphic_path(object)
34
34
  }
35
35
  end
36
36
  end
@@ -1,7 +1,7 @@
1
1
  # Helpful serializer for including pagination meta
2
2
  # Source: http://stackoverflow.com/a/23002614/131208
3
3
  module Tenon
4
- class PaginatingSerializer < ActiveModel::ArraySerializer
4
+ class PaginatingSerializer < ActiveModel::Serializer::CollectionSerializer
5
5
  def initialize(object, options = {})
6
6
  meta_key = options[:meta_key] || :meta
7
7
  options[meta_key] ||= {}
@@ -1,5 +1,6 @@
1
- = react_component 'ResourceIndexRoot',
1
+ = react_component 'Tenon.RI.Root',
2
2
  title: 'Assets',
3
3
  breadcrumbs: breadcrumb_links,
4
4
  recordsPath: assets_path(format: 'json'),
5
- newPath: new_asset_path
5
+ newPath: new_asset_path,
6
+ childComponentNames: { List: 'AssetList', Record: 'AssetRecord' }
@@ -1 +1,2 @@
1
- = react_component 'Breadcrumbs', breadcrumbs: breadcrumb_links
1
+ = react_component 'Tenon.reactComponents.Breadcrumbs',
2
+ breadcrumbs: breadcrumb_links
@@ -6,7 +6,7 @@
6
6
  - if f.object.image
7
7
  = backend_piece_image_tag(f.object)
8
8
  - else
9
- = link_to(new_item_asset_path, class: 'add-image', data: {'modal-remote' => true, 'modal-title' => 'Select Image', 'modal-handler' => 'Tenon.features.tenonContent.AssetAttachment'}) do
9
+ = link_to(new_item_asset_path, class: 'add-image', data: {'modal-remote' => true, 'modal-title' => 'Select Image', 'modal-handler' => 'TenonContentAssetAttachment'}) do
10
10
  %span Add Image
11
11
 
12
12
  .medium-editor-toolbar.medium-toolbar-arrow-under.medium-editor-toolbar-active.image-controls{style: 'display: none; margin-top: -65px;'}
@@ -15,7 +15,7 @@
15
15
  %button{title: 'Crop', class: 'asset-crop medium-editor-action medium-editor-button-first', data: {'tooltip' => true, 'post-crop-handler' => 'Tenon.features.tenonContent.PostCropHandler', 'asset-id' => f.object.image_id}}
16
16
  %i.fa.fa-crop
17
17
  %li
18
- %button{href: new_item_asset_path, title: 'Replace Image', class: 'replace-image medium-editor-action medium-editor-button-last', data: {'modal-remote' => 'true', 'modal-title' => "Select Image", 'modal-handler' => 'Tenon.features.tenonContent.AssetAttachment', 'tooltip' => true}}
18
+ %button{href: new_item_asset_path, title: 'Replace Image', class: 'replace-image medium-editor-action medium-editor-button-last', data: {'modal-remote' => 'true', 'modal-title' => "Select Image", 'modal-handler' => 'TenonContentAssetAttachment', 'tooltip' => true}}
19
19
  %i.fa.fa-picture-o
20
20
 
21
21
  .medium-editor-toolbar-form-anchor
@@ -1,5 +1,5 @@
1
1
  .embedded-content
2
- = link_to 'Edit Embed Code', '#', class: 'open-embed-modal', 'data-modal-target' => '.edit-embed-code', 'data-modal-title' => 'Edit Embed Code', 'data-modal-clone' => 'true', 'data-modal-handler' => 'Tenon.features.tenonContent.EmbeddedContentModalHandler'
2
+ = link_to 'Edit Embed Code', '#', class: 'open-embed-modal', 'data-modal-target' => '.edit-embed-code', 'data-modal-title' => 'Edit Embed Code', 'data-modal-clone' => 'true', 'data-modal-handler' => 'TenonContentEmbeddedContent'
3
3
  .embed= raw f.object.try(:embed_code)
4
4
 
5
5
 
@@ -7,7 +7,7 @@
7
7
  - if f.object.image
8
8
  = backend_piece_image_tag(f.object)
9
9
  - else
10
- = link_to(new_item_asset_path, class: 'tn-tc-fields__add-image', data: { 'modal-remote' => true, 'modal-title' => "Select Image", 'modal-handler' => 'Tenon.features.tenonContent.AssetAttachment' }) do
10
+ = link_to(new_item_asset_path, class: 'tn-tc-fields__add-image', data: { 'modal-remote' => true, 'modal-title' => "Select Image", 'modal-handler' => 'TenonContentAssetAttachment' }) do
11
11
  %span Add Image
12
12
 
13
13
  = f.super_text_area :caption, class: 'tn-tc-fields__caption', placeholder: 'Enter caption here...', data: { image_caption: true }, style: ("display: none;" unless f.object.show_caption)
@@ -50,7 +50,7 @@
50
50
  %button.add-link.medium-editor-toolbar__action{ title: 'Add Link', class: ('medium-editor-button-active' unless f.object.link_url.blank?), data: { tooltip: true } }
51
51
  %i.material-icon.material-icon--smaller-on-min link
52
52
  %li
53
- %button{ href: new_item_asset_path, title: 'Replace Image', class: 'replace-image medium-editor-toolbar__action medium-editor-button-last', data: { 'modal-remote' => 'true', 'modal-title' => "Select Image", 'modal-handler' => 'Tenon.features.tenonContent.AssetAttachment', 'tooltip' => true } }
53
+ %button{ href: new_item_asset_path, title: 'Replace Image', class: 'replace-image medium-editor-toolbar__action medium-editor-button-last', data: { 'modal-remote' => 'true', 'modal-title' => "Select Image", 'modal-handler' => 'TenonContentAssetAttachment', 'tooltip' => true } }
54
54
  %i.material-icon.material-icon--smaller-on-min photo_library
55
55
 
56
56
  .medium-editor-toolbar-form-anchor
@@ -3,6 +3,8 @@ require 'client_side_validations'
3
3
  require 'cocoon'
4
4
  require 'date_time_attribute'
5
5
  require 'draper'
6
+ require 'factory_girl'
7
+ require 'factory_girl_rails'
6
8
  require 'haml'
7
9
  require 'jquery-fileupload-rails'
8
10
  require 'jquery-rails'
@@ -1,3 +1,3 @@
1
1
  module Tenon
2
- VERSION = '2.0.8'
2
+ VERSION = '2.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tenon
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - factor[e] design initiative
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: capybara-webkit
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: database_cleaner
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -198,7 +184,7 @@ dependencies:
198
184
  requirements:
199
185
  - - ">="
200
186
  - !ruby/object:Gem::Version
201
- version: 5.0.0.rc1
187
+ version: 5.0.0
202
188
  - - "<"
203
189
  - !ruby/object:Gem::Version
204
190
  version: 5.1.0
@@ -208,7 +194,7 @@ dependencies:
208
194
  requirements:
209
195
  - - ">="
210
196
  - !ruby/object:Gem::Version
211
- version: 5.0.0.rc1
197
+ version: 5.0.0
212
198
  - - "<"
213
199
  - !ruby/object:Gem::Version
214
200
  version: 5.1.0
@@ -218,14 +204,14 @@ dependencies:
218
204
  requirements:
219
205
  - - ">="
220
206
  - !ruby/object:Gem::Version
221
- version: '0'
207
+ version: 0.10.0
222
208
  type: :runtime
223
209
  prerelease: false
224
210
  version_requirements: !ruby/object:Gem::Requirement
225
211
  requirements:
226
212
  - - ">="
227
213
  - !ruby/object:Gem::Version
228
- version: '0'
214
+ version: 0.10.0
229
215
  - !ruby/object:Gem::Dependency
230
216
  name: cocoon
231
217
  requirement: !ruby/object:Gem::Requirement