Add images and documents settings to admin panel
This commit is contained in:
@@ -8,7 +8,7 @@ class Setting < ApplicationRecord
|
||||
end
|
||||
|
||||
def type
|
||||
if %w[feature process proposals map html homepage].include? prefix
|
||||
if %w[feature process proposals map html homepage uploads].include? prefix
|
||||
prefix
|
||||
else
|
||||
"configuration"
|
||||
@@ -19,6 +19,14 @@ class Setting < ApplicationRecord
|
||||
value.present?
|
||||
end
|
||||
|
||||
def content_type?
|
||||
key.split(".").last == "content_types"
|
||||
end
|
||||
|
||||
def content_type_group
|
||||
key.split(".").second
|
||||
end
|
||||
|
||||
class << self
|
||||
def [](key)
|
||||
where(key: key).pluck(:value).first.presence
|
||||
@@ -44,6 +52,25 @@ class Setting < ApplicationRecord
|
||||
setting.destroy if setting.present?
|
||||
end
|
||||
|
||||
def mime_types
|
||||
{
|
||||
"images" => {
|
||||
"jpg" => "image/jpeg",
|
||||
"png" => "image/png",
|
||||
"gif" => "image/gif"
|
||||
},
|
||||
"documents" => {
|
||||
"pdf" => "application/pdf",
|
||||
"doc" => "application/msword",
|
||||
"docx" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
"xls" => "application/x-ole-storage",
|
||||
"xlsx" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"csv" => "text/plain",
|
||||
"zip" => "application/zip"
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def defaults
|
||||
{
|
||||
"feature.featured_proposals": nil,
|
||||
|
||||
Reference in New Issue
Block a user