hera_cms 0.4.0 → 1.0.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: 7f4470fe55d225d68aa2bf7acc64e51bde8313ff8a8ab980fbf3ed026d984d32
4
- data.tar.gz: 459ba30e104ccb91cc80e1496467e315655933d2cb6f1a5cde8c43e35f56410e
3
+ metadata.gz: 61489d8e9272b6b349d4adf98b8f9d75f7fab547c81a6df414e3d270ec9f03af
4
+ data.tar.gz: ca9fd9eaf966fb36f78e8c9eee6ad9a288318d2f5f6eb8c12b650bd3b044a2de
5
5
  SHA512:
6
- metadata.gz: 5131b9167e0854d426538322d39f97c3b5b05fee5a4a4f03a2699e45c0474655b6d0785390de74540069fafe1dc4a716bb2be13d1a4d93e9b4a292891e3753f0
7
- data.tar.gz: a5813934ba73b6ef1874f2bbc48846caee3dac3a6dfdf50c0f7cc9773c7d448aead71d20f31d6a2d0177f539e4aa49851c09da44103c53641bb7456db4a14030
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
- Coming soon...
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
- ## Contributing
178
+ For the image uploads, you will have to re-attach your image files to your populated production images
138
179
 
139
- ---- GEM STILL IN DEVELOPMENT ----
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
 
@@ -2,7 +2,6 @@ class CreateHeraCmsImages < ActiveRecord::Migration[6.0]
2
2
  def change
3
3
  create_table :hera_cms_images do |t|
4
4
  t.string :identifier
5
- t.string :upload
6
5
  t.string :url
7
6
  t.string :classes, default: ""
8
7
  t.string :style, default: ""
@@ -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: ""
@@ -1,3 +1,3 @@
1
1
  module HeraCms
2
- VERSION = '0.4.0'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hera_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rayan Castro