simple_form_attachments 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20fff88df741e411c95ed3fedf922493973e648f
4
- data.tar.gz: f794f357a9e3c1182bf16395f1c1b9559ebc04b9
3
+ metadata.gz: 5438c1e936aadfb3a6f0c480c7e5924c0daaf827
4
+ data.tar.gz: 161f086f633ff44dd4d899be439aafe0b0bbec68
5
5
  SHA512:
6
- metadata.gz: 0f559414630de4992c5ad1a4ea18f8f47d7e23c30c7f48ed63156d6195a28e4cedc924019b6b7bcb413fb9ce7ef18bea593272d931abc28912dc6ededeba32fb
7
- data.tar.gz: 18348f0b5fbbc40d441535d0667239e0cfe389c7e387eab25eaafa719b27a2a3dc038193cb70910b968a2f18eca417d98fbc65f058d3fe4731a6e5c133b4aca3
6
+ metadata.gz: 67a75e03e65a81babea65304df653c22d169f26de17efa41e4fb9cc815339e87c8f06f03db2291d61843feca515e5dd829395b9a7e74955b200eb00c7598ae24
7
+ data.tar.gz: fafeda901c327e9488230f7f4a948f53145f4c04cf94d56f175ecc413fb77059c20f8a43efa88ff991092c98bf21f296437be30a09bfaea607afa1e9a7f50d6e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_form_attachments (0.0.9)
4
+ simple_form_attachments (0.1.0)
5
5
  jquery-ui-rails
6
6
  rails (>= 4.2)
7
7
  rails-assets-blueimp-file-upload (>= 9.6.0)
@@ -49,7 +49,7 @@ GEM
49
49
  thread_safe (~> 0.3, >= 0.3.4)
50
50
  tzinfo (~> 1.1)
51
51
  addressable (2.3.8)
52
- arel (6.0.2)
52
+ arel (6.0.3)
53
53
  bson (3.1.2)
54
54
  builder (3.2.2)
55
55
  coderay (1.1.0)
@@ -71,7 +71,7 @@ GEM
71
71
  erubis (2.7.0)
72
72
  ffi (1.9.10)
73
73
  formatador (0.2.5)
74
- globalid (0.3.5)
74
+ globalid (0.3.6)
75
75
  activesupport (>= 4.1.0)
76
76
  guard (2.12.8)
77
77
  formatador (>= 0.2.4)
@@ -145,12 +145,12 @@ GEM
145
145
  railties (= 4.2.3)
146
146
  sprockets-rails
147
147
  rails-assets-blueimp-canvas-to-blob (2.2.0)
148
- rails-assets-blueimp-file-upload (9.10.5)
148
+ rails-assets-blueimp-file-upload (9.11.0)
149
149
  rails-assets-blueimp-canvas-to-blob (>= 2.1.1)
150
150
  rails-assets-blueimp-load-image (>= 1.13.0)
151
151
  rails-assets-blueimp-tmpl (>= 2.5.4)
152
152
  rails-assets-jquery (>= 1.6)
153
- rails-assets-blueimp-load-image (1.13.1)
153
+ rails-assets-blueimp-load-image (1.14.0)
154
154
  rails-assets-blueimp-tmpl (2.5.5)
155
155
  rails-assets-handlebars (3.0.3)
156
156
  rails-assets-jquery (2.1.4)
@@ -188,7 +188,7 @@ GEM
188
188
  temple (~> 0.7.3)
189
189
  tilt (>= 1.3.3, < 2.1)
190
190
  slop (3.6.0)
191
- sprockets (3.2.0)
191
+ sprockets (3.3.2)
192
192
  rack (~> 1.0)
193
193
  sprockets-rails (2.3.2)
194
194
  actionpack (>= 3.0)
@@ -9,9 +9,20 @@
9
9
  defaults =
10
10
  debug: false
11
11
  sortable_options:
12
- items: 'tr'
13
12
  handle: '.handle'
14
13
  axis: 'y'
14
+ items: '> tr'
15
+ forcePlaceholderSize: true
16
+ placeholder: 'attachment-placeholder'
17
+ start: (event, ui) ->
18
+ cellCount = 0
19
+ $('td, th', ui.helper).each ->
20
+ colspan = 1
21
+ colspanAttr = $(this).attr('colspan')
22
+ if colspanAttr > 1 then colspan = colspanAttr
23
+ cellCount += colspan
24
+ ui.placeholder.html '<td colspan="#{cellCount}">&nbsp;</td>'
25
+
15
26
  slide_speed: 'fast'
16
27
 
17
28
  # ---------------------------------------------------------------------
@@ -34,7 +45,8 @@
34
45
  @init_fileupload()
35
46
 
36
47
  init_sortable: () ->
37
- @get_attachment_list().sortable(@options.sortable_options)
48
+ @get_attachment_list().add( @get_attachment_list().find('th, td') ).each -> $(this).outerWidth $(this).outerWidth()
49
+ @get_attachment_list().find('tbody').sortable(@options.sortable_options).disableSelection()
38
50
 
39
51
  init_fileupload: () ->
40
52
  console.log "init jQuery.fileupload" if @options.debug
@@ -83,6 +95,7 @@
83
95
  fail: (e, data) =>
84
96
  @set_logs(e, data) if @options.debug
85
97
  $result = $(JSON.parse(data.jqXHR.responseText).html).addClass('has_error')
98
+ $result.find('td.errors').attr('colspan', '3');
86
99
  data.context.replaceWith($result)
87
100
 
88
101
  progress: (e, data) =>
@@ -1,3 +1,3 @@
1
1
  module SimpleFormAttachments
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -34,6 +34,7 @@ body {
34
34
  @include default-font-size;
35
35
  }
36
36
 
37
+
37
38
  // --------------------------------------------------------------------
38
39
 
39
40
  input[type="file"] {
@@ -51,10 +52,11 @@ div.input.attachment {
51
52
  }
52
53
 
53
54
  table.attachments.list {
55
+ width: 100%;
54
56
  margin-bottom: $default-line-height;
55
57
  border-collapse: collapse;
56
- width: 100%;
57
- box-sizing: border-box;
58
+
59
+ // ---------------------------------------------------------------------
58
60
 
59
61
  &.sortable {
60
62
  tr.attachment {
@@ -64,31 +66,51 @@ div.input.attachment {
64
66
  }
65
67
  }
66
68
 
69
+ // ---------------------------------------------------------------------
70
+
71
+ tr.attachment-placeholder,
67
72
  tr.attachment {
68
- height: $image-height + ($padding-large*2);
69
73
  width: 100%;
74
+ height: $image-height + ($padding-large*2);
75
+ }
76
+
77
+ tr.attachment {
70
78
  background-color: #eee;
71
79
  border-bottom: 1px solid white;
72
- border-left: 0;
73
80
 
74
81
  &.has_error {
75
82
  color: red;
76
83
  background-color: pink;
84
+ width: 100%;
77
85
  height: $image-height + ($padding-large*2);
78
86
 
79
87
  td.handle {
88
+ color: transparent;
89
+ text-shadow: none;
80
90
  border-right: 0;
81
-
82
- &:before,
83
- &:after {
84
- display: none;
85
- }
86
91
  }
87
92
  }
88
93
 
89
94
  td.handle {
90
95
  display: none;
91
- box-sizing: border-box;
96
+ content: '....';
97
+ border-right: 1px solid #FFF;
98
+ padding: 0 $padding $padding-large $padding;
99
+ overflow: hidden;
100
+ cursor: move;
101
+ margin-top: -20px;
102
+ vertical-align: middle;
103
+ font-size: 12px;
104
+ line-height: 5px;
105
+ font-family: sans-serif;
106
+ letter-spacing: 2px;
107
+ color: #aaa;
108
+ text-shadow: 1px 0 1px #eee;
109
+ width: 10px;
110
+
111
+ &:after {
112
+ content: '.. .. .. ..';
113
+ }
92
114
  }
93
115
 
94
116
  td.hidden {
@@ -96,7 +118,6 @@ div.input.attachment {
96
118
  }
97
119
 
98
120
  td {
99
- box-sizing: border-box;
100
121
  padding: $padding-large;
101
122
 
102
123
  &:first-child {
@@ -111,19 +132,6 @@ div.input.attachment {
111
132
  }
112
133
  }
113
134
 
114
- td.handle {
115
- width: 18px;
116
- vertical-align: middle;
117
- color: #aaa;
118
- cursor: move;
119
- border-right: 1px solid white;
120
- padding: 0 $padding;
121
-
122
- &:before {
123
- content: "░";
124
- }
125
- }
126
-
127
135
  td.thumb {
128
136
  width: $image-height + ($padding-large*2);
129
137
 
@@ -216,5 +224,3 @@ div.input.attachment {
216
224
  outline: 6px solid yellow;
217
225
  }
218
226
  }
219
-
220
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_attachments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-04 00:00:00.000000000 Z
12
+ date: 2015-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails