bullet_train-fields 1.7.7 → 1.7.8
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
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e75d6f9f8137d6b25bf218ad3842160e07e2c7311871850c3a2f8061f95a8d16
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: dc352bbf73529c13962388a8e6c901c714b2462747a53e2cf0f41b7799e25227
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8138c97d819636259443d8a76e8163223152a5ff4de38d4be9ca11db8842275352b2d1242e1039438ac7e111027ad08188c003b4c22d24b42971fa917e3d7a39
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: efdff41d4b4b909a97d7741ece2b204c6b80373793117d7b012699d3ae3249a4087552623637ddf7fbe065d522646381de221ce349f945df98953ad80000c6a4
         
     | 
| 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import { Controller } from "@hotwired/stimulus"
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { get } from "@rails/request.js"
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
4 
     | 
    
         
             
            export default class extends Controller {
         
     | 
| 
       4 
5 
     | 
    
         
             
              static targets = [ "uploadButton", "hiddenField", "thumbnail" ]
         
     | 
| 
         @@ -56,16 +57,31 @@ export default class extends Controller { 
     | 
|
| 
       56 
57 
     | 
    
         
             
                this.removeThumbnail()
         
     | 
| 
       57 
58 
     | 
    
         
             
              }
         
     | 
| 
       58 
59 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
              getCloudinarySignature(callback, paramsToSign) {
         
     | 
| 
       60 
     | 
    
         
            -
                 
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                   
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                   
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
      
 60 
     | 
    
         
            +
              async getCloudinarySignature(callback, paramsToSign) {
         
     | 
| 
      
 61 
     | 
    
         
            +
                const queryData = new URLSearchParams();
         
     | 
| 
      
 62 
     | 
    
         
            +
              
         
     | 
| 
      
 63 
     | 
    
         
            +
                for (const key in paramsToSign) {
         
     | 
| 
      
 64 
     | 
    
         
            +
                  queryData.append(`data[${key}]`, paramsToSign[key]);
         
     | 
| 
      
 65 
     | 
    
         
            +
                }
         
     | 
| 
      
 66 
     | 
    
         
            +
              
         
     | 
| 
      
 67 
     | 
    
         
            +
                try {
         
     | 
| 
      
 68 
     | 
    
         
            +
                  const response = await get(this.signaturesUrlValue, {
         
     | 
| 
      
 69 
     | 
    
         
            +
                    responseKind: 'text',
         
     | 
| 
      
 70 
     | 
    
         
            +
                    query: queryData
         
     | 
| 
      
 71 
     | 
    
         
            +
                  });
         
     | 
| 
      
 72 
     | 
    
         
            +
              
         
     | 
| 
      
 73 
     | 
    
         
            +
                  if (response.ok) {
         
     | 
| 
      
 74 
     | 
    
         
            +
                    const signature = await response.text;
         
     | 
| 
      
 75 
     | 
    
         
            +
                    console.log('signature', signature)
         
     | 
| 
      
 76 
     | 
    
         
            +
                    callback(signature);
         
     | 
| 
      
 77 
     | 
    
         
            +
                  } else {
         
     | 
| 
      
 78 
     | 
    
         
            +
                    console.log('Request failed:', response.statusText);
         
     | 
| 
      
 79 
     | 
    
         
            +
                  }
         
     | 
| 
      
 80 
     | 
    
         
            +
                } catch (error) {
         
     | 
| 
      
 81 
     | 
    
         
            +
                  console.error('Request error:', error);
         
     | 
| 
      
 82 
     | 
    
         
            +
                } finally {
         
     | 
| 
      
 83 
     | 
    
         
            +
                  console.log('complete');
         
     | 
| 
      
 84 
     | 
    
         
            +
                }
         
     | 
| 
       69 
85 
     | 
    
         
             
              }
         
     | 
| 
       70 
86 
     | 
    
         | 
| 
       71 
87 
     | 
    
         
             
              handleWidgetResponse(error, response) {
         
     | 
| 
         @@ -85,8 +101,13 @@ export default class extends Controller { 
     | 
|
| 
       85 
101 
     | 
    
         
             
              }
         
     | 
| 
       86 
102 
     | 
    
         | 
| 
       87 
103 
     | 
    
         
             
              addThumbnail(url) {
         
     | 
| 
       88 
     | 
    
         
            -
                 
     | 
| 
       89 
     | 
    
         
            -
                 
     | 
| 
      
 104 
     | 
    
         
            +
                const imageElement = document.createElement('img');
         
     | 
| 
      
 105 
     | 
    
         
            +
                imageElement.src = url;
         
     | 
| 
      
 106 
     | 
    
         
            +
                imageElement.width = this.widthValue;
         
     | 
| 
      
 107 
     | 
    
         
            +
                imageElement.height = this.heightValue;
         
     | 
| 
      
 108 
     | 
    
         
            +
                imageElement.setAttribute(`data-${this.identifier}-target`, 'thumbnail');
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                this.uploadButtonTarget.prepend(imageElement);
         
     | 
| 
       90 
111 
     | 
    
         | 
| 
       91 
112 
     | 
    
         
             
                // mark the image as present.
         
     | 
| 
       92 
113 
     | 
    
         
             
                this.uploadButtonTarget.classList.add(this.thumbnailShownClass)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: bullet_train-fields
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.7. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.7.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Andrew Culver
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024-05- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-05-24 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: standard
         
     |