BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
011a7a32
Commit
011a7a32
authored
Dec 18, 2015
by
Jacob Schatz
Committed by
Jacob Schatz
Dec 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adds starring and unstarring text to star button, also adds partial new styles
parent
7b50ab5c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
projects.scss
app/assets/stylesheets/pages/projects.scss
+4
-1
projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
_star.html.haml
app/views/projects/buttons/_star.html.haml
+17
-2
No files found.
app/assets/stylesheets/pages/projects.scss
View file @
011a7a32
...
...
@@ -115,7 +115,6 @@
margin-left
:
4px
;
.arrow
{
&
:before
{
content
:
''
;
display
:
inline-block
;
...
...
@@ -165,6 +164,10 @@
background-image
:
none
;
white-space
:
nowrap
;
margin
:
0
11px
0px
4px
;
&
:hover
{
background
:
#FFF
;
}
}
}
}
...
...
app/controllers/projects_controller.rb
View file @
011a7a32
...
...
@@ -171,7 +171,7 @@ class ProjectsController < ApplicationController
@project
.
reload
render
json:
{
html:
view_to_html_string
(
"projects/buttons/_star"
)
star_count:
@project
.
star_count
}
end
...
...
app/views/projects/buttons/_star.html.haml
View file @
011a7a32
-
if
current_user
=
link_to
toggle_star_namespace_project_path
(
@project
.
namespace
,
@project
),
class:
'btn star-btn toggle-star has_tooltip'
,
method: :post
,
remote:
true
,
title:
"Star project"
do
=
icon
(
'star fw'
)
Star
-
if
current_user
.
starred?
(
@project
)
%span
.starred
Unstar
-
else
%span
Star
%div
.count-with-arrow
%span
.arrow
%span
.count
...
...
@@ -9,7 +12,19 @@
:javascript
$
(
'.project-home-panel .toggle-star'
).
on
(
'ajax:success'
,
function
(
e
,
data
,
status
,
xhr
)
{
$
(
this
).
replaceWith
(
data
.
html
);
var
$this
=
$
(
this
);
var
$starSpan
=
$this
.
find
(
'span'
);
$this
.
parent
()
.
find
(
'span.count'
)
.
text
(
data
.
star_count
);
if
(
$starSpan
.
hasClass
(
'starred'
)){
$starSpan
.
removeClass
(
'starred'
);
$starSpan
.
text
(
'Star'
);
}
else
{
$starSpan
.
addClass
(
'starred'
);
$starSpan
.
text
(
'Unstar'
);
}
})
.
on
(
'ajax:error'
,
function
(
e
,
xhr
,
status
,
error
)
{
new
Flash
(
'Star toggle failed. Try again later.'
,
'alert'
);
...
...
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