Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
6592bfbb
Commit
6592bfbb
authored
Dec 23, 2015
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moves star code to a class
parent
7ba4482f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
37 deletions
+27
-37
app/assets/javascripts/star.js.coffee
app/assets/javascripts/star.js.coffee
+22
-0
app/views/projects/_home_panel.html.haml
app/views/projects/_home_panel.html.haml
+3
-0
app/views/projects/buttons/_star.html.haml
app/views/projects/buttons/_star.html.haml
+0
-35
features/steps/project/create.rb
features/steps/project/create.rb
+2
-2
No files found.
app/assets/javascripts/star.js.coffee
0 → 100644
View file @
6592bfbb
class
@
Star
constructor
:
->
$
(
'.project-home-panel .toggle-star'
).
on
(
'ajax:success'
,
(
e
,
data
,
status
,
xhr
)
->
$this
=
$
(
this
)
$starSpan
=
$this
.
find
(
'span'
)
$starIcon
=
$this
.
find
(
'i'
)
toggleStar
=
(
isStarred
)
->
$this
.
parent
().
find
(
'span.count'
).
text
data
.
star_count
if
isStarred
$starSpan
.
removeClass
(
'starred'
).
text
'Star'
$starIcon
.
removeClass
(
'fa-star'
).
addClass
'fa-star-o'
else
$starSpan
.
addClass
(
'starred'
).
text
'Unstar'
$starIcon
.
removeClass
(
'fa-star-o'
).
addClass
'fa-star'
return
toggleStar
$starSpan
.
hasClass
(
'starred'
)
return
).
on
'ajax:error'
,
(
e
,
xhr
,
status
,
error
)
->
new
Flash
(
'Star toggle failed. Try again later.'
,
'alert'
)
return
\ No newline at end of file
app/views/projects/_home_panel.html.haml
View file @
6592bfbb
...
@@ -38,3 +38,6 @@
...
@@ -38,3 +38,6 @@
=
render
'projects/buttons/dropdown'
=
render
'projects/buttons/dropdown'
=
render
'projects/buttons/notifications'
=
render
'projects/buttons/notifications'
:coffeescript
new Star()
\ No newline at end of file
app/views/projects/buttons/_star.html.haml
View file @
6592bfbb
...
@@ -11,41 +11,6 @@
...
@@ -11,41 +11,6 @@
%span
.count.star-count
%span
.count.star-count
=
@project
.
star_count
=
@project
.
star_count
:javascript
$
(
'
.project-home-panel .toggle-star
'
).
on
(
'
ajax:success
'
,
function
(
e
,
data
,
status
,
xhr
)
{
var
$this
=
$
(
this
);
var
$starSpan
=
$this
.
find
(
'
span
'
);
var
$starIcon
=
$this
.
find
(
'
i
'
);
var
toggleStar
=
function
(
isStarred
)
{
$this
.
parent
()
.
find
(
'
span.count
'
)
.
text
(
data
.
star_count
);
if
(
isStarred
){
$starSpan
.
removeClass
(
'
starred
'
)
.
text
(
'
Star
'
);
$starIcon
.
removeClass
(
'
fa-star
'
)
.
addClass
(
'
fa-star-o
'
);
}
else
{
$starSpan
.
addClass
(
'
starred
'
)
.
text
(
'
Unstar
'
);
$starIcon
.
removeClass
(
'
fa-star-o
'
)
.
addClass
(
'
fa-star
'
);
}
};
toggleStar
(
$starSpan
.
hasClass
(
'
starred
'
));
})
.
on
(
'
ajax:error
'
,
function
(
e
,
xhr
,
status
,
error
)
{
new
Flash
(
'
Star toggle failed. Try again later.
'
,
'
alert
'
);
});
-
else
-
else
=
link_to
new_user_session_path
,
class:
'btn has_tooltip star-btn'
,
title:
'You must sign in to star a project'
do
=
link_to
new_user_session_path
,
class:
'btn has_tooltip star-btn'
,
title:
'You must sign in to star a project'
do
=
icon
(
'star fw'
)
=
icon
(
'star fw'
)
...
...
features/steps/project/create.rb
View file @
6592bfbb
...
@@ -31,7 +31,7 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
...
@@ -31,7 +31,7 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
end
end
step
'Remote url should update to http link'
do
step
'Remote url should update to http link'
do
expect
(
page
).
to
have_content
Project
.
last
.
http_url_to_repo
expect
(
page
).
to
have_content
"git remote add origin
#{
Project
.
last
.
http_url_to_repo
}
"
end
end
step
'If I click on SSH'
do
step
'If I click on SSH'
do
...
@@ -40,6 +40,6 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
...
@@ -40,6 +40,6 @@ class Spinach::Features::ProjectCreate < Spinach::FeatureSteps
end
end
step
'Remote url should update to ssh link'
do
step
'Remote url should update to ssh link'
do
expect
(
page
).
to
have_content
Project
.
last
.
ssh_url_to_repo
expect
(
page
).
to
have_content
"git remote add origin
#{
Project
.
last
.
url_to_repo
}
"
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment