feat: Sets up portal public views with rails ERB and tailwind (#5309)
* feat: Sets up portal public views with rails ERB and tailwind * linter fixes * Remove duplicate style file * Shows articles and categories * Specify layout for articles page * Updates public portal styles * Fixes blog content styles * Portal style updates for article page * Review fixes * Adds breadcrumbs * fix: rspec * fix: public portal spec * Code climate fixes * Adds test cases for missing files * Show only published articles * Updates help center routes * Review fixes * Render markdown content for aticle body * Update app/views/public/api/v1/portals/articles/index.html.erb Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Sojan <sojan@pepalo.com> Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com> Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: tejaswini chile <tejaswini@chatwoot.com>
This commit is contained in:
committed by
GitHub
parent
a680b08251
commit
1ea289e8b7
@@ -3,6 +3,7 @@ class Public::Api::V1::Portals::ArticlesController < PublicController
|
||||
before_action :set_portal
|
||||
before_action :set_category
|
||||
before_action :set_article, only: [:show]
|
||||
layout 'portal'
|
||||
|
||||
def index
|
||||
@articles = @portal.articles
|
||||
@@ -15,6 +16,7 @@ class Public::Api::V1::Portals::ArticlesController < PublicController
|
||||
|
||||
def set_article
|
||||
@article = @category.articles.find(params[:id])
|
||||
@parsed_content = render_article_content(@article.content)
|
||||
end
|
||||
|
||||
def set_category
|
||||
@@ -28,4 +30,10 @@ class Public::Api::V1::Portals::ArticlesController < PublicController
|
||||
def list_params
|
||||
params.permit(:query)
|
||||
end
|
||||
|
||||
def render_article_content(content)
|
||||
# rubocop:disable Rails/OutputSafety
|
||||
CommonMarker.render_html(content).html_safe
|
||||
# rubocop:enable Rails/OutputSafety
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,6 +2,7 @@ class Public::Api::V1::Portals::CategoriesController < PublicController
|
||||
before_action :ensure_custom_domain_request, only: [:show, :index]
|
||||
before_action :set_portal
|
||||
before_action :set_category, only: [:show]
|
||||
layout 'portal'
|
||||
|
||||
def index
|
||||
@categories = @portal.categories
|
||||
@@ -12,7 +13,7 @@ class Public::Api::V1::Portals::CategoriesController < PublicController
|
||||
private
|
||||
|
||||
def set_category
|
||||
@category = @portal.categories.find_by!(locale: params[:locale])
|
||||
@category = @portal.categories.find_by!(locale: params[:locale], slug: params[:category_slug])
|
||||
end
|
||||
|
||||
def set_portal
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
class Public::Api::V1::PortalsController < PublicController
|
||||
before_action :ensure_custom_domain_request, only: [:show]
|
||||
before_action :set_portal
|
||||
layout 'portal'
|
||||
|
||||
def show; end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user