diff --git a/app/controllers/admin/ruling_templates_controller.rb b/app/controllers/admin/ruling_templates_controller.rb index c48abe5..4131772 100644 --- a/app/controllers/admin/ruling_templates_controller.rb +++ b/app/controllers/admin/ruling_templates_controller.rb @@ -39,7 +39,7 @@ class Admin::RulingTemplatesController < OrbitAdminController image = TemplateImageFile.new(template_image_params) image.order = (template.template_image_files.max(:order) + 1 rescue 0) image.r_template = template - image.save + image.save! render :json => {"files" => [{"thumbnail_url"=>image.image_file.thumb.url}]}.to_json end diff --git a/app/models/template_image_file.rb b/app/models/template_image_file.rb index 72257e8..137a856 100644 --- a/app/models/template_image_file.rb +++ b/app/models/template_image_file.rb @@ -1,4 +1,5 @@ class TemplateImageFile + require "ostruct" include Mongoid::Document include Mongoid::Timestamps @@ -7,4 +8,25 @@ class TemplateImageFile field :order, :type => Integer, :default => 0 belongs_to :r_template + + def album_crops + [] + end + + def file + self.image_file + end + def album + tmp = OpenStruct.new + tmp.album_colors = album_colors + tmp.resize_gravity = 'Center' + tmp + end + + def album_id + nil + end + def album_colors + [{'color' => 'transparent'}] + end end \ No newline at end of file