Skip to content

Commit

Permalink
lint a random file
Browse files Browse the repository at this point in the history
  • Loading branch information
osc-bot committed Sep 25, 2024
1 parent 26aba48 commit 1aeb5c3
Showing 1 changed file with 49 additions and 45 deletions.
94 changes: 49 additions & 45 deletions apps/dashboard/app/controllers/batch_connect/settings_controller.rb
Original file line number Diff line number Diff line change
@@ -1,55 +1,59 @@
# frozen_string_literal: true

# The controller to manage BatchConnect saved settings
class BatchConnect::SettingsController < ApplicationController
include BatchConnectConcern
include UserSettingStore

# GET /batch_connect/<app_token>/settings/<settings_name>
def show
set_app_groups
set_saved_settings

request_params = settings_request_params
app_token = request_params[:token]
settings_name = request_params[:id]
settings_values = bc_templates(app_token)[settings_name.to_sym]
if settings_values.nil?
redirect_to new_batch_connect_session_context_path(token: app_token),
alert: t('dashboard.bc_saved_settings.missing_settings')
return
module BatchConnect
class SettingsController < ApplicationController
include BatchConnectConcern
include UserSettingStore

# GET /batch_connect/<app_token>/settings/<settings_name>
def show
set_app_groups
set_saved_settings

request_params = settings_request_params
app_token = request_params[:token]
settings_name = request_params[:id]
settings_values = bc_templates(app_token)[settings_name.to_sym]
if settings_values.nil?
redirect_to new_batch_connect_session_context_path(token: app_token),
alert: t('dashboard.bc_saved_settings.missing_settings')
return
end

@settings = BatchConnect::Settings.new(app_token, settings_name, settings_values)
if @settings.outdated?
flash.now[:alert] = t('dashboard.bc_saved_settings.outdated_message', app_title: @settings.app.title)
end
end

@settings = BatchConnect::Settings.new(app_token, settings_name, settings_values)
if @settings.outdated?
flash.now[:alert] = t('dashboard.bc_saved_settings.outdated_message', app_title: @settings.app.title)
# DELETE /batch_connect/<app_token>/settings/<settings_name>
def destroy
request_params = settings_request_params
app_token = request_params[:token]
settings_name = request_params[:id]
delete_bc_template(app_token, settings_name)
redirect_to new_batch_connect_session_context_path(token: app_token),
notice: t('dashboard.bc_saved_settings.deleted_message', settings_name: settings_name)
end
end

# DELETE /batch_connect/<app_token>/settings/<settings_name>
def destroy
request_params = settings_request_params
app_token = request_params[:token]
settings_name = request_params[:id]
delete_bc_template(app_token, settings_name)
redirect_to new_batch_connect_session_context_path(token: app_token),
notice: t('dashboard.bc_saved_settings.deleted_message', settings_name: settings_name)
end

private
private

def settings_request_params
params.permit(:token, :id)
end
def settings_request_params
params.permit(:token, :id)
end

# Set the all the saved settings to render the navigation
def set_saved_settings
@bc_saved_settings = all_bc_templates
end
# Set the all the saved settings to render the navigation
def set_saved_settings
@bc_saved_settings = all_bc_templates
end

# Set list of app lists for navigation
def set_app_groups
@sys_app_groups = bc_sys_app_groups
@usr_app_groups = bc_usr_app_groups
@dev_app_groups = bc_dev_app_groups
@apps_menu_group = bc_custom_apps_group
# Set list of app lists for navigation
def set_app_groups
@sys_app_groups = bc_sys_app_groups
@usr_app_groups = bc_usr_app_groups
@dev_app_groups = bc_dev_app_groups
@apps_menu_group = bc_custom_apps_group
end
end
end

0 comments on commit 1aeb5c3

Please sign in to comment.