goals {
message "Our app is nearly done! The main topics listing page is pretty busy. There are a lot of links that aren't necessary."
message "Let's clean up the topics list page by doing the following:"
goal "Remove the 'show' link"
goal "Remove the 'edit' link"
goal "Change 'destroy' to 'delete'"
}
steps {
step "Remove the 'show' and 'edit' links" do
message "Open `app/views/topics/index.html.erb` and remove these two lines:"
source_code :erb, <<-HTML
<td><%= link_to 'Show', topic %></td>
<td><%= link_to 'Edit', edit_topic_path(topic) %></td>
HTML
end
step "Change 'destroy' to 'delete'" do
message "Change the line with the word 'Destroy' to this:"
source_code :erb, "<td><%= link_to 'Delete', topic, method: :delete, data: { confirm: 'Are you sure?' } %></td>"
end
step "Confirm your changes" do
message "Now save your file and try reloading in your browser to see the changes."
end
}
explanation {
message <<-MARKDOWN
* The two links we removed were show and edit. We did this because the title now links to the show page and from the show page you can reach the edit page.
* The second change we made was to make the link text 'Delete' instead of destroy.
MARKDOWN
}
tip {
message <<-MARKDOWN
## Three key words
Find a partner and decide on three key words from this section. Write each word down on a sticky note, then put them all on a bit of paper.
If some of the words made you frown, wave at a teacher and talk to them about it.
MARKDOWN
}
insert 'consider_deploying'
next_step 'credits_and_next_steps'