activeadmin_file_input_on_steroids 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWE4MTc4YmYxNjQyMDhmNzRiMGVlYzRmMDFmYzY1OWZiYmE0YTJhNA==
4
+ MWM5NTEyOTk0MWYzZjZkY2M4OTg5MGViOTQyYzE1NzExMTlhZTYxMg==
5
5
  data.tar.gz: !binary |-
6
- NTU2OGE3NzhjYWZlYTRjYmFkOTJhOGYwZTg0YzVhMjk5NmYzYjgyMg==
6
+ ZWZmNTFhMGU4ODc2Yzg1Nzg4NDdjMGQ3MTc4NWNkOTFhOTBkMjI5OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjI2YTU3OGRhNGE1NmM0ZmI3ZWE0NWRkYjcxZmQ3OTAxN2FkZWNlOWE4NzM1
10
- ODIxNTYwOTFkYTU5ZTI2YWU3NzZhMGY3NjY5MDg2YTQ2NDQzMGI3ZWExNTgy
11
- ZjZmNjc4MDU4ZDM2ZmY0MjlkNjQ2ODZiMTJlNmI1MGZmODJhZGM=
9
+ YjUzYWQ3YTJhZDRhYWY2YjdhNmMzMjM4MjVhMGJlZjBhZGE2OWZlNmZlOGQz
10
+ ODI2MjM1ZDZiMTBiNTczNzIwOTNiY2ZmZTBlYjlkMmY0MTEzNDJkZGQxZjU0
11
+ ZTY3ZmFmNDdlNzgyZjA4MWQ2OTMzZTgzYTBiMzM3NjhkZDE4ODg=
12
12
  data.tar.gz: !binary |-
13
- ZDQ4MDA4YjIzMDc4MzQ2NWFhOTdmMGJkODZlZmUzNjFiYzgwZDUxNTA2Mjlh
14
- MmNiNjVlMmJiM2QzNjQ0NTAxMGQ2MmVmOWJiNzBiMGFhMjFkMDk3MTU1YjYz
15
- OWNjOWU5YzYyZWQzZWUwYWJmODFjMDMxODViYjJlOWZiN2Q1N2M=
13
+ ZTUxOTgzNGIxOWU4OTE4MWE1NmJhY2I0ZGNjMDEyOGE5OGVjZTc2NGZiMWJl
14
+ Yzg3YWVjMDhkZDQyZDBjYTMxN2M4MzBmZTMyODEzZDc5OTgxMmYxYmJjMTlh
15
+ ZmVmYTgwOTc5NWYzYThlNDdkNGJmZTUwN2IzZjhlZjIwMjhiMjQ=
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ActiveadminFileInputOnSteroids
2
2
 
3
- TODO: Write a gem description
3
+ This gem adds 2 functionalities to the file input field. Image preview and a size hint based on paperclip styles.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,23 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ Include javascript to your active_admin.js file.
22
+
23
+ ```javascript
24
+ //= require activeadmin_file_input_on_steroids
25
+ ```
26
+
27
+ Include the css to your active_admin.css.scss
28
+ ```css
29
+ @import "activeadmin_file_input_on_steroids";
30
+ ```
31
+
32
+ Now, when in your forms, when you create a file input, you have 2 new options, image_preview and size_hint.
33
+
34
+ ```ruby
35
+ f.input :photo, image_preview: true, size_hint: true
36
+ ```
37
+
22
38
 
23
39
  ## Contributing
24
40
 
@@ -39,7 +39,11 @@ class FileInput < Formtastic::Inputs::FileInput
39
39
  end
40
40
 
41
41
  def size_hint_html
42
- template.content_tag(:p, 'Tamanhos gerados automaticamente (redimensiona, centraliza e corta) através da imagem selecionada:', class: 'size-hint-text inline-hints') +
43
- template.content_tag(:p, size_hint_text, class: 'size-hint-text inline-hints')
42
+ if size_hint?
43
+ template.content_tag(:p, 'Tamanhos gerados automaticamente (redimensiona, centraliza e corta) através da imagem selecionada:', class: 'size-hint-text inline-hints') +
44
+ template.content_tag(:p, size_hint_text, class: 'size-hint-text inline-hints')
45
+ else
46
+ nil
47
+ end
44
48
  end
45
49
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveadminFileInputOnSteroids
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeadmin_file_input_on_steroids
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ariel Schvartz