dhatu 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +114 -0
  4. data/Rakefile +36 -0
  5. data/app/assets/config/dhatu_manifest.js +2 -0
  6. data/app/assets/javascripts/dhatu/application.js +13 -0
  7. data/app/assets/stylesheets/dhatu/application.css +15 -0
  8. data/app/controllers/dhatu/application_controller.rb +25 -0
  9. data/app/controllers/dhatu/blog_posts_controller.rb +84 -0
  10. data/app/controllers/dhatu/contact_informations_controller.rb +84 -0
  11. data/app/controllers/dhatu/dashboard_controller.rb +24 -0
  12. data/app/controllers/dhatu/events_controller.rb +84 -0
  13. data/app/controllers/dhatu/offers_controller.rb +84 -0
  14. data/app/controllers/dhatu/resource_controller.rb +13 -0
  15. data/app/controllers/dhatu/sections_controller.rb +83 -0
  16. data/app/controllers/dhatu/team_members_controller.rb +84 -0
  17. data/app/controllers/dhatu/testimonials_controller.rb +84 -0
  18. data/app/helpers/dhatu/application_helper.rb +4 -0
  19. data/app/jobs/dhatu/application_job.rb +4 -0
  20. data/app/mailers/dhatu/application_mailer.rb +6 -0
  21. data/app/models/dhatu/application_record.rb +8 -0
  22. data/app/models/dhatu/blog_post.rb +62 -0
  23. data/app/models/dhatu/contact_information.rb +88 -0
  24. data/app/models/dhatu/event.rb +56 -0
  25. data/app/models/dhatu/offer.rb +55 -0
  26. data/app/models/dhatu/section.rb +82 -0
  27. data/app/models/dhatu/team_member.rb +59 -0
  28. data/app/models/dhatu/testimonial.rb +57 -0
  29. data/app/views/dhatu/blog_posts/_form.html.erb +42 -0
  30. data/app/views/dhatu/blog_posts/_index.html.erb +58 -0
  31. data/app/views/dhatu/blog_posts/_row.html.erb +28 -0
  32. data/app/views/dhatu/blog_posts/_show.html.erb +120 -0
  33. data/app/views/dhatu/blog_posts/index.html.erb +56 -0
  34. data/app/views/dhatu/contact_informations/_form.html.erb +104 -0
  35. data/app/views/dhatu/contact_informations/_index.html.erb +51 -0
  36. data/app/views/dhatu/contact_informations/_row.html.erb +26 -0
  37. data/app/views/dhatu/contact_informations/_show.html.erb +150 -0
  38. data/app/views/dhatu/contact_informations/index.html.erb +46 -0
  39. data/app/views/dhatu/dashboard/_index.html.erb +58 -0
  40. data/app/views/dhatu/dashboard/index.html.erb +18 -0
  41. data/app/views/dhatu/events/_form.html.erb +40 -0
  42. data/app/views/dhatu/events/_index.html.erb +58 -0
  43. data/app/views/dhatu/events/_row.html.erb +28 -0
  44. data/app/views/dhatu/events/_show.html.erb +120 -0
  45. data/app/views/dhatu/events/index.html.erb +45 -0
  46. data/app/views/dhatu/offers/_form.html.erb +39 -0
  47. data/app/views/dhatu/offers/_index.html.erb +57 -0
  48. data/app/views/dhatu/offers/_row.html.erb +28 -0
  49. data/app/views/dhatu/offers/_show.html.erb +118 -0
  50. data/app/views/dhatu/offers/index.html.erb +46 -0
  51. data/app/views/dhatu/sections/_form.html.erb +60 -0
  52. data/app/views/dhatu/sections/_index.html.erb +53 -0
  53. data/app/views/dhatu/sections/_row.html.erb +25 -0
  54. data/app/views/dhatu/sections/_show.html.erb +152 -0
  55. data/app/views/dhatu/sections/index.html.erb +53 -0
  56. data/app/views/dhatu/team_members/_form.html.erb +56 -0
  57. data/app/views/dhatu/team_members/_index.html.erb +62 -0
  58. data/app/views/dhatu/team_members/_row.html.erb +35 -0
  59. data/app/views/dhatu/team_members/_show.html.erb +93 -0
  60. data/app/views/dhatu/team_members/index.html.erb +46 -0
  61. data/app/views/dhatu/testimonials/_form.html.erb +36 -0
  62. data/app/views/dhatu/testimonials/_index.html.erb +64 -0
  63. data/app/views/dhatu/testimonials/_row.html.erb +36 -0
  64. data/app/views/dhatu/testimonials/_show.html.erb +133 -0
  65. data/app/views/dhatu/testimonials/index.html.erb +46 -0
  66. data/app/views/layouts/dhatu/application.html.erb +14 -0
  67. data/app/views/layouts/kuppayam/_footer.html.erb +25 -0
  68. data/app/views/layouts/kuppayam/_header.html.erb +43 -0
  69. data/app/views/layouts/kuppayam/_navbar.html.erb +55 -0
  70. data/app/views/layouts/kuppayam/_sidebar.html.erb +219 -0
  71. data/app/views/pattana/dashboard/_index.html.erb +35 -0
  72. data/config/routes.rb +63 -0
  73. data/db/master_data/features.csv +16 -0
  74. data/lib/dhatu.rb +5 -0
  75. data/lib/dhatu/engine.rb +31 -0
  76. data/lib/dhatu/factories.rb +7 -0
  77. data/lib/dhatu/version.rb +3 -0
  78. data/lib/tasks/dhatu/data.rake +91 -0
  79. data/lib/tasks/dhatu/master_data.rake +48 -0
  80. data/spec/dummy/spec/factories/blog_post.rb +48 -0
  81. data/spec/dummy/spec/factories/blog_post_cover_image.rb +13 -0
  82. data/spec/dummy/spec/factories/blog_post_gallery_image.rb +13 -0
  83. data/spec/dummy/spec/factories/contact_information.rb +63 -0
  84. data/spec/dummy/spec/factories/event.rb +46 -0
  85. data/spec/dummy/spec/factories/event_cover_image.rb +13 -0
  86. data/spec/dummy/spec/factories/event_gallery_image.rb +13 -0
  87. data/spec/dummy/spec/factories/offer.rb +43 -0
  88. data/spec/dummy/spec/factories/offer_cover_image.rb +13 -0
  89. data/spec/dummy/spec/factories/offer_gallery_image.rb +13 -0
  90. data/spec/dummy/spec/factories/section.rb +50 -0
  91. data/spec/dummy/spec/factories/section_cover_image.rb +13 -0
  92. data/spec/dummy/spec/factories/section_gallery_image.rb +13 -0
  93. data/spec/dummy/spec/factories/team_member.rb +47 -0
  94. data/spec/dummy/spec/factories/test.jpg +0 -0
  95. data/spec/dummy/spec/factories/testimonial.rb +44 -0
  96. metadata +520 -0
@@ -0,0 +1,84 @@
1
+ module Dhatu
2
+ class OffersController < ResourceController
3
+
4
+ private
5
+
6
+ def permitted_params
7
+ params.require("dhatu/offer").permit(:title, :offer_text, :description, :starts_at, :ends_at)
8
+ end
9
+
10
+ def get_collections
11
+ @relation = Offer.includes(:cover_image).where("")
12
+ params[:st] = "published" if params[:st].nil?
13
+ parse_filters
14
+ apply_filters
15
+ @offers = @r_objects = @relation.page(@current_page).per(@per_page)
16
+ return true
17
+ end
18
+
19
+ def apply_filters
20
+ @relation = @relation.search(@query) if @query
21
+ @relation = @relation.status(@status) if @status
22
+
23
+ @offer_by = "created_at desc" unless @offer_by
24
+ @relation = @relation.order(@offer_by)
25
+ end
26
+
27
+ def configure_filter_settings
28
+ @filter_settings = {
29
+ string_filters: [
30
+ { filter_name: :query },
31
+ { filter_name: :status }
32
+ ],
33
+
34
+ boolean_filters: [],
35
+
36
+ reference_filters: [],
37
+ variable_filters: [],
38
+ }
39
+ end
40
+
41
+ def configure_filter_ui_settings
42
+ @filter_ui_settings = {
43
+ status: {
44
+ object_filter: false,
45
+ select_label: "Select Status",
46
+ display_hash: Offer::STATUS,
47
+ current_value: @status,
48
+ values: Offer::STATUS_REVERSE,
49
+ current_filters: @filters,
50
+ filters_to_remove: [],
51
+ filters_to_add: {},
52
+ url_method_name: 'offers_url',
53
+ show_all_filter_on_top: true
54
+ }
55
+ }
56
+ end
57
+
58
+ def resource_controller_configuration
59
+ {
60
+ page_title: "Offers",
61
+ js_view_path: "/kuppayam/workflows/peacock",
62
+ view_path: "dhatu/offers",
63
+ collection_name: :offers,
64
+ item_name: :offer,
65
+ class: Offer
66
+ }
67
+ end
68
+
69
+ def breadcrumbs_configuration
70
+ {
71
+ heading: "Manage Offers",
72
+ icon: "fa-gift",
73
+ description: "Listing all Offers",
74
+ links: [{name: "Dashboard", link: breadcrumb_home_path, icon: 'fa-dashboard'},
75
+ {name: "Manage Offers", link: dhatu.offers_path, icon: 'fa-gift', active: true}]
76
+ }
77
+ end
78
+
79
+ def set_navs
80
+ set_nav("dhatu/offers")
81
+ end
82
+
83
+ end
84
+ end
@@ -0,0 +1,13 @@
1
+ module Dhatu
2
+ class ResourceController < ApplicationController
3
+
4
+ include ResourceHelper
5
+
6
+ before_action :configure_resource_controller
7
+ before_action :require_read_permission, only: [:index, :show]
8
+ before_action :require_create_permission, only: [:create]
9
+ before_action :require_update_permission, only: [:update, :update_status, :mark_as_featured, :remove_from_featured]
10
+ before_action :require_delete_permission, only: [:destroy]
11
+
12
+ end
13
+ end
@@ -0,0 +1,83 @@
1
+ module Dhatu
2
+ class SectionsController < ResourceController
3
+
4
+ private
5
+
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)
8
+ end
9
+
10
+ def get_collections
11
+ @relation = Dhatu::Section.includes(:cover_image).where("")
12
+ params[:st] = "published" if params[:st].nil?
13
+ parse_filters
14
+ apply_filters
15
+ @sections = @r_objects = @relation.page(@current_page).per(@per_page)
16
+ return true
17
+ end
18
+
19
+ def apply_filters
20
+ @relation = @relation.search(@query) if @query
21
+ @relation = @relation.status(@status) if @status
22
+
23
+ @order_by = "created_at desc" unless @order_by
24
+ @relation = @relation.order(@order_by)
25
+ end
26
+
27
+ def configure_filter_settings
28
+ @filter_settings = {
29
+ string_filters: [
30
+ { filter_name: :query },
31
+ { filter_name: :status }
32
+ ],
33
+
34
+ boolean_filters: [],
35
+
36
+ reference_filters: [],
37
+ variable_filters: [],
38
+ }
39
+ end
40
+
41
+ def configure_filter_ui_settings
42
+ @filter_ui_settings = {
43
+ status: {
44
+ object_filter: false,
45
+ select_label: "Select Status",
46
+ display_hash: Dhatu::Section::STATUS,
47
+ current_value: @status,
48
+ values: Dhatu::Section::STATUS_REVERSE,
49
+ current_filters: @filters,
50
+ filters_to_remove: [],
51
+ filters_to_add: {},
52
+ url_method_name: 'sections_url',
53
+ show_all_filter_on_top: true
54
+ }
55
+ }
56
+ end
57
+
58
+ def resource_controller_configuration
59
+ {
60
+ page_title: "Sections",
61
+ js_view_path: "/kuppayam/workflows/peacock",
62
+ view_path: "dhatu/sections",
63
+ collection_name: :sections,
64
+ item_name: :section,
65
+ class: Dhatu::Section
66
+ }
67
+ end
68
+
69
+ def breadcrumbs_configuration
70
+ {
71
+ heading: "Manage sections",
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}]
76
+ }
77
+ end
78
+
79
+ def set_navs
80
+ set_nav("section")
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,84 @@
1
+ module Dhatu
2
+ class TeamMembersController < ResourceController
3
+
4
+ private
5
+
6
+ def permitted_params
7
+ params.require("dhatu/team_member").permit(:name, :designation, :status, :featured, :description, :linked_in_url, :google_plus_url, :facebook_url, :twitter_url)
8
+ end
9
+
10
+ def get_collections
11
+ @relation = Dhatu::TeamMember.includes(:profile_image).where("")
12
+ params[:st] = "published" if params[:st].nil?
13
+ parse_filters
14
+ apply_filters
15
+ @team_members = @r_objects = @relation.page(@current_page).per(@per_page)
16
+ return true
17
+ end
18
+
19
+ def apply_filters
20
+ @relation = @relation.search(@query) if @query
21
+ @relation = @relation.status(@status) if @status
22
+
23
+ @order_by = "created_at desc" unless @order_by
24
+ @relation = @relation.order(@order_by)
25
+ end
26
+
27
+ def configure_filter_settings
28
+ @filter_settings = {
29
+ string_filters: [
30
+ { filter_name: :query },
31
+ { filter_name: :status }
32
+ ],
33
+
34
+ boolean_filters: [],
35
+
36
+ reference_filters: [],
37
+ variable_filters: [],
38
+ }
39
+ end
40
+
41
+ def configure_filter_ui_settings
42
+ @filter_ui_settings = {
43
+ status: {
44
+ object_filter: false,
45
+ select_label: "Select Status",
46
+ display_hash: Dhatu::TeamMember::STATUS,
47
+ current_value: @status,
48
+ values: Dhatu::TeamMember::STATUS_REVERSE,
49
+ current_filters: @filters,
50
+ filters_to_remove: [],
51
+ filters_to_add: {},
52
+ url_method_name: 'team_members_url',
53
+ show_all_filter_on_top: true
54
+ }
55
+ }
56
+ end
57
+
58
+ def resource_controller_configuration
59
+ {
60
+ page_title: "Team",
61
+ js_view_path: "/kuppayam/workflows/peacock",
62
+ view_path: "dhatu/team_members",
63
+ collection_name: :team_members,
64
+ item_name: :team_member,
65
+ class: Dhatu::TeamMember
66
+ }
67
+ end
68
+
69
+ def breadcrumbs_configuration
70
+ {
71
+ heading: "Manage Team",
72
+ icon: "fa-group",
73
+ description: "Listing all team_members",
74
+ links: [{name: "Dashboard", link: dashboard_path, icon: 'fa-dashboard'},
75
+ {name: "Manage team_members", link: dhatu.team_members_path, icon: 'fa-group', active: true}]
76
+ }
77
+ end
78
+
79
+ def set_navs
80
+ set_nav("dhatu/team")
81
+ end
82
+
83
+ end
84
+ end
@@ -0,0 +1,84 @@
1
+ module Dhatu
2
+ class TestimonialsController < ResourceController
3
+
4
+ private
5
+
6
+ def permitted_params
7
+ params.require("dhatu/testimonial").permit(:name, :designation, :organisation, :status, :featured, :statement)
8
+ end
9
+
10
+ def get_collections
11
+ @relation = Testimonial.includes(:profile_image, :logo_image).where("")
12
+ params[:st] = "published" if params[:st].nil?
13
+ parse_filters
14
+ apply_filters
15
+ @testimonials = @r_objects = @relation.page(@current_page).per(@per_page)
16
+ return true
17
+ end
18
+
19
+ def apply_filters
20
+ @relation = @relation.search(@query) if @query
21
+ @relation = @relation.status(@status) if @status
22
+
23
+ @order_by = "created_at desc" unless @order_by
24
+ @relation = @relation.order(@order_by)
25
+ end
26
+
27
+ def configure_filter_settings
28
+ @filter_settings = {
29
+ string_filters: [
30
+ { filter_name: :query },
31
+ { filter_name: :status }
32
+ ],
33
+
34
+ boolean_filters: [],
35
+
36
+ reference_filters: [],
37
+ variable_filters: [],
38
+ }
39
+ end
40
+
41
+ def configure_filter_ui_settings
42
+ @filter_ui_settings = {
43
+ status: {
44
+ object_filter: false,
45
+ select_label: "Select Status",
46
+ display_hash: Testimonial::STATUS,
47
+ current_value: @status,
48
+ values: Testimonial::STATUS_REVERSE,
49
+ current_filters: @filters,
50
+ filters_to_remove: [],
51
+ filters_to_add: {},
52
+ url_method_name: 'testimonials_url',
53
+ show_all_filter_on_top: true
54
+ }
55
+ }
56
+ end
57
+
58
+ def resource_controller_configuration
59
+ {
60
+ page_title: "Testimonials",
61
+ js_view_path: "/kuppayam/workflows/peacock",
62
+ view_path: "dhatu/testimonials",
63
+ collection_name: :testimonials,
64
+ item_name: :testimonial,
65
+ class: Testimonial
66
+ }
67
+ end
68
+
69
+ def breadcrumbs_configuration
70
+ {
71
+ heading: "Manage testimonials",
72
+ icon: "fa-comment",
73
+ description: "Listing all testimonials",
74
+ links: [{name: "Dashboard", link: dashboard_path, icon: 'fa-dashboard'},
75
+ {name: "Manage testimonials", link: dhatu.testimonials_path, icon: 'fa-comment', active: true}]
76
+ }
77
+ end
78
+
79
+ def set_navs
80
+ set_nav("dhatu/testimonials")
81
+ end
82
+
83
+ end
84
+ end
@@ -0,0 +1,4 @@
1
+ module Dhatu
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Dhatu
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Dhatu
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: 'from@example.com'
4
+ layout 'mailer'
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ module Dhatu
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+
5
+ extend Kuppayam::Importer
6
+ extend Kuppayam::Validators
7
+ end
8
+ end
@@ -0,0 +1,62 @@
1
+ class Dhatu::BlogPost < Dhatu::ApplicationRecord
2
+
3
+ # Set Table Name
4
+ self.table_name = "blog_posts"
5
+
6
+ # Including the State Machine Methods
7
+ include Publishable
8
+ include Featureable
9
+
10
+ # Validations
11
+ validates :title, presence: true, length: {minimum: 5, maximum: 256}, allow_blank: false
12
+ validates :slug, uniqueness: true, presence: true, length: {minimum: 5, maximum: 64}, allow_blank: false
13
+ validates :author, length: {minimum: 3, maximum: 250}, allow_blank: true
14
+ validates :description, presence: true
15
+ validates :posted_at, presence: true
16
+ validates :meta_description, presence: true, length: {minimum: 10, maximum: 500}, allow_blank: false
17
+
18
+ # Associations
19
+ has_one :cover_image, :as => :imageable, :dependent => :destroy, :class_name => "Image::CoverImage"
20
+ has_many :gallery_images, :as => :imageable, :dependent => :destroy, :class_name => "Image::GalleryImage"
21
+
22
+ # Serializers
23
+ serialize :tags, Hash
24
+
25
+ # ------------------
26
+ # Class Methods
27
+ # ------------------
28
+
29
+ scope :search, lambda { |query| where("LOWER(title) LIKE LOWER('%#{query}%') OR\
30
+ LOWER(author) LIKE LOWER('%#{query}%') OR\
31
+ LOWER(description) LIKE LOWER('%#{query}%')") }
32
+
33
+ scope :upcoming, lambda { where("starts_at >= ?", Time.now) }
34
+ scope :past, lambda { where("starts_at < ?", Time.now) }
35
+
36
+ # ------------------
37
+ # Instance Methods
38
+ # ------------------
39
+
40
+ # Generic Methods
41
+ # ---------------
42
+
43
+ def to_param
44
+ "#{id}-#{slug}"
45
+ end
46
+
47
+ def display_name
48
+ "#{title_was}"
49
+ end
50
+
51
+ # Permission Methods
52
+ # ------------------
53
+
54
+ def can_be_edited?
55
+ status?(:published) or status?(:unpublished)
56
+ end
57
+
58
+ def can_be_deleted?
59
+ status?(:removed)
60
+ end
61
+
62
+ end