diff options
| author | mo khan <mo@mokhan.ca> | 2015-03-18 21:01:10 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2015-03-18 21:01:10 -0600 |
| commit | c38947dcaec2e63ab40b133d34919872e398aaf2 (patch) | |
| tree | 5481d83686ea7afc1c4949bc7949c3911709ad18 | |
| parent | 3fce3d05fec51e2cc2f8df41945715830e294bf1 (diff) | |
upgrade tutorials page.
| -rw-r--r-- | app/controllers/tutorials_controller.rb | 2 | ||||
| -rw-r--r-- | app/views/tutorials/index.html.erb | 28 |
2 files changed, 14 insertions, 16 deletions
diff --git a/app/controllers/tutorials_controller.rb b/app/controllers/tutorials_controller.rb index 3fc46c52..caa1e4a4 100644 --- a/app/controllers/tutorials_controller.rb +++ b/app/controllers/tutorials_controller.rb @@ -1,6 +1,6 @@ class TutorialsController < ApplicationController def index - @tutorials = Tutorial.search(params[:q]).page(page).per(per_page) + @tutorials = Tutorial.search(params[:q]).includes([:tags]).page(page).per(per_page) end def show diff --git a/app/views/tutorials/index.html.erb b/app/views/tutorials/index.html.erb index c355917e..0659662e 100644 --- a/app/views/tutorials/index.html.erb +++ b/app/views/tutorials/index.html.erb @@ -1,22 +1,20 @@ <%= provide(:search_path, tutorials_path) %> <% provide(:container_class, 'container-fluid') %> <div class="row-fluid"> - <% @tutorials.each_slice(6).each do |batch| %> - <ul class='thumbnails'> - <% batch.each do |tutorial| %> - <li class="span2"> - <div class="thumbnail"> - <%= link_to tutorial do %> - <%= image_tag tutorial.image_url, width: 240 %> + <table class='table'> + <% @tutorials.each do |tutorial| %> + <tr> + <td> + <h4><a href="<%= tutorial.url %>" target="_blank"><%= tutorial.heading %></a> <small><%= tutorial.created_at.to_s :foomat %></small></h4> + <% tutorial.tags.each do |tag| -%> + <%= link_to tutorial_tag_path(tag.name) do %> + <span class="label"><%= tag.name %></span> <% end %> - <div class="caption"> - <small><%= link_to truncate(tutorial.heading, length: 20), tutorial %></small> - </div> - </div> - </li> - <% end %> - </ul> - <% end %> + <% end -%> + </td> + </tr> + <% end %> + </table> </div> <div class="row-fluid"> <%= render "shared/paging", items: @tutorials %> |
