goals {
message "Your friends recommended two changes for the site:"
goal "Don't show the description on the list page"
goal "Make the title a link and when it's clicked show the description"
}
steps {
step("Remove the description") {
message "Let's start by removing the description. Open `app/views/topics/index.html.erb` and delete the line that looks like this:"
source_code :erb, "<td><%= topic.description %></td>"
message "Also delete the line that looks like this:"
source_code :erb, "<th>Description</th>"
message "If you save and try to load it in the browser you should see that the description no longer appears."
}
step("Make the title a link") {
message "Now make the title a link by editing `app/views/topics/index.html.erb` (again) and replacing this line:"
source_code :erb, "<td><%= topic.title %></td>"
message "with this:"
source_code :erb, "<td><%= link_to topic.title, topic %></td>"
}
}
explanation {
source_code :erb, "<td><%= topic.description %></td>"
message "This line was getting the description using .description and just printing it out."
source_code :erb, "<th>Description</th>"
message "
`<th>` stands for table header and everything between `<th>` and
`</th>` was being printed as a table header (bold). We removed it
since we removed the description and it would look funny to have the
header and the wrong thing below it."
hr
source_code :erb, "<td><%= link_to topic.title, topic %></td>"
message "
Here's another use of `link_to` to create a link on the page. This
`link_to` creates a link using the text from the topic title and goes
to the topic#show page."
}
next_step "clean_up_links_on_the_topics_list"