Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
0f4933240b
3
Gemfile
3
Gemfile
|
@ -27,6 +27,7 @@ group :test do
|
||||||
gem "mocha", "~> 0.13.3"
|
gem "mocha", "~> 0.13.3"
|
||||||
gem 'capybara', '~> 2.0.0'
|
gem 'capybara', '~> 2.0.0'
|
||||||
gem 'nokogiri', '< 1.6.0'
|
gem 'nokogiri', '< 1.6.0'
|
||||||
|
gem 'factory_girl'
|
||||||
|
|
||||||
platforms :mri, :mingw do
|
platforms :mri, :mingw do
|
||||||
group :rmagick do
|
group :rmagick do
|
||||||
|
@ -43,7 +44,7 @@ group :development, :test do
|
||||||
gem 'spork-testunit'
|
gem 'spork-testunit'
|
||||||
gem 'guard-spork'
|
gem 'guard-spork'
|
||||||
gem 'guard-test', '~> 1.0.0'
|
gem 'guard-test', '~> 1.0.0'
|
||||||
#gem 'ruby-prof'
|
gem 'ruby-prof' unless RUBY_PLATFORM =~ /w32/
|
||||||
gem 'pry'
|
gem 'pry'
|
||||||
gem 'pry-nav'
|
gem 'pry-nav'
|
||||||
end
|
end
|
||||||
|
|
|
@ -78,6 +78,8 @@ GEM
|
||||||
coffee-script-source (1.7.1)
|
coffee-script-source (1.7.1)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.2.1)
|
execjs (2.2.1)
|
||||||
|
factory_girl (4.4.0)
|
||||||
|
activesupport (>= 3.0.0)
|
||||||
fastercsv (1.5.5)
|
fastercsv (1.5.5)
|
||||||
ffi (1.9.3)
|
ffi (1.9.3)
|
||||||
ffi (1.9.3-x86-mingw32)
|
ffi (1.9.3-x86-mingw32)
|
||||||
|
@ -247,6 +249,7 @@ DEPENDENCIES
|
||||||
capybara (~> 2.0.0)
|
capybara (~> 2.0.0)
|
||||||
coderay (~> 1.0.6)
|
coderay (~> 1.0.6)
|
||||||
coffee-rails (~> 3.2.1)
|
coffee-rails (~> 3.2.1)
|
||||||
|
factory_girl
|
||||||
fastercsv (~> 1.5.0)
|
fastercsv (~> 1.5.0)
|
||||||
guard-rails
|
guard-rails
|
||||||
guard-spork
|
guard-spork
|
||||||
|
|
|
@ -55,32 +55,35 @@ class AttachmentsController < ApplicationController
|
||||||
candown = false
|
candown = false
|
||||||
if @attachment.container.has_attribute?(:project) && @attachment.container.project
|
if @attachment.container.has_attribute?(:project) && @attachment.container.project
|
||||||
project = @attachment.container.project
|
project = @attachment.container.project
|
||||||
candown= User.current.member_of?(project)
|
candown= User.current.member_of?(project) || (project.is_public==1 && @attachment.is_public == 1)
|
||||||
elsif @attachment.container.is_a?(Project)
|
elsif @attachment.container.is_a?(Project)
|
||||||
project = @attachment.container
|
project = @attachment.container
|
||||||
candown= User.current.member_of?(project)
|
candown= User.current.member_of?(project) || (project.is_public==1 && @attachment.is_public == 1)
|
||||||
elsif @attachment.container.has_attribute?(:course) && @attachment.container.course
|
elsif @attachment.container.has_attribute?(:course) && @attachment.container.course
|
||||||
course = @attachment.container.course
|
course = @attachment.container.course
|
||||||
candown= User.current.member_of_course?(course)
|
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
|
||||||
elsif @attachment.container.is_a?(Course)
|
elsif @attachment.container.is_a?(Course)
|
||||||
course = @attachment.container
|
course = @attachment.container
|
||||||
candown= User.current.member_of_course?(course)
|
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
|
||||||
elsif @attachment.container.class.to_s=="HomeworkAttach" && @attachment.container.bid.reward_type == 3
|
elsif @attachment.container.class.to_s=="HomeworkAttach" && @attachment.container.bid.reward_type == 3
|
||||||
candown = true
|
candown = true
|
||||||
|
else
|
||||||
|
candown = @attachment.is_public == 1
|
||||||
end
|
end
|
||||||
if candown || User.current.admin?
|
if candown || User.current.admin?
|
||||||
@attachment.increment_download
|
@attachment.increment_download
|
||||||
|
|
||||||
|
if stale?(:etag => @attachment.digest)
|
||||||
|
# images are sent inline
|
||||||
|
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
||||||
|
:type => detect_content_type(@attachment),
|
||||||
|
:disposition => (@attachment.image? ? 'inline' : 'attachment')
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
render_403 :message => :notice_not_authorized
|
render_403 :message => :notice_not_authorized
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if stale?(:etag => @attachment.digest)
|
|
||||||
# images are sent inline
|
|
||||||
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
|
||||||
:type => detect_content_type(@attachment),
|
|
||||||
:disposition => (@attachment.image? ? 'inline' : 'attachment')
|
|
||||||
end
|
|
||||||
rescue => e
|
rescue => e
|
||||||
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ class StoresController < ApplicationController
|
||||||
LIMIT = 12 unless const_defined?(:LIMIT)
|
LIMIT = 12 unless const_defined?(:LIMIT)
|
||||||
def index
|
def index
|
||||||
@projects_attach = project_classification(0).take(LIMIT)
|
@projects_attach = project_classification(0).take(LIMIT)
|
||||||
@courses_attach = Attachment.includes(:course).where("courses.is_public = ?", 1).
|
@courses_attach = Attachment.includes(:course).where("courses.is_public = 1").
|
||||||
where(container_type: 'Course').
|
where(container_type: 'Course').
|
||||||
limit(LIMIT)
|
limit(LIMIT)
|
||||||
# @projects_attach = Attachment.includes(:project).where("projects.project_type=? AND projects.is_public = ?", 0, 1).
|
# @projects_attach = Attachment.includes(:project).where("projects.project_type=? AND projects.is_public = ?", 0, 1).
|
||||||
|
|
|
@ -16,6 +16,8 @@ module StoresHelper
|
||||||
news_path(container)
|
news_path(container)
|
||||||
when 'Project'
|
when 'Project'
|
||||||
project_files_path(container)
|
project_files_path(container)
|
||||||
|
when 'Course'
|
||||||
|
course_files_path(container)
|
||||||
when 'Version'
|
when 'Version'
|
||||||
# version_path(container)
|
# version_path(container)
|
||||||
project_files_path(container.project)
|
project_files_path(container.project)
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
<div id="file_buttons" class="nhidden">
|
<div id="file_buttons" class="nhidden">
|
||||||
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %>
|
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @course) %>
|
||||||
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %>
|
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @course) %>
|
||||||
|
<p></p>
|
||||||
|
<div class="box" id="files-box">
|
||||||
|
<label for="files-box" style="font-weight:bold;"> <%= l(:label_files_filter) %></label>
|
||||||
<% if attachmenttypes.any? %>
|
<% if attachmenttypes.any? %>
|
||||||
|
|
||||||
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
|
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
|
||||||
|
@ -24,7 +26,7 @@
|
||||||
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
|
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
|
||||||
:onchange => "course_attachment_contenttypes_searchex(this.value)" %>
|
:onchange => "course_attachment_contenttypes_searchex(this.value)" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
<div id="upload_file_div" class="relation_file_div hidden">
|
<div id="upload_file_div" class="relation_file_div hidden">
|
||||||
<%= render :partial => 'course_new', locals: {course: @course} %>
|
<%= render :partial => 'course_new', locals: {course: @course} %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
<div id="file_buttons" class="nhidden">
|
<div id="file_buttons" class="nhidden">
|
||||||
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %>
|
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %>
|
||||||
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
|
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
|
||||||
|
<p></p>
|
||||||
|
<div class="box" id="files-box">
|
||||||
|
<label for="files-box" style="font-weight:bold;"> <%= l(:label_files_filter) %></label>
|
||||||
<% if attachmenttypes.any? %>
|
<% if attachmenttypes.any? %>
|
||||||
|
|
||||||
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
|
<label for="attachment_browse_label"><%= l(:attachment_browse) %></label>
|
||||||
|
@ -24,6 +26,7 @@
|
||||||
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
|
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
|
||||||
:onchange => "attachment_contenttypes_searchex(this.value)" %>
|
:onchange => "attachment_contenttypes_searchex(this.value)" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="upload_file_div" class="relation_file_div hidden">
|
<div id="upload_file_div" class="relation_file_div hidden">
|
||||||
<%= render :partial => 'new', locals: {project: @project} %>
|
<%= render :partial => 'new', locals: {project: @project} %>
|
||||||
|
|
|
@ -183,12 +183,12 @@
|
||||||
<!--description-->
|
<!--description-->
|
||||||
<div class="inf_user_context">
|
<div class="inf_user_context">
|
||||||
<div class="font_title_left">
|
<div class="font_title_left">
|
||||||
<%= l(:label_course_overview) %>
|
<%= l(:label_new_course_description) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="padding-bottom: 8px">
|
<div style="padding-bottom: 8px">
|
||||||
<% if @course.description && @course.description.size>0 %>
|
<% if @course.description && @course.description.size>0 %>
|
||||||
<div class="font_lighter_sidebar">
|
<div class="font_lighter_sidebar" style="word-break:break-all; word-wrap:break-all;">
|
||||||
|
|
||||||
<%= textilizable @course.description %>
|
<%= textilizable @course.description %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -937,6 +937,7 @@ en:
|
||||||
label_cross_project_hierarchy: With project hierarchy
|
label_cross_project_hierarchy: With project hierarchy
|
||||||
label_cross_project_system: With all projects
|
label_cross_project_system: With all projects
|
||||||
label_gantt_progress_line: Progress line
|
label_gantt_progress_line: Progress line
|
||||||
|
label_files_filter: Files Filter:
|
||||||
|
|
||||||
button_login: Login
|
button_login: Login
|
||||||
button_submit: Submit
|
button_submit: Submit
|
||||||
|
|
|
@ -1742,6 +1742,7 @@ zh:
|
||||||
label_file_number: 文档的数量
|
label_file_number: 文档的数量
|
||||||
label_code_submit_number: 代码提交数量
|
label_code_submit_number: 代码提交数量
|
||||||
label_topic_number: 讨论区帖子数量
|
label_topic_number: 讨论区帖子数量
|
||||||
|
label_files_filter: 资源过滤:
|
||||||
|
|
||||||
label_course_contribute_to: 参与了 %{project_count} 个项目:
|
label_course_contribute_to: 参与了 %{project_count} 个项目:
|
||||||
label_x_course_contribute_to:
|
label_x_course_contribute_to:
|
||||||
|
|
|
@ -45,6 +45,8 @@ class AttachmentsControllerTest < ActionController::TestCase
|
||||||
role.save
|
role.save
|
||||||
}
|
}
|
||||||
User.current = nil
|
User.current = nil
|
||||||
|
@request.session[:ctime] = Time.now.to_i
|
||||||
|
@request.session[:atime] = Time.now.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ class CodeReviewControllerTest < ActionController::TestCase
|
||||||
role.permissions << :view_code_review
|
role.permissions << :view_code_review
|
||||||
role.save
|
role.save
|
||||||
}
|
}
|
||||||
|
@request.session[:ctime] = Time.now.to_i
|
||||||
|
@request.session[:atime] = Time.now.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
context "index" do
|
context "index" do
|
||||||
|
|
|
@ -42,6 +42,8 @@ class CodeReviewSettingsControllerTest < ActionController::TestCase
|
||||||
role.permissions << :view_code_review
|
role.permissions << :view_code_review
|
||||||
role.save
|
role.save
|
||||||
}
|
}
|
||||||
|
@request.session[:ctime] = Time.now.to_i
|
||||||
|
@request.session[:atime] = Time.now.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,8 @@ class IssuesControllerTest < ActionController::TestCase
|
||||||
role.permissions << :view_code_review
|
role.permissions << :view_code_review
|
||||||
role.save
|
role.save
|
||||||
}
|
}
|
||||||
|
@request.session[:ctime] = Time.now.to_i
|
||||||
|
@request.session[:atime] = Time.now.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show
|
def test_show
|
||||||
|
|
|
@ -26,6 +26,8 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||||
@controller = ProjectsController.new
|
@controller = ProjectsController.new
|
||||||
@request = ActionController::TestRequest.new
|
@request = ActionController::TestRequest.new
|
||||||
@response = ActionController::TestResponse.new
|
@response = ActionController::TestResponse.new
|
||||||
|
@request.session[:ctime] = Time.now.to_i
|
||||||
|
@request.session[:atime] = Time.now.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
context "#settings" do
|
context "#settings" do
|
||||||
|
|
|
@ -52,6 +52,8 @@ class RepositoriesControllerTest < ActionController::TestCase
|
||||||
role.permissions << :browse_repository
|
role.permissions << :browse_repository
|
||||||
role.save
|
role.save
|
||||||
}
|
}
|
||||||
|
@request.session[:ctime] = Time.now.to_i
|
||||||
|
@request.session[:atime] = Time.now.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_revision
|
def test_revision
|
||||||
|
|
|
@ -117,3 +117,9 @@ FactoryGirl.define do
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
ActiveRecord::Fixtures.create_fixtures(File.dirname(__FILE__)+ '/fixtures/',
|
||||||
|
[ :code_review_assignments,
|
||||||
|
:code_reviews,
|
||||||
|
:code_review_project_settings,
|
||||||
|
:code_review_user_settings])
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,11 @@ class CodeReviewAssignmentTest < ActiveSupport::TestCase
|
||||||
fixtures :code_review_assignments, :issues, :issue_statuses,
|
fixtures :code_review_assignments, :issues, :issue_statuses,
|
||||||
:projects, :trackers, :projects_trackers, :users, :members, :repositories,
|
:projects, :trackers, :projects_trackers, :users, :members, :repositories,
|
||||||
:enumerations
|
:enumerations
|
||||||
|
ActiveRecord::Fixtures.create_fixtures(File.dirname(__FILE__)+ '/../fixtures/',
|
||||||
|
[ :code_review_assignments,
|
||||||
|
:code_reviews,
|
||||||
|
:code_review_project_settings,
|
||||||
|
:code_review_user_settings])
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@assignment = CodeReviewAssignment.new
|
@assignment = CodeReviewAssignment.new
|
||||||
|
|
|
@ -1852,7 +1852,7 @@ span.required {color: #bb0000;}
|
||||||
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block; padding-left:16px;}
|
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block; padding-left:16px;}
|
||||||
a.remove-upload:hover {text-decoration:none !important;}
|
a.remove-upload:hover {text-decoration:none !important;}
|
||||||
#attachments_fields input.is_public_checkbox {width:20px;}
|
#attachments_fields input.is_public_checkbox {width:20px;}
|
||||||
#attachments_fields span.ispublic-label {display:inline-block;width:50px;margin-left:10px; }
|
#attachments_fields span.ispublic-label {display:inline-block;width:30px;margin-left:10px; }
|
||||||
|
|
||||||
/*gcm upload file count and deleteall*/
|
/*gcm upload file count and deleteall*/
|
||||||
#upload_file_count #count {color:red; font-size:1.5em;}
|
#upload_file_count #count {color:red; font-size:1.5em;}
|
||||||
|
|
Loading…
Reference in New Issue