Commit f92dd1dc6812289798ff0040737e6a8eb9c2f0ab
Committed by
Guilherme Rojas
1 parent
80757276
Exists in
colab
and in
4 other branches
Refactored project show
Now the not signed user see a warning message to sign in before create a project Signed-off By: Guilherme Rojas V. de Lima <guilhermehrojas@gmail.com>
Showing
2 changed files
with
14 additions
and
3 deletions
Show diff stats
app/views/projects/index.html.erb
| @@ -2,6 +2,15 @@ | @@ -2,6 +2,15 @@ | ||
| 2 | <h1>Projects</h1> | 2 | <h1>Projects</h1> |
| 3 | </div> | 3 | </div> |
| 4 | 4 | ||
| 5 | -<p><% if user_signed_in? %><%= link_to 'New Project', new_project_path, class: 'btn btn-primary' %><% end %></p> | 5 | +<% if user_signed_in? %> |
| 6 | + <p> | ||
| 7 | + <%= link_to 'New Project', new_project_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">×</button> | ||
| 12 | + To create new projects you must be logged in page. | ||
| 13 | + </p> | ||
| 14 | +<% end %> | ||
| 6 | 15 | ||
| 7 | -<%= render partial: 'shared/project_list', locals: {projects: @projects} %> | 16 | -<%= render partial: 'shared/project_list', locals: {projects: @projects} %> |
| 17 | +<%= render partial: 'shared/project_list', locals: {projects: @projects} %> | ||
| 8 | \ No newline at end of file | 18 | \ No newline at end of file |
features/project/listing.feature
| @@ -3,12 +3,13 @@ Feature: Project listing | @@ -3,12 +3,13 @@ Feature: Project listing | ||
| 3 | As a regular user | 3 | As a regular user |
| 4 | I should have various listings | 4 | I should have various listings |
| 5 | 5 | ||
| 6 | - Scenario: Listing projects | 6 | + Scenario: Listing projects |
| 7 | Given I am at the homepage | 7 | Given I am at the homepage |
| 8 | When I click the Project link | 8 | When I click the Project link |
| 9 | Then I should see "Projects" | 9 | Then I should see "Projects" |
| 10 | And I should see "Name" | 10 | And I should see "Name" |
| 11 | And I should see "Description" | 11 | And I should see "Description" |
| 12 | + And I should see "To create new projects you must be logged in page." | ||
| 12 | 13 | ||
| 13 | @kalibro_restart | 14 | @kalibro_restart |
| 14 | Scenario: Should list the existing projects | 15 | Scenario: Should list the existing projects |
| @@ -17,6 +18,7 @@ Feature: Project listing | @@ -17,6 +18,7 @@ Feature: Project listing | ||
| 17 | And I have a sample project | 18 | And I have a sample project |
| 18 | And I am at the All Projects page | 19 | And I am at the All Projects page |
| 19 | Then the sample project should be there | 20 | Then the sample project should be there |
| 21 | + And I should not see "To create new projects you must be logged in page." | ||
| 20 | 22 | ||
| 21 | @kalibro_restart | 23 | @kalibro_restart |
| 22 | Scenario: Should show the existing project | 24 | Scenario: Should show the existing project |