godmin-uploads 0.10.2 → 0.11

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: 958b1b1542a35904790cebea4d08d4b7df0a41ea
4
- data.tar.gz: 93a4ff922e3082ad834bb98248d24f98bdd58b23
3
+ metadata.gz: f640c2e30e2ea47f2cfac0004e8ba40419926bfc
4
+ data.tar.gz: e7bd95e80a7992e9f89d5de72c721749858d7039
5
5
  SHA512:
6
- metadata.gz: 0a7b8e2e2420951ea719a3da56cd5bf2efc2588918ea920258e2347b4be1233a10247e82e4de9f6fb56bade0662c0087ac139dc3dd41f17ae560eaa567f20ef1
7
- data.tar.gz: f765aec4862be9afaf02e960bca3a62c6c660467720464b5bf7933f9ecf2e84cf8487d6274e011bffa2d47a44b28a159c726fa0411fc4275f2ab0e68dad4c805
6
+ metadata.gz: d74668d1019ff4ae404b7f590ccc7c4ab34b505c466b054adcc6dc4e879943214b2f0db3cca090b93feacc600b0dd429cf51acecfc802061334615ad7d9d4cbe
7
+ data.tar.gz: 58b43115fa72fa3acff93bef1378eaa63e4694633bc0406dda4e0e56882c7b37724a414d8dc666f5c2db1418c289d31714b28bb7fb1d6c14c03b3b381d7c7d4a
@@ -1,17 +1,359 @@
1
- AllCops:
2
- RunRailsCops: true
1
+ # See https://github.com/bbatsov/rubocop/blob/master/config/default.yml
2
+ Rails:
3
+ Enabled: true
3
4
 
4
5
  Documentation:
5
6
  Enabled: false
6
7
 
7
- Metrics/LineLength:
8
- Max: 120
9
-
10
8
  Metrics/ClassLength:
11
9
  Max: 300
12
10
 
11
+ Metrics/ModuleLength:
12
+ Max: 300
13
+
13
14
  Metrics/MethodLength:
14
15
  Max: 25
15
16
 
16
17
  Style/StringLiterals:
17
18
  EnforcedStyle: double_quotes
19
+
20
+ Layout/AccessModifierIndentation:
21
+ EnforcedStyle: indent
22
+
23
+ Style/Alias:
24
+ EnforcedStyle: prefer_alias_method
25
+
26
+ Layout/AlignHash:
27
+ EnforcedHashRocketStyle: key
28
+ EnforcedColonStyle: key
29
+ EnforcedLastArgumentHashStyle: always_inspect
30
+
31
+ Layout/AlignParameters:
32
+ EnforcedStyle: with_fixed_indentation
33
+
34
+ Style/AndOr:
35
+ EnforcedStyle: conditionals
36
+
37
+ Style/BlockDelimiters:
38
+ EnforcedStyle: line_count_based
39
+
40
+ Style/BracesAroundHashParameters:
41
+ EnforcedStyle: no_braces
42
+
43
+ Layout/CaseIndentation:
44
+ EnforcedStyle: end
45
+
46
+ Style/ClassAndModuleChildren:
47
+ EnforcedStyle: nested
48
+
49
+ Style/ClassCheck:
50
+ EnforcedStyle: is_a?
51
+
52
+ Style/CollectionMethods:
53
+ PreferredMethods:
54
+ collect: "map"
55
+ collect!: "map!"
56
+ inject: "reduce"
57
+ detect: "find"
58
+ find_all: "select"
59
+
60
+ Style/CommandLiteral:
61
+ EnforcedStyle: percent_x
62
+ AllowInnerBackticks: false
63
+
64
+ Style/CommentAnnotation:
65
+ Keywords:
66
+ - TODO
67
+ - FIXME
68
+ - OPTIMIZE
69
+ - HACK
70
+ - REVIEW
71
+
72
+ Layout/DotPosition:
73
+ EnforcedStyle: leading
74
+
75
+ Style/EmptyElse:
76
+ EnforcedStyle: both
77
+
78
+ Layout/EmptyLinesAroundBlockBody:
79
+ EnforcedStyle: no_empty_lines
80
+
81
+ Layout/EmptyLinesAroundClassBody:
82
+ EnforcedStyle: no_empty_lines
83
+
84
+ Layout/EmptyLinesAroundModuleBody:
85
+ EnforcedStyle: no_empty_lines
86
+
87
+ Style/EmptyMethod:
88
+ EnforcedStyle: expanded
89
+
90
+ Layout/ExtraSpacing:
91
+ AllowForAlignment: true
92
+
93
+ Style/For:
94
+ EnforcedStyle: each
95
+
96
+ Style/FormatString:
97
+ EnforcedStyle: format
98
+
99
+ Style/GlobalVars:
100
+ AllowedVariables:
101
+ - autogen_filepath
102
+ - autogen_buffer
103
+
104
+ Style/HashSyntax:
105
+ EnforcedStyle: ruby19_no_mixed_keys
106
+
107
+ Layout/IndentationConsistency:
108
+ EnforcedStyle: normal
109
+
110
+ Layout/IndentationWidth:
111
+ Width: 2
112
+
113
+ Style/Lambda:
114
+ EnforcedStyle: line_count_dependent
115
+
116
+ Layout/SpaceInLambdaLiteral:
117
+ EnforcedStyle: require_space
118
+
119
+ Style/LambdaCall:
120
+ EnforcedStyle: braces
121
+
122
+ Style/MethodDefParentheses:
123
+ EnforcedStyle: require_parentheses
124
+
125
+ Naming/MethodName:
126
+ EnforcedStyle: snake_case
127
+
128
+ Style/ModuleFunction:
129
+ EnforcedStyle: module_function
130
+
131
+ Layout/MultilineArrayBraceLayout:
132
+ EnforcedStyle: symmetrical
133
+
134
+ Layout/MultilineHashBraceLayout:
135
+ EnforcedStyle: new_line
136
+
137
+ Layout/MultilineMethodCallBraceLayout:
138
+ EnforcedStyle: symmetrical
139
+
140
+ Layout/MultilineMethodDefinitionBraceLayout:
141
+ EnforcedStyle: new_line
142
+
143
+ Style/NonNilCheck:
144
+ IncludeSemanticChanges: true
145
+
146
+ Style/ParenthesesAroundCondition:
147
+ AllowSafeAssignment: true
148
+
149
+ Style/PercentLiteralDelimiters:
150
+ PreferredDelimiters:
151
+ default: ()
152
+ "%i": "[]"
153
+ "%I": "[]"
154
+ "%r": "{}"
155
+ "%w": "[]"
156
+ "%W": "[]"
157
+ "%Q": "{}"
158
+
159
+ Style/PercentQLiterals:
160
+ EnforcedStyle: upper_case_q
161
+
162
+ Style/RaiseArgs:
163
+ EnforcedStyle: exploded
164
+
165
+ Style/RedundantReturn:
166
+ AllowMultipleReturnValues: false
167
+
168
+ Style/RegexpLiteral:
169
+ EnforcedStyle: slashes
170
+ AllowInnerSlashes: false
171
+
172
+ Style/Semicolon:
173
+ AllowAsExpressionSeparator: false
174
+
175
+ Style/SingleLineBlockParams:
176
+ Methods:
177
+ - reduce:
178
+ - acc
179
+ - elem
180
+ - inject:
181
+ - acc
182
+ - elem
183
+
184
+ Style/FrozenStringLiteralComment:
185
+ EnforcedStyle: when_needed
186
+
187
+ Style/SingleLineMethods:
188
+ AllowIfMethodIsEmpty: false
189
+
190
+ Layout/SpaceAroundBlockParameters:
191
+ EnforcedStyleInsidePipes: no_space
192
+
193
+ Layout/SpaceAroundEqualsInParameterDefault:
194
+ EnforcedStyle: space
195
+
196
+ Layout/SpaceBeforeBlockBraces:
197
+ EnforcedStyle: space
198
+
199
+ Layout/SpaceInsideBlockBraces:
200
+ EnforcedStyle: space
201
+
202
+ Layout/SpaceInsideHashLiteralBraces:
203
+ EnforcedStyle: space
204
+ EnforcedStyleForEmptyBraces: no_space
205
+
206
+ Layout/SpaceInsideStringInterpolation:
207
+ EnforcedStyle: no_space
208
+
209
+ Style/SpecialGlobalVars:
210
+ EnforcedStyle: use_english_names
211
+
212
+ Style/StabbyLambdaParentheses:
213
+ EnforcedStyle: require_parentheses
214
+
215
+ Style/StringLiterals:
216
+ EnforcedStyle: double_quotes
217
+
218
+ Style/StringLiteralsInInterpolation:
219
+ EnforcedStyle: double_quotes
220
+
221
+ Style/StringMethods:
222
+ PreferredMethods:
223
+ intern: to_sym
224
+
225
+ Style/BarePercentLiterals:
226
+ EnforcedStyle: percent_q
227
+
228
+ Style/SymbolArray:
229
+ EnforcedStyle: percent
230
+
231
+ Style/TernaryParentheses:
232
+ EnforcedStyle: require_no_parentheses
233
+
234
+ Layout/TrailingBlankLines:
235
+ EnforcedStyle: final_newline
236
+
237
+ Style/TrailingCommaInArguments:
238
+ EnforcedStyleForMultiline: no_comma
239
+
240
+ Style/TrailingCommaInLiteral:
241
+ EnforcedStyleForMultiline: no_comma
242
+
243
+ Naming/VariableName:
244
+ EnforcedStyle: snake_case
245
+
246
+ Naming/VariableNumber:
247
+ EnforcedStyle: snake_case
248
+
249
+ Style/WordArray:
250
+ EnforcedStyle: percent
251
+
252
+ Style/GuardClause:
253
+ Enabled: false
254
+
255
+ Layout/MultilineMethodCallIndentation:
256
+ EnforcedStyle: indented
257
+
258
+ Metrics/LineLength:
259
+ Max: 120
260
+ AllowHeredoc: true
261
+ AllowURI: true
262
+ URISchemes:
263
+ - http
264
+ - https
265
+
266
+ Lint/AssignmentInCondition:
267
+ AllowSafeAssignment: true
268
+
269
+ Lint/BlockAlignment:
270
+ EnforcedStyleAlignWith: start_of_line
271
+
272
+ Lint/DefEndAlignment:
273
+ EnforcedStyleAlignWith: start_of_line
274
+
275
+ Lint/EndAlignment:
276
+ EnforcedStyleAlignWith: start_of_line
277
+
278
+ Lint/UnusedBlockArgument:
279
+ AllowUnusedKeywordArguments: false
280
+
281
+ Lint/UnusedMethodArgument:
282
+ AllowUnusedKeywordArguments: false
283
+
284
+ Rails/Date:
285
+ EnforcedStyle: strict
286
+
287
+ Rails/TimeZone:
288
+ EnforcedStyle: flexible
289
+
290
+ Rails/NotNullColumn:
291
+ Include:
292
+ - db/migrate/*.rb
293
+
294
+ Rails/ReversibleMigration:
295
+ Include:
296
+ - db/migrate/*.rb
297
+
298
+ Rails/FindBy:
299
+ Include:
300
+ - app/models/**/*.rb
301
+
302
+ Rails/FindEach:
303
+ Include:
304
+ - app/models/**/*.rb
305
+
306
+ Rails/HasAndBelongsToMany:
307
+ Include:
308
+ - app/models/**/*.rb
309
+
310
+ Rails/RequestReferer:
311
+ EnforcedStyle: referer
312
+
313
+ Rails/UniqBeforePluck:
314
+ EnforcedStyle: conservative
315
+
316
+ Rails/OutputSafety:
317
+ Enabled: false
318
+
319
+ Naming/AsciiIdentifiers:
320
+ Enabled: true
321
+
322
+ Style/MultilineBlockChain:
323
+ Enabled: false
324
+
325
+ Style/DoubleNegation:
326
+ Enabled: false
327
+
328
+ Style/UnneededPercentQ:
329
+ Enabled: false
330
+
331
+ Lint/Debugger:
332
+ Enabled: true
333
+
334
+ Naming/FileName:
335
+ Enabled: true
336
+
337
+ Style/InverseMethods:
338
+ Enabled: true
339
+
340
+ Layout/IndentArray:
341
+ EnforcedStyle: consistent
342
+
343
+ Layout/IndentHash:
344
+ EnforcedStyle: consistent
345
+
346
+ Metrics/BlockLength:
347
+ Enabled: true
348
+
349
+ Rails/SkipsModelValidations:
350
+ Enabled: true
351
+
352
+ AllCops:
353
+ TargetRubyVersion: 2.3
354
+ Exclude:
355
+ - db/schema.rb
356
+ - tmp/**/*
357
+ - vendor/**/*
358
+ - .rubocop.yml
359
+ - node_modules/**/*
@@ -1,18 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ### 0.11 - 2018-02-15
4
+ Features
5
+ - Supports modern versions of Refile
6
+
7
+ Other
8
+ - Removes the preview of the uploaded image, on order to support modern Refile
9
+
3
10
  ### 0.10.2 - 2015-04-30
4
- Bug fixes:
11
+ Bug fixes
5
12
  - Fixes preview of newly uploaded files in IE
6
13
 
7
14
  ### 0.10.1 - 2015-02-05
8
- Bug fixes:
15
+ Bug fixes
9
16
  - Fixes bundler errors on recent versions of godmin
10
17
 
11
18
  ### 0.10.0 - 2015-06-25
12
19
  Features
13
20
  - New look
14
21
 
15
- Fixes
22
+ Fixes:
16
23
  - Works with nested fields
17
24
 
18
25
  ### 0.9.3 - 2015-02-11
@@ -5,107 +5,44 @@
5
5
  //= require_tree .
6
6
 
7
7
  (function() {
8
-
9
8
  var initialize = function() {
10
-
11
- $('[data-toggle="tooltip"]').tooltip()
12
-
13
9
  $(document).on("upload:start", ".godmin-uploads", function(e) {
14
- var $el = $(this);
15
- $el.removeClass("godmin-uploads-success");
16
- $el.addClass("godmin-uploads-start");
17
- showProgressBar($el);
10
+ var $el = $(e.currentTarget);
11
+ $el.addClass('godmin-uploads--uploading');
18
12
  });
19
13
 
20
14
  $(document).on("upload:progress", ".godmin-uploads", function(e) {
21
- setProgressBarPercentage($(this), 50);
15
+ var $el = $(e.currentTarget);
16
+ $el.find(".progress-bar").css("width", 50 + "%");
22
17
  });
23
18
 
24
19
  $(document).on("upload:complete", ".godmin-uploads", function(e) {
25
- var $el = $(this);
26
- setProgressBarPercentage($el, 100);
27
- $el.removeClass("godmin-uploads-start");
28
- $el.addClass("godmin-uploads-complete");
20
+ var $el = $(e.currentTarget);
21
+ $el.find(".progress-bar").css("width", 100 + "%");
29
22
  });
30
23
 
31
24
  $(document).on("upload:success", ".godmin-uploads", function(e) {
32
- var $el = $(this);
33
- var fileObject = getFileObject($el);
34
- setUploadPreview($el, fileObject);
35
- setDownloadUrl($el, fileObject);
36
- hideProgressBar($el);
37
- $el.removeClass("godmin-uploads-complete");
38
- $el.addClass("godmin-uploads-success");
25
+ var $el = $(e.currentTarget);
26
+ $el.find(".progress-bar").addClass("progress-bar-" + "success");
39
27
  });
40
28
 
41
29
  $(document).on("upload:failure", ".godmin-uploads", function(e) {
42
- setProgressBarContext($(this), "danger");
30
+ var $el = $(e.currentTarget);
31
+ $el.find(".progress-bar").addClass("progress-bar-" + "danger");
43
32
  });
44
33
 
45
- $(document).on("click", ".godmin-uploads__remove-link", function(e) {
34
+ $(document).on("click", ".godmin-uploads__remove-btn", function(e) {
46
35
  e.preventDefault();
47
- var $el = $(this).parents(".godmin-uploads");
48
- $el.removeClass("godmin-uploads-success");
49
- $el.addClass("godmin-uploads-remove");
50
- setDestroy($el);
51
- });
52
-
53
- $(document).on("click", ".remove__actions__undo", function(e) {
54
- var $el = $(this).parents(".godmin-uploads");
55
- $el.removeClass("godmin-uploads-remove");
56
- $el.addClass("godmin-uploads-success");
57
- unsetDestroy($el);
58
- });
59
- };
60
-
61
- var setDestroy = function($el) {
62
- $el.find(".godmin-uploads__remove-field").val("true");
63
- }
64
-
65
- var unsetDestroy = function($el) {
66
- $el.find(".godmin-uploads__remove-field").val("");
67
- }
68
- var setProgressBarPercentage = function($el, percentage) {
69
- $el.find(".progress").find(".progress-bar").css("width", percentage + "%");
70
- };
71
-
72
- var setProgressBarContext = function($el, context) {
73
- $el.find(".progress-bar").addClass("progress-bar-" + context);
74
- };
75
-
76
- var showProgressBar = function($el) {
77
- $el.find(".progress").show();
78
- };
79
-
80
- var hideProgressBar = function($el) {
81
- setTimeout(function() {
82
- $el.find(".progress").slideUp();
83
- setTimeout(function() {
84
- setProgressBarPercentage($el, 0);
85
- }, 1000);
86
- }, 2000);
87
- };
88
36
 
89
- var setUploadPreview = function($el, fileObject) {
90
- $el.find(".godmin-uploads__preview__image").attr(
91
- "src", fileObject.url + "/fill/0/400/" + fileObject.id + "/" + fileObject.filename);
92
- };
93
-
94
- var setDownloadUrl = function($el, fileObject) {
95
- ext = fileObject.filename.split(".").pop().toLowerCase();
96
- $el.find(".godmin-uploads__preview__download__link").attr(
97
- "href", fileObject.url + "/" + fileObject.id + "/" + fileObject.filename);
98
- };
37
+ var $el = $(e.currentTarget);
99
38
 
100
- var getFileObject = function($el) {
101
- var $file = $el.find(".godmin-uploads__file-field")
102
- var fileObject = JSON.parse($file.prev().val());
103
- fileObject.url = $file.data("url")
104
- return fileObject;
39
+ $el.toggleClass("btn-danger").next().val(
40
+ $el.next().val() == "true" ? "" : "true"
41
+ );
42
+ });
105
43
  };
106
44
 
107
45
  $(function() {
108
46
  initialize();
109
47
  });
110
-
111
48
  })();
@@ -1,216 +1,19 @@
1
- $border-radius: 4px;
2
-
3
- .godmin-uploads__info__progress { display: none; }
4
-
5
- .godmin-uploads {
6
- max-height: 152px;
7
- min-height: 152px;
8
- width: 100%;
9
- display: flex;
10
- flex-direction: row;
11
- justify-content: center;
12
- align-items: center;
13
- position: relative;
14
- border-radius: $border-radius;
15
- overflow: hidden;
16
- }
17
-
18
- ///States///
19
- .godmin-uploads {
20
- border: 1px dashed #ddd;
21
- .godmin-uploads__preview,
22
- .godmin-uploads__remove-link,
23
- .godmin-uploads__complete,
24
- .godmin-uploads__info {
25
- display: none;
26
- }
27
- .godmin-uploads__placeholder {
28
- display: block;
29
- }
30
- }
31
-
32
- .godmin-uploads-start {
33
- border: 1px dashed #ddd;
34
- .godmin-uploads__preview__actions
35
- .godmin-uploads__remove-link,
36
- .godmin-uploads__placeholder,
37
- .godmin-uploads__preview__actions {
38
- display: none;
39
- }
40
- .godmin-uploads__info {
41
- display: block;
42
- }
43
- }
44
-
45
- .godmin-uploads-complete {
46
- border: 1px dashed #ddd;
47
- .godmin-uploads__preview__actions
48
- .godmin-uploads__remove-link,
49
- .godmin-uploads__placeholder,
50
- .godmin-uploads__preview__actions {
51
- display: none;
52
- }
53
- .godmin-uploads__info {
54
- display: block;
55
- }
56
- }
57
-
58
- .godmin-uploads-success {
59
- max-height: 1200px;
60
- transition: max-height 0.5s ease-in-out 0.3s;
61
- border: none;
62
- .godmin-uploads__placeholder,
63
- .godmin-uploads__preview__set-to-remove,
64
- .godmin-uploads__complete {
65
- display: none
66
- }
67
- .godmin-uploads__preview,
68
- .godmin-uploads__remove-link {
69
- display: block;
70
- }
71
- }
72
-
73
- .godmin-uploads-remove {
74
- border: none;
75
- .godmin-uploads__remove-link,
76
- .godmin-uploads__placeholder,
77
- .godmin-uploads__preview__actions,
78
- .godmin-uploads__complete {
79
- display: none;
80
- }
81
- .godmin-uploads__preview,
82
- .godmin-uploads__preview__set-to-remove {
83
- display: block;
84
- }
85
- }
86
-
87
- ///end States///
88
-
89
- .godmin-uploads__preview__set-to-remove {
90
- border-radius: $border-radius;
91
- font-size: 1em;
92
- height: 100%;
93
- width: 100%;
94
- background-color: rgba(39, 39, 39, 0.8);
95
- color: #fff;
96
- position: absolute;
97
- top: 0;
98
- .godmin-uploads__preview__set-to-remove__actions {
99
- display: flex;
100
- flex-direction: column;
101
- justify-content: center;
102
- align-items: center;
103
- width: 100%;
104
- height: 100%;
105
- .remove__actions__undo {
106
- padding: 20px 0;
107
- cursor: pointer;
108
- .glyphicon-repeat {
109
- font-size: 2em;
110
- }
111
- }
112
- }
113
- }
114
-
115
- .godmin-uploads__preview {
116
- position: relative;
117
- text-align: center;
118
- &:hover {
119
- .godmin-uploads__preview__actions {
120
- opacity: 1;
121
- transition: opacity 0.2s ease-in-out 0.1s;
122
- }
123
- }
124
- }
125
-
126
- .godmin-uploads__preview__image {
127
- border: 1px solid #ddd;
128
- border-radius: $border-radius;
129
- max-width: 100%;
1
+ .godmin-uploads__image {
2
+ display: block;
3
+ margin-bottom: 1em;
130
4
  max-height: 100%;
131
- min-width: 152px;
132
- min-height: 152px;
133
- }
134
-
135
- .godmin-uploads__preview .glyphicon-file {
136
- font-size: 80px;
137
- height: 150px;
138
- width: 150px;
139
- line-height: 150px;
140
- }
141
-
142
- .godmin-uploads__placeholder {
143
- cursor: pointer;
144
- text-align: center;
145
- width: 100px;
146
- .glyphicon-cloud-upload {
147
- font-size: 40px;
148
- }
149
- }
150
-
151
- .godmin-uploads__placeholder__file-label {
152
- cursor: pointer;
153
- }
154
-
155
- .godmin-uploads__placeholder {
156
- color: #ddd;
157
- &:hover {
158
- color: #bbb;
159
- }
5
+ max-width: 100%;
6
+ min-height: 150px;
7
+ min-width: 150px;
160
8
  }
161
9
 
162
- .godmin-uploads__preview__actions {
163
- opacity: 0;
164
- background-color: rgba(0, 0, 0, 0.5);
165
- width: 3em;
166
- height: 100%;
167
- position: absolute;
168
- top: 0;
169
- right: 0;
170
- z-index: 1;
171
- border-top: 1px solid #ddd;
172
- border-bottom: 1px solid #ddd;
173
- border-top-right-radius: 4px;
174
- border-bottom-right-radius: 4px;
10
+ .godmin-uploads__progress {
11
+ display: none;
12
+ margin-bottom: 1em;
175
13
  }
176
14
 
177
- .godmin-uploads__remove-link,
178
- .godmin-uploads__preview__download,
179
- .godmin-uploads__preview__update {
180
- float: right;
181
- display: block;
182
- width: 100%;
183
- height: 50px;
184
- color: #fff;
185
- font-weight: bold;
186
- .glyphicon {
187
- font-size: 1.5em;
188
- line-height: 50px;
189
- }
190
- &:hover {
191
- background-color: rgba(0, 0, 0, 0.8);
192
- cursor: pointer;
193
- color: #ddd;
194
- text-decoration: none;
195
- }
196
- &:active {
197
- color: #bbb;
198
- }
199
- a{
200
- color: #fff;
201
- text-decoration: none;
202
- &:hover { color: #ddd; }
203
- &:active { color: #bbb; }
15
+ .godmin-uploads--uploading {
16
+ .godmin-uploads__progress {
17
+ display: block;
204
18
  }
205
19
  }
206
-
207
- .godmin-uploads__preview__update__file-label { cursor: pointer; }
208
-
209
- .godmin-uploads__info {
210
- width: 100%;
211
- }
212
-
213
- .godmin-uploads__info__progress {
214
- margin: 0 auto;
215
- width: 80%;
216
- }
@@ -1,62 +1,30 @@
1
- <div class="godmin-uploads <%= 'godmin-uploads-success' if f.object.send(attachment) %>">
1
+ <div class="godmin-uploads">
2
+ <% if preview %>
3
+ <%= attachment_image_tag(f.object, attachment, :fill, 0, 400, class: "godmin-uploads__image") %>
4
+ <% end %>
2
5
 
3
- <%= f.attachment_field attachment, direct: true, class: "hidden godmin-uploads__file-field" %>
6
+ <%= f.attachment_field attachment, direct: true, class: "hidden" %>
4
7
 
5
- <div class="godmin-uploads__placeholder">
6
- <%= f.label attachment, class:"godmin-uploads__placeholder__file-label" do %>
7
- <div class="glyphicon glyphicon-cloud-upload"></div>
8
- <div><%= t("godmin.uploads.upload_file")%></div>
9
- <% end %>
8
+ <div class="godmin-uploads__progress progress">
9
+ <div class="progress-bar" style="width: 0%;"></div>
10
10
  </div>
11
11
 
12
- <div class="godmin-uploads__preview">
13
- <% if preview %>
14
- <%= attachment_image_tag(f.object, attachment, :fill, 0, 400, fallback: "http://placehold.it/150/f5f5f5/cccccc", class:"godmin-uploads__preview__image", alt:"") %>
15
- <% else %>
16
- <div class="glyphicon glyphicon-file godmin-uploads__preview__icon"></div>
17
- <% end %>
18
-
19
- <div class="godmin-uploads__preview__actions">
20
-
21
- <% if remove %>
22
- <%= f.hidden_field "remove_#{attachment}", class: "godmin-uploads__remove-field" %>
23
- <div class="godmin-uploads__preview__remove" title="<%= t("godmin.uploads.destroy_file") %>">
24
- <%= link_to "#", class: "godmin-uploads__remove-link" do %>
25
- <i class="glyphicon glyphicon-remove"></i>
26
- <% end %>
27
- </div>
28
- <% end %>
29
-
30
- <div class="godmin-uploads__preview__download" title="<%= t("godmin.uploads.download_file") %>">
31
- <%= link_to attachment_url(f.object, attachment), class: "godmin-uploads__preview__download__link" do %>
32
- <i class="glyphicon glyphicon-cloud-download"></i>
33
- <% end %>
34
- </div>
35
-
36
- <div class="godmin-uploads__preview__update" title="<%= t("godmin.uploads.upload_file") %>">
37
- <%= f.label attachment, class:"godmin-uploads__preview__update__file-label" do %>
38
- <i class="glyphicon glyphicon-cloud-upload"></i>
39
- <% end %>
40
- </div>
41
-
42
- </div>
43
-
44
- <div class="godmin-uploads__preview__set-to-remove">
45
- <div class="godmin-uploads__preview__set-to-remove__actions">
46
- <div> <%= t("godmin.uploads.set_to_remove") %> </div>
47
- <div class="remove__actions__undo">
48
- <i class="glyphicon glyphicon-repeat"></i>
49
- <div> <%= t("godmin.uploads.undo_destroy_file") %> </div>
50
- </div>
51
- </div>
52
- </div>
53
- </div>
54
-
55
- <div class="godmin-uploads__info">
56
- <div class="godmin-uploads__info__progress progress">
57
- <div class="progress-bar progress-bar-striped active" style="width: 0%;">
58
- </div>
59
- </div>
60
- </div>
12
+ <%= f.label attachment, class: "btn btn-default" do %>
13
+ <i class="glyphicon glyphicon-cloud-upload"></i>
14
+ <% end %>
61
15
 
16
+ <% if f.object.send(attachment) %>
17
+ <%= link_to attachment_url(f.object, attachment), class: "btn btn-default" do %>
18
+ <i class="glyphicon glyphicon-cloud-download"></i>
19
+ <% end %>
20
+ <% end %>
21
+
22
+ <% if f.object.send(attachment) %>
23
+ <% if remove %>
24
+ <button class="godmin-uploads__remove-btn btn btn-default">
25
+ <i class="glyphicon glyphicon-remove"></i>
26
+ </button>
27
+ <%= f.hidden_field "remove_#{attachment}", class: "godmin-uploads__remove-field" %>
28
+ <% end %>
29
+ <% end %>
62
30
  </div>
@@ -20,8 +20,7 @@ Gem::Specification.new do |gem|
20
20
  gem.require_paths = ["lib"]
21
21
 
22
22
  gem.add_dependency "godmin", "< 2.0", ">= 0.9.7"
23
- gem.add_dependency "refile", "~> 0.5.3"
24
- gem.add_dependency "mini_magick", "~> 4.0.1"
23
+ gem.add_dependency "refile", "> 0.5.3"
25
24
 
26
25
  gem.add_development_dependency "bundler", "~> 1.7"
27
26
  gem.add_development_dependency "rake", "~> 10.0"
@@ -1,6 +1,5 @@
1
1
  require "refile"
2
2
  require "refile/rails"
3
- require "refile/image_processing"
4
3
  require "godmin/uploads/engine"
5
4
  require "godmin/uploads/helper"
6
5
  require "godmin/uploads/version"
@@ -1,5 +1,5 @@
1
1
  module Godmin
2
2
  module Uploads
3
- VERSION = "0.10.2"
3
+ VERSION = "0.11"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: godmin-uploads
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: '0.11'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Ljungblad
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-30 00:00:00.000000000 Z
12
+ date: 2018-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: godmin
@@ -35,30 +35,16 @@ dependencies:
35
35
  name: refile
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.5.3
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.5.3
48
- - !ruby/object:Gem::Dependency
49
- name: mini_magick
50
- requirement: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 4.0.1
55
- type: :runtime
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 4.0.1
62
48
  - !ruby/object:Gem::Dependency
63
49
  name: bundler
64
50
  requirement: !ruby/object:Gem::Requirement
@@ -104,8 +90,6 @@ files:
104
90
  - app/assets/javascripts/godmin-uploads/index.js
105
91
  - app/assets/stylesheets/godmin-uploads.css.scss
106
92
  - app/views/godmin/uploads/_uploader.html.erb
107
- - config/locales/en.yml
108
- - config/locales/sv.yml
109
93
  - godmin-uploads.gemspec
110
94
  - lib/godmin/uploads.rb
111
95
  - lib/godmin/uploads/engine.rb
@@ -171,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
155
  version: '0'
172
156
  requirements: []
173
157
  rubyforge_project:
174
- rubygems_version: 2.4.5.1
158
+ rubygems_version: 2.5.2.1
175
159
  signing_key:
176
160
  specification_version: 4
177
161
  summary: File uploads for the Godmin admin engine for Rails 4+
@@ -216,4 +200,3 @@ test_files:
216
200
  - test/dummy/public/500.html
217
201
  - test/dummy/public/favicon.ico
218
202
  - test/test_helper.rb
219
- has_rdoc:
@@ -1,8 +0,0 @@
1
- en:
2
- godmin:
3
- uploads:
4
- upload_file: Upload
5
- download_file: Download
6
- destroy_file: Remove
7
- undo_destroy_file: Undo
8
- set_to_remove: The file will be removed on save
@@ -1,8 +0,0 @@
1
- sv:
2
- godmin:
3
- uploads:
4
- upload_file: Ladda upp
5
- download_file: Ladda ner
6
- destroy_file: Ta bort
7
- undo_destroy_file: Ångra
8
- set_to_remove: Filen tas bort när du sparar