image_input 0.0.5 → 0.0.7

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: 52ebcc38110ac7d9c868744d36485ac2bc336b90d0b6f1651acef5711546655e
4
- data.tar.gz: 8fcd2c947ae62c09ffb1a88cf07be82c85e20696b94ba4f52f06cc3c1186c947
3
+ metadata.gz: 2f3073f6527858f59bcf55edb7a62e524ec991de2ecb30d025e25fb906eeedb9
4
+ data.tar.gz: 310174f936344a3c8598d8f2465bb20474fff0e3c58d0318828094cc61b8e726
5
5
  SHA512:
6
- metadata.gz: d53fc39c634346f0210d738de9282090b669def6282e47ed3a496b509f3db789472f1401bc390e2ff9689c6a5100c7ccfb91a0bf76cb1186dff627f29f90954d
7
- data.tar.gz: 86da5d9f0f2f9f64d89c85f89abc6d7dcb843eb991bb98dc9b2d1146bc7ca16c4ce09cef931c4a2e3d3e9dcbd2d4621c87b21726556c15b5b7d34d9fcf0d4865
6
+ metadata.gz: 42fbacb8f4ba39595ff17c376eb0225f4a0bcd25773bd056fba3d2cec6276502af808554e969cd2722466855031b11db233ba1ba55c49c365da1db9ebfa6ecec
7
+ data.tar.gz: 65a504414bb3a6c3b80a87ecda10359342b7c78d9333d1e07bdc9ca9a01427e4526f670136d97c8aaf67ffb7226c63be1d27d969353ebfe126ad6da2058c9184
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  A Rails helper for a simple, clean image input for use with Active Storage.
4
4
 
5
+ <img src="example.png" width="314" height="269" />
6
+
5
7
  Example usage:
6
8
 
7
9
  ```ruby
@@ -14,13 +14,13 @@
14
14
  <%= image_tag(
15
15
  blob.variant(resize_to_limit: [300, 300]),
16
16
  data: { target: 'image-input.image' },
17
- class: 'rounded-md mb-4'
17
+ class: image_class || 'rounded-md mb-4'
18
18
  ) %>
19
19
  <% end %>
20
20
 
21
21
  <a
22
22
  href="#"
23
- class="border border-transparent cursor-pointer duration-150 ease-in-out focus:outline-none font-bold inline-block leading-5 px-4 py-2 rounded-md text-sm transition active:bg-gray-50 active:text-gray-800 bg-white border-gray-300 hover:bg-gray-100 hover:text-gray-600 text-gray-800 mr-4"
23
+ class="<%= button_class || 'border border-transparent cursor-pointer duration-150 ease-in-out focus:outline-none font-bold inline-block leading-5 px-4 py-2 rounded-md text-sm transition active:bg-gray-50 active:text-gray-800 bg-white border-gray-300 hover:bg-gray-100 hover:text-gray-600 text-gray-800 mr-4' %>"
24
24
  data-action="click->image-input#chooseFile"
25
25
  data-target="image-input.button"
26
26
  >
@@ -2,14 +2,25 @@
2
2
 
3
3
  module ImageInput
4
4
  module Helpers
5
- def image_input(form, field, accept: %i(png jpeg gif), direct_upload: true)
5
+ def image_input(
6
+ form,
7
+ field,
8
+ accept: %i(png jpeg gif),
9
+ direct_upload: true,
10
+ button_class: nil,
11
+ image_class: nil,
12
+ **options
13
+ )
6
14
  render(
7
15
  'image_input/input',
8
16
  form: form,
9
17
  field: field,
10
18
  blob: form.object.public_send(field),
11
19
  accept: accept.map { |a| Mime[a].to_s }.join(','),
12
- direct_upload: direct_upload
20
+ direct_upload: direct_upload,
21
+ button_class: button_class,
22
+ image_class: image_class,
23
+ **options
13
24
  )
14
25
  end
15
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ImageInput
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.7'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_input
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Katz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-02 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails