OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/app/models/custom_style.rb

32 lines
755 B

class CustomStyle < ApplicationRecord
mount_uploader :logo, OpenProject::Configuration.file_uploader
mount_uploader :favicon, OpenProject::Configuration.file_uploader
mount_uploader :touch_icon, OpenProject::Configuration.file_uploader
class << self
def current
RequestStore.fetch(:current_custom_style) do
custom_style = CustomStyle.order(Arel.sql('created_at DESC')).first
if custom_style.nil?
return nil
else
custom_style
end
end
end
end
def digest
updated_at.to_i
end
%i(favicon touch_icon logo).each do |name|
define_method "#{name}_path" do
image = send(name)
if image.readable?
image.local_file.path
end
end
end
end