cm_page_builder-rails 0.1.12 → 0.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
  SHA256:
3
- metadata.gz: 1319d18846ff6fbec6c7e1dc85363195f43508e5cf13f881e37df294ea00463f
4
- data.tar.gz: c068f3a7c46b87020c1deae14a5152706fcd1c3a02fee7d5c71fa0bb10f1b39f
3
+ metadata.gz: 459dbee8f8a6d0f44b65f66680fbd49d4e80cb7d98c5e1c51c880d498bee4b6e
4
+ data.tar.gz: 6575bb5cec83a974583f8a9e3f9647f083aadab5b44545920bdbe10129f0f8e6
5
5
  SHA512:
6
- metadata.gz: fb9bad65dbf2a040723c1f047070ab63edc18b43af54beb2cedf998be431bd69f4d83c8927ffa2c174deea4368a26cdef15cff79b99e0fc243c5a5fcbb54cfa7
7
- data.tar.gz: 8ff919d4c117cdab7a74ab0acb5d73d8ac5339231a277bdfb6f60714bb86c6e461e70ac9b775701e2889e0822f6cc11a3684375e3f545b1e88b8759d4a74e7c3
6
+ metadata.gz: ac569b59270e994afffb4ba5f29369ed07548d34c6705e65b5f5cbe3407f9237f813d317d57c784d556d4960a33d13c469de35cbfc8de2276af5d282f75d39f3
7
+ data.tar.gz: 3a15e1030e9a41a8e81380dc9542026ed6ca614e6276379102b40a0175d9d845224651a656c4d124a15570b3df9267eea012531ffbf5944125b4d580627d3452
data/README.md CHANGED
@@ -1,29 +1,39 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/cm_page_builder-rails.svg)](https://badge.fury.io/rb/cm_page_builder-rails)
2
2
 
3
3
  # CmPageBuilder::Rails
4
- This gem's purpose is to allow easy integration between the Commutatus react package cm-page-builder and any rails applications created by
4
+ This gem's purpose is to allow easy integration between the Commutatus javascript library [cm-page-builder](https://github.com/commutatus/cm-page-builder) and any Rails application that requires storing and editing content through Rails-rendered webpages.
5
5
 
6
- ## Usage
7
- To activate this module, add `include CmPageBuilder::Rails::HasCmContent` on top of any model file that should have an associated rich text field.
6
+ ## Requirements
7
+
8
+ * Rails 6+
9
+ * Webpacker must be enabled in the project
8
10
 
9
- ## Installation
10
11
 
12
+ ## Initial setup:
11
13
 
12
- ```ruby
13
- gem 'react-rails', '~> 2.6.0'
14
- gem 'cm_page_builder-rails'
15
- ```
14
+ * Add the following lines to the gemfile:
15
+ ```ruby
16
+ gem 'react-rails', '~> 2.6.0'
17
+ gem 'cm_page_builder-rails'
18
+ ```
19
+ And then execute:
20
+ ```bash
21
+ $ bundle
22
+ ```
23
+ * Follow all react-rails installation instructions (https://github.com/reactjs/react-rails)
24
+ *Important:* ensure that the `hello_world` example successfully works
16
25
 
17
- And then execute:
18
- ```bash
19
- $ bundle
20
- ```
26
+ * Add the javascript package with `yarn add cm-page-builder@1.2.69`
21
27
 
22
- Follow all react-rails installation instructions
28
+ * Run `rails cm_page_builder_rails:install:migrations`
23
29
 
24
- Then run `rails cm_page_builder_rails:install:migrations`
30
+ * In `config/routes.rb`, mount the endpoint with the line `mount CmPageBuilder::Rails::Engine => "/cm_page_builder"`
25
31
 
26
- In `config/routes.rb`, mount the endpoint with the line `mount CmPageBuilder::Rails::Engine => "/cm_page_builder"`
32
+ * Initialize the layout
33
+
34
+ ## Usage
35
+ This package comes with a concern, `CmPageBuilder::Rails::HasCmContent` `include CmPageBuilder::Rails::HasCmContent`
36
+ To activate this module, add `include CmPageBuilder::Rails::HasCmContent` on top of any model file that should have an associated rich text field.
27
37
 
28
38
  ### Setting up CORS for aws
29
39
  Do this or the direct upload capabilities won't work
@@ -39,12 +39,14 @@ module CmPageBuilder::Rails
39
39
  attachment = component.component_attachment.attachment
40
40
  return unless attachment
41
41
 
42
+ blob = attachment.blob
42
43
  attachment_data = {
43
44
  filename: attachment.filename.to_s,
44
- url: attachment.service_url
45
+ filesize: blob.byte_size,
46
+ url: Rails.application.routes.url_helpers.rails_blob_path(attachment, only_path: true)
45
47
  }
46
- if attachment.blob.variable?
47
- dimensions = attachment.blob.metadata
48
+ if blob.variable?
49
+ dimensions = blob.metadata
48
50
  dimensions['orientation'] =
49
51
  if dimensions['width'] > dimensions['height']
50
52
  'landscape'
@@ -1,5 +1,5 @@
1
1
  module CmPageBuilder
2
2
  module Rails
3
- VERSION = '0.1.12'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cm_page_builder-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Camilo Ernesto Forero Junco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-24 00:00:00.000000000 Z
11
+ date: 2020-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails