项目收藏结构修改

This commit is contained in:
huang 2016-10-25 14:05:07 +08:00
parent 8d53893a9b
commit 2702b5a197
5 changed files with 15 additions and 16 deletions

View File

@ -886,14 +886,14 @@ module ApplicationHelper
# 项目版本库可见权限判断:
# modules中设置可见
# 版本库存在
# 版本库设置了隐藏则仅仅项目成员可见(hidden_repo:1 隐藏版本库)
# 版本库设置了隐藏则仅仅项目成员或超级管理员可见(hidden_repo:1 隐藏版本库)
# return -> true 可见
def visible_repository?(project)
repository = Repository.where(:project_id => project.id, :type => "Repository::Gitlab").first
if project.enabled_modules.where("name = 'repository'").empty? || repository.nil?
result = false
else
result = (project.hidden_repo && !User.current.member_of?(project)) ? false : true
result = (project.hidden_repo && !User.current.admin && !User.current.member_of?(project)) ? false : true
end
end

View File

@ -366,10 +366,10 @@ module WatchersHelper
def store_project_link project_id, user_id
collected = Member.where(:project_id => project_id, :user_id => user_id).first.try(:is_collect)
text = collected == 1 ? l(:label_project_collect) : l(:label_project_collect_cancel)
text = collected == 1 ? l(:label_project_collect_cancel) : l(:label_project_collect)
url = store_mine_project_path(project_id)
method = 'post'
link = link_to(text, url, :remote => true, :method => method, :id => "#{project_id}", :class => "pro_new_topbtn_left fl", :title => "点击将其从个人主页的项目列表中移除")
link = link_to(text, url, :remote => true, :method => method, :id => "#{project_id}", :class => "pro_new_topbtn_left fl", :title => "#{collected == 1 ? '点击将其从个人主页的项目列表中移除' : '点击将其添加至人主页的项目列表中'}")
# link.html_safe
end

View File

@ -3,7 +3,6 @@
<% project_acts = ForgeActivity.where("project_id = ?", @project.id).count %>
<% raodmaps = Version.where("project_id = ?", @project.id).count %>
<% project_score = @project.project_score %>
<% project_modules = @project.enabled_modules.where("name = 'issue_tracking'") %>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @project %>

View File

@ -13,16 +13,6 @@
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</head>
<!--add by huang-->
@ -58,6 +48,16 @@
</div>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
<!-- MathJax的配置 -->
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %>
</html>

View File

@ -17,7 +17,7 @@
<% end %>
<% else %>
<!--项目收藏-->
<% my_stores = Member.where(:project_id => @project.id, :is_collect => 0).count %>
<% my_stores = Member.where(:project_id => @project.id, :is_collect => 1).count %>
<li class="mr5 fl"><%= store_project_link(@project.id, User.current.id) %><%= link_to my_stores, store_mine_project_path(@project), :class => "pro_new_topbtn fl" %></li>
<!--项目创建者不能退出项目-->
<% if User.current.id != @project.user_id %>