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
constructor: ->
$("a[data-toggle='tab']").on "shown.bs.tab", (e) ->
$.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"
# I kept class for future
- 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)
Unstar
- else
Star
%span.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) ->
$(@).replaceWith(data.html)
.on 'ajax:error', (e, xhr, status, error) ->
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 @@
= render_readme(readme)
- else
%h3.page-title
This project does not have README yet :(
This project does not have README yet
- if can?(current_user, :push_code, @project)
%p.slead
A
......
......@@ -189,6 +189,7 @@ Feature: Project Issues
Given I logout
Given public project "Community"
When I visit project "Community" page
And I visit project "Community" issues page
And I click link "New Issue"
And I should not see assignee field
And I should not see milestone field
......
......@@ -53,6 +53,5 @@ Feature: Project Shortcuts
@javascript
Scenario: Navigate to project feed
Given I visit my project's files page
Given I press "g" and "e"
Then the active main tab should be Activity
......@@ -194,6 +194,11 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
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
project = Project.find_by(name: 'Empty Project')
visit namespace_project_issues_path(project.namespace, project)
......
......@@ -5,7 +5,7 @@ class Spinach::Features::ProjectStar < Spinach::FeatureSteps
include SharedUser
step "The project has no stars" do
expect(page).not_to have_content '.star-buttons'
expect(page).not_to have_content '.toggle-star'
end
step "The project has 0 stars" do
......
......@@ -49,4 +49,8 @@ module SharedProjectTab
expect(page).to have_content('Back to project')
end
end
step 'the active main tab should be Activity' do
ensure_active_main_tab('Activity')
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