lolita-file-upload 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/.document +5 -5
  2. data/.rspec +2 -2
  3. data/Gemfile +21 -21
  4. data/LICENSE.txt +20 -20
  5. data/README.rdoc +27 -27
  6. data/Rakefile +39 -39
  7. data/VERSION +1 -1
  8. data/app/controllers/lolita/uploads_controller.rb +58 -0
  9. data/app/models/lolita/upload/file.rb +43 -43
  10. data/app/uploaders/file_uploader.rb +20 -20
  11. data/app/views/components/lolita/configuration/tab/files/_cells.html.erb +10 -4
  12. data/app/views/components/lolita/configuration/tab/files/_destroy.js.erb +2 -2
  13. data/app/views/components/lolita/configuration/tab/files/_display.html.erb +10 -11
  14. data/app/views/components/lolita/configuration/tab/files/_edit.js.erb +1 -1
  15. data/app/views/components/lolita/configuration/tab/files/_file.html.erb +5 -0
  16. data/app/views/components/lolita/configuration/tab/files/_fixed_gallery.html.haml +33 -0
  17. data/app/views/components/lolita/configuration/tab/files/_form.html.erb +7 -3
  18. data/app/views/components/lolita/configuration/tab/files/_list.html.erb +13 -13
  19. data/app/views/components/lolita/configuration/tab/files/_list_form.html.erb +5 -5
  20. data/app/views/components/lolita/configuration/tab/files/_row.html.erb +5 -2
  21. data/app/views/components/lolita/configuration/tab/files/_update.js.erb +1 -1
  22. data/app/views/components/lolita/configuration/tab/files/_upload_script.html.erb +79 -77
  23. data/config/locales/en.yml +18 -18
  24. data/features/configuration_for_tab.feature +25 -25
  25. data/features/connect_with_lolita.feature +14 -14
  26. data/features/extend_resources_with_new_routes.feature +16 -16
  27. data/features/step_definitions/lolita_steps.rb +112 -112
  28. data/features/support/env.rb +15 -15
  29. data/features/support_byte_converter.feature +31 -31
  30. data/features/upload_file.feature +15 -15
  31. data/lib/generators/lolita_file_upload/assets_generator.rb +12 -12
  32. data/lib/generators/lolita_file_upload/install_generator.rb +19 -19
  33. data/lib/generators/lolita_file_upload/templates/migration.rb +24 -24
  34. data/lib/lolita-file-upload.rb +35 -36
  35. data/lib/lolita-file-upload/configuration/tab/files.rb +108 -57
  36. data/lib/lolita-file-upload/module.rb +10 -6
  37. data/lib/lolita-file-upload/rails.rb +7 -7
  38. data/lib/lolita-file-upload/rails/file_upload_routes.rb +14 -19
  39. data/lib/support/bytes.rb +58 -58
  40. data/lolita-file-upload.gemspec +9 -13
  41. data/public/javascripts/lolita/upload/I18n/lv.js +21 -21
  42. data/public/javascripts/lolita/upload/I18n/ru.js +21 -21
  43. data/public/javascripts/lolita/upload/plupload.full.js +1 -1
  44. data/public/stylesheets/lolita/upload/jquery.ui.plupload.css +139 -139
  45. data/public/stylesheets/lolita/upload/plupload.queue.css +177 -177
  46. data/spec/configuration/tab/files_spec.rb +36 -36
  47. data/spec/lolita/support/bytes_spec.rb +35 -35
  48. data/spec/models/file_spec.rb +33 -33
  49. data/spec/spec_helper.rb +32 -29
  50. data/spec/support/post.rb +2 -2
  51. data/spec/uploaders/file_uploader_spec.rb +11 -11
  52. data/test_orm/active_record.rb +11 -11
  53. data/test_orm/active_record/news.rb +11 -11
  54. data/test_orm/active_record/post.rb +12 -12
  55. data/test_orm/active_record/tag.rb +2 -2
  56. data/test_orm/config/active_record.yml +1 -1
  57. data/test_orm/coverage.rb +18 -18
  58. data/test_orm/db/migrate/01_create_posts.rb +14 -14
  59. data/test_orm/db/migrate/02_create_files.rb +19 -19
  60. data/test_orm/db/migrate/03_create_news.rb +16 -16
  61. data/test_orm/db/migrate/04_create_tags.rb +14 -14
  62. data/test_orm/files/large_file.txt +201 -201
  63. data/test_orm/files/normal_file.txt +1 -1
  64. data/test_orm/rails/config/application.rb +7 -7
  65. data/test_orm/rails/config/enviroment.rb +4 -4
  66. data/test_orm/rails/config/routes.rb +2 -2
  67. data/test_orm/rails/log/development.log +7 -7
  68. data/test_orm/support.rb +26 -26
  69. data/test_orm/uploaders/list_image_uploader.rb +5 -5
  70. data/test_orm/uploaders/main_image_uploader.rb +5 -5
  71. metadata +19 -23
  72. data/app/controllers/lolita/upload/files_controller.rb +0 -51
  73. data/app/controllers/lolita/upload/images_controller.rb +0 -52
  74. data/lib/lolita-file-upload/configuration/tab/images.rb +0 -20
  75. data/spec/configuration/tab/images_spec.rb +0 -16
  76. data/upload/lolita/upload/file/201105/1/large_file.txt +0 -201
  77. data/upload/lolita/upload/file/201106/1/large_file.txt +0 -201
  78. data/upload/misc/large_file.txt +0 -201
@@ -1,177 +1,177 @@
1
- /*
2
- Plupload
3
- ------------------------------------------------------------------- */
4
-
5
- .plupload_button {
6
- display: -moz-inline-box; /* FF < 3*/
7
- display: inline-block;
8
- font: normal 12px sans-serif;
9
- text-decoration: none;
10
- color: #42454a;
11
- border: 1px solid #bababa;
12
- padding: 2px 8px 3px 20px;
13
- margin-right: 4px;
14
- background: #f3f3f3 url('/images/lolita/upload/plupload/buttons.png') no-repeat 0 center;
15
- outline: 0;
16
-
17
- /* Optional rounded corners for browsers that support it */
18
- -moz-border-radius: 3px;
19
- -khtml-border-radius: 3px;
20
- -webkit-border-radius: 3px;
21
- border-radius: 3px;
22
- }
23
-
24
- .plupload_button:hover {
25
- color: #000;
26
- text-decoration: none;
27
- }
28
-
29
- .plupload_disabled, a.plupload_disabled:hover {
30
- color: #737373;
31
- border-color: #c5c5c5;
32
- background: #ededed url('/images/lolita/upload/plupload/buttons-disabled.png') no-repeat 0 center;
33
- cursor: default;
34
- }
35
-
36
- .plupload_add {
37
- background-position: -181px center;
38
- }
39
-
40
- .plupload_wrapper {
41
- font: normal 11px Verdana,sans-serif;
42
- width: 100%;
43
- }
44
-
45
- .plupload_container {
46
- padding: 8px;
47
- background: url('/images/lolita/upload/plupload/transp50.png');
48
- /*-moz-border-radius: 5px;*/
49
- }
50
-
51
- .plupload_container input {
52
- border: 1px solid #DDD;
53
- font: normal 11px Verdana,sans-serif;
54
- width: 98%;
55
- }
56
-
57
- .plupload_header {background: #2A2C2E url('/images/lolita/upload/plupload/backgrounds.gif') repeat-x;}
58
- .plupload_header_content {
59
- background: url('/images/lolita/upload/plupload/backgrounds.gif') no-repeat 0 -317px;
60
- min-height: 56px;
61
- padding-left: 60px;
62
- color: #FFF;
63
- }
64
- .plupload_header_title {
65
- font: normal 18px sans-serif;
66
- padding: 6px 0 3px;
67
- }
68
- .plupload_header_text {
69
- font: normal 12px sans-serif;
70
- }
71
-
72
- .plupload_filelist {
73
- margin: 0;
74
- padding: 0;
75
- list-style: none;
76
- }
77
-
78
- .plupload_scroll .plupload_filelist {
79
- height: 185px;
80
- background: #F5F5F5;
81
- overflow-y: scroll;
82
- }
83
-
84
- .plupload_filelist li {
85
- padding: 10px 8px;
86
- background: #F5F5F5 url('/images/lolita/upload/plupload/backgrounds.gif') repeat-x 0 -156px;
87
- border-bottom: 1px solid #DDD;
88
- }
89
-
90
- .plupload_filelist_header, .plupload_filelist_footer {
91
- background: #DFDFDF;
92
- padding: 8px 8px;
93
- color: #42454A;
94
- }
95
- .plupload_filelist_header {
96
- border-top: 1px solid #EEE;
97
- border-bottom: 1px solid #CDCDCD;
98
- }
99
-
100
- .plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;}
101
- .plupload_file_name {float: left; overflow: hidden}
102
- .plupload_file_status {color: #777;}
103
- .plupload_file_status span {color: #42454A;}
104
- .plupload_file_size, .plupload_file_status, .plupload_progress {
105
- float: right;
106
- width: 80px;
107
- }
108
- .plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;}
109
-
110
- .plupload_filelist .plupload_file_name {width: 205px}
111
-
112
- .plupload_file_action {
113
- float: right;
114
- width: 16px;
115
- height: 16px;
116
- margin-left: 15px;
117
- }
118
-
119
- .plupload_file_action * {
120
- display: none;
121
- width: 16px;
122
- height: 16px;
123
- }
124
-
125
- li.plupload_uploading {background: #ECF3DC url('/images/lolita/upload/plupload/backgrounds.gif') repeat-x 0 -238px;}
126
- li.plupload_done {color:#AAA}
127
-
128
- li.plupload_delete a {
129
- background: url('/images/lolita/upload/plupload/delete.gif');
130
- }
131
-
132
- li.plupload_failed a {
133
- background: url('/images/lolita/upload/plupload/error.gif');
134
- cursor: default;
135
- }
136
-
137
- li.plupload_done a {
138
- background: url('/images/lolita/upload/plupload/done.gif');
139
- cursor: default;
140
- }
141
-
142
- .plupload_progress, .plupload_upload_status {
143
- display: none;
144
- }
145
-
146
- .plupload_progress_container {
147
- margin-top: 3px;
148
- border: 1px solid #CCC;
149
- background: #FFF;
150
- padding: 1px;
151
- }
152
- .plupload_progress_bar {
153
- width: 0px;
154
- height: 7px;
155
- background: #CDEB8B;
156
- }
157
-
158
- .plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action {
159
- margin-right: 17px;
160
- }
161
-
162
- /* Floats */
163
-
164
- .plupload_clear,.plupload_clearer {clear: both;}
165
- .plupload_clearer, .plupload_progress_bar {
166
- display: block;
167
- font-size: 0;
168
- line-height: 0;
169
- }
170
-
171
- li.plupload_droptext {
172
- background: transparent;
173
- text-align: center;
174
- vertical-align: middle;
175
- border: 0;
176
- line-height: 165px;
177
- }
1
+ /*
2
+ Plupload
3
+ ------------------------------------------------------------------- */
4
+
5
+ .plupload_button {
6
+ display: -moz-inline-box; /* FF < 3*/
7
+ display: inline-block;
8
+ font: normal 12px sans-serif;
9
+ text-decoration: none;
10
+ color: #42454a;
11
+ border: 1px solid #bababa;
12
+ padding: 2px 8px 3px 20px;
13
+ margin-right: 4px;
14
+ background: #f3f3f3 url('/images/lolita/upload/plupload/buttons.png') no-repeat 0 center;
15
+ outline: 0;
16
+
17
+ /* Optional rounded corners for browsers that support it */
18
+ -moz-border-radius: 3px;
19
+ -khtml-border-radius: 3px;
20
+ -webkit-border-radius: 3px;
21
+ border-radius: 3px;
22
+ }
23
+
24
+ .plupload_button:hover {
25
+ color: #000;
26
+ text-decoration: none;
27
+ }
28
+
29
+ .plupload_disabled, a.plupload_disabled:hover {
30
+ color: #737373;
31
+ border-color: #c5c5c5;
32
+ background: #ededed url('/images/lolita/upload/plupload/buttons-disabled.png') no-repeat 0 center;
33
+ cursor: default;
34
+ }
35
+
36
+ .plupload_add {
37
+ background-position: -181px center;
38
+ }
39
+
40
+ .plupload_wrapper {
41
+ font: normal 11px Verdana,sans-serif;
42
+ width: 100%;
43
+ }
44
+
45
+ .plupload_container {
46
+ padding: 8px;
47
+ background: url('/images/lolita/upload/plupload/transp50.png');
48
+ /*-moz-border-radius: 5px;*/
49
+ }
50
+
51
+ .plupload_container input {
52
+ border: 1px solid #DDD;
53
+ font: normal 11px Verdana,sans-serif;
54
+ width: 98%;
55
+ }
56
+
57
+ .plupload_header {background: #2A2C2E url('/images/lolita/upload/plupload/backgrounds.gif') repeat-x;}
58
+ .plupload_header_content {
59
+ background: url('/images/lolita/upload/plupload/backgrounds.gif') no-repeat 0 -317px;
60
+ min-height: 56px;
61
+ padding-left: 60px;
62
+ color: #FFF;
63
+ }
64
+ .plupload_header_title {
65
+ font: normal 18px sans-serif;
66
+ padding: 6px 0 3px;
67
+ }
68
+ .plupload_header_text {
69
+ font: normal 12px sans-serif;
70
+ }
71
+
72
+ .plupload_filelist {
73
+ margin: 0;
74
+ padding: 0;
75
+ list-style: none;
76
+ }
77
+
78
+ .plupload_scroll .plupload_filelist {
79
+ height: 185px;
80
+ background: #F5F5F5;
81
+ overflow-y: scroll;
82
+ }
83
+
84
+ .plupload_filelist li {
85
+ padding: 10px 8px;
86
+ background: #F5F5F5 url('/images/lolita/upload/plupload/backgrounds.gif') repeat-x 0 -156px;
87
+ border-bottom: 1px solid #DDD;
88
+ }
89
+
90
+ .plupload_filelist_header, .plupload_filelist_footer {
91
+ background: #DFDFDF;
92
+ padding: 8px 8px;
93
+ color: #42454A;
94
+ }
95
+ .plupload_filelist_header {
96
+ border-top: 1px solid #EEE;
97
+ border-bottom: 1px solid #CDCDCD;
98
+ }
99
+
100
+ .plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;}
101
+ .plupload_file_name {float: left; overflow: hidden}
102
+ .plupload_file_status {color: #777;}
103
+ .plupload_file_status span {color: #42454A;}
104
+ .plupload_file_size, .plupload_file_status, .plupload_progress {
105
+ float: right;
106
+ width: 80px;
107
+ }
108
+ .plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;}
109
+
110
+ .plupload_filelist .plupload_file_name {width: 205px}
111
+
112
+ .plupload_file_action {
113
+ float: right;
114
+ width: 16px;
115
+ height: 16px;
116
+ margin-left: 15px;
117
+ }
118
+
119
+ .plupload_file_action * {
120
+ display: none;
121
+ width: 16px;
122
+ height: 16px;
123
+ }
124
+
125
+ li.plupload_uploading {background: #ECF3DC url('/images/lolita/upload/plupload/backgrounds.gif') repeat-x 0 -238px;}
126
+ li.plupload_done {color:#AAA}
127
+
128
+ li.plupload_delete a {
129
+ background: url('/images/lolita/upload/plupload/delete.gif');
130
+ }
131
+
132
+ li.plupload_failed a {
133
+ background: url('/images/lolita/upload/plupload/error.gif');
134
+ cursor: default;
135
+ }
136
+
137
+ li.plupload_done a {
138
+ background: url('/images/lolita/upload/plupload/done.gif');
139
+ cursor: default;
140
+ }
141
+
142
+ .plupload_progress, .plupload_upload_status {
143
+ display: none;
144
+ }
145
+
146
+ .plupload_progress_container {
147
+ margin-top: 3px;
148
+ border: 1px solid #CCC;
149
+ background: #FFF;
150
+ padding: 1px;
151
+ }
152
+ .plupload_progress_bar {
153
+ width: 0px;
154
+ height: 7px;
155
+ background: #CDEB8B;
156
+ }
157
+
158
+ .plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action {
159
+ margin-right: 17px;
160
+ }
161
+
162
+ /* Floats */
163
+
164
+ .plupload_clear,.plupload_clearer {clear: both;}
165
+ .plupload_clearer, .plupload_progress_bar {
166
+ display: block;
167
+ font-size: 0;
168
+ line-height: 0;
169
+ }
170
+
171
+ li.plupload_droptext {
172
+ background: transparent;
173
+ text-align: center;
174
+ vertical-align: middle;
175
+ border: 0;
176
+ line-height: 165px;
177
+ }
@@ -1,37 +1,37 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
-
3
- describe Lolita::Configuration::Tab::Files do
4
-
5
- let(:dbi){Lolita::DBI::Base.new(Post)}
6
- let(:tab){Lolita::Configuration::Tab::Files.new(dbi)}
7
-
8
- it "should create new file tab" do
9
- Lolita::Configuration::Tab::Files.new(dbi).type.should == :files
10
- end
11
-
12
- describe "extensions" do
13
-
14
- it "should return empty array for new tab" do
15
- tab.extensions.should == []
16
- end
17
-
18
- it "all can be assigned" do
19
- tab.extensions=["pdf","xls"]
20
- tab.extensions.should == ["pdf", "xls"]
21
- end
22
-
23
- it "should allow to add new one" do
24
- tab.extension("Image","pdf")
25
- tab.extensions.should == [{:title=>"Image",:extensions=>"pdf"}]
26
- end
27
- end
28
-
29
- describe "maximum file size" do
30
- it "should be changable" do
31
- tab.maxfilesize=2048
32
- tab.maxfilesize.should == 2048
33
- tab.maxfilesize(1024)
34
- tab.maxfilesize.should == 1024
35
- end
36
- end
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe Lolita::Configuration::Tab::Files do
4
+
5
+ let(:dbi){Lolita::DBI::Base.new(Post)}
6
+ let(:tab){Lolita::Configuration::Tab::Files.new(dbi)}
7
+
8
+ it "should create new file tab" do
9
+ Lolita::Configuration::Tab::Files.new(dbi).type.should == :files
10
+ end
11
+
12
+ describe "extensions" do
13
+
14
+ it "should return empty array for new tab" do
15
+ tab.filters.should == []
16
+ end
17
+
18
+ it "all can be assigned" do
19
+ tab.filters=["pdf","xls"]
20
+ tab.filters.should == ["pdf", "xls"]
21
+ end
22
+
23
+ it "should allow to add new one" do
24
+ tab.filters("Image","pdf")
25
+ tab.filters.should == [{:title=>"Image",:extensions=>"pdf"}]
26
+ end
27
+ end
28
+
29
+ describe "maximum file size" do
30
+ it "should be changable" do
31
+ tab.maxfilesize=2048
32
+ tab.maxfilesize.should == 2048
33
+ tab.maxfilesize(1024)
34
+ tab.maxfilesize.should == 1024
35
+ end
36
+ end
37
37
  end
@@ -1,36 +1,36 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
-
3
-
4
- describe Lolita::Support::Bytes do
5
- let(:klass){Lolita::Support::Bytes}
6
-
7
- it "should recognize bytes" do
8
- conv=klass.new(512)
9
- conv.unit.should == "bytes"
10
- conv.value.should == 512.0
11
- end
12
-
13
- it "should recognize kilobytes" do
14
- conv=klass.new(1024+6)
15
- conv.unit.should == "kilobytes"
16
- conv.value.should == 1.01
17
- end
18
-
19
- it "should recognize megabytes" do
20
- conv=klass.new(1024**2)
21
- conv.unit.should == "megabyte"
22
- conv.value.should == 1.0
23
- end
24
-
25
- it "should recognize gigabytes" do
26
- conv=klass.new(1024**3+1024**2*10)
27
- conv.unit.should == "gigabytes"
28
- conv.value.should == 1.01
29
- end
30
-
31
- it "should take next unit when rounding move to next limit" do
32
- conv=klass.new(1024**2-1)
33
- conv.value.should == 1.0
34
- conv.unit.should == "megabyte"
35
- end
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+
4
+ describe Lolita::Support::Bytes do
5
+ let(:klass){Lolita::Support::Bytes}
6
+
7
+ it "should recognize bytes" do
8
+ conv=klass.new(512)
9
+ conv.unit.should == "bytes"
10
+ conv.value.should == 512.0
11
+ end
12
+
13
+ it "should recognize kilobytes" do
14
+ conv=klass.new(1024+6)
15
+ conv.unit.should == "kilobytes"
16
+ conv.value.should == 1.01
17
+ end
18
+
19
+ it "should recognize megabytes" do
20
+ conv=klass.new(1024**2)
21
+ conv.unit.should == "megabyte"
22
+ conv.value.should == 1.0
23
+ end
24
+
25
+ it "should recognize gigabytes" do
26
+ conv=klass.new(1024**3+1024**2*10)
27
+ conv.unit.should == "gigabytes"
28
+ conv.value.should == 1.01
29
+ end
30
+
31
+ it "should take next unit when rounding move to next limit" do
32
+ conv=klass.new(1024**2-1)
33
+ conv.value.should == 1.0
34
+ conv.unit.should == "megabyte"
35
+ end
36
36
  end