bullet_train 1.4.4 → 1.4.5
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/app/helpers/account/users_helper.rb +7 -2
- data/app/views/account/users/_form.html.erb +7 -5
- data/docs/field-partials.md +7 -4
- data/docs/super-scaffolding.md +40 -0
- data/lib/bullet_train/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1996b94dbb7fda2db6472e01a23499b91947f4b3faf3a97ac1b5b20630505e3a
         | 
| 4 | 
            +
              data.tar.gz: 608ea60207cb19ff2c4b73d8b9129ed5d1e3fe2a0190645754b55372132f1c72
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: be8f7010714d24a73dd42ef91530e2d61f20b520bc39ca1444d5cf6881df10869d1836823e2dab378b0b8d12e0bb6a00be201db9c896ddd6242bc067e2522713
         | 
| 7 | 
            +
              data.tar.gz: 3907fad30d953b8f7e693ec1f3e2bf56917de2fcf0bcbb5e8d8306bdeb7664663408bf013158670f8e55da0428a2313a680446e888cc097b622552ccedfc4865
         | 
| @@ -1,10 +1,15 @@ | |
| 1 1 | 
             
            module Account::UsersHelper
         | 
| 2 | 
            +
              def photo_url_for_active_storage_attachment attachment, options
         | 
| 3 | 
            +
                size_details = {resize_to_limit: [options[:width], options[:height]]}
         | 
| 4 | 
            +
                attachment.representation(size_details)
         | 
| 5 | 
            +
              end
         | 
| 6 | 
            +
             | 
| 2 7 | 
             
              def profile_photo_for(url: nil, email: nil, first_name: nil, last_name: nil, profile_header: false)
         | 
| 3 8 | 
             
                size_details = profile_header ? {width: 700, height: 200} : {width: 100, height: 100}
         | 
| 4 9 | 
             
                size_details[:crop] = :fill
         | 
| 5 10 |  | 
| 6 11 | 
             
                if cloudinary_enabled? && !url.blank?
         | 
| 7 | 
            -
                  cl_image_path(url, size_details | 
| 12 | 
            +
                  cl_image_path(url, size_details)
         | 
| 8 13 | 
             
                elsif !url.blank?
         | 
| 9 14 | 
             
                  url + "?" + size_details.to_param
         | 
| 10 15 | 
             
                else
         | 
| @@ -38,7 +43,7 @@ module Account::UsersHelper | |
| 38 43 | 
             
              # leaving them in case we have other developers depending on these methods.
         | 
| 39 44 | 
             
              def profile_header_photo_for(url: nil, email: nil, first_name: nil, last_name: nil)
         | 
| 40 45 | 
             
                if cloudinary_enabled? && !url.blank?
         | 
| 41 | 
            -
                  cl_image_path(url, width: 700, height: 200, crop: :fill)
         | 
| 46 | 
            +
                  cl_image_path(url, {width: 700, height: 200, crop: :fill})
         | 
| 42 47 | 
             
                elsif !url.blank?
         | 
| 43 48 | 
             
                  url + "?" + {size: 200}.to_param
         | 
| 44 49 | 
             
                else
         | 
| @@ -10,11 +10,13 @@ | |
| 10 10 | 
             
                  </div>
         | 
| 11 11 |  | 
| 12 12 | 
             
                  <div class="sm:col-span-2">
         | 
| 13 | 
            -
                    <% | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 13 | 
            +
                    <%
         | 
| 14 | 
            +
                        image_method = :profile_photo
         | 
| 15 | 
            +
                        if cloudinary_enabled?
         | 
| 16 | 
            +
                          image_method = :profile_photo_id
         | 
| 17 | 
            +
                        end
         | 
| 18 | 
            +
                    %>
         | 
| 19 | 
            +
                    <%= render 'shared/fields/image', method: image_method %>
         | 
| 18 20 | 
             
                  </div>
         | 
| 19 21 |  | 
| 20 22 | 
             
                  <div class="sm:col-span-2">
         | 
    
        data/docs/field-partials.md
    CHANGED
    
    | @@ -81,12 +81,12 @@ When you're including multiple fields, you can DRY up redundant settings (e.g. ` | |
| 81 81 | 
             
            <% with_field_settings form: form do %>
         | 
| 82 82 | 
             
              <%= render 'shared/fields/text_field', method: :text_field_value, options: {autofocus: true} %>
         | 
| 83 83 | 
             
              <%= render 'shared/fields/buttons', method: :button_value %>
         | 
| 84 | 
            -
              <%= render 'shared/fields/ | 
| 84 | 
            +
              <%= render 'shared/fields/image', method: :cloudinary_image_value %>
         | 
| 85 85 | 
             
            <% end %>
         | 
| 86 86 | 
             
            ```
         | 
| 87 87 |  | 
| 88 88 | 
             
            ## Field partials that integrate with third-party service providers
         | 
| 89 | 
            -
             - ` | 
| 89 | 
            +
             - `image` makes it trivial to upload photos and videos to [Cloudinary](https://cloudinary.com) and store their resulting Cloudinary ID as an attribute of the model backing the form. To enable this field partial, sign up for Cloudinary and copy the "Cloudinary URL" they provide you with into your `config/application.yml` as `CLOUDINARY_URL`. If you use our [Heroku app.json](https://github.com/bullet-train-co/bullet_train/blob/main/app.json) to provision your production environment, this will happen in that environment automatically.
         | 
| 90 90 |  | 
| 91 91 | 
             
            ## Yaml Configuration
         | 
| 92 92 | 
             
            The localization Yaml file (where you configure label and option values for a field) is automatically generated when you run Super Scaffolding for a model. If you haven't done this yet, the localization Yaml file for `Scaffolding::CompletelyConcrete::TangibleThing` serves as a good example. Under `en.scaffolding/completely_concrete/tangible_things.fields` you'll see definitions like this:
         | 
| @@ -126,7 +126,7 @@ Certain form field partials like `buttons` and `super_select` can also have thei | |
| 126 126 | 
             
            |--------------------------------------------------------|--------------|------------------|-------------------------|-----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
         | 
| 127 127 | 
             
            | `boolean`                                              | `boolean`    |                  | `assign_boolean`        |                                                                                   |                                                                                          |
         | 
| 128 128 | 
             
            | [`buttons`](/docs/field-partials/buttons.md)           | `string`     | Optionally       | `assign_checkboxes`     |                                                                                   |                                                                                          |
         | 
| 129 | 
            -
            | ` | 
| 129 | 
            +
            | `image`                                                | `string` or `attachment`*  |                  |                         |                                                                                   |                                                                                          |
         | 
| 130 130 | 
             
            | `color_picker`                                         | `string`     |                  |                         | [pickr](https://simonwep.github.io/pickr/)                                        |                                                                                          |
         | 
| 131 131 | 
             
            | `date_and_time_field`                                  | `datetime`   |                  |                  | [Date Range Picker](https://www.daterangepicker.com)                              |                                                                                          |
         | 
| 132 132 | 
             
            | `date_field`                                           | `date`       |                  |                  | [Date Range Picker](https://www.daterangepicker.com)                              |                                                                                          |
         | 
| @@ -139,9 +139,12 @@ Certain form field partials like `buttons` and `super_select` can also have thei | |
| 139 139 | 
             
            | [`super_select`](/docs/field-partials/super-select.md) | `string`     | Optionally       | `assign_select_options` | [Select2](https://select2.org)                                                    | Provides powerful option search, AJAX search, and multi-select functionality.            |
         | 
| 140 140 | 
             
            | `text_area`                                            | `text`       |                  |                         |                                                                                   |                                                                                          |
         | 
| 141 141 | 
             
            | `text_field`                                           | `string`     |                  |                         |                                                                                   |                                                                                          |
         | 
| 142 | 
            -
            | `number_field` | 
| 142 | 
            +
            | `number_field`                                         | `integer`    |                  |                         |                                                                                   |                                                                                          |
         | 
| 143 143 | 
             
            | `trix_editor`                                          | `text`       |                  |                         | [Trix](https://github.com/basecamp/trix)                                          | Basic HTML-powered formatting features and support for at-mentions amongst team members. |
         | 
| 144 144 |  | 
| 145 | 
            +
            * The data type for `image` fields will vary based on whether you're using Cloudinary or ActiveStorage.
         | 
| 146 | 
            +
            For Cloudinary you should use `string`, and for ActiveStorage you should use `attachment`.
         | 
| 147 | 
            +
             | 
| 145 148 | 
             
            ## A Note On Data Types
         | 
| 146 149 | 
             
            Set the data type to `jsonb` whenever passing the `multiple` option to a new attribute.
         | 
| 147 150 | 
             
            ```
         | 
    
        data/docs/super-scaffolding.md
    CHANGED
    
    | @@ -228,6 +228,46 @@ end | |
| 228 228 |  | 
| 229 229 | 
             
            Honestly, it's crazy that we got to the point where we can handle this particular use case automatically. It seems simple, but there is so much going on to make this feature work.
         | 
| 230 230 |  | 
| 231 | 
            +
            ### 7. Scaffolding image upload attributes
         | 
| 232 | 
            +
             | 
| 233 | 
            +
            Bullet Train comes with two different ways to handle image uploads.
         | 
| 234 | 
            +
             | 
| 235 | 
            +
            * Cloudinary - This option allows your app deployment to be simpler because you don't need to ship any image manipulation libraries. But it does introduce a dependence on a 3rd party service.
         | 
| 236 | 
            +
            * ActiveStorage - This option doesn't include reliance on a 3rd party service, but you do have to include image manipulation libararies in your deployment process.
         | 
| 237 | 
            +
             | 
| 238 | 
            +
            #### Scaffolding images with Cloudinary
         | 
| 239 | 
            +
             | 
| 240 | 
            +
            When you scaffold your model you need to include a `string` where Cloudinary can store a reference to the image.
         | 
| 241 | 
            +
             | 
| 242 | 
            +
            For instance to scaffold a `Project` model with a `logo` image upload.
         | 
| 243 | 
            +
             | 
| 244 | 
            +
            ```
         | 
| 245 | 
            +
            rails g model Project team:references name:string logo:string
         | 
| 246 | 
            +
            ```
         | 
| 247 | 
            +
             | 
| 248 | 
            +
            Then you can use `image` as a field type for super scaffolding:
         | 
| 249 | 
            +
             | 
| 250 | 
            +
            ```
         | 
| 251 | 
            +
            bin/super-scaffold crud Project Team name:text_field logo:image
         | 
| 252 | 
            +
            rake db:migrate
         | 
| 253 | 
            +
            ```
         | 
| 254 | 
            +
            #### Scaffolding images with ActiveStorage
         | 
| 255 | 
            +
             | 
| 256 | 
            +
            When you scaffold your model you need to generate an `attachment` type attribute.
         | 
| 257 | 
            +
             | 
| 258 | 
            +
            For instance to scaffold a `Project` model with a `logo` image upload.
         | 
| 259 | 
            +
             | 
| 260 | 
            +
            ```
         | 
| 261 | 
            +
            rails g model Project team:references name:string logo:attachment
         | 
| 262 | 
            +
            ```
         | 
| 263 | 
            +
             | 
| 264 | 
            +
            Then you can use `image` as a field type for super scaffolding:
         | 
| 265 | 
            +
             | 
| 266 | 
            +
            ```
         | 
| 267 | 
            +
            bin/super-scaffold crud Project Team name:text_field logo:image
         | 
| 268 | 
            +
            rake db:migrate
         | 
| 269 | 
            +
            ```
         | 
| 270 | 
            +
             | 
| 231 271 | 
             
            ## Additional Notes
         | 
| 232 272 |  | 
| 233 273 | 
             
            ### `TangibleThing` and `CreativeConcept`
         | 
    
        data/lib/bullet_train/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bullet_train
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.4. | 
| 4 | 
            +
              version: 1.4.5
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Andrew Culver
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023-09- | 
| 11 | 
            +
            date: 2023-09-20 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: standard
         |