simple_form_attachments 0.2.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +118 -113
- data/README.md +29 -14
- data/app/controllers/simple_form_attachments/upload_controller.rb +3 -1
- data/app/models/concerns/simple_form_attachments/attachment.rb +1 -1
- data/app/models/concerns/simple_form_attachments/has_attachments.rb +11 -8
- data/app/views/layouts/simple_form_attachments/_attachment_layout.html.slim +8 -8
- data/app/views/simple_form_attachments/_errors.html.slim +4 -3
- data/app/views/simple_form_attachments/attachments/_attachment.hbs.slim +14 -15
- data/app/views/simple_form_attachments/attachments/_attachment.html.slim +4 -2
- data/config/locales/simple_form_attachments/simple_form_attachments.en.yml +8 -3
- data/config/routes.rb +2 -2
- data/lib/assets/javascripts/simple_form_attachments/{simple_form_attachments.js.coffee → simple_form_attachments.coffee.erb} +24 -41
- data/lib/assets/stylesheets/simple_form_attachments/__attachment.scss.erb +8 -0
- data/lib/assets/stylesheets/simple_form_attachments/__attachment__col.scss.erb +1 -0
- data/lib/assets/stylesheets/simple_form_attachments/__attachment__col__actions.scss.erb +3 -0
- data/lib/assets/stylesheets/simple_form_attachments/__attachment__col__errors.scss.erb +10 -0
- data/lib/assets/stylesheets/simple_form_attachments/__attachment__col__fields.scss.erb +4 -0
- data/lib/assets/stylesheets/simple_form_attachments/__attachment__col__file_info.scss.erb +4 -0
- data/lib/assets/stylesheets/simple_form_attachments/__attachment__col__handle.scss.erb +6 -0
- data/lib/assets/stylesheets/simple_form_attachments/__attachment__col__hidden.scss.erb +3 -0
- data/lib/assets/stylesheets/simple_form_attachments/__attachment__col__progress.scss.erb +14 -0
- data/lib/assets/stylesheets/simple_form_attachments/__attachment__col__thumb.scss.erb +9 -0
- data/lib/assets/stylesheets/simple_form_attachments/__attachment_list.scss.erb +11 -0
- data/lib/assets/stylesheets/simple_form_attachments/__button.scss.erb +9 -0
- data/lib/assets/stylesheets/simple_form_attachments/__label.scss.erb +3 -0
- data/lib/assets/stylesheets/simple_form_attachments/simple_form_attachments.scss.erb +29 -0
- data/lib/assets/stylesheets/simple_form_attachments.css +4 -0
- data/lib/simple_form_attachments/attachment_input.rb +12 -11
- data/lib/simple_form_attachments/version.rb +1 -1
- data/lib/simple_form_attachments.rb +12 -0
- data/simple_form_attachments.gemspec +2 -1
- data/test/controllers/simple_form_attachments/upload_controller_test.rb +53 -57
- data/test/dummy/Gemfile +1 -0
- data/test/dummy/Gemfile.lock +80 -74
- data/test/dummy/app/assets/stylesheets/application.css +5 -0
- data/test/dummy/app/models/attachment_image.rb +1 -0
- data/test/dummy/app/views/simple_form_attachments/attachment_images/_attachment_image.html.slim +12 -9
- data/test/dummy/config/environments/test.rb +2 -2
- data/test/dummy/config/mongoid.yml +5 -8
- data/test/dummy/config/routes.rb +1 -3
- data/test/simple_form_attachments_test.rb +30 -0
- data/test/test_helper.rb +5 -1
- metadata +46 -16
- data/test/dummy/app/assets/stylesheets/application.css.scss +0 -5
- data/test/dummy/app/assets/stylesheets/tests.scss +0 -233
@@ -1,233 +0,0 @@
|
|
1
|
-
$image-height: 60px;
|
2
|
-
|
3
|
-
$font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
|
4
|
-
|
5
|
-
$default-font-size: 14px;
|
6
|
-
$default-line-height: 16px;
|
7
|
-
$small-font-size: 12px;
|
8
|
-
$small-line-height: 14px;
|
9
|
-
$padding: 4px;
|
10
|
-
$padding-large: 8px;
|
11
|
-
|
12
|
-
@mixin font {
|
13
|
-
font-family: $font-family;
|
14
|
-
font-size: $default-font-size;
|
15
|
-
line-height: $default-line-height;
|
16
|
-
font-weight: normal;
|
17
|
-
font-style: normal;
|
18
|
-
letter-spacing: 0;
|
19
|
-
color: black;
|
20
|
-
}
|
21
|
-
|
22
|
-
@mixin default-font-size {
|
23
|
-
font-size: $default-font-size;
|
24
|
-
line-height: $default-line-height;
|
25
|
-
}
|
26
|
-
|
27
|
-
@mixin small-font-size {
|
28
|
-
font-size: $small-font-size;
|
29
|
-
line-height: $small-line-height;
|
30
|
-
}
|
31
|
-
|
32
|
-
body {
|
33
|
-
@include font;
|
34
|
-
@include default-font-size;
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
// --------------------------------------------------------------------
|
39
|
-
|
40
|
-
div.input.attachment {
|
41
|
-
label[for="attachment_file"] {
|
42
|
-
margin-bottom: $default-line-height;
|
43
|
-
|
44
|
-
span.button {
|
45
|
-
display: none;
|
46
|
-
}
|
47
|
-
}
|
48
|
-
|
49
|
-
div.simple_form_attachments {
|
50
|
-
|
51
|
-
input[type="file"] {
|
52
|
-
margin: 0;
|
53
|
-
padding: 0;
|
54
|
-
}
|
55
|
-
|
56
|
-
// ---------------------------------------------------------------------
|
57
|
-
|
58
|
-
table.attachments.list {
|
59
|
-
width: 100%;
|
60
|
-
margin-bottom: $default-line-height;
|
61
|
-
border-collapse: collapse;
|
62
|
-
|
63
|
-
// ---------------------------------------------------------------------
|
64
|
-
|
65
|
-
&.sortable {
|
66
|
-
tr.attachment {
|
67
|
-
td.handle {
|
68
|
-
display: table-cell;
|
69
|
-
}
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
// ---------------------------------------------------------------------
|
74
|
-
|
75
|
-
tr.attachment-placeholder,
|
76
|
-
tr.attachment {
|
77
|
-
width: 100%;
|
78
|
-
height: $image-height + ($padding-large*2);
|
79
|
-
}
|
80
|
-
|
81
|
-
tr.attachment {
|
82
|
-
background-color: #eee;
|
83
|
-
border-bottom: 1px solid white;
|
84
|
-
|
85
|
-
&.has_error {
|
86
|
-
color: red;
|
87
|
-
background-color: pink;
|
88
|
-
width: 100%;
|
89
|
-
height: $image-height + ($padding-large*2);
|
90
|
-
|
91
|
-
td.handle {
|
92
|
-
color: transparent;
|
93
|
-
text-shadow: none;
|
94
|
-
border-right: 0;
|
95
|
-
}
|
96
|
-
}
|
97
|
-
|
98
|
-
td.handle {
|
99
|
-
display: none;
|
100
|
-
content: '....';
|
101
|
-
border-right: 1px solid #FFF;
|
102
|
-
padding: 0 $padding $padding-large $padding;
|
103
|
-
overflow: hidden;
|
104
|
-
cursor: move;
|
105
|
-
margin-top: -20px;
|
106
|
-
vertical-align: middle;
|
107
|
-
font-size: 12px;
|
108
|
-
line-height: 5px;
|
109
|
-
font-family: sans-serif;
|
110
|
-
letter-spacing: 2px;
|
111
|
-
color: #aaa;
|
112
|
-
text-shadow: 1px 0 1px #eee;
|
113
|
-
width: 10px;
|
114
|
-
|
115
|
-
&:after {
|
116
|
-
content: '.. .. .. ..';
|
117
|
-
}
|
118
|
-
}
|
119
|
-
|
120
|
-
td.hidden {
|
121
|
-
display: none;
|
122
|
-
}
|
123
|
-
|
124
|
-
td {
|
125
|
-
padding: $padding-large;
|
126
|
-
|
127
|
-
&:first-child {
|
128
|
-
border-top-left-radius: 2px;
|
129
|
-
border-bottom-left-radius: 2px;
|
130
|
-
max-width: $padding-large*2;
|
131
|
-
}
|
132
|
-
|
133
|
-
&:last-child {
|
134
|
-
border-top-right-radius: 2px;
|
135
|
-
border-bottom-right-radius: 2px;
|
136
|
-
}
|
137
|
-
}
|
138
|
-
|
139
|
-
td.thumb {
|
140
|
-
width: $image-height + ($padding-large*2);
|
141
|
-
|
142
|
-
div.thumb {
|
143
|
-
width: $image-height;
|
144
|
-
height: $image-height;
|
145
|
-
background-position: center center;
|
146
|
-
background-repeat: no-repeat;
|
147
|
-
overflow: hidden;
|
148
|
-
|
149
|
-
img {
|
150
|
-
width: $image-height;
|
151
|
-
height: $image-height;
|
152
|
-
object-fit: cover;
|
153
|
-
object-position: center;
|
154
|
-
}
|
155
|
-
}
|
156
|
-
}
|
157
|
-
|
158
|
-
td.file_info {
|
159
|
-
@include small-font-size;
|
160
|
-
text-overflow: ellipsis;
|
161
|
-
white-space: nowrap;
|
162
|
-
overflow: hidden;
|
163
|
-
|
164
|
-
span {
|
165
|
-
display: block;
|
166
|
-
|
167
|
-
&.size {
|
168
|
-
&:after {
|
169
|
-
content: ' KB';
|
170
|
-
}
|
171
|
-
}
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
td.size {
|
176
|
-
@include small-font-size;
|
177
|
-
}
|
178
|
-
|
179
|
-
td.errors {
|
180
|
-
@include small-font-size;
|
181
|
-
ul.errors {
|
182
|
-
list-style: none;
|
183
|
-
padding: 0;
|
184
|
-
margin: 0;
|
185
|
-
li.error {}
|
186
|
-
}
|
187
|
-
}
|
188
|
-
|
189
|
-
td.fields {
|
190
|
-
input {
|
191
|
-
width: 100%;
|
192
|
-
max-width: 500px;
|
193
|
-
}
|
194
|
-
}
|
195
|
-
|
196
|
-
td.progress {
|
197
|
-
div.progress.container {
|
198
|
-
background-color: #ccc;
|
199
|
-
width: 100%;
|
200
|
-
max-width: 500px;
|
201
|
-
|
202
|
-
div.progress.bar {
|
203
|
-
background-color: blue;
|
204
|
-
width: 0;
|
205
|
-
height: 20px;
|
206
|
-
}
|
207
|
-
}
|
208
|
-
}
|
209
|
-
|
210
|
-
td.cancel.delete.close {
|
211
|
-
white-space: nowrap;
|
212
|
-
width: 1%;
|
213
|
-
|
214
|
-
button.close {
|
215
|
-
// @include font-awesome-before('\f00d');
|
216
|
-
&:before {
|
217
|
-
content: "\00D7";
|
218
|
-
}
|
219
|
-
margin-right: $padding-large;
|
220
|
-
color: red;
|
221
|
-
}
|
222
|
-
}
|
223
|
-
}
|
224
|
-
}
|
225
|
-
|
226
|
-
// ---------------------------------------------------------------------
|
227
|
-
|
228
|
-
&.dragover {
|
229
|
-
border-radius: 2px;
|
230
|
-
outline: 1px solid yellow;
|
231
|
-
}
|
232
|
-
}
|
233
|
-
}
|