From 8289ca6c8920d6a58ce8779a21902576c2633da0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 31 Jan 2015 11:14:55 +0800 Subject: [PATCH 01/44] 11111 --- app/controllers/zipdown_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index b329e4c27..6c5385115 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -7,6 +7,7 @@ class ZipdownController < ApplicationController SAVE_FOLDER = "#{Rails.root}/files" OUTPUT_FOLDER = "#{Rails.root}/tmp/archiveZip" + def assort if params[:obj_class] == "Bid" bid = Bid.find params[:obj_id] From d76c0a5365619de89ab9ca3cb2ffaed9e946ea6c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 31 Jan 2015 14:28:02 +0800 Subject: [PATCH 02/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=95=8C=E9=9D=A2=E6=98=BE=E7=A4=BA=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_attach/new.html.erb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/views/homework_attach/new.html.erb b/app/views/homework_attach/new.html.erb index 77077f102..e9d32afd4 100644 --- a/app/views/homework_attach/new.html.erb +++ b/app/views/homework_attach/new.html.erb @@ -37,7 +37,7 @@ function submit_homework_form(){if(regexName()&®exDescription()){$('#new_homework_attach').submit();}} -
+
    @@ -82,9 +82,6 @@

    -
    -

    -

    +
      @@ -75,7 +75,6 @@ <%= f.text_area :description, :rows => 8, :name => "homework_description", :class => "w620", :maxlength => 3000, :placeholder => "最多3000个汉字" %>

      -

      +
    <% end %> From 4f82fe2a7b34e136ced36aea572c6140fca6b0a0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 31 Jan 2015 14:47:17 +0800 Subject: [PATCH 05/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E6=A1=86=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css.css | 1 + 1 file changed, 1 insertion(+) diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index ffb9da644..a64d73832 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -1,6 +1,7 @@ /* CSS Document */ #content{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;} #popbox{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;} +#popbox02{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea{ margin:0; padding:0;} div,img,tr,td,textarea{ border:0;} table,tr,td{border:0; cellspacing:0; cellpadding:0;} From 280092366bb74094992a9e9fdfaf9e27796abbd8 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 31 Jan 2015 14:54:37 +0800 Subject: [PATCH 06/44] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css.css | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/public/stylesheets/css.css b/public/stylesheets/css.css index a64d73832..2319d1f59 100644 --- a/public/stylesheets/css.css +++ b/public/stylesheets/css.css @@ -1,7 +1,5 @@ /* CSS Document */ -#content{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;} -#popbox{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;} -#popbox02{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;} +#content,#popbox,#popbox02{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea{ margin:0; padding:0;} div,img,tr,td,textarea{ border:0;} table,tr,td{border:0; cellspacing:0; cellpadding:0;} From 523af8b2a905cdb32056bd4eae0ad0822ac088a0 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 31 Jan 2015 15:43:35 +0800 Subject: [PATCH 07/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E7=89=88=E7=BB=93=E6=9E=84=E5=8F=8A=E5=88=97=E8=A1=A8=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 6 +++++ app/controllers/originizations_controller.rb | 6 ----- app/controllers/welcome_controller.rb | 14 +++++------ ...ions_helper.rb => organizations_helper.rb} | 0 app/views/organizations/index.html.erb | 23 +++++++++++++++++ app/views/originizations/index.html.erb | 25 ------------------- app/views/welcome/index.html.erb | 10 ++++---- config/locales/zh.yml | 8 +++--- config/routes.rb | 4 +-- public/stylesheets/application.css | 9 +++++++ 10 files changed, 56 insertions(+), 49 deletions(-) create mode 100644 app/controllers/organizations_controller.rb delete mode 100644 app/controllers/originizations_controller.rb rename app/helpers/{originizations_helper.rb => organizations_helper.rb} (100%) create mode 100644 app/views/organizations/index.html.erb delete mode 100644 app/views/originizations/index.html.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb new file mode 100644 index 000000000..c9cce5752 --- /dev/null +++ b/app/controllers/organizations_controller.rb @@ -0,0 +1,6 @@ +class OrganizationsController < ApplicationController + layout 'project_base' + def index + @projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)") + end +end diff --git a/app/controllers/originizations_controller.rb b/app/controllers/originizations_controller.rb deleted file mode 100644 index 033f9d8ec..000000000 --- a/app/controllers/originizations_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -class OriginizationsController < ApplicationController - layout 'project_base' - def index - @enterprises = Project.find_by_sql("select distinct(enterprise_name) from projects") - end -end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index b1138f964..6704346a5 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -25,15 +25,15 @@ class WelcomeController < ApplicationController before_filter :entry_select, :only => [:index] def index - unless params[:originization].nil? - @originization = params[:originization] - @originization_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @originization]) - @e_count = @originization_projects.count - if @e_count < 10 - part_count = 10 -@e_count + unless params[:project].nil? + @cur_projects = Project.find(params[:project]) + @organization = @cur_projects.enterprise_name + @organization_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @organization]) + @e_count = @organization_projects.count + if @e_count < 9 + part_count = 9 - @e_count # @part_projects = find_all_hot_project part_count, order @part_projects = find_miracle_project(part_count, 3,"score desc") - limit = 10 - @e_count end end if @first_page.nil? || @first_page.sort_type.nil? diff --git a/app/helpers/originizations_helper.rb b/app/helpers/organizations_helper.rb similarity index 100% rename from app/helpers/originizations_helper.rb rename to app/helpers/organizations_helper.rb diff --git a/app/views/organizations/index.html.erb b/app/views/organizations/index.html.erb new file mode 100644 index 000000000..a5773ba2f --- /dev/null +++ b/app/views/organizations/index.html.erb @@ -0,0 +1,23 @@ +<%= l(:label_all_enterprises) %> +
    +
    <%= l(:label_all_enterprises) %>
    +
    + <% if @projects.count == 0 %> +

    <%= l(:label_enterprise_nil) %>

    + <% else %> + <% @projects.each do |project| %> + <% unless project.enterprise_name.blank? %> + + <% end %> + <% end %> + <% end %> +
    +
    +
    +
    +
      +
      +<% html_title(l(:label_enterprise_all)) -%> diff --git a/app/views/originizations/index.html.erb b/app/views/originizations/index.html.erb deleted file mode 100644 index 7e31a2e75..000000000 --- a/app/views/originizations/index.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -
      -

      - <%= link_to l(:label_all_enterprises) %> -

      -

      - <% if @enterprises.count == 0 %> -

      <%= l(:label_enterprise_nil) %>

      - <% else %> - <% @enterprises.each do |enterprise| %> - <% unless enterprise.enterprise_name.blank? %> -
        -
      • - <%= link_to enterprise.enterprise_name, home_path(:originization => enterprise.enterprise_name) %> -
      • -
      - <% end %> - <% end %> - <% end %> -

      -
      -
      -
      -
        -
        -<% html_title(l(:label_enterprise_all)) -%> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index c53377134..07f99c89d 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -31,7 +31,7 @@
        - <% if @enterprise.nil? %> + <% if @organization.nil? %> <% if get_avatar?(@first_page) %> <%= image_tag(url_to_avatar(@first_page), width:@first_page.image_width,height: @first_page.image_height) %> <% else %> @@ -42,13 +42,13 @@ <% end %>
        - <% if @enterprise.nil? %> + <% if @organization.nil? %> <% unless @first_page.nil? %> <%= @first_page.description.html_safe %> <% end %> <% else %> - <%= link_to @enterprise, options={:action => 'index', :enterprise => @enterprise}, html_options={ :method => 'get', :style => "color: #E8770D"} %> + <%= link_to @organization, options={:action => 'index', :enterprise => @organization}, html_options={ :method => 'get', :style => "color: #E8770D"} %>
        <%= @first_page.title %> <% end %> @@ -77,7 +77,7 @@
          - <% if @originization.nil? %> + <% if @organization.nil? %> <% @projects.map do |project| %> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %> <% end; reset_cycle %> @@ -89,7 +89,7 @@ <%= render :partial => 'hot_projects_list', :locals => {:project => project} %> <% end %> <% elsif @e_count < 10 %> - <% @originization_projects.map do |project| %> + <% @organization_projects.map do |project| %> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %> <% end %>

          <%= l(:label_part_enterprise_tips) %>

          diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 524494f45..d0be02253 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -275,7 +275,7 @@ zh: label_course_closed_tips: "确定要%{desc}课程?" # end field_name: 名称 - field_enterprise_name: 企业名 + field_enterprise_name: 组织名称 #added by huang field_tea_name: 教师 field_couurse_time: 学时 @@ -2205,7 +2205,7 @@ zh: label_course_practice: 课程实践 label_forum_all: 公共贴吧 label_school_all: 中国高校 - :label_enterprise_all: 名企 + label_enterprise_all: 组织 label_contest_innovate: 创新竞赛 label_software_user: 软件创客 label_requirement_enterprise: 软件众包 @@ -2454,6 +2454,6 @@ zh: label_all_enterprises: 所有企业 label_my_enterprise: 我的企业 label_enterprise_tips: 暂时还没有该企业对应的项目,系统的其它项目您可能会感兴趣! - label_part_enterprise_tips: 系统的其它项目您可能也会感兴趣! + label_part_enterprise_tips: 您可能对系统的其它项目会感兴趣! label_enterprise_nil: 改模块为最新上线模块,目前还未有项目关联到企业! - label_enterprises: 名企 + label_enterprises: 组织 diff --git a/config/routes.rb b/config/routes.rb index 97d603242..81dea18ff 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -26,7 +26,7 @@ # Example: :via => :get ====> :via => :get RedmineApp::Application.routes.draw do - get "originizations/index" + get "organizations/index" #match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index' @@ -390,7 +390,7 @@ RedmineApp::Application.routes.draw do match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get # match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get match '/homework', :to => 'projects#homework', :as => 'homework', :via => :get - match 'originizations', :to => 'originizations#index', :as => 'index', :via => :get + match 'organizations', :to => 'organizations#index', :as => 'index', :via => :get # match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get # match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index fb2b451fa..5a84c5005 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -8,6 +8,15 @@ h3, .wiki h2 {font-size: 15px; padding-left: 5px} h4, .wiki h3 {font-size: 13px;} h4 {border-bottom: 1px dotted #bbb;} /*huang*/ +/*企业版样式*/ +.content_syqy{ width:940px; height:400px; border:1px;} +.content_syqy .list{ font-size:14px; font-weight:normal; margin-left:10px; font-weight:bold; padding-top:10px} +.syqy_box{ margin-left:-30px; margin-top:5px;} +.syqy_box ul li{ float:left; margin-right:10px; border:1px solid #e3e3e3; width:215px; height:30px; padding:5px; padding-right:0px; margin-bottom:10px; overflow:hidden; text-overflow:ellipsis;font-size:14px; color:#464646;white-space: nowrap; } +.syqy_box ul li img{ float:left; margin-right:3px; } +.syqy_box ul li a { font-size:14px; color:#464646; height:30px; padding-top:500px;} +.syqy_box ul li a:hover{color:#15bccf;} +a.syqy_wenzi{ padding-bottom:10px; border:1px solid red;} /*current position*/ .enterprise_all{ padding-left: 20px; From 9e36f9264c956b3ae4e83ba8df73d717e6b3d24a Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sat, 31 Jan 2015 15:46:10 +0800 Subject: [PATCH 08/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E7=AB=9E?= =?UTF-8?q?=E8=B5=9B=E4=BD=9C=E4=B8=9A=E8=AF=84=E5=88=86=E3=80=8B=20Signed?= =?UTF-8?q?-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contests/show_attendingcontest.html.erb | 48 ++++++++++--------- config/locales/zh.yml | 2 +- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb index f8c231550..3f8ef4264 100644 --- a/app/views/contests/show_attendingcontest.html.erb +++ b/app/views/contests/show_attendingcontest.html.erb @@ -136,34 +136,35 @@ <% else %> <%= l(:label_noawards_current) %> <% end %> - <% else %> - <% case get_prize(c_project) %> - <% when '-1' %> - <%= image_tag("/images/bid/special_reward.png") %> - <% when '0' %> - <%= image_tag("/images/bid/first_reward.png") %> - <% when '1' %> - <%= image_tag("/images/bid/second_reward.png") %> - <% when '2' %> - <%= image_tag("/images/bid/third_reward.png") %> - <% when '3' %> - <%= image_tag("/images/bid/forth_reward.png") %> - <% when '4' %> - <%= image_tag("/images/bid/fifth_reward.png") %> - <% when '5' %> - <%= image_tag("/images/bid/qualified.png") %> - <% end %> - <% end %> + <% else %> + <% case get_prize(c_project) %> + <% when '-1' %> + <%= image_tag("/images/bid/special_reward.png") %> + <% when '0' %> + <%= image_tag("/images/bid/first_reward.png") %> + <% when '1' %> + <%= image_tag("/images/bid/second_reward.png") %> + <% when '2' %> + <%= image_tag("/images/bid/third_reward.png") %> + <% when '3' %> + <%= image_tag("/images/bid/forth_reward.png") %> + <% when '4' %> + <%= image_tag("/images/bid/fifth_reward.png") %> + <% when '5' %> + <%= image_tag("/images/bid/qualified.png") %> + <% end %> + <% end %> - <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> + <% if ((User.current.id == @contest.author_id) && (@contest.deadline >= Date.today))||User.current.admin %> + <%= toggle_link l(:label_reward), c_project.id.to_s %> -
        @@ -282,7 +284,7 @@ - <% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %> + <% if ((User.current.id == @contest.author_id) && (@contest.deadline >= Date.today))||User.current.admin %>
        <%= toggle_link '评奖', c_softapplication.id.to_s %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 524494f45..13f609aef 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2204,7 +2204,7 @@ zh: label_project_deposit: 项目托管 label_course_practice: 课程实践 label_forum_all: 公共贴吧 - label_school_all: 中国高校 + :label_enterprise_all: 名企 label_contest_innovate: 创新竞赛 label_software_user: 软件创客 From 4ebd34722d336afc8712bdf16823cd0ed6631fde Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sat, 31 Jan 2015 15:53:50 +0800 Subject: [PATCH 09/44] =?UTF-8?q?email=5Fverifier=20=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/email_verifier | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/email_verifier b/lib/email_verifier index 3cabcc643..222a9bdd7 160000 --- a/lib/email_verifier +++ b/lib/email_verifier @@ -1 +1 @@ -Subproject commit 3cabcc643f36939939685e6f55273dfbf89da545 +Subproject commit 222a9bdd72014f197baf2131ab71cc41660111ed From 1dd8724656bddea4a4fa053f59eac931a35770c8 Mon Sep 17 00:00:00 2001 From: huang Date: Sat, 31 Jan 2015 16:10:20 +0800 Subject: [PATCH 10/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/index.html.erb | 2 +- public/stylesheets/application.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/organizations/index.html.erb b/app/views/organizations/index.html.erb index a5773ba2f..3e0e507c5 100644 --- a/app/views/organizations/index.html.erb +++ b/app/views/organizations/index.html.erb @@ -9,7 +9,7 @@ <% unless project.enterprise_name.blank? %> <% end %> <% end %> diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index b11509e14..cbd383151 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -14,7 +14,7 @@ h4 {border-bottom: 1px dotted #bbb;} .syqy_box{ margin-left:-30px; margin-top:5px;} .syqy_box ul li{ float:left; margin-right:10px; border:1px solid #e3e3e3; width:215px; height:30px; padding:5px; padding-right:0px; margin-bottom:10px; overflow:hidden; text-overflow:ellipsis;font-size:14px; color:#464646;white-space: nowrap; } .syqy_box ul li img{ float:left; margin-right:3px; } -.syqy_box ul li a { font-size:14px; color:#464646; height:30px; padding-top:500px;} +.syqy_box ul li a { float:left;font-size:14px; color:#464646; height:30px; padding-top:4px; width: 175px; overflow:hidden; text-overflow:ellipsis;} .syqy_box ul li a:hover{color:#15bccf;} a.syqy_wenzi{ padding-bottom:10px; border:1px solid red;} /*current position*/ From 79d1a069c21ce6772663b39e8f52decde43747b1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 31 Jan 2015 16:19:13 +0800 Subject: [PATCH 11/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E5=90=8D=E5=AD=97=E8=BF=87=E9=95=BF=E9=A6=96=E9=A1=B5=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/index.html.erb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 95efcdb0a..ff1841bd4 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -41,16 +41,19 @@ <%= image_tag '/images/avatars/Project/0', width:@first_page.image_width,height: @first_page.image_height %> <% end %>
        -
        +
        <% if @organization.nil? %> <% unless @first_page.nil? %> <%= @first_page.description.html_safe %> <% end %> <% else %> - - <%= link_to @organization, options={:action => 'index', :enterprise => @organization}, html_options={ :method => 'get', :style => "color: #E8770D"} %> -
        - <%= @first_page.title %> + + <%= link_to @organization, options={:action => 'index', :enterprise => @organization}, html_options={ :method => 'get', :style => "color: #E8770D"} %> + +
        + + <%= @first_page.title %> + <% end %>
      \ No newline at end of file diff --git a/app/views/admin/enterprise_page_made.html.erb b/app/views/admin/enterprise_page_made.html.erb new file mode 100644 index 000000000..566f09bb8 --- /dev/null +++ b/app/views/admin/enterprise_page_made.html.erb @@ -0,0 +1,39 @@ +

      <%=l(:label_first_page_made)%>

      + +<%= form_tag(:controller => 'admin', :action => 'enterprise_page_made') do %> +

      + + <%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +

      + <%= render 'tab_partial' %> +

      <%=l(:label_enterprise_page_made)%>

      +

      + +

      +
      + <%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@enterprise_page} %> +
      +

      + + <%= text_field_tag 'image_width', params[:label_image_width],:value => @enterprise_page.image_width,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +

      +

      + + <%= text_field_tag 'image_height', params[:label_imgae_height], :value => @enterprise_page.image_height,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +

      +

      + + <%= text_field_tag 'course_title', params[:label_site_title], :value => @enterprise_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +

      +

      + + <%= text_area_tag 'course_description',@enterprise_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %> +

      + + <%= submit_tag l(:button_save), :class => "small", :name => nil %> +<% end %> +
      + + + +
      \ No newline at end of file diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index ff1841bd4..972c3250e 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -38,7 +38,7 @@ <%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %> <% end %> <% else %> - <%= image_tag '/images/avatars/Project/0', width:@first_page.image_width,height: @first_page.image_height %> + <%= image_tag(url_to_avatar(@enterprise_page), width:@first_page.image_width,height: @first_page.image_height) %> <% end %>
      @@ -52,7 +52,7 @@
      - <%= @first_page.title %> + <%= @enterprise_page.title %> <% end %>
      diff --git a/config/locales/en.yml b/config/locales/en.yml index cb89070ff..6f272a980 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2088,4 +2088,5 @@ en: label_anonymous_comments: Anonymous comments label_anonymous: Anonymous label_submit_comments: Submit_comments - label_course_empty_select: You have not selected course! \ No newline at end of file + label_course_empty_select: You have not selected course! + label_enterprise_page_made: enterprise_page \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 50c29bd05..171117778 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -536,6 +536,7 @@ zh: label_project_first_page: 项目托管平台首页 label_course_first_page: 课程实践平台首页 label_contest_first_page: 竞赛实战平台首页 + label_enterprise_page_made: 在线协同开发社区首页 label_web_footer_page: 网站页脚配置 label_organizer_name: 主办单位名称 label_web_footer_description: 页脚内容 diff --git a/config/routes.rb b/config/routes.rb index 81dea18ff..a06679fba 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -640,6 +640,7 @@ RedmineApp::Application.routes.draw do match 'admin/course_page_made', as: :course_page_made match 'admin/contest_page_made', as: :contest_page_made match 'admin/web_footer_made', as: :web_footer_made + match 'admin/enterprise_page_made', as: :enterprise_page_made match 'admin/search', :via => [:get, :post] match 'admin/plugins', :via => :get match 'admin/info', :via => :get From 944dc33212fe95d5873ca0ab8b9607d4221ee03a Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 31 Jan 2015 17:14:47 +0800 Subject: [PATCH 13/44] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=8E=89API=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/api.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index e2c4aa357..bee78a20e 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -39,7 +39,7 @@ module Mobile mount Apis::Homeworks #add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'}) - add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development? + #add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development? end end From ab18dfcaa882f45276db8f49ae45c05375951778 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 31 Jan 2015 17:19:13 +0800 Subject: [PATCH 14/44] =?UTF-8?q?School=20=3D>=20=20=E4=B8=AD=E5=9B=BD?= =?UTF-8?q?=E9=AB=98=E6=A0=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/en.yml | 2 +- config/locales/zh.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/locales/en.yml b/config/locales/en.yml index cb89070ff..b7a2b59eb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1774,7 +1774,7 @@ en: label_project_deposit: Projects label_course_practice: Courses label_forum_all: Forums - label_school_all: Schools +# label_school_all: Schools label_contest_innovate: Competition community label_software_user: Users label_requirement_enterprise: Requirements diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 50c29bd05..02f4afba6 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2421,6 +2421,7 @@ zh: review_assignments: 评审任务 label_my_school: 我的学校 label_all_schol: 全部学校 + label_school_all: 中国高校 label_select_province: 请选择省份 label_search_conditions_not_null: 搜索条件不能为空 From 6261d95ebade08b40cb6e35650c7ed2356a90f3c Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 31 Jan 2015 17:27:52 +0800 Subject: [PATCH 15/44] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/welcome/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 972c3250e..30f9f01bb 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -41,7 +41,7 @@ <%= image_tag(url_to_avatar(@enterprise_page), width:@first_page.image_width,height: @first_page.image_height) %> <% end %>
      -
      +
      <% if @organization.nil? %> <% unless @first_page.nil? %> <%= @first_page.description.html_safe %> From 78d8a0a1c6fcf8d47729b1d18ea59e7b44ba70bb Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 2 Feb 2015 09:09:45 +0800 Subject: [PATCH 16/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=84=8F=E8=A7=81?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E6=8A=98=E5=8F=A0=E5=90=8E=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E4=B8=BA=E9=80=8F=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_feedback.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index 2039735bc..c4479b43a 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -8,7 +8,7 @@ html{ overflow-x:hidden;} .custom_service p img {display: inline; margin-top:-5px; vertical-align:middle;} -.scrollsidebar{position:absolute; z-index:999; top:150px;} +.scrollsidebar{position:absolute; z-index:999; top:150px;background:none !important;} .side_content{width:154px; height:auto; overflow:hidden; float:left; } .side_content .side_list {width:154px;overflow:hidden;} .show_btn{ width:0; height:112px; overflow:hidden; margin-top:50px; float:left; cursor:pointer;} From a29887cfed64d5a382887cc117f281038c79f709 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 2 Feb 2015 09:43:35 +0800 Subject: [PATCH 17/44] =?UTF-8?q?=E5=85=B3=E9=97=AD=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=8F=91=E5=B8=83=E9=97=AE=E5=8D=B7=E5=92=8C?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E7=9A=84=E5=8F=91=E5=B8=83=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E6=A1=86=E6=A1=86=E6=9C=AA=E5=AF=B9=E9=BD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_poll.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index 644b678b8..33bff6258 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -46,7 +46,7 @@ <% else%> -
    • +
    • 发布问卷
    • <% end%> From 858b5ea97c2bb896d09c515003b2d406381b90a2 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 2 Feb 2015 11:00:23 +0800 Subject: [PATCH 18/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E8=AE=A8?= =?UTF-8?q?=E8=AE=BA=E5=90=A7=E5=8F=91=E5=B8=96=E5=8F=91=E9=80=81=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=E3=80=8B=20Signed?= =?UTF-8?q?-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/forum.rb | 2 +- app/models/mailer.rb | 14 ++++++++------ app/models/memo.rb | 2 +- config/application.rb | 3 ++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/models/forum.rb b/app/models/forum.rb index e47d18b02..baa8e6260 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -23,7 +23,7 @@ class Forum < ActiveRecord::Base acts_as_taggable scope :by_join_date, order("created_at DESC") - after_create :send_email + #after_create :send_email def reset_counters! self.class.reset_counters!(id) end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index f42c20acc..ffd5e87be 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -50,10 +50,15 @@ class Mailer < ActionMailer::Base @forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id) @issue_author_url = url_for(user_activities_url(@author)) recipients ||= [] - mems = memo.self_and_siblings - mems.each do |mem| - recipients << mem.author.mail unless recipients.include? mem.author.mail + if !memo.parent_id.nil? + mems = memo.self_and_siblings + mems.each do |mem| + recipients << mem.author.mail unless recipients.include? mem.author.mail + end + else + recipients << memo.author.mail end + recipients << @author.mail unless recipients.include? @author.mail # cc = wiki_content.page.wiki.watcher_recipients - recipients @memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))) @@ -98,10 +103,7 @@ class Mailer < ActionMailer::Base #收件人邮箱 @recipients ||= [] @members.each do |teacher| - @recipients << teacher.user.mail - - end mail :to => @recipients, :subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} " diff --git a/app/models/memo.rb b/app/models/memo.rb index 165f8e144..7d463c28b 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -47,7 +47,7 @@ class Memo < ActiveRecord::Base "parent_id", "replies_count" - after_create :add_author_as_watcher, :reset_counters!, :sendmail#,:be_user_score -- 公共区发帖暂不计入得分 + after_create :add_author_as_watcher, :reset_counters! #, :sendmail#,:be_user_score -- 公共区发帖暂不计入得分 # after_update :update_memos_forum after_destroy :reset_counters!#,:down_user_score -- 公共区发帖暂不计入得分 # after_create :send_notification diff --git a/config/application.rb b/config/application.rb index c7f2f3ea5..000250a61 100644 --- a/config/application.rb +++ b/config/application.rb @@ -39,7 +39,8 @@ module RedmineApp # config.plugins = [ :exception_notification, :ssl_requirement, :all ] # Activate observers that should always be running. - config.active_record.observers = :journals_for_message_observer, :message_observer, :issue_observer, :journal_observer, :news_observer, :document_observer, :wiki_content_observer, :comment_observer + config.active_record.observers = :journals_for_message_observer, :message_observer, :issue_observer, :journal_observer, :news_observer, + :document_observer, :wiki_content_observer, :comment_observer, :forum_observer, :memo_observer config.active_record.store_full_sti_class = true config.active_record.default_timezone = :local From 96f538c76b61d784d09b0f4cb1fcc7e9934681d1 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 2 Feb 2015 16:42:51 +0800 Subject: [PATCH 19/44] =?UTF-8?q?#1917=E9=82=AE=E4=BB=B6=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=AD=E5=B0=86=E2=80=9C=E6=94=B6=E5=8F=96?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E9=A1=B9=E7=9B=AE=E7=9A=84=E6=89=80=E6=9C=89?= =?UTF-8?q?=E9=80=9A=E7=9F=A5...=E2=80=9D=E5=90=8E=E7=9A=84=E7=9C=81?= =?UTF-8?q?=E7=95=A5=E5=8F=B7=E5=8E=BB=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/zh.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7187c70d3..42a1143ec 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -999,7 +999,7 @@ zh: label_project_course_unadd: "你还未创建课程,赶快去创建吧!" label_project_cousre_studentun: "你还未加入任何课程,赶快加入吧!" #end by huang - label_user_mail_option_selected: "收取选中项目的所有通知..." + label_user_mail_option_selected: "收取选中项目的所有通知" label_user_mail_option_none: "不收取任何通知" label_user_mail_option_only_my_events: "只收取我跟踪或参与的项目的通知" label_user_mail_option_only_assigned: "只收取分配给我的" From 646678c9db4278ae42d717bd3d4608d6ecd47e6a Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 2 Feb 2015 17:01:07 +0800 Subject: [PATCH 20/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B--=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8=EF=BC=9A?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=9C=89=E6=95=88=E6=9D=A1=E4=BB=B6=E8=8E=B7?= =?UTF-8?q?=E5=BE=97=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C=EF=BC=8C=E5=AF=B9?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C=E6=8C=89=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=EF=BC=8C=E5=8D=B4=E8=87=AA=E5=8A=A8=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=AF=B9=E6=89=80=E6=9C=89=E5=AD=A6=E7=94=9F=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E3=80=8Bbug=20Signed-off-by:=20alan=20<547533434@qq.c?= =?UTF-8?q?om>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 35 ++++++++++++++++++------- app/views/courses/_member_list.html.erb | 2 +- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 7653be94d..61944ca2c 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -254,8 +254,8 @@ class CoursesController < ApplicationController end @is_remote = true @result_count = @results.count - @results = paginateHelper @results - + @results = paginateHelper @results, 10 + @search_name = q end def addgroups @@ -428,17 +428,34 @@ class CoursesController < ApplicationController # @results = paginateHelper @results@score_sort_by = "desc" @is_remote = true @score_sort_by = params[:sort_by] if params[:sort_by] + @search_name = params[:search_name] if params[:search_name] group_id = params[:group_id] - if group_id == '0' - page = params[:page].nil? ? 0 : (params['page'].to_i - 1) - @results = student_homework_score(0,page, 10,@score_sort_by) + if !@search_name.nil? + if group_id == '0' + page = params[:page].nil? ? 0 : (params['page'].to_i - 1) - @results = paginateHelper_for_members @results, 10 + @results = searchmember_by_name(student_homework_score(0,0,0,@score_sort_by), @search_name) + @result_count = @results.count + @results = paginateHelper @results, 10 + else + @group = CourseGroup.find(group_id) + @results = searchmember_by_name(student_homework_score(group_id, 0, 0,@score_sort_by),@search_name) + @result_count = @results.count + @results = paginateHelper @results, 10 + end else - @group = CourseGroup.find(group_id) - @results = student_homework_score(group_id, 0, 0,@score_sort_by) - @results = paginateHelper @results, 10 + if group_id == '0' + page = params[:page].nil? ? 0 : (params['page'].to_i - 1) + @results = student_homework_score(0,page, 10,@score_sort_by) + + @results = paginateHelper_for_members @results, 10 + else + @group = CourseGroup.find(group_id) + @results = student_homework_score(group_id, 0, 0,@score_sort_by) + @results = paginateHelper @results, 10 + end end + end # 显示每个学生的作业评分详情 def show_member_score diff --git a/app/views/courses/_member_list.html.erb b/app/views/courses/_member_list.html.erb index dd543ec2c..11bfd9f81 100644 --- a/app/views/courses/_member_list.html.erb +++ b/app/views/courses/_member_list.html.erb @@ -25,7 +25,7 @@
        <% if @subPage_title == l(:label_student_list) %> -
      • <%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0)) ,:result => members,method: 'get', remote: true%> +
      • <%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%> <% if @score_sort_by == 'desc' %> <% else %> From 93410e0d57771c7df65c82c24a60b39b9b16813f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 2 Feb 2015 17:23:32 +0800 Subject: [PATCH 21/44] =?UTF-8?q?=20#1919=20=20=E5=8F=96=E6=B6=88=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E7=95=99=E8=A8=80=E7=9A=84=E5=8A=A8=E6=80=81=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/show.html.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index aac2c72b4..00543557d 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -158,14 +158,14 @@ <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
      -
      - - <%= link_to l(:label_find_all_comments), respond_path(e.act_id) %> - - - <%= l(:label_comments_count, :count => e.act.commit) %> - -
      + + + + + + + + <% when 'Journal' %> From 44c783a61b61692a5bb129457b8ca69ca54d6792 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Mon, 2 Feb 2015 17:31:27 +0800 Subject: [PATCH 22/44] =?UTF-8?q?=E5=B8=96=E5=AD=90=E7=9A=84=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E9=80=9A=E7=9F=A5=E6=94=B9=E6=88=90=E5=8F=AA=E6=9C=89?= =?UTF-8?q?=E7=89=88=E4=B8=BB=E6=94=B6=E5=88=B0=20Signed-off-by:=20alan=20?= =?UTF-8?q?<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ffd5e87be..2cae982a7 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -50,15 +50,15 @@ class Mailer < ActionMailer::Base @forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id) @issue_author_url = url_for(user_activities_url(@author)) recipients ||= [] - if !memo.parent_id.nil? - mems = memo.self_and_siblings - mems.each do |mem| - recipients << mem.author.mail unless recipients.include? mem.author.mail - end - else - recipients << memo.author.mail - end - recipients << @author.mail unless recipients.include? @author.mail + # if !memo.parent_id.nil? + # mems = memo.self_and_siblings + # mems.each do |mem| + # recipients << mem.author.mail unless recipients.include? mem.author.mail + # end + # else + # recipients << memo.author.mail + # end + recipients << @author.mail # cc = wiki_content.page.wiki.watcher_recipients - recipients @memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))) From 320ee9289a856e8ba7ec8b9facf136a142abff99 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 3 Feb 2015 09:52:35 +0800 Subject: [PATCH 23/44] =?UTF-8?q?#1897=20=E4=BF=AE=E6=94=B9=E7=82=B9?= =?UTF-8?q?=E5=87=BBDTS=E6=B5=8B=E8=AF=95=E4=B9=8B=E5=90=8E=EF=BC=8CTAB?= =?UTF-8?q?=E9=A1=B5=E8=83=8C=E6=99=AF=E8=89=B2=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 64706887b..02bfc9e19 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -20,11 +20,12 @@ class ProjectsController < ApplicationController layout :select_project_layout - menu_item :overview + menu_item :overview, :only => :show menu_item :roadmap, :only => :roadmap menu_item :settings, :only => :settings menu_item :homework, :only => [:homework, :new_homework] menu_item :feedback, :only => :feedback + menu_item :share, :only => :share before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches] From 7ab5eeab659d89e0100847fbc7e44cfbf4e4fd2b Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 3 Feb 2015 10:42:36 +0800 Subject: [PATCH 24/44] =?UTF-8?q?#1839=E4=B8=8A=E4=BC=A0=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E5=90=8D=E5=BB=B6=E5=90=8E=E7=9C=81=E7=95=A5=E5=8F=B7=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_links.html.erb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index 2954adbcb..e604409d3 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -1,14 +1,15 @@
      <% for attachment in attachments %>

      - - <% if options[:length] %> - <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true,:length => options[:length] -%> - <% else %> - <%= link_to_short_attachment attachment, :class => 'icon icon-attachment', :download => true -%> - <% end %> - - +

      + + <% if options[:length] %> + <%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true,:length => options[:length] -%> + <% else %> + <%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%> + <% end %> + +
      <% if attachment.is_text? %> <%= link_to image_tag('magnifier.png'), :controller => 'attachments', @@ -19,8 +20,9 @@ <%= h(truncate(" - #{attachment.description}", length: options[:length] ? options[:length]:15, omission: '...')) unless attachment.description.blank? %> - (<%= number_to_human_size attachment.filesize %>) - + ( + <%= number_to_human_size attachment.filesize %>) + <% if options[:deletable] %> <% if attachment.container_type == 'HomeworkAttach' %> <%= link_to image_tag('delete.png'), {:controller => 'attachments', :action => 'delete_homework', :id => attachment.id}, @@ -39,8 +41,8 @@ <% end %> <% end %> <% if options[:wrap] %> -
      -   +
      +   <% end %> <% if options[:author] %> From 26b1f9f43356e75a0006db48b8ebd90e779bc138 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 3 Feb 2015 11:24:46 +0800 Subject: [PATCH 25/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E7=89=88=E4=B8=AD=E5=AD=98=E5=9C=A8=E7=9A=84=E4=B8=80=E4=BA=9B?= =?UTF-8?q?bug=20=E6=9C=80=E5=A4=9A=E5=8F=AA=E6=98=BE=E7=A4=BA=E5=8D=81?= =?UTF-8?q?=E4=B8=AA=E9=A1=B9=E7=9B=AE=20=E6=8F=90=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 26 +++++++++++++++++--------- app/views/organizations/index.html.erb | 6 +++--- app/views/welcome/index.html.erb | 6 +++--- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 144199b86..9001546dc 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -25,22 +25,30 @@ class WelcomeController < ApplicationController before_filter :entry_select, :only => [:index] def index - unless params[:project].nil? - @cur_projects = Project.find(params[:project]) - @organization = @cur_projects.enterprise_name - @organization_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @organization]) + # 企业版定制: params[:project]为传过来的参数 + unless params[:organization].nil? + @cur_projects = Project.find(params[:organization]) + @organization = @cur_projects.enterprise_name + @organization_projects = current_user.admin? ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization) @e_count = @organization_projects.count + @part_projects = [] + # 取十个 + @organization_projects.each do |obj| + break if(@organization_projects[10] == obj) + @part_projects << Project.visible.find_by_id("#{obj.id}") unless obj.id.nil? + end + # 不够十个的用最火项目替代 + @e_count < 9 ? @part_projects = find_miracle_project( 9 - @e_count, 3,"score desc") : @part_projects + # 配置文件首页定制 @enterprise_page = FirstPage.find_by_page_type('enterprise') if @enterprise_page.nil? @enterprise_page = FirstPage.new @enterprise_page.page_type = 'enterprise' end - if @e_count < 9 - part_count = 9 - @e_count - # @part_projects = find_all_hot_project part_count, order - @part_projects = find_miracle_project(part_count, 3,"score desc") - end + # 主页配置部分结束 + end + # end 企业版定制结束 if @first_page.nil? || @first_page.sort_type.nil? @projects = find_miracle_project(10, 3,"score desc") else diff --git a/app/views/organizations/index.html.erb b/app/views/organizations/index.html.erb index 3e0e507c5..45813ced5 100644 --- a/app/views/organizations/index.html.erb +++ b/app/views/organizations/index.html.erb @@ -5,11 +5,11 @@ <% if @projects.count == 0 %>

      <%= l(:label_enterprise_nil) %>

      <% else %> - <% @projects.each do |project| %> - <% unless project.enterprise_name.blank? %> + <% @projects.each do |organization| %> + <% unless organization.enterprise_name.blank? %>
      • #{project.enterprise_name} - <%= link_to project.enterprise_name, home_path(:project => project) %>
      • + <%= link_to organization.enterprise_name, home_path(:organization => organization) %>
      <% end %> <% end %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 30f9f01bb..3e0a50ceb 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -48,7 +48,7 @@ <% end %> <% else %> - <%= link_to @organization, options={:action => 'index', :enterprise => @organization}, html_options={ :method => 'get', :style => "color: #E8770D"} %> + <%= @organization %>
      @@ -87,7 +87,7 @@ <% else %> <% if @e_count == 0 %> -

      <%= l(:label_enterprise_tips) %>

      +
      <%= l(:label_enterprise_tips) %>
      <% @projects.map do |project| %> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %> <% end %> @@ -95,7 +95,7 @@ <% @organization_projects.map do |project| %> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %> <% end %> -

      <%= l(:label_part_enterprise_tips) %>

      +
      <%= l(:label_part_enterprise_tips) %>
      <% @part_projects.map do |project| %> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %> <% end %> From a752ade770ae598de3dd4c0eefaa857f63e8e93a Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 3 Feb 2015 15:02:45 +0800 Subject: [PATCH 26/44] =?UTF-8?q?#1922=20=20=20=E6=B5=8B=E8=AF=95=E7=89=88?= =?UTF-8?q?--=E5=B9=B3=E5=8F=B0=E4=B8=8A=E4=BC=A0=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E9=99=84=E4=BB=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_links.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index e604409d3..0c2b0d7c2 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -1,7 +1,7 @@
      <% for attachment in attachments %>

      -

      +
      <% if options[:length] %> <%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true,:length => options[:length] -%> From 9708c50899dc5dc6f1594295a8568613f9cd7917 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 3 Feb 2015 15:10:21 +0800 Subject: [PATCH 27/44] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E8=AF=84=E5=88=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/homeworks.rb | 26 ++++++++++++++++++ app/services/homework_service.rb | 46 +++++++++++++++++++++++++++++--- 2 files changed, 69 insertions(+), 3 deletions(-) diff --git a/app/api/mobile/apis/homeworks.rb b/app/api/mobile/apis/homeworks.rb index cba295064..7a8c87987 100644 --- a/app/api/mobile/apis/homeworks.rb +++ b/app/api/mobile/apis/homeworks.rb @@ -70,6 +70,32 @@ module Mobile present :status, 0 end + desc "作品打分" + params do + requires :token, type: String + requires :is_teacher, type: String,desc: '是否为教师(匿评作品详情返回的结果中可获取此参数的值)' + requires :is_anonymous_comments, type: String, desc: '是否为匿评(匿评作品详情返回的结果中可获取此参数的值)' + optional :stars_value, type: Integer,desc: '用户给出的评分' + optional :cur_page,type: Integer,desc: '匿评作品详情返回的结果中可获取此参数的值' + optional :cur_type, type: Integer,desc: '匿评作品详情返回的结果中可获取此参数的值' + optional :user_message, type: String, desc: '用户评论' + end + + post ':homework_id/scoring' do + cs_params = { + new_form: params.reject{|k,v| [:token,:is_teacher,:is_anonymous_comments,:stars_value,:cur_page,:cur_type,:homework_id].include?(k)}, + token: params[:token], + is_teacher: params[:is_teacher], + is_anonymous_comments: params[:is_anonymous_comments], + stars_value: params[:stars_value], + cur_page: params[:cur_page], + cur_type: params[:cur_type], + homework_id: params[:homework_id] + } + Homeworks.get_service.add_score_and_jour cs_params,current_user + present :status, 0 + end + end end diff --git a/app/services/homework_service.rb b/app/services/homework_service.rb index a2c063e15..abf89229c 100644 --- a/app/services/homework_service.rb +++ b/app/services/homework_service.rb @@ -141,16 +141,56 @@ class HomeworkService end #作品打分/留言 - def add_score_and_jour params + def add_score_and_jour params,current_user @is_teacher,@is_anonymous_comments,@m_score = params[:is_teacher]=="true",params[:is_anonymous_comments]=="true",params[:stars_value] @cur_page,@cur_type = params[:cur_page] || 1,params[:cur_type] || 5 @homework = HomeworkAttach.find(params[:homework_id]) + comment_status = @homework.bid.comment_status + if @is_anonymous_comments && comment_status != 1 + case comment_status + when 0 + raise '尚未开启匿评!' + when 2 + raise '匿评已结束!' + end + end + if @is_anonymous_comments && ((@m_score.nil? || @m_score.blank?) || !(params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "")) + raise '您尚未打分或评论!' + end #保存评分 - @homework.rate(@m_score.to_i,User.current.id,:quality) if @m_score + homework = @homework + is_teacher = @is_teacher ? 1 : 0 + #保存评分@homework.rate(@m_score.to_i,User.current.id,:quality, (@is_teacher ? 1 : 0)) + if @m_score + rate = @homework.rates(:quality).where(:rater_id => current_user.id, :is_teacher_score => is_teacher).first + if rate + rate.stars = @m_score + rate.save! + else + @homework.rates(:quality).new(:stars => @m_score, :rater_id => current_user.id, :is_teacher_score => is_teacher).save! + end + + if homework.is_teacher_score == 0 + if is_teacher == 1 + homework.score = @m_score + homework.is_teacher_score = 1 + else + sql = "SELECT AVG(stars) as stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{homework.id}" + score= HomeworkAttach.find_by_sql(sql).first.stars + homework.score = score + end + else + if is_teacher == 1 + homework.score = @m_score + homework.is_teacher_score = 1 + end + end + homework.save! + end #保存评论 @is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言 if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言 - @homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation + @homework.addjours current_user.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation end end From 8bef9420cfc543fe0adb847d458ca0094a98e81b Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 3 Feb 2015 15:22:45 +0800 Subject: [PATCH 28/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E7=89=88=E4=B8=AD=E8=87=AA=E5=B7=B1=E8=83=BD=E7=9C=8B=E5=88=B0?= =?UTF-8?q?=E8=87=AA=E5=B7=B1=E7=9A=84=E7=A7=81=E6=9C=89=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 2 +- config/locales/zh.yml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 9001546dc..3ae5538e9 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -29,7 +29,7 @@ class WelcomeController < ApplicationController unless params[:organization].nil? @cur_projects = Project.find(params[:organization]) @organization = @cur_projects.enterprise_name - @organization_projects = current_user.admin? ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization) + @organization_projects = (current_user.admin? || User.current.member_of?(@cur_projects)) ? Project.where("enterprise_name =? ", @organization) : Project.all_public.where("enterprise_name =? ", @organization) @e_count = @organization_projects.count @part_projects = [] # 取十个 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7187c70d3..15ab84133 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2520,9 +2520,9 @@ zh: # 项目企业模块 - label_all_enterprises: 所有企业 + label_all_enterprises: 所有组织 label_my_enterprise: 我的企业 - label_enterprise_tips: 暂时还没有该企业对应的项目,系统的其它项目您可能会感兴趣! - label_part_enterprise_tips: 您可能对系统的其它项目会感兴趣! - label_enterprise_nil: 该模块为最新上线模块,目前还未有项目关联到企业! + label_enterprise_tips: 该组织暂时还没创建公开项目,您可能会对系统的其它项目感兴趣! + label_part_enterprise_tips: 您可能对系统的其它项目感兴趣! + label_enterprise_nil: 该模块为最新上线模块,目前还没有创建企业项目! label_enterprises: 组织 From 87e658a0f1367a73afaf5f2e1abd243054a3b0ac Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 3 Feb 2015 15:46:17 +0800 Subject: [PATCH 29/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=8C=BF=E8=AF=84=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E5=90=8E=E4=BE=9D=E7=84=B6=E5=8F=AF=E4=BB=A5=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=EF=BC=88=E5=B1=9E=E4=BA=8E=E7=95=99=E8=A8=80=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/homework_service.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/services/homework_service.rb b/app/services/homework_service.rb index abf89229c..b468e1110 100644 --- a/app/services/homework_service.rb +++ b/app/services/homework_service.rb @@ -146,13 +146,8 @@ class HomeworkService @cur_page,@cur_type = params[:cur_page] || 1,params[:cur_type] || 5 @homework = HomeworkAttach.find(params[:homework_id]) comment_status = @homework.bid.comment_status - if @is_anonymous_comments && comment_status != 1 - case comment_status - when 0 - raise '尚未开启匿评!' - when 2 - raise '匿评已结束!' - end + if @is_anonymous_comments && comment_status == 0 + raise '尚未开启匿评!' end if @is_anonymous_comments && ((@m_score.nil? || @m_score.blank?) || !(params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "")) raise '您尚未打分或评论!' From 8216453a027f9486229244ab42a51a18f3642821 Mon Sep 17 00:00:00 2001 From: z9hang Date: Tue, 3 Feb 2015 16:03:30 +0800 Subject: [PATCH 30/44] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0comment=5Fstatus=E5=AD=97=E6=AE=B5=200:?= =?UTF-8?q?=E6=89=80=E5=B1=9E=E4=BD=9C=E4=B8=9A=E5=B0=9A=E6=9C=AA=E5=BC=80?= =?UTF-8?q?=E5=90=AF=E5=8C=BF=E8=AF=84=EF=BC=8C1=EF=BC=9A=E5=8C=BF?= =?UTF-8?q?=E8=AF=84=E4=B8=AD=202=EF=BC=9A=E5=8C=BF=E8=AF=84=E7=BB=93?= =?UTF-8?q?=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/entities/homework_attach.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/api/mobile/entities/homework_attach.rb b/app/api/mobile/entities/homework_attach.rb index 256dcdf61..690ec8e94 100644 --- a/app/api/mobile/entities/homework_attach.rb +++ b/app/api/mobile/entities/homework_attach.rb @@ -17,6 +17,8 @@ module Mobile case field when :homework_times f.bid.courses.first.homeworks.index(f.bid) + 1 unless (f.bid.nil? || f.bid.courses.nil? || f.bid.courses.first.nil?) + when :comment_status + f.bid.comment_status end end end @@ -28,6 +30,8 @@ module Mobile homework_attach_expose :homework_times homework_attach_expose :description homework_attach_expose :created_at + #comment_status 0:所属作业尚未开启匿评,1:匿评中 2:匿评结束 + homework_attach_expose :comment_status expose :attachments,using: Mobile::Entities::Attachment do |f, opt| if f.respond_to?(:attachments) f.send(:attachments) From 6d79c2cf83f6322c35df3ce0b4c502876356b70a Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 4 Feb 2015 11:57:37 +0800 Subject: [PATCH 31/44] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E7=AB=AF=EF=BC=A1?= =?UTF-8?q?=EF=BC=B0=EF=BC=A9=E6=B7=BB=E5=8A=A0=E6=96=B0=E9=97=BB=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E5=AE=9E=E4=BD=93Comment=EF=BC=8C=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E4=B8=AD=E5=BC=95=E7=94=A8Comment,=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E6=96=B0=E9=97=BB=E5=88=97=E8=A1=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=9D=83=E9=99=90=E5=88=A4=E6=96=AD=EF=BC=8C=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E8=AF=A5=E6=8E=A5=E5=8F=A3=E4=B8=8D=E5=8F=AF=E7=94=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/comments.rb | 22 ++++++++++++++++++++++ app/api/mobile/apis/courses.rb | 3 ++- app/api/mobile/entities/comment.rb | 30 ++++++++++++++++++++++++++++++ app/api/mobile/entities/news.rb | 6 +++++- app/services/comment_service.rb | 12 ++++++++++++ app/services/courses_service.rb | 7 +++++-- 6 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 app/api/mobile/apis/comments.rb create mode 100644 app/api/mobile/entities/comment.rb create mode 100644 app/services/comment_service.rb diff --git a/app/api/mobile/apis/comments.rb b/app/api/mobile/apis/comments.rb new file mode 100644 index 000000000..fb6d01fb4 --- /dev/null +++ b/app/api/mobile/apis/comments.rb @@ -0,0 +1,22 @@ +#coding=utf-8 +module Mobile + module Apis + class Comments < Grape::API + resource :comments do + desc '课程通知评论' + params do + requires :token, type: String + requires :comment, type: String + end + post ':id' do + cs = CommentService.new + comments = cs.news_comments params,current_user + raise "create comments failed #{comments.errors.full_messages}" if comments.new_record? + present :data, comments, with: Mobile::Entities::Comment + present :status, 0 + end + + end + end + end +end \ No newline at end of file diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 7c1aa5e7e..2e678bad4 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -188,10 +188,11 @@ module Mobile desc "课程通知列表" params do + optional :token, type: String end get ":course_id/news" do cs = CoursesService.new - news = cs.course_news_list params + news = cs.course_news_list params,current_user.nil? ? User.find(2):current_user present :data, news, with: Mobile::Entities::News present :status, 0 end diff --git a/app/api/mobile/entities/comment.rb b/app/api/mobile/entities/comment.rb new file mode 100644 index 000000000..803d0c6d0 --- /dev/null +++ b/app/api/mobile/entities/comment.rb @@ -0,0 +1,30 @@ +module Mobile + module Entities + class Comment < Grape::Entity + include Redmine::I18n + def self.comment_expose(field) + expose field do |f,opt| + if f.is_a?(Hash) && f.key?(field) + f[field] + elsif f.is_a?(::Comment) + if f.respond_to?(field) + if field == :created_on + format_time(f.send(field)) + else + f.send(field) + end + end + end + end + end + comment_expose :id + expose :author, using: Mobile::Entities::User do |c, opt| + if c.is_a? ::Comment + c.author + end + end + comment_expose :comments + comment_expose :created_on + end + end +end \ No newline at end of file diff --git a/app/api/mobile/entities/news.rb b/app/api/mobile/entities/news.rb index 7c77f8c82..406db59e4 100644 --- a/app/api/mobile/entities/news.rb +++ b/app/api/mobile/entities/news.rb @@ -34,7 +34,11 @@ module Mobile #评论数量 news_expose :comments_count #评论 - news_expose :comments + expose :comments, using: Mobile::Entities::Comment do |f, opt| + if f.is_a?(Hash) && f.key?(:comments) + f[:comments] + end + end end diff --git a/app/services/comment_service.rb b/app/services/comment_service.rb new file mode 100644 index 000000000..b6727a941 --- /dev/null +++ b/app/services/comment_service.rb @@ -0,0 +1,12 @@ +class CommentService + #评论 + def news_comments params,current_user + raise Unauthorized unless @news.commentable? + @news = News.find(params[:id]) + @comment = Comment.new + @comment.safe_attributes = params[:comment] + @comment.author = current_user + @news.comments << @comment + @comment + end +end \ No newline at end of file diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 41b6f2c68..afd674610 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -106,11 +106,14 @@ class CoursesService end #课程通知列表 - def course_news_list params + def course_news_list params,current_user if params[:course_id] && @course==nil @course = Course.find(params[:course_id]) end - scope = @course ? @course.news.course_visible : News.course_visible + if current_user.nil? || !(current_user.admin? || @course.is_public == 1 || (@course.is_public == 0 && current_user.member_of_course?(@course))) + raise '403' + end + scope = @course ? @course.news.course_visible(current_user) : News.course_visible(current_user) news = [] scope.each do |n| news << {: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} From 3cd97f8a7013c7e7f407b60d4e1b24cf60710d46 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 4 Feb 2015 13:47:52 +0800 Subject: [PATCH 32/44] =?UTF-8?q?API=E6=B7=BB=E5=8A=A0comment=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/api.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index bee78a20e..bad8c1a77 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -6,6 +6,7 @@ module Mobile require_relative 'apis/watches' require_relative 'apis/upgrade' require_relative 'apis/homeworks' + require_relative 'apis/comments' class API < Grape::API version 'v1', using: :path format :json @@ -37,6 +38,7 @@ module Mobile mount Apis::Watches mount Apis::Upgrade mount Apis::Homeworks + mount Apis::Comment #add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'}) #add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development? From 4fdc1b97a5022185d322c32a92fecab8d4594721 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 4 Feb 2015 14:07:00 +0800 Subject: [PATCH 33/44] =?UTF-8?q?=E9=85=8D=E7=BD=AEAPI=20comment=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E4=BF=AE=E6=AD=A3=E6=98=BE=E7=A4=BA=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E9=80=9A=E7=9F=A5=E6=8E=A5=E5=8F=A3=E6=9C=AA=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/api.rb | 2 +- app/api/mobile/apis/courses.rb | 2 +- app/services/comment_service.rb | 2 +- app/services/courses_service.rb | 9 +++++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index bad8c1a77..8f7f0342f 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -38,7 +38,7 @@ module Mobile mount Apis::Watches mount Apis::Upgrade mount Apis::Homeworks - mount Apis::Comment + mount Apis::Comments #add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'}) #add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development? diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 2e678bad4..8f8c08c3f 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -199,7 +199,7 @@ module Mobile desc "显示课程通知" params do - + optional :token, type: String end get "news/:id" do cs = CoursesService.new diff --git a/app/services/comment_service.rb b/app/services/comment_service.rb index b6727a941..23f4355e6 100644 --- a/app/services/comment_service.rb +++ b/app/services/comment_service.rb @@ -1,8 +1,8 @@ class CommentService #评论 def news_comments params,current_user - raise Unauthorized unless @news.commentable? @news = News.find(params[:id]) + raise Unauthorized unless @news.commentable? @comment = Comment.new @comment.safe_attributes = params[:comment] @comment.author = current_user diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index afd674610..77b5e325d 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -131,9 +131,18 @@ class CoursesService #显示课程通知(包括评论) 需验证权限 def show_course_news params,current_user @news = News.find(params[:id]) + @course = @news.course + if @course + if current_user.nil? || !(current_user.admin? || @course.is_public == 1 || (@course.is_public == 0 && current_user.member_of_course?(@course))) + raise '403' + end + else + raise 'news in unknown course' + end @comments = @news.comments @comments.reverse! if current_user.wants_comments_in_reverse_order? {:news => @news,:comments => @comments} + #comments = [] #@comments.each do |comment| # comments << {:author_id => comment.author_id,:author_name => comment.author.name,:commont_content => comment.comments,:time => format_time(comment.created_on)} From d6b82c3549c5aaaf4e232d3de38c4380cc8fbfb3 Mon Sep 17 00:00:00 2001 From: z9hang Date: Wed, 4 Feb 2015 14:39:46 +0800 Subject: [PATCH 34/44] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E8=AF=84=E8=AE=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/comments.rb | 7 +++++-- app/services/comment_service.rb | 11 +++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/api/mobile/apis/comments.rb b/app/api/mobile/apis/comments.rb index fb6d01fb4..402bce66f 100644 --- a/app/api/mobile/apis/comments.rb +++ b/app/api/mobile/apis/comments.rb @@ -6,11 +6,14 @@ module Mobile desc '课程通知评论' params do requires :token, type: String - requires :comment, type: String + requires :comments, type: String end post ':id' do cs = CommentService.new - comments = cs.news_comments params,current_user + cs_params = { + id: params[:id], + comment: params.reject{|k,v| [:id].include?(k)}} + comments = cs.news_comments cs_params,current_user raise "create comments failed #{comments.errors.full_messages}" if comments.new_record? present :data, comments, with: Mobile::Entities::Comment present :status, 0 diff --git a/app/services/comment_service.rb b/app/services/comment_service.rb index 23f4355e6..c7e4b29a7 100644 --- a/app/services/comment_service.rb +++ b/app/services/comment_service.rb @@ -2,9 +2,16 @@ class CommentService #评论 def news_comments params,current_user @news = News.find(params[:id]) - raise Unauthorized unless @news.commentable? + @course = @news.course + if @course.nil? + raise 'news in unknown course' + end + raise Unauthorized unless @news.commentable?(current_user) + if current_user.nil? || !(current_user.admin? || @course.is_public == 1 || (@course.is_public == 0 && current_user.member_of_course?(@course))) + raise '403' + end @comment = Comment.new - @comment.safe_attributes = params[:comment] + @comment.send(:safe_attributes=,params[:comment],current_user) @comment.author = current_user @news.comments << @comment @comment From d6813e5996cb5a5ed2b0e5b6edf5b28edd219d90 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 5 Feb 2015 15:54:50 +0800 Subject: [PATCH 35/44] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98=EF=BC=8C=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=95=99=E8=A8=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/comments.rb | 19 +++++++++++++++++++ app/services/comment_service.rb | 20 ++++++++++++++++++++ app/services/courses_service.rb | 2 -- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/apis/comments.rb b/app/api/mobile/apis/comments.rb index 402bce66f..fb30f59f4 100644 --- a/app/api/mobile/apis/comments.rb +++ b/app/api/mobile/apis/comments.rb @@ -19,6 +19,25 @@ module Mobile present :status, 0 end + desc '作业留言(教师布置的作业)' + params do + requires :token, type: String + requires :id, type: Integer,desc: '老师布置的作业id' + requires :message,type: String, desc: '留言' + optional :reference_content, type: String ,desc: '引用的内容' + optional :reference_user_id, type: Integer,desc: '被引用的人' + end + post 'create_homework_message' do + cs_params = { + id: params[:id], + token: params[:token], + reference_content: params[:reference_content], + bid_message: params.reject{|k,v| [:id,:token,:reference_content].include?(k)}} + cs = CommentService.new + cs.homework_message cs_params,current_user + present :status, 0 + end + end end end diff --git a/app/services/comment_service.rb b/app/services/comment_service.rb index c7e4b29a7..84a7d09cf 100644 --- a/app/services/comment_service.rb +++ b/app/services/comment_service.rb @@ -16,4 +16,24 @@ class CommentService @news.comments << @comment @comment end + + #作业留言 + def homework_message params,current_user + @bid = Bid.find(params[:id], :include => [{:homeworks => :user}]) + if params[:bid_message][:message].size>0 + if params[:reference_content] + message = params[:bid_message][:message] + "\n" + params[:reference_content] + else + message = params[:bid_message][:message] + @m = message + end + refer_user_id = params[:bid_message][:reference_user_id].to_i + @bid.add_jour(current_user, message, refer_user_id) + end + #@user = @bid.author + #@jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + #@jour = paginateHelper @jours,10 + @bid.set_commit(@feedback_count) + end + end \ No newline at end of file diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 77b5e325d..341ecd422 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -136,8 +136,6 @@ class CoursesService if current_user.nil? || !(current_user.admin? || @course.is_public == 1 || (@course.is_public == 0 && current_user.member_of_course?(@course))) raise '403' end - else - raise 'news in unknown course' end @comments = @news.comments @comments.reverse! if current_user.wants_comments_in_reverse_order? From ef203ff40c0bf8250bbf3a084c733e2970a18424 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 5 Feb 2015 16:11:35 +0800 Subject: [PATCH 36/44] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E7=95=99=E8=A8=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/comments.rb | 11 ++++++----- app/models/bid.rb | 4 +++- app/services/comment_service.rb | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/api/mobile/apis/comments.rb b/app/api/mobile/apis/comments.rb index fb30f59f4..c6d925868 100644 --- a/app/api/mobile/apis/comments.rb +++ b/app/api/mobile/apis/comments.rb @@ -22,19 +22,20 @@ module Mobile desc '作业留言(教师布置的作业)' params do requires :token, type: String - requires :id, type: Integer,desc: '老师布置的作业id' + #requires :id, type: Integer,desc: '老师布置的作业id' requires :message,type: String, desc: '留言' - optional :reference_content, type: String ,desc: '引用的内容' - optional :reference_user_id, type: Integer,desc: '被引用的人' + #optional :reference_content, type: String ,desc: '引用的内容' + #optional :reference_user_id, type: Integer,desc: '被引用的人' end - post 'create_homework_message' do + post ':id/create_homework_message' do cs_params = { id: params[:id], token: params[:token], reference_content: params[:reference_content], bid_message: params.reject{|k,v| [:id,:token,:reference_content].include?(k)}} cs = CommentService.new - cs.homework_message cs_params,current_user + message = cs.homework_message cs_params,current_user + present :data, message, with: Mobile::Entities::Jours present :status, 0 end diff --git a/app/models/bid.rb b/app/models/bid.rb index f423266b8..eb7e5d83f 100644 --- a/app/models/bid.rb +++ b/app/models/bid.rb @@ -93,7 +93,9 @@ class Bid < ActiveRecord::Base # 'deadline' def add_jour(user, notes, reference_user_id = 0, options = {}) if options.count == 0 - self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id) + jfm = JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id) + self.journals_for_messages << jfm + jfm else jfm = self.journals_for_messages.build(options) jfm.save diff --git a/app/services/comment_service.rb b/app/services/comment_service.rb index 84a7d09cf..5d40bf6bc 100644 --- a/app/services/comment_service.rb +++ b/app/services/comment_service.rb @@ -28,12 +28,13 @@ class CommentService @m = message end refer_user_id = params[:bid_message][:reference_user_id].to_i - @bid.add_jour(current_user, message, refer_user_id) + jfm = @bid.add_jour(current_user, message, refer_user_id) end #@user = @bid.author #@jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') #@jour = paginateHelper @jours,10 @bid.set_commit(@feedback_count) + jfm end end \ No newline at end of file From 0dfa42837709576213e1abc7a3f3a6c9d7ee7b43 Mon Sep 17 00:00:00 2001 From: z9hang Date: Thu, 5 Feb 2015 17:32:19 +0800 Subject: [PATCH 37/44] =?UTF-8?q?=E6=89=8B=E6=9C=BA=EF=BC=A1=EF=BC=B0?= =?UTF-8?q?=EF=BC=A9=E6=B7=BB=E5=8A=A0=E5=9B=9E=E5=A4=8D=E7=95=99=E8=A8=80?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/comments.rb | 20 +++++++++++++++++- app/api/mobile/entities/jours.rb | 3 +++ app/services/comment_service.rb | 35 ++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/app/api/mobile/apis/comments.rb b/app/api/mobile/apis/comments.rb index c6d925868..3f252070f 100644 --- a/app/api/mobile/apis/comments.rb +++ b/app/api/mobile/apis/comments.rb @@ -22,7 +22,6 @@ module Mobile desc '作业留言(教师布置的作业)' params do requires :token, type: String - #requires :id, type: Integer,desc: '老师布置的作业id' requires :message,type: String, desc: '留言' #optional :reference_content, type: String ,desc: '引用的内容' #optional :reference_user_id, type: Integer,desc: '被引用的人' @@ -39,6 +38,25 @@ module Mobile present :status, 0 end + desc '回复留言' + params do + requires :token, type: String + requires :reference_id, type: Integer,desc: '所属留言树的根留言id(最顶层的非回复的留言,留言对象中的m_parent_id)' + requires :reference_user_id,type: Integer ,desc: '被回复的留言的作者id' + #requires :reference_message_id,type: Integer,desc: '被回复的留言的id' + requires :user_notes,type: String,desc: '留言的内容' + requires :jour_type,type: String,desc: '等于父留言的jour_type' + requires :jour_id,type:Integer, desc: '等于父留言的jour_id' + end + post ':reference_message_id/create_reply'do + cs = CommentService.new + message = cs.create_reply params,current_user + raise "create reply failed #{message.errors.full_messages}" if message.new_record? + present :data, message, with: Mobile::Entities::Jours + present :status, 0 + end + + end end end diff --git a/app/api/mobile/entities/jours.rb b/app/api/mobile/entities/jours.rb index 5a9f48cbc..10fd0f893 100644 --- a/app/api/mobile/entities/jours.rb +++ b/app/api/mobile/entities/jours.rb @@ -18,12 +18,15 @@ module Mobile end end jours_expose :id + jours_expose :jour_type + jours_expose :jour_id expose :user,using: Mobile::Entities::User do |f, opt| f.user end jours_expose :created_on jours_expose :notes jours_expose :m_reply_id + jours_expose :m_parent_id expose :reply_user,using: Mobile::Entities::User do |f, opt| f.at_user end diff --git a/app/services/comment_service.rb b/app/services/comment_service.rb index 5d40bf6bc..5a5667a92 100644 --- a/app/services/comment_service.rb +++ b/app/services/comment_service.rb @@ -37,4 +37,39 @@ class CommentService jfm end + #回复留言接口 + def create_reply params,current_user + # 这里是创建回复所使用的方法,此方法只针对回复,每一个新的留言并不在此方法管理范围内。 + # 由于多个地方用到了留言,而之前的表设计也有jour_type/jour_id这类信息 + # 所以在方法 add_reply_adapter 中判断所有调用此方法的来源页面, + # 为了保证兼容以往所有的代码,保证以往的方法可以调用,在返回页面中都做了各式各样的判断。 + # 页面保证 render new_respond/journal_reply + # 修改 add_reply_adapter 中可以确保留言创建成功 + # 删除留言功能要调用destroy,也记得在destroy.js中修改 + + # deny api. api useless + parent_id = params[:reference_id] + author_id = current_user.id + reply_user_id = params[:reference_user_id] + reply_id = params[:reference_message_id] # 暂时不实现 + content = params[:user_notes] + jour_type = params[:jour_type] + jour_id = params[:jour_id] + @show_name = params[:show_name] == "true" + options = { + :jour_id => jour_id, + :jour_type => jour_type, + :user_id => author_id, + :status => true, + :m_parent_id => parent_id, + :m_reply_id => reply_id, + :reply_id => reply_user_id, + :notes => content, + :is_readed => false} + @jfm = ::JournalsForMessage.new(options) + #@save_succ = true if @jfm.errors.empty? + @jfm.save + @jfm + end + end \ No newline at end of file From 95b757ba0901cda67104c94ad465cdc4de3c691d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 6 Feb 2015 09:32:32 +0800 Subject: [PATCH 38/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=88=90=E5=8A=9F=E5=92=8C=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=88=90=E5=8A=9F=E5=90=8E=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/poll/_alert.html.erb | 27 +++++++++++++++++++++++++++ app/views/poll/publish_poll.js.erb | 10 +++++++++- app/views/poll/republish_poll.js.erb | 10 +++++++++- config/locales/zh.yml | 1 + public/stylesheets/polls.css | 6 ++++++ 5 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 app/views/poll/_alert.html.erb diff --git a/app/views/poll/_alert.html.erb b/app/views/poll/_alert.html.erb new file mode 100644 index 000000000..b3de53d1f --- /dev/null +++ b/app/views/poll/_alert.html.erb @@ -0,0 +1,27 @@ + + + + + + + +
      +
      +
      +

      + <%= message%> +

      + +
      +
      +
      +
      + + + diff --git a/app/views/poll/publish_poll.js.erb b/app/views/poll/publish_poll.js.erb index ad052f8f2..6074df6c6 100644 --- a/app/views/poll/publish_poll.js.erb +++ b/app/views/poll/publish_poll.js.erb @@ -1,2 +1,10 @@ $("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); -alert("发布成功"); \ No newline at end of file +$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>"); +showModal('ajax-modal', '180px'); +$('#ajax-modal').css('height','111px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().removeClass("alert_praise"); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("poll_alert_form"); \ No newline at end of file diff --git a/app/views/poll/republish_poll.js.erb b/app/views/poll/republish_poll.js.erb index a2d8e28fa..94369678d 100644 --- a/app/views/poll/republish_poll.js.erb +++ b/app/views/poll/republish_poll.js.erb @@ -1,2 +1,10 @@ $("#polls_<%= @poll.id %>").html("<%= escape_javascript(render :partial => 'poll',:locals => {:poll => @poll}) %>"); -alert("取消成功"); \ No newline at end of file +$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>"); +showModal('ajax-modal', '180px'); +$('#ajax-modal').css('height','80px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before("" + + ""); +$('#ajax-modal').parent().removeClass("alert_praise"); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("poll_alert_form"); \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index d5c56fe13..31ec29e18 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2486,6 +2486,7 @@ zh: label_poll_result: 问卷调查_问卷统计 label_answer: 答案: label_poll_answer_valid_result: 以上为有效问答题答案! + label_poll_republish_success: 取消成功 label_answer_total: 总计: label_join_project: 加入项目 label_technical_support: 技术支持: diff --git a/public/stylesheets/polls.css b/public/stylesheets/polls.css index f0d670a1d..a0d64645a 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -145,3 +145,9 @@ a:hover.btn_pu{ background:#3cb761;} .polls_title_w { width:330px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_de_grey{ color:#b1b1b1;padding-left: 5px;} .ml5{ margin-left:5px;} + +/******确定弹框***********/ +.poll_alert_form{width:140px;height:180px;position:fixed;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} +.polls_alert_btn_box{width: 100%;margin: 0 auto;padding-left: 45px;} +.polls_alert_upload_box{ width:120px; margin:15px auto;} +.polls_alert_box_p{ font-size:14px; padding-left: 45px;padding-top: 10px;} From b1903dba116716a2470fcef3fab6d99dd4e9c98e Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 6 Feb 2015 10:35:38 +0800 Subject: [PATCH 39/44] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=95=99=E8=A8=80=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/comments.rb | 16 ++++++++++++++++ app/services/comment_service.rb | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/app/api/mobile/apis/comments.rb b/app/api/mobile/apis/comments.rb index 3f252070f..a7eea735d 100644 --- a/app/api/mobile/apis/comments.rb +++ b/app/api/mobile/apis/comments.rb @@ -38,6 +38,22 @@ module Mobile present :status, 0 end + desc '课程留言' + params do + requires :token, type: String + requires :course_message,type: String, desc: '留言' + end + post ':id/leave_course_message' do + cs_params = { + id: params[:id], + token: params[:token], + new_form: params.reject{|k,v| [:id,:token].include?(k)}} + cs = CommentService.new + message = cs.leave_course_message cs_params,current_user + present :data, message, with: Mobile::Entities::Jours + present :status, 0 + end + desc '回复留言' params do requires :token, type: String diff --git a/app/services/comment_service.rb b/app/services/comment_service.rb index 5a5667a92..42dc8c415 100644 --- a/app/services/comment_service.rb +++ b/app/services/comment_service.rb @@ -36,6 +36,12 @@ class CommentService @bid.set_commit(@feedback_count) jfm end + #课程留言接口 + def leave_course_message params,current_user + message = params[:new_form][:course_message] + feedback = Course.add_new_jour(current_user, message, params[:id]) + feedback + end #回复留言接口 def create_reply params,current_user From 0b41afa5716eca611d5038218e9b29a00435a0cf Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 6 Feb 2015 10:51:29 +0800 Subject: [PATCH 40/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=8C=BF=E8=AF=84=E7=95=8C=E9=9D=A2=EF=BC=8C=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=90=8D=E6=98=BE=E7=A4=BA=E6=B7=B7=E4=B9=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/attachments/_links.html.erb | 10 ++++++++-- app/views/memos/show.html.erb | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index 0c2b0d7c2..989ed776d 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -1,7 +1,10 @@
      +<% is_float ||= false %> <% for attachment in attachments %>

      -

      + <%if is_float%> +
      + <% end%> <% if options[:length] %> <%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true,:length => options[:length] -%> @@ -9,7 +12,10 @@ <%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%> <% end %> -
      + <%if is_float%> +
      + <% end%> + <% if attachment.is_text? %> <%= link_to image_tag('magnifier.png'), :controller => 'attachments', diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 0330b65e4..995529fe9 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -67,7 +67,7 @@

      <% if @memo.attachments.any?%> <% options = {:author => true, :deletable => @memo.deleted_attach_able_by?(User.current) } %> - <%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options} %> + <%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %> <% end %>

      @@ -136,7 +136,7 @@

      <% if reply.attachments.any?%> <% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %> - <%= render :partial => 'attachments/links', :locals => {:attachments => reply.attachments, :options => options} %> + <%= render :partial => 'attachments/links', :locals => {:attachments => reply.attachments, :options => options, :is_float => true} %> <% end %>

      From 4cdb3c83ddb69c6334f68e5053d7b5bad642cdca Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 6 Feb 2015 11:22:29 +0800 Subject: [PATCH 41/44] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=9C=A8=E6=8C=87=E5=AE=9A=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=86=85=E4=BD=9C=E4=B8=9A=E6=95=B0=E9=87=8F=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/api_helper.rb | 24 ++++++++++++++++++++++++ app/helpers/homework_attach_helper.rb | 18 ++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index 8ff6f725c..b227a96ab 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -37,4 +37,28 @@ module ApiHelper end result end + + ######################################################### + #sw + #获取课程未匿评数量 + #param: user => "用户", course_id => "查询的课程ID" + #return: 作业的数量 + ######################################################### + def get_course_anonymous_evaluation user,course_id + course = Course.find course_id + count = 0 + if course + is_teacher = is_course_teacher user,course + if is_teacher #如果是老师,显示学生提交的作业数 + course.homeworks.each do |bid| + count += bid.homeworks.count + end + else #如果是学生,显示未匿评的数量 + course.homeworks.each do |bid| + count += get_student_not_batch_homework_list bid,user + end + end + end + count + end end \ No newline at end of file diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb index c41ba54ee..0b98283ff 100644 --- a/app/helpers/homework_attach_helper.rb +++ b/app/helpers/homework_attach_helper.rb @@ -130,4 +130,22 @@ module HomeworkAttachHelper WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id} ORDER BY m_score DESC") student_batch_homework_list end + + ######################################################### + #sw + #获取学生未进行匿评的数量 + #param: bid => 作业 user => 用户 + #return 指定用户未进行匿评的作业的数量 + #user必须是学生用户 + ####################################################### + def get_student_not_batch_homework_list bid,user + HomeworkAttach.find_by_sql("SELECT * FROM(SELECT homework_attaches.*, + (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 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, + (SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{user.id} AND is_teacher_score = 0) AS m_score + FROM homework_attaches + INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id + WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id}) AS table1 + WHERE table1.m_score IS NULL").count + end end \ No newline at end of file From cc83b30fc6c230a54182cf4a3c0979f69210db4d Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 6 Feb 2015 14:29:42 +0800 Subject: [PATCH 42/44] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=8A=A8=E6=80=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 10 ++++++++++ app/api/mobile/apis/users.rb | 18 ++++++++++-------- app/services/courses_service.rb | 8 ++++++++ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 8f8c08c3f..7b3fc7cd5 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -209,6 +209,16 @@ module Mobile present :status, 0 end + desc '课程动态' + params do + requires :token, type: String + end + get "course_dynamic/:id" do + cs = CoursesService.new + count = cs.course_dynamic(params,current_user) + present :data, count + present :status, 0 + end end end diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index 69260716e..d780b9db4 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -22,13 +22,15 @@ module Mobile desc "显示用户" params do - + requires :id, type: Integer end - get ':id' do - us = UsersService.new - ue = us.show_user params - present :data, ue,with: Mobile::Entities::User - present :status, 0 + route_param :id do + get do + us = UsersService.new + ue = us.show_user params + present :data, ue,with: Mobile::Entities::User + present :status, 0 + end end desc "修改用户" @@ -77,11 +79,11 @@ module Mobile present :status, 0 end - desc "用户搜索" + desc "用户搜索" params do requires :name, type: String, desc: '用户名关键字' end - get 'search' do + get 'search/search_user' do us = UsersService.new user = us.search_user params present :data, user, with: Mobile::Entities::User diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 341ecd422..d987514c2 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -2,6 +2,7 @@ class CoursesService include ApplicationHelper include CoursesHelper include HomeworkAttachHelper + include ApiHelper #TODO:尚未整合权限系统 #参数school_id为0或不传时返回所有课程,否则返回对应学校的课程 #参数per_page_count分页功能,每页显示的课程数 @@ -326,6 +327,11 @@ class CoursesService end end + def course_dynamic params,current_user + count = get_course_anonymous_evaluation current_user,params[:id] + count + end + private def show_homework_info course,bid,current_user,is_course_teacher author = bid.author.lastname + bid.author.firstname @@ -361,4 +367,6 @@ class CoursesService :description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation} end + + end \ No newline at end of file From d913f89a82b640bfd9b11a9d3c92cc31919b351b Mon Sep 17 00:00:00 2001 From: z9hang Date: Fri, 6 Feb 2015 15:52:34 +0800 Subject: [PATCH 43/44] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 2 +- app/api/mobile/entities/course_dynamic.rb | 17 +++++++++++++++++ app/helpers/api_helper.rb | 5 ++--- app/services/courses_service.rb | 17 ++++++++++++++--- 4 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 app/api/mobile/entities/course_dynamic.rb diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 7b3fc7cd5..7dbfaffb0 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -216,7 +216,7 @@ module Mobile get "course_dynamic/:id" do cs = CoursesService.new count = cs.course_dynamic(params,current_user) - present :data, count + present :data, count, with: Mobile::Entities::CourseDynamic present :status, 0 end diff --git a/app/api/mobile/entities/course_dynamic.rb b/app/api/mobile/entities/course_dynamic.rb new file mode 100644 index 000000000..11f8c2682 --- /dev/null +++ b/app/api/mobile/entities/course_dynamic.rb @@ -0,0 +1,17 @@ +module Mobile + module Entities + class CourseDynamic < Grape::Entity + def self.course_dynamic_expose(field) + expose field do |c,opt| + c[field] if (c.is_a?(Hash) && c.key?(field)) + end + end + + course_dynamic_expose :course_name + course_dynamic_expose :need_anonymous_comments_count + course_dynamic_expose :student_commit_number + course_dynamic_expose :news_count + course_dynamic_expose :message_count + end + end +end \ No newline at end of file diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb index b227a96ab..c865a500b 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -44,8 +44,7 @@ module ApiHelper #param: user => "用户", course_id => "查询的课程ID" #return: 作业的数量 ######################################################### - def get_course_anonymous_evaluation user,course_id - course = Course.find course_id + def get_course_anonymous_evaluation user,course count = 0 if course is_teacher = is_course_teacher user,course @@ -59,6 +58,6 @@ module ApiHelper end end end - count + [count,is_teacher] end end \ No newline at end of file diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index d987514c2..f4201774a 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -327,9 +327,20 @@ class CoursesService end end - def course_dynamic params,current_user - count = get_course_anonymous_evaluation current_user,params[:id] - count + def course_dynamic(params,current_user) + course = Course.find(params[:id]) + if current_user.nil? || !(current_user.admin? || course.is_public == 1 || (course.is_public == 0 && current_user.member_of_course?(course))) + raise '403' + end + count,is_teacher = get_course_anonymous_evaluation current_user,course + if is_teacher + student_commit_number = count + else + need_anonymous_comments_count = count + end + news_count = course.news.count + message_count = course.journals_for_messages.count + {:course_name => course.name,:need_anonymous_comments_count=>need_anonymous_comments_count,:student_commit_number=>student_commit_number,:news_count=> news_count,:message_count=>message_count} end private From 103a411b40b0cae04485da9cd1f672bb01008972 Mon Sep 17 00:00:00 2001 From: z9hang Date: Mon, 9 Feb 2015 16:24:45 +0800 Subject: [PATCH 44/44] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/users.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index d780b9db4..9a5307be6 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -82,6 +82,7 @@ module Mobile desc "用户搜索" params do requires :name, type: String, desc: '用户名关键字' + requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱' end get 'search/search_user' do us = UsersService.new