Skip to content

Commit

Permalink
Fix projet tab loading and cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
nanego committed Jan 10, 2024
1 parent 9c0324a commit 252ae0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
8 changes: 2 additions & 6 deletions lib/redmine_admin_activity/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ class ProjectsController
after_action :journalized_projects_closing, :only => [:close]
after_action :journalized_projects_archivation, :only => [:archive]
after_action :journalized_projects_reopen, :only => [:reopen]
before_action :get_projects_journals_for_pagination, :only => [:settings]

alias_method :settings, :settings

helper :journal_settings
include JournalSettingsHelper
append_before_action :get_projects_journals_for_pagination, :only => [:settings]

def init_journal
@project.init_journal(User.current)
Expand Down Expand Up @@ -247,6 +242,7 @@ def self_and_descendants_or_ancestors
end

def get_projects_journals_for_pagination
find_project unless @project
@scope = get_journal_for_history(@project.journals)
@journal_count = @scope.count
@journal_pages = Paginator.new @journal_count, per_page_option, params['page']
Expand Down
13 changes: 7 additions & 6 deletions lib/redmine_admin_activity/controllers/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class SettingsController

def intialize_settings_was
@settings_was = Setting.pluck(:name)
.select { |name| Setting.find_by_name(name).valid? }
.map { |name| [name.to_sym, Setting[name]] }
.select { |name| Setting.find_by_name(name).valid? }
.map { |name| [name.to_sym, Setting[name]] }
end

def track_settings_was_changes
Expand All @@ -36,11 +36,12 @@ def track_settings_was_changes
end

def get_settings_journals_for_pagination
@scope = JournalSetting.includes(:user).search_scope(params[:name]).
reorder(created_on: :desc).
references(:user)
@scope = JournalSetting.includes(:user)
.search_scope(params[:name])
.reorder(created_on: :desc)
.references(:user)
@journal_count = @scope.count
@journal_pages = Paginator.new @journal_count, per_page_option, params['page']
@journal_pages = Paginator.new @journal_count, per_page_option, params['page']
@journals = @scope.limit(@journal_pages.per_page).offset(@journal_pages.offset).to_a
@journals = add_index_to_journal_for_history(@journals)
end
Expand Down

0 comments on commit 252ae0d

Please sign in to comment.