-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f30e9f0
commit b7fac7e
Showing
21 changed files
with
157 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
class ExportsController < ApplicationController | ||
|
||
def show | ||
# Generate a Tempfile for the download | ||
csv = Tempfile.new "export", encoding: 'utf-8' | ||
#export_type = '' | ||
# Generate a Tempfile for the download | ||
csv = Tempfile.new "export", encoding: 'utf-8' | ||
#export_type = '' | ||
|
||
#if params && params[:kind_of_article] == 'seller_line_item_groups' | ||
# LineItemGroupExporter.export(csv, current_user, params) | ||
# export_type = 'purchase' | ||
#else | ||
# | ||
# ArticleExporter.export(csv, current_user, params[:kind_of_article]) | ||
# export_type = 'article' | ||
#end | ||
ArticleExporter.export(csv, current_user, params[:kind_of_article]) | ||
#if params && params[:kind_of_article] == 'seller_line_item_groups' | ||
# LineItemGroupExporter.export(csv, current_user, params) | ||
# export_type = 'purchase' | ||
#else | ||
# | ||
# ArticleExporter.export(csv, current_user, params[:kind_of_article]) | ||
# export_type = 'article' | ||
#end | ||
ArticleExporter.export(csv, current_user, params[:kind_of_article]) | ||
|
||
respond_to do |format| | ||
format.csv { send_file csv.path, | ||
{ type: 'text/csv; charset=utf-8' , filename: "Fairmondo_export_#{Time.now.strftime("%Y-%d-%m %H:%M:%S")}.csv"} } | ||
end | ||
respond_to do |format| | ||
format.csv do | ||
send_file csv.path, | ||
type: 'text/csv; charset=utf-8', | ||
filename: "Fairmondo_export_"\ | ||
"#{Time.now.strftime("%Y-%d-%m %H:%M:%S")}.csv" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,46 @@ | ||
class ArticleImage < Image | ||
extend STI | ||
PROCESSING_IMAGE_URL = "pending.png" | ||
|
||
has_attached_file :image, | ||
styles: { | ||
original: {geometry: "900>x600>", animated: false}, | ||
medium: {geometry: "520>x360>", animated: false}, | ||
thumb: {geometry: "280x200>", animated: false} | ||
}, | ||
convert_options: { | ||
medium: "-quality 75 -strip", | ||
thumb: "-quality 75 -strip -background white -gravity center -extent 260x180" | ||
}, | ||
default_url: "missing.png", | ||
url: "/system/images/:id_partition/:style/:filename", | ||
path: "public/system/images/:id_partition/:style/:filename" | ||
PROCESSING_IMAGE_URL = 'pending.png' | ||
|
||
process_in_background :image, :processing_image_url => PROCESSING_IMAGE_URL | ||
has_attached_file( | ||
:image, | ||
styles: { | ||
original: { geometry: '900>x600>', animated: false }, | ||
medium: { geometry: '520>x360>', animated: false }, | ||
thumb: { geometry: '280x200>', animated: false } | ||
}, | ||
convert_options: { | ||
medium: '-quality 75 -strip', | ||
thumb: '-quality 75 -strip -background white -gravity center -extent 260x180' | ||
}, | ||
default_url: 'missing.png', | ||
url: '/system/images/:id_partition/:style/:filename', | ||
path: 'public/system/images/:id_partition/:style/:filename' | ||
) | ||
|
||
validates_attachment_presence :image, :unless => :external_url | ||
validates_attachment_content_type :image,:content_type => ['image/jpeg', 'image/png', 'image/gif'] | ||
validates_attachment_size :image, :in => 1..20.megabytes # the 1 means one byte, not one megabyte | ||
process_in_background :image, processing_image_url: PROCESSING_IMAGE_URL | ||
|
||
belongs_to :article, foreign_key: "imageable_id" | ||
validates_attachment_presence :image, unless: :external_url | ||
validates_attachment_content_type :image, | ||
content_type: %w( | ||
image/jpeg image/png image/gif | ||
) | ||
validates_attachment_size :image, in: 1..20.megabytes # the 1 means one byte, not one megabyte | ||
|
||
def original_image_url_while_processing | ||
Paperclip::Interpolations.interpolate ArticleImage.paperclip_definitions[:image][:url] , self.image, :original | ||
end | ||
belongs_to :article, foreign_key: 'imageable_id' | ||
|
||
def url_or_original_while_processing style = :thumb | ||
if image.processing? | ||
original_image_url_while_processing | ||
else | ||
image.url(style) | ||
end | ||
end | ||
def original_image_url_while_processing | ||
Paperclip::Interpolations.interpolate( | ||
ArticleImage.paperclip_definitions[:image][:url], self.image, :original | ||
) | ||
end | ||
|
||
def url_or_original_while_processing style = :thumb | ||
if image.processing? | ||
original_image_url_while_processing | ||
else | ||
image.url(style) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
class FeedbackImage < Image | ||
extend STI | ||
|
||
has_attached_file :image, | ||
has_attached_file( | ||
:image, | ||
styles: { | ||
original: {geometry: "300>x300>", animated: false} | ||
original: { geometry: '300>x300>', animated: false } | ||
}, | ||
default_url: "/assets/missing.png", | ||
url: "/system/images/:id_partition/:style/:filename", | ||
path: "public/system/images/:id_partition/:style/:filename" | ||
default_url: '/assets/missing.png', | ||
url: '/system/images/:id_partition/:style/:filename', | ||
path: 'public/system/images/:id_partition/:style/:filename' | ||
) | ||
|
||
belongs_to :feedback, foreign_key: "imageable_id" | ||
belongs_to :feedback, foreign_key: 'imageable_id' | ||
|
||
validates_attachment_presence :image, unless: :external_url | ||
validates_attachment_content_type :image, content_type: ['image/jpeg', 'image/png'] | ||
validates_attachment_content_type :image, | ||
content_type: %w(image/jpeg image/png) | ||
validates_attachment_size :image, in: 0..2.megabytes | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
class UserImage < Image | ||
extend STI | ||
has_attached_file :image, | ||
has_attached_file( | ||
:image, | ||
styles: { | ||
original: {geometry: "300>x300>", animated: false}, | ||
profile: {geometry: "300x300>", animated: false} | ||
original: { geometry: '300>x300>', animated: false }, | ||
profile: { geometry: '300x300>', animated: false } | ||
}, | ||
convert_options: { profile: "-quality 75 -strip -background white -gravity center -extent 300x300" }, | ||
default_url: "/assets/missing.png", | ||
url: "/system/images/:id_partition/:style/:filename", | ||
path: "public/system/images/:id_partition/:style/:filename", | ||
convert_options: { profile: '-quality 75 -strip -background white -gravity center -extent 300x300' }, | ||
default_url: '/assets/missing.png', | ||
url: '/system/images/:id_partition/:style/:filename', | ||
path: 'public/system/images/:id_partition/:style/:filename', | ||
only_process: [:profile] | ||
) | ||
|
||
belongs_to :user, foreign_key: "imageable_id" | ||
belongs_to :user, foreign_key: 'imageable_id' | ||
|
||
validates_attachment_presence :image, :unless => :external_url | ||
validates_attachment_content_type :image,:content_type => ['image/jpeg', 'image/png', 'image/gif'] | ||
validates_attachment_size :image, :in => 1..20.megabytes # the 1 means one byte, not one megabyte | ||
validates_attachment_presence :image, unless: :external_url | ||
validates_attachment_content_type :image, | ||
content_type: %w( | ||
image/jpeg image/png image/gif | ||
) | ||
validates_attachment_size :image, in: 1..20.megabytes # the 1 means one byte, not one megabyte | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.