Class: StylesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/styles_controller.rb

Overview

Foodcoop-specific styling

Instance Method Summary collapse

Methods inherited from ApplicationController

current

Instance Method Details

#foodcoopObject

renders foodcoop css, or 404 if not configured

When requested with the parameter md5, the result is returned with an expiry time of a week, to leverage caching.


9
10
11
12
13
14
15
16
17
# File 'app/controllers/styles_controller.rb', line 9

def foodcoop
  css = FoodsoftConfig[:custom_css]
  if css.blank?
    render text: nil, content_type: 'text/css', status: 404
  else
    expires_in 1.week, public:true if params[:md5].present?
    render text: css, content_type: 'text/css'
  end
end