Commit b42c9613f46f03eb8d22fefc3257eb4410056dcb
Committed by
Rafael Manzo
1 parent
4dba87a9
Exists in
colab
and in
4 other branches
Creating reading group views.
Signed-off-by: Fellipe Souto <fllsouto@gmail.com> Signed-off-by: Renan Fichberg <rfichberg@gmail.com>
Showing
9 changed files
with
89 additions
and
2 deletions
Show diff stats
app/views/layouts/application.html.erb
| @@ -59,6 +59,7 @@ | @@ -59,6 +59,7 @@ | ||
| 59 | <ul class="nav"> | 59 | <ul class="nav"> |
| 60 | <li><%= link_to 'Home', root_path %></li> | 60 | <li><%= link_to 'Home', root_path %></li> |
| 61 | <li><%= link_to 'Project', projects_path %></li> | 61 | <li><%= link_to 'Project', projects_path %></li> |
| 62 | + <li><%= link_to 'Reading Group', reading_groups_path %></li> | ||
| 62 | </ul> | 63 | </ul> |
| 63 | <ul class="nav" style="float: right;"> | 64 | <ul class="nav" style="float: right;"> |
| 64 | <% if user_signed_in? %> | 65 | <% if user_signed_in? %> |
| @@ -0,0 +1,57 @@ | @@ -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,7 +4,7 @@ Feature: Show Project | ||
| 4 | I should be able to see each of them | 4 | I should be able to see each of them |
| 5 | 5 | ||
| 6 | @kalibro_restart | 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 | Given I am a regular user | 8 | Given I am a regular user |
| 9 | And I have a sample project | 9 | And I have a sample project |
| 10 | And I have a sample configuration with native metrics | 10 | And I have a sample configuration with native metrics |
| @@ -41,4 +41,4 @@ Scenario: Considering the project has repositories | @@ -41,4 +41,4 @@ Scenario: Considering the project has repositories | ||
| 41 | Scenario: Checking project contents | 41 | Scenario: Checking project contents |
| 42 | Given I have a sample project | 42 | Given I have a sample project |
| 43 | When I am at the Sample Project page | 43 | When I am at the Sample Project page |
| 44 | - Then the sample project should be there | ||
| 45 | \ No newline at end of file | 44 | \ No newline at end of file |
| 45 | + Then the sample project should be there |
| @@ -0,0 +1,14 @@ | @@ -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 |
| @@ -0,0 +1,11 @@ | @@ -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 | + |