dhatu 0.1.25 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/dhatu/page.rb +32 -0
  3. data/app/models/dhatu/section.rb +9 -3
  4. data/app/models/dhatu/testimonial.rb +1 -1
  5. data/db/data/dummy/pages.csv +10 -0
  6. data/db/data/dummy/sections.csv +15 -15
  7. data/db/data/pages.csv +10 -0
  8. data/db/data/permissions.csv +0 -3
  9. data/db/master_data/features.csv +0 -1
  10. data/db/migrate/20160803045832_create_events.rb +3 -0
  11. data/db/migrate/20160803045832_create_offers.rb +3 -0
  12. data/db/migrate/{20180101093435_create_pages.rb → 20171010055101_create_pages.rb} +4 -0
  13. data/db/migrate/20171010055102_create_sections.rb +20 -1
  14. data/db/migrate/20171012073510_create_testimonials.rb +5 -1
  15. data/db/migrate/20171012103805_create_team_members.rb +6 -2
  16. data/db/migrate/20171012103806_create_blog_posts.rb +5 -2
  17. data/db/migrate/20171014125055_create_services.rb +2 -0
  18. data/db/migrate/20171104163660_create_prices.rb +2 -0
  19. data/db/migrate/20171104163661_create_bookings.rb +1 -0
  20. data/db/migrate/20171120145548_create_promotion_and_promotion_enquiries.rb +5 -1
  21. data/db/migrate/20180101093434_create_projects.rb +2 -1
  22. data/lib/dhatu/version.rb +3 -1
  23. data/lib/tasks/dhatu/data.rake +3 -3
  24. data/spec/dummy/spec/factories/section.rb +1 -1
  25. metadata +5 -26
  26. data/app/controllers/dhatu/section_types_controller.rb +0 -77
  27. data/app/models/dhatu/section_type.rb +0 -74
  28. data/app/views/dhatu/section_types1/_form.html.erb +0 -20
  29. data/app/views/dhatu/section_types1/_index.html.erb +0 -48
  30. data/app/views/dhatu/section_types1/_row.html.erb +0 -20
  31. data/app/views/dhatu/section_types1/_show.html.erb +0 -41
  32. data/app/views/dhatu/section_types1/index.html.erb +0 -43
  33. data/db/data/dummy/section_types.csv +0 -15
  34. data/db/migrate/20171104163658_add_category_id_to_blog_posts.rb +0 -5
  35. data/db/migrate/20171104163659_add_priority_to_tables.rb +0 -8
  36. data/db/migrate/20171104163662_add_category_id_to_tables.rb +0 -7
  37. data/db/migrate/20171120145545_remove_categories_from_section.rb +0 -5
  38. data/db/migrate/20171120145546_create_section_types.rb +0 -9
  39. data/db/migrate/20171120145547_add_section_type_id_to_sections.rb +0 -15
  40. data/db/migrate/20171203114528_change_default_status_of_promotion_enquiries.rb +0 -8
  41. data/db/migrate/20171203114530_add_control_fields_to_promotions.rb +0 -7
  42. data/db/migrate/20180101093437_add_page_id_to_sections.rb +0 -5
  43. data/db/migrate/20180101093438_add_priority_to_pages_and_sections.rb +0 -6
  44. data/db/migrate/20180101093439_add_a_ton_of_boolean_fields_to_sections.rb +0 -34
  45. data/db/migrate/20180101093440_add_code_to_sections.rb +0 -19
  46. data/db/migrate/20180101093441_rename_meta_description_all_over.rb +0 -7
  47. data/db/migrate/20180101093442_add_name_to_sections.rb +0 -19
  48. data/spec/dummy/spec/factories/section_type.rb +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b61caa08b4a5e9f6f3272d1e7dac508637c2fa9bb4838f841170c37d92a24e90
4
- data.tar.gz: 2e698dc5e1ab1f22f33944d75b32e16c0e461935103812c1381a27ca208c3c6c
3
+ metadata.gz: d86a2db6606d13b0c37c9761e6f24e14f9ce940c7521c640d1e043a31f207967
4
+ data.tar.gz: f6f8cb4ba9b26c523fb2226c1af5e53da3338afa9a4888105dc7e61f32d6889b
5
5
  SHA512:
6
- metadata.gz: 2c7cdd79de757fe642af93110d8b51e3f44699d9611626acfca4795ba5c29459255a157c10ff28fe50d93ec1fda7a366c302a91bb3d380c9a542130d81dbfed2
7
- data.tar.gz: 4e1877734b8ea00939622e272744850620cc6bc5e87f0ee81071fb71cfd222a05bc454aba575416efee70c91ddd78df0988b4fdafb0bdfa5f93d86a2206e150e
6
+ metadata.gz: e5317626fb1813fe528a7f17006f883b4c1bc3ef371139afbfc6d68fee1b213d7634d28fadb590f06e00951c4037e4709184b1b35f9c5f2c3f4b8644623893b7
7
+ data.tar.gz: d4c53785c6fe128b9f825231d7d034959b506144b3befb370a4752fa0e5be1372f4fdadc97323703dddaba7db152fba54da75ddf59775ef6563b6a5e1dcd35e3
@@ -24,6 +24,38 @@ class Dhatu::Page < Dhatu::ApplicationRecord
24
24
 
25
25
  scope :search, lambda { |query| where("LOWER(name) LIKE LOWER('%#{query}%') OR LOWER(code) LIKE LOWER('%#{query}%')") }
26
26
 
27
+ def self.save_row_data(hsh)
28
+ # Initializing error hash for displaying all errors altogether
29
+ error_object = Kuppayam::Importer::ErrorHash.new
30
+
31
+ return error_object if hsh[:code].to_s.strip.blank?
32
+
33
+ page = Dhatu::Page.where("code = ?", hsh[:code].to_s.strip).first || Dhatu::Page.new
34
+
35
+ page.name = hsh[:name].to_s.strip
36
+ page.code = hsh[:code].to_s.strip
37
+
38
+ page.feature = Feature.where("name = ?", hsh[:feature].to_s.strip).first
39
+
40
+ page.status = hsh[:status].to_s.strip || PUBLISHED
41
+ page.priority = hsh[:priority].to_s.strip || 1
42
+
43
+ if page.valid?
44
+ begin
45
+ page.save!
46
+ rescue Exception => e
47
+ summary = "uncaught #{e} exception while handling connection: #{e.message}"
48
+ details = "Stack trace: #{e.backtrace.map {|l| " #{l}\n"}.join}"
49
+ error_object.errors << { summary: summary, details: details }
50
+ end
51
+ else
52
+ summary = "Error while saving page: #{page.title}"
53
+ details = "Error! #{page.errors.full_messages.to_sentence}"
54
+ error_object.errors << { summary: summary, details: details }
55
+ end
56
+ return error_object
57
+ end
58
+
27
59
  # ------------------
28
60
  # Instance Methods
29
61
  # ------------------
@@ -19,7 +19,6 @@ class Dhatu::Section < Dhatu::ApplicationRecord
19
19
  validates :button_two_link, length: {maximum: 512}, allow_blank: true
20
20
 
21
21
  # Associations
22
- belongs_to :section_type, :class_name => "Dhatu::SectionType", optional: true
23
22
  belongs_to :page, :class_name => "Dhatu::Page", optional: true
24
23
  has_one :cover_image, :as => :imageable, :dependent => :destroy, :class_name => "Image::CoverImage"
25
24
  has_many :gallery_images, :as => :imageable, :dependent => :destroy, :class_name => "Image::GalleryImage"
@@ -48,18 +47,25 @@ class Dhatu::Section < Dhatu::ApplicationRecord
48
47
  return error_object if hsh[:code].to_s.strip.blank?
49
48
 
50
49
  section = Dhatu::Section.where("code = ?", hsh[:code].to_s.strip).first || Dhatu::Section.new
51
-
52
- section.title = hsh[:title].to_s.strip
50
+
51
+ section.name = hsh[:name].to_s.strip
53
52
  section.code = hsh[:code].to_s.strip
53
+
54
+ section.title = hsh[:title].to_s.strip
54
55
  section.sub_title = hsh[:sub_title].to_s.strip
56
+
55
57
  section.short_description = hsh[:short_description].to_s.strip
56
58
  section.long_description = hsh[:long_description].to_s.strip
59
+
57
60
  section.button_one_text = hsh[:button_one_text].to_s.strip
58
61
  section.button_two_text = hsh[:button_two_text].to_s.strip
59
62
  section.button_one_link = hsh[:button_one_link].to_s.strip
60
63
  section.button_two_link = hsh[:button_two_link].to_s.strip
61
64
 
65
+ section.page = Dhatu::Page.where("code = ?", hsh[:page].to_s.strip).first
66
+
62
67
  section.status = hsh[:status].to_s.strip || PUBLISHED
68
+ section.priority = hsh[:priority].to_s.strip || 1
63
69
 
64
70
  if section.valid?
65
71
  begin
@@ -39,7 +39,7 @@ class Dhatu::Testimonial < Dhatu::ApplicationRecord
39
39
  testimonial.name = hsh[:name].to_s.strip
40
40
  testimonial.designation = hsh[:designation].to_s.strip
41
41
  testimonial.organisation = hsh[:organisation].to_s.strip
42
- testimonial.description = hsh[:description].to_s.strip
42
+ testimonial.statement = hsh[:statement].to_s.strip
43
43
 
44
44
  # testimonial.category = Dhatu::Category.find_by_name(hsh[:category])
45
45
  testimonial.status = hsh[:status].to_s.strip || PUBLISHED
@@ -0,0 +1,10 @@
1
+ name, code,status,priority,feature
2
+ Home Page,HOME_PAGE,published,1,
3
+ About Us Page,ABOUT_US_PAGE,published,2,
4
+ Contact Us Page,CONTACT_US_PAGE,published,3,
5
+ Products Page,PRODUCTS_PAGE,published,4,Dhatu::Product
6
+ Services Page,SERVICES_PAGE,published,5,Dhatu::Service
7
+ Projects Page,PROJECTS_PAGE,published,6,Dhatu::Project
8
+ Offers Page,OFFERS_PAGE,unpublished,7,Dhatu::Offer
9
+ Prices Page,PRICES_PAGE,unpublished,8,Dhatu::Price
10
+ Blogs Page,BLOGS_PAGE,unpublished,9,Dhatu::BlogPost
@@ -1,15 +1,15 @@
1
- section_type,title, status, sub_title, short_description, long_description, button_one_text, button_two_text, button_one_link, button_two_link
2
- ABOUT_US_BANNER,About Us,published,We are Awesome!,,,,,,
3
- CONTACT_US_BANNER,Contact Us,published,Drop us a message to let us know how we can help you,,,,,,
4
- BLOG_BANNER,Going Places,published,"I havent been everywhere, but its on my list",,,,,,
5
- OFFERS_BANNER,Limitted Offers,published,Grab your offer right not!,,,,,,
6
- SERVICES_BANNER,Our Services,published,Serving better day by day,,,,,,
7
- PRODUCTS_BANNER,Our Products,published,Click on the links left to filter down,,,,,,
8
- PROJECTS_BANNER,Recent Projects,published,Take a look at some of the great projects we have done recently.,,,,,,
9
- HOME_PAGE_SLIDE,Aspire to inspire before we expire,published,"A good teacher can inspire hope, ignite the imagination, and instill a love of learning. Read more at: https://www.brainyquote.com/topics/inspire",,,,,,
10
- HOME_PAGE_SLIDE,7 Billion Smiles and yours is my favorite,published,The most important thing is to try and inspire people so that they can be great in whatever they want to do. Read more at: https://www.brainyquote.com/topics/inspire,,,,,,
11
- HOME_PAGE_SLIDE,Create your own Sunshine,published,Find your voice and inspire others to find theirs. Read more at: https://www.brainyquote.com/topics/inspire,,,,,,
12
- BOOK_NOW,Download Free Sample,published,Fill up this form to get your free copy of the e-book - Himalayan Mistics,,,,,,
13
- ABOUT_US,About Us,published,About Us Section,,,,,,
14
- CONTACT_US,Contact Us,published,Contact Us Section,,,,,,
15
- ABOUT_US_FOOTER,About Us,published,,ellow Leaf Hammocks is a company trying to save the world via hammocks. The brand plans to accomplish this by selling hand-woven hammocks from artisans in Thailand.,,,,,
1
+ Name, code, status,priority,title, sub_title, short_description, long_description, button_one_text, button_two_text, button_one_link, button_two_link
2
+ About Us Section,ABOUT_US_BANNER,published,1,About Us,We are Awesome!,,,,,,
3
+ Contact Us Section,CONTACT_US_BANNER,published,2,Contact Us,Drop us a message to let us know how we can help you,,,,,,
4
+ BLOG_BANNER,BLOG_BANNER,published,3,Going Places,"I havent been everywhere, but its on my list",,,,,,
5
+ OFFERS_BANNER,OFFERS_BANNER,published,4,Limitted Offers,Grab your offer right not!,,,,,,
6
+ SERVICES_BANNER,SERVICES_BANNER,published,5,Our Services,Serving better day by day,,,,,,
7
+ PRODUCTS_BANNER,PRODUCTS_BANNER,published,6,Our Products,Click on the links left to filter down,,,,,,
8
+ PROJECTS_BANNER,PROJECTS_BANNER,published,7,Recent Projects,Take a look at some of the great projects we have done recently.,,,,,,
9
+ HOME_PAGE_SLIDE,HOME_PAGE_SLIDE,published,8,Aspire to inspire before we expire,"A good teacher can inspire hope, ignite the imagination, and instill a love of learning. Read more at: https://www.brainyquote.com/topics/inspire",,,,,,
10
+ HOME_PAGE_SLIDE,HOME_PAGE_SLIDE,published,9,7 Billion Smiles and yours is my favorite,The most important thing is to try and inspire people so that they can be great in whatever they want to do. Read more at: https://www.brainyquote.com/topics/inspire,,,,,,
11
+ HOME_PAGE_SLIDE,HOME_PAGE_SLIDE,published,10,Create your own Sunshine,Find your voice and inspire others to find theirs. Read more at: https://www.brainyquote.com/topics/inspire,,,,,,
12
+ BOOK_NOW,BOOK_NOW,published,11,Download Free Sample,Fill up this form to get your free copy of the e-book - Himalayan Mistics,,,,,,
13
+ ABOUT_US,ABOUT_US,published,12,About Us,About Us Section,,,,,,
14
+ CONTACT_US,CONTACT_US,published,13,Contact Us,Contact Us Section,,,,,,
15
+ ABOUT_US_FOOTER,ABOUT_US_FOOTER,published,14,About Us,,ellow Leaf Hammocks is a company trying to save the world via hammocks. The brand plans to accomplish this by selling hand-woven hammocks from artisans in Thailand.,,,,,
@@ -0,0 +1,10 @@
1
+ name, code,status,priority,feature
2
+ Home Page,HOME_PAGE,published,1,
3
+ About Us Page,ABOUT_US_PAGE,published,2,
4
+ Contact Us Page,CONTACT_US_PAGE,published,3,
5
+ Products Page,PRODUCTS_PAGE,published,4,Dhatu::Product
6
+ Services Page,SERVICES_PAGE,published,5,Dhatu::Service
7
+ Projects Page,PROJECTS_PAGE,published,6,Dhatu::Project
8
+ Offers Page,OFFERS_PAGE,unpublished,7,Dhatu::Offer
9
+ Prices Page,PRICES_PAGE,unpublished,8,Dhatu::Price
10
+ Blogs Page,BLOGS_PAGE,unpublished,9,Dhatu::BlogPost
@@ -2,7 +2,6 @@ user,feature,can_create,can_read,can_update,can_delete
2
2
  john.honai,Dhatu::Price,TRUE,TRUE,TRUE,TRUE
3
3
  john.honai,Dhatu::Category,TRUE,TRUE,TRUE,TRUE
4
4
  john.honai,Dhatu::Section,TRUE,TRUE,TRUE,TRUE
5
- john.honai,Dhatu::SectionType,TRUE,TRUE,TRUE,FALSE
6
5
  john.honai,Dhatu::Branch,TRUE,TRUE,TRUE,TRUE
7
6
  john.honai,Dhatu::BlogPost,TRUE,TRUE,TRUE,TRUE
8
7
  john.honai,Dhatu::Booking,TRUE,TRUE,TRUE,TRUE
@@ -13,7 +12,6 @@ john.honai,Permission,TRUE,TRUE,TRUE,FALSE
13
12
  malavika,Dhatu::Price,TRUE,TRUE,TRUE,TRUE
14
13
  malavika,Dhatu::Category,TRUE,TRUE,TRUE,TRUE
15
14
  malavika,Dhatu::Section,TRUE,TRUE,TRUE,TRUE
16
- malavika,Dhatu::SectionType,TRUE,TRUE,TRUE,FALSE
17
15
  malavika,Dhatu::Branch,TRUE,TRUE,TRUE,TRUE
18
16
  malavika,Dhatu::BlogPost,TRUE,TRUE,TRUE,TRUE
19
17
  malavika,Dhatu::Booking,TRUE,TRUE,TRUE,TRUE
@@ -24,7 +22,6 @@ malavika,Permission,TRUE,TRUE,TRUE,FALSE
24
22
  anas,Dhatu::Price,TRUE,TRUE,TRUE,TRUE
25
23
  anas,Dhatu::Category,TRUE,TRUE,TRUE,TRUE
26
24
  anas,Dhatu::Section,TRUE,TRUE,TRUE,TRUE
27
- anas,Dhatu::SectionType,TRUE,TRUE,TRUE,FALSE
28
25
  anas,Dhatu::Branch,TRUE,TRUE,TRUE,TRUE
29
26
  anas,Dhatu::BlogPost,TRUE,TRUE,TRUE,TRUE
30
27
  anas,Dhatu::Booking,TRUE,TRUE,TRUE,TRUE
@@ -8,7 +8,6 @@ Region,published,FALSE,1
8
8
  City,published,FALSE,1
9
9
  Locality,published,FALSE,1
10
10
  Dhatu::Section,published,FALSE,1
11
- Dhatu::SectionType,published,FALSE,1
12
11
  Dhatu::BlogPost,published,TRUE,1
13
12
  Dhatu::Branch,published,FALSE,1
14
13
  Dhatu::Offer,published,FALSE,1
@@ -10,9 +10,12 @@ class CreateEvents < ActiveRecord::Migration[5.0]
10
10
  t.date :date, :null => true
11
11
  t.datetime :starts_at, :null => true
12
12
  t.datetime :ends_at, :null => true
13
+
14
+ t.references :category, index: true
13
15
 
14
16
  t.boolean :featured, default: false
15
17
  t.string :status, :null => false, :default=>"unpublished", :limit=>16
18
+ t.integer :priority, default: 1, null: false
16
19
 
17
20
  t.timestamps null: false
18
21
  end
@@ -9,9 +9,12 @@ class CreateOffers < ActiveRecord::Migration[5.0]
9
9
 
10
10
  t.datetime :starts_at, :null => true
11
11
  t.datetime :ends_at, :null => true
12
+
13
+ t.references :category, index: true
12
14
 
13
15
  t.boolean :featured, default: false
14
16
  t.string :status, :null => false, :default=>"unpublished", :limit=>16
17
+ t.integer :priority, default: 1, null: false
15
18
 
16
19
  t.timestamps null: false
17
20
  end
@@ -3,8 +3,12 @@ class CreatePages < ActiveRecord::Migration[5.1]
3
3
  create_table :pages do |t|
4
4
  t.string :name, :null => false, limit: 64
5
5
  t.string :code, :null => false, limit: 64
6
+
6
7
  t.references :feature
8
+
7
9
  t.string :status, :null => false, :default=>"unpublished", :limit=>16
10
+ t.integer :priority, default: 1, null: false
11
+
8
12
  t.timestamps null: false
9
13
  end
10
14
 
@@ -1,16 +1,35 @@
1
1
  class CreateSections < ActiveRecord::Migration[5.0]
2
2
  def self.up
3
3
  create_table :sections do |t|
4
+
5
+ t.string :name, null: false, limit: 64
6
+ t.string :code, null: false, limit: 64
7
+
4
8
  t.string :title, :null => false, :limit=>256
5
9
  t.string :sub_title, :null => false, :limit=>256
10
+
6
11
  t.string :short_description, :limit=>1048
7
12
  t.text :long_description
13
+
8
14
  t.string :button_one_text, :limit=>64
9
15
  t.string :button_two_text, :limit=>64
10
16
  t.string :button_one_link, :limit=>512
11
17
  t.string :button_two_link, :limit=>512
12
- t.string :section_type, :limit=>64
18
+
13
19
  t.string :status, :null => false, :default=>"unpublished", :limit=>16
20
+ t.integer :priority, default: 1, null: false
21
+
22
+ t.references :page, index: true
23
+
24
+ t.boolean :enable_title, default: false
25
+ t.boolean :enable_sub_title, default: false
26
+ t.boolean :enable_short_description, default: false
27
+ t.boolean :enable_long_description, default: false
28
+ t.boolean :enable_button_one, default: false
29
+ t.boolean :enable_button_two, default: false
30
+ t.boolean :enable_cover_image, default: false
31
+ t.boolean :enable_gallery_images, default: false
32
+
14
33
  t.timestamps null: false
15
34
  end
16
35
  end
@@ -4,9 +4,13 @@ class CreateTestimonials < ActiveRecord::Migration[5.0]
4
4
  t.string :name, :null => false, :limit=>256
5
5
  t.string :designation, :null => true, :limit=>256
6
6
  t.string :organisation, :null => true, :limit=>256
7
+
8
+ t.text :statement
9
+
7
10
  t.string :status, :null => false, :limit=>64
8
11
  t.boolean :featured, default: false
9
- t.text :statement
12
+ t.integer :priority, default: 1, null: false
13
+
10
14
  t.timestamps null: false
11
15
  end
12
16
  end
@@ -3,13 +3,17 @@ class CreateTeamMembers < ActiveRecord::Migration[5.0]
3
3
  create_table :team_members do |t|
4
4
  t.string :name
5
5
  t.string :designation
6
- t.string :status
7
- t.boolean :featured
8
6
  t.text :description
7
+
9
8
  t.string :linked_in_url
10
9
  t.string :google_plus_url
11
10
  t.string :facebook_url
12
11
  t.string :twitter_url
12
+
13
+ t.string :status, :null => false, :limit=>64
14
+ t.boolean :featured, default: false
15
+ t.integer :priority, default: 1, null: false
16
+
13
17
  t.timestamps null: false
14
18
  end
15
19
  end
@@ -5,8 +5,8 @@ class CreateBlogPosts < ActiveRecord::Migration[5.0]
5
5
  t.string :title, null: false, limit: 256
6
6
  t.string :slug, null: true, limit: 64
7
7
  t.string :author, null: true, limit: 256
8
- t.string :meta_description, null: true, limit: 512
9
-
8
+
9
+ t.string :short_description, null: true, limit: 512
10
10
  t.text :description
11
11
 
12
12
  t.datetime :posted_at, null: true
@@ -16,8 +16,11 @@ class CreateBlogPosts < ActiveRecord::Migration[5.0]
16
16
 
17
17
  t.text :tags
18
18
 
19
+ t.references :category, index: true
20
+
19
21
  t.timestamps null: false
20
22
  end
21
23
  add_index :blog_posts, :status
24
+
22
25
  end
23
26
  end
@@ -4,6 +4,8 @@ class CreateServices < ActiveRecord::Migration[5.1]
4
4
  t.string :name, :null => false, limit: 128
5
5
  t.string :one_liner
6
6
  t.string :permalink, :null => false, limit: 128
7
+
8
+ t.string :short_description, null: true, limit: 512
7
9
  t.text :description
8
10
 
9
11
  t.text :price
@@ -4,7 +4,9 @@ class CreatePrices < ActiveRecord::Migration[5.1]
4
4
  t.string :title, :null => false, limit: 128
5
5
  t.string :sub_title
6
6
  t.text :price
7
+
7
8
  t.references :category, index: true
9
+
8
10
  t.string :status, :null => false, :default=>"unpublished", :limit=>16
9
11
  t.boolean :featured, default: false
10
12
  t.integer :priority, default: 1, null: false
@@ -14,6 +14,7 @@ class CreateBookings < ActiveRecord::Migration[5.1]
14
14
 
15
15
  t.boolean :featured, default: false
16
16
  t.string :status, :null => false, :default=>"new", :limit=>16
17
+
17
18
  t.timestamps null: false
18
19
  end
19
20
 
@@ -15,9 +15,13 @@
15
15
  t.boolean :phone_mandatory, default: false, null: false
16
16
 
17
17
  t.boolean :featured, default: false
18
- t.string :status, :null => false, :default=>"unpublished", :limit=>16
18
+ t.string :status, :null => false, :default=>"new", :limit=>16
19
19
  t.integer :priority, default: 1, null: false
20
20
 
21
+ t.boolean :show_popup, default: true, :null => false
22
+ t.boolean :show_only_on_homepage, default: true, :null => false
23
+ t.integer :popup_lifespan_in_minutes, default: 60, :null => false
24
+
21
25
  t.timestamps null: false
22
26
  end
23
27
 
@@ -4,10 +4,11 @@ class CreateProjects < ActiveRecord::Migration[5.1]
4
4
  t.string :name, :null => false, limit: 128
5
5
  t.string :permalink, :null => false, limit: 128
6
6
 
7
- t.string :meta_description, :null => true, limit: 512
7
+ t.string :short_description, null: true, limit: 512
8
8
  t.text :description
9
9
 
10
10
  t.string :client, :null => false, limit: 128
11
+
11
12
  t.references :category
12
13
 
13
14
  t.string :status, :null => false, :default=>"unpublished", :limit=>16
@@ -1,3 +1,5 @@
1
1
  module Dhatu
2
- VERSION = '0.1.25'
2
+ VERSION = '0.2.0'
3
+ # The old version to migrate existing applications
4
+ # VERSION = '0.1.25'
3
5
  end
@@ -25,7 +25,7 @@ namespace 'dhatu' do
25
25
  puts " "
26
26
  end
27
27
 
28
- ["Dhatu::Category", "Dhatu::Service", "Dhatu::Project", "Dhatu::Section", "Dhatu::SectionType", "Dhatu::Event", "Dhatu::Offer", "Dhatu::Price", "Dhatu::Testimonial", "Dhatu::TeamMember", "Dhatu::Branch", "Dhatu::Promotion", "Dhatu::PromotionAttribute", "Dhatu::BlogPost"].each do |cls_name|
28
+ ["Dhatu::Category", "Dhatu::Page", "Dhatu::Service", "Dhatu::Project", "Dhatu::Section", "Dhatu::Event", "Dhatu::Offer", "Dhatu::Price", "Dhatu::Testimonial", "Dhatu::TeamMember", "Dhatu::Branch", "Dhatu::Promotion", "Dhatu::PromotionAttribute", "Dhatu::BlogPost"].each do |cls_name|
29
29
  name = cls_name.underscore.pluralize
30
30
  desc "Import #{cls_name.pluralize}"
31
31
  task name => :environment do
@@ -49,7 +49,7 @@ namespace 'dhatu' do
49
49
  desc "Import all dummy data in sequence"
50
50
  task 'all' => :environment do
51
51
 
52
- import_list = ["dhatu/services", "dhatu/projects", "dhatu/sections", "dhatu/section_types", "dhatu/categories", "dhatu/events", "dhatu/offers", "dhatu/prices", "dhatu/testimonials", "dhatu/team_members"]
52
+ import_list = ["dhatu/pages", "dhatu/services", "dhatu/projects", "dhatu/sections", "dhatu/categories", "dhatu/events", "dhatu/offers", "dhatu/prices", "dhatu/testimonials", "dhatu/team_members"]
53
53
 
54
54
  import_list.each do |item|
55
55
  print "Loading #{item.split(':').last.titleize} \t".yellow
@@ -65,7 +65,7 @@ namespace 'dhatu' do
65
65
  puts " "
66
66
  end
67
67
 
68
- ["Dhatu::Category", "Dhatu::Service", "Dhatu::Project", "Dhatu::Section", "Dhatu::SectionType", "Dhatu::Event", "Dhatu::Offer", "Dhatu::Price", "Dhatu::Testimonial", "Dhatu::TeamMember", "Dhatu::Branch", "Dhatu::Promotion", "Dhatu::PromotionAttribute", "Dhatu::BlogPost"].each do |cls_name|
68
+ ["Dhatu::Category", "Dhatu::Page", "Dhatu::Service", "Dhatu::Project", "Dhatu::Section", "Dhatu::Event", "Dhatu::Offer", "Dhatu::Price", "Dhatu::Testimonial", "Dhatu::TeamMember", "Dhatu::Branch", "Dhatu::Promotion", "Dhatu::PromotionAttribute", "Dhatu::BlogPost"].each do |cls_name|
69
69
  name = cls_name.underscore.pluralize
70
70
  desc "Load Dummy #{cls_name.pluralize}"
71
71
  task name => :environment do
@@ -13,7 +13,7 @@ FactoryBot.define do
13
13
  button_one_link "www.domain.com/link_one"
14
14
  button_two_link "www.domain.com/link_two"
15
15
 
16
- association :section_type, factory: :section_type
16
+ association :page, factory: :page
17
17
  end
18
18
 
19
19
  factory :published_section, parent: :unpublished_section do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dhatu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.25
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kpvarma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-19 00:00:00.000000000 Z
11
+ date: 2018-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -425,7 +425,6 @@ files:
425
425
  - app/controllers/dhatu/promotion_enquiries_controller.rb
426
426
  - app/controllers/dhatu/promotions_controller.rb
427
427
  - app/controllers/dhatu/resource_controller.rb
428
- - app/controllers/dhatu/section_types_controller.rb
429
428
  - app/controllers/dhatu/sections_controller.rb
430
429
  - app/controllers/dhatu/services_controller.rb
431
430
  - app/controllers/dhatu/team_members_controller.rb
@@ -448,7 +447,6 @@ files:
448
447
  - app/models/dhatu/promotion_attribute.rb
449
448
  - app/models/dhatu/promotion_enquiry.rb
450
449
  - app/models/dhatu/section.rb
451
- - app/models/dhatu/section_type.rb
452
450
  - app/models/dhatu/service.rb
453
451
  - app/models/dhatu/team_member.rb
454
452
  - app/models/dhatu/testimonial.rb
@@ -529,11 +527,6 @@ files:
529
527
  - app/views/dhatu/promotions/_row.html.erb
530
528
  - app/views/dhatu/promotions/_show.html.erb
531
529
  - app/views/dhatu/promotions/index.html.erb
532
- - app/views/dhatu/section_types1/_form.html.erb
533
- - app/views/dhatu/section_types1/_index.html.erb
534
- - app/views/dhatu/section_types1/_row.html.erb
535
- - app/views/dhatu/section_types1/_show.html.erb
536
- - app/views/dhatu/section_types1/index.html.erb
537
530
  - app/views/dhatu/sections/_form.html.erb
538
531
  - app/views/dhatu/sections/_index.html.erb
539
532
  - app/views/dhatu/sections/_row.html.erb
@@ -565,19 +558,21 @@ files:
565
558
  - db/data/dummy/categories.csv
566
559
  - db/data/dummy/events.csv
567
560
  - db/data/dummy/offers.csv
561
+ - db/data/dummy/pages.csv
568
562
  - db/data/dummy/prices.csv
569
563
  - db/data/dummy/promotions.csv
570
- - db/data/dummy/section_types.csv
571
564
  - db/data/dummy/sections.csv
572
565
  - db/data/dummy/services.csv
573
566
  - db/data/dummy/team_members.csv
574
567
  - db/data/dummy/testimonials.csv
568
+ - db/data/pages.csv
575
569
  - db/data/permissions.csv
576
570
  - db/data/users.csv
577
571
  - db/master_data/features.csv
578
572
  - db/master_data/roles.csv
579
573
  - db/migrate/20160803045832_create_events.rb
580
574
  - db/migrate/20160803045832_create_offers.rb
575
+ - db/migrate/20171010055101_create_pages.rb
581
576
  - db/migrate/20171010055102_create_sections.rb
582
577
  - db/migrate/20171012073510_create_testimonials.rb
583
578
  - db/migrate/20171012103805_create_team_members.rb
@@ -585,26 +580,11 @@ files:
585
580
  - db/migrate/20171014125053_create_branches.rb
586
581
  - db/migrate/20171014125054_create_categories.rb
587
582
  - db/migrate/20171014125055_create_services.rb
588
- - db/migrate/20171104163658_add_category_id_to_blog_posts.rb
589
- - db/migrate/20171104163659_add_priority_to_tables.rb
590
583
  - db/migrate/20171104163660_create_prices.rb
591
584
  - db/migrate/20171104163661_create_bookings.rb
592
- - db/migrate/20171104163662_add_category_id_to_tables.rb
593
- - db/migrate/20171120145545_remove_categories_from_section.rb
594
- - db/migrate/20171120145546_create_section_types.rb
595
- - db/migrate/20171120145547_add_section_type_id_to_sections.rb
596
585
  - db/migrate/20171120145548_create_promotion_and_promotion_enquiries.rb
597
- - db/migrate/20171203114528_change_default_status_of_promotion_enquiries.rb
598
- - db/migrate/20171203114530_add_control_fields_to_promotions.rb
599
586
  - db/migrate/20180101093434_create_projects.rb
600
- - db/migrate/20180101093435_create_pages.rb
601
587
  - db/migrate/20180101093436_create_meta_tags.rb
602
- - db/migrate/20180101093437_add_page_id_to_sections.rb
603
- - db/migrate/20180101093438_add_priority_to_pages_and_sections.rb
604
- - db/migrate/20180101093439_add_a_ton_of_boolean_fields_to_sections.rb
605
- - db/migrate/20180101093440_add_code_to_sections.rb
606
- - db/migrate/20180101093441_rename_meta_description_all_over.rb
607
- - db/migrate/20180101093442_add_name_to_sections.rb
608
588
  - lib/dhatu.rb
609
589
  - lib/dhatu/engine.rb
610
590
  - lib/dhatu/factories.rb
@@ -628,7 +608,6 @@ files:
628
608
  - spec/dummy/spec/factories/section.rb
629
609
  - spec/dummy/spec/factories/section_cover_image.rb
630
610
  - spec/dummy/spec/factories/section_gallery_image.rb
631
- - spec/dummy/spec/factories/section_type.rb
632
611
  - spec/dummy/spec/factories/team_member.rb
633
612
  - spec/dummy/spec/factories/test.jpg
634
613
  - spec/dummy/spec/factories/testimonial.rb
@@ -1,77 +0,0 @@
1
- module Dhatu
2
- class SectionTypesController < ResourceController
3
-
4
- before_action :require_super_admin
5
-
6
- private
7
-
8
- def get_resource
9
- @r_object = @resource_options[:class].find_by_id(params[:id])
10
- end
11
-
12
- def get_collections
13
- @relation = SectionType.where("")
14
-
15
- parse_filters
16
- apply_filters
17
-
18
- @section_types = @r_objects = @relation.page(@current_page).per(@per_page)
19
-
20
- return true
21
- end
22
-
23
- def apply_filters
24
- @relation = @relation.search(@query) if @query
25
-
26
- @order_by = "created_at desc" unless @order_by
27
- @relation = @relation.order(@order_by)
28
- end
29
-
30
- def configure_filter_settings
31
- @filter_settings = {
32
- string_filters: [
33
- { filter_name: :query }
34
- ],
35
- boolean_filters: [],
36
- reference_filters: [],
37
- variable_filters: [],
38
- }
39
- end
40
-
41
- def configure_filter_ui_settings
42
- @filter_ui_settings = {}
43
- end
44
-
45
- def resource_controller_configuration
46
- {
47
- page_title: "Section Types",
48
- js_view_path: "/kuppayam/workflows/parrot",
49
- view_path: "/dhatu/section_types",
50
- show_modal_after_create: false,
51
- show_modal_after_update: false,
52
- collection_name: :section_types,
53
- item_name: :section_type,
54
- class: Dhatu::SectionType
55
- }
56
- end
57
-
58
- def breadcrumbs_configuration
59
- {
60
- heading: "Manage Section Types",
61
- icon: "fa-reorder",
62
- description: "Listing all Section Types",
63
- links: [{name: "Home", link: breadcrumb_home_path, icon: 'fa-home'},
64
- {name: "Manage Section Types", link: section_types_path, icon: 'fa-reorder', active: true}]
65
- }
66
- end
67
-
68
- def permitted_params
69
- params.require("dhatu/section_type").permit(:name, :code)
70
- end
71
-
72
- def set_navs
73
- set_nav("dhatu/section_types")
74
- end
75
-
76
- end
77
- end
@@ -1,74 +0,0 @@
1
- class Dhatu::SectionType < Dhatu::ApplicationRecord
2
-
3
- # Set Table Name
4
- self.table_name = "section_types"
5
-
6
- # Validations
7
- validates :name, presence: true, length: {minimum: 3, maximum: 64}
8
- validates :code, presence: true, length: {minimum: 3, maximum: 64}
9
-
10
- # ------------------
11
- # Class Methods
12
- # ------------------
13
-
14
- scope :search, lambda {|query| where("LOWER(name) LIKE LOWER('%#{query}%') OR\
15
- LOWER(code) LIKE LOWER('%#{query}%')")}
16
-
17
- scope :upcoming, lambda { where("created_at >= ?", Time.now) }
18
- scope :past, lambda { where("created_at < ?", Time.now) }
19
-
20
- # Associations
21
- has_many :sections, :class_name => "Dhatu::Section"
22
-
23
- def self.save_row_data(hsh)
24
- # Initializing error hash for displaying all errors altogether
25
- error_object = Kuppayam::Importer::ErrorHash.new
26
-
27
- return error_object if hsh[:name].to_s.strip.blank?
28
-
29
- section_type = Dhatu::SectionType.find_by_name(hsh[:name].to_s.strip) || Dhatu::SectionType.new
30
- section_type.name = hsh[:name].to_s.strip
31
- section_type.code = hsh[:code].to_s.strip
32
-
33
- if section_type.valid?
34
- begin
35
- section_type.save!
36
- rescue Exception => e
37
- summary = "uncaught #{e} exception while handling connection: #{e.message}"
38
- details = "Stack trace: #{e.backtrace.map {|l| " #{l}\n"}.join}"
39
- error_object.errors << { summary: summary, details: details }
40
- end
41
- else
42
- summary = "Error while saving section_type: #{section_type.name}"
43
- details = "Error! #{section_type.errors.full_messages.to_sentence}"
44
- error_object.errors << { summary: summary, details: details }
45
- end
46
- return error_object
47
- end
48
-
49
- # ------------------
50
- # Instance Methods
51
- # ------------------
52
-
53
- # Generic Methods
54
- # ---------------
55
- def to_param
56
- "#{id}-#{name.parameterize[0..32]}"
57
- end
58
-
59
- def display_name
60
- "#{name_was}"
61
- end
62
-
63
- # Permission Methods
64
- # ------------------
65
-
66
- def can_be_edited?
67
- true
68
- end
69
-
70
- def can_be_deleted?
71
- true
72
- end
73
-
74
- end
@@ -1,20 +0,0 @@
1
- <%= form_for([@section_type], :html => {:id=>"form_section_type", :class=>"mb-0 form-horizontal", :role => "form", :method => (@section_type.new_record? ? :post : :put), :remote=>true}) do |f| %>
2
-
3
- <div id="section_type_form_error">
4
- <%= @section_type.errors[:base].to_sentence %>
5
- </div>
6
-
7
- <div class="form-inputs mb-30 mt-30">
8
- <%= theme_form_field(@section_type, :name, label: "Name") %>
9
- <%= theme_form_field(@section_type, :code, label: "Code") %>
10
- </div>
11
-
12
- <div>
13
- <%= submit_tag("Save", :class=>"btn btn-primary pull-right ml-10") %>
14
- <%= link_to raw("<i class='fa fa-close mr-5'></i><span>Cancel</span>"), "#", onclick: "closeGenericModal();", class: "pull-right ml-10 btn btn-white" %>
15
- </div>
16
- <%= clear_tag(10) %>
17
- </div>
18
-
19
- <% end %>
20
-
@@ -1,48 +0,0 @@
1
- <div class="table-responsive">
2
- <table class="table table-hover members-table middle-align">
3
- <thead>
4
- <tr>
5
- <th style="text-align: center;width:60px">#</th>
6
- <th>Name</th>
7
- <th>Code</th>
8
- <% if display_manage_links? %>
9
- <th style="text-align: center;">Actions</th>
10
- <% end %>
11
- </tr>
12
- </thead>
13
- <tbody>
14
- <% @section_types.each_with_index do |section_type, i| %>
15
-
16
- <tr id="tr_section_type_<%= section_type.id %>">
17
-
18
- <th scope="row" style="text-align: center;">
19
- <% if i < 0 %>
20
- <i class="fa fa-check text-success"></i>
21
- <% else %>
22
- <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
23
- <% end %>
24
- </th>
25
-
26
- <td class="section_type-name"><%= link_to section_type.display_name, section_type_path(section_type), remote: true %></td>
27
-
28
- <td class="section_type-name"><%= link_to section_type.code, section_type_path(section_type), remote: true %></td>
29
-
30
- <% if display_manage_links? %>
31
-
32
- <td class="action-links hidden-sm hidden-xs" style="width:10%">
33
- <%= display_manage_links(section_type, @current_user) %>
34
- </td>
35
- <% end %>
36
- </tr>
37
-
38
- <% end %>
39
- </tbody>
40
- </table>
41
- </div>
42
-
43
- <div class="row">
44
- <div class="col-sm-12">
45
- <%= paginate_kuppayam(@section_types) %>
46
- </div>
47
- </div>
48
-
@@ -1,20 +0,0 @@
1
- <tr id="tr_section_type_<%= section_type.id %>">
2
-
3
- <th scope="row" style="text-align: center;">
4
- <% if i < 0 %>
5
- <i class="fa fa-check text-success"></i>
6
- <% else %>
7
- <%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %>
8
- <% end %>
9
- </th>
10
-
11
- <td class="section_type-name"><%= link_to section_type.display_name, section_type_path(section_type), remote: true %></td>
12
-
13
- <td class="section_type-name"><%= link_to section_type.code, section_type_path(section_type), remote: true %></td>
14
-
15
- <% if display_manage_links? %>
16
- <td class="action-links hidden-sm hidden-xs" style="width:10%">
17
- <%= display_manage_links(section_type, @current_user) %>
18
- </td>
19
- <% end %>
20
- </tr>
@@ -1,41 +0,0 @@
1
- <div id="div_blog_post_show">
2
-
3
- <div class="row">
4
-
5
- <div class="col-md-9 col-sm-12 col-xs-12" style="border-right:1px solid #f1f1f1;">
6
- <%= theme_panel_heading(@section_type.display_name) %>
7
- <%= theme_panel_sub_heading(@section_type.code, "#") %>
8
- <%= clear_tag(10) %>
9
- <div class="table-responsive mb-50">
10
- <table class="table table-striped table-condensed table-bordered">
11
- <tbody>
12
- <tr>
13
- <th>Name</th><td><%= @section_type.name %></td>
14
- </tr>
15
- <tr>
16
- <th>Code</th><td><%= @section_type.code %></td>
17
- </tr>
18
- <tr>
19
- <th>Created At</th><td><%= @section_type.created_at.strftime("%m/%d/%Y - %H:%M:%S") if @section_type.created_at %></td>
20
- </tr>
21
- <tr>
22
- <th>Updated At</th><td><%= @section_type.updated_at.strftime("%m/%d/%Y - %H:%M:%S") if @section_type.updated_at %></td>
23
- </tr>
24
-
25
- </tbody>
26
- </table>
27
- </div>
28
- <%= clear_tag(10) %>
29
- </div>
30
-
31
- <% if display_manage_links? %>
32
- <div class="col-md-3 col-sm-12 col-xs-12">
33
- <%= display_manage_buttons(@section_type) %>
34
- </div>
35
- <% end %>
36
- </div>
37
-
38
- <%= clear_tag(30) %>
39
- <%= link_to "Close", "#", onclick: "closeGenericModal();", class: "btn btn-primary pull-right" %>
40
- <%= clear_tag(10) %>
41
- </div>
@@ -1,43 +0,0 @@
1
- <div class="row">
2
-
3
- <div class="col-md-12">
4
-
5
- <ul class="nav nav-tabs">
6
- </ul>
7
- <div class="tab-content">
8
- <div class="tab-pane active">
9
-
10
- <div id="div_section_type_action_buttons">
11
- <div class="row">
12
- <div class="col-md-6">
13
-
14
- <%= theme_button('Add a Section Type', 'plus', new_section_type_path(), classes: "pull-left mr-10", btn_type: "success") if @current_user.has_create_permission?(Dhatu::SectionType) %>
15
-
16
- <%= theme_button('Refresh', 'refresh', section_types_path(), classes: "pull-left mr-10", btn_type: "white") %>
17
-
18
- </div>
19
- <div class="col-md-6">
20
- <%= search_form_kuppayam(Dhatu::SectionType, section_types_path, text: @filters[:query]) %>
21
- </div>
22
- </div>
23
- </div>
24
- <%= clear_tag(10) %>
25
-
26
- <div id="div_section_type_index">
27
- <%= render :partial=>"dhatu/section_types/index" %>
28
- </div>
29
- <%= clear_tag(10) %>
30
-
31
- </div>
32
- </div>
33
-
34
- </div>
35
-
36
- </div>
37
-
38
- <script type="text/javascript">
39
- $('body').on('change', '#inp_name', function() {
40
- var sectionCode = $(this).val().replace(/ /g, '_').toUpperCase().slice(0, 63);
41
- $('#inp_code').val(sectionCode);
42
- });
43
- </script>
@@ -1,15 +0,0 @@
1
- name,code
2
- About Us Banner,ABOUT_US_BANNER
3
- Contact Us Banner,CONTACT_US_BANNER
4
- Blog Banner,BLOG_BANNER
5
- Offers Banner,OFFERS_BANNER
6
- Services Banner,SERVICES_BANNER
7
- Products Banner,PRODUCTS_BANNER
8
- Projects Banner,PROJECTS_BANNER
9
- Home Page Slider 1,HOME_PAGE_SLIDE
10
- Home Page Slider 2,HOME_PAGE_SLIDE
11
- Home Page Slider 3,HOME_PAGE_SLIDE
12
- Book Now,BOOK_NOW
13
- About Us,ABOUT_US
14
- Contact Us,CONTACT_US
15
- About Us Footer,ABOUT_US_FOOTER
@@ -1,5 +0,0 @@
1
- class AddCategoryIdToBlogPosts < ActiveRecord::Migration[5.1]
2
- def change
3
- add_reference :blog_posts, :category, index: true
4
- end
5
- end
@@ -1,8 +0,0 @@
1
- class AddPriorityToTables < ActiveRecord::Migration[5.1]
2
- def change
3
- add_column :events, :priority, :integer, default: 1000
4
- add_column :offers, :priority, :integer, default: 1000
5
- add_column :testimonials, :priority, :integer, default: 1000
6
- add_column :team_members, :priority, :integer, default: 1000
7
- end
8
- end
@@ -1,7 +0,0 @@
1
- class AddCategoryIdToTables < ActiveRecord::Migration[5.1]
2
- def change
3
- add_reference :events, :category, index: true
4
- add_reference :offers, :category, index: true
5
- add_reference :sections, :category, index: true
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- class RemoveCategoriesFromSection < ActiveRecord::Migration[5.1]
2
- def change
3
- remove_reference :sections, :category, index: true
4
- end
5
- end
@@ -1,9 +0,0 @@
1
- class CreateSectionTypes < ActiveRecord::Migration[5.1]
2
- def change
3
- create_table :section_types do |t|
4
- t.string :name, :null => false, limit: 64
5
- t.string :code, :null => false, limit: 64
6
- t.timestamps null: false
7
- end
8
- end
9
- end
@@ -1,15 +0,0 @@
1
- class AddSectionTypeIdToSections < ActiveRecord::Migration[5.1]
2
- def change
3
- add_reference :sections, :section_type, index: true
4
-
5
- begin
6
- Dhatu::Section.all.each do |section|
7
- section_type = Dhatu::SectionType.find_by_code(section.section_type) || Dhatu::SectionType.create(title: section.section_type.titleize, code: section.section_type)
8
- section.update_attribute(section_type_id: section_type.id)
9
- end
10
- rescue
11
- end
12
-
13
- remove_column :sections, :section_type
14
- end
15
- end
@@ -1,8 +0,0 @@
1
- class ChangeDefaultStatusOfPromotionEnquiries < ActiveRecord::Migration[5.1]
2
- def up
3
- change_column_default :promotion_enquiries, :status, "new"
4
- end
5
- def down
6
- change_column_default :promotion_enquiries, :status, "unpublished"
7
- end
8
- end
@@ -1,7 +0,0 @@
1
- class AddControlFieldsToPromotions < ActiveRecord::Migration[5.1]
2
- def change
3
- add_column :promotions, :show_popup, :boolean, default: true, :null => false
4
- add_column :promotions, :show_only_on_homepage, :boolean, default: true, :null => false
5
- add_column :promotions, :popup_lifespan_in_minutes, :integer, default: 60, :null => false
6
- end
7
- end
@@ -1,5 +0,0 @@
1
- class AddPageIdToSections < ActiveRecord::Migration[5.1]
2
- def change
3
- add_reference :sections, :page, index: true
4
- end
5
- end
@@ -1,6 +0,0 @@
1
- class AddPriorityToPagesAndSections < ActiveRecord::Migration[5.1]
2
- def change
3
- add_column :pages, :priority, :integer, default: 1000
4
- add_column :sections, :priority, :integer, default: 1000
5
- end
6
- end
@@ -1,34 +0,0 @@
1
- class AddATonOfBooleanFieldsToSections < ActiveRecord::Migration[5.1]
2
- def change
3
- add_column :sections, :enable_title, :boolean, default: false
4
- add_column :sections, :enable_sub_title, :boolean, default: false
5
- add_column :sections, :enable_short_description, :boolean, default: false
6
- add_column :sections, :enable_long_description, :boolean, default: false
7
- add_column :sections, :enable_button_one, :boolean, default: false
8
- add_column :sections, :enable_button_two, :boolean, default: false
9
- add_column :sections, :enable_cover_image, :boolean, default: false
10
- add_column :sections, :enable_gallery_images, :boolean, default: false
11
-
12
- begin
13
- Dhatu::Section.all.each do |section|
14
- section.enable_title = !section.title.blank?
15
- section.enable_sub_title = !section.sub_title.blank?
16
- section.enable_short_description = !section.short_description.blank?
17
- section.enable_long_description = !section.long_description.blank?
18
- section.enable_button_one = !section.button_one_text.blank?
19
- section.enable_button_two = !section.button_two_text.blank?
20
- section.enable_cover_image = !section.cover_image.blank?
21
- section.enable_gallery_images = section.gallery_images.any?
22
- section.save
23
- end
24
- rescue
25
- puts ""
26
- puts ""
27
- puts ""
28
- puts "ERROR in AddATonOfBooleanFieldsToSections".red
29
- puts ""
30
- puts ""
31
- puts ""
32
- end
33
- end
34
- end
@@ -1,19 +0,0 @@
1
- class AddCodeToSections < ActiveRecord::Migration[5.1]
2
- def change
3
- add_column :sections, :code, :string, null: false, limit: 64
4
- begin
5
- Dhatu::Section.all.each do |section|
6
- section.code = section.section_type.code if section.section_type
7
- section.save
8
- end
9
- rescue
10
- puts ""
11
- puts ""
12
- puts ""
13
- puts "ERROR in AddCodeToSections".red
14
- puts ""
15
- puts ""
16
- puts ""
17
- end
18
- end
19
- end
@@ -1,7 +0,0 @@
1
- class RenameMetaDescriptionAllOver < ActiveRecord::Migration[5.1]
2
- def change
3
- rename_column :projects, :meta_description, :short_description
4
- rename_column :services, :meta_description, :short_description
5
- rename_column :blog_posts, :meta_description, :short_description
6
- end
7
- end
@@ -1,19 +0,0 @@
1
- class AddNameToSections < ActiveRecord::Migration[5.1]
2
- def change
3
- add_column :sections, :name, :string, null: false, limit: 64
4
- begin
5
- Dhatu::Section.all.each do |section|
6
- section.name = section.code.titleize.gsub("_", " ") if section.code
7
- section.save
8
- end
9
- rescue
10
- puts ""
11
- puts ""
12
- puts ""
13
- puts "ERROR in AddNameToSections".red
14
- puts ""
15
- puts ""
16
- puts ""
17
- end
18
- end
19
- end
@@ -1,6 +0,0 @@
1
- FactoryBot.define do
2
- factory :section_type, class: Dhatu::SectionType do
3
- name "About Us"
4
- code "ABOUT_US"
5
- end
6
- end