module Dhatu class BlogPostsController < ResourceController private def permitted_params params.require("dhatu/blog_post").permit(:title, :slug, :author, :meta_description, :description, :posted_at, :tags, :category_id) end def get_collections @relation = Dhatu::BlogPost.includes(:cover_image).where("") params[:st] = "published" if params[:st].nil? parse_filters apply_filters @blog_posts = @r_objects = @relation.page(@current_page).per(@per_page) return true end def apply_filters @relation = @relation.search(@query) if @query @relation = @relation.status(@status) if @status @order_by = "created_at desc" unless @order_by @relation = @relation.order(@order_by) end def configure_filter_settings @filter_settings = { string_filters: [ { filter_name: :query }, { filter_name: :status } ], boolean_filters: [], reference_filters: [], variable_filters: [], } end def configure_filter_ui_settings @filter_ui_settings = { status: { object_filter: false, select_label: "Select Status", display_hash: Dhatu::BlogPost::STATUS, current_value: @status, values: Dhatu::BlogPost::STATUS_REVERSE, current_filters: @filters, filters_to_remove: [], filters_to_add: {}, url_method_name: 'blog_posts_url', show_all_filter_on_top: true } } end def resource_controller_configuration { page_title: "Blog", js_view_path: "/kuppayam/workflows/peacock", view_path: "dhatu/blog_posts", collection_name: :blog_posts, item_name: :blog_post, class: Dhatu::BlogPost } end def breadcrumbs_configuration { heading: "Manage Blog", icon: "fa-newspaper-o", description: "Listing all Blog Posts", links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'}, {name: "Manage Blog", link: dhatu.blog_posts_path, icon: 'fa-newspaper-o', active: true}] } end def set_navs set_nav("dhatu/blog_posts") end end end