promethee 1.5.4 → 1.6.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 +5 -5
- data/README.md +51 -0
- data/lib/promethee.rb +2 -2
- data/lib/promethee/core_ext/mapper.rb +9 -0
- data/lib/promethee/rails/version.rb +1 -1
- metadata +4 -5
- data/config/routes.rb +0 -7
- data/lib/promethee/configuration.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3f3343da331244a830c57574312d5182f16b7f7d2329096250a4eec41f091e50
|
4
|
+
data.tar.gz: 34226a84dc47694fcce5e4738c0a2ef2fa6261e486f3048fd40570b134bad428
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74df3572cd23faf57a5257891238828623944e5c5a5f5af3027f4ac05128264d2bd6bd928992b62774104b4feea17230fc0cc2313c1066e452cfbbddd74fa227
|
7
|
+
data.tar.gz: 0ddcbaf0a569b29a6f432713348260b6030eac55300b02d49ff9fbc6793111e623557703a062c4efbf32bc7863fa410395ac34e912faaf59ac1f0df39f91b24c
|
data/README.md
CHANGED
@@ -129,6 +129,19 @@ You can specify a back link url to go to when closing the editor without saving:
|
|
129
129
|
<% end %>
|
130
130
|
```
|
131
131
|
|
132
|
+
> In these examples, the `Page` model would need a migration adding a `data` column:
|
133
|
+
>
|
134
|
+
> ```ruby
|
135
|
+
> class AddDataToPages < ActiveRecord::Migration[5.2]
|
136
|
+
> def change
|
137
|
+
> add_column :pages, :data, :jsonb
|
138
|
+
>
|
139
|
+
> # Or, if jsonb isn't supported by your storage strategy:
|
140
|
+
> # add_column :pages, :data, :string
|
141
|
+
> end
|
142
|
+
> end
|
143
|
+
> ```
|
144
|
+
|
132
145
|
With javascript set:
|
133
146
|
```
|
134
147
|
//= require jquery
|
@@ -150,6 +163,8 @@ With stylesheets set:
|
|
150
163
|
@import 'promethee-edit'
|
151
164
|
```
|
152
165
|
|
166
|
+
> These require/import statements are quite flexible: if you already use gems or packages which include bootstrap, jquery, summernote... you're likely to be able to use them in place of those included in Prométhée.
|
167
|
+
|
153
168
|
#### The editor has components
|
154
169
|
|
155
170
|
The component is made of a show and and edit.
|
@@ -183,6 +198,42 @@ To register a component, the code is:
|
|
183
198
|
});
|
184
199
|
```
|
185
200
|
|
201
|
+
#### The editor needs routes to be defined
|
202
|
+
|
203
|
+
To provide preview and active storage management features, **Prométhée use a controller which have to be targeted by routes**. The gem provide a shortcut helper to achieve that:
|
204
|
+
|
205
|
+
```ruby
|
206
|
+
# config/routes.rb
|
207
|
+
|
208
|
+
Rails.application.routes.draw do
|
209
|
+
promethee
|
210
|
+
# Equivalent to:
|
211
|
+
# namespace :promethee do
|
212
|
+
# post 'preview' => 'promethee#preview', as: :preview
|
213
|
+
# post 'blob' => 'promethee#blob_create'
|
214
|
+
# get 'blob/:id' => 'promethee#blob_show'
|
215
|
+
# end
|
216
|
+
end
|
217
|
+
```
|
218
|
+
|
219
|
+
Since it's just a shortcut calling Rails native methods, this helper consider the route priority order (higher priority at the top, lower at the bottom).
|
220
|
+
|
221
|
+
You can specify the namespace path by providing a value to the `path` option:
|
222
|
+
|
223
|
+
```ruby
|
224
|
+
# config/routes.rb
|
225
|
+
|
226
|
+
Rails.application.routes.draw do
|
227
|
+
promethee path: 'admin/promethee'
|
228
|
+
# Equivalent to:
|
229
|
+
# namespace :promethee, path: 'admin/promethee', module: nil do
|
230
|
+
# post 'preview' => 'promethee#preview', as: :preview
|
231
|
+
# post 'blob' => 'promethee#blob_create'
|
232
|
+
# get 'blob/:id' => 'promethee#blob_show'
|
233
|
+
# end
|
234
|
+
end
|
235
|
+
```
|
236
|
+
|
186
237
|
#### The editor previews in an iframe
|
187
238
|
|
188
239
|
To be able to preview responsivity, there is a POST "promethee/preview" route.
|
data/lib/promethee.rb
CHANGED
@@ -16,10 +16,10 @@ module Promethee
|
|
16
16
|
require 'promethee/rails/version'
|
17
17
|
end
|
18
18
|
|
19
|
-
require 'promethee/core_ext/tags'
|
20
19
|
require 'promethee/core_ext/form_helper'
|
21
20
|
require 'promethee/core_ext/form_builder'
|
21
|
+
require 'promethee/core_ext/mapper'
|
22
|
+
require 'promethee/core_ext/tags'
|
22
23
|
|
23
|
-
require 'promethee/configuration'
|
24
24
|
require 'promethee/data'
|
25
25
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
ActionDispatch::Routing::Mapper.class_eval do
|
2
|
+
def promethee path: :promethee
|
3
|
+
namespace :promethee, path: path.to_s, module: nil do
|
4
|
+
post 'preview' => 'promethee#preview', as: :preview
|
5
|
+
post 'blob' => 'promethee#blob_create'
|
6
|
+
get 'blob/:id' => 'promethee#blob_show'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promethee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Dargelos
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2018-05-
|
16
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: rails
|
@@ -259,11 +259,10 @@ files:
|
|
259
259
|
- app/views/promethee/utils/_text-content-from-html.html.erb
|
260
260
|
- app/views/promethee/utils/_url-safe.html.erb
|
261
261
|
- config/initializers/assets.rb
|
262
|
-
- config/routes.rb
|
263
262
|
- lib/promethee.rb
|
264
|
-
- lib/promethee/configuration.rb
|
265
263
|
- lib/promethee/core_ext/form_builder.rb
|
266
264
|
- lib/promethee/core_ext/form_helper.rb
|
265
|
+
- lib/promethee/core_ext/mapper.rb
|
267
266
|
- lib/promethee/core_ext/tags.rb
|
268
267
|
- lib/promethee/data.rb
|
269
268
|
- lib/promethee/rails/engine.rb
|
@@ -359,7 +358,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
358
|
version: '0'
|
360
359
|
requirements: []
|
361
360
|
rubyforge_project:
|
362
|
-
rubygems_version: 2.6
|
361
|
+
rubygems_version: 2.7.6
|
363
362
|
signing_key:
|
364
363
|
specification_version: 4
|
365
364
|
summary: Bring fire to your page
|
data/config/routes.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
module Promethee
|
2
|
-
def self.configuration
|
3
|
-
@configuration ||= Configuration.new
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.configure
|
7
|
-
yield configuration
|
8
|
-
end
|
9
|
-
|
10
|
-
class Configuration
|
11
|
-
attr_accessor :route_scope
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
@route_scope = 'promethee'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|