muck-contents 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/muck/tiny_mce_controller.rb +7 -2
- data/config/initializers/new_rails_defaults.rb +19 -0
- data/muck-contents.gemspec +2 -1
- metadata +2 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
@@ -32,7 +32,7 @@ class Muck::TinyMceController < ApplicationController
|
|
32
32
|
@parent = current_user if @parent.blank?
|
33
33
|
@images = @parent.uploads.images.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')
|
34
34
|
respond_to do |format|
|
35
|
-
format.json { render :json => @images
|
35
|
+
format.json { render :json => make_json(@images) }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -40,11 +40,16 @@ class Muck::TinyMceController < ApplicationController
|
|
40
40
|
@parent = current_user if @parent.blank?
|
41
41
|
@files = @parent.uploads.files.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')
|
42
42
|
respond_to do |format|
|
43
|
-
format.json { render :json => @files
|
43
|
+
format.json { render :json => make_json(@files) }
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
protected
|
48
|
+
def make_json(uploads)
|
49
|
+
return [] if uploads.blank?
|
50
|
+
uploads.collect {|f| f.as_json(json_options)}
|
51
|
+
end
|
52
|
+
|
48
53
|
def json_options
|
49
54
|
{ :only => [:id], :methods => [:icon, :thumb, :file_name] }
|
50
55
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# These settings change the behavior of Rails 2 apps and will be defaults
|
4
|
+
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
5
|
+
|
6
|
+
if defined?(ActiveRecord)
|
7
|
+
# Include Active Record class name as root for JSON serialized output.
|
8
|
+
ActiveRecord::Base.include_root_in_json = true
|
9
|
+
|
10
|
+
# Store the full class name (including module namespace) in STI type column.
|
11
|
+
ActiveRecord::Base.store_full_sti_class = true
|
12
|
+
end
|
13
|
+
|
14
|
+
# Use ISO 8601 format for JSON serialized times and dates.
|
15
|
+
ActiveSupport.use_standard_json_time_format = true
|
16
|
+
|
17
|
+
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
18
|
+
# if you're including raw json in an HTML page.
|
19
|
+
ActiveSupport.escape_html_entities_in_json = false
|
data/muck-contents.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{muck-contents}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Ball", "Joel Duffin"]
|
@@ -37,6 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
"app/views/tiny_mce/images.html.erb",
|
38
38
|
"app/views/tiny_mce/links.html.erb",
|
39
39
|
"config/initializers/mce_options.rb",
|
40
|
+
"config/initializers/new_rails_defaults.rb",
|
40
41
|
"config/muck_contents_routes.rb",
|
41
42
|
"db/migrate/20090703055724_add_contents.rb",
|
42
43
|
"db/migrate/20090806230610_add_layout_to_contents.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muck-contents
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Ball
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- app/views/tiny_mce/images.html.erb
|
135
135
|
- app/views/tiny_mce/links.html.erb
|
136
136
|
- config/initializers/mce_options.rb
|
137
|
+
- config/initializers/new_rails_defaults.rb
|
137
138
|
- config/muck_contents_routes.rb
|
138
139
|
- db/migrate/20090703055724_add_contents.rb
|
139
140
|
- db/migrate/20090806230610_add_layout_to_contents.rb
|