comfortable_mexican_sofa 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/Gemfile +7 -0
- data/app/controllers/cms_admin/files_controller.rb +12 -4
- data/app/views/cms_admin/revisions/show.html.haml +0 -1
- data/comfortable_mexican_sofa.gemspec +1 -1
- data/lib/comfortable_mexican_sofa/routing.rb +4 -4
- data/lib/comfortable_mexican_sofa/version.rb +1 -1
- data/test/controllers/cms_admin/files_controller_test.rb +15 -1
- data/test/gemfiles/Gemfile.rails.4.0 +2 -1
- metadata +3 -3
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -2,6 +2,13 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
+
group :development do
|
6
|
+
gem 'awesome_print'
|
7
|
+
gem 'better_errors'
|
8
|
+
gem 'binding_of_caller'
|
9
|
+
gem 'quiet_assets'
|
10
|
+
end
|
11
|
+
|
5
12
|
group :test do
|
6
13
|
gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
|
7
14
|
gem 'jdbc-sqlite3', :platform => :jruby
|
@@ -9,9 +9,17 @@ class CmsAdmin::FilesController < CmsAdmin::BaseController
|
|
9
9
|
@files = @site.files.includes(:categories).for_category(params[:category]).order('cms_files.position')
|
10
10
|
|
11
11
|
if params[:ajax]
|
12
|
-
|
13
|
-
|
14
|
-
:
|
12
|
+
if params[:not_images]
|
13
|
+
files = @files.not_images.collect do |file|
|
14
|
+
{ :label => file.label,
|
15
|
+
:filename => file.file_file_name,
|
16
|
+
:url => file.file.url }
|
17
|
+
end
|
18
|
+
else
|
19
|
+
files = @files.images.collect do |file|
|
20
|
+
{ :thumb => file.file.url(:cms_thumb),
|
21
|
+
:image => file.file.url }
|
22
|
+
end
|
15
23
|
end
|
16
24
|
render :json => files
|
17
25
|
else
|
@@ -41,7 +49,7 @@ class CmsAdmin::FilesController < CmsAdmin::BaseController
|
|
41
49
|
|
42
50
|
if params[:ajax]
|
43
51
|
view = render_to_string(:partial => 'cms_admin/files/file', :collection => @files, :layout => false)
|
44
|
-
render :json => {:filelink => @file.file.url, :view => view.gsub("\n", '')}
|
52
|
+
render :json => {:filelink => @file.file.url, :filename => @file.file_file_name, :view => view.gsub("\n", '')}
|
45
53
|
else
|
46
54
|
flash[:success] = I18n.t('cms.files.created')
|
47
55
|
redirect_to :action => :edit, :id => @file
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.email = ["oleg@khabarov.ca"]
|
11
11
|
s.homepage = "http://github.com/comfy/comfortable-mexican-sofa"
|
12
12
|
s.summary = "CMS Engine for Rails 4 apps"
|
13
|
-
s.description = "ComfortableMexicanSofa is a powerful CMS Engine for Ruby on Rails
|
13
|
+
s.description = "ComfortableMexicanSofa is a powerful CMS Engine for Ruby on Rails applications"
|
14
14
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.platform = Gem::Platform::RUBY
|
@@ -12,22 +12,22 @@ module ComfortableMexicanSofa::Routing
|
|
12
12
|
get :toggle_branch, :on => :member
|
13
13
|
put :reorder, :on => :collection
|
14
14
|
resources :revisions, :only => [:index, :show, :revert] do
|
15
|
-
|
15
|
+
patch :revert, :on => :member
|
16
16
|
end
|
17
17
|
end
|
18
18
|
resources :files do
|
19
|
-
|
19
|
+
post :reorder, :on => :collection
|
20
20
|
end
|
21
21
|
resources :layouts do
|
22
22
|
put :reorder, :on => :collection
|
23
23
|
resources :revisions, :only => [:index, :show, :revert] do
|
24
|
-
|
24
|
+
patch :revert, :on => :member
|
25
25
|
end
|
26
26
|
end
|
27
27
|
resources :snippets do
|
28
28
|
put :reorder, :on => :collection
|
29
29
|
resources :revisions, :only => [:index, :show, :revert] do
|
30
|
-
|
30
|
+
patch :revert, :on => :member
|
31
31
|
end
|
32
32
|
end
|
33
33
|
resources :categories
|
@@ -41,7 +41,20 @@ class CmsAdmin::FilesControllerTest < ActionController::TestCase
|
|
41
41
|
'image' => file.file.url
|
42
42
|
}], r
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
|
+
def test_get_index_as_ajax_with_no_images
|
46
|
+
file = cms_files(:default)
|
47
|
+
file.update_attribute(:file_content_type, 'text/plain')
|
48
|
+
get :index, :site_id => cms_sites(:default), :not_images => 1, :ajax => true
|
49
|
+
assert_response :success
|
50
|
+
r = JSON.parse(response.body)
|
51
|
+
assert_equal [{
|
52
|
+
'label' => file.label,
|
53
|
+
'filename' => file.file_file_name,
|
54
|
+
'url' => file.file.url
|
55
|
+
}], r
|
56
|
+
end
|
57
|
+
|
45
58
|
def test_get_new
|
46
59
|
site = cms_sites(:default)
|
47
60
|
get :new, :site_id => site
|
@@ -133,6 +146,7 @@ class CmsAdmin::FilesControllerTest < ActionController::TestCase
|
|
133
146
|
file = Cms::File.last
|
134
147
|
r = JSON.parse(response.body)
|
135
148
|
assert_equal file.file.url, r['filelink']
|
149
|
+
assert_equal file.file_file_name, r['filename']
|
136
150
|
assert r['view'].present?
|
137
151
|
end
|
138
152
|
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.9.
|
4
|
+
version: 1.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-07-
|
13
|
+
date: 2013-07-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -172,7 +172,7 @@ dependencies:
|
|
172
172
|
- - ! '>='
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: 3.1.0
|
175
|
-
description: ComfortableMexicanSofa is a powerful CMS Engine for Ruby on Rails
|
175
|
+
description: ComfortableMexicanSofa is a powerful CMS Engine for Ruby on Rails applications
|
176
176
|
email:
|
177
177
|
- oleg@khabarov.ca
|
178
178
|
executables: []
|