foodsoft/app/controllers/styles_controller.rb
Philipp Rothmann fb2b4d8a8a chore: rubocop
chore: fix api test conventions

chore: rubocop -A spec/

chore: more rubocop -A

fix failing test

rubocop fixes

removes helper methods that are in my opinion dead code

more rubocop fixes

rubocop -a --auto-gen-config
2023-06-09 17:35:05 +02:00

18 lines
569 B
Ruby

# Foodcoop-specific styling
class StylesController < ApplicationController
skip_before_action :authenticate
# 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?
render body: nil, content_type: 'text/css', status: :not_found
else
expires_in 1.week, public: true if params[:md5].present?
render body: css, content_type: 'text/css'
end
end
end