imagedrop 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: 6d5e8404d28349c09cf9ce8c52ec4fb56662c2be
4
- data.tar.gz: afa5c785d22f0d29f6186f42281a9372fe3b4902
3
+ metadata.gz: de79eec9039c62f168da72f8036694a04f8ce49a
4
+ data.tar.gz: cce3321d1da0f0c91d420419f71c1e005f04338e
5
5
  SHA512:
6
- metadata.gz: 5c3ee5f1bd5e62f318a43a7a4ab956e6b61a45cfe21b231c85df3c4079966fc1923f63da8b0b05f4fdcde4c75489b7f6f2414b0c1ced0d50456e9d1af5310d12
7
- data.tar.gz: 29ea756d66376ee9a6432f8d452fc19b8da0eff6fdba538dc85147849930ad94afd6654e83b04f97dddec6076c900b1c7a5f5569328d8a9e837ccfb756e89e07
6
+ metadata.gz: f11e32e4e8f8b6446463b7b565a8e0811a2ce3e0a711d82c1a4b4ca546d37524bc2f6eb66e5c32ff5f34923d5eea83426e3df7cf942339eefc569abd5d2ce558
7
+ data.tar.gz: 805f5b25c7d0884daeade3ab0219d5d15c185aa4257ebbdadb450bbe9fba47286b1e375840a2138075b4ebaaf3ab0880c9bedd88cdf46462ef2fa55e77a606ed
@@ -0,0 +1,6 @@
1
+ ### v0.0.2
2
+ * Changes to readme file
3
+ * Add changelog
4
+
5
+ ### v0.0.1
6
+ * Initial check in
data/README.md CHANGED
@@ -68,20 +68,27 @@ ImageDrop expects a loose html structure. Just wrap the input field with a div.
68
68
 
69
69
  The input field may have an optional sibling div to act as the placeholder text. Here is an example:
70
70
 
71
- <div id='avatar' style='background-image: url(<%= asset_path @user.avatar_url %>)'>
71
+ <div id='avatar-parent' style='background-image: url(<%= @user.avatar_image %>)'>
72
72
  <div class='placeholder'>Drop an image here</div>
73
73
  <%= f.file_field :avatar %>
74
74
  </div>
75
75
 
76
- This ERB uses the rails asset_path method to preload the avatar image should one already exist.
76
+ `div.placeholder` contains a small snippet of text in this example. It may contain any content you wish but does not accept mouse and keyboard input. The class name is not necessary, I'm just using it here for clarity.
77
+
78
+ In this example, I'm using an `avatar_image` method from my code that provides the path to the user's image or a default image if one doesn't exist. You could do something similar. In a view helper add a function:
77
79
 
78
- `div.placeholder` just contains a small snippet of text. The class name is not necessary but may be so if you need to style your placeholder. The placeholder may contain any content you wish but does not accept mouse and keyboard input.
80
+ def avatar_image(@user)
81
+ asset_path
82
+ @user.new_record? || @user.avatar_url.blank? ?
83
+ 'default.jpg' : @user.avatar_url
84
+ end
79
85
 
80
- Finally, initialize the image-drop by adding this to one of the js/coffeescript files in your project:
86
+ And then call it like this:
87
+
88
+ <div style='background-image: url(<%= avatar_image(@user) %>)'>
89
+
90
+ Obviously, your version will be a little different.
81
91
 
82
- jQuery ->
83
- avatar = new ImageDrop '#avatar'
84
-
85
92
  ### Outside of Rails
86
93
 
87
94
  The same HTML structure expectation applies whether inside or outside of Rails (so check that out above). You can extract the coffeescript file from this repo and convert it to vanilla javascript at [js2coffee.org](http://js2coffee.org) kindly written and hosted by [Rico Sta Cruz](http://ricostacruz.com/).
@@ -90,7 +97,9 @@ The SCSS stylesheet, both of them, can be converted to whitebread CSS at [SASSMe
90
97
 
91
98
  ## Alternatives
92
99
 
93
- There are alternatives to ImageDrop. I wanted to keep things small and very simple. While experimenting, I found a cool way to let CSS do the heavy lifting. That may not be enough for your purposes. You might need to drop multiple files onto the same control, realtime back-end processing, or to display upload progress. Here are some:
100
+ There are alternatives to ImageDrop. While experimenting, I found a cool way to let CSS do the heavy lifting. I want to keep things small and very simple.
101
+
102
+ This may not be enough for your purposes. You might need to drop multiple files, do realtime back-end processing, display upload progress, etc. Here are some alternatives:
94
103
 
95
104
  * [jQuery File Upload](http://blueimp.github.io/jQuery-File-Upload/)
96
105
 
@@ -1,3 +1,3 @@
1
1
  module Imagedrop
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: imagedrop
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
  - Dave Gerton
@@ -47,6 +47,7 @@ extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
49
  - ".gitignore"
50
+ - CHANGELOG.md
50
51
  - Gemfile
51
52
  - LICENSE.txt
52
53
  - README.md