Commit 900cad88420c1f13a2117e5ba7bba4e0d0607afe

Authored by vinicim
Committed by Rafael Manzo
1 parent d405f1a8

link to configuration index is working

app/controllers/mezuro_configurations_controller.rb
1 1 class MezuroConfigurationsController < ApplicationController
  2 +
  3 + def index
  4 + @configurations = KalibroGem::Entities::Configuration.all
  5 + end
2 6  
3 7 def show
4 8 @configuration = MezuroConfiguration.find(params[:id])
... ...
app/views/mezuro_configurations/index.html.erb 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +<div class="page-header">
  2 + <h1>Configurations</h1>
  3 +</div>
  4 +
  5 +<% if user_signed_in? %>
  6 + <p>
  7 + <%= link_to 'New configuration', new_mezuro_configuration_path, class: 'btn btn-primary' %>
  8 + </p>
  9 +<%else%>
  10 + <p class="alert alert-warning alert-dismissable">
  11 + <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
  12 + To create new configurations you must be logged in page.
  13 + </p>
  14 +<% end %>
  15 +
  16 +<%= render partial: 'shared/mezuro_configuration_list', locals: {configurations: @configurations} %>
0 17 \ No newline at end of file
... ...
app/views/shared/_mezuro_configuration_list.html.erb 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +<table class="table table-hover">
  2 + <thead>
  3 + <tr>
  4 + <th>Name</th>
  5 + <th>Description</th>
  6 + <th colspan="2"></th>
  7 + </tr>
  8 + </thead>
  9 +
  10 + <tbody>
  11 + <% configurations.each do |configuration| %>
  12 + <tr>
  13 + <td><%= configuration.name %></td>
  14 + <td><%= configuration.description %></td>
  15 + <td><%= link_to 'Show', mezuro_configuration_path(configuration.id), class: 'btn btn-info' %></td>
  16 + <td>
  17 + <%= link_to 'Edit', edit_mezuro_configuration_path(configuration.id), class: 'btn btn-info' %>
  18 + </td>
  19 + </tr>
  20 + <% end %>
  21 + </tbody>
  22 +</table>
0 23 \ No newline at end of file
... ...