dhatu 0.3.0.pre.materialize → 0.3.1.pre.materialize

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/dhatu/application_controller.rb +0 -2
  3. data/app/controllers/dhatu/career_opportunities_controller.rb +145 -0
  4. data/app/controllers/dhatu/manufacturers_controller.rb +114 -0
  5. data/app/controllers/dhatu/products_controller.rb +164 -0
  6. data/app/controllers/dhatu/resource_controller.rb +1 -0
  7. data/app/models/dhatu/blog_post.rb +1 -1
  8. data/app/models/dhatu/booking.rb +1 -1
  9. data/app/models/dhatu/branch.rb +1 -1
  10. data/app/models/dhatu/career_opportunity.rb +92 -0
  11. data/app/models/dhatu/category.rb +1 -1
  12. data/app/models/dhatu/event.rb +1 -1
  13. data/app/models/dhatu/manufacturer.rb +113 -0
  14. data/app/models/dhatu/meta_tag.rb +1 -1
  15. data/app/models/dhatu/offer.rb +1 -1
  16. data/app/models/dhatu/page.rb +1 -1
  17. data/app/models/dhatu/photo_album.rb +1 -1
  18. data/app/models/dhatu/price.rb +1 -1
  19. data/app/models/dhatu/product.rb +141 -0
  20. data/app/models/dhatu/project.rb +1 -1
  21. data/app/models/dhatu/promotion.rb +1 -1
  22. data/app/models/dhatu/promotion_attribute.rb +1 -1
  23. data/app/models/dhatu/promotion_enquiry.rb +1 -1
  24. data/app/models/dhatu/section.rb +11 -1
  25. data/app/models/dhatu/service.rb +1 -1
  26. data/app/models/dhatu/team_member.rb +1 -1
  27. data/app/models/dhatu/testimonial.rb +1 -1
  28. data/app/views/dhatu/blog_posts/_form.html.erb +1 -1
  29. data/app/views/dhatu/blog_posts/_show.html.erb +1 -1
  30. data/app/views/dhatu/bookings/_show.html.erb +1 -1
  31. data/app/views/dhatu/branches/_form.html.erb +1 -1
  32. data/app/views/dhatu/branches/_show.html.erb +1 -1
  33. data/app/views/dhatu/career_opportunities/_form.html.erb +41 -0
  34. data/app/views/dhatu/career_opportunities/_index.html.erb +52 -0
  35. data/app/views/dhatu/career_opportunities/_row.html.erb +26 -0
  36. data/app/views/dhatu/career_opportunities/_show.html.erb +96 -0
  37. data/app/views/dhatu/career_opportunities/index.html.erb +52 -0
  38. data/app/views/dhatu/categories/_show.html.erb +1 -1
  39. data/app/views/dhatu/dashboard/_index.html.erb +18 -0
  40. data/app/views/dhatu/events/_form.html.erb +1 -1
  41. data/app/views/dhatu/events/_show.html.erb +1 -1
  42. data/app/views/dhatu/manufacturers/_form.html.erb +40 -0
  43. data/app/views/dhatu/manufacturers/_index.html.erb +56 -0
  44. data/app/views/dhatu/manufacturers/_row.html.erb +30 -0
  45. data/app/views/dhatu/manufacturers/_show.html.erb +69 -0
  46. data/app/views/dhatu/manufacturers/index.html.erb +63 -0
  47. data/app/views/dhatu/manufacturers/show.html.erb +12 -0
  48. data/app/views/dhatu/offers/_form.html.erb +1 -1
  49. data/app/views/dhatu/offers/_show.html.erb +1 -1
  50. data/app/views/dhatu/pages/_show.html.erb +1 -1
  51. data/app/views/dhatu/photo_albums/_show.html.erb +1 -1
  52. data/app/views/dhatu/prices/_show.html.erb +1 -1
  53. data/app/views/dhatu/products/_form.html.erb +58 -0
  54. data/app/views/dhatu/products/_index.html.erb +68 -0
  55. data/app/views/dhatu/products/_row.html.erb +40 -0
  56. data/app/views/dhatu/products/_show.html.erb +146 -0
  57. data/app/views/dhatu/products/index.html.erb +63 -0
  58. data/app/views/dhatu/products/show.html.erb +12 -0
  59. data/app/views/dhatu/projects/_form.html.erb +1 -1
  60. data/app/views/dhatu/projects/_show.html.erb +1 -1
  61. data/app/views/dhatu/promotion_attributes/_show.html.erb +1 -1
  62. data/app/views/dhatu/promotion_enquiries/_show.html.erb +1 -1
  63. data/app/views/dhatu/promotions/_form.html.erb +1 -1
  64. data/app/views/dhatu/promotions/_show.html.erb +1 -1
  65. data/app/views/dhatu/sections/_form.html.erb +1 -1
  66. data/app/views/dhatu/sections/_show.html.erb +1 -1
  67. data/app/views/dhatu/services/_form.html.erb +1 -1
  68. data/app/views/dhatu/services/_show.html.erb +1 -1
  69. data/app/views/dhatu/team_members/_form.html.erb +1 -1
  70. data/app/views/dhatu/team_members/_show.html.erb +1 -1
  71. data/app/views/dhatu/testimonials/_form.html.erb +1 -1
  72. data/app/views/dhatu/testimonials/_show.html.erb +1 -1
  73. data/app/views/layouts/kuppayam/_sidebar.html.erb +18 -0
  74. data/config/routes.rb +24 -0
  75. data/db/data/dummy/categories.csv +4 -1
  76. data/db/data/dummy/products.csv +3 -0
  77. data/db/migrate/20160803045832_create_events.rb +2 -2
  78. data/db/migrate/20160803045832_create_offers.rb +2 -2
  79. data/db/migrate/20171010055101_create_pages.rb +3 -3
  80. data/db/migrate/20171010055102_create_sections.rb +2 -2
  81. data/db/migrate/20171012073510_create_testimonials.rb +2 -2
  82. data/db/migrate/20171012103805_create_team_members.rb +2 -2
  83. data/db/migrate/20171012103806_create_blog_posts.rb +2 -2
  84. data/db/migrate/20171014125053_create_branches.rb +2 -2
  85. data/db/migrate/20171014125054_create_categories.rb +3 -3
  86. data/db/migrate/20171014125055_create_services.rb +3 -3
  87. data/db/migrate/20171104163660_create_prices.rb +2 -2
  88. data/db/migrate/20171104163661_create_bookings.rb +2 -2
  89. data/db/migrate/20171120145548_create_promotion_and_promotion_enquiries.rb +5 -5
  90. data/db/migrate/20180101093434_create_projects.rb +3 -3
  91. data/db/migrate/20180101093436_create_meta_tags.rb +3 -3
  92. data/db/migrate/20180101093437_create_photo_albums.rb +3 -3
  93. data/db/migrate/20180101093438_create_manufacturers.rb +17 -0
  94. data/db/migrate/20180101093439_create_products.rb +29 -0
  95. data/db/migrate/20180101093449_create_career_opportunities.rb +23 -0
  96. data/lib/dhatu/version.rb +1 -1
  97. metadata +29 -7
  98. data/app/views/dhatu/sections_old/_form.html.erb +0 -171
  99. data/app/views/dhatu/sections_old/_index.html.erb +0 -53
  100. data/app/views/dhatu/sections_old/_row.html.erb +0 -26
  101. data/app/views/dhatu/sections_old/_show.html.erb +0 -208
  102. data/app/views/dhatu/sections_old/index.html.erb +0 -52
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f35c168d8965fcecc570566c6c268da1a37102c4cb082ab2c77cefde4d77a5c
4
- data.tar.gz: 61f87b4f2ad9359580103ac8075e2d8e18d7044568767c383b44fa7b9074c4e2
3
+ metadata.gz: 39dd0eeddc88ca2234b73d0b3259d9aab7cb5342ab73042e0645fdc2f5e49fda
4
+ data.tar.gz: 0eb024309cb1225339806da919f4b6c6511d605f9973e5c27f8656e220710d70
5
5
  SHA512:
6
- metadata.gz: 428291e91afd8ee8066de1229d5dee31e741af31410e1edf83463c50e7f57347e9d8b43c678ffdd350c39993ef96f294724d1caffb27289fdfb0aeddc6fb69f3
7
- data.tar.gz: d38daa7b36bc984c93b9a5798f88084addaa10fd5896cd67c84064b42908abc5870108aa0fbd4453aefe09f03c771f77c6d552d2a0fa2fb29de1788b8121e0b6
6
+ metadata.gz: 3e12138aa785409c87f79c1f95071407886178d05bc96d97cc669b2f89f5a1a3c8a9fe61e8dea3ff4eff7d66279c67d2286bd0274639d8c4ad3495bfdd97cdfa
7
+ data.tar.gz: 453c566ae6a38ad7896a09cd218ab2855d6e1a7e4e4f84668913b47f0ace5a8e6dbdfbc75f617521147c709331995a5a585222437104df7a54f2656dfe823fd9
@@ -3,8 +3,6 @@ module Dhatu
3
3
 
4
4
  include Usman::AuthenticationHelper
5
5
 
6
- layout 'kuppayam/admin'
7
-
8
6
  before_action :current_user
9
7
  before_action :require_user
10
8
  before_action :require_site_admin
@@ -0,0 +1,145 @@
1
+ module Dhatu
2
+ class CareerOpportunitiesController < ResourceController
3
+
4
+ private
5
+
6
+ def permitted_params
7
+ params.require("dhatu/career_opportunity").permit(:title, :sub_title, :short_description, :description, :priority, :category_id)
8
+ end
9
+
10
+ def get_collections
11
+ @relation = Dhatu::CareerOpportunity.includes(:cover_image, :category).where("")
12
+
13
+ parse_filters
14
+ apply_filters
15
+
16
+ @career_opportunities = @r_objects = @relation.page(@current_page).per(@per_page)
17
+ return true
18
+ end
19
+
20
+ def apply_filters
21
+ if @category.is_a?(String)
22
+ @category = Dhatu::Category.new(id: -2, name: "IS NOT SET")
23
+ elsif @category.blank?
24
+ @category = Dhatu::Category.new(id: -1, name: "All")
25
+ end
26
+
27
+ if @category
28
+ if @category.persisted?
29
+ @relation = @relation.where("category_id = ?", @category.id)
30
+ elsif @category.id == -2
31
+ @relation = @relation.where("category_id IS NULL")
32
+ end
33
+ end
34
+
35
+ @relation = @relation.search(@query) if @query
36
+ @relation = @relation.status(@status) if @status
37
+ @relation = @relation.order("priority ASC, title ASC")
38
+ end
39
+
40
+ def configure_filter_settings
41
+ @filter_settings = {
42
+ string_filters: [
43
+ { filter_name: :query },
44
+ { filter_name: :status }
45
+ ],
46
+
47
+ boolean_filters: [],
48
+
49
+ reference_filters: [
50
+ { filter_name: :category, filter_class: Dhatu::Category },
51
+ ],
52
+ variable_filters: [],
53
+ }
54
+ end
55
+
56
+ def configure_filter_ui_settings
57
+ @filter_ui_settings = {
58
+ status: {
59
+ object_filter: false,
60
+ select_label: "Filter by Status",
61
+ display_hash: Dhatu::CareerOpportunity::STATUS_REVERSE,
62
+ current_value: @status,
63
+ values: Dhatu::CareerOpportunity::STATUS,
64
+ current_filters: @filters,
65
+ filters_to_remove: [],
66
+ filters_to_add: {},
67
+ url_method_name: 'career_opportunities_url',
68
+ show_all_filter_on_top: true
69
+ },
70
+ category: {
71
+ object_filter: true,
72
+ select_label: 'Select Category Type',
73
+ current_value: @category,
74
+ values: [], #Dhatu::Category.filter_by_category_type("Dhatu::CareerOpportunity").published.order("priority ASC, name ASC").all,
75
+ current_filters: @filters,
76
+ url_method_name: 'career_opportunities_url',
77
+ filters_to_remove: [],
78
+ filters_to_add: {},
79
+ show_null_filter_on_top: true,
80
+ show_all_filter_on_top: true
81
+ }
82
+ }
83
+ end
84
+
85
+ def resource_controller_configuration
86
+ {
87
+ page_title: "Manage Career Opportunities",
88
+ current_nav: "dhatu/career_opportunities",
89
+
90
+ # Resource Names
91
+ class: Dhatu::CareerOpportunity,
92
+ collection_name: :career_opportunities,
93
+ item_name: :career_opportunity,
94
+
95
+ # Conditions
96
+ get_collections_after_save_resource: false,
97
+ show_modal_after_create: true,
98
+ show_modal_after_update: true,
99
+
100
+ # Model Size can be large or generic
101
+ form_model_size: :large,
102
+ show_model_size: :large,
103
+
104
+ # Layout can be table or feed
105
+ # table uses html tables and feed uses div based boxes
106
+ layout: :table,
107
+
108
+ # "/kuppayam/workflows/default"
109
+ #
110
+ # Default partial opens show and form partial according to the model_size configuration
111
+ # It also respect the configuration layout and refresh the page element on both cases - i.e layout is table or feed
112
+
113
+ # "/kuppayam/workflows/peacock"
114
+ # "/kuppayam/workflows/parrot"
115
+ #
116
+ # Peacock & Parrot are old ways of doing things and it respects certail configurations
117
+ # Peacock opens show and form partials in large popup where as Parrot opens it in small
118
+ # Both Peacock and Parrot expect table based layout and will reload a single row after create / update
119
+
120
+ # Rendering Paths
121
+ view_path: "dhatu/career_opportunities",
122
+ js_view_path: "/kuppayam/workflows/default",
123
+
124
+ # Additional Configurations
125
+ load_rich_text_editor: true,
126
+ tagsinput: false
127
+ }
128
+ end
129
+
130
+ def breadcrumbs_configuration
131
+ {
132
+ heading: "Manage Career Opportunities",
133
+ icon: "fa-gift",
134
+ description: "Listing all Career Opportunities",
135
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
136
+ {name: "Manage CareerOpportunities", link: dhatu.career_opportunities_path, icon: 'fa-gift', active: true}]
137
+ }
138
+ end
139
+
140
+ def set_navs
141
+ set_nav("dhatu/career_opportunities")
142
+ end
143
+
144
+ end
145
+ end
@@ -0,0 +1,114 @@
1
+ module Dhatu
2
+ class ManufacturersController < ResourceController
3
+
4
+ private
5
+
6
+ def permitted_params
7
+ params.require("dhatu/manufacturer").permit(:name, :description, :remarks, :website, :priority)
8
+ end
9
+
10
+ def get_collections
11
+ @relation = Dhatu::Manufacturer.includes(:logo).where("")
12
+
13
+ parse_filters
14
+ apply_filters
15
+
16
+ @manufacturers = @r_objects = @relation.page(@current_page).per(@per_page)
17
+ return true
18
+ end
19
+
20
+ def apply_filters
21
+ @relation = @relation.search(@query) if @query
22
+ @relation = @relation.status(@status) if @status
23
+ @relation = @relation.order("priority ASC, name ASC")
24
+ end
25
+
26
+ def configure_filter_settings
27
+ @filter_settings = {
28
+ string_filters: [
29
+ { filter_name: :query },
30
+ { filter_name: :status }
31
+ ],
32
+
33
+ boolean_filters: [],
34
+ reference_filters: [],
35
+ variable_filters: [],
36
+ }
37
+ end
38
+
39
+ def configure_filter_ui_settings
40
+ @filter_ui_settings = {
41
+ status: {
42
+ object_filter: false,
43
+ select_label: "Filter by Status",
44
+ display_hash: Dhatu::Manufacturer::STATUS_REVERSE,
45
+ current_value: @status,
46
+ values: Dhatu::Manufacturer::STATUS,
47
+ current_filters: @filters,
48
+ filters_to_remove: [],
49
+ filters_to_add: {},
50
+ url_method_name: 'manufacturers_url',
51
+ show_all_filter_on_top: true
52
+ }
53
+ }
54
+ end
55
+
56
+ def resource_controller_configuration
57
+ {
58
+
59
+ page_title: "Manage Manufacturers",
60
+ current_nav: "dhatu/manufacturers",
61
+ feature_name: "KM - Users",
62
+
63
+ # Resource Names
64
+ class: Dhatu::Manufacturer,
65
+ collection_name: :manufacturers,
66
+ item_name: :manufacturer,
67
+
68
+ # Conditions
69
+ get_collections_after_save_resource: false,
70
+ show_modal_after_create: true,
71
+ show_modal_after_update: false,
72
+
73
+ # Model Size can be large or generic
74
+ form_model_size: :large,
75
+ show_model_size: :large,
76
+
77
+ # Layout can be table or feed
78
+ # table uses html tables and feed uses div based boxes
79
+ layout: :table,
80
+
81
+ # "/kuppayam/workflows/default"
82
+ #
83
+ # Default partial opens show and form partial according to the model_size configuration
84
+ # It also respect the configuration layout and refresh the page element on both cases - i.e layout is table or feed
85
+
86
+ # "/kuppayam/workflows/peacock"
87
+ # "/kuppayam/workflows/parrot"
88
+ #
89
+ # Peacock & Parrot are old ways of doing things and it respects certail configurations
90
+ # Peacock opens show and form partials in large popup where as Parrot opens it in small
91
+ # Both Peacock and Parrot expect table based layout and will reload a single row after create / update
92
+
93
+ # Rendering Paths
94
+ view_path: "dhatu/manufacturers",
95
+ js_view_path: "/kuppayam/workflows/default",
96
+
97
+ # Additional Configurations
98
+ load_rich_text_editor: true,
99
+ tagsinput: false
100
+ }
101
+ end
102
+
103
+ def breadcrumbs_configuration
104
+ {
105
+ heading: "Manage Manufacturers",
106
+ icon: "fa-institution",
107
+ description: "Listing all Manufacturers",
108
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
109
+ {name: "Manage Manufacturers", link: dhatu.manufacturers_path, icon: 'fa-institution', active: true}]
110
+ }
111
+ end
112
+
113
+ end
114
+ end
@@ -0,0 +1,164 @@
1
+ module Dhatu
2
+ class ProductsController < ResourceController
3
+
4
+ private
5
+
6
+ def permitted_params
7
+ params.require("dhatu/product").permit(:title, :sub_title, :ean_sku, :reference_number, :manufacturer_id, :category_id, :short_description, :description, :price, :priority)
8
+ end
9
+
10
+ def get_collections
11
+ @relation = Dhatu::Product.includes(:cover_image, :category).where("")
12
+
13
+ parse_filters
14
+ apply_filters
15
+
16
+ @products = @r_objects = @relation.page(@current_page).per(@per_page)
17
+ return true
18
+ end
19
+
20
+ def apply_filters
21
+ if @category.is_a?(String)
22
+ @category = Dhatu::Category.new(id: -2, name: "IS NOT SET")
23
+ elsif @category.blank?
24
+ @category = Dhatu::Category.new(id: -1, name: "All")
25
+ end
26
+
27
+ if @category
28
+ if @category == "null"
29
+ @relation = @relation.where("category_id IS NULL")
30
+ elsif @category.persisted?
31
+ @relation = @relation.where("category_id = ?", @category.id)
32
+ end
33
+ end
34
+
35
+ if @manufacturer
36
+ if @manufacturer == "null"
37
+ @relation = @relation.where("manufacturer_id IS NULL")
38
+ elsif @manufacturer.persisted?
39
+ @relation = @relation.where("manufacturer_id = ?", @manufacturer.id)
40
+ end
41
+ end
42
+
43
+ @relation = @relation.search(@query) if @query
44
+ @relation = @relation.status(@status) if @status
45
+ @relation = @relation.order("priority ASC, title ASC")
46
+ end
47
+
48
+ def configure_filter_settings
49
+ @filter_settings = {
50
+ string_filters: [
51
+ { filter_name: :query },
52
+ { filter_name: :status }
53
+ ],
54
+
55
+ boolean_filters: [],
56
+ reference_filters: [
57
+ { filter_name: :category, filter_class: Dhatu::Category },
58
+ { filter_name: :manufacturer, filter_class: Dhatu::Manufacturer },
59
+ ],
60
+ variable_filters: [],
61
+ }
62
+ end
63
+
64
+ def configure_filter_ui_settings
65
+ @filter_ui_settings = {
66
+ status: {
67
+ object_filter: false,
68
+ select_label: "Filter by Status",
69
+ display_hash: Dhatu::Product::STATUS_REVERSE,
70
+ current_value: @status,
71
+ values: Dhatu::Product::STATUS,
72
+ current_filters: @filters,
73
+ filters_to_remove: [],
74
+ filters_to_add: {},
75
+ url_method_name: 'products_url',
76
+ show_all_filter_on_top: true
77
+ },
78
+ category: {
79
+ object_filter: true,
80
+ select_label: 'Select Category Type',
81
+ current_value: @category,
82
+ values: Dhatu::Category.filter_by_category_type("Dhatu::Product").published.order("priority ASC, name ASC").all,
83
+ current_filters: @filters,
84
+ url_method_name: 'products_url',
85
+ filters_to_remove: [],
86
+ filters_to_add: {},
87
+ show_null_filter_on_top: true,
88
+ show_all_filter_on_top: true
89
+ },
90
+ manufacturer: {
91
+ object_filter: true,
92
+ select_label: 'Select Manufacturer',
93
+ current_value: @manufacturer,
94
+ values: Dhatu::Manufacturer.published.order("priority ASC, name ASC").all,
95
+ current_filters: @filters,
96
+ url_method_name: 'products_url',
97
+ filters_to_remove: [],
98
+ filters_to_add: {},
99
+ show_null_filter_on_top: true,
100
+ show_all_filter_on_top: true
101
+ }
102
+ }
103
+ end
104
+
105
+ def resource_controller_configuration
106
+ {
107
+ page_title: "Manage Products",
108
+ current_nav: "dhatu/products",
109
+
110
+ # Resource Names
111
+ class: Dhatu::Product,
112
+ collection_name: :products,
113
+ item_name: :product,
114
+
115
+ # Conditions
116
+ get_collections_after_save_resource: false,
117
+ show_modal_after_create: true,
118
+ show_modal_after_update: true,
119
+
120
+ # Model Size can be large or generic
121
+ form_model_size: :large,
122
+ show_model_size: :large,
123
+
124
+ # Layout can be table or feed
125
+ # table uses html tables and feed uses div based boxes
126
+ layout: :table,
127
+
128
+ # "/kuppayam/workflows/default"
129
+ #
130
+ # Default partial opens show and form partial according to the model_size configuration
131
+ # It also respect the configuration layout and refresh the page element on both cases - i.e layout is table or feed
132
+
133
+ # "/kuppayam/workflows/peacock"
134
+ # "/kuppayam/workflows/parrot"
135
+ #
136
+ # Peacock & Parrot are old ways of doing things and it respects certail configurations
137
+ # Peacock opens show and form partials in large popup where as Parrot opens it in small
138
+ # Both Peacock and Parrot expect table based layout and will reload a single row after create / update
139
+
140
+ # Rendering Paths
141
+ view_path: "dhatu/products",
142
+ js_view_path: "/kuppayam/workflows/default",
143
+
144
+ # Additional Configurations
145
+ load_rich_text_editor: true,
146
+ tagsinput: false
147
+ }
148
+ end
149
+
150
+ def breadcrumbs_configuration
151
+ {
152
+ heading: "Manage Products",
153
+ icon: "linecons-shop",
154
+ description: "Listing all Products",
155
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
156
+ {name: "Manage Products", link: dhatu.products_path, icon: 'linecons-shop', active: true}]
157
+ }
158
+ end
159
+
160
+ def set_navs
161
+ set_nav("dhatu/products")
162
+ end
163
+ end
164
+ end
@@ -25,6 +25,7 @@ module Dhatu
25
25
  @filter_param_mapping[:category_type] = :ctype
26
26
  @filter_param_mapping[:feature] = :ft
27
27
  @filter_param_mapping[:featured] = :featured
28
+ @filter_param_mapping[:manufacturer] = :mf
28
29
  end
29
30
 
30
31
  end