dhatu 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/dhatu/blog_posts_controller.rb +81 -14
- data/app/controllers/dhatu/bookings_controller.rb +51 -5
- data/app/controllers/dhatu/branches_controller.rb +42 -8
- data/app/controllers/dhatu/categories_controller.rb +86 -47
- data/app/controllers/dhatu/events_controller.rb +79 -9
- data/app/controllers/dhatu/meta_tags_controller.rb +96 -0
- data/app/controllers/dhatu/offers_controller.rb +83 -10
- data/app/controllers/dhatu/pages_controller.rb +130 -0
- data/app/controllers/dhatu/prices_controller.rb +78 -12
- data/app/controllers/dhatu/projects_controller.rb +78 -22
- data/app/controllers/dhatu/promotion_enquiries_controller.rb +69 -7
- data/app/controllers/dhatu/promotions_controller.rb +46 -2
- data/app/controllers/dhatu/resource_controller.rb +4 -0
- data/app/controllers/dhatu/sections_controller.rb +41 -8
- data/app/controllers/dhatu/services_controller.rb +78 -18
- data/app/controllers/dhatu/team_members_controller.rb +41 -8
- data/app/controllers/dhatu/testimonials_controller.rb +41 -9
- data/app/models/dhatu/blog_post.rb +6 -2
- data/app/models/dhatu/category.rb +3 -3
- data/app/models/dhatu/event.rb +4 -0
- data/app/models/dhatu/meta_tag.rb +48 -0
- data/app/models/dhatu/offer.rb +4 -0
- data/app/models/dhatu/page.rb +50 -0
- data/app/models/dhatu/project.rb +7 -3
- data/app/models/dhatu/promotion.rb +1 -0
- data/app/models/dhatu/section.rb +8 -12
- data/app/models/dhatu/service.rb +7 -3
- data/app/models/image/og_image.rb +3 -0
- data/app/uploaders/og_image_uploader.rb +15 -0
- data/app/views/dhatu/blog_posts/_form.html.erb +1 -1
- data/app/views/dhatu/blog_posts/_index.html.erb +1 -1
- data/app/views/dhatu/blog_posts/_row.html.erb +1 -1
- data/app/views/dhatu/blog_posts/_show.html.erb +1 -1
- data/app/views/dhatu/bookings/_index.html.erb +7 -8
- data/app/views/dhatu/bookings/_row.html.erb +11 -7
- data/app/views/dhatu/bookings/index.html.erb +20 -12
- data/app/views/dhatu/branches/_index.html.erb +8 -12
- data/app/views/dhatu/branches/_show.html.erb +75 -69
- data/app/views/dhatu/branches/index.html.erb +13 -8
- data/app/views/dhatu/categories/_category_types.html.erb +27 -0
- data/app/views/dhatu/categories/_form.html.erb +2 -2
- data/app/views/dhatu/categories/_index.html.erb +114 -89
- data/app/views/dhatu/categories/_index_list.html.erb +118 -0
- data/app/views/dhatu/categories/_row.html.erb +27 -31
- data/app/views/dhatu/categories/_row_list.html.erb +34 -0
- data/app/views/dhatu/categories/_show.html.erb +101 -74
- data/app/views/dhatu/categories/choose_category_type.html.erb +20 -0
- data/app/views/dhatu/categories/index.html.erb +1 -19
- data/app/views/dhatu/dashboard/_index.html.erb +53 -42
- data/app/views/dhatu/events/_index.html.erb +1 -1
- data/app/views/dhatu/events/_row.html.erb +1 -1
- data/app/views/dhatu/events/_show.html.erb +99 -75
- data/app/views/dhatu/events/index.html.erb +14 -9
- data/app/views/dhatu/meta_tags/_form.html.erb +48 -0
- data/app/views/dhatu/meta_tags/_index.html.erb +59 -0
- data/app/views/dhatu/meta_tags/_row.html.erb +32 -0
- data/app/views/dhatu/meta_tags/create.js.erb +29 -0
- data/app/views/dhatu/offers/_index.html.erb +8 -8
- data/app/views/dhatu/offers/_row.html.erb +1 -1
- data/app/views/dhatu/offers/_show.html.erb +85 -81
- data/app/views/dhatu/offers/index.html.erb +14 -8
- data/app/views/dhatu/pages/_form.html.erb +44 -0
- data/app/views/dhatu/pages/_index.html.erb +57 -0
- data/app/views/dhatu/pages/_row.html.erb +47 -0
- data/app/views/dhatu/pages/_show.html.erb +99 -0
- data/app/views/dhatu/pages/index.html.erb +59 -0
- data/app/views/dhatu/pages/show.html.erb +12 -0
- data/app/views/dhatu/prices/_index.html.erb +6 -6
- data/app/views/dhatu/prices/_row.html.erb +3 -2
- data/app/views/dhatu/prices/_show.html.erb +34 -45
- data/app/views/dhatu/prices/index.html.erb +14 -25
- data/app/views/dhatu/projects/_form.html.erb +15 -16
- data/app/views/dhatu/projects/_index.html.erb +6 -7
- data/app/views/dhatu/projects/_row.html.erb +4 -4
- data/app/views/dhatu/projects/_show.html.erb +108 -97
- data/app/views/dhatu/projects/index.html.erb +13 -19
- data/app/views/dhatu/projects/show.html.erb +12 -0
- data/app/views/dhatu/promotion_attributes/_index.html.erb +1 -7
- data/app/views/dhatu/promotion_attributes/_row.html.erb +1 -4
- data/app/views/dhatu/promotion_enquiries/_index.html.erb +11 -11
- data/app/views/dhatu/promotion_enquiries/_row.html.erb +7 -5
- data/app/views/dhatu/promotion_enquiries/_show.html.erb +35 -43
- data/app/views/dhatu/promotion_enquiries/index.html.erb +20 -12
- data/app/views/dhatu/promotions/_index.html.erb +13 -15
- data/app/views/dhatu/promotions/_row.html.erb +10 -9
- data/app/views/dhatu/promotions/_show.html.erb +190 -93
- data/app/views/dhatu/promotions/index.html.erb +0 -8
- data/app/views/dhatu/{section_types → section_types1}/_form.html.erb +0 -0
- data/app/views/dhatu/{section_types → section_types1}/_index.html.erb +0 -0
- data/app/views/dhatu/{section_types → section_types1}/_row.html.erb +0 -0
- data/app/views/dhatu/{section_types → section_types1}/_show.html.erb +0 -0
- data/app/views/dhatu/{section_types → section_types1}/index.html.erb +0 -0
- data/app/views/dhatu/sections/_form.html.erb +116 -11
- data/app/views/dhatu/sections/_index.html.erb +6 -3
- data/app/views/dhatu/sections/_row.html.erb +5 -2
- data/app/views/dhatu/sections/_show.html.erb +168 -132
- data/app/views/dhatu/sections/index.html.erb +10 -2
- data/app/views/dhatu/services/_form.html.erb +16 -17
- data/app/views/dhatu/services/_index.html.erb +6 -7
- data/app/views/dhatu/services/_row.html.erb +4 -4
- data/app/views/dhatu/services/_show.html.erb +107 -96
- data/app/views/dhatu/services/index.html.erb +13 -19
- data/app/views/dhatu/team_members/_index.html.erb +5 -6
- data/app/views/dhatu/team_members/_row.html.erb +3 -3
- data/app/views/dhatu/team_members/_show.html.erb +70 -58
- data/app/views/dhatu/team_members/index.html.erb +13 -8
- data/app/views/dhatu/testimonials/_index.html.erb +3 -6
- data/app/views/dhatu/testimonials/_row.html.erb +2 -3
- data/app/views/dhatu/testimonials/_show.html.erb +63 -93
- data/app/views/dhatu/testimonials/index.html.erb +13 -8
- data/app/views/layouts/kuppayam/_sidebar.html.erb +63 -48
- data/app/views/usman/dashboard/_super_admin_index.html.erb +22 -0
- data/config/routes.rb +12 -1
- data/db/data/dummy/services.csv +1 -1
- data/db/migrate/20180101093435_create_pages.rb +14 -0
- data/db/migrate/20180101093436_create_meta_tags.rb +19 -0
- data/db/migrate/20180101093437_add_page_id_to_sections.rb +5 -0
- data/db/migrate/20180101093438_add_priority_to_pages_and_sections.rb +6 -0
- data/db/migrate/20180101093439_add_a_ton_of_boolean_fields_to_sections.rb +34 -0
- data/db/migrate/20180101093440_add_code_to_sections.rb +19 -0
- data/db/migrate/20180101093441_rename_meta_description_all_over.rb +7 -0
- data/db/migrate/20180101093442_add_name_to_sections.rb +19 -0
- data/lib/dhatu/version.rb +1 -1
- metadata +43 -14
- data/db/migrate/20171203114529_add_meta_description_to_services.rb +0 -7
|
@@ -7,9 +7,17 @@ module Dhatu
|
|
|
7
7
|
params.require("dhatu/event").permit(:title, :venue, :description, :date, :starts_at, :ends_at, :priority, :category_id)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
+
def load_nested_categories
|
|
11
|
+
category_ids = Dhatu::Event.distinct.pluck(:category_id)
|
|
12
|
+
@categories = Dhatu::Category.where(id: category_ids).to_a
|
|
13
|
+
@categories.unshift(Dhatu::Category.new(id: -1, name: "All"))
|
|
14
|
+
end
|
|
15
|
+
|
|
10
16
|
def get_collections
|
|
17
|
+
# Checkout the method get_category_filters before using this method
|
|
18
|
+
# load_nested_categories
|
|
19
|
+
|
|
11
20
|
@relation = Dhatu::Event.includes(:cover_image).where("")
|
|
12
|
-
params[:st] = "published" if params[:st].nil?
|
|
13
21
|
parse_filters
|
|
14
22
|
apply_filters
|
|
15
23
|
@events = @r_objects = @relation.page(@current_page).per(@per_page)
|
|
@@ -17,6 +25,20 @@ module Dhatu
|
|
|
17
25
|
end
|
|
18
26
|
|
|
19
27
|
def apply_filters
|
|
28
|
+
if @category.is_a?(String)
|
|
29
|
+
@category = Dhatu::Category.new(id: -2, name: "IS NOT SET")
|
|
30
|
+
elsif @category.blank?
|
|
31
|
+
@category = Dhatu::Category.new(id: -1, name: "All")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
if @category
|
|
35
|
+
if @category.persisted?
|
|
36
|
+
@relation = @relation.where("category_id = ?", @category.id)
|
|
37
|
+
elsif @category.id == -2
|
|
38
|
+
@relation = @relation.where("category_id IS NULL")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
20
42
|
@relation = @relation.search(@query) if @query
|
|
21
43
|
@relation = @relation.status(@status) if @status
|
|
22
44
|
@relation = @relation.order("priority ASC, title ASC")
|
|
@@ -31,7 +53,9 @@ module Dhatu
|
|
|
31
53
|
|
|
32
54
|
boolean_filters: [],
|
|
33
55
|
|
|
34
|
-
reference_filters: [
|
|
56
|
+
reference_filters: [
|
|
57
|
+
# { filter_name: :category, filter_class: Dhatu::Category },
|
|
58
|
+
],
|
|
35
59
|
variable_filters: [],
|
|
36
60
|
}
|
|
37
61
|
end
|
|
@@ -40,27 +64,73 @@ module Dhatu
|
|
|
40
64
|
@filter_ui_settings = {
|
|
41
65
|
status: {
|
|
42
66
|
object_filter: false,
|
|
43
|
-
select_label: "
|
|
44
|
-
display_hash: Dhatu::Event::
|
|
67
|
+
select_label: "Filter by Status",
|
|
68
|
+
display_hash: Dhatu::Event::STATUS_REVERSE,
|
|
45
69
|
current_value: @status,
|
|
46
|
-
values: Dhatu::Event::
|
|
70
|
+
values: Dhatu::Event::STATUS,
|
|
47
71
|
current_filters: @filters,
|
|
48
72
|
filters_to_remove: [],
|
|
49
73
|
filters_to_add: {},
|
|
50
74
|
url_method_name: 'events_url',
|
|
51
75
|
show_all_filter_on_top: true
|
|
52
76
|
}
|
|
77
|
+
# category: {
|
|
78
|
+
# object_filter: true,
|
|
79
|
+
# select_label: 'Select Category Type',
|
|
80
|
+
# current_value: @category,
|
|
81
|
+
# values: Dhatu::Category.filter_by_category_type("Dhatu::Event").published.order("priority ASC, name ASC").all,
|
|
82
|
+
# current_filters: @filters,
|
|
83
|
+
# url_method_name: 'events_url',
|
|
84
|
+
# filters_to_remove: [],
|
|
85
|
+
# filters_to_add: {},
|
|
86
|
+
# show_null_filter_on_top: true,
|
|
87
|
+
# show_all_filter_on_top: true
|
|
88
|
+
# }
|
|
53
89
|
}
|
|
54
90
|
end
|
|
55
91
|
|
|
56
92
|
def resource_controller_configuration
|
|
57
93
|
{
|
|
58
|
-
page_title: "Events",
|
|
59
|
-
|
|
60
|
-
|
|
94
|
+
page_title: "Manage Events",
|
|
95
|
+
current_nav: "dhatu/events",
|
|
96
|
+
|
|
97
|
+
# Resource Names
|
|
98
|
+
class: Dhatu::Event,
|
|
61
99
|
collection_name: :events,
|
|
62
100
|
item_name: :event,
|
|
63
|
-
|
|
101
|
+
|
|
102
|
+
# Conditions
|
|
103
|
+
get_collections_after_save_resource: false,
|
|
104
|
+
show_modal_after_create: true,
|
|
105
|
+
show_modal_after_update: true,
|
|
106
|
+
|
|
107
|
+
# Model Size can be large or generic
|
|
108
|
+
form_model_size: :large,
|
|
109
|
+
show_model_size: :large,
|
|
110
|
+
|
|
111
|
+
# Layout can be table or feed
|
|
112
|
+
# table uses html tables and feed uses div based boxes
|
|
113
|
+
layout: :table,
|
|
114
|
+
|
|
115
|
+
# "/kuppayam/workflows/default"
|
|
116
|
+
#
|
|
117
|
+
# Default partial opens show and form partial according to the model_size configuration
|
|
118
|
+
# It also respect the configuration layout and refresh the page element on both cases - i.e layout is table or feed
|
|
119
|
+
|
|
120
|
+
# "/kuppayam/workflows/peacock"
|
|
121
|
+
# "/kuppayam/workflows/parrot"
|
|
122
|
+
#
|
|
123
|
+
# Peacock & Parrot are old ways of doing things and it respects certail configurations
|
|
124
|
+
# Peacock opens show and form partials in large popup where as Parrot opens it in small
|
|
125
|
+
# Both Peacock and Parrot expect table based layout and will reload a single row after create / update
|
|
126
|
+
|
|
127
|
+
# Rendering Paths
|
|
128
|
+
view_path: "dhatu/events",
|
|
129
|
+
js_view_path: "/kuppayam/workflows/default",
|
|
130
|
+
|
|
131
|
+
# Additional Configurations
|
|
132
|
+
load_wysihtml5: true,
|
|
133
|
+
tagsinput: false
|
|
64
134
|
}
|
|
65
135
|
end
|
|
66
136
|
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
module Dhatu
|
|
2
|
+
class MetaTagsController < ResourceController
|
|
3
|
+
|
|
4
|
+
before_action :require_site_admin
|
|
5
|
+
before_action :initialize_row_partial_locals, :get_meta_taggable
|
|
6
|
+
|
|
7
|
+
def create
|
|
8
|
+
@meta_tag = @r_object = Dhatu::MetaTag.new
|
|
9
|
+
@meta_tag.assign_attributes(permitted_params)
|
|
10
|
+
@meta_tag.meta_taggable = @meta_taggable
|
|
11
|
+
save_resource
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def initialize_row_partial_locals
|
|
17
|
+
@row_partial_locals = {}
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def get_meta_taggable
|
|
21
|
+
if params[:meta_taggable_type] && params[:meta_taggable_id]
|
|
22
|
+
@meta_taggable = params[:meta_taggable_type].constantize.find_by_id(params[:meta_taggable_id])
|
|
23
|
+
@row_partial_locals[:meta_taggable] = @meta_taggable
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def get_collections
|
|
28
|
+
@relation = @meta_taggable.meta_tags.where("")
|
|
29
|
+
|
|
30
|
+
parse_filters
|
|
31
|
+
apply_filters
|
|
32
|
+
|
|
33
|
+
@meta_tags = @r_objects = @relation.page(@current_page).per(@per_page)
|
|
34
|
+
@row_partial_locals[:meta_tags] = @meta_tags
|
|
35
|
+
|
|
36
|
+
return true
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def apply_filters
|
|
40
|
+
@relation = @relation.search(@query) if @query
|
|
41
|
+
|
|
42
|
+
@order_by = "meta_key ASC" unless @order_by
|
|
43
|
+
@relation = @relation.order(@order_by)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def configure_filter_settings
|
|
47
|
+
@filter_settings = {
|
|
48
|
+
string_filters: [
|
|
49
|
+
{ filter_name: :query }
|
|
50
|
+
],
|
|
51
|
+
boolean_filters: [],
|
|
52
|
+
reference_filters: [],
|
|
53
|
+
variable_filters: [],
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def configure_filter_ui_settings
|
|
58
|
+
@filter_ui_settings = {}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def resource_url(obj)
|
|
62
|
+
url_for(obj)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def resource_controller_configuration
|
|
66
|
+
{
|
|
67
|
+
collection_name: :meta_tags,
|
|
68
|
+
item_name: :meta_tag,
|
|
69
|
+
class: Dhatu::MetaTag,
|
|
70
|
+
feature_class: Dhatu::Page,
|
|
71
|
+
show_modal_after_create: false,
|
|
72
|
+
show_modal_after_update: false,
|
|
73
|
+
page_title: "Manage Meta Tags",
|
|
74
|
+
js_view_path: "/kuppayam/workflows/parrot",
|
|
75
|
+
view_path: "/dhatu/meta_tags"
|
|
76
|
+
}
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def breadcrumbs_configuration
|
|
80
|
+
{
|
|
81
|
+
heading: "Manage Meta Tags",
|
|
82
|
+
description: "Listing Meta Tags for the Page",
|
|
83
|
+
links: [{name: "Home", link: breadcrumb_home_path, icon: 'fa-home'}]
|
|
84
|
+
}
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def permitted_params
|
|
88
|
+
params.require("dhatu/meta_tag").permit(:meta_type, :meta_key, :meta_value)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def set_navs
|
|
92
|
+
set_nav("admin/meta_tags")
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
end
|
|
96
|
+
end
|
|
@@ -7,16 +7,41 @@ module Dhatu
|
|
|
7
7
|
params.require("dhatu/offer").permit(:title, :offer_text, :description, :starts_at, :ends_at, :priority, :category_id)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
+
def load_nested_categories
|
|
11
|
+
# Checkout the method get_category_filters before using this method
|
|
12
|
+
category_ids = Dhatu::Offer.distinct.pluck(:category_id)
|
|
13
|
+
@categories = Dhatu::Category.where(id: category_ids).to_a
|
|
14
|
+
@categories.unshift(Dhatu::Category.new(id: -1, name: "All"))
|
|
15
|
+
end
|
|
16
|
+
|
|
10
17
|
def get_collections
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
# Checkout the method get_category_filters before using this method
|
|
19
|
+
# load_nested_categories
|
|
20
|
+
|
|
21
|
+
@relation = Dhatu::Offer.includes(:cover_image, :category).where("")
|
|
22
|
+
|
|
13
23
|
parse_filters
|
|
14
24
|
apply_filters
|
|
25
|
+
|
|
15
26
|
@offers = @r_objects = @relation.page(@current_page).per(@per_page)
|
|
16
27
|
return true
|
|
17
28
|
end
|
|
18
29
|
|
|
19
30
|
def apply_filters
|
|
31
|
+
if @category.is_a?(String)
|
|
32
|
+
@category = Dhatu::Category.new(id: -2, name: "IS NOT SET")
|
|
33
|
+
elsif @category.blank?
|
|
34
|
+
@category = Dhatu::Category.new(id: -1, name: "All")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
if @category
|
|
38
|
+
if @category.persisted?
|
|
39
|
+
@relation = @relation.where("category_id = ?", @category.id)
|
|
40
|
+
elsif @category.id == -2
|
|
41
|
+
@relation = @relation.where("category_id IS NULL")
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
20
45
|
@relation = @relation.search(@query) if @query
|
|
21
46
|
@relation = @relation.status(@status) if @status
|
|
22
47
|
@relation = @relation.order("priority ASC, title ASC")
|
|
@@ -31,7 +56,9 @@ module Dhatu
|
|
|
31
56
|
|
|
32
57
|
boolean_filters: [],
|
|
33
58
|
|
|
34
|
-
reference_filters: [
|
|
59
|
+
reference_filters: [
|
|
60
|
+
# { filter_name: :category, filter_class: Dhatu::Category },
|
|
61
|
+
],
|
|
35
62
|
variable_filters: [],
|
|
36
63
|
}
|
|
37
64
|
end
|
|
@@ -40,27 +67,73 @@ module Dhatu
|
|
|
40
67
|
@filter_ui_settings = {
|
|
41
68
|
status: {
|
|
42
69
|
object_filter: false,
|
|
43
|
-
select_label: "
|
|
44
|
-
display_hash: Dhatu::Offer::
|
|
70
|
+
select_label: "Filter by Status",
|
|
71
|
+
display_hash: Dhatu::Offer::STATUS_REVERSE,
|
|
45
72
|
current_value: @status,
|
|
46
|
-
values: Dhatu::Offer::
|
|
73
|
+
values: Dhatu::Offer::STATUS,
|
|
47
74
|
current_filters: @filters,
|
|
48
75
|
filters_to_remove: [],
|
|
49
76
|
filters_to_add: {},
|
|
50
77
|
url_method_name: 'offers_url',
|
|
51
78
|
show_all_filter_on_top: true
|
|
52
79
|
}
|
|
80
|
+
# category: {
|
|
81
|
+
# object_filter: true,
|
|
82
|
+
# select_label: 'Select Category Type',
|
|
83
|
+
# current_value: @category,
|
|
84
|
+
# values: [], #Dhatu::Category.filter_by_category_type("Dhatu::Offer").published.order("priority ASC, name ASC").all,
|
|
85
|
+
# current_filters: @filters,
|
|
86
|
+
# url_method_name: 'offers_url',
|
|
87
|
+
# filters_to_remove: [],
|
|
88
|
+
# filters_to_add: {},
|
|
89
|
+
# show_null_filter_on_top: true,
|
|
90
|
+
# show_all_filter_on_top: true
|
|
91
|
+
# }
|
|
53
92
|
}
|
|
54
93
|
end
|
|
55
94
|
|
|
56
95
|
def resource_controller_configuration
|
|
57
96
|
{
|
|
58
|
-
page_title: "Offers",
|
|
59
|
-
|
|
60
|
-
|
|
97
|
+
page_title: "Manage Offers",
|
|
98
|
+
current_nav: "dhatu/offers",
|
|
99
|
+
|
|
100
|
+
# Resource Names
|
|
101
|
+
class: Dhatu::Offer,
|
|
61
102
|
collection_name: :offers,
|
|
62
103
|
item_name: :offer,
|
|
63
|
-
|
|
104
|
+
|
|
105
|
+
# Conditions
|
|
106
|
+
get_collections_after_save_resource: false,
|
|
107
|
+
show_modal_after_create: true,
|
|
108
|
+
show_modal_after_update: true,
|
|
109
|
+
|
|
110
|
+
# Model Size can be large or generic
|
|
111
|
+
form_model_size: :large,
|
|
112
|
+
show_model_size: :large,
|
|
113
|
+
|
|
114
|
+
# Layout can be table or feed
|
|
115
|
+
# table uses html tables and feed uses div based boxes
|
|
116
|
+
layout: :table,
|
|
117
|
+
|
|
118
|
+
# "/kuppayam/workflows/default"
|
|
119
|
+
#
|
|
120
|
+
# Default partial opens show and form partial according to the model_size configuration
|
|
121
|
+
# It also respect the configuration layout and refresh the page element on both cases - i.e layout is table or feed
|
|
122
|
+
|
|
123
|
+
# "/kuppayam/workflows/peacock"
|
|
124
|
+
# "/kuppayam/workflows/parrot"
|
|
125
|
+
#
|
|
126
|
+
# Peacock & Parrot are old ways of doing things and it respects certail configurations
|
|
127
|
+
# Peacock opens show and form partials in large popup where as Parrot opens it in small
|
|
128
|
+
# Both Peacock and Parrot expect table based layout and will reload a single row after create / update
|
|
129
|
+
|
|
130
|
+
# Rendering Paths
|
|
131
|
+
view_path: "dhatu/offers",
|
|
132
|
+
js_view_path: "/kuppayam/workflows/default",
|
|
133
|
+
|
|
134
|
+
# Additional Configurations
|
|
135
|
+
load_wysihtml5: true,
|
|
136
|
+
tagsinput: false
|
|
64
137
|
}
|
|
65
138
|
end
|
|
66
139
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
module Dhatu
|
|
2
|
+
class PagesController < ResourceController
|
|
3
|
+
|
|
4
|
+
def new
|
|
5
|
+
@r_object = @page = Dhatu::Page.new
|
|
6
|
+
render_accordingly
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
def permitted_params
|
|
12
|
+
params.require("dhatu/page").permit(:name, :code, :feature_id, :priority)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def get_collections
|
|
16
|
+
@relation = Dhatu::Page.includes(:og_image).where("")
|
|
17
|
+
parse_filters
|
|
18
|
+
apply_filters
|
|
19
|
+
@pages = @r_objects = @relation.page(@current_page).per(@per_page)
|
|
20
|
+
return true
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def apply_filters
|
|
24
|
+
@relation = @relation.search(@query) if @query
|
|
25
|
+
@relation = @relation.status(@status) if @status
|
|
26
|
+
@relation = @relation.where("feature_id = ?", @feature.id) if @feature
|
|
27
|
+
@order_by = "priority ASC, created_at desc" unless @order_by
|
|
28
|
+
@relation = @relation.order(@order_by)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def configure_filter_settings
|
|
32
|
+
@filter_settings = {
|
|
33
|
+
string_filters: [
|
|
34
|
+
{ filter_name: :query },
|
|
35
|
+
{ filter_name: :status }
|
|
36
|
+
],
|
|
37
|
+
boolean_filters: [],
|
|
38
|
+
reference_filters: [
|
|
39
|
+
{ filter_name: :feature, filter_class: Feature },
|
|
40
|
+
],
|
|
41
|
+
variable_filters: [],
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def configure_filter_ui_settings
|
|
46
|
+
@filter_ui_settings = {
|
|
47
|
+
status: {
|
|
48
|
+
object_filter: false,
|
|
49
|
+
select_label: "Filter by Status",
|
|
50
|
+
display_hash: Dhatu::Page::STATUS,
|
|
51
|
+
current_value: @status,
|
|
52
|
+
values: Dhatu::Page::STATUS_REVERSE,
|
|
53
|
+
current_filters: @filters,
|
|
54
|
+
filters_to_remove: [],
|
|
55
|
+
filters_to_add: {},
|
|
56
|
+
url_method_name: 'pages_url',
|
|
57
|
+
show_all_filter_on_top: true
|
|
58
|
+
},
|
|
59
|
+
feature: {
|
|
60
|
+
object_filter: true,
|
|
61
|
+
select_label: 'Select Feature',
|
|
62
|
+
current_value: @feature,
|
|
63
|
+
values: Feature.published.order(:name).all,
|
|
64
|
+
current_filters: @filters,
|
|
65
|
+
url_method_name: 'permissions_url',
|
|
66
|
+
filters_to_remove: [:feature],
|
|
67
|
+
filters_to_add: { user: @user.try(:id) },
|
|
68
|
+
show_null_filter_on_top: false,
|
|
69
|
+
show_all_filter_on_top: true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def resource_controller_configuration
|
|
75
|
+
{
|
|
76
|
+
page_title: "Manage Pages",
|
|
77
|
+
current_nav: "dhatu/pages",
|
|
78
|
+
|
|
79
|
+
# Resource Names
|
|
80
|
+
class: Dhatu::Page,
|
|
81
|
+
collection_name: :pages,
|
|
82
|
+
item_name: :page,
|
|
83
|
+
|
|
84
|
+
# Conditions
|
|
85
|
+
get_collections_after_save_resource: false,
|
|
86
|
+
show_modal_after_create: false,
|
|
87
|
+
show_modal_after_update: false,
|
|
88
|
+
|
|
89
|
+
# Model Size can be large or generic
|
|
90
|
+
form_model_size: :generic,
|
|
91
|
+
show_model_size: :large,
|
|
92
|
+
|
|
93
|
+
# Layout can be table or feed
|
|
94
|
+
# table uses html tables and feed uses div based boxes
|
|
95
|
+
layout: :feed,
|
|
96
|
+
|
|
97
|
+
# "/kuppayam/workflows/default"
|
|
98
|
+
#
|
|
99
|
+
# Default partial opens show and form partial according to the model_size configuration
|
|
100
|
+
# It also respect the configuration layout and refresh the page element on both cases - i.e layout is table or feed
|
|
101
|
+
|
|
102
|
+
# "/kuppayam/workflows/peacock"
|
|
103
|
+
# "/kuppayam/workflows/parrot"
|
|
104
|
+
#
|
|
105
|
+
# Peacock & Parrot are old ways of doing things and it respects certail configurations
|
|
106
|
+
# Peacock opens show and form partials in large popup where as Parrot opens it in small
|
|
107
|
+
# Both Peacock and Parrot expect table based layout and will reload a single row after create / update
|
|
108
|
+
|
|
109
|
+
# Rendering Paths
|
|
110
|
+
view_path: "dhatu/pages",
|
|
111
|
+
js_view_path: "/kuppayam/workflows/default",
|
|
112
|
+
|
|
113
|
+
# Additional Configurations
|
|
114
|
+
load_wysihtml5: false,
|
|
115
|
+
tagsinput: false
|
|
116
|
+
}
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def breadcrumbs_configuration
|
|
120
|
+
{
|
|
121
|
+
heading: "Manage Pages",
|
|
122
|
+
icon: "fa-file",
|
|
123
|
+
description: "Listing all Pages",
|
|
124
|
+
links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
|
|
125
|
+
{name: "Manage Pages", link: dhatu.pages_path, icon: 'fa-file', active: true}]
|
|
126
|
+
}
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
end
|
|
130
|
+
end
|