From cf4451e998e470758fc4b247de2442dc1544b9c7 Mon Sep 17 00:00:00 2001 From: whimlex Date: Mon, 13 Apr 2015 18:34:44 +0800 Subject: [PATCH 01/11] =?UTF-8?q?pre=E6=A0=87=E7=AD=BE=E6=8D=A2=E8=A1=8C?= =?UTF-8?q?=EF=BC=9Bcontest=E4=B8=BB=E9=A1=B5=E6=A0=B7=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/comment.rb | 2 +- app/views/welcome/contest.html.erb | 82 +++++++++++++++--------------- app/views/welcome/course.html.erb | 27 ++++------ config/locales/en.yml | 9 ---- config/locales/users/zh.yml | 3 +- config/locales/zh.yml | 10 +--- public/javascripts/application.js | 19 +++++++ public/javascripts/course.js | 15 ++++++ public/stylesheets/application.css | 5 ++ public/stylesheets/public.css | 1 + 10 files changed, 95 insertions(+), 78 deletions(-) diff --git a/app/models/comment.rb b/app/models/comment.rb index 1f6655bc4..bdb642d3c 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -27,7 +27,7 @@ class Comment < ActiveRecord::Base def send_mail if self.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added') - Mailer.news_comment_added(self) + Mailer.run.news_comment_added(self) end end after_destroy :delete_kindeditor_assets diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 6233063a3..fa23f3843 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -257,48 +257,6 @@ -
-

- <%=l(:label_issue_feedback_activities)%> - <%= link_to l(:label_my_question), newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> - <%= link_to l(:label_my_feedback), suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> -

- <%= link_to l(:label_more_information), forums_path %> -
-
    - <% find_new_forum_topics(9 - @contest_notifications.count).each do |topic|%> -
  • -
    -       - <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %> - <%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> - -
    - - <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> - - - <%=l(:label_question_sponsor)%> <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> - - - <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> - <%=l(:label_final_reply)%>  - <%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%> - <% end %> - - - <%=l(:label_reply)%> - (<%= link_to topic.try(:replies_count), topic.event_url %>) - -
    -
    -
  • - <% end %> -
-
-
- -

<%=l(:label_current_attendingcontest_work)%>

@@ -340,6 +298,46 @@
+
+

+ <%=l(:label_issue_feedback_activities)%> + <%= link_to l(:label_my_question), newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> + <%= link_to l(:label_my_feedback), suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> +

+ <%= link_to l(:label_more_information), forums_path %> +
+
    + <% find_new_forum_topics(9 - @contest_notifications.count).each do |topic|%> +
  • +
    +       + <%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %> + <%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %> + +
    + + <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> + + + <%=l(:label_question_sponsor)%> <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> + + + <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> + <%=l(:label_final_reply)%>  + <%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%> + <% end %> + + + <%=l(:label_reply)%> + (<%= link_to topic.try(:replies_count), topic.event_url %>) + +
    +
    +
  • + <% end %> +
+
+
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index 91fa2110c..a764c6eb8 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -41,8 +41,18 @@
<% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> + , + + <%= l(:label_welcome_trustie_course_description) %> + <% else %> <% if @school_id == "0" %> + <% else %> <% if @school_id.nil? %> <%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %> @@ -65,23 +75,6 @@ <%= l(:label_welcome_trustie_course) %> - <% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %> - , - - <%= l(:label_welcome_trustie_course_description) %> - - <% else %> - <% if @school_id == "0" %> - , - <%= @course_page.description %> - - <% end %> - <% end %> <% end %>
diff --git a/app/views/homework_attach/_homeworks_list.html.erb b/app/views/homework_attach/_homeworks_list.html.erb index bf6d3d8e0..d2121c85f 100644 --- a/app/views/homework_attach/_homeworks_list.html.erb +++ b/app/views/homework_attach/_homeworks_list.html.erb @@ -11,11 +11,17 @@ ( <%= homework_count%> ) + <% + url= get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id) if is_batch_homeworks + url= get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id) if not_batch_homework + url= get_homeworks_homework_attach_index_path(:bid_id => @bid.id) if is_all_homeworks + %> + <%= link_to l(:label_export_excel), get_batch_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_batch_homeworks%> <%= link_to l(:label_export_excel), get_not_batch_homework_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if not_batch_homework%> <%= link_to l(:label_export_excel), get_homeworks_homework_attach_index_path(:bid_id => @bid.id,:format => 'xls'),:class=>'xls' if is_all_homeworks%> - - + + 搜索 按  diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 87b17823e..6d2113d4b 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -169,11 +169,20 @@ a:hover.tijiao{ background:#0f99a9 !important;} /*新增*/ .min_search { width: 150px; - height: 20px; + height: 15px; border: 1px solid #d0d0d0 !important; color: #666; - background: url(../images/course/public_icon.png) 135px -193px no-repeat; - cursor: pointer; + /*background: url(../images/course/public_icon.png) 135px -193px no-repeat;*/ + /*cursor: pointer;*/ +} +a.member_search { + width: 43px; + height: 22px; + background: #15bccf; + color: #fff; + text-align: center; + padding: 4px 6px; + text-decoration: none; } From 81cbb76d7834a06427c18054c46b3d4b654c0019 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 14 Apr 2015 19:50:17 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E8=AF=BE=E7=A8=8B/=E9=A1=B9=E7=9B=AE--?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=88=90=E5=91=98=EF=BC=9A=E7=94=A8=E7=9C=9F?= =?UTF-8?q?=E5=AE=9E=E5=A7=93=E5=90=8D=E6=90=9C=E7=B4=A2=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E9=9C=80=E8=A6=81=E5=9C=A8=E5=A7=93=E5=92=8C?= =?UTF-8?q?=E5=90=8D=E4=B9=8B=E9=97=B4=E5=8A=A0=E4=B8=AA=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E6=89=8D=E5=8F=AF=E4=BB=A5=E6=90=9C=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/principal.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/principal.rb b/app/models/principal.rb index 5aa21768f..dfec5b911 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -42,7 +42,8 @@ class Principal < ActiveRecord::Base where({}) else pattern = "%#{q}%" - sql = %w(login firstname lastname mail).map {|column| "LOWER(#{table_name}.#{column}) LIKE LOWER(:p)"}.join(" OR ") + # sql = %w(login firstname lastname mail).map {|column| "LOWER(#{table_name}.#{column}) LIKE LOWER(:p)"}.join(" OR ") + sql= "LOWER(concat(lastname,firstname)) LIKE LOWER(:p) or LOWER(login) LIKE LOWER(:p) or LOWER(mail) LIKE LOWER(:p)" params = {:p => pattern} if q =~ /^(.+)\s+(.+)$/ a, b = "#{$1}%", "#{$2}%" From ee688281326cf000596e088663a69ccc77bb0409 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 15 Apr 2015 08:50:29 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=90=8E=E8=B7=B3=E8=BD=ACURL=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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1c2419305..8710b624e 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -429,7 +429,7 @@ class CoursesController < ApplicationController else respond_to do |format| format.html { - render :layout => 'base_courses' + # render :layout => 'base_courses' flash[:notice] = l(:notice_successful_create) if params[:continue] redirect_to new_course_url(attrs, :course => '0') From 78dff36d7a7b080e28f463b1a5ce0abbdfe1a355 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 15 Apr 2015 09:06:54 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E8=80=81=E5=B8=88=E5=8F=AA=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E4=B8=8D=E8=AF=84=E5=88=86=E7=9A=84=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8D=B4=E5=9C=A8=E5=B7=B2=E8=AF=84=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index ae4e66d1c..a2d5ef456 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -606,7 +606,7 @@ class HomeworkAttachController < ApplicationController order_by = "created_at #{direction}" end @all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, + (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score FROM homework_attaches WHERE bid_id = #{bid_id} ORDER BY #{order_by}) AS table1 From d1f42a3954b8b09fb558b4e74c1eec0ed45b3509 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 15 Apr 2015 09:52:33 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E6=95=99=E5=B8=88=E5=8F=AA=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E4=B8=8D=E8=AF=84=E5=88=86=E7=9A=84=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=9C=A8=E6=9C=AA=E6=89=B9=E5=92=8C=E5=B7=B2=E6=89=B9=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E4=B8=AD=E9=83=BD=E6=9C=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index a2d5ef456..c90d078e2 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -51,7 +51,7 @@ class HomeworkAttachController < ApplicationController order_by = "created_at #{direction}" end all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, + (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY #{order_by}) AS table1 @@ -483,7 +483,7 @@ class HomeworkAttachController < ApplicationController get_not_batch_homework_list params[:cur_sort] || "s_socre",params[:cur_direction] || "desc",@homework.bid_id elsif @cur_type == "2" #老师已批列表 @result_homework = HomeworkAttach.find_by_sql("SELECT homework_attaches.*, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, + (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score FROM homework_attaches WHERE id = #{@homework.id}").first elsif @cur_type == "3" #全部作业列表 @@ -606,11 +606,11 @@ class HomeworkAttachController < ApplicationController order_by = "created_at #{direction}" end @all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT * FROM (SELECT homework_attaches.*, - (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL AND stars > 0 ORDER BY updated_at DESC limit 0,1) AS t_score, + (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score FROM homework_attaches WHERE bid_id = #{bid_id} ORDER BY #{order_by}) AS table1 - WHERE table1.t_score IS NULL") + WHERE table1.t_score IS NULL OR table1.t_score = 0 ") @all_homework_list = search_homework_member(@all_homework_list,@search_name.to_s.downcase) if @search_name @homework_list = paginateHelper @all_homework_list,10 end From 61df6e144d548254d132db6f9c73900714c57dcf Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 15 Apr 2015 10:06:52 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8QQ=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E6=98=BE=E7=A4=BA=E8=B6=85=E5=87=BA=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_homework.html.erb | 8 +++++--- public/stylesheets/css.css | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/views/layouts/base_homework.html.erb b/app/views/layouts/base_homework.html.erb index 1e6b9bca2..96671cc6d 100644 --- a/app/views/layouts/base_homework.html.erb +++ b/app/views/layouts/base_homework.html.erb @@ -37,6 +37,8 @@ .span_wping a:hover{ background-color:#03a1b3;} .span_wping_background{background: #CCC !important;} .font_lighter_sidebar img{max-width: 100%} + /*上传图片处理*/ + .upload_img img{max-width: 100%;} @@ -122,7 +124,7 @@
- +
<% if (User.current.admin?||User.current.allowed_to?(:as_teacher,course)) %> - diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index 6d2113d4b..2b820381e 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -184,6 +184,8 @@ a.member_search { padding: 4px 6px; text-decoration: none; } +/*上传图片处理*/ +.upload_img img{max-width: 100%;} From 7dbd20e5eb0b70936936ecda2954d3e10217995a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 15 Apr 2015 10:27:17 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=97=B6=E5=8F=AA=E8=AF=84=E8=AE=BA=E6=9C=AA?= =?UTF-8?q?=E8=AF=84=E5=88=86=E8=A1=A8=E7=9A=84=E4=BD=9C=E5=93=81=E5=9C=A8?= =?UTF-8?q?=E5=B7=B2=E8=AF=84=E5=88=97=E8=A1=A8=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 21b3cc531..d38846ea0 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -490,7 +490,7 @@ class BidsController < ApplicationController (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score, (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score FROM homework_attaches WHERE bid_id = #{@bid.id} ORDER BY s_score DESC,created_at ASC) AS table1 - WHERE table1.t_score IS NULL") + WHERE table1.t_score IS NULL OR table1.t_score = 0") @not_batch_homework = true @cur_type = 1 else
@@ -151,8 +153,8 @@
- <%= @bid.description.html_safe %> + +
<%= @bid.description.html_safe %>