promethee 1.2.3 → 1.2.4
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 +4 -4
- data/README.md +43 -6
- data/app/views/promethee/components/cover/_edit.write.html.erb +1 -1
- data/lib/promethee/data.rb +17 -3
- data/lib/promethee/rails/version.rb +1 -1
- metadata +2 -30
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 44d867fcd71fae583eb50ba8eb6593eaa1162c7e
         | 
| 4 | 
            +
              data.tar.gz: 324128142799a00e45d000b25967c3edc01722c4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 1c73fe2e2d4d7b37b52195ca9d57147b5a059fbf9dbc5d5a245640deb098340fe87d20081af53bcbc59217e96d823bf047e3f3224cb5e895bcb8ec06315fd5c1
         | 
| 7 | 
            +
              data.tar.gz: 0db18fd16d4ff3d2fed9cd413aff093c4393afddce21e602d21a25cac8241843e607a1a499d93b30d8d3222cf56b76c77ecb36a219a65b37cdc494b1969ba745
         | 
    
        data/README.md
    CHANGED
    
    | @@ -132,8 +132,6 @@ With javascript set: | |
| 132 132 | 
             
            //= require angular-animate
         | 
| 133 133 | 
             
            //= require angular-ui-bootstrap
         | 
| 134 134 | 
             
            //= require angular-summernote
         | 
| 135 | 
            -
            //= require promethee
         | 
| 136 | 
            -
            //= require promethee-edit
         | 
| 137 135 | 
             
            ```
         | 
| 138 136 |  | 
| 139 137 | 
             
            With stylesheets set:
         | 
| @@ -248,6 +246,45 @@ This would do quite the same thing: | |
| 248 246 | 
             
              <input type="submit">
         | 
| 249 247 | 
             
            </form>
         | 
| 250 248 | 
             
            ```
         | 
| 249 | 
            +
             | 
| 250 | 
            +
            ## Database 
         | 
| 251 | 
            +
             | 
| 252 | 
            +
            ### PostgreSQL
         | 
| 253 | 
            +
             | 
| 254 | 
            +
            To generate the standard models, you might use this:
         | 
| 255 | 
            +
            ```
         | 
| 256 | 
            +
            rails g scaffold Page title:string data:jsonb
         | 
| 257 | 
            +
            rails g scaffold Localization page:references data:jsonb
         | 
| 258 | 
            +
            ```
         | 
| 259 | 
            +
            Usually, the Localization will reference a language or a locale, or maybe use a locale stored as a String ("fr-FR").
         | 
| 260 | 
            +
             | 
| 261 | 
            +
            Add the null false, default '{}' like this:
         | 
| 262 | 
            +
            ```
         | 
| 263 | 
            +
            class CreatePages < ActiveRecord::Migration[5.1]
         | 
| 264 | 
            +
              def change
         | 
| 265 | 
            +
                create_table :pages do |t|
         | 
| 266 | 
            +
                  t.string :title
         | 
| 267 | 
            +
                  t.jsonb :data, null: false, default: {}
         | 
| 268 | 
            +
             | 
| 269 | 
            +
                  t.timestamps
         | 
| 270 | 
            +
                end
         | 
| 271 | 
            +
              end
         | 
| 272 | 
            +
            end
         | 
| 273 | 
            +
            ```
         | 
| 274 | 
            +
            and this:
         | 
| 275 | 
            +
            ```
         | 
| 276 | 
            +
            class CreateLocalizations < ActiveRecord::Migration[5.1]
         | 
| 277 | 
            +
              def change
         | 
| 278 | 
            +
                create_table :localizations do |t|
         | 
| 279 | 
            +
                  t.references :page, foreign_key: true
         | 
| 280 | 
            +
                  t.jsonb :data, null: false, default: {}
         | 
| 281 | 
            +
             | 
| 282 | 
            +
                  t.timestamps
         | 
| 283 | 
            +
                end
         | 
| 284 | 
            +
              end
         | 
| 285 | 
            +
            end
         | 
| 286 | 
            +
            ```
         | 
| 287 | 
            +
             | 
| 251 288 | 
             
            ### SQLite (or other not native json storage)
         | 
| 252 289 |  | 
| 253 290 | 
             
            Prométhée takes a ruby hash.
         | 
| @@ -276,6 +313,10 @@ JSON.parse(data, symbolize_names: true) | |
| 276 313 | 
             
            - ~~Preview in iframe~~
         | 
| 277 314 | 
             
            - ~~Preview~~
         | 
| 278 315 | 
             
            - ~~Fullscreen~~
         | 
| 316 | 
            +
            - ~~Cover~~
         | 
| 317 | 
            +
            - ~~Chapter (or maybe it's a cover too? *Yes it is, but see next line*)~~
         | 
| 318 | 
            +
            - ~~Grid background helper~
         | 
| 319 | 
            +
            - Section (in order to organize page contents within distincts parts which can be referenced. eg: scrollspy, hyperlink, tabs, ...)
         | 
| 279 320 | 
             
            - Hooks (needed for image and video)
         | 
| 280 321 | 
             
            - promethee-i18n
         | 
| 281 322 | 
             
            - Component versioning
         | 
| @@ -285,11 +326,7 @@ JSON.parse(data, symbolize_names: true) | |
| 285 326 | 
             
            - Menu
         | 
| 286 327 | 
             
            - Tab
         | 
| 287 328 | 
             
            - Better col sizing/positioning UX
         | 
| 288 | 
            -
            - Grid background helper
         | 
| 289 329 | 
             
            - File upload?
         | 
| 290 | 
            -
            - ~~Cover~~
         | 
| 291 | 
            -
            - ~~Chapter (or maybe it's a cover too? *Yes it is, but see next line*)~~
         | 
| 292 | 
            -
            - Section (in order to organize page contents within distincts parts which can be referenced. eg: scrollspy, hyperlink, tabs, ...)
         | 
| 293 330 | 
             
            - Utils rake tasks (generate, destroy, override, ...)
         | 
| 294 331 | 
             
            - Doc (to be updated in terms of the new component concept and structure)
         | 
| 295 332 |  | 
    
        data/lib/promethee/data.rb
    CHANGED
    
    | @@ -3,7 +3,8 @@ module Promethee | |
| 3 3 | 
             
              class Data
         | 
| 4 4 | 
             
                def initialize(data, options = {})
         | 
| 5 5 | 
             
                  @master_data = hashify data
         | 
| 6 | 
            -
                  @localization_data_raw = hashify | 
| 6 | 
            +
                  @localization_data_raw = hashify(options[:localization_data]) if options.include? :localization_data
         | 
| 7 | 
            +
                  check_master_integrity
         | 
| 7 8 | 
             
                  prepare_localization_data
         | 
| 8 9 | 
             
                  localize_master_data
         | 
| 9 10 | 
             
                end
         | 
| @@ -23,8 +24,21 @@ module Promethee | |
| 23 24 |  | 
| 24 25 | 
             
                protected
         | 
| 25 26 |  | 
| 26 | 
            -
                def hashify( | 
| 27 | 
            -
                   | 
| 27 | 
            +
                def hashify(data)
         | 
| 28 | 
            +
                  case data.class.to_s
         | 
| 29 | 
            +
                  when 'Hash'
         | 
| 30 | 
            +
                    h = data
         | 
| 31 | 
            +
                  when 'String'
         | 
| 32 | 
            +
                    h = JSON.parse data
         | 
| 33 | 
            +
                  when 'NilClass'
         | 
| 34 | 
            +
                    h = {}
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
                  h.deep_symbolize_keys
         | 
| 37 | 
            +
                end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                def check_master_integrity
         | 
| 40 | 
            +
                  @master_data[:version] = 1 unless @master_data.include? :version
         | 
| 41 | 
            +
                  @master_data[:children] = [] unless @master_data.include? :children 
         | 
| 28 42 | 
             
                end
         | 
| 29 43 |  | 
| 30 44 | 
             
                # We merge the localization data in the components from the master data.
         | 
    
        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.2. | 
| 4 | 
            +
              version: 1.2.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Julien Dargelos
         | 
| @@ -11,7 +11,7 @@ authors: | |
| 11 11 | 
             
            autorequire: 
         | 
| 12 12 | 
             
            bindir: bin
         | 
| 13 13 | 
             
            cert_chain: []
         | 
| 14 | 
            -
            date: 2018-01- | 
| 14 | 
            +
            date: 2018-01-19 00:00:00.000000000 Z
         | 
| 15 15 | 
             
            dependencies:
         | 
| 16 16 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 17 17 | 
             
              name: rails
         | 
| @@ -167,20 +167,6 @@ dependencies: | |
| 167 167 | 
             
                - - ">="
         | 
| 168 168 | 
             
                  - !ruby/object:Gem::Version
         | 
| 169 169 | 
             
                    version: '0'
         | 
| 170 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 171 | 
            -
              name: sqlite3
         | 
| 172 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 173 | 
            -
                requirements:
         | 
| 174 | 
            -
                - - ">="
         | 
| 175 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 176 | 
            -
                    version: '0'
         | 
| 177 | 
            -
              type: :development
         | 
| 178 | 
            -
              prerelease: false
         | 
| 179 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 180 | 
            -
                requirements:
         | 
| 181 | 
            -
                - - ">="
         | 
| 182 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 183 | 
            -
                    version: '0'
         | 
| 184 170 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 185 171 | 
             
              name: byebug
         | 
| 186 172 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -195,20 +181,6 @@ dependencies: | |
| 195 181 | 
             
                - - ">="
         | 
| 196 182 | 
             
                  - !ruby/object:Gem::Version
         | 
| 197 183 | 
             
                    version: '0'
         | 
| 198 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 199 | 
            -
              name: annotate
         | 
| 200 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 201 | 
            -
                requirements:
         | 
| 202 | 
            -
                - - ">="
         | 
| 203 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 204 | 
            -
                    version: '0'
         | 
| 205 | 
            -
              type: :development
         | 
| 206 | 
            -
              prerelease: false
         | 
| 207 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 208 | 
            -
                requirements:
         | 
| 209 | 
            -
                - - ">="
         | 
| 210 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 211 | 
            -
                    version: '0'
         | 
| 212 184 | 
             
            description: 
         | 
| 213 185 | 
             
            email:
         | 
| 214 186 | 
             
            - contact@juliendargelos.com
         |