funicular-image-uploader 0.1.1 → 0.3.0
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/lib/components/image_uploader_component.rb +7 -7
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 034e05f3c3225d450bb1e5b6c7a84cd9fe440b3534ade63636026e7eb9f4c340
|
|
4
|
+
data.tar.gz: 8b2e21f6234b281ac167288fa020cdff764dee7d92767cfa1e5e37b99ec48a41
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78c88149453d486b69b08ce99b5f835126f57f7cfa9d24a856cce064d94a3f3e6e60def3f8d3c70c1ce54167901c1ad0a9c984826189e455d67910b74b0ae46a
|
|
7
|
+
data.tar.gz: 86953c8df5cddcf2a4f6f41e1efb4f4c808c2d22ef4bb87f840f206013f798a1d91838935e71ca6ec73e9cc01fb8e16f04625237d65bd1f89f9d0287ddb25319
|
|
@@ -105,10 +105,10 @@ class ImageUploaderComponent < Funicular::Component
|
|
|
105
105
|
button(
|
|
106
106
|
type: "button",
|
|
107
107
|
class: upload_button_class,
|
|
108
|
-
disabled: state
|
|
108
|
+
disabled: state[:uploading] || @selected_file.nil?,
|
|
109
109
|
onclick: -> { upload }
|
|
110
110
|
) do
|
|
111
|
-
state
|
|
111
|
+
state[:uploading] ? uploading_label : upload_label
|
|
112
112
|
end
|
|
113
113
|
end
|
|
114
114
|
end
|
|
@@ -131,19 +131,19 @@ class ImageUploaderComponent < Funicular::Component
|
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
def render_error
|
|
134
|
-
return unless state
|
|
134
|
+
return unless state[:error] && props[:show_error] != false
|
|
135
135
|
|
|
136
|
-
div(class: error_class) { state
|
|
136
|
+
div(class: error_class) { state[:error] }
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
def image_src
|
|
140
|
-
source = state
|
|
140
|
+
source = state[:preview_url] || state[:uploaded_url] || props[:src]
|
|
141
141
|
return nil if source.nil? || source.to_s == ""
|
|
142
142
|
return source if source.to_s.start_with?("blob:", "data:")
|
|
143
143
|
return source unless props[:cache_bust]
|
|
144
144
|
|
|
145
145
|
separator = source.to_s.include?("?") ? "&" : "?"
|
|
146
|
-
"#{source}#{separator}t=#{state
|
|
146
|
+
"#{source}#{separator}t=#{state[:cache_buster]}"
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
def input_id
|
|
@@ -165,7 +165,7 @@ class ImageUploaderComponent < Funicular::Component
|
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
def clearable?
|
|
168
|
-
props[:clearable] && (state
|
|
168
|
+
props[:clearable] && (state[:preview_url] || state[:uploaded_url] || props[:src])
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
def emit_select(file, preview_url)
|
metadata
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: funicular-image-uploader
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- HASUMI Hitoshi
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
-
dependencies:
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: funicular
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.4.0
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.4.0
|
|
12
26
|
executables: []
|
|
13
27
|
extensions: []
|
|
14
28
|
extra_rdoc_files: []
|