Class: Slices::Config
- Inherits:
-
Object
- Object
- Slices::Config
- Defined in:
- lib/slices/config.rb
Constant Summary collapse
- S3_TEMPFILE_KEY_PREFIX =
'uploads'
Class Method Summary collapse
-
.add_asset_styles(options = {}) ⇒ Object
Set the asset styles for the app, this is a hash with the keys as the style names and Papcerlip resize options.
- .admin_asset_styles ⇒ Object
-
.asset_convert_options ⇒ Object
Addition Paperclip convert options which are applied to all styles.
-
.asset_styles ⇒ Hash
The list of asset styles in use.
-
.google_apps_domain ⇒ String
Google Apps domain for quick auth.
-
.google_apps_domain=(domain) ⇒ Object
Set Google Apps domain for quick auth.
-
.s3_credentials ⇒ Object
S3 credentaials taken from the papercip defaults.
- .s3_storage? ⇒ Boolean
-
.snippets? ⇒ Boolean
Does this app use snippets?.
-
.use_snippets! ⇒ Object
Enable snippets.
Class Method Details
.add_asset_styles(options = {}) ⇒ Object
Set the asset styles for the app, this is a hash with the keys as the style names and Papcerlip resize options
Slices::Config.add_asset_styles(
:thumbnail => "220x146#",
:full_width => "971x440#",
:feature_full => "971x475#",
:slideshow => "723x440>",
)
16 17 18 |
# File 'lib/slices/config.rb', line 16 def self.add_asset_styles( = {}) @asset_styles = .merge(admin_asset_styles) end |
.admin_asset_styles ⇒ Object
75 76 77 |
# File 'lib/slices/config.rb', line 75 def self.admin_asset_styles { admin: '180x180#' } end |
.asset_convert_options ⇒ Object
Addition Paperclip convert options which are applied to all styles. This removes colour profiles, sets the dpi to 72 dpi (the image is not resampled). The colour depth is set to 8 bits per pixel
82 83 84 85 86 87 88 89 |
# File 'lib/slices/config.rb', line 82 def self. Hash.new.tap do || asset_styles.keys.each do |style| next if style == :original [style] = "-strip -density 72x72 -depth 8" end end end |
.asset_styles ⇒ Hash
The list of asset styles in use
23 24 25 |
# File 'lib/slices/config.rb', line 23 def self.asset_styles @asset_styles || add_asset_styles end |
.google_apps_domain ⇒ String
Google Apps domain for quick auth.
63 64 65 |
# File 'lib/slices/config.rb', line 63 def self.google_apps_domain @google_apps_domain end |
.google_apps_domain=(domain) ⇒ Object
Set Google Apps domain for quick auth.
70 71 72 |
# File 'lib/slices/config.rb', line 70 def self.google_apps_domain=(domain) @google_apps_domain = domain end |
.s3_credentials ⇒ Object
S3 credentaials taken from the papercip defaults
{
:bucket => 'slices-demo',
:access_key_id => 'access key id',
:secret_access_key => 'secret access key',
}
51 52 53 54 55 56 57 58 |
# File 'lib/slices/config.rb', line 51 def self.s3_credentials = Paperclip::Attachment. { bucket: [:fog_directory], access_key_id: [:fog_credentials][:aws_access_key_id], secret_access_key: [:fog_credentials][:aws_secret_access_key], } end |
.s3_storage? ⇒ Boolean
38 39 40 |
# File 'lib/slices/config.rb', line 38 def self.s3_storage? Paperclip::Attachment.[:storage].to_sym == :fog end |
.snippets? ⇒ Boolean
Does this app use snippets?
34 35 36 |
# File 'lib/slices/config.rb', line 34 def self.snippets? @snippets || false end |
.use_snippets! ⇒ Object
Enable snippets
28 29 30 |
# File 'lib/slices/config.rb', line 28 def self.use_snippets! @snippets = true end |