comfortable_mexican_sofa 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/assets/stylesheets/comfortable_mexican_sofa/content.css +24 -15
- data/app/assets/stylesheets/comfortable_mexican_sofa/form.css +12 -13
- data/app/controllers/cms_admin/files_controller.rb +1 -1
- data/app/models/cms/file.rb +4 -1
- data/app/views/cms_admin/files/_file.html.erb +1 -1
- data/app/views/cms_admin/files/_index.html.erb +15 -2
- data/comfortable_mexican_sofa.gemspec +2 -2
- data/config/locales/en.yml +2 -0
- data/config/locales/es.yml +2 -0
- data/config/routes.rb +3 -3
- data/test/functional/cms_admin/files_controller_test.rb +1 -1
- data/test/functional/cms_admin/layouts_controller_test.rb +1 -1
- data/test/functional/cms_admin/pages_controller_test.rb +1 -1
- data/test/unit/models/file_test.rb +16 -0
- metadata +9 -9
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.5
|
@@ -37,14 +37,17 @@
|
|
37
37
|
max-height: 500px;
|
38
38
|
overflow-y: auto;
|
39
39
|
}
|
40
|
+
#cms_body #file_uploads #uploaded_files h3 {
|
41
|
+
margin-top: 5px;
|
42
|
+
font: 11px/20px Arial, sans-serif;
|
43
|
+
text-transform: uppercase;
|
44
|
+
}
|
40
45
|
#cms_body #file_uploads #uploaded_files .file {
|
41
|
-
position: relative;
|
42
46
|
overflow: hidden;
|
43
|
-
font
|
47
|
+
font: 11px/11px Arial, serif;
|
44
48
|
background-color: #252525;
|
45
|
-
margin-top:
|
46
|
-
padding:
|
47
|
-
opacity: 0.5;
|
49
|
+
margin-top: 1px;
|
50
|
+
padding: 3px 5px;
|
48
51
|
border-radius: 2px;
|
49
52
|
-moz-border-radius: 2px;
|
50
53
|
}
|
@@ -52,22 +55,28 @@
|
|
52
55
|
opacity: 0.3;
|
53
56
|
}
|
54
57
|
#cms_body #file_uploads #uploaded_files .file:hover {
|
55
|
-
|
58
|
+
background-color: #000;
|
56
59
|
}
|
57
60
|
#cms_body #file_uploads #uploaded_files .file a {
|
58
61
|
color: #fff;
|
59
62
|
}
|
63
|
+
#cms_body #file_uploads #uploaded_files .file a.filename {
|
64
|
+
float: left;
|
65
|
+
width: 175px;
|
66
|
+
overflow: hidden;
|
67
|
+
}
|
60
68
|
#cms_body #file_uploads #uploaded_files .file a.delete {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
69
|
+
float: right;
|
70
|
+
margin-left: 7px;
|
71
|
+
background-color: #b7b7b7;
|
72
|
+
color: #000;
|
73
|
+
font: 8px/8px Arial, sans-serif;
|
74
|
+
padding: 1px 3px;
|
75
|
+
border-radius: 5px;
|
68
76
|
}
|
69
|
-
#cms_body #file_uploads #uploaded_files .file
|
70
|
-
color: #
|
77
|
+
#cms_body #file_uploads #uploaded_files .file a.delete:hover {
|
78
|
+
background-color: #fff;
|
79
|
+
color: #9E0B0F;
|
71
80
|
}
|
72
81
|
/* -- Categories Widget -------------------------------------------------- */
|
73
82
|
#cms_body .categories_widget {
|
@@ -19,8 +19,6 @@
|
|
19
19
|
}
|
20
20
|
#cms_body .form_element .value {
|
21
21
|
margin-left: 150px;
|
22
|
-
margin-right: -140px;
|
23
|
-
overflow: hidden;
|
24
22
|
}
|
25
23
|
#cms_body .form_element .value input[type='text'],
|
26
24
|
#cms_body .form_element .value input[type='password'],
|
@@ -70,8 +68,8 @@
|
|
70
68
|
#cms_body #form_blocks .files {
|
71
69
|
overflow: hidden;
|
72
70
|
margin-top: 5px;
|
73
|
-
background-color: #
|
74
|
-
padding: 5px
|
71
|
+
background-color: #f1f1f1;
|
72
|
+
padding: 5px 0px 0px 5px;
|
75
73
|
border-radius: 5px;
|
76
74
|
color: #fff;
|
77
75
|
min-height: 20px;
|
@@ -82,30 +80,30 @@
|
|
82
80
|
background-color: #484848;
|
83
81
|
border-radius: 3px;
|
84
82
|
color: #fff;
|
85
|
-
height:
|
83
|
+
height: 11px;
|
86
84
|
padding: 3px 5px;
|
87
85
|
margin: 0px 5px 5px 0px;
|
88
86
|
}
|
89
87
|
#cms_body #form_blocks .files .file a {
|
90
88
|
float: left;
|
91
|
-
color: #a3a3a3;
|
92
|
-
font: 9px/9px Arial, serif;
|
93
|
-
text-transform: uppercase;
|
94
|
-
}
|
95
|
-
#cms_body #form_blocks .files .file a:hover {
|
96
89
|
color: #fff;
|
90
|
+
font: 11px/11px Arial, serif;
|
91
|
+
}
|
92
|
+
#cms_body #form_blocks .files .file:hover {
|
93
|
+
background-color: #000;
|
97
94
|
}
|
98
95
|
#cms_body #form_blocks .files .file a.delete {
|
99
96
|
float: right;
|
100
|
-
margin-left:
|
97
|
+
margin-left: 7px;
|
101
98
|
background-color: #b7b7b7;
|
102
99
|
color: #000;
|
103
|
-
font:
|
100
|
+
font: 7px/8px Arial, sans-serif;
|
104
101
|
padding: 1px 3px;
|
105
|
-
border-radius:
|
102
|
+
border-radius: 5px;
|
106
103
|
}
|
107
104
|
#cms_body #form_blocks .files .file a.delete:hover {
|
108
105
|
background-color: #fff;
|
106
|
+
color: #9E0B0F;
|
109
107
|
}
|
110
108
|
#cms_body .form_element.field_date_time .label,
|
111
109
|
#cms_body .form_element.field_integer .label,
|
@@ -143,6 +141,7 @@
|
|
143
141
|
margin-top: 10px;
|
144
142
|
}
|
145
143
|
#cms_body .form_element.submit_element .value {
|
144
|
+
overflow: hidden;
|
146
145
|
background-color: #f1f1f1;
|
147
146
|
border-radius: 3px;
|
148
147
|
-moz-border-radius: 3px;
|
@@ -6,7 +6,7 @@ class CmsAdmin::FilesController < CmsAdmin::BaseController
|
|
6
6
|
|
7
7
|
def index
|
8
8
|
return redirect_to :action => :new if @site.files.count == 0
|
9
|
-
@files = @site.files.includes(:categories).for_category(params[:category]).all(:order => 'cms_files.
|
9
|
+
@files = @site.files.includes(:categories).for_category(params[:category]).all(:order => 'cms_files.position')
|
10
10
|
end
|
11
11
|
|
12
12
|
def new
|
data/app/models/cms/file.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
class Cms::File < ActiveRecord::Base
|
2
2
|
|
3
|
+
IMAGE_MIMETYPES = %w(gif jpeg pjpeg png svg+xml tiff).collect{|subtype| "image/#{subtype}"}
|
4
|
+
|
3
5
|
ComfortableMexicanSofa.establish_connection(self)
|
4
6
|
|
5
7
|
set_table_name :cms_files
|
@@ -24,7 +26,8 @@ class Cms::File < ActiveRecord::Base
|
|
24
26
|
after_destroy :reload_page_cache
|
25
27
|
|
26
28
|
# -- Scopes ---------------------------------------------------------------
|
27
|
-
|
29
|
+
scope :images, where(:file_content_type => IMAGE_MIMETYPES)
|
30
|
+
scope :not_images, where('file_content_type NOT IN (?)', IMAGE_MIMETYPES)
|
28
31
|
|
29
32
|
protected
|
30
33
|
|
@@ -6,5 +6,5 @@
|
|
6
6
|
end
|
7
7
|
%>
|
8
8
|
<%= link_to file_name, file.file.url, :target => '_blank', :class => 'filename' %>
|
9
|
-
<%= link_to span_tag('x'), cms_admin_site_file_path(@site, file), :method => :delete, :remote => true, :class => 'delete' %>
|
9
|
+
<%= link_to span_tag('x'), cms_admin_site_file_path(@site, file), :method => :delete, :remote => true, :confirm => t('.are_you_sure'), :class => 'delete' %>
|
10
10
|
</div>
|
@@ -6,8 +6,21 @@
|
|
6
6
|
<% end %>
|
7
7
|
|
8
8
|
<div id='uploaded_files'>
|
9
|
-
<% Cms::File.order(
|
10
|
-
|
9
|
+
<% if (images = Cms::File.images.order(:label)).present? %>
|
10
|
+
<div class='section images'>
|
11
|
+
<h3>Images</h3>
|
12
|
+
<% images.each do |file| %>
|
13
|
+
<%= render :partial => 'cms_admin/files/file', :object => file %>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
17
|
+
<% if (images = Cms::File.not_images.order(:label)).present? %>
|
18
|
+
<div class='section other'>
|
19
|
+
<h3>Files</h3>
|
20
|
+
<% images.each do |file| %>
|
21
|
+
<%= render :partial => 'cms_admin/files/file', :object => file %>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
11
24
|
<% end %>
|
12
25
|
</div>
|
13
26
|
</div>
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "comfortable_mexican_sofa"
|
8
|
-
s.version = "1.5.
|
8
|
+
s.version = "1.5.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oleg Khabarov", "The Working Group Inc"]
|
12
|
-
s.date = "2011-10-
|
12
|
+
s.date = "2011-10-04"
|
13
13
|
s.description = ""
|
14
14
|
s.email = "oleg@theworkinggroup.ca"
|
15
15
|
s.extra_rdoc_files = [
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/routes.rb
CHANGED
@@ -6,13 +6,13 @@ Rails.application.routes.draw do
|
|
6
6
|
resources :pages do
|
7
7
|
get :form_blocks, :on => :member
|
8
8
|
get :toggle_branch, :on => :member
|
9
|
-
|
9
|
+
put :reorder, :on => :collection
|
10
10
|
resources :revisions, :only => [:index, :show, :revert] do
|
11
11
|
put :revert, :on => :member
|
12
12
|
end
|
13
13
|
end
|
14
14
|
resources :files do
|
15
|
-
|
15
|
+
put :reorder, :on => :collection
|
16
16
|
end
|
17
17
|
resources :layouts do
|
18
18
|
post :reorder, :on => :collection
|
@@ -21,7 +21,7 @@ Rails.application.routes.draw do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
resources :snippets do
|
24
|
-
|
24
|
+
put :reorder, :on => :collection
|
25
25
|
resources :revisions, :only => [:index, :show, :revert] do
|
26
26
|
put :revert, :on => :member
|
27
27
|
end
|
@@ -173,7 +173,7 @@ class CmsAdmin::FilesControllerTest < ActionController::TestCase
|
|
173
173
|
assert_equal 0, file_one.position
|
174
174
|
assert_equal 1, file_two.position
|
175
175
|
|
176
|
-
|
176
|
+
put :reorder, :site_id => cms_sites(:default), :cms_file => [file_two.id, file_one.id]
|
177
177
|
assert_response :success
|
178
178
|
file_one.reload
|
179
179
|
file_two.reload
|
@@ -111,7 +111,7 @@ class CmsAdmin::LayoutsControllerTest < ActionController::TestCase
|
|
111
111
|
assert_equal 0, layout_one.position
|
112
112
|
assert_equal 1, layout_two.position
|
113
113
|
|
114
|
-
|
114
|
+
put :reorder, :site_id => cms_sites(:default), :cms_layout => [layout_two.id, layout_one.id]
|
115
115
|
assert_response :success
|
116
116
|
layout_one.reload
|
117
117
|
layout_two.reload
|
@@ -406,7 +406,7 @@ class CmsAdmin::PagesControllerTest < ActionController::TestCase
|
|
406
406
|
assert_equal 0, page_one.position
|
407
407
|
assert_equal 1, page_two.position
|
408
408
|
|
409
|
-
|
409
|
+
put :reorder, :site_id => cms_sites(:default), :cms_page => [page_two.id, page_one.id]
|
410
410
|
assert_response :success
|
411
411
|
page_one.reload
|
412
412
|
page_two.reload
|
@@ -31,4 +31,20 @@ class CmsFileTest < ActiveSupport::TestCase
|
|
31
31
|
cms_sites(:default).files.create(:file => '')
|
32
32
|
end
|
33
33
|
end
|
34
|
+
|
35
|
+
def test_image_mimetypes
|
36
|
+
assert_equal %w(image/gif image/jpeg image/pjpeg image/png image/svg+xml image/tiff),
|
37
|
+
Cms::File::IMAGE_MIMETYPES
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_images_scope
|
41
|
+
file = cms_files(:default)
|
42
|
+
assert_equal 'image/jpeg', file.file_content_type
|
43
|
+
assert_equal 1, Cms::File.images.count
|
44
|
+
assert_equal 0, Cms::File.not_images.count
|
45
|
+
|
46
|
+
file.update_attribute(:file_content_type, 'application/pdf')
|
47
|
+
assert_equal 0, Cms::File.images.count
|
48
|
+
assert_equal 1, Cms::File.not_images.count
|
49
|
+
end
|
34
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-10-
|
13
|
+
date: 2011-10-04 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70349048422300 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 3.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70349048422300
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: active_link_to
|
28
|
-
requirement: &
|
28
|
+
requirement: &70349048421660 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70349048421660
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: paperclip
|
39
|
-
requirement: &
|
39
|
+
requirement: &70349048421060 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: 2.3.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70349048421060
|
48
48
|
description: ''
|
49
49
|
email: oleg@theworkinggroup.ca
|
50
50
|
executables: []
|
@@ -358,7 +358,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
358
358
|
version: '0'
|
359
359
|
segments:
|
360
360
|
- 0
|
361
|
-
hash:
|
361
|
+
hash: 3379896773245428729
|
362
362
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
363
363
|
none: false
|
364
364
|
requirements:
|