From 09b6f1d78792123c56364ba29f2d7fd58ad045d5 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 26 Jun 2015 17:16:03 +0800 Subject: [PATCH 01/68] =?UTF-8?q?=E4=BF=AE=E6=94=B9news=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/news.rb | 6 ++++-- app/services/courses_service.rb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/api/mobile/entities/news.rb b/app/api/mobile/entities/news.rb index f189771e3..7399ebb4c 100644 --- a/app/api/mobile/entities/news.rb +++ b/app/api/mobile/entities/news.rb @@ -26,13 +26,15 @@ module Mobile news_expose :title expose :author,using: Mobile::Entities::User do |f, opt| - n = f[:news] - n.author if n.respond_to?(:author) + n = f[:author] + #n.author if n.respond_to?(:author) end #作者id news_expose :author_id #作者名 news_expose :author_name + #作者头像url + news_expose :author_img_url #新闻内容 news_expose :description #发布时间 diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 29c4fb1b0..f5ff2670f 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -123,7 +123,7 @@ class CoursesService scope = @course ? @course.news.course_visible(current_user) : News.course_visible(current_user) news = [] scope.each do |n| - news << {:id => n.id,:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count} + news << {:id => n.id,:title => n.title,:author_name => n.author.name,:author_id => n.author.id, :author=>n.author, :description => n.description,:created_on => format_time(n.created_on),:comments_count => n.comments_count} end news end From 7fa45a47bbe8da71923b15df36c0b9ea1758007b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 29 Jun 2015 10:59:39 +0800 Subject: [PATCH 02/68] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=88=AA=E8=87=B3?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E5=90=AF=E5=8A=A8=E5=8C=BF=E8=AF=84=E7=BB=99?= =?UTF-8?q?=E5=87=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 1 + app/views/homework_common/start_anonymous_comment.js.erb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 5cd55e23b..659d0fa8e 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -135,6 +135,7 @@ class HomeworkCommonController < ApplicationController #statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限 def start_anonymous_comment @statue =4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course) + @statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") > Time.now.strftime("%Y-%m-%d") if @homework_detail_manual.comment_status == 1 student_works = @homework.student_works if student_works && student_works.size >=2 diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb index cd4dafde8..5f27a5b82 100644 --- a/app/views/homework_common/start_anonymous_comment.js.erb +++ b/app/views/homework_common/start_anonymous_comment.js.erb @@ -5,6 +5,8 @@ $("#<%= @homework.id %>_start_anonymous_comment").replaceWith('<%= escape_javasc alert('启动失败\n作业总数大于等于2份时才能启动匿评'); <% elsif @statue == 3%> alert("已开启匿评,请务重复开启"); -<% elsif @statue == 3%> +<% elsif @statue == 4%> alert("您没有权限开启匿评"); +<% elsif @statue == 5%> +alert("作业提交截止之后才能启动匿评"); <% end %> \ No newline at end of file From 3e6ccf3e501a5edee690ea35fc0c2fed05d786d7 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 09:47:54 +0800 Subject: [PATCH 03/68] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E6=88=AA=E8=87=B3?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=E4=B8=8D=E8=83=BD=E5=90=AF=E5=8A=A8=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 2 +- app/helpers/application_helper.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 659d0fa8e..18ee03d2e 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -135,7 +135,7 @@ class HomeworkCommonController < ApplicationController #statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限 def start_anonymous_comment @statue =4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course) - @statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") > Time.now.strftime("%Y-%m-%d") + @statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") if @homework_detail_manual.comment_status == 1 student_works = @homework.student_works if student_works && student_works.size >=2 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5af4e2038..a31bd6189 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2278,7 +2278,9 @@ module ApplicationHelper #获取匿评相关连接代码 def homework_anonymous_comment homework if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业 - if homework.student_works.count >= 2 #作业份数大于2 + if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") + link = "启动匿评".html_safe + elsif homework.student_works.count >= 2 #作业份数大于2 case homework.homework_detail_manual.comment_status when 1 link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit' From 59f6ef81cda792d51cd3633c4507c538751495e0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 10:15:04 +0800 Subject: [PATCH 04/68] =?UTF-8?q?=E9=99=84=E4=BB=B6=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E6=A1=86=E5=9B=BA=E5=AE=9A=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 4 ++-- public/stylesheets/courses.css | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/javascripts/course.js b/public/javascripts/course.js index f73ab7bf6..172e630f0 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -802,8 +802,8 @@ $(function(){ $(".zip_download_alert").bind("mouseover",function(e){ //alert($(this).html()); $(this).next("div").show(); - $(this).next("div").css("top",e.pageY); - $(this).next("div").css("left",e.pageX); + //$(this).next("div").css("top",e.pageY); + //$(this).next("div").css("left",e.pageX); }); $(".zip_download_alert").bind("mouseout",function(e){ //alert($(this).html()); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 0bd28bea7..056a33752 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -654,7 +654,7 @@ a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;} .fr{ float:right;} .li_min_search{ float:right; margin-right:-10px;} -.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;} +.info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 110px;margin-top: 10px;} /*返回顶部*/ .to_top{width: 19px;height: 74px;position: fixed;top: 50px;right: 1px;color: white;background: #15bccf; line-height: 1.2; padding-top: 10px;padding-left: 5px;font-size: 14px;cursor: pointer;} .hwork_num_ab{ width:120px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;min-height: 1px;} From af97f3bea88e6b692b718fa38cd4260bf79c77e1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 30 Jun 2015 10:18:46 +0800 Subject: [PATCH 05/68] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E3=80=81=E9=80=9A=E7=9F=A5=E5=B1=95=E5=BC=80=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=B1=85=E5=8F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/index.html.erb | 5 +++-- app/views/news/_course_news.html.erb | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 3208bb969..a1aa49c8c 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -41,12 +41,13 @@ <%= homework.description.html_safe %> +
-<%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %> From 7338f0d44ea253b322676102ecbe346c59eca7bb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 10:02:50 +0800 Subject: [PATCH 15/68] =?UTF-8?q?=E6=9C=AA=E5=AE=8C=E5=96=84=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E8=B5=84=E6=96=99=E7=9A=84=E7=94=A8=E6=88=B7=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=8F=AF=E4=BB=A5=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 27 ++++++++++----------------- app/services/courses_service.rb | 4 +++- config/locales/zh.yml | 1 + 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 3b25438df..00d740ee7 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -443,26 +443,19 @@ class CoursesController < ApplicationController def create cs = CoursesService.new @course = cs.create_course(params,User.current)[:course] - if @course.new_record? + if @course respond_to do |format| - format.html { render :action => 'new', :layout => 'new_base' } #Added by young - format.api { render_validation_errors(@course) } + flash[:notice] = l(:notice_successful_create) + format.html {redirect_to settings_course_url(@course, :course_type => 1)} + format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) } end else respond_to do |format| - format.html { - # render :layout => 'base_courses' - flash[:notice] = l(:notice_successful_create) - if params[:continue] - redirect_to new_course_url(attrs, :course => '0') - elsif params[:course_continue] - redirect_to new_course_url(:course => '1') - else - redirect_to settings_course_url(@course, :course_type => 1) - end - } - format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) } - end + flash[:notice] = l(:notice_create_failed) + # @course = Course.new + format.html { redirect_to new_course_path } #Added by young + format.api { render_validation_errors(@course) } + end end end @@ -532,7 +525,7 @@ class CoursesController < ApplicationController @trackers = Tracker.sorted.all @course = Course.new @course.safe_attributes = params[:course] - month = Time.now.month + # month = Time.now.month render :layout => 'new_base' end diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index f5ff2670f..68177552c 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -201,12 +201,14 @@ class CoursesService @course.class_period = params[:class_period].to_i params[:course][:is_public] ? @course.is_public = 1 : @course.is_public = 0 params[:course][:open_student] ? @course.open_student = 1 : @course.open_student = 0 + else + end @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all - if @course.save + if @course && @course.save #unless User.current.admin? r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first m = Member.new(:user => current_user, :roles => [r]) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2a538138d..1aab2a22c 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -12,6 +12,7 @@ zh: notice_account_wrong_password: 密码错误 name_can_be_empty: 可以不填写真实姓名[保密所需] notice_successful_create: 创建成功 + notice_create_failed: 创建失败,请先完善个人信息 notice_failed_create: 创建失败 notice_successful_update: 更新成功 notice_successful_edit: 修改成功 From fa1a03bef322d818ae5a5febb75cc45ac07325b0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 10:30:26 +0800 Subject: [PATCH 16/68] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8F=AF=E6=9F=A5=E7=9C=8B=E4=B8=8B=E8=BD=BD=E7=A7=81?= =?UTF-8?q?=E6=9C=89=E8=AF=BE=E7=A8=8B=E7=9A=84=E7=A7=81=E6=9C=89=E8=B5=84?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 2 +- app/views/files/_course_list.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 0003f7586..19c1214e2 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -37,7 +37,7 @@ class FilesController < ApplicationController obj.each do |container| @attachments += container.attachments end - @all_attachments = visable_attachemnts(@attachments) + @all_attachments = User.current.admin? ? @attachments : visable_attachemnts(@attachments) @limit = 10 @feedback_count = @all_attachments.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 8536a3ef5..353d19dab 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -22,7 +22,7 @@
- <%=l(:label_project)%> - | -- <%=l(:field_is_public)%> - | -- <%=l(:field_created_on)%> - | -- |
---|---|---|---|
- - <%= link_to_project_settings(project, {}) %> - - | -- <%= checked_image project.is_public? %> - | -- <%= format_date(project.created_on) %> - | -- <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %> - <%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %> - <%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %> - <%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %> - | -
+ 序号 + | ++ <%=l(:label_project)%> + | ++ <%=l(:field_is_public)%> + | ++ <%=l(:field_created_on)%> + | ++ |
---|---|---|---|---|
+ <%= project.id %> + | ++ + <%= link_to_project_settings(project, {}) %> + + | ++ <%= checked_image project.is_public? %> + | ++ <%= format_date(project.created_on) %> + | ++ <%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %> + <%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %> + <%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %> + <%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del') %> + | +
+ 序号 + | ++ 课程 + | ++ 主讲老师 + | ++ 学时 + | ++ <%=l(:field_is_public)%> + | ++ <%=l(:field_created_on)%> + | +
---|---|---|---|---|---|
+ <%= course.id %> + | ++ + <%= link_to(course.name, course_path(course.id)) %> + + | ++ <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> + | ++ <%= course.class_period %> + | ++ <%= checked_image course.is_public? %> + | ++ <%= format_date(course.created_at) %> + | +
((.|\s)*?)}m, '[...]') @content = "> #{ll(Setting.default_language, :text_user_wrote, user)}\n> " @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n" + @content = "
" << @content @id = user.id rescue ActiveRecord::RecordNotFound render_404 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 340559828..0d0b82752 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -186,7 +186,7 @@ class Mailer < ActionMailer::Base @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc") - + @user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC') # 查询user在项目中留言(用户反馈) diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index f7594d000..444016db8 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -20,8 +20,10 @@ <%= render :partial => 'history', :locals => {:issue => @issue, :journals => @journals} %>
<%= render_notes_issue(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %>
++ <%= render_notes_issue(issue, journal, :reply_links => reply_links) unless journal.notes.blank? %> +
<%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %>
+由<%= @journal.user %> 更新于 <%= format_time @journal.created_on %>
基本规则设置(总分为100分)