Files
docuseal/app/controllers/templates_shared_controller.rb
T

23 lines
639 B
Ruby
Raw Normal View History

2026-06-24 14:17:17 +03:00
# frozen_string_literal: true
class TemplatesSharedController < ApplicationController
def index
authorize!(:read, Template)
2026-06-24 19:08:15 +03:00
@is_archived = params[:archived] == 'true'
2026-06-24 14:17:17 +03:00
@templates = Templates.shared(current_user)
2026-06-24 19:08:15 +03:00
@has_archived = !@is_archived && @templates.archived.exists?
@templates = @is_archived ? @templates.archived : @templates.active
@templates = @templates.preload(:author, :template_accesses, :template_sharings)
.order(id: :desc)
2026-06-24 14:17:17 +03:00
@templates = Templates.search(current_user, @templates, params[:q])
@pagy, @templates = pagy_auto(@templates, limit: 12)
end
end