hera_cms 0.4.0 → 1.0.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61489d8e9272b6b349d4adf98b8f9d75f7fab547c81a6df414e3d270ec9f03af
|
4
|
+
data.tar.gz: ca9fd9eaf966fb36f78e8c9eee6ad9a288318d2f5f6eb8c12b650bd3b044a2de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d900d357319ed1595b2853f78179494f6a9e0954d041704a7c5ceeb961fedf5cffe02e392486d9c9b28228ddce74111c0f4e89ea96991880185287c25c0c18
|
7
|
+
data.tar.gz: 4244ec5ab042cd5ebc651869f351c3c8efbc16e40a9e587ff3d085bb3c9d0d9df7d437e276202e936f92322234d61558218e31cc0d02a5daebc2984b3d7c8873
|
data/README.md
CHANGED
@@ -72,7 +72,6 @@ pry(main)> HeraCms::Link.create(identifier: 'home-link-main', inner_text: "Horta
|
|
72
72
|
Then you can just add it to the view using the Hera Link Helper, passing the correct identifier
|
73
73
|
|
74
74
|
```erb
|
75
|
-
<!-- app/views/pages/home.html.erb -->
|
76
75
|
<!-- ... -->
|
77
76
|
|
78
77
|
<%= hera_link 'home-link-main' %>
|
@@ -84,7 +83,6 @@ Then you can just add it to the view using the Hera Link Helper, passing the cor
|
|
84
83
|
Alternatively, you can create links passing a block, similar to the link_to rails helper
|
85
84
|
|
86
85
|
```erb
|
87
|
-
<!-- app/views/pages/home.html.erb -->
|
88
86
|
<!-- ... -->
|
89
87
|
|
90
88
|
<%= hera_link 'home-link-main', class: 'main-link' do %>
|
@@ -111,7 +109,6 @@ pry(main)> HeraCms::Text.create(identifier: 'home-description', inner_text: "The
|
|
111
109
|
Then you can just add it to the view using the Hera Text Helper, passing the correct identifier
|
112
110
|
|
113
111
|
```erb
|
114
|
-
<!-- app/views/pages/home.html.erb -->
|
115
112
|
<!-- ... -->
|
116
113
|
|
117
114
|
<%= hera_text 'home-description', html_tag: :p %>
|
@@ -122,7 +119,51 @@ Then you can just add it to the view using the Hera Text Helper, passing the cor
|
|
122
119
|
|
123
120
|
### Images
|
124
121
|
|
125
|
-
|
122
|
+
To use images that the owner can edit the SRC URL that will be displayed, it's almost the same as the other models
|
123
|
+
|
124
|
+
First you create the image in the rails console
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
# rails console
|
128
|
+
pry(main)> HeraCms::Image.create(identifier: 'tutorial-01', url: 'https://picsum.photos/200/300')
|
129
|
+
|
130
|
+
```
|
131
|
+
|
132
|
+
Then you add it to the view using the Hera Image Helper, passing the correct identifier
|
133
|
+
|
134
|
+
```erb
|
135
|
+
<!-- ... -->
|
136
|
+
|
137
|
+
<%= hera_image 'tutorial-01' %>
|
138
|
+
|
139
|
+
<!-- ... -->
|
140
|
+
|
141
|
+
```
|
142
|
+
|
143
|
+
#### Image uploads
|
144
|
+
|
145
|
+
Hera currently has support for Image uploads with Active Storage.
|
146
|
+
To enable the owner to change the editable Images by uploading new images, you first need to configure Active Storage properly, according to the [Active Storage Documentation](https://edgeguides.rubyonrails.org/active_storage_overview.html)
|
147
|
+
|
148
|
+
After Active Storage is properly set, you will need to update the HeraCms config file
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
# config/initializers/hera.rb
|
152
|
+
HeraCms.setup do |config|
|
153
|
+
config.image_upload = true
|
154
|
+
config.upload_service = :active_storage
|
155
|
+
end
|
156
|
+
|
157
|
+
```
|
158
|
+
|
159
|
+
And create an image with upload in the rails console
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
# rails console
|
163
|
+
pry(main)> image = HeraCms::Image.new(identifier: 'tutorial-02')
|
164
|
+
pry(main)> image.upload.attach(io: File.open(Rails.root.join('app/assets/images/logo.jpg')), filename: 'logo.jpg')
|
165
|
+
pry(main)> image.save
|
166
|
+
```
|
126
167
|
|
127
168
|
## Production Database
|
128
169
|
|
@@ -134,9 +175,9 @@ After you finish developing your application and want to build it in production,
|
|
134
175
|
rails hera_cms:populate_database
|
135
176
|
```
|
136
177
|
|
137
|
-
|
178
|
+
For the image uploads, you will have to re-attach your image files to your populated production images
|
138
179
|
|
139
|
-
|
180
|
+
## Contributing
|
140
181
|
|
141
182
|
If you want to contribute, feel free to open an issue or contact me at rayan@hortatech.com.br
|
142
183
|
|
@@ -12,7 +12,6 @@ class <%= migration_class_name %> < ActiveRecord::Migration<%= migration_version
|
|
12
12
|
|
13
13
|
create_table :hera_cms_images do |t|
|
14
14
|
t.string :identifier, default: ""
|
15
|
-
t.string :upload
|
16
15
|
t.string :url
|
17
16
|
t.string :classes, default: ""
|
18
17
|
t.string :style, default: ""
|
data/lib/hera_cms/version.rb
CHANGED