Class: Releaf::RootController

Inherits:
ActionController show all
Defined in:
app/controllers/releaf/root_controller.rb

Instance Method Summary collapse

Methods inherited from ActionController

#collection_given?, #confirm_destroy, #controller_scope_name, #create, #create_another?, #definition, #destroy, #destroyable?, #edit, #index, #new, #page_title, #prepare_create, #prepare_destroy, #prepare_edit, #prepare_index, #prepare_new, #prepare_resource_view, #prepare_show, #prepare_toolbox, #prepare_update, #required_params, #short_name, #show, #toolbox, #update

Methods included from Responders

#action_responder, #action_responders, #active_responder, #respond_with

Methods included from ActionController::Exceptions

#access_denied, #page_not_found

Methods included from ActionController::Layout

#layout_features

Methods included from ActionController::Views

#action_view, #action_views, #active_view

Methods included from ActionController::RichtextAttachments

#create_releaf_richtext_attachment, #releaf_richtext_attachment_upload_url

Methods included from ActionController::Breadcrumbs

#add_resource_breadcrumb, #build_breadcrumbs, #controller_breadcrumb

Methods included from ActionController::Urls

#current_path, #index_path, #resolve_index_path, #success_path, #valid_index_path?

Methods included from ActionController::Ajax

#ajax?, #layout, #manage_ajax

Methods included from ActionController::Features

#action_feature, #action_features, #feature_available?, #verify_feature_availability!

Methods included from ActionController::Search

#search, #searchable_fields, #searcher_class

Methods included from ActionController::Builders

#application_scope, #builder_class, #builder_scopes

Methods included from ActionController::Resources

#load_resource, #new_resource, #permitted_params, #resource_class, #resource_given?, #resource_params, #resources, #resources_per_page

Methods included from ActionController::Notifications

#notice_scope_name, #render_notification

Instance Method Details

#featuresObject


10
11
12
# File 'app/controllers/releaf/root_controller.rb', line 10

def features
  []
end

#homeObject


2
3
4
5
6
7
8
# File 'app/controllers/releaf/root_controller.rb', line 2

def home
  respond_to do |format|
    format.html do
      redirect_to Releaf.application.config.root.default_controller_resolver.call(current_controller: self)
    end
  end
end

#store_settingsObject

Store settings for menu collapsing and others


15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/releaf/root_controller.rb', line 15

def store_settings
  settings = params.permit(settings: [:key, :value]).to_h.fetch(:settings, nil)
  if settings
    settings.each do|item|
      next if item[:key].nil? || item[:value].nil?
      item[:value] = true if item[:value] == "true"
      item[:value] = false if item[:value] == "false"
      Releaf.application.config.settings_manager.write(controller: self, key: item[:key], value: item[:value])
    end
    head :ok
  else
    head :unprocessable_entity
  end
end