Commit b42c9613f46f03eb8d22fefc3257eb4410056dcb

Authored by Diego Camarinha
Committed by Rafael Manzo
1 parent 4dba87a9

Creating reading group views.

Signed-off-by: Fellipe Souto <fllsouto@gmail.com>
Signed-off-by: Renan Fichberg <rfichberg@gmail.com>
app/views/layouts/application.html.erb
... ... @@ -59,6 +59,7 @@
59 59 <ul class="nav">
60 60 <li><%= link_to 'Home', root_path %></li>
61 61 <li><%= link_to 'Project', projects_path %></li>
  62 + <li><%= link_to 'Reading Group', reading_groups_path %></li>
62 63 </ul>
63 64 <ul class="nav" style="float: right;">
64 65 <% if user_signed_in? %>
... ...
app/views/reading_groups/edit.html.erb 0 → 100644
app/views/reading_groups/index.html.erb 0 → 100644
app/views/reading_groups/new.html.erb 0 → 100644
app/views/reading_groups/show.html.erb 0 → 100644
... ... @@ -0,0 +1,57 @@
  1 +<div class="page-header">
  2 + <h1><%= @reading_group.name %></h1>
  3 +</div>
  4 +
  5 +<p>
  6 + <strong>Description:</strong>
  7 + <%= @reading_group.description %>
  8 +</p>
  9 +
  10 +<hr />
  11 +
  12 +<h2>Readings</h2>
  13 +
  14 +<% if reading_group_owner? @reading_group.id %><%= link_to 'New Reading', new_reading_group_reading_path(@reading_group,), class: 'btn btn-primary' %><% end %>
  15 +
  16 +<table class="table table-hover">
  17 + <thead>
  18 + <tr>
  19 + <th>Name</th>
  20 + <th>Type</th>
  21 + <th>Address</th>
  22 + <th colspan="2"></th>
  23 + </tr>
  24 + </thead>
  25 +
  26 + <tbody>
  27 + <% if @reading_group_readings.size == 0 %>
  28 + <tr>
  29 + <% col_number = reading_group_owner?(@reading_group.id) ? 4 : 3 %>
  30 + <td colspan="<%= col_number %>">There are no readings yet!</td>
  31 + </tr>
  32 + <% end %>
  33 + <% @reading_group_readings.each do |reading| %>
  34 + <tr>
  35 + <td><%= reading.label %></td>
  36 + <td><%= reading.grade %></td>
  37 + <td><%= reading.color %></td>
  38 + <td>
  39 + <% if reading_group_owner? @reading_group.id %>
  40 + <%= link_to 'Edit', edit_project_repository_path(@project, repository.id), class: 'btn btn-info' %>
  41 + <% end %>
  42 + </td>
  43 + <td>
  44 + <%= link_to 'Show', project_repository_path(@project, repository.id), class: 'btn btn-info' %></td>
  45 + </td>
  46 + </tr>
  47 + <% end %>
  48 + </tbody>
  49 +</table>
  50 +
  51 +<hr />
  52 +
  53 +<p>
  54 + <% if project_owner? @project.id %>
  55 + <%= link_to 'Destroy project', project_path(@project.id), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %>
  56 + <% end %>
  57 +</p>
... ...
features/project/show.feature
... ... @@ -4,7 +4,7 @@ Feature: Show Project
4 4 I should be able to see each of them
5 5  
6 6 @kalibro_restart
7   -Scenario: Should not show the create repository link to user that doesn't own the projetct
  7 +Scenario: Should not show the create repository link to user that doesn't own the project
8 8 Given I am a regular user
9 9 And I have a sample project
10 10 And I have a sample configuration with native metrics
... ... @@ -41,4 +41,4 @@ Scenario: Considering the project has repositories
41 41 Scenario: Checking project contents
42 42 Given I have a sample project
43 43 When I am at the Sample Project page
44   - Then the sample project should be there
45 44 \ No newline at end of file
  45 + Then the sample project should be there
... ...
features/reading_group/show.feature 0 → 100644
... ... @@ -0,0 +1,14 @@
  1 +Feature: Show Reading Group
  2 + In order to know all the readings of the given reading group and its contents
  3 + As a regular user
  4 + I should be able to see each of them
  5 +
  6 +@kalibro_restart @wip
  7 +Scenario: Should not show the create reading link to user that doesn't own the reading group
  8 + Given I am a regular user
  9 + And I have a sample reading group
  10 + And I have a sample reading within the sample reading group
  11 + When I am at the Sample Reading Group page
  12 + Then I should not see New Reading
  13 + And I should not see Destroy reading group
  14 + And I should not see Edit
... ...
features/step_definitions/reading_group_steps.rb 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +require 'kalibro_gem/errors'
  2 +
  3 +Given(/^I have a sample reading group$/) do
  4 + @reading_group = FactoryGirl.create(:reading_group, {id: nil})
  5 +end
  6 +
  7 +When(/^I am at the Sample Reading Group page$/) do
  8 + page.should have_content(@reading_group.name)
  9 + page.should have_content(@reading_group.description)
  10 +end
  11 +
... ...
features/step_definitions/reading_steps.rb 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +Given(/^I have a sample reading within the sample reading group$/) do
  2 + @reading = FactoryGirl.create(:reading, {group_id: @reading_group.id, id: nil})
  3 +end
  4 +
... ...