title修改、通知的编辑删除、附件下载
This commit is contained in:
parent
631bcd508f
commit
4067a9c4a7
|
@ -21,7 +21,7 @@ class CommentsController < ApplicationController
|
|||
model_object News
|
||||
before_filter :find_model_object, :except => [:reply, :quote]
|
||||
before_filter :find_project_from_association, :except => [:reply, :quote]
|
||||
before_filter :authorize
|
||||
before_filter :authorize, :except => [:destroy]
|
||||
|
||||
def create
|
||||
raise Unauthorized unless @news.commentable?
|
||||
|
|
|
@ -2246,6 +2246,7 @@ class UsersController < ApplicationController
|
|||
|
||||
# 竞赛社区
|
||||
def contest_community
|
||||
@contest_community = "竞赛"
|
||||
shield_contest_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Contest'").map(&:shield_id)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_contest_ids = (@user.favorite_contests.visible.where("is_delete = 0").map{|contest| contest.id}-shield_contest_ids).empty? ? "(-1)" : "(" + (@user.favorite_contests.visible.map{|contest| contest.id}-shield_contest_ids).join(",") + ")"
|
||||
|
|
|
@ -1317,6 +1317,8 @@ module ApplicationHelper
|
|||
title << @project.name
|
||||
elsif @course
|
||||
title << @course.name
|
||||
elsif @contest
|
||||
title << @contest.name
|
||||
elsif @organization
|
||||
title << @organization.name
|
||||
elsif @user
|
||||
|
@ -1324,6 +1326,8 @@ module ApplicationHelper
|
|||
title << @project_community
|
||||
elsif !@course_community.blank?
|
||||
title << @course_community
|
||||
elsif !@contest_community.blank?
|
||||
title << @contest_community
|
||||
else
|
||||
title << @user.try(:realname)
|
||||
end
|
||||
|
@ -2442,6 +2446,12 @@ module ApplicationHelper
|
|||
candown = true
|
||||
elsif attachment.container.class.to_s=="StudentWork"
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="Contest"
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="Work"
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="ContestantWork"
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="BlogComment" #博客资源允许下载
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="Memo" #论坛资源允许下载
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
:class => 'fr mr20 undis',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if ((object.kind_of? Organization) ? User.current.allowed_to?(:manage_news, object) : (User.current.admin_of_org?(object) || User.current == comment.author)) %>
|
||||
) if ((object.kind_of? Organization) ? (User.current.admin_of_org?(object) || User.current == comment.author) : (User.current.allowed_to?(:manage_news, object) || User.current == comment.author || User.current.admin_of_contest?(object))) %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
</span>
|
||||
<% news = News.find(activity_id) %>
|
||||
<%= link_to('删除', {:controller => 'comments', :action => 'destroy', :id => activity_id, :comment_id => comment, :user_activity_id => user_activity_id},
|
||||
:id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) if (User.current.allowed_to?(:manage_news, news.course) || User.current.allowed_to?(:manage_news, news.project)) %>
|
||||
:id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) if (User.current.allowed_to?(:manage_news, news.course) || User.current.allowed_to?(:manage_news, news.project) || User.current == comment.author || User.current.admin_of_contest?(news.contest)) %>
|
||||
<% elsif type == 'Issue' %>
|
||||
<span style="position: relative" class="fr mr20">
|
||||
<%= link_to(
|
||||
|
|
Loading…
Reference in New Issue