进入他人个人主页,TA的项目列表,对不是成员的项目显示申请项目/取消申请

This commit is contained in:
sw 2015-07-30 16:02:41 +08:00
parent 32122796f9
commit 9dde668742
3 changed files with 14 additions and 2 deletions

View File

@ -17,6 +17,8 @@ if (window.Messenger) {
Messenger().post({
id: "label_apply_project_waiting",
message: "<%= l(:label_apply_project_waiting) %>",
showCloseButton: true,
showCloseButton: true
});
};
$("#applied_project_link_<%= @project.id%>").replaceWith("<%= escape_javascript(link_to "加入项目",appliedproject_path(:user_id => User.current.id,:project_id => @project.id,:project_join => true),:class => "blue_n_btn fr mt20", :remote => "true",:method => "post",:id => "applied_project_link_#{@project.id}") %>");

View File

@ -6,6 +6,7 @@
<% elsif @status == 2%>
alert("<%= l('project.join.tips.success') %>");
hideModal($("#popbox"));
$("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>");
<% elsif @status == 3%>
alert("<%= l('project.join.tips.has') %>");
<%else%>

View File

@ -41,7 +41,16 @@
</tbody></table>
</div>
</div>
<a href="<%= url_for(:controller => 'issues', :action=>"new", :project_id=>item.id, :host=>Setting.host_name) %>" target="_blank" class="blue_n_btn fr mt20">发布问题</a>
<% if User.current.member_of? item%>
<a href="<%= url_for(:controller => 'issues', :action=>"new", :project_id=>item.id, :host=>Setting.host_name) %>" target="_blank" class="blue_n_btn fr mt20">发布问题</a>
<% elsif User.current.logged?%>
<% if item.applied_projects.find_by_user_id(User.current.id)%>
<%= link_to '取消申请',appliedproject_applied_path(:project_id => item.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{item.id}"%>
<% else%>
<%= link_to "加入项目",appliedproject_path(:user_id => User.current.id,:project_id => item.id,:project_join => true),:class => "blue_n_btn fr mt20", :remote => "true",:method => "post",:id => "applied_project_link_#{item.id}" %>
<% end%>
<% end%>
<div class="cl"></div>
</div>
<% end %>