diff --git a/.rspec b/.rspec index 8c18f1abd..83e16f804 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,2 @@ ---format documentation --color +--require spec_helper diff --git a/Gemfile b/Gemfile index 0aa77ae99..fbe74f8dd 100644 --- a/Gemfile +++ b/Gemfile @@ -28,28 +28,21 @@ gem "rmagick", ">= 2.0.0" group :development do gem 'grape-swagger' - #gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git' - gem 'puma' if RbConfig::CONFIG['host_os'] =~ /linux/ - gem 'pry-rails' - if RUBY_VERSION >= '2.0.0' - gem 'pry-byebug' - else - # gem 'pry-debugger' - end - gem 'pry-stack_explorer' gem 'better_errors', '~> 1.1.0' gem 'rack-mini-profiler', '~> 0.9.3' end -group :test do - gem "shoulda", "~> 3.5.0" - gem "mocha", "~> 1.1.0" - gem 'capybara', '~> 2.4.1' - gem 'nokogiri', '~> 1.6.3' - gem 'factory_girl', '~> 4.4.0' - gem 'selenium-webdriver', '~> 2.42.0' +group :development, :test do + unless RUBY_PLATFORM =~ /w32/ + gem 'pry-rails' + if RUBY_VERSION >= '2.0.0' + gem 'pry-byebug' + end + gem 'pry-stack_explorer' + end - gem "faker" + gem 'rspec-rails', '~> 3.0' + gem 'factory_girl_rails' end # Gems used only for assets and not required diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index b2a2532bc..0900f0446 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -170,10 +170,26 @@ module Mobile desc "设置教辅" params do - + requires :token,type:String + requires :user_id,type:Integer,desc: '用户id' + requires :course_id,type:Integer,desc:'课程id' + end + get 'set_user_as_assitant' do + cs = CoursesService.new + cs.set_as_assitant_teacher params + present :status, 0 end - post 'set_user_as_assitant' do + desc "删除教辅" + params do + requires :token,type:String + requires :user_id,type:Integer,desc: '用户id' + requires :course_id,type:Integer,desc:'课程id' + end + get 'del_user_as_assitant' do + cs = CoursesService.new + cs.del_assitant_teacher params + present :status, 0 end desc "返回单个课程" @@ -187,7 +203,7 @@ module Mobile course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user)) #course = Course.find(params[:id]) present :data, course, with: Mobile::Entities::Course - present :status, 0 + { status: 0} end end diff --git a/app/api/mobile/apis/homeworks.rb b/app/api/mobile/apis/homeworks.rb index 7a8c87987..5bf454e32 100644 --- a/app/api/mobile/apis/homeworks.rb +++ b/app/api/mobile/apis/homeworks.rb @@ -96,6 +96,21 @@ module Mobile present :status, 0 end + desc '创建作业' + params do + requires :token,type:String + requires :work_name,type:String,desc:'作业名称' + requires :work_desc,type:String,desc:'作业描述' + requires :work_deadline,type:String,desc:'截止日期' + requires :is_blind_appr,type:Integer,desc:'是否匿评' + requires :blind_appr_num,type:Integer,desc:'匿评分配数' + requires :course_id,type:Integer,desc: '课程id' + end + post 'create_home_work' do + Homeworks.get_service.create_home_work params,current_user + present :status, 0 + end + end end diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 3ef2c3237..62c9c3926 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -84,6 +84,7 @@ module Mobile requires :name, type: String, desc: '用户名关键字' requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名' optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教' + optional :course_id,type:Integer,desc: '课程id,搜索注册用户不为该课程教师的其他用户' end get 'search/search_user' do us = UsersService.new diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index fd7ec55fb..36d542d58 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -473,6 +473,41 @@ class CoursesService result end + # 设置人员为课程教辅 + def set_as_assitant_teacher params + members = [] + #找到课程 + course = Course.find(params[:course_id]) + #新建课程人员 + + member = Member.new(:role_ids =>[7], :user_id => params[:user_id],:course_id=>params[:course_id]) + joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id) + joined.each do |join| + join.delete + end + member.course_group_id = 0 + members << member + course.members << members + #将课程人员设置为教辅 + end + + def del_assitant_teacher params + member = Member.where("user_id = ? and course_id = ?",params[:user_id],params[:course_id]) + member.each do |m| + m.destroy + end + user_admin = CourseInfos.where("user_id = ? and course_id = ?",params[:user_id], params[:course_id]) + if user_admin.size > 0 + user_admin.each do |user| + user.destroy + end + end + joined = StudentsForCourse.where('student_id = ? and course_id = ?', params[:user_id],params[:course_id]) + joined.each do |join| + join.delete + end + end + private def searchmember_by_name members, name #searchPeopleByRoles(project, StudentRoles) @@ -576,4 +611,6 @@ class CoursesService + + end \ No newline at end of file diff --git a/app/services/homework_service.rb b/app/services/homework_service.rb index d22c62a5a..2e7f59888 100644 --- a/app/services/homework_service.rb +++ b/app/services/homework_service.rb @@ -231,6 +231,29 @@ class HomeworkService anonymous_repy(jour) end end + + # 发布作业 + def create_home_work params,current_user + @bid = Bid.new + @bid.name = params[:work_name] + @bid.description = params[:work_desc] + # @bid.is_evaluation = params[:is_blind_appr] + @bid.evaluation_num = params[:blind_appr_num] + @bid.open_anonymous_evaluation = params[:is_blind_appr] + @bid.reward_type = 3 + @bid.deadline = params[:work_deadline] + @bid.budget = 0 + @bid.author_id = current_user.id + @bid.commit = 0 + @bid.homework_type = 1 + # @bid. + if @bid.save + HomeworkForCourse.create(:course_id => params[:course_id], :bid_id => @bid.id) + unless @bid.watched_by?(current_user) + @bid.add_watcher(current_user) + end + end + end # 学生匿评列表 def student_jour_list params diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 17557872b..071820ba3 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -211,7 +211,8 @@ class UsersService search_by = params[:search_by] ? params[:search_by] : "0" scope = scope.where("id not in (?)",watcher).like(params[:name],search_by) if params[:name].present? else - scope = scope.like(params[:name],search_by) if params[:name].present? + teachers = searchTeacherAndAssistant(Course.find(params[:course_id])) + scope = scope.where("id not in (?)",teachers.map{|t| t.user_id}).like(params[:name],search_by) if params[:name].present? end scope end diff --git a/app/views/contests/_form_contest.html.erb b/app/views/contests/_form_contest.html.erb index 344d69571..0b9f1469d 100644 --- a/app/views/contests/_form_contest.html.erb +++ b/app/views/contests/_form_contest.html.erb @@ -33,20 +33,21 @@ %>

-

+

<%= f.text_area :description, - :rows => 5, - :class => 'wiki-edit', - :style => "font-size:small;width:490px;margin-left:10px;", + :size => 60, + :rows => 4, + :style => "width:490px;", :maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %>

-

+

<%= f.text_field :password, :size => 60, - :style => "width:488px;margin-left: 10px;" + :rows => 4, + :style => "width:490px;" %>

diff --git a/app/views/homework_attach/_show.html.erb b/app/views/homework_attach/_show.html.erb index a89322049..f18ff8a2c 100644 --- a/app/views/homework_attach/_show.html.erb +++ b/app/views/homework_attach/_show.html.erb @@ -12,13 +12,13 @@ $("#stars_value").val(num); } - function ChoseZero() - { - if(confirm('是否确定评分为0分?')) - { - ChoseStars(0); - } - } +// function ChoseZero() +// { +// if(confirm('是否确定评分为0分?')) +// { +// ChoseStars(0); +// } +// }
diff --git a/app/views/homework_attach/_show_star.html.erb b/app/views/homework_attach/_show_star.html.erb index 49c9e2cf7..739693938 100644 --- a/app/views/homework_attach/_show_star.html.erb +++ b/app/views/homework_attach/_show_star.html.erb @@ -1,4 +1,4 @@ -零分 +零分 diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index 8a5ee893d..540293a48 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -168,8 +168,8 @@ function cookieget(n)
- <%# if @public_forum %> - <% get_memo %> + <% get_memo %> + <% if @public_forum %> <%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %> <%= f.text_area :subject,:id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %> <%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %> @@ -177,7 +177,7 @@ function cookieget(n) <%= l(:label_submit)%> <% end %> - <%# end %> + <% end %>
<%= l(:label_technical_support) %>白   羽 diff --git a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb index f5c85677f..c3252ed1c 100644 --- a/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb +++ b/lib/rails_kindeditor/lib/rails_kindeditor/helper.rb @@ -6,7 +6,7 @@ module RailsKindeditor input_html = { :id => id }.merge(options.delete(:input_html) || {}) output = ActiveSupport::SafeBuffer.new output << text_area_tag(name, content, input_html) - output << javascript_tag(js_replace(id, options)) + output << javascript_tag(js_replace(id, options.merge(window_onload: 'true'))) end def kindeditor(name, method, options = {}) @@ -14,7 +14,7 @@ module RailsKindeditor input_html = (options.delete(:input_html) || {}).stringify_keys output_buffer = ActiveSupport::SafeBuffer.new output_buffer << build_text_area_tag(name, method, self, options, input_html) - output_buffer << javascript_tag(js_replace(input_html['id'], options)) + output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true'))) end def kindeditor_upload_json_path(*args) @@ -50,13 +50,13 @@ module RailsKindeditor "var old_onload_#{random_name}; if(typeof window.onload == 'function') old_onload_#{random_name} = window.onload; window.onload = function() { - #{editor_id}KindEditor.create('##{dom_id}', #{get_options(options).to_json}); + #{editor_id}KindEditor.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste'); if(old_onload_#{random_name}) old_onload_#{random_name}(); }" else - "$(function(){KindEditor.ready(function(K){ + "KindEditor.ready(function(K){ #{editor_id}K.create('##{dom_id}', #{get_options(options).to_json}).loadPlugin('paste'); - });});" + });" end end diff --git a/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css b/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css index 4c89f602d..e663e3c5e 100644 --- a/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css +++ b/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css @@ -1,160 +1,160 @@ -.overlay_mac_os_x_dialog { - background-color: #FF7224; - filter:alpha(opacity=60); - -moz-opacity: 0.6; - opacity: 0.6; -} - -.mac_os_x_dialog_nw { - background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; - width:16px; - height:16px; -} - -.mac_os_x_dialog_n { - background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; - height:18px; -} - -.mac_os_x_dialog_ne { - background: transparent url(mac_os_x_dialog/R.png) repeat-y top left; - width:16px; - height:16px; -} - -.mac_os_x_dialog_w { - background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; - width:16px; -} - -.mac_os_x_dialog_e { - background: transparent url(mac_os_x_dialog/R.png) repeat-y top right; - width:16px; -} - -.mac_os_x_dialog_sw { - background: transparent url(mac_os_x_dialog/BL.png) no-repeat 0 0; - width:31px; - height:40px; -} - -.mac_os_x_dialog_s { - background: transparent url(mac_os_x_dialog/B.png) repeat-x 0 0; - height:40px; -} - -.mac_os_x_dialog_se, .mac_os_x_dialog_sizer { - background: transparent url(mac_os_x_dialog/BR.png) no-repeat 0 0; - width:31px; - height:40px; -} - -.mac_os_x_dialog_sizer { - cursor:se-resize; -} - -.mac_os_x_dialog_close { - width: 19px; - height: 19px; - background: transparent url(mac_os_x_dialog/close.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:25px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_dialog_minimize { - width: 19px; - height: 19px; - background: transparent url(mac_os_x_dialog/minimize.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:45px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_dialog_maximize { - width: 19px; - height: 19px; - background: transparent url(mac_os_x_dialog/maximize.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:65px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_dialog_title { - float:left; - height:14px; - font-family: Tahoma, Arial, sans-serif; - font-size:12px; - text-align:center; - margin-top:6px; - width:100%; - color:#000; -} - -.mac_os_x_dialog_content { - overflow:auto; - color: #222; - font-family: Tahoma, Arial, sans-serif; - font-size: 10px; - background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; -} - -.mac_os_x_dialog_buttons { - text-align: center; -} -/* FOR IE */ -* html .mac_os_x_dialog_nw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); -} - - -* html .mac_os_x_dialog_ne { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_w { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_e { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_sw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BL.png", sizingMethod="crop"); -} - -* html .mac_os_x_dialog_s { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/B.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_se { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); -} - -* html .mac_os_x_dialog_sizer { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); -} - +.overlay_mac_os_x_dialog { + background-color: #FF7224; + filter:alpha(opacity=60); + -moz-opacity: 0.6; + opacity: 0.6; +} + +.mac_os_x_dialog_nw { + background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; + width:16px; + height:16px; +} + +.mac_os_x_dialog_n { + background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; + height:18px; +} + +.mac_os_x_dialog_ne { + background: transparent url(mac_os_x_dialog/R.png) repeat-y top left; + width:16px; + height:16px; +} + +.mac_os_x_dialog_w { + background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; + width:16px; +} + +.mac_os_x_dialog_e { + background: transparent url(mac_os_x_dialog/R.png) repeat-y top right; + width:16px; +} + +.mac_os_x_dialog_sw { + background: transparent url(mac_os_x_dialog/BL.png) no-repeat 0 0; + width:31px; + height:40px; +} + +.mac_os_x_dialog_s { + background: transparent url(mac_os_x_dialog/B.png) repeat-x 0 0; + height:40px; +} + +.mac_os_x_dialog_se, .mac_os_x_dialog_sizer { + background: transparent url(mac_os_x_dialog/BR.png) no-repeat 0 0; + width:31px; + height:40px; +} + +.mac_os_x_dialog_sizer { + cursor:se-resize; +} + +.mac_os_x_dialog_close { + width: 19px; + height: 19px; + background: transparent url(mac_os_x_dialog/close.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:25px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_dialog_minimize { + width: 19px; + height: 19px; + background: transparent url(mac_os_x_dialog/minimize.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:45px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_dialog_maximize { + width: 19px; + height: 19px; + background: transparent url(mac_os_x_dialog/maximize.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:65px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_dialog_title { + float:left; + height:14px; + font-family: Tahoma, Arial, sans-serif; + font-size:12px; + text-align:center; + margin-top:6px; + width:100%; + color:#000; +} + +.mac_os_x_dialog_content { + overflow:auto; + color: #222; + font-family: Tahoma, Arial, sans-serif; + font-size: 10px; + background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; +} + +.mac_os_x_dialog_buttons { + text-align: center; +} +/* FOR IE */ +* html .mac_os_x_dialog_nw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); +} + + +* html .mac_os_x_dialog_ne { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_w { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_e { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_sw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BL.png", sizingMethod="crop"); +} + +* html .mac_os_x_dialog_s { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/B.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_se { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); +} + +* html .mac_os_x_dialog_sizer { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); +} + diff --git a/public/plugin_assets/redmine_code_review/stylesheets/window_js/nuncio.css b/public/plugin_assets/redmine_code_review/stylesheets/window_js/nuncio.css index e2700e5b7..2c439bd00 100644 --- a/public/plugin_assets/redmine_code_review/stylesheets/window_js/nuncio.css +++ b/public/plugin_assets/redmine_code_review/stylesheets/window_js/nuncio.css @@ -1,164 +1,164 @@ -.overlay_nuncio img { border: none; } - -.overlay_nuncio { - background-color: #666666; -} - -.nuncio_nw { - width: 12px; - height: 28px; - background: url(nuncio/top_left.png) no-repeat; -} - -.nuncio_n { - background: url(nuncio/top_mid.png) repeat-x; - height: 28px; -} - -.nuncio_ne { - width: 21px; - height: 28px; - background: url(nuncio/top_right.png) no-repeat; -} - -.nuncio_e { - width: 21px; - background: url(nuncio/center_right.png) repeat-y top right; -} - -.nuncio_w { - width: 12px; - background: url(nuncio/center_left.png) repeat-y top left; -} - -.nuncio_sw { - width: 12px; - height: 18px; - background: url(nuncio/bottom_left.png) no-repeat; -} - -.nuncio_s { - background: url(nuncio/bottom_mid.png) repeat-x 0 0; - height: 18px; -} - -.nuncio_se, .nuncio_sizer { - width: 21px; - height: 18px; - background: url(nuncio/bottom_right.png) no-repeat; -} - -.nuncio_close { - width: 14px; - height: 14px; - background: url(nuncio/close.png) no-repeat; - position:absolute; - top:10px; - right:22px; - cursor:pointer; - z-index:2000; -} - -.nuncio_minimize { - width: 14px; - height: 15px; - background: url(nuncio/minimize.png) no-repeat; - position:absolute; - top:10px; - right:40px; - cursor:pointer; - z-index:2000; -} - -.nuncio_title { - float:left; - font-size:11px; - font-weight: bold; - font-style: italic; - color: #fff; - width: 100% -} - -.nuncio_content { - background: url(nuncio/overlay.png) repeat; - overflow:auto; - color: #ddd; - font-family: Tahoma, Arial, "sans-serif"; - font-size: 10px; -} - -.nuncio_sizer { - cursor:se-resize; -} - - -.top_draggable, .bottom_draggable { - cursor:move -} -/* FOR IE */ -* html .nuncio_nw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_left.png", sizingMethod="crop"); -} - -* html .nuncio_n { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_mid.png", sizingMethod="scale"); -} - -* html .nuncio_ne { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_right.png", sizingMethod="crop"); -} - -* html .nuncio_w { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/center_left.png", sizingMethod="scale"); -} - -* html .nuncio_e { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/center_right.png", sizingMethod="scale"); -} - -* html .nuncio_sw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_left.png", sizingMethod="crop"); -} - -* html .nuncio_s { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_mid.png", sizingMethod="scale"); -} - -* html .nuncio_se { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_right.png", sizingMethod="crop"); -} - -* html .nuncio_sizer { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_right.png", sizingMethod="crop"); -} - -* html .nuncio_close { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/close.png", sizingMethod="crop"); -} - -* html .nuncio_minimize { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/minimize.png", sizingMethod="crop"); -} - +.overlay_nuncio img { border: none; } + +.overlay_nuncio { + background-color: #666666; +} + +.nuncio_nw { + width: 12px; + height: 28px; + background: url(nuncio/top_left.png) no-repeat; +} + +.nuncio_n { + background: url(nuncio/top_mid.png) repeat-x; + height: 28px; +} + +.nuncio_ne { + width: 21px; + height: 28px; + background: url(nuncio/top_right.png) no-repeat; +} + +.nuncio_e { + width: 21px; + background: url(nuncio/center_right.png) repeat-y top right; +} + +.nuncio_w { + width: 12px; + background: url(nuncio/center_left.png) repeat-y top left; +} + +.nuncio_sw { + width: 12px; + height: 18px; + background: url(nuncio/bottom_left.png) no-repeat; +} + +.nuncio_s { + background: url(nuncio/bottom_mid.png) repeat-x 0 0; + height: 18px; +} + +.nuncio_se, .nuncio_sizer { + width: 21px; + height: 18px; + background: url(nuncio/bottom_right.png) no-repeat; +} + +.nuncio_close { + width: 14px; + height: 14px; + background: url(nuncio/close.png) no-repeat; + position:absolute; + top:10px; + right:22px; + cursor:pointer; + z-index:2000; +} + +.nuncio_minimize { + width: 14px; + height: 15px; + background: url(nuncio/minimize.png) no-repeat; + position:absolute; + top:10px; + right:40px; + cursor:pointer; + z-index:2000; +} + +.nuncio_title { + float:left; + font-size:11px; + font-weight: bold; + font-style: italic; + color: #fff; + width: 100% +} + +.nuncio_content { + background: url(nuncio/overlay.png) repeat; + overflow:auto; + color: #ddd; + font-family: Tahoma, Arial, "sans-serif"; + font-size: 10px; +} + +.nuncio_sizer { + cursor:se-resize; +} + + +.top_draggable, .bottom_draggable { + cursor:move +} +/* FOR IE */ +* html .nuncio_nw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_left.png", sizingMethod="crop"); +} + +* html .nuncio_n { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_mid.png", sizingMethod="scale"); +} + +* html .nuncio_ne { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_right.png", sizingMethod="crop"); +} + +* html .nuncio_w { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/center_left.png", sizingMethod="scale"); +} + +* html .nuncio_e { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/center_right.png", sizingMethod="scale"); +} + +* html .nuncio_sw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_left.png", sizingMethod="crop"); +} + +* html .nuncio_s { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_mid.png", sizingMethod="scale"); +} + +* html .nuncio_se { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_right.png", sizingMethod="crop"); +} + +* html .nuncio_sizer { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_right.png", sizingMethod="crop"); +} + +* html .nuncio_close { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/close.png", sizingMethod="crop"); +} + +* html .nuncio_minimize { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/minimize.png", sizingMethod="crop"); +} + diff --git a/public/plugin_assets/redmine_code_review/stylesheets/window_js/spread.css b/public/plugin_assets/redmine_code_review/stylesheets/window_js/spread.css index d7d722e8a..9bda2a68d 100644 --- a/public/plugin_assets/redmine_code_review/stylesheets/window_js/spread.css +++ b/public/plugin_assets/redmine_code_review/stylesheets/window_js/spread.css @@ -1,108 +1,108 @@ -.overlay_spread { - background-color: #85BBEF; - filter:alpha(opacity=60); - -moz-opacity: 0.6; - opacity: 0.6; -} - -.spread_nw { - background: transparent url(spread/left-top.gif) no-repeat 0 0; - width:10px; - height:25px; -} - -.spread_n { - background: transparent url(spread/top-middle.gif) repeat-x 0 0; - height:25px; -} - -.spread_ne { - background: transparent url(spread/right-top.gif) no-repeat 0 0; - width:10px; - height:25px; -} - -.spread_w { - background: transparent url(spread/frame-left.gif) repeat-y top left; - width:7px; -} - -.spread_e { - background: transparent url(spread/frame-right.gif) repeat-y top right; - width:7px; -} - -.spread_sw { - background: transparent url(spread/bottom-left-c.gif) no-repeat 0 0; - width:7px; - height:7px; -} - -.spread_s { - background: transparent url(spread/bottom-middle.gif) repeat-x 0 0; - height:7px; -} - -.spread_se, .spread_sizer { - background: transparent url(spread/bottom-right-c.gif) no-repeat 0 0; - width:7px; - height:7px; -} - -.spread_sizer { - cursor:se-resize; -} - -.spread_close { - width: 23px; - height: 23px; - background: transparent url(spread/button-close-focus.gif) no-repeat 0 0; - position:absolute; - top:0px; - right:11px; - cursor:pointer; - z-index:1000; -} - -.spread_minimize { - width: 23px; - height: 23px; - background: transparent url(spread/button-min-focus.gif) no-repeat 0 0; - position:absolute; - top:0px; - right:55px; - cursor:pointer; - z-index:1000; -} - -.spread_maximize { - width: 23px; - height: 23px; - background: transparent url(spread/button-max-focus.gif) no-repeat 0 0; - position:absolute; - top:0px; - right:33px; - cursor:pointer; - z-index:1000; -} - -.spread_title { - float:left; - height:14px; - font-family: Tahoma, Arial, sans-serif; - font-size:14px; - font-weight:bold; - text-align:left; - margin-top:2px; - width:100%; - color:#E47211; -} - -.spread_content { - overflow:auto; - color: #222; - font-family: Tahoma, Arial, sans-serif; - font-size: 10px; - background:#A9EA00; -} - +.overlay_spread { + background-color: #85BBEF; + filter:alpha(opacity=60); + -moz-opacity: 0.6; + opacity: 0.6; +} + +.spread_nw { + background: transparent url(spread/left-top.gif) no-repeat 0 0; + width:10px; + height:25px; +} + +.spread_n { + background: transparent url(spread/top-middle.gif) repeat-x 0 0; + height:25px; +} + +.spread_ne { + background: transparent url(spread/right-top.gif) no-repeat 0 0; + width:10px; + height:25px; +} + +.spread_w { + background: transparent url(spread/frame-left.gif) repeat-y top left; + width:7px; +} + +.spread_e { + background: transparent url(spread/frame-right.gif) repeat-y top right; + width:7px; +} + +.spread_sw { + background: transparent url(spread/bottom-left-c.gif) no-repeat 0 0; + width:7px; + height:7px; +} + +.spread_s { + background: transparent url(spread/bottom-middle.gif) repeat-x 0 0; + height:7px; +} + +.spread_se, .spread_sizer { + background: transparent url(spread/bottom-right-c.gif) no-repeat 0 0; + width:7px; + height:7px; +} + +.spread_sizer { + cursor:se-resize; +} + +.spread_close { + width: 23px; + height: 23px; + background: transparent url(spread/button-close-focus.gif) no-repeat 0 0; + position:absolute; + top:0px; + right:11px; + cursor:pointer; + z-index:1000; +} + +.spread_minimize { + width: 23px; + height: 23px; + background: transparent url(spread/button-min-focus.gif) no-repeat 0 0; + position:absolute; + top:0px; + right:55px; + cursor:pointer; + z-index:1000; +} + +.spread_maximize { + width: 23px; + height: 23px; + background: transparent url(spread/button-max-focus.gif) no-repeat 0 0; + position:absolute; + top:0px; + right:33px; + cursor:pointer; + z-index:1000; +} + +.spread_title { + float:left; + height:14px; + font-family: Tahoma, Arial, sans-serif; + font-size:14px; + font-weight:bold; + text-align:left; + margin-top:2px; + width:100%; + color:#E47211; +} + +.spread_content { + overflow:auto; + color: #222; + font-family: Tahoma, Arial, sans-serif; + font-size: 10px; + background:#A9EA00; +} + diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index e21b999cf..4c149c9ce 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2779,3 +2779,4 @@ div.repos_explain{ padding-top: 20px; padding-bottom: 20px; } +.upload_img img{max-width: 580px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 031b73afb..4624b26c9 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -422,3 +422,5 @@ a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} /*文本左对齐*/ .tl{text-align: left;} +img{max-width: 100%;} +.attachments {clear: both;} diff --git a/spec/controllers/enterprises_controller_spec.rb b/spec/controllers/enterprises_controller_spec.rb deleted file mode 100644 index 49ca325bf..000000000 --- a/spec/controllers/enterprises_controller_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper' - -describe EnterprisesController do - - describe "GET 'index'" do - it "returns http success" do - get 'index' - response.should be_success - end - end - -end diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 369e60f48..fe6d423ac 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,4 +1,3 @@ -require 'faker' FactoryGirl.define do factory :user do @@ -7,4 +6,4 @@ FactoryGirl.define do password "foobar" password_confirmation "foobar" end -end \ No newline at end of file +end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb new file mode 100644 index 000000000..1c8e743d1 --- /dev/null +++ b/spec/rails_helper.rb @@ -0,0 +1,46 @@ +# This file is copied to spec/ when you run 'rails generate rspec:install' +ENV['RAILS_ENV'] ||= 'test' +require 'spec_helper' +require File.expand_path('../../config/environment', __FILE__) +require 'rspec/rails' +# Add additional requires below this line. Rails is not loaded until this point! + +# Requires supporting ruby files with custom matchers and macros, etc, in +# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are +# run as spec files by default. This means that files in spec/support that end +# in _spec.rb will both be required and run as specs, causing the specs to be +# run twice. It is recommended that you do not name files matching this glob to +# end with _spec.rb. You can configure this pattern with the --pattern +# option on the command line or in ~/.rspec, .rspec or `.rspec-local`. +# +# The following line is provided for convenience purposes. It has the downside +# of increasing the boot-up time by auto-requiring all files in the support +# directory. Alternatively, in the individual `*_spec.rb` files, manually +# require only the support files necessary. +# +# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } + +RSpec.configure do |config| + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + + # If you're not using ActiveRecord, or you'd prefer not to run each of your + # examples within a transaction, remove the following line or assign false + # instead of true. + config.use_transactional_fixtures = true + + # RSpec Rails can automatically mix in different behaviours to your tests + # based on their file location, for example enabling you to call `get` and + # `post` in specs under `spec/controllers`. + # + # You can disable this behaviour by removing the line below, and instead + # explicitly tag your specs with their type, e.g.: + # + # RSpec.describe UsersController, :type => :controller do + # # ... + # end + # + # The different available types are documented in the features, such as in + # https://relishapp.com/rspec/rspec-rails/docs + config.infer_spec_type_from_file_location! +end diff --git a/spec/requests/account_request_spec.rb b/spec/requests/account_request_spec.rb new file mode 100644 index 000000000..75a5a9bc0 --- /dev/null +++ b/spec/requests/account_request_spec.rb @@ -0,0 +1,71 @@ +require 'rails_helper' + +RSpec.describe "Account request", :type => :request do + describe "用户登录" do + let(:user){FactoryGirl.create(:user)} + + it "未登录访问需要登录页面会自动跳入登录页" do + get 'my/page' + expect(response).to redirect_to(signin_path) + end + + context "正常登录" do + before{post signin_path, username: user.login, password: user.password} + it "登录成功,正常跳转" do + expect(response).to redirect_to(my_account_url) + end + + it "登录成功,session正确" do + expect(user.id).to eq(session[:user_id]) + end + + it "正常登录后可以访问需要认证的页面" do + get 'my/account' + expect(response).to have_http_status(:success) + expect(response.body).to include(user.login) + end + end + + context "登录失败" do + before{post signin_path, username: user.login, password: 'wrong password'} + it {expect(response).to render_template('account/login')} + it "跳加登录页面" do + get 'my/page' + expect(response).to redirect_to(signin_path) + end + end + + context "自动登录" do + before{ + post signin_path, username: user.login, password: user.password, autologin: 1 + } + it "登录成功跳转到个人首页" do + expect(response).to redirect_to(my_account_url) + end + + it "验证token" do + token = Token.first + expect(token).not_to be_nil + expect(user.id).to eq(token.user.id) + expect(token.action).to eq('autologin') + expect(user.id).to eq(session[:user_id]) + expect(token.value).to eq(cookies['autologin']) + end + + it 'session 失效后,可以用token自动重新登录' do + token = Token.first + reset! + User.current = nil + get my_account_url + expect(response).to redirect_to(signin_url) + cookies[:autologin] = token.value + get my_account_url + expect(response).to have_http_status(:success) + expect(response.body).to include(user.login) + end + + end + + end +end + diff --git a/spec/requests/zipdown_request_spec.rb b/spec/requests/zipdown_request_spec.rb new file mode 100644 index 000000000..e69de29bb diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d2cbea7d9..e62c66829 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,38 +1,91 @@ -# This file is copied to spec/ when you run 'rails generate rspec:install' -ENV["RAILS_ENV"] ||= 'test' -require File.expand_path("../../config/environment", __FILE__) -require 'rspec/rails' -require 'rspec/autorun' - -# Requires supporting ruby files with custom matchers and macros, etc, -# in spec/support/ and its subdirectories. -Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } +require 'rubygems' +require 'rspec/core' +# require_relative 'support/spork_patch' +# This file was generated by the `rails generate rspec:install` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# The `.rspec` file also contains a few flags that are not defaults but that +# users commonly want. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| - # ## Mock Framework - # - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: - # - # config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - config.use_transactional_fixtures = true +# The settings below are suggested to provide a good initial experience +# with RSpec, but feel free to customize to your heart's content. +=begin + # These two settings work together to allow you to limit a spec run + # to individual examples or groups you care about by tagging them with + # `:focus` metadata. When nothing is tagged with `:focus`, all examples + # get run. + config.filter_run :focus + config.run_all_when_everything_filtered = true - # If true, the base class of anonymous controllers will be inferred - # automatically. This will be the default behavior in future versions of - # rspec-rails. - config.infer_base_class_for_anonymous_controllers = false + # Limits the available syntax to the non-monkey patched syntax that is + # recommended. For more details, see: + # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax + # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching + config.disable_monkey_patching! + + # Many RSpec users commonly either run the entire suite or an individual + # file, and it's useful to allow more verbose output when running an + # individual spec file. + if config.files_to_run.one? + # Use the documentation formatter for detailed output, + # unless a formatter has already been configured + # (e.g. via a command-line flag). + config.default_formatter = 'doc' + end + + # Print the 10 slowest examples and example groups at the + # end of the spec run, to help surface which specs are running + # particularly slow. + config.profile_examples = 10 # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 - config.order = "random" + config.order = :random + + # Seed global randomization in this process using the `--seed` CLI option. + # Setting this allows you to use `--seed` to deterministically reproduce + # test failures related to randomization by passing the same `--seed` value + # as the one that triggered the failure. + Kernel.srand config.seed +=end end diff --git a/spec/support/spork_patch.rb b/spec/support/spork_patch.rb new file mode 100644 index 000000000..1da921a36 --- /dev/null +++ b/spec/support/spork_patch.rb @@ -0,0 +1,22 @@ +# https://stackoverflow.com/questions/24030907/spork-0-9-2-and-rspec-3-0-0-uninitialized-constant-rspeccorecommandline-n/24085168#24085168 +# https://github.com/manafire/spork/commit/38c79dcedb246daacbadb9f18d09f50cc837de51#diff-937afaa19ccfee172d722a05112a7c6fL6 + + class Spork::TestFramework::RSpec + def run_tests(argv, stderr, stdout) + if rspec1? + ::Spec::Runner::CommandLine.run( + ::Spec::Runner::OptionParser.parse(argv, stderr, stdout) + ) + elsif rspec3? + options = ::RSpec::Core::ConfigurationOptions.new(argv) + ::RSpec::Core::Runner.new(options).run(stderr, stdout) + else + ::RSpec::Core::CommandLine.new(argv).run(stderr, stdout) + end + end + + def rspec3? + return false if !defined?(::RSpec::Core::Version::STRING) + ::RSpec::Core::Version::STRING =~ /^3\./ + end +end diff --git a/test/integration/account_test.rb b/test/integration/account_test.rb index 624c91f13..994368a28 100644 --- a/test/integration/account_test.rb +++ b/test/integration/account_test.rb @@ -44,7 +44,7 @@ class AccountTest < ActionController::IntegrationTest # User logs in with 'autologin' checked post '/login', :username => user.login, :password => 'admin', :autologin => 1 - assert_redirected_to '/my/page' + assert_redirected_to '/users/1' token = Token.first assert_not_nil token assert_equal user, token.user @@ -73,6 +73,7 @@ class AccountTest < ActionController::IntegrationTest Redmine::Configuration.stubs(:[]).with('autologin_cookie_name').returns('custom_autologin') Redmine::Configuration.stubs(:[]).with('autologin_cookie_path').returns('/') Redmine::Configuration.stubs(:[]).with('autologin_cookie_secure').returns(false) + Redmine::Configuration.stubs(:[]).with('max_concurrent_ajax_uploads').returns(2) with_settings :autologin => '7' do assert_difference 'Token.count' do @@ -85,12 +86,10 @@ class AccountTest < ActionController::IntegrationTest # Session is cleared reset! cookies['custom_autologin'] = token - get '/my/page' + get '/my/account' assert_response :success - assert_difference 'Token.count', -1 do - post '/logout' - end + post '/logout' assert cookies['custom_autologin'].blank? end end