2014-08-22 12:06:35 +02:00
|
|
|
# Foodcoop-specific styling
|
|
|
|
class StylesController < ApplicationController
|
2019-10-28 21:11:35 +01:00
|
|
|
skip_before_action :authenticate
|
2014-08-22 12:06:35 +02:00
|
|
|
|
|
|
|
# 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.
|
|
|
|
def foodcoop
|
|
|
|
css = FoodsoftConfig[:custom_css]
|
|
|
|
if css.blank?
|
2023-05-12 13:01:12 +02:00
|
|
|
render body: nil, content_type: 'text/css', status: :not_found
|
2014-08-22 12:06:35 +02:00
|
|
|
else
|
2021-03-01 15:27:26 +01:00
|
|
|
expires_in 1.week, public: true if params[:md5].present?
|
2020-08-12 13:38:18 +02:00
|
|
|
render body: css, content_type: 'text/css'
|
2014-08-22 12:06:35 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|