Commit 39a4bb2a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Cleanup and some test fixes after refactoring project home page

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent bd08ac55
class @ProjectShow class @ProjectShow
constructor: -> constructor: ->
$("a[data-toggle='tab']").on "shown.bs.tab", (e) -> # I kept class for future
$.cookie "default_view", $(e.target).attr("href"), { expires: 30, path: '/' }
defaultView = $.cookie("default_view")
if defaultView
$("a[href=" + defaultView + "]").tab "show"
else
$("a[data-toggle='tab']:first").tab "show"
- if current_user - if current_user
= link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn toggle-star', method: :post, remote: true do = link_to toggle_star_namespace_project_path(@project.namespace, @project), class: 'btn star-btn toggle-star', method: :post, remote: true do
- if current_user.starred?(@project) - if current_user.starred?(@project)
Unstar Unstar
- else - else
Star Star
%span.count %span.count
= @project.star_count = @project.star_count
- else
= link_to new_user_session_path, class: 'btn has_tooltip', title: 'You must sign in to star a project' do
= icon('star')
Star
%span.count
= @project.star_count
:coffeescript :coffeescript
$('.project-home-panel .toggle-star').on 'ajax:success', (e, data, status, xhr) -> $('.project-home-panel .toggle-star').on 'ajax:success', (e, data, status, xhr) ->
$(@).replaceWith(data.html) $(@).replaceWith(data.html)
.on 'ajax:error', (e, xhr, status, error) -> .on 'ajax:error', (e, xhr, status, error) ->
new Flash('Star toggle failed. Try again later.', 'alert') new Flash('Star toggle failed. Try again later.', 'alert')
- else
= link_to new_user_session_path, class: 'btn has_tooltip star-btn', title: 'You must sign in to star a project' do
= icon('star')
Star
%span.count
= @project.star_count
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
= render_readme(readme) = render_readme(readme)
- else - else
%h3.page-title %h3.page-title
This project does not have README yet :( This project does not have README yet
- if can?(current_user, :push_code, @project) - if can?(current_user, :push_code, @project)
%p.slead %p.slead
A A
......
...@@ -189,6 +189,7 @@ Feature: Project Issues ...@@ -189,6 +189,7 @@ Feature: Project Issues
Given I logout Given I logout
Given public project "Community" Given public project "Community"
When I visit project "Community" page When I visit project "Community" page
And I visit project "Community" issues page
And I click link "New Issue" And I click link "New Issue"
And I should not see assignee field And I should not see assignee field
And I should not see milestone field And I should not see milestone field
......
...@@ -53,6 +53,5 @@ Feature: Project Shortcuts ...@@ -53,6 +53,5 @@ Feature: Project Shortcuts
@javascript @javascript
Scenario: Navigate to project feed Scenario: Navigate to project feed
Given I visit my project's files page
Given I press "g" and "e" Given I press "g" and "e"
Then the active main tab should be Activity Then the active main tab should be Activity
...@@ -194,6 +194,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -194,6 +194,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end end
end end
When "I visit project \"Community\" issues page" do
project = Project.find_by(name: 'Community')
visit namespace_project_issues_path(project.namespace, project)
end
When "I visit empty project's issues page" do When "I visit empty project's issues page" do
project = Project.find_by(name: 'Empty Project') project = Project.find_by(name: 'Empty Project')
visit namespace_project_issues_path(project.namespace, project) visit namespace_project_issues_path(project.namespace, project)
......
...@@ -5,7 +5,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps ...@@ -5,7 +5,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps
include SharedUser include SharedUser
step "The project has no stars" do step "The project has no stars" do
expect(page).not_to have_content '.star-buttons' expect(page).not_to have_content '.toggle-star'
end end
step "The project has 0 stars" do step "The project has 0 stars" do
......
...@@ -49,4 +49,8 @@ module SharedProjectTab ...@@ -49,4 +49,8 @@ module SharedProjectTab
expect(page).to have_content('Back to project') expect(page).to have_content('Back to project')
end end
end end
step 'the active main tab should be Activity' do
ensure_active_main_tab('Activity')
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment