Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
011a7a32
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
011a7a32
编写于
12月 18, 2015
作者:
J
Jacob Schatz
提交者:
Jacob Schatz
12月 23, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adds starring and unstarring text to star button, also adds partial new styles
上级
7b50ab5c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
4 deletion
+22
-4
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+4
-1
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/views/projects/buttons/_star.html.haml
app/views/projects/buttons/_star.html.haml
+17
-2
未找到文件。
app/assets/stylesheets/pages/projects.scss
浏览文件 @
011a7a32
...
@@ -115,7 +115,6 @@
...
@@ -115,7 +115,6 @@
margin-left
:
4px
;
margin-left
:
4px
;
.arrow
{
.arrow
{
&
:before
{
&
:before
{
content
:
''
;
content
:
''
;
display
:
inline-block
;
display
:
inline-block
;
...
@@ -165,6 +164,10 @@
...
@@ -165,6 +164,10 @@
background-image
:
none
;
background-image
:
none
;
white-space
:
nowrap
;
white-space
:
nowrap
;
margin
:
0
11px
0px
4px
;
margin
:
0
11px
0px
4px
;
&
:hover
{
background
:
#FFF
;
}
}
}
}
}
}
}
...
...
app/controllers/projects_controller.rb
浏览文件 @
011a7a32
...
@@ -171,7 +171,7 @@ class ProjectsController < ApplicationController
...
@@ -171,7 +171,7 @@ class ProjectsController < ApplicationController
@project
.
reload
@project
.
reload
render
json:
{
render
json:
{
html:
view_to_html_string
(
"projects/buttons/_star"
)
star_count:
@project
.
star_count
}
}
end
end
...
...
app/views/projects/buttons/_star.html.haml
浏览文件 @
011a7a32
-
if
current_user
-
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
=
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'
)
=
icon
(
'star fw'
)
Star
-
if
current_user
.
starred?
(
@project
)
%span
.starred
Unstar
-
else
%span
Star
%div
.count-with-arrow
%div
.count-with-arrow
%span
.arrow
%span
.arrow
%span
.count
%span
.count
...
@@ -9,7 +12,19 @@
...
@@ -9,7 +12,19 @@
:javascript
:javascript
$
(
'
.project-home-panel .toggle-star
'
).
on
(
'
ajax:success
'
,
function
(
e
,
data
,
status
,
xhr
)
{
$
(
'
.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
)
{
.
on
(
'
ajax:error
'
,
function
(
e
,
xhr
,
status
,
error
)
{
new
Flash
(
'
Star toggle failed. Try again later.
'
,
'
alert
'
);
new
Flash
(
'
Star toggle failed. Try again later.
'
,
'
alert
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录