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.

32 lines
804 B

  1. # frozen_string_literal: true
  2. class Settings::FlavoursController < Settings::BaseController
  3. def index
  4. redirect_to action: 'show', flavour: current_flavour
  5. end
  6. def show
  7. unless Themes.instance.flavours.include?(params[:flavour]) || (params[:flavour] == current_flavour)
  8. redirect_to action: 'show', flavour: current_flavour
  9. end
  10. @listing = Themes.instance.flavours
  11. @selected = params[:flavour]
  12. end
  13. def update
  14. user_settings.update(user_settings_params)
  15. redirect_to action: 'show', flavour: params[:flavour]
  16. end
  17. private
  18. def user_settings
  19. UserSettingsDecorator.new(current_user)
  20. end
  21. def user_settings_params
  22. { setting_flavour: params.require(:flavour),
  23. setting_skin: params.dig(:user, :setting_skin) }.with_indifferent_access
  24. end
  25. end