neofiles 2.0.4 → 2.2.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 +11 -0
- data/app/assets/javascripts/neofiles/index.webpack.js +3 -0
- data/app/assets/stylesheets/neofiles/neofiles.css.scss +3 -3
- data/app/controllers/neofiles/admin_controller.rb +2 -1
- data/app/models/neofiles/data_store/amazon_s3.rb +16 -7
- data/app/views/neofiles/admin/_file_compact.html.haml +11 -5
- data/lib/neofiles/engine.rb +2 -0
- data/lib/neofiles/version.rb +1 -1
- metadata +7 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 | 
            -
             | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 2 | 
            +
            SHA256:
         | 
| 3 | 
            +
              metadata.gz: 2043db724bbdbcf8227ff75527303fbb3df314cd2cb915e199f8b1fe9f8f4f6f
         | 
| 4 | 
            +
              data.tar.gz: dcf7b597d8456dddca82fa67f7e5d436a7fd64d5165a4a7f2378ad0ead2776a2
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3211ac84d144c6695bdcd0e894ba7a9a297e134ad051ba445ce7fc1a336970d355590d18cb35a9102c0ff38f37f9f97bdd2c68d55fe7849280f58c73c08139f7
         | 
| 7 | 
            +
              data.tar.gz: a6b508101bd201c0b01e464f05aedd7c00f8a0bcfc4cfeeb4cec490e05d103c3661068f00229d2ce8989b4652254012eacff6cc3fe5d364e067d9c5899df5ba1
         | 
    
        data/README.md
    CHANGED
    
    | @@ -403,6 +403,17 @@ config.neofiles.image_max_crop_height = 2000 # users can request resizing only u | |
| 403 403 | 
             
            config.neofiles.watermarker = ->(image, no_watermark: false, watermark_width:, watermark_height:) do
         | 
| 404 404 | 
             
              ...
         | 
| 405 405 | 
             
            end
         | 
| 406 | 
            +
             | 
| 407 | 
            +
            # picture when added is displayed on the right or left
         | 
| 408 | 
            +
            # also affects the order of displaying pictures
         | 
| 409 | 
            +
            config.neofiles.album_append_create_side = :left
         | 
| 410 | 
            +
             | 
| 411 | 
            +
            # Amazon S3 settings
         | 
| 412 | 
            +
            config.neofiles.amazon_s3_region = 'us-east'
         | 
| 413 | 
            +
            config.neofiles.amazon_s3_api = 'KEY_ID'
         | 
| 414 | 
            +
            config.neofiles.amazon_s3_secret = 'KEY_SECRET'
         | 
| 415 | 
            +
            config.neofiles.amazon_s3_bucket = 'neofiles_prod'
         | 
| 416 | 
            +
            config.neofiles.amazon_s3_endpoint = 'https://some-s3-provider.com' # optional
         | 
| 406 417 | 
             
            ```
         | 
| 407 418 |  | 
| 408 419 | 
             
            Roadmap, TODOs
         | 
| @@ -40,7 +40,7 @@ | |
| 40 40 | 
             
                opacity: 1;
         | 
| 41 41 | 
             
              }
         | 
| 42 42 |  | 
| 43 | 
            -
              . | 
| 43 | 
            +
              .fas {
         | 
| 44 44 | 
             
                top: 0;
         | 
| 45 45 | 
             
              }
         | 
| 46 46 |  | 
| @@ -69,7 +69,7 @@ | |
| 69 69 | 
             
              box-shadow: 0px 2px 2px rgba(90, 50, 50, .5);
         | 
| 70 70 | 
             
              opacity: .2;
         | 
| 71 71 |  | 
| 72 | 
            -
              . | 
| 72 | 
            +
              .fas {
         | 
| 73 73 | 
             
                top: 1px;
         | 
| 74 74 | 
             
                font-size: 12px;
         | 
| 75 75 | 
             
                line-height: 12px;
         | 
| @@ -146,4 +146,4 @@ INPUT.neofiles-image-compact-file { | |
| 146 146 | 
             
              &.neofiles-image-compact-with-description {
         | 
| 147 147 | 
             
                margin-bottom: 50px;
         | 
| 148 148 | 
             
              }
         | 
| 149 | 
            -
            }
         | 
| 149 | 
            +
            }
         | 
| @@ -107,7 +107,8 @@ class Neofiles::AdminController < ApplicationController | |
| 107 107 |  | 
| 108 108 | 
             
                result = []
         | 
| 109 109 | 
             
                file_objects.each_with_index do |file, i|
         | 
| 110 | 
            -
                   | 
| 110 | 
            +
                  append_create_position = Rails.application.config.neofiles.album_append_create_side == :left ? i == 0 : i == file_objects.count - 1
         | 
| 111 | 
            +
                  result << file_compact(data.merge(id: file.id, widget_id: "#{data[:widget_id]}_ap_#{i}", append_create: append_create_position && !old_file && data[:append_create] == '1' ? '1' : '0'))
         | 
| 111 112 | 
             
                end
         | 
| 112 113 |  | 
| 113 114 | 
             
                if result.empty?
         | 
| @@ -2,6 +2,7 @@ | |
| 2 2 | 
             
            # If you want to work with amazon s3 you need set values for the following parameters in your config file
         | 
| 3 3 | 
             
            # amazon_s3_region - the AWS region to connect to. The region is used to construct the client endpoint.
         | 
| 4 4 | 
             
            # amazon_s3_api, amazon_s3_secret - used to set credentials statically
         | 
| 5 | 
            +
            # amazon_s3_endpoint - change if using another S3-compatible provider
         | 
| 5 6 | 
             
            # bucket_name - storage name in amazon_s3. Bucket must have a name that conforms to the naming requirements for non-US Standard regions.
         | 
| 6 7 | 
             
            # http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html
         | 
| 7 8 | 
             
            # File will be named as id of the Neofiles::File object
         | 
| @@ -81,15 +82,23 @@ class Neofiles::DataStore::AmazonS3 | |
| 81 82 | 
             
              end
         | 
| 82 83 |  | 
| 83 84 | 
             
              def client
         | 
| 84 | 
            -
                @client ||= Aws::S3::Client.new(
         | 
| 85 | 
            -
                    region: Rails.application.config.neofiles.amazon_s3_region,
         | 
| 86 | 
            -
                    credentials: Aws::Credentials.new(
         | 
| 87 | 
            -
                        Rails.application.config.neofiles.amazon_s3_api,
         | 
| 88 | 
            -
                        Rails.application.config.neofiles.amazon_s3_secret
         | 
| 89 | 
            -
                    )
         | 
| 90 | 
            -
                )
         | 
| 85 | 
            +
                @client ||= Aws::S3::Client.new(client_params)
         | 
| 91 86 | 
             
              rescue Aws::S3::Errors::ServiceError
         | 
| 92 87 | 
             
                nil
         | 
| 93 88 | 
             
              end
         | 
| 94 89 |  | 
| 90 | 
            +
              def client_params
         | 
| 91 | 
            +
                {
         | 
| 92 | 
            +
                  region: Rails.application.config.neofiles.amazon_s3_region,
         | 
| 93 | 
            +
                  credentials: Aws::Credentials.new(
         | 
| 94 | 
            +
                    Rails.application.config.neofiles.amazon_s3_api,
         | 
| 95 | 
            +
                    Rails.application.config.neofiles.amazon_s3_secret
         | 
| 96 | 
            +
                  )
         | 
| 97 | 
            +
                }.tap do |result|
         | 
| 98 | 
            +
                  if Rails.application.config.neofiles.amazon_s3_endpoint
         | 
| 99 | 
            +
                    result[:endpoint] = Rails.application.config.neofiles.amazon_s3_endpoint
         | 
| 100 | 
            +
                  end
         | 
| 101 | 
            +
                end
         | 
| 102 | 
            +
              end
         | 
| 103 | 
            +
             | 
| 95 104 | 
             
            end
         | 
| @@ -2,6 +2,11 @@ | |
| 2 2 | 
             
            - desc = file.try(:description).try(:to_s).try!(:strip).try!(:truncate, 15).presence
         | 
| 3 3 | 
             
            - empty_desc = t 'neofiles.views.no_description'
         | 
| 4 4 |  | 
| 5 | 
            +
            - if Rails.application.config.neofiles.album_append_create_side == :left
         | 
| 6 | 
            +
              - if append_create and file
         | 
| 7 | 
            +
                = render partial: 'file_compact', locals: {file: nil, input_name: input_name, widget_id: widget_id + '_ap', clean_remove: clean_remove, append_create: true, error: nil, disabled: disabled, multiple: multiple, with_desc: with_desc, no_wm: no_wm}
         | 
| 8 | 
            +
             | 
| 9 | 
            +
             | 
| 5 10 | 
             
            - classes = []
         | 
| 6 11 | 
             
            - classes << 'neofiles-image-compact-empty' unless file
         | 
| 7 12 | 
             
            - classes << 'neofiles-image-compact-with-description' if file && with_desc
         | 
| @@ -15,7 +20,7 @@ | |
| 15 20 | 
             
                .neofiles-image-compact-view= file.admin_compact_view self
         | 
| 16 21 |  | 
| 17 22 | 
             
                %a(href=neofiles_file_remove_path class="neofiles-image-compact-remove")
         | 
| 18 | 
            -
                  %i.icon-remove. | 
| 23 | 
            +
                  %i.icon-remove.fas.fa-times
         | 
| 19 24 |  | 
| 20 25 | 
             
                - if Neofiles.is_admin? self
         | 
| 21 26 | 
             
                  - options_form = capture do
         | 
| @@ -41,7 +46,7 @@ | |
| 41 46 | 
             
                          = t 'neofiles.views.no_wm'
         | 
| 42 47 |  | 
| 43 48 | 
             
                  %a(href="#" tabindex="0" class="neofiles-image-compact-options" data-toggle="popover" data-trigger="click" data-placement="top" data-html="true" data-animation="false" data-title="#{file.filename}" data-content="#{options_form}")
         | 
| 44 | 
            -
                    %i.icon-wrench. | 
| 49 | 
            +
                    %i.icon-wrench.fas.fa-wrench
         | 
| 45 50 |  | 
| 46 51 | 
             
                - if with_desc
         | 
| 47 52 | 
             
                  - description_form = capture do
         | 
| @@ -60,7 +65,7 @@ | |
| 60 65 | 
             
                    %a.neofiles-image-compact-description-handle(href="#" data-empty=empty_desc data-toggle="popover" data-trigger="click" data-placement="bottom" data-html="true" data-animation="false" data-title="#{t 'neofiles.views.description'}" data-content="#{description_form}" data-template="#{popover_template}" data-container="##{widget_id}"){class: ('neofiles-image-compact-description-empty' unless desc)}= desc || empty_desc
         | 
| 61 66 |  | 
| 62 67 | 
             
              %span.neofiles-image-compact-upload-icon
         | 
| 63 | 
            -
                %i.icon-upload. | 
| 68 | 
            +
                %i.icon-upload.fas.fa-arrow-circle-up
         | 
| 64 69 |  | 
| 65 70 | 
             
              - common_options = {id: nil, disabled: disabled}
         | 
| 66 71 | 
             
              = hidden_field_tag input_name,                file.try(:id),  common_options.merge(class: 'neofiles-image-transfer-input')
         | 
| @@ -82,6 +87,7 @@ | |
| 82 87 | 
             
                  $("##{widget_id}").image();
         | 
| 83 88 | 
             
              });
         | 
| 84 89 |  | 
| 85 | 
            -
            - if  | 
| 86 | 
            -
               | 
| 90 | 
            +
            - if Rails.application.config.neofiles.album_append_create_side == :right
         | 
| 91 | 
            +
              - if append_create && file
         | 
| 92 | 
            +
                = render partial: 'file_compact', locals: {file: nil, input_name: input_name, widget_id: widget_id + '_ap', clean_remove: clean_remove, append_create: true, error: nil, disabled: disabled, multiple: multiple, with_desc: with_desc, no_wm: no_wm}
         | 
| 87 93 |  | 
    
        data/lib/neofiles/engine.rb
    CHANGED
    
    | @@ -16,6 +16,8 @@ module Neofiles | |
| 16 16 | 
             
                config.neofiles.image_max_crop_width  = 2000 # users can request resizing only up to this width
         | 
| 17 17 | 
             
                config.neofiles.image_max_crop_height = 2000 # users can request resizing only up to this height
         | 
| 18 18 |  | 
| 19 | 
            +
                config.neofiles.album_append_create_side = :right # picture when added is displayed on the right
         | 
| 20 | 
            +
             | 
| 19 21 | 
             
                # default storage
         | 
| 20 22 | 
             
                config.neofiles.write_data_stores = 'mongo'
         | 
| 21 23 | 
             
                config.neofiles.read_data_stores  = 'mongo'
         | 
    
        data/lib/neofiles/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: neofiles
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.0 | 
| 4 | 
            +
              version: 2.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Konanykhin Ilya
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2022-04-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rails
         | 
| @@ -123,6 +123,7 @@ files: | |
| 123 123 | 
             
            - app/assets/images/neofiles/swf-thumb-100x100.png
         | 
| 124 124 | 
             
            - app/assets/images/neofiles/watermark.png
         | 
| 125 125 | 
             
            - app/assets/javascripts/neofiles/index.js.coffee
         | 
| 126 | 
            +
            - app/assets/javascripts/neofiles/index.webpack.js
         | 
| 126 127 | 
             
            - app/assets/javascripts/neofiles/jquery.fileupload.js
         | 
| 127 128 | 
             
            - app/assets/javascripts/neofiles/jquery.iframe-transport.js
         | 
| 128 129 | 
             
            - app/assets/javascripts/neofiles/jquery.neofiles.js.coffee
         | 
| @@ -155,7 +156,7 @@ homepage: http://neoweb.kz | |
| 155 156 | 
             
            licenses:
         | 
| 156 157 | 
             
            - MIT
         | 
| 157 158 | 
             
            metadata: {}
         | 
| 158 | 
            -
            post_install_message: | 
| 159 | 
            +
            post_install_message:
         | 
| 159 160 | 
             
            rdoc_options: []
         | 
| 160 161 | 
             
            require_paths:
         | 
| 161 162 | 
             
            - lib
         | 
| @@ -170,9 +171,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 170 171 | 
             
                - !ruby/object:Gem::Version
         | 
| 171 172 | 
             
                  version: '0'
         | 
| 172 173 | 
             
            requirements: []
         | 
| 173 | 
            -
             | 
| 174 | 
            -
             | 
| 175 | 
            -
            signing_key: 
         | 
| 174 | 
            +
            rubygems_version: 3.0.9
         | 
| 175 | 
            +
            signing_key:
         | 
| 176 176 | 
             
            specification_version: 4
         | 
| 177 177 | 
             
            summary: Serves and manages files & images.
         | 
| 178 178 | 
             
            test_files: []
         |