dhatu 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/dhatu/blog_posts_controller.rb +5 -5
  3. data/app/controllers/dhatu/bookings_controller.rb +76 -0
  4. data/app/controllers/dhatu/branches_controller.rb +1 -1
  5. data/app/controllers/dhatu/categories_controller.rb +14 -12
  6. data/app/controllers/dhatu/events_controller.rb +7 -9
  7. data/app/controllers/dhatu/offers_controller.rb +6 -8
  8. data/app/controllers/dhatu/prices_controller.rb +90 -0
  9. data/app/controllers/dhatu/sections_controller.rb +5 -5
  10. data/app/controllers/dhatu/services_controller.rb +6 -8
  11. data/app/controllers/dhatu/team_members_controller.rb +5 -7
  12. data/app/controllers/dhatu/testimonials_controller.rb +10 -12
  13. data/app/models/dhatu/booking.rb +55 -0
  14. data/app/models/dhatu/category.rb +11 -13
  15. data/app/models/dhatu/event.rb +2 -1
  16. data/app/models/dhatu/offer.rb +1 -0
  17. data/app/models/dhatu/price.rb +59 -0
  18. data/app/models/dhatu/section.rb +1 -14
  19. data/app/models/dhatu/service.rb +1 -14
  20. data/app/uploaders/category_image_uploader.rb +8 -0
  21. data/app/views/dhatu/blog_posts/_show.html.erb +3 -5
  22. data/app/views/dhatu/bookings/_index.html.erb +48 -0
  23. data/app/views/dhatu/bookings/_row.html.erb +18 -0
  24. data/app/views/dhatu/bookings/_show.html.erb +62 -0
  25. data/app/views/dhatu/bookings/index.html.erb +79 -0
  26. data/app/views/dhatu/bookings/show.js.erb +17 -0
  27. data/app/views/dhatu/categories/_form.html.erb +5 -6
  28. data/app/views/dhatu/categories/_index.html.erb +3 -0
  29. data/app/views/dhatu/categories/_row.html.erb +2 -0
  30. data/app/views/dhatu/categories/_show.html.erb +29 -16
  31. data/app/views/dhatu/categories/index.html.erb +10 -4
  32. data/app/views/dhatu/dashboard/_index.html.erb +12 -0
  33. data/app/views/dhatu/events/_form.html.erb +5 -2
  34. data/app/views/dhatu/offers/_form.html.erb +5 -2
  35. data/app/views/dhatu/prices/_form.html.erb +45 -0
  36. data/app/views/dhatu/prices/_index.html.erb +49 -0
  37. data/app/views/dhatu/prices/_row.html.erb +24 -0
  38. data/app/views/dhatu/prices/_show.html.erb +76 -0
  39. data/app/views/dhatu/prices/index.html.erb +69 -0
  40. data/app/views/dhatu/services/_show.html.erb +1 -0
  41. data/app/views/dhatu/team_members/_form.html.erb +10 -2
  42. data/app/views/dhatu/testimonials/_form.html.erb +21 -8
  43. data/app/views/layouts/kuppayam/_sidebar.html.erb +12 -0
  44. data/config/routes.rb +16 -0
  45. data/lib/dhatu/version.rb +1 -1
  46. data/spec/dummy/spec/factories/blog_post.rb +2 -0
  47. data/spec/dummy/spec/factories/category.rb +51 -0
  48. data/spec/dummy/spec/factories/event.rb +2 -0
  49. data/spec/dummy/spec/factories/offer.rb +1 -1
  50. data/spec/dummy/spec/factories/section.rb +2 -0
  51. metadata +23 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5aa15ef1778f28fd3c9a4c2e5fa38c70a04691fb
4
- data.tar.gz: db924144919db1ce6795890dac67ec1e969d4aa8
3
+ metadata.gz: f51c750289d9a5c2e5c5285c6838e99fd8d7fa5f
4
+ data.tar.gz: ba4a2da4bb22359c41521d3bb0e67638463c1a62
5
5
  SHA512:
6
- metadata.gz: 06ee7c08dfed11f1b3c2c753b0f3fce3bf64ae2aa043ad9dde093fc9c8cd7cbd90f927345632161c6907c203e5c4e710c027e2b2ab026a15bd0b985a53e36159
7
- data.tar.gz: 7d3a7f3177d7df229009a8cc9f9dc313e19bd230061c5ab6a86be036e0e68bc11321d9cce89573d2c28dda3b7c7cc085829e2801d988b48ba2b1a48a72f1313a
6
+ metadata.gz: edb42de7e28b445b175755393a13f28441b05502211d96ed6ed17acb3bd575dd97e63dd3e3b475fd977ef4eb88234fcab2ffdff5dfe18a0e33269782ffa520c4
7
+ data.tar.gz: 29ba424274a5e616bf86d2a0fd1b310c5f43509c8da4041eba8e85106f8e1e02d156389bbe920c70903959aa644a73aec071282c744aa8db66334e984130dc97
@@ -8,7 +8,7 @@ module Dhatu
8
8
  end
9
9
 
10
10
  def get_collections
11
- @relation = BlogPost.includes(:cover_image).where("")
11
+ @relation = Dhatu::BlogPost.includes(:cover_image).where("")
12
12
  params[:st] = "published" if params[:st].nil?
13
13
  parse_filters
14
14
  apply_filters
@@ -43,9 +43,9 @@ module Dhatu
43
43
  status: {
44
44
  object_filter: false,
45
45
  select_label: "Select Status",
46
- display_hash: BlogPost::STATUS,
46
+ display_hash: Dhatu::BlogPost::STATUS,
47
47
  current_value: @status,
48
- values: BlogPost::STATUS_REVERSE,
48
+ values: Dhatu::BlogPost::STATUS_REVERSE,
49
49
  current_filters: @filters,
50
50
  filters_to_remove: [],
51
51
  filters_to_add: {},
@@ -62,7 +62,7 @@ module Dhatu
62
62
  view_path: "dhatu/blog_posts",
63
63
  collection_name: :blog_posts,
64
64
  item_name: :blog_post,
65
- class: BlogPost
65
+ class: Dhatu::BlogPost
66
66
  }
67
67
  end
68
68
 
@@ -71,7 +71,7 @@ module Dhatu
71
71
  heading: "Manage Blog",
72
72
  icon: "fa-newspaper-o",
73
73
  description: "Listing all Blog Posts",
74
- links: [{name: "Dashboard", link: dashboard_path, icon: 'fa-dashboard'},
74
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
75
75
  {name: "Manage Blog", link: dhatu.blog_posts_path, icon: 'fa-newspaper-o', active: true}]
76
76
  }
77
77
  end
@@ -0,0 +1,76 @@
1
+ module Dhatu
2
+ class BookingsController < ResourceController
3
+
4
+ def show
5
+ @booking = @r_object = Dhatu::Booking.find_by_id(params[:id])
6
+ if @booking
7
+ @booking.read! if @booking.new? || @booking.unread?
8
+ else
9
+ set_notification(false, I18n.t('status.error'), I18n.t('status.not_found', item: default_item_name.titleize))
10
+ end
11
+ end
12
+
13
+ private
14
+
15
+ def get_collections
16
+ @new_bookings_count = Dhatu::Booking.new_ones.count
17
+ @unread_bookings_count = Dhatu::Booking.unread.count
18
+ @relation = Dhatu::Booking.where("")
19
+ params[:st] = "new" if params[:st].nil? && params[:q].nil?
20
+ parse_filters
21
+ apply_filters
22
+ @bookings = @r_objects = @relation.page(@current_page).per(@per_page)
23
+ return true
24
+ end
25
+
26
+ def apply_filters
27
+ @relation = @relation.search(@query) if @query
28
+ @relation = @relation.status(@status) if @status
29
+ @relation = @relation.order("created_at DESC")
30
+ end
31
+
32
+ def configure_filter_settings
33
+ @filter_settings = {
34
+ string_filters: [
35
+ { filter_name: :query },
36
+ { filter_name: :status }
37
+ ],
38
+
39
+ boolean_filters: [],
40
+
41
+ reference_filters: [],
42
+ variable_filters: [],
43
+ }
44
+ end
45
+
46
+ def configure_filter_ui_settings
47
+ @filter_ui_settings = {}
48
+ end
49
+
50
+ def resource_controller_configuration
51
+ {
52
+ page_title: "Bookings",
53
+ js_view_path: "/kuppayam/workflows/peacock",
54
+ view_path: "dhatu/bookings",
55
+ collection_name: :bookings,
56
+ item_name: :booking,
57
+ class: Dhatu::Booking
58
+ }
59
+ end
60
+
61
+ def breadcrumbs_configuration
62
+ {
63
+ heading: "Manage Bookings",
64
+ icon: "fa-calendar",
65
+ description: "Listing all Bookings",
66
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
67
+ {name: "Manage Bookings", link: dhatu.bookings_path, icon: 'fa-calendar', active: true}]
68
+ }
69
+ end
70
+
71
+ def set_navs
72
+ set_nav("dhatu/bookings")
73
+ end
74
+
75
+ end
76
+ end
@@ -103,7 +103,7 @@ module Dhatu
103
103
  heading: "Manage Branches",
104
104
  icon: "fa-phone-square",
105
105
  description: "Listing all Branches",
106
- links: [{name: "Dashboard", link: dashboard_path, icon: 'fa-dashboard'},
106
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
107
107
  {name: "Manage Branches", link: dhatu.branches_path, icon: 'fa-phone-square', active: true}]
108
108
  }
109
109
  end
@@ -1,7 +1,8 @@
1
1
  module Dhatu
2
2
  class CategoriesController < ResourceController
3
-
3
+
4
4
  before_action :require_update_permission, only: [:update_status, :make_parent, :mark_as_featured, :remove_from_featured]
5
+ before_action :get_features, only: [:index, :new, :edit]
5
6
 
6
7
  def update_status
7
8
  @category = @r_object = Dhatu::Category.find(params[:id])
@@ -38,8 +39,12 @@ module Dhatu
38
39
 
39
40
  private
40
41
 
42
+ def get_features
43
+ @features = Feature.categorisable.published.order("name ASC").all
44
+ end
45
+
41
46
  def permitted_params
42
- params[:category].permit(:name, :permalink, :one_liner, :description, :parent_id, :priority)
47
+ params[:category].permit(:name, :permalink, :one_liner, :description, :parent_id, :priority, :category_type)
43
48
  end
44
49
 
45
50
  def set_navs
@@ -47,9 +52,6 @@ module Dhatu
47
52
  end
48
53
 
49
54
  def get_collections
50
- @category_types = Dhatu::Category.distinct.pluck(:category_type)
51
- @category_types.unshift('All')
52
-
53
55
  @current_category = Dhatu::Category.find_by_id(params[:parent_id])
54
56
 
55
57
  filter_param_mapping
@@ -66,21 +68,21 @@ module Dhatu
66
68
  end
67
69
 
68
70
  @relation = @relation.order("priority ASC, name ASC")
69
-
70
71
  apply_filters
71
-
72
72
  @categories = @r_objects = @relation.page(@current_page).per(@per_page)
73
-
74
73
  return true
75
74
  end
76
75
 
77
76
  def apply_filters
78
-
79
77
  @category_type = params[:category_type] || "All"
80
- if @category_type && @category_type != "All"
78
+ case @category_type
79
+ when "none"
80
+ @relation = @relation.joins("LEFT JOIN features f on f.name = categories.category_type").where("f.name is NULL")
81
+ when "All"
82
+ @relation = @relation.where("")
83
+ else
81
84
  @relation = @relation.where("category_type = ?", params[:category_type])
82
85
  end
83
-
84
86
  @relation = @relation.search(@query) if @query
85
87
  @relation = @relation.status(@status) if @status
86
88
  @relation = @relation.featured(@featured) unless @featured.nil?
@@ -116,7 +118,7 @@ module Dhatu
116
118
  heading: "Manage Categories",
117
119
  icon: "fa-sitemap",
118
120
  description: "Listing all Categories",
119
- links: [{name: "Home", link: dashboard_path, icon: 'fa-home'},
121
+ links: [{name: "Home", link: breadcrumb_home_path, icon: 'fa-home'},
120
122
  {name: "Manage Categories", link: dhatu.categories_path, icon: 'fa-sitemap', active: true}]
121
123
  }
122
124
  end
@@ -4,11 +4,11 @@ module Dhatu
4
4
  private
5
5
 
6
6
  def permitted_params
7
- params.require("dhatu/event").permit(:title, :venue, :description, :date, :starts_at, :ends_at)
7
+ params.require("dhatu/event").permit(:title, :venue, :description, :date, :starts_at, :ends_at, :priority, :category_id)
8
8
  end
9
9
 
10
10
  def get_collections
11
- @relation = Event.includes(:cover_image).where("")
11
+ @relation = Dhatu::Event.includes(:cover_image).where("")
12
12
  params[:st] = "published" if params[:st].nil?
13
13
  parse_filters
14
14
  apply_filters
@@ -19,9 +19,7 @@ module Dhatu
19
19
  def apply_filters
20
20
  @relation = @relation.search(@query) if @query
21
21
  @relation = @relation.status(@status) if @status
22
-
23
- @order_by = "created_at desc" unless @order_by
24
- @relation = @relation.order(@order_by)
22
+ @relation = @relation.order("priority ASC, title ASC")
25
23
  end
26
24
 
27
25
  def configure_filter_settings
@@ -43,9 +41,9 @@ module Dhatu
43
41
  status: {
44
42
  object_filter: false,
45
43
  select_label: "Select Status",
46
- display_hash: Event::STATUS,
44
+ display_hash: Dhatu::Event::STATUS,
47
45
  current_value: @status,
48
- values: Event::STATUS_REVERSE,
46
+ values: Dhatu::Event::STATUS_REVERSE,
49
47
  current_filters: @filters,
50
48
  filters_to_remove: [],
51
49
  filters_to_add: {},
@@ -62,7 +60,7 @@ module Dhatu
62
60
  view_path: "dhatu/events",
63
61
  collection_name: :events,
64
62
  item_name: :event,
65
- class: Event
63
+ class: Dhatu::Event
66
64
  }
67
65
  end
68
66
 
@@ -71,7 +69,7 @@ module Dhatu
71
69
  heading: "Manage Events",
72
70
  icon: "fa-map-marker",
73
71
  description: "Listing all Events",
74
- links: [{name: "Dashboard", link: dashboard_path, icon: 'fa-dashboard'},
72
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
75
73
  {name: "Manage Events", link: dhatu.events_path, icon: 'fa-calendar', active: true}]
76
74
  }
77
75
  end
@@ -4,11 +4,11 @@ module Dhatu
4
4
  private
5
5
 
6
6
  def permitted_params
7
- params.require("dhatu/offer").permit(:title, :offer_text, :description, :starts_at, :ends_at)
7
+ params.require("dhatu/offer").permit(:title, :offer_text, :description, :starts_at, :ends_at, :priority, :category_id)
8
8
  end
9
9
 
10
10
  def get_collections
11
- @relation = Offer.includes(:cover_image).where("")
11
+ @relation = Dhatu::Offer.includes(:cover_image).where("")
12
12
  params[:st] = "published" if params[:st].nil?
13
13
  parse_filters
14
14
  apply_filters
@@ -19,9 +19,7 @@ module Dhatu
19
19
  def apply_filters
20
20
  @relation = @relation.search(@query) if @query
21
21
  @relation = @relation.status(@status) if @status
22
-
23
- @offer_by = "created_at desc" unless @offer_by
24
- @relation = @relation.order(@offer_by)
22
+ @relation = @relation.order("priority ASC, title ASC")
25
23
  end
26
24
 
27
25
  def configure_filter_settings
@@ -43,9 +41,9 @@ module Dhatu
43
41
  status: {
44
42
  object_filter: false,
45
43
  select_label: "Select Status",
46
- display_hash: Offer::STATUS,
44
+ display_hash: Dhatu::Offer::STATUS,
47
45
  current_value: @status,
48
- values: Offer::STATUS_REVERSE,
46
+ values: Dhatu::Offer::STATUS_REVERSE,
49
47
  current_filters: @filters,
50
48
  filters_to_remove: [],
51
49
  filters_to_add: {},
@@ -62,7 +60,7 @@ module Dhatu
62
60
  view_path: "dhatu/offers",
63
61
  collection_name: :offers,
64
62
  item_name: :offer,
65
- class: Offer
63
+ class: Dhatu::Offer
66
64
  }
67
65
  end
68
66
 
@@ -0,0 +1,90 @@
1
+ module Dhatu
2
+ class PricesController < ResourceController
3
+
4
+ private
5
+
6
+ def permitted_params
7
+ params.require("dhatu/price").permit(:title, :sub_title, :price, :category_id, :priority)
8
+ end
9
+
10
+ def get_collections
11
+ category_ids = Dhatu::Price.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
+
15
+ @relation = Dhatu::Price.where("")
16
+ parse_filters
17
+ apply_filters
18
+ @prices = @r_objects = @relation.page(@current_page).per(@per_page)
19
+ return true
20
+ end
21
+
22
+ def apply_filters
23
+ @category = Dhatu::Category.find_by_id(params[:ct]) || Dhatu::Category.new(id: -1, name: "All")
24
+
25
+ if @category && @category.id != -1
26
+ @relation = @relation.where("category_id = ?", @category.id)
27
+ end
28
+
29
+ @relation = @relation.search(@query) if @query
30
+ @relation = @relation.status(@status) if @status
31
+ @relation = @relation.order("priority ASC, title ASC")
32
+ end
33
+
34
+ def configure_filter_settings
35
+ @filter_settings = {
36
+ string_filters: [
37
+ { filter_name: :query },
38
+ { filter_name: :status }
39
+ ],
40
+
41
+ boolean_filters: [],
42
+
43
+ reference_filters: [],
44
+ variable_filters: [],
45
+ }
46
+ end
47
+
48
+ def configure_filter_ui_settings
49
+ @filter_ui_settings = {
50
+ status: {
51
+ object_filter: false,
52
+ select_label: "Select Status",
53
+ display_hash: Dhatu::Price::STATUS,
54
+ current_value: @status,
55
+ values: Dhatu::Price::STATUS_REVERSE,
56
+ current_filters: @filters,
57
+ filters_to_remove: [],
58
+ filters_to_add: {},
59
+ url_method_name: 'prices_url',
60
+ show_all_filter_on_top: true
61
+ }
62
+ }
63
+ end
64
+
65
+ def resource_controller_configuration
66
+ {
67
+ page_title: "Prices",
68
+ js_view_path: "/kuppayam/workflows/parrot",
69
+ view_path: "dhatu/prices",
70
+ collection_name: :prices,
71
+ item_name: :price,
72
+ class: Dhatu::Price
73
+ }
74
+ end
75
+
76
+ def breadcrumbs_configuration
77
+ {
78
+ heading: "Manage Prices",
79
+ icon: "fa-dollar",
80
+ description: "Listing all Prices",
81
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
82
+ {name: "Manage Prices", link: dhatu.prices_path, icon: 'fa-dollar', active: true}]
83
+ }
84
+ end
85
+
86
+ def set_navs
87
+ set_nav("price")
88
+ end
89
+ end
90
+ end
@@ -4,7 +4,7 @@ module Dhatu
4
4
  private
5
5
 
6
6
  def permitted_params
7
- params.require("dhatu/section").permit(:section_type, :title, :sub_title, :short_description, :long_description, :button_one_text, :button_two_text, :button_one_link, :button_two_link)
7
+ params.require("dhatu/section").permit(:section_type, :title, :sub_title, :short_description, :long_description, :button_one_text, :button_two_text, :button_one_link, :button_two_link, :category_id)
8
8
  end
9
9
 
10
10
  def get_collections
@@ -68,11 +68,11 @@ module Dhatu
68
68
 
69
69
  def breadcrumbs_configuration
70
70
  {
71
- heading: "Manage sections",
71
+ heading: "Manage Sections",
72
72
  icon: "fa-reorder",
73
- description: "Listing all sections",
74
- links: [{name: "Dashboard", link: dashboard_path, icon: 'fa-dashboard'},
75
- {name: "Manage sections", link: dhatu.sections_path, icon: 'fa-calendar', active: true}]
73
+ description: "Listing all Sections",
74
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
75
+ {name: "Manage Sections", link: dhatu.sections_path, icon: 'fa-calendar', active: true}]
76
76
  }
77
77
  end
78
78
 
@@ -30,9 +30,7 @@ module Dhatu
30
30
 
31
31
  @relation = @relation.search(@query) if @query
32
32
  @relation = @relation.status(@status) if @status
33
-
34
- @order_by = "created_at desc" unless @order_by
35
- @relation = @relation.order(@order_by)
33
+ @relation = @relation.order("priority ASC, name ASC")
36
34
  end
37
35
 
38
36
  def configure_filter_settings
@@ -79,11 +77,11 @@ module Dhatu
79
77
 
80
78
  def breadcrumbs_configuration
81
79
  {
82
- heading: "Manage services",
83
- icon: "fa-reorder",
84
- description: "Listing all services",
85
- links: [{name: "Dashboard", link: dashboard_path, icon: 'fa-dashboard'},
86
- {name: "Manage services", link: dhatu.services_path, icon: 'fa-calendar', active: true}]
80
+ heading: "Manage Services",
81
+ icon: "fa-glass",
82
+ description: "Listing all Services",
83
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
84
+ {name: "Manage Services", link: dhatu.services_path, icon: 'fa-glass', active: true}]
87
85
  }
88
86
  end
89
87