cm_page_builder-rails 0.1.12 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +25 -15
- data/app/models/cm_page_builder/rails/page.rb +5 -3
- data/lib/cm_page_builder/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 459dbee8f8a6d0f44b65f66680fbd49d4e80cb7d98c5e1c51c880d498bee4b6e
|
4
|
+
data.tar.gz: 6575bb5cec83a974583f8a9e3f9647f083aadab5b44545920bdbe10129f0f8e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac569b59270e994afffb4ba5f29369ed07548d34c6705e65b5f5cbe3407f9237f813d317d57c784d556d4960a33d13c469de35cbfc8de2276af5d282f75d39f3
|
7
|
+
data.tar.gz: 3a15e1030e9a41a8e81380dc9542026ed6ca614e6276379102b40a0175d9d845224651a656c4d124a15570b3df9267eea012531ffbf5944125b4d580627d3452
|
data/README.md
CHANGED
@@ -1,29 +1,39 @@
|
|
1
1
|
[](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
|
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
|
-
##
|
7
|
-
|
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
|
-
|
13
|
-
|
14
|
-
gem '
|
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
|
-
|
18
|
-
```bash
|
19
|
-
$ bundle
|
20
|
-
```
|
26
|
+
* Add the javascript package with `yarn add cm-page-builder@1.2.69`
|
21
27
|
|
22
|
-
|
28
|
+
* Run `rails cm_page_builder_rails:install:migrations`
|
23
29
|
|
24
|
-
|
30
|
+
* In `config/routes.rb`, mount the endpoint with the line `mount CmPageBuilder::Rails::Engine => "/cm_page_builder"`
|
25
31
|
|
26
|
-
|
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
|
-
|
45
|
+
filesize: blob.byte_size,
|
46
|
+
url: Rails.application.routes.url_helpers.rails_blob_path(attachment, only_path: true)
|
45
47
|
}
|
46
|
-
if
|
47
|
-
dimensions =
|
48
|
+
if blob.variable?
|
49
|
+
dimensions = blob.metadata
|
48
50
|
dimensions['orientation'] =
|
49
51
|
if dimensions['width'] > dimensions['height']
|
50
52
|
'landscape'
|
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.
|
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-
|
11
|
+
date: 2020-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|