diff --git a/apps/dashboard/app/controllers/concerns/directory_utils_concern.rb b/apps/dashboard/app/controllers/concerns/directory_utils_concern.rb index 126be4944..87bdb932e 100644 --- a/apps/dashboard/app/controllers/concerns/directory_utils_concern.rb +++ b/apps/dashboard/app/controllers/concerns/directory_utils_concern.rb @@ -39,11 +39,10 @@ def validate_path! end def set_sorting_params(parameters) - Rails.logger.debug("Sorting params: #{parameters}") @sorting_params = { - col: parameters&.[](:col), - direction: !parameters&.[](:direction), - grouped?: parameters&.[](:grouped?) + col: parameters&.[](:col) || DEFAULT_SORTING_PARAMS[:col], + direction: !parameters&.[](:direction) || DEFAULT_SORTING_PARAMS[:direction], + grouped?: parameters&.[](:grouped?) || DEFAULT_SORTING_PARAMS[:grouped?] } end diff --git a/apps/dashboard/app/controllers/projects_controller.rb b/apps/dashboard/app/controllers/projects_controller.rb index 9786a4e66..5cbd8a67f 100644 --- a/apps/dashboard/app/controllers/projects_controller.rb +++ b/apps/dashboard/app/controllers/projects_controller.rb @@ -39,7 +39,6 @@ def directory parse_path("#{directory_params[:dir_path]}") validate_path! - Rails.logger.debug("Sorting params: #{@sorting_params}") set_sorting_params(directory_params[:sorting_params] || DEFAULT_SORTING_PARAMS ) set_files render( partial: 'projects/directory', diff --git a/apps/dashboard/app/helpers/projects_helper.rb b/apps/dashboard/app/helpers/projects_helper.rb index 5abfe103c..1610b583e 100644 --- a/apps/dashboard/app/helpers/projects_helper.rb +++ b/apps/dashboard/app/helpers/projects_helper.rb @@ -67,42 +67,26 @@ def project_size # end def column_head_link(column, sorting_params) - a = link_to( + link_to( link_text(column, sorting_params), target_path(column, sorting_params), title: tool_tip, class: "text-dark", data: data_attributes ) - - Rails.logger.debug("\n\n\n\n\n============== #{column} ===================") - Rails.logger.debug("Column head link: #{a}") - Rails.logger.debug("========================================\n\n\n\n\n") - a end def direction(column, sorting_params) - if column.to_s == sorting_params[:col].to_s - Rails.logger.debug("\n\n\n\n\n______________--------============-----------______________") - Rails.logger.debug(" COLUMN: #{column}") - Rails.logger.debug(" is #{column.to_s == sorting_params[:col] ? 'EQUAL' : 'NOT EQUAL'} to") - Rails.logger.debug(" SP COL: #{sorting_params[:col]}") - Rails.logger.debug(" RETURNING: descending") if column.to_s == sorting_params[:col].to_s && sorting_params[:direction] == ascending - - Rails.logger.debug("--------------========____________===========--------------\n\n\n\n\n") - end - if column.to_s == sorting_params[:col].to_s - !sorting_params[:direction] - end + return !sorting_params[:direction] if column.to_s == sorting_params[:col].to_s ascending end def link_text(column, sorting_params) col_title = t("dashboard.#{column.to_s}") if column.to_s == sorting_params[:col] - "#{col_title} #{fa_icon( direction(column, sorting_params) == ascending ? 'sort-up' : 'sort-down', classes: 'fa-md')}".html_safe + "#{col_title} #{ fa_icon(direction(column, sorting_params) == ascending ? 'sort-up' : 'sort-down', classes: 'fa-md') }".html_safe else - "#{col_title} #{fa_icon('sort', classes: 'fa-md')}".html_safe + "#{col_title} #{ fa_icon('sort', classes: 'fa-md') }".html_safe end end