1、根据代码评审修改代码。2、修正部分页面标题。
This commit is contained in:
parent
2ed4ace7c9
commit
76bab839c7
|
@ -256,13 +256,16 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def authorize_attachment_download(ctrl = params[:controller], action = params[:action], global = false)
|
||||
if @attachment.container_type == "Memo"
|
||||
case @attachment.container_type
|
||||
when "Memo"
|
||||
allowed = User.current.allowed_to?(:memos_attachments_download,nil,:global => true)
|
||||
elsif @attachment.container_type == "Message" && !@project.nil?
|
||||
when "Message"
|
||||
if @project
|
||||
allowed = User.current.allowed_to?(:projects_attachments_download,@project,:global => false)
|
||||
elsif @attachment.container_type == "Message" && !@course.nil?
|
||||
elsif @course
|
||||
allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
|
||||
elsif @attachment.container_type == "contest"
|
||||
end
|
||||
when "contest"
|
||||
return true
|
||||
else
|
||||
return true
|
||||
|
|
|
@ -402,13 +402,8 @@ class Attachment < ActiveRecord::Base
|
|||
|
||||
# Finds an attachment that matches the given token and that has no container
|
||||
def self.find_by_token(token)
|
||||
if token.to_s =~ /^(\d+)\.([0-9a-f]+)$/
|
||||
attachment_id, attachment_digest = $1, $2
|
||||
attachment = Attachment.where(:id => attachment_id, :digest => attachment_digest).first
|
||||
if attachment && attachment.container.nil?
|
||||
attachment
|
||||
end
|
||||
end
|
||||
attachment = find_by_token_only(token)
|
||||
attachment if attachment.container.nil?
|
||||
end
|
||||
|
||||
# Finds an attachment that matches the given token
|
||||
|
@ -416,9 +411,6 @@ class Attachment < ActiveRecord::Base
|
|||
if token.to_s =~ /^(\d+)\.([0-9a-f]+)$/
|
||||
attachment_id, attachment_digest = $1, $2
|
||||
attachment = Attachment.where(:id => attachment_id, :digest => attachment_digest).first
|
||||
if attachment
|
||||
attachment
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,3 +11,4 @@
|
|||
<%= javascript_tag "$('#course_name').focus();" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% html_title(l(:label_course_new)) -%>
|
|
@ -98,4 +98,4 @@
|
|||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_school_all)) -%>
|
||||
|
|
|
@ -69,3 +69,4 @@
|
|||
}
|
||||
});
|
||||
</script>
|
||||
<% html_title(l(:label_stores_index)) -%>
|
Loading…
Reference in New Issue