funicular-image-uploader 0.2.0 → 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 +14 -14
- metadata +3 -3
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
|
|
@@ -84,12 +84,12 @@ class ImageUploaderComponent < Funicular::Component
|
|
|
84
84
|
emit_upload(result)
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
def render
|
|
88
|
-
|
|
89
|
-
render_image
|
|
90
|
-
render_error
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
def render
|
|
88
|
+
div(class: container_class) do
|
|
89
|
+
render_image
|
|
90
|
+
render_error
|
|
91
|
+
div(class: controls_class) do
|
|
92
|
+
input(
|
|
93
93
|
type: "file",
|
|
94
94
|
id: input_id,
|
|
95
95
|
accept: props[:accept] || "image/*",
|
|
@@ -97,12 +97,12 @@ class ImageUploaderComponent < Funicular::Component
|
|
|
97
97
|
class: input_class
|
|
98
98
|
)
|
|
99
99
|
if clearable?
|
|
100
|
-
|
|
100
|
+
button(type: "button", class: clear_button_class, onclick: -> { clear }) do
|
|
101
101
|
props[:clear_label] || "Clear"
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
if props[:show_upload_button]
|
|
105
|
-
|
|
105
|
+
button(
|
|
106
106
|
type: "button",
|
|
107
107
|
class: upload_button_class,
|
|
108
108
|
disabled: state[:uploading] || @selected_file.nil?,
|
|
@@ -117,23 +117,23 @@ class ImageUploaderComponent < Funicular::Component
|
|
|
117
117
|
|
|
118
118
|
private
|
|
119
119
|
|
|
120
|
-
def render_image
|
|
120
|
+
def render_image
|
|
121
121
|
source = image_src
|
|
122
122
|
if source
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
div(class: preview_container_class) do
|
|
124
|
+
img(src: source, alt: alt_text, class: image_class)
|
|
125
125
|
end
|
|
126
126
|
elsif props[:placeholder]
|
|
127
|
-
|
|
127
|
+
div(class: placeholder_class) do
|
|
128
128
|
props[:placeholder]
|
|
129
129
|
end
|
|
130
130
|
end
|
|
131
131
|
end
|
|
132
132
|
|
|
133
|
-
def render_error
|
|
133
|
+
def render_error
|
|
134
134
|
return unless state[:error] && props[:show_error] != false
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
div(class: error_class) { state[:error] }
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
def image_src
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.4.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.4.0
|
|
26
26
|
executables: []
|
|
27
27
|
extensions: []
|
|
28
28
|
extra_rdoc_files: []
|