* move home link to a customisable navlink * add trailing slash for path * update specs * replace positions, set home link to -1 * add update script for adding home navigation link * update data update script
20 lines
644 B
Ruby
20 lines
644 B
Ruby
module DataUpdateScripts
|
|
class CreateHomeNavigationLink
|
|
def run
|
|
NavigationLink.create_or_update_by_identity(
|
|
name: "Home",
|
|
url: URL.url("/"),
|
|
icon: File.read(Rails.root.join("app/assets/images/twemoji/house.svg")),
|
|
display_only_when_signed_in: false,
|
|
position: 1,
|
|
section: :default,
|
|
)
|
|
|
|
# Increment all other default section links to account for new home link, and update to be 1-based
|
|
NavigationLink.where(section: :default).find_each do |link|
|
|
new_position = link.position + 2
|
|
link.update_columns(position: new_position)
|
|
end
|
|
end
|
|
end
|
|
end
|