Files
docuseal/app/controllers/dashboard_controller.rb
T

32 lines
733 B
Ruby
Raw Normal View History

2023-05-21 17:59:36 +03:00
# frozen_string_literal: true
class DashboardController < ApplicationController
2023-06-19 21:44:41 +00:00
skip_before_action :authenticate_user!, only: %i[index]
2023-09-17 00:45:57 +03:00
before_action :maybe_redirect_product_url
before_action :maybe_render_landing
load_and_authorize_resource :template, parent: false
2023-05-21 17:59:36 +03:00
def index
2023-09-17 00:45:57 +03:00
@templates = @templates.active.preload(:author).order(id: :desc)
@templates = Templates.search(@templates, params[:q])
@pagy, @templates = pagy(@templates, items: 12)
end
private
def maybe_redirect_product_url
return if !Docuseal.multitenant? || signed_in?
redirect_to Docuseal::PRODUCT_URL, allow_other_host: true
end
2023-06-19 21:44:41 +00:00
2023-09-17 00:45:57 +03:00
def maybe_render_landing
return if signed_in?
2023-06-28 00:22:34 +03:00
2023-09-17 00:45:57 +03:00
render 'pages/landing'
2023-05-21 17:59:36 +03:00
end
end