Sha256: e6e74f81ce96da60fcc642ac3a0e3a1f47a2dcbc7e7d2af20b2550066531f21d

Contents?: true

Size: 848 Bytes

Versions: 4

Compression:

Stored size: 848 Bytes

Contents

class RedmineupController < ApplicationController
  layout 'admin'

  before_action :require_admin
  require_sudo_mode :settings if respond_to?(:require_sudo_mode)

  def settings
    @section = Redmineup::Settings::SECTIONS[params[:id]]
    return render_404 unless @section

    if request.post?
      setting =
        if params[:settings].present?
          params[:settings].respond_to?(:to_unsafe_hash) ? params[:settings].to_unsafe_hash : params[:settings]
        else
          {}
        end
      Redmineup::Settings.apply = setting
      flash[:notice] = l(:notice_successful_update)
      redirect_to redmineup_settings_path(@section[:id])
    else
      @settings = Redmineup::Settings.values
    end
    @section_tabs = Redmineup::Settings::SECTIONS.map { |_n, s| { name: s[:id], partial: s[:partial], label: s[:label] } }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redmineup-1.0.5 app/controllers/redmineup_controller.rb
redmineup-1.0.4 app/controllers/redmineup_controller.rb
redmineup-1.0.3 app/controllers/redmineup_controller.rb
redmineup-1.0.2 app/controllers/redmineup_controller.rb