![Prométhée](https://github.com/lespoupeesrusses/promethee/blob/master/app/assets/images/logo-promethee-vertical.svg) # Bring fire to your page [![Maintainability](https://api.codeclimate.com/v1/badges/98a8649f411bc9f50786/maintainability)](https://codeclimate.com/github/lespoupeesrusses/promethee/maintainability) ## Where does it come from? 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. 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. 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. 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. 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. 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. As we needed the solution for 2 projects, and a third one coming, we decided to make it a gem. Prométhée was born. ## What does it do? It builds responsive pages! 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. ## How does it relate to existing solutions? ### Regarding wysiwyg editors like tinymce, trix... It's not only rich text: it lets you build complete pages, with a grid system. ### Regarding page builders like Divi, Semplice, Shogun It's for Rails (unlike Divi or Semplice which are for Wordpress). It's open source. 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. ## Installation Add this line to your application's Gemfile: ```ruby gem 'promethee' ``` And then execute: ```bash $ bundle ``` Or install it yourself as: ```bash $ gem install promethee ``` ## Usage In this example, we have a page with a title (string) and a data (jsonb) attribute. ### Render The data is: ```ruby @page.data = { id: 'ero342ezr', type: 'page', version: 1, children: [ { id: '7lebjl4j6', type: 'row', version: 1, children: [ { id: '8lebjl4j6', type: 'column', version: 1, attributes: { size: 4, offset: 0 }, children: [ { id: '9lebjl4j6', type: 'text', version: 1, attributes: { body: '
This is a text
' } }, { id: '12lebjl4j6', type: 'image', version: 1, attributes: { src: 'https://c1.staticflickr.com/5/4089/4975306844_f849232195_b.jpg', alt: 'Prométhée' } } ] } ] } ] } ``` The view is: ```erb <%= promethee @page.data %> ``` Which renders to: ```htmlThis is a text
Ceci est un texte
' } } ] } ``` The view is: ```erb <%= promethee @page.data, l: @localization.data %> ``` Which renders to: ```htmlCeci est un texte