From 478ef5e4e35a0f7fa11bcdbd6d4e682c8bdae1ae Mon Sep 17 00:00:00 2001 From: Renan Fichberg Date: Wed, 15 Jan 2014 18:17:01 -0200 Subject: [PATCH] Edit view for reading group --- app/views/reading_groups/show.html.erb | 34 +++++++++++++++++----------------- features/reading_group/show.feature | 12 ++++++++++++ features/step_definitions/reading_group_steps.rb | 10 ++++++++++ 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/app/views/reading_groups/show.html.erb b/app/views/reading_groups/show.html.erb index 62cedaa..d06ff9f 100644 --- a/app/views/reading_groups/show.html.erb +++ b/app/views/reading_groups/show.html.erb @@ -11,22 +11,21 @@

Readings

-<% if reading_group_owner? @reading_group.id %><%= link_to 'New Reading', new_reading_group_reading_path(@reading_group,), class: 'btn btn-primary' %><% end %> +<% if reading_groups_owner? @reading_group.id %><%= link_to 'New Reading', new_reading_group_reading_path(@reading_group,), class: 'btn btn-primary' %><% end %> - - - - + + + <% if @reading_group_readings.size == 0 %> - <% col_number = reading_group_owner?(@reading_group.id) ? 4 : 3 %> + <% col_number = reading_groups_owner?(@reading_group.id) ? 5 : 3 %> <% end %> @@ -34,15 +33,16 @@ - - - - + + <% if reading_groups_owner? @reading_group.id %> + + + + <% end %> <% end %> @@ -51,7 +51,7 @@

- <% if project_owner? @project.id %> - <%= link_to 'Destroy project', project_path(@project.id), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %> + <% if reading_groups_owner? @reading_group.id %> + <%= link_to 'Destroy reading group', reading_group_path(@reading_group.id), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %> <% end %>

diff --git a/features/reading_group/show.feature b/features/reading_group/show.feature index 5be7866..72f03e7 100644 --- a/features/reading_group/show.feature +++ b/features/reading_group/show.feature @@ -12,3 +12,15 @@ Scenario: Should not show the create reading link to user that doesn't own the r Then I should not see New Reading And I should not see Destroy reading group And I should not see Edit + +@kalibro_restart @wip +Scenario: Should show the create reading link to user that do own the reading group + Given I am a regular user + And I own a sample reading group + And I have a sample reading within the sample reading group + When I visit the Sample Reading Group page + Then I should be in the Sample Reading Group page + And I should see "Destroy" + And I should see "Edit" + And I should see "Destroy reading group" + And I should see "New reading group" \ No newline at end of file diff --git a/features/step_definitions/reading_group_steps.rb b/features/step_definitions/reading_group_steps.rb index 08f1fb2..91940da 100644 --- a/features/step_definitions/reading_group_steps.rb +++ b/features/step_definitions/reading_group_steps.rb @@ -9,7 +9,17 @@ Given(/^I have a sample reading group$/) do @reading_group = FactoryGirl.create(:reading_group, {id: nil}) end +Given(/^I visit the Sample Reading Group page$/) do + visit reading_group_path(@reading_group.id) +end + When(/^I am at the Sample Reading Group page$/) do + p @reading_group page.should have_content(@reading_group.name) page.should have_content(@reading_group.description) end + +Then(/^I should be in the Sample Reading Group page$/) do + page.should have_content(@reading_group.name) + page.should have_content(@reading_group.description) +end \ No newline at end of file -- libgit2 0.21.2
NameTypeAddressLabelGradeColor
There are no readings yet!
<%= reading.label %> <%= reading.grade %><%= reading.color %> - <% if reading_group_owner? @reading_group.id %> - <%= link_to 'Edit', edit_project_repository_path(@project, repository.id), class: 'btn btn-info' %> - <% end %> - - <%= link_to 'Show', project_repository_path(@project, repository.id), class: 'btn btn-info' %>  + <%= link_to 'Edit', edit_reading_group_reading_path(@reading_group.id, reading.id), class: 'btn btn-info' %> + + <%= link_to 'Destroy', reading_group_reading_path(@reading_group.id, reading.id), method: :delete, data: { confirm: 'Are you sure that you want to destroy this reading?' }, class: 'btn btn-danger' %> +