Class: RedmineCrmController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/redmine_crm_controller.rb

Instance Method Summary collapse

Instance Method Details

#settingsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/redmine_crm_controller.rb', line 7

def settings
  @section = RedmineCrm::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
    RedmineCrm::Settings.apply = setting
    flash[:notice] = l(:notice_successful_update)
    redirect_to redmine_crm_settings_path(@section[:id])
  else
    @settings = RedmineCrm::Settings.values
  end
  @section_tabs = RedmineCrm::Settings::SECTIONS.map { |_n, s| { name: s[:id], partial: s[:partial], label: s[:label] } }
end