2022-07-18 10:47:54 +02:00
# Create tenant
tenant = Tenant . create (
site_name : 'Default site name' ,
subdomain : 'default' ,
status : 'active'
)
Current . tenant = tenant
2019-08-24 13:35:01 +02:00
# Create an admin user and confirm its email automatically
2023-01-18 21:11:27 +01:00
owner = User . create (
2019-09-23 18:41:38 +02:00
full_name : 'Admin' ,
email : 'admin@example.com' ,
password : 'password' ,
2023-01-18 21:11:27 +01:00
role : 'owner' ,
2019-09-23 18:41:38 +02:00
confirmed_at : Time . zone . now
)
2019-08-24 13:35:01 +02:00
2019-08-25 11:26:28 +02:00
# Create some boards
2022-05-08 16:36:35 +02:00
feature_board = Board . create (
name : 'Feature Requests' ,
2022-07-18 10:47:54 +02:00
description : 'This is a **board**! You can create as many as you want from **site settings** and their description can be *Markdown formatted*.' ,
2022-05-08 16:36:35 +02:00
order : 0
)
bug_board = Board . create (
name : 'Bug Reports' ,
description : 'Tell us everything about problems you encountered in our services!' ,
order : 1
)
2019-08-24 13:35:01 +02:00
# Create some post statuses
2022-05-08 16:36:35 +02:00
planned_post_status = PostStatus . create (
name : 'Planned' ,
color : '#0096ff' ,
order : 0 ,
show_in_roadmap : true
)
in_progress_post_status = PostStatus . create (
name : 'In Progress' ,
color : '#9437ff' ,
order : 1 ,
show_in_roadmap : true
)
completed_post_status = PostStatus . create (
name : 'Completed' ,
color : '#6ac47c' ,
order : 2 ,
show_in_roadmap : true
)
rejected_post_status = PostStatus . create (
name : 'Rejected' ,
color : '#ff2600' ,
order : 3 ,
show_in_roadmap : false
)
2019-08-24 13:35:01 +02:00
2019-08-25 11:26:28 +02:00
# Create some posts
2019-09-16 18:02:52 +02:00
post1 = Post . create (
2022-07-18 10:47:54 +02:00
title : 'Users can submit feedback by publishing posts!' ,
description : 'You can assign a **status** to each post: this one, for example, is marked as "Planned". Remember that you can customise post statuses from Site settings > Statuses' ,
2019-08-25 11:26:28 +02:00
board_id : feature_board . id ,
2023-01-18 21:11:27 +01:00
user_id : owner . id ,
2022-07-18 10:47:54 +02:00
post_status_id : planned_post_status . id
2019-08-25 11:26:28 +02:00
)
2022-07-18 10:47:54 +02:00
PostStatusChange . create (
post_id : post1 . id ,
2023-01-18 21:11:27 +01:00
user_id : owner . id ,
2019-08-25 11:26:28 +02:00
post_status_id : planned_post_status . id
)
2022-07-18 10:47:54 +02:00
post2 = Post . create (
2019-08-25 11:26:28 +02:00
title : 'There are multiple boards' ,
2022-07-18 10:47:54 +02:00
description : 'For now you have Feature Requests and Bug Reports, but you can add or remove as many as you want! Just go to Site settings > Boards!' ,
2019-08-25 11:26:28 +02:00
board_id : bug_board . id ,
2023-01-18 21:11:27 +01:00
user_id : owner . id
2019-08-25 11:26:28 +02:00
)
2022-07-18 10:47:54 +02:00
# # Create some comments
post1 . comments . create (
body : 'Users can comment to express their opinions! As with posts and board descriptions, comments can be *Markdown* **formatted**' ,
2023-01-18 21:11:27 +01:00
user_id : owner . id
2022-07-18 10:47:54 +02:00
)
2019-09-16 18:02:52 +02:00
2019-08-25 11:26:28 +02:00
# Let the user know how to log in with admin account
2022-07-18 10:47:54 +02:00
puts " A default tenant has been created with name #{ tenant . site_name } "
2019-08-25 11:26:28 +02:00
puts 'A default admin account has been created. Credentials:'
2023-01-18 21:11:27 +01:00
puts " -> email: #{ owner . email } "
puts " -> password: #{ owner . password } "