promethee 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +164 -19
- data/Rakefile +33 -2
- data/app/assets/images/icon-promethee.png +0 -0
- data/app/assets/images/logo-promethee-horizontal.svg +14 -0
- data/app/assets/images/logo-promethee-vertical.svg +14 -0
- data/app/assets/javascripts/promethee.js +59 -0
- data/app/assets/javascripts/promethee/controller.js +22 -0
- data/app/assets/stylesheets/promethee-editor.sass +105 -0
- data/app/assets/stylesheets/promethee-editor/_mixins.sass +19 -0
- data/app/assets/stylesheets/promethee-editor/_variables.sass +4 -0
- data/app/assets/stylesheets/promethee.sass +4 -0
- data/app/views/promethee/_edit.html.erb +172 -0
- data/app/views/promethee/_show.html.erb +6 -0
- data/app/views/promethee/components/_column.html.erb +8 -0
- data/app/views/promethee/components/_column_edit.html.erb +40 -0
- data/app/views/promethee/components/_image.html.erb +7 -0
- data/app/views/promethee/components/_image_edit.html.erb +60 -0
- data/app/views/promethee/components/_index.html.erb +3 -0
- data/app/views/promethee/components/_index_edit.html.erb +7 -0
- data/app/views/promethee/components/_row.html.erb +6 -0
- data/app/views/promethee/components/_row_edit.html.erb +53 -0
- data/app/views/promethee/components/_show.html.erb +4 -0
- data/app/views/promethee/components/_show_edit.html.erb +3 -0
- data/app/views/promethee/components/_text.html.erb +6 -0
- data/app/views/promethee/components/_text_edit.html.erb +59 -0
- data/app/views/promethee/components/_video.html.erb +16 -0
- data/app/views/promethee/components/_video_edit.html.erb +63 -0
- data/app/views/promethee/partials/_toolbar_buttons.html.erb +4 -0
- data/lib/promethee.rb +37 -2
- data/lib/promethee/component.rb +28 -0
- data/lib/promethee/component/attribute.rb +42 -0
- data/lib/promethee/component/attribute/boolean.rb +4 -0
- data/lib/promethee/component/attribute/float.rb +3 -0
- data/lib/promethee/component/attribute/integer.rb +3 -0
- data/lib/promethee/component/attribute/string.rb +3 -0
- data/lib/promethee/component/attributes.rb +50 -0
- data/lib/promethee/component/attributes/definer.rb +13 -0
- data/lib/promethee/component/base.rb +68 -0
- data/lib/promethee/component/collection.rb +17 -0
- data/lib/promethee/component/column.rb +8 -0
- data/lib/promethee/component/image.rb +6 -0
- data/lib/promethee/component/row.rb +3 -0
- data/lib/promethee/component/text.rb +5 -0
- data/lib/promethee/component/video.rb +5 -0
- data/lib/promethee/core_ext/form_builder.rb +6 -0
- data/lib/promethee/core_ext/form_helper.rb +6 -0
- data/lib/promethee/core_ext/tags.rb +18 -0
- data/lib/promethee/grid.rb +52 -0
- data/lib/promethee/rails/engine.rb +7 -0
- data/lib/promethee/rails/helper.rb +26 -0
- data/lib/promethee/rails/version.rb +5 -0
- data/lib/tasks/promethee/promethee.rake +4 -0
- metadata +202 -20
- data/.gitignore +0 -9
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -6
- data/LICENSE +0 -21
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/promethee/version.rb +0 -3
- data/promethee.gemspec +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5329192fbb6d6dff5ce76400ea7d1e893a85d986
|
4
|
+
data.tar.gz: 252c1911ebeee040d1fdd554b227b497d770adb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63893b3d2074a7591666dca95e6ac011feff3602281e38c2965c3a18b930e3e2399c339a7d278a61b1771fb2bec60106da882272528486aa08d5c08588e79e43
|
7
|
+
data.tar.gz: 72ac5c6055d870b14ffe63341684e74b05b124a0b7fbc5baf7f3d676a4929695d1b9229b28c15187aac39962bd92d00e2aff97988ae2e242bfeb93dee0597e84
|
data/README.md
CHANGED
@@ -1,29 +1,44 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
![Prométhée](https://github.com/lespoupeesrusses/promethee/blob/master/app/assets/images/logo-promethee-vertical.svg)
|
2
|
+
|
3
|
+
# Bring fire to your page
|
4
|
+
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/98a8649f411bc9f50786/maintainability)](https://codeclimate.com/github/lespoupeesrusses/promethee/maintainability)
|
3
6
|
|
4
7
|
## Where does it come from?
|
5
|
-
As we
|
6
|
-
|
7
|
-
|
8
|
+
As we build sites and digital solutions for some of the most prestigious brands (Givenchy, L’Oréal, Lancôme, Cartier, Hermès…) we often need to build spectacular pages, with a responsive layout, using a predefined design system or visual guidelines. Very often, our clients need to be able to do some creation or adaptation on their own. And in most situation, it has to be translated very easily, with no technical cost.
|
9
|
+
|
10
|
+
Our first approach was to generate custom templates. For example, 10 years ago, before responsivity, we did a lot of multilingual content for Parfums Lolita Lempicka using a simple read/write system with something like 10 templates. We soon made a “Do what you feel” template, allowing the designer to put fields wherever he needed on the page, but it was completely unusable for people who lacked either design or development background.
|
11
|
+
|
12
|
+
We then built a system for Cartier, where the content was made by a designer, then implemented by a front end developer with keys allowing the translation. This was good because creation was very free, but the client could make no content on its own.
|
13
|
+
|
8
14
|
We built another tool for Diptyque, with content bricks that we assembled. Basically, it looked like vertical slides doing a nice one-page. It seemed like the perfect solution, but in the end it had so many options it became very hard to use, and still the different pages like quite similar.
|
9
|
-
|
15
|
+
|
16
|
+
Then came the page builder. Inspired by Divi, the idea was to offer rows and columns, based on bootstrap. We built that for Hermès, as one of the different components available to build pages. Translation was fine, responsivity was fine, content was not super simple to do, but still quite simple, and the use of presets provided a good “easy to use” solution.
|
17
|
+
|
10
18
|
We re-used the concept for Céline, and realized we had a mis-conception: the builder was the basic page editor, and we could add components in it.
|
19
|
+
|
11
20
|
As we needed the solution for 2 projects, and a third one coming, we decided to make it a gem.
|
21
|
+
|
12
22
|
Prométhée was born.
|
13
23
|
|
14
24
|
## What does it do?
|
15
25
|
It builds responsive pages!
|
26
|
+
|
16
27
|
There are 2 parts: the editor, which lets you build the pages, and the renderer. The pages are stored as json data, which can easily be added to a model in rails, and saved via a regular form.
|
17
28
|
|
18
29
|
## How does it relate to existing solutions?
|
19
|
-
tinymce / trix...
|
20
|
-
divi
|
21
|
-
semplice
|
22
|
-
shogun
|
23
30
|
|
31
|
+
### Regarding wysiwyg editors like tinymce, trix...
|
24
32
|
|
25
|
-
|
33
|
+
It's not only rich text: it lets you build complete pages, with a grid system.
|
26
34
|
|
35
|
+
### Regarding page builders like Divi, Semplice, Shogun
|
36
|
+
|
37
|
+
It's for Rails (unlike Divi or Semplice which are for Wordpress).
|
38
|
+
It's open source.
|
39
|
+
It does not provide as many options, as it's intended to be integrated in a website with specific brand guidelines through some custom css.
|
40
|
+
|
41
|
+
## Installation
|
27
42
|
Add this line to your application's Gemfile:
|
28
43
|
|
29
44
|
```ruby
|
@@ -31,27 +46,157 @@ gem 'promethee'
|
|
31
46
|
```
|
32
47
|
|
33
48
|
And then execute:
|
34
|
-
|
35
|
-
|
49
|
+
```bash
|
50
|
+
$ bundle
|
51
|
+
```
|
36
52
|
|
37
53
|
Or install it yourself as:
|
38
|
-
|
39
|
-
|
54
|
+
```bash
|
55
|
+
$ gem install promethee
|
56
|
+
```
|
40
57
|
|
41
58
|
## Usage
|
59
|
+
In this example, we have a page with a title (string) and a data (jsonb) attribute.
|
42
60
|
|
43
|
-
|
61
|
+
### Render
|
62
|
+
The data is:
|
44
63
|
|
45
|
-
|
64
|
+
```ruby
|
65
|
+
@page.data = [
|
66
|
+
{
|
67
|
+
type: 'row',
|
68
|
+
children: [
|
69
|
+
{
|
70
|
+
type: 'col',
|
71
|
+
attributes: {
|
72
|
+
size: 4,
|
73
|
+
offset: 0
|
74
|
+
},
|
75
|
+
children: [
|
76
|
+
{
|
77
|
+
type: 'text',
|
78
|
+
attributes: {
|
79
|
+
body: '<p><b>This</b> is a text</p>'
|
80
|
+
}
|
81
|
+
},
|
82
|
+
{
|
83
|
+
type: 'image',
|
84
|
+
attributes: {
|
85
|
+
src: 'https://c1.staticflickr.com/5/4089/4975306844_f849232195_b.jpg',
|
86
|
+
alt: 'Prométhée'
|
87
|
+
}
|
88
|
+
}
|
89
|
+
]
|
90
|
+
}
|
91
|
+
]
|
92
|
+
}
|
93
|
+
]
|
94
|
+
```
|
46
95
|
|
96
|
+
The view is:
|
97
|
+
|
98
|
+
```erb
|
99
|
+
<%= promethee @page.data %>
|
100
|
+
```
|
101
|
+
|
102
|
+
Which renders to:
|
103
|
+
|
104
|
+
```html
|
105
|
+
<div class="row promethee__component promethee__component--row">
|
106
|
+
<div class="col-md-4 promethee__component promethee__component--col">
|
107
|
+
<div class="promethee__component promethee__component--text">
|
108
|
+
<p><b>This</b> is a text</p>
|
109
|
+
</div>
|
110
|
+
<div class="promethee__component promethee__component--image">
|
111
|
+
<img src="https://c1.staticflickr.com/5/4089/4975306844_f849232195_b.jpg" alt="Prométhée">
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
```
|
116
|
+
|
117
|
+
### Editor
|
118
|
+
|
119
|
+
This would allow editing for a page model, with a jsonb data attribute:
|
120
|
+
|
121
|
+
```erb
|
122
|
+
<%= form_for @page do |f| %>
|
123
|
+
<%= f.promethee :data %>
|
124
|
+
<%= f.submit %>
|
125
|
+
<% end %>
|
126
|
+
```
|
127
|
+
|
128
|
+
This would do quite the same thing:
|
129
|
+
|
130
|
+
```erb
|
131
|
+
<form action="/pages" method="post">
|
132
|
+
<%= promethee_editor :page, :data, @page.data %>
|
133
|
+
<input type="submit">
|
134
|
+
</form>
|
135
|
+
```
|
136
|
+
|
137
|
+
#### The editor has components
|
138
|
+
|
139
|
+
The component is made of a show and and edit.
|
140
|
+
|
141
|
+
In the edit, the component description looks like:
|
142
|
+
```
|
143
|
+
{
|
144
|
+
name: 'Image',
|
145
|
+
thumb: 'http://via.placeholder.com/300x200',
|
146
|
+
data: {
|
147
|
+
type: 'image',
|
148
|
+
attributes: {
|
149
|
+
src: 'https://source.unsplash.com/random/1920x1080'
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
```
|
154
|
+
|
155
|
+
#### An editor in an iframe
|
156
|
+
|
157
|
+
At first, the editor was rendered in the view.
|
158
|
+
When trying to create a preview, it was impossible to manage responsivity, because it relies on the page width, and the page width does not change.
|
159
|
+
This is the first problem of the kind, but many others would follow: stylesheet conflicts, bootstrap parameters (number of columns...) conflicts, maybe javascript conflicts...
|
160
|
+
|
161
|
+
The solution is to put the editor in an iframe.
|
162
|
+
The editor creates an iframe.
|
163
|
+
The global scheme is illustrated in docs/iframe.html.
|
164
|
+
The idea is to create the angular app inside the iframe so it's completely independant.
|
165
|
+
Before the form is submit, we take the data from the angular app (through a plain javascript variable) and put it in the form input.
|
166
|
+
|
167
|
+
### Roadmap
|
168
|
+
- ~~Gem setup~~
|
169
|
+
- ~~renderer helper~~
|
170
|
+
- ~~editor helper (for form tag)~~
|
171
|
+
- ~~editor helper (for simple form)~~
|
172
|
+
- ~~Show Row~~
|
173
|
+
- ~~Show Col~~
|
174
|
+
- ~~Show Text~~
|
175
|
+
- ~~Show Image (http)~~
|
176
|
+
- ~~Show Video (http vimeo / youtube)~~
|
177
|
+
- ~~Edit Row~~
|
178
|
+
- ~~Edit Col~~
|
179
|
+
- ~~Edit Text~~
|
180
|
+
- ~~Edit Image (http)~~
|
181
|
+
- ~~Edit Video (http)~~
|
182
|
+
- Editor in iframe
|
183
|
+
- UI et branding
|
184
|
+
- Hooks (needed for image and video)
|
185
|
+
- Gallery
|
186
|
+
- Menu
|
187
|
+
- Tab
|
188
|
+
- Cover
|
189
|
+
- Chapter (or maybe it's a cover too?)
|
190
|
+
- Preview
|
191
|
+
- Fullscreen
|
192
|
+
|
193
|
+
## Development
|
47
194
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
48
195
|
|
49
196
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
50
197
|
|
51
198
|
## Contributing
|
52
|
-
|
53
199
|
Bug reports and pull requests are welcome on GitHub at https://github.com/arnaudlevy/promethee. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
54
200
|
|
55
201
|
## Code of Conduct
|
56
|
-
|
57
202
|
Everyone interacting in the Promethee project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/arnaudlevy/promethee/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,2 +1,33 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Promethee'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
require 'bundler/gem_tasks'
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'test'
|
28
|
+
t.pattern = 'test/**/*_test.rb'
|
29
|
+
t.verbose = false
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
task default: :test
|
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
+
<svg version="1.1" id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 390 116" style="enable-background:new 0 0 390 116;" xml:space="preserve">
|
4
|
+
<path fill="#ff9900" d="M79.2,28.8c-2-0.7-8.6-2.6-8.6-7.6c0,0-6,3.8,0.4,10.3c1,1.1,15.4,15.4-6.2,25.5,c6.1-15.5-5.2-26.5-5.2-26.5L51,21.2v66.5h-6.7v2.9H71v-2.9h-6.6V63.5c2.6-0.1,5.1-0.1,6.7-0.1c13,0,21.1-7.1,21.1-17.5,C92.2,38.3,87.6,32,79.2,28.8z"/>
|
5
|
+
<path d="M114.7,60h-8.1v10.3h-1.2v-23h9.2c4.2,0,6.8,2.5,6.8,6.4C121.4,57.3,118.7,60,114.7,60z M114.6,48.4h-8v10.3h8.1,c2.8,0,5.5-1.6,5.5-5.2C120.2,50.3,118.1,48.4,114.6,48.4z"/>
|
6
|
+
<path d="M148,70.2h-1.3c-0.3-0.6-0.5-1.4-0.5-2.5v-3.4c0-3.7-2.7-4.5-4.9-4.5h-8.5v10.3h-1.2v-23h9.7c4.3,0,6.9,2.5,6.9,6.4,c0,2.8-1.5,4.8-3.9,5.8c2,0.8,3.2,2.5,3.2,5v3.1C147.5,68.3,147.7,69.6,148,70.2z M146.9,53.5c0-3.3-2-5.1-5.6-5.1h-8.5v10.3h8.6,C144.2,58.7,146.9,57.1,146.9,53.5z"/>
|
7
|
+
<path d="M180,58.6c0,6.6-5.1,12-11.4,12c-6.3,0-11.4-5.4-11.4-12s5.1-12,11.4-12C175,46.6,180,51.8,180,58.6z M178.7,58.6,c0-6-4.5-10.8-10.1-10.8s-10.2,4.8-10.2,10.8s4.5,10.8,10.2,10.8C174.2,69.4,178.7,64.5,178.7,58.6z"/>
|
8
|
+
<path d="M212,70.2h-1.3V50l-8.8,20.2h-1.4L191.6,50v20.2h-1.2v-23h1.3l9.5,21.6l9.5-21.6h1.3L212,70.2L212,70.2z"/>
|
9
|
+
<path d="M225.3,57.5h12.6v1.2h-12.6V69h14v1.2H224v-23h15.3v1.2h-14V57.5z M232,44.8h-1.4l2.8-3.4h1.6L232,44.8z"/>
|
10
|
+
<path d="M256.6,48.4v21.8h-1.2V48.4h-7.7v-1.2h16.7v1.2H256.6L256.6,48.4z"/>
|
11
|
+
<path d="M291.9,70.2h-1.2V58.7h-15.5v11.5H274v-23h1.2v10.3h15.5V47.2h1.2L291.9,70.2L291.9,70.2z"/>
|
12
|
+
<path d="M305.2,57.5h12.6v1.2h-12.6V69h14v1.2H304v-23h15.3v1.2h-14L305.2,57.5L305.2,57.5z M312,44.8h-1.4l2.8-3.4h1.6L312,44.8z"/>
|
13
|
+
<path d="M331.7,57.5h12.6v1.2h-12.6V69h14v1.2h-15.3v-23h15.3v1.2h-14V57.5z"/>
|
14
|
+
</svg>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 500 340" style="enable-background:new 0 0 500 340;" xml:space="preserve">
|
4
|
+
<path fill="#ff9900" d="M263.6,96.1c-2.5-1-10.8-3.2-10.8-9.5c0,0-7.5,4.8,0.4,12.9c1.3,1.4,19.3,19.2-7.8,31.9,c7.6-19.3-6.5-33.2-6.5-33.2l-10.6-11.6v49.6l-0.2,8.4v25.3H220v3.7h33.5V170h-8.2v-30.3c3.2-0.1,6.4-0.2,8.4-0.2,c16.3,0,26.3-8.8,26.3-21.8C280,107.9,274.1,100.1,263.6,96.1z"/>
|
5
|
+
<path d="M99.6,227.5h-11v13.9H87v-31.3h12.5c5.7,0,9.3,3.3,9.3,8.7C108.8,223.9,105,227.5,99.6,227.5z M99.5,211.8H88.6v14h11,c3.7,0,7.5-2.2,7.5-7C107.1,214.4,104.3,211.8,99.5,211.8z"/>
|
6
|
+
<path d="M144.8,241.4h-1.7c-0.4-0.9-0.6-1.9-0.6-3.4v-4.6c0-5-3.6-6-6.6-6h-11.6v14h-1.7v-31.3h13.2c5.8,0,9.3,3.3,9.3,8.7,c0,3.7-2,6.6-5.2,7.8c2.8,1,4.3,3.4,4.3,6.9v4.1C144.2,238.8,144.5,240.5,144.8,241.4z M143.4,218.8c0-4.4-2.8-7-7.6-7h-11.5v14,H136C139.7,225.8,143.4,223.6,143.4,218.8z"/>
|
7
|
+
<path d="M188.3,225.6c0,9-6.9,16.3-15.5,16.3s-15.5-7.3-15.5-16.3s6.9-16.3,15.5-16.3C181.6,209.4,188.3,216.5,188.3,225.6z M186.6,225.6c0-8.2-6-14.6-13.8-14.6c-7.6,0-13.8,6.6-13.8,14.6c0,8.1,6.2,14.7,13.8,14.7C180.5,240.3,186.6,233.7,186.6,225.6z"/>
|
8
|
+
<path d="M231.7,241.4H230V214l-12,27.4h-1.8l-12-27.4v27.4h-1.7v-31.3h1.8l12.9,29.3l12.9-29.3h1.8v31.3H231.7z"/>
|
9
|
+
<path d="M249.8,224.2h17.1v1.6h-17.1v13.9h19.1v1.7h-20.7v-31.3h20.7v1.7h-19.1L249.8,224.2L249.8,224.2z M259,206.9h-1.8l3.8-4.6,h2.1L259,206.9z"/>
|
10
|
+
<path d="M292.3,211.8v29.6h-1.7v-29.6h-10.5v-1.7h22.7v1.7H292.3z"/>
|
11
|
+
<path d="M340.2,241.4h-1.7v-15.6h-21v15.6h-1.7v-31.3h1.7v14h21v-14h1.7V241.4z"/>
|
12
|
+
<path d="M358.4,224.2h17.1v1.6h-17.1v13.9h19.1v1.7h-20.7v-31.3h20.7v1.7h-19.1V224.2z M367.6,206.9h-1.8l3.8-4.6h2.1L367.6,206.9z"/>
|
13
|
+
<path d="M394.3,224.2h17.1v1.6h-17.1v13.9h19.1v1.7h-20.7v-31.3h20.7v1.7h-19.1V224.2z"/>
|
14
|
+
</svg>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
//= require tinymce
|
2
|
+
//= require jquery
|
3
|
+
//= require bootstrap
|
4
|
+
//= require angular
|
5
|
+
//= require angular-ui-tinymce-rails
|
6
|
+
//= require angular-drag-and-drop-lists
|
7
|
+
//= require_self
|
8
|
+
//= require_tree './promethee'
|
9
|
+
|
10
|
+
Promethee = function(id, data) {
|
11
|
+
this.id = id;
|
12
|
+
this.data = data;
|
13
|
+
};
|
14
|
+
|
15
|
+
Promethee.prototype = {
|
16
|
+
constructor: Promethee,
|
17
|
+
dependencies: ['ui.tinymce', 'dndLists'],
|
18
|
+
|
19
|
+
get app() {
|
20
|
+
if(!this.initialized) this.initialize();
|
21
|
+
return this._app;
|
22
|
+
},
|
23
|
+
|
24
|
+
get initialized() {
|
25
|
+
return !!this._app;
|
26
|
+
},
|
27
|
+
|
28
|
+
initialize: function() {
|
29
|
+
this._app = angular
|
30
|
+
.module(this.id, this.dependencies)
|
31
|
+
.constant('promethee', this)
|
32
|
+
.value('state', {
|
33
|
+
editing: false
|
34
|
+
})
|
35
|
+
|
36
|
+
this.app.filter('htmlSafe', ['$sce', function($sce) {
|
37
|
+
return function(val) {
|
38
|
+
return $sce.trustAsHtml(val);
|
39
|
+
};
|
40
|
+
}]);
|
41
|
+
|
42
|
+
this.app.filter('urlSafe', ['$sce', function($sce) {
|
43
|
+
return function(val) {
|
44
|
+
return $sce.trustAsResourceUrl(val);
|
45
|
+
};
|
46
|
+
}]);
|
47
|
+
|
48
|
+
this.app.filter('humanize', function() {
|
49
|
+
return function(val) {
|
50
|
+
val = (val + '').replace(/_/g, ' ').replace(/([A-Z])/g, ' $1').replace(/\s\s+/, ' ').trim();
|
51
|
+
return val[0].toUpperCase() + val.substring(1).toLowerCase();
|
52
|
+
};
|
53
|
+
});
|
54
|
+
|
55
|
+
this.constructor.Controller.initialize(this);
|
56
|
+
|
57
|
+
Promethee.app = this.app;
|
58
|
+
}
|
59
|
+
};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Promethee.Controller = function(name, initializer) {
|
2
|
+
this.name = name;
|
3
|
+
this.initializer = initializer;
|
4
|
+
};
|
5
|
+
|
6
|
+
Promethee.Controller.prototype = {
|
7
|
+
constructor: Promethee.Controller,
|
8
|
+
|
9
|
+
initialize: function(promethee) {
|
10
|
+
promethee.app.controller(this.name, this.initializer);
|
11
|
+
}
|
12
|
+
};
|
13
|
+
|
14
|
+
Promethee.Controller.controllers = {};
|
15
|
+
|
16
|
+
Promethee.Controller.for = function(name, initializer) {
|
17
|
+
this.controllers[name] = new this(name, initializer);
|
18
|
+
};
|
19
|
+
|
20
|
+
Promethee.Controller.initialize = function(promethee) {
|
21
|
+
for(var name in this.controllers) this.controllers[name].initialize(promethee);
|
22
|
+
};
|
@@ -0,0 +1,105 @@
|
|
1
|
+
@import 'bootstrap'
|
2
|
+
|
3
|
+
@import 'promethee-editor/variables'
|
4
|
+
@import 'font-awesome.css'
|
5
|
+
@import 'material_icons.css'
|
6
|
+
@import 'promethee-editor/mixins'
|
7
|
+
|
8
|
+
$promethee-color: #ff9900
|
9
|
+
|
10
|
+
.promethee-editor
|
11
|
+
+grid-builder-set-gutter-width(0)
|
12
|
+
|
13
|
+
background: white
|
14
|
+
|
15
|
+
.navbar
|
16
|
+
border-radius: 0
|
17
|
+
border: none
|
18
|
+
border-bottom: 2px solid $promethee-color
|
19
|
+
background: transparent
|
20
|
+
|
21
|
+
.dndPlaceholder
|
22
|
+
height: 30px
|
23
|
+
border: 2px dotted transparentize($promethee-color, .5)
|
24
|
+
list-style: none
|
25
|
+
margin: 6px
|
26
|
+
|
27
|
+
&__page
|
28
|
+
margin-left: -6px
|
29
|
+
margin-right: -6px
|
30
|
+
|
31
|
+
&--preview
|
32
|
+
.promethee-editor__toolbar
|
33
|
+
display: none
|
34
|
+
.promethee-editor__component
|
35
|
+
border: none
|
36
|
+
margin: 0
|
37
|
+
.promethee-editor__page
|
38
|
+
margin: 0 auto
|
39
|
+
&--mobile
|
40
|
+
.promethee-editor__page
|
41
|
+
width: 375px
|
42
|
+
border-left: 1px dotted #eee
|
43
|
+
border-right: 1px dotted #eee
|
44
|
+
&--tablet
|
45
|
+
.promethee-editor__page
|
46
|
+
width: 768px
|
47
|
+
border-left: 1px dotted #eee
|
48
|
+
border-right: 1px dotted #eee
|
49
|
+
|
50
|
+
&__sidebar
|
51
|
+
background: $promethee-light-grey
|
52
|
+
width: 300px
|
53
|
+
flex-grow: 0
|
54
|
+
flex-shrink: 0
|
55
|
+
|
56
|
+
&__content
|
57
|
+
flex-grow: 1
|
58
|
+
flex-shrink: 1
|
59
|
+
|
60
|
+
&__components
|
61
|
+
min-height: 30px
|
62
|
+
|
63
|
+
&__component
|
64
|
+
background: #fff
|
65
|
+
border: 1px solid #eee
|
66
|
+
margin: 6px
|
67
|
+
overflow: auto
|
68
|
+
|
69
|
+
&--text
|
70
|
+
.mce-tinymce
|
71
|
+
border: none
|
72
|
+
|
73
|
+
.mce-panel
|
74
|
+
border-top-color: $promethee-transparent-grey
|
75
|
+
|
76
|
+
.mce-btn-group:not(:first-child)
|
77
|
+
border-left-color: $promethee-transparent-grey
|
78
|
+
|
79
|
+
.mce-top-part::before
|
80
|
+
box-shadow: none
|
81
|
+
|
82
|
+
&--final
|
83
|
+
background: #fff
|
84
|
+
|
85
|
+
&__toolbar
|
86
|
+
background: #fff
|
87
|
+
padding: 10px
|
88
|
+
font-size: 11px
|
89
|
+
text-transform: uppercase
|
90
|
+
font-weight: bold
|
91
|
+
color: $promethee-color
|
92
|
+
&, *
|
93
|
+
user-select: none
|
94
|
+
cursor: move
|
95
|
+
|
96
|
+
&__wrapper
|
97
|
+
padding: 10px
|
98
|
+
|
99
|
+
&.fullscreen
|
100
|
+
position: fixed
|
101
|
+
left: 0
|
102
|
+
right: 0
|
103
|
+
bottom: 0
|
104
|
+
top: 0
|
105
|
+
overflow: auto
|