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,91 @@
1
+ require 'csv'
2
+ require 'open-uri'
3
+ require 'time'
4
+
5
+ namespace 'dhatu' do
6
+ namespace 'import' do
7
+ namespace 'data' do
8
+
9
+ desc "Import all data in sequence"
10
+ task 'all' => :environment do
11
+
12
+ import_list = ["features"]
13
+
14
+ import_list.each do |item|
15
+ print "Importing #{item.titleize} \t".yellow
16
+ begin
17
+ Rake::Task["dhatu:import:data:#{item}"].invoke
18
+ rescue ArgumentError => e
19
+ puts "Loading #{item} - Failed - #{e.message}".red
20
+ rescue Exception => e
21
+ puts "Importing #{item.titleize} - Failed - #{e.message}".red
22
+ puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
23
+ end
24
+ end
25
+ puts " "
26
+ end
27
+
28
+ ["Feature"].each do |cls_name|
29
+ name = cls_name.underscore.pluralize
30
+ desc "Import #{cls_name.pluralize}"
31
+ task name => :environment do
32
+ verbose = true
33
+ verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
34
+
35
+ destroy_all = false
36
+ destroy_all = true if ["true", "t","1","yes","y"].include?(ENV["destroy_all"].to_s.downcase.strip)
37
+
38
+ path = Rails.root.join('db', 'data', "#{cls_name.constantize.table_name}.csv")
39
+ path = Dhatu::Engine.root.join('db', 'data', "#{cls_name.constantize.table_name}.csv") unless File.exists?(path)
40
+
41
+ cls_name.constantize.destroy_all if destroy_all
42
+ cls_name.constantize.import_data_file(path, true, verbose)
43
+ puts "Importing Completed".green if verbose
44
+ end
45
+ end
46
+
47
+ namespace 'dummy' do
48
+
49
+ desc "Import all dummy data in sequence"
50
+ task 'all' => :environment do
51
+
52
+ import_list = ["features"]
53
+
54
+ import_list.each do |item|
55
+ print "Loading #{item.split(':').last.titleize} \t".yellow
56
+ begin
57
+ Rake::Task["dhatu:import:data:dummy:#{item}"].invoke
58
+ rescue ArgumentError => e
59
+ puts "Loading #{item} - Failed - #{e.message}".red
60
+ rescue Exception => e
61
+ puts "Loading #{item} - Failed - #{e.message}".red
62
+ puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
63
+ end
64
+ end
65
+ puts " "
66
+ end
67
+
68
+ ["Feature"].each do |cls_name|
69
+ name = cls_name.underscore.pluralize
70
+ desc "Load Dummy #{cls_name.pluralize}"
71
+ task name => :environment do
72
+ verbose = true
73
+ verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
74
+
75
+ destroy_all = false
76
+ destroy_all = true if ["true", "t","1","yes","y"].include?(ENV["destroy_all"].to_s.downcase.strip)
77
+
78
+ path = Rails.root.join('db', 'data', 'dummy', "#{cls_name.constantize.table_name}.csv")
79
+ path = Dhatu::Engine.root.join('db', 'data', 'dummy', "#{cls_name.constantize.table_name}.csv") unless File.exists?(path)
80
+
81
+ cls_name.constantize.destroy_all if destroy_all
82
+ cls_name.constantize.import_data_file(path, true, verbose)
83
+ puts "Importing Completed".green if verbose
84
+ end
85
+ end
86
+ end
87
+
88
+ end
89
+ end
90
+ end
91
+
@@ -0,0 +1,48 @@
1
+ require 'csv'
2
+ require 'open-uri'
3
+ require 'time'
4
+
5
+ namespace 'dhatu' do
6
+ namespace 'import' do
7
+ namespace 'master_data' do
8
+
9
+ desc "Import all data in sequence"
10
+ task 'all' => :environment do
11
+
12
+ import_list = ["features"]
13
+
14
+ import_list.each do |item|
15
+ print "Importing #{item.titleize} \t".yellow
16
+ begin
17
+ Rake::Task["dhatu:import:master_data:#{item}"].invoke
18
+ rescue ArgumentError => e
19
+ puts "Loading #{item} - Failed - #{e.message}".red
20
+ rescue Exception => e
21
+ puts "Importing #{item.titleize} - Failed - #{e.message}".red
22
+ puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
23
+ end
24
+ end
25
+ puts " "
26
+ end
27
+
28
+ ["Feature"].each do |cls_name|
29
+ name = cls_name.underscore.pluralize
30
+ desc "Import #{cls_name.pluralize}"
31
+ task name => :environment do
32
+ verbose = true
33
+ verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
34
+
35
+ destroy_all = false
36
+ destroy_all = true if ["true", "t","1","yes","y"].include?(ENV["destroy_all"].to_s.downcase.strip)
37
+
38
+ path = Dhatu::Engine.root.join('db', 'master_data', "#{cls_name.constantize.table_name}.csv")
39
+ cls_name.constantize.destroy_all if destroy_all
40
+ cls_name.constantize.import_data_file(path, true, verbose)
41
+ # puts "Importing Completed".green if verbose
42
+ end
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+
@@ -0,0 +1,48 @@
1
+ FactoryGirl.define do
2
+
3
+ sequence(:slug) {|n| "#{n}-a-sample-blog-post-title" }
4
+
5
+ factory :unpublished_blog_post, class: Dhatu::BlogPost do
6
+
7
+ title "A Sample Blog Post Title"
8
+ author "Some Author Name"
9
+ slug
10
+ meta_description "Blog post meta description which explain the essence of the post."
11
+ description "Some Blog Post Description which is not less than 10 characters."
12
+
13
+ posted_at { Time.now - 4.hours }
14
+ tags {{key1: "val1", key2: "val2"}}
15
+
16
+ end
17
+
18
+ factory :published_blog_post, parent: :unpublished_blog_post do
19
+ after :build do |e|
20
+ e.publish
21
+ end
22
+ end
23
+
24
+ factory :removed_blog_post, parent: :unpublished_blog_post do
25
+ after :build do |e|
26
+ e.remove
27
+ end
28
+ end
29
+
30
+ factory :archived_blog_post, parent: :unpublished_blog_post do
31
+ after :build do |e|
32
+ e.archive
33
+ end
34
+ end
35
+
36
+ factory :featured_blog_post, parent: :published_blog_post do
37
+ after :build do |e|
38
+ e.mark_as_featured
39
+ end
40
+ end
41
+
42
+ factory :non_featured_blog_post, parent: :published_blog_post do
43
+ after :build do |e|
44
+ e.remove_from_featured
45
+ end
46
+ end
47
+
48
+ end
@@ -0,0 +1,13 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :blog_post_cover_image, class: Image::CoverImage do
4
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
5
+ association :imageable, factory: :published_blog_post
6
+ end
7
+
8
+ factory :oversized_blog_post_cover_image, class: Image::CoverImage do
9
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
10
+ association :imageable, factory: :published_blog_post
11
+ end
12
+
13
+ end
@@ -0,0 +1,13 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :blog_post_gallery_image, class: Image::GalleryImage do
4
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
5
+ association :imageable, factory: :published_blog_post
6
+ end
7
+
8
+ factory :oversized_blog_post_gallery_image, class: Image::GalleryImage do
9
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
10
+ association :imageable, factory: :published_blog_post
11
+ end
12
+
13
+ end
@@ -0,0 +1,63 @@
1
+ require 'usman/factories.rb'
2
+
3
+ FactoryGirl.define do
4
+
5
+ factory :unpublished_contact_information, class: Dhatu::ContactInformation do
6
+
7
+ title "Some Title"
8
+
9
+ address_1 "Address 1"
10
+ address_2 "Address 2"
11
+ address_3 "Address 3"
12
+
13
+ email
14
+ landline "0495123456"
15
+ fax "0495987654"
16
+ mobile "9880123456"
17
+
18
+ facebook "http://www.facebook.com/account_name"
19
+ twitter "http://www.twitter.com/account_name"
20
+ google_plus "http://www.google.com/account_name"
21
+ linked_in "http://www.linked.com/account_name"
22
+ youtube "http://www.youtube.com/account_name"
23
+ instagram "http://www.instagram.com/account_name"
24
+ tumblr "http://www.tumblr.com/account_name"
25
+ pinterest "http://www.pinterest.com/account_name"
26
+ blog "http://www.blogger.com/account_name"
27
+
28
+ status "unpublished"
29
+
30
+ end
31
+
32
+ factory :published_contact_information, parent: :unpublished_contact_information do
33
+ after :build do |e|
34
+ e.publish
35
+ end
36
+ end
37
+
38
+ factory :removed_contact_information, parent: :unpublished_contact_information do
39
+ after :build do |e|
40
+ e.remove
41
+ end
42
+ end
43
+
44
+ factory :archived_contact_information, parent: :unpublished_contact_information do
45
+ after :build do |e|
46
+ e.archive
47
+ end
48
+ end
49
+
50
+ factory :featured_contact_information, parent: :published_contact_information do
51
+ after :build do |e|
52
+ e.mark_as_featured
53
+ end
54
+ end
55
+
56
+ factory :non_featured_contact_info, parent: :published_contact_info do
57
+ after :build do |e|
58
+ e.remove_from_featured
59
+ end
60
+ end
61
+
62
+
63
+ end
@@ -0,0 +1,46 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :unpublished_event, class: Dhatu::Event do
4
+
5
+ title "Event Title"
6
+ venue "Venue"
7
+ description "Some Event Description"
8
+
9
+ date { Date.today }
10
+
11
+ starts_at { Time.now - 4.hours }
12
+ ends_at { Time.now - 1.hours }
13
+
14
+ end
15
+
16
+ factory :published_event, parent: :unpublished_event do
17
+ after :build do |e|
18
+ e.publish
19
+ end
20
+ end
21
+
22
+ factory :removed_event, parent: :unpublished_event do
23
+ after :build do |e|
24
+ e.remove
25
+ end
26
+ end
27
+
28
+ factory :archived_event, parent: :unpublished_event do
29
+ after :build do |e|
30
+ e.archive
31
+ end
32
+ end
33
+
34
+ factory :featured_event, parent: :published_event do
35
+ after :build do |e|
36
+ e.mark_as_featured
37
+ end
38
+ end
39
+
40
+ factory :non_featured_event, parent: :published_event do
41
+ after :build do |e|
42
+ e.remove_from_featured
43
+ end
44
+ end
45
+
46
+ end
@@ -0,0 +1,13 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :event_cover_image, class: Image::CoverImage do
4
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
5
+ association :imageable, factory: :published_event
6
+ end
7
+
8
+ factory :oversized_event_cover_image, class: Image::CoverImage do
9
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
10
+ association :imageable, factory: :published_event
11
+ end
12
+
13
+ end
@@ -0,0 +1,13 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :event_gallery_image, class: Image::GalleryImage do
4
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
5
+ association :imageable, factory: :published_event
6
+ end
7
+
8
+ factory :oversized_event_gallery_image, class: Image::GalleryImage do
9
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
10
+ association :imageable, factory: :published_event
11
+ end
12
+
13
+ end
@@ -0,0 +1,43 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :unpublished_offer, class: Dhatu::Offer do
4
+ title "Offer Title"
5
+ offer_text "AED 1000 only"
6
+ description "Some Offer Description"
7
+
8
+ starts_at { Time.now - 4.hours }
9
+ ends_at { Time.now - 1.hours }
10
+ end
11
+
12
+ factory :published_offer, parent: :unpublished_offer do
13
+ after :build do |e|
14
+ e.publish
15
+ end
16
+ end
17
+
18
+ factory :removed_offer, parent: :unpublished_offer do
19
+ after :build do |e|
20
+ e.remove
21
+ end
22
+ end
23
+
24
+ factory :archived_offer, parent: :unpublished_offer do
25
+ after :build do |e|
26
+ e.archive
27
+ end
28
+ end
29
+
30
+ factory :featured_offer, parent: :published_offer do
31
+ after :build do |e|
32
+ e.mark_as_featured
33
+ end
34
+ end
35
+
36
+ factory :non_featured_offer, parent: :published_offer do
37
+ after :build do |e|
38
+ e.remove_from_featured
39
+ end
40
+ end
41
+
42
+
43
+ end
@@ -0,0 +1,13 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :offer_cover_image, class: Image::CoverImage do
4
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
5
+ association :imageable, factory: :published_offer
6
+ end
7
+
8
+ factory :oversized_offer_cover_image, class: Image::CoverImage do
9
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
10
+ association :imageable, factory: :published_offer
11
+ end
12
+
13
+ end
@@ -0,0 +1,13 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :offer_gallery_image, class: Image::GalleryImage do
4
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
5
+ association :imageable, factory: :published_offer
6
+ end
7
+
8
+ factory :oversized_offer_gallery_image, class: Image::GalleryImage do
9
+ image { Rack::Test::UploadedFile.new('spec/dummy/spec/factories/test.jpg', 'image.png') }
10
+ association :imageable, factory: :published_offer
11
+ end
12
+
13
+ end
@@ -0,0 +1,50 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :unpublished_section, class: Dhatu::Section do
4
+
5
+ title "Section Title"
6
+ sub_title "Section Sub Title"
7
+
8
+ short_description "Short Description (cannot be too short). Minimum is 10 characters"
9
+ long_description "Long Description No Size Limit. Actually set via a rich text editor"
10
+
11
+ button_one_text "Button One"
12
+ button_two_text "Button Two"
13
+
14
+ button_one_link "www.domain.com/link_one"
15
+ button_two_link "www.domain.com/link_two"
16
+
17
+ end
18
+
19
+ factory :published_section, parent: :unpublished_section do
20
+ after :build do |e|
21
+ e.publish
22
+ end
23
+ end
24
+
25
+ factory :removed_section, parent: :unpublished_section do
26
+ after :build do |e|
27
+ e.remove
28
+ end
29
+ end
30
+
31
+ factory :archived_section, parent: :unpublished_section do
32
+ after :build do |e|
33
+ e.archive
34
+ end
35
+ end
36
+
37
+ factory :featured_section, parent: :published_section do
38
+ after :build do |e|
39
+ e.mark_as_featured
40
+ end
41
+ end
42
+
43
+ factory :non_featured_section, parent: :published_section do
44
+ after :build do |e|
45
+ e.remove_from_featured
46
+ end
47
+ end
48
+
49
+
50
+ end