From 0da01c5a3395fbb9b34bf609a2de3ee2c619fd17 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jul 2017 11:16:10 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E7=9A=84=E7=94=A8=E6=88=B7=E5=88=97=E8=A1=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E2=80=9C=E6=9C=80=E5=90=8E=E7=99=BB=E5=BD=95=E2=80=9D?= =?UTF-8?q?=EF=BC=8C=E2=80=9C=E5=88=9B=E5=BB=BA=E6=97=B6=E9=97=B4=E2=80=9D?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 14 ++++--- app/views/managements/_user_list.html.erb | 45 +++++++++++++++++++++-- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index d434651cf..400fad766 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -9,19 +9,21 @@ class ManagementsController < ApplicationController # 0 全部;1 活动的; 2 已注册; 3 锁定 def users - status = params[:user_status].nil? ? 0 : params[:user_status].to_i + status = params[:user_status].nil? ? 0 : params[:user_status].to_i + @us_order = params[:us_order].blank? ? "desc" : params[:us_order] # 排序 + @order_key = params[:order_key].blank? ? "created_on" : params[:order_key] # 排序关键字 condition = (params[:research_condition].nil? || params[:research_condition] == "name") ? "concat(lastname, firstname)" : params[:research_condition] if 0 == status if params[:research_condition] == "phone" && params[:research_contents].blank? - @users = User.order("created_on desc").all + @users = User.order("#{@order_key} #{@us_order}").all else - @users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("created_on desc").all + @users = User.where("#{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}").all end else if params[:research_condition] == "phone" && params[:research_contents].blank? - @users = User.where(:status => status).order("created_on desc").all + @users = User.where(:status => status).order("#{@order_key} #{@us_order}").all else - @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("created_on desc").all + @users = User.where("status = #{status} and #{condition} like '%#{params[:research_contents]}%'").order("#{@order_key} #{@us_order}").all end end @@ -33,8 +35,8 @@ class ManagementsController < ApplicationController @users = paginateHelper @users, @limit respond_to do |format| - format.html format.js + format.html end end diff --git a/app/views/managements/_user_list.html.erb b/app/views/managements/_user_list.html.erb index 441dc6170..398c5f486 100644 --- a/app/views/managements/_user_list.html.erb +++ b/app/views/managements/_user_list.html.erb @@ -6,8 +6,8 @@ 邮件地址 手机号码 单位 - 创建于 - 最后登录 + 创建于 ml5 color-blue"> + 最后登录 ml5 color-blue"> 操作 @@ -44,4 +44,43 @@
-<% end %> \ No newline at end of file +<% end %> + \ No newline at end of file From 12a2ac8f79db4794970514a6cc1de36518a090ff Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jul 2017 14:05:14 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5TA?= =?UTF-8?q?=E7=9A=84=E5=AE=9E=E8=AE=AD=E8=BF=9B=E8=A1=8C=E7=BF=BB=E9=A1=B5?= =?UTF-8?q?=E4=B8=8D=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 4 ++-- app/views/users/show.html.erb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index da7c72a84..167663265 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2043,7 +2043,7 @@ class UsersController < ApplicationController if @user == User.current @shixuns = Shixun.where(:user_id => @user).order("created_at desc") else - @shixuns = Shixun.where(:status => [2, 3], :id => @user).order("created_at desc") + @shixuns = Shixun.where(:status => [2, 3], :user_id => @user).order("created_at desc") end @limit = 5 @is_remote = true @@ -2211,7 +2211,7 @@ class UsersController < ApplicationController if @user == User.current @shixuns = Shixun.where(:user_id => @user).order("created_at desc") else - @shixuns = Shixun.where(:status => [2, 3], :id => @user).order("created_at desc") + @shixuns = Shixun.where(:status => [2, 3], :user_id => @user).order("created_at desc") end elsif params[:filter] == "cooperative" # 合作者及创建者 diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 07197032e..d6c6fb8ea 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -231,9 +231,9 @@
- "create") %>" class="course_filtrate fl course_filtrate_bg" data-remote="true">我创建的 - "cooperative") %>" class="course_filtrate fl" data-remote="true">我合作的 - "challenge") %>" class="course_filtrate fl" data-remote="true">我挑战的 + "create") %>" class="course_filtrate fl course_filtrate_bg" data-remote="true"><%= str %>创建的 + "cooperative") %>" class="course_filtrate fl" data-remote="true"><%= str %>合作的 + "challenge") %>" class="course_filtrate fl" data-remote="true"><%= str %>挑战的
From db63887e7c6ca2a6e5073114485a2cac873da9b8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jul 2017 14:10:12 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=8F=96=E6=B6=88=E5=88=B0=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_task_pass_form.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/challenges/_task_pass_form.html.erb b/app/views/challenges/_task_pass_form.html.erb index e1849fc65..30ab40395 100644 --- a/app/views/challenges/_task_pass_form.html.erb +++ b/app/views/challenges/_task_pass_form.html.erb @@ -28,7 +28,11 @@
  • 保存 - 取消 + <% if params[:action] == "new" %> + 取消 + <% else %> + 取消 + <% end %>
  • From 7c02bad6cad5d1d509e149c44229f06068dfd317 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jul 2017 14:27:54 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E5=BD=92=E6=A1=A3?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=90=8E=EF=BC=8C=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E6=98=AF=E5=BD=92=E6=A1=A3=E8=AF=BE=E7=A8=8B=EF=BC=8C=E6=89=80?= =?UTF-8?q?=E4=BB=A5=E5=A4=B4=E9=83=A8=E7=9A=84=E2=80=9C=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E8=AF=BE=E5=A0=82=E2=80=9D=E2=80=9C=E6=88=91=E7=9A=84=E8=AF=BE?= =?UTF-8?q?=E5=A0=82=E2=80=9D=E6=9C=80=E5=A5=BD=E4=B9=9F=E8=81=94=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=8C=E4=BD=BF=E6=95=B4=E4=B8=AA=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E6=95=B0=E6=8D=AE=E5=92=8C=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=BF=9D=E6=8C=81=E4=B8=80=E8=87=B4=E3=80=82=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=90=8E=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- app/views/courses/index.html.erb | 4 ++-- app/views/courses/index.js.erb | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 84f445f53..e19008076 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -46,7 +46,7 @@ class CoursesController < ApplicationController @select = params[:select].nil? ? '' : params[:select] @is_end = params[:is_end].nil? ? 0 : params[:is_end].to_i #是否归档 - @syllabuses_num = Course.where("is_end = 0 and is_delete = 0").count + @syllabuses_num = Course.where("is_end = #{@is_end} and is_delete = 0").count #@syllabus_count = all_syllabuses.count # 我创建的课堂 create_syllabuses = Course.where(:tea_id => @user.id).where("is_end = #{@is_end} and is_delete = 0 and name like '%#{@search}%'") diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index 466b8d9d4..ec838b511 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -6,8 +6,8 @@
    diff --git a/app/views/courses/index.js.erb b/app/views/courses/index.js.erb index ed6add425..6f5412247 100644 --- a/app/views/courses/index.js.erb +++ b/app/views/courses/index.js.erb @@ -9,5 +9,9 @@ $("#courses_index_syllabuses_3").attr('href', '<%= courses_path(:select => "join $("#courses_index_syllabuses_4").show(); $("#courses_index_syllabuses_5").hide(); <% end %> +<% if @select == "end" %> + $("#all_syllabuses").html("<%= @syllabuses_num %>"); + $("#my_syllabuses").html("<%= @join_syllabuses_count + @create_syllabuses_count %>"); +<% end %> $("#input_select_val").val('<%= @select %>'); $("#input_select_text").val('<%= @is_end %>'); \ No newline at end of file From ac6e9a755c48ddc8ee96064d0af8a49e61e52966 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jul 2017 15:24:22 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=9A=84=E7=AD=9B=E9=80=89=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E2=80=9C=E6=89=80=E6=9C=89=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 11 ++++++ app/views/shixuns/index.html.erb | 49 +++++++++++++++++++++------ 2 files changed, 49 insertions(+), 11 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 13aa8349e..e09702890 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -164,6 +164,7 @@ class ShixunsController < ApplicationController end @language = params[:language] @status = params[:status].to_i + @shixun_status = params[:shixun_status] # 2是已发布 3是未发布 @search = params[:search] @major = params[:major] @course = params[:course] @@ -200,6 +201,16 @@ class ShixunsController < ApplicationController shixun_ids = Myshixun.where(:user_id => User.current, :status => 1).map(&:shixun_id) @shixuns = @shixuns.where(:id => shixun_ids) end + case @shixun_status + when "1" + @shixuns = @shixuns.where(:status => [0, 1]) + when "2" + @shixuns = @shixuns.where(:status => 2) + when "3" + @shixuns = @shixuns.where(:status => 3) + when nil, "0" + @shixuns = @shixuns + end if @order == "created_at" @shixuns =@shixuns.reorder(order_str) else diff --git a/app/views/shixuns/index.html.erb b/app/views/shixuns/index.html.erb index 6808d4930..1517b1cad 100644 --- a/app/views/shixuns/index.html.erb +++ b/app/views/shixuns/index.html.erb @@ -69,6 +69,27 @@
    筛选条件
    +
  • + 所有状态 + +
  • 所有难度
  • \ No newline at end of file diff --git a/app/views/challenges/_edit_scoring.html.erb b/app/views/challenges/_edit_scoring.html.erb index 4c19ce5bd..307f8d74c 100644 --- a/app/views/challenges/_edit_scoring.html.erb +++ b/app/views/challenges/_edit_scoring.html.erb @@ -18,7 +18,7 @@
  • - <%= @challenge.score %>分 + <%= @challenge.score.nil? ? 0 : @challenge.score %>分
  • diff --git a/app/views/challenges/_score_form.html.erb b/app/views/challenges/_score_form.html.erb index 7f8e66622..ff8801819 100644 --- a/app/views/challenges/_score_form.html.erb +++ b/app/views/challenges/_score_form.html.erb @@ -24,7 +24,9 @@
  • 保存 - 取消 + <% if !@challenge.score.nil? %> + 取消 + <% end %>
  • diff --git a/app/views/challenges/_skill_form.html.erb b/app/views/challenges/_skill_form.html.erb index e7f0f81b9..d711ab15a 100644 --- a/app/views/challenges/_skill_form.html.erb +++ b/app/views/challenges/_skill_form.html.erb @@ -11,7 +11,7 @@ <% end %> <% end %> -
    +
    " id="add_shixun_skill">
    @@ -44,6 +44,7 @@ $(".task-tag-input").attr("value",""); } $("#shixun_skill_input").val(""); + $("#add_shixun_skill").hide(); } function close_tag(thisObj){ @@ -54,6 +55,7 @@ function challenge_skill_update(){ var nSkill = $(".knowledge_frame"); + add_tag(); if (nSkill.length > 0){ $("#challenge_skill_update").submit(); }else{ diff --git a/app/views/shixuns/_shixun_list.html.erb b/app/views/shixuns/_shixun_list.html.erb index db2105df6..2b0dcec9e 100644 --- a/app/views/shixuns/_shixun_list.html.erb +++ b/app/views/shixuns/_shixun_list.html.erb @@ -1,9 +1,9 @@
    From 1b55407a874e4e3bc757822c36d451eb173c4628 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jul 2017 16:57:47 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E8=AF=B7=E5=9C=A8=E9=98=B6=E6=AE=B5?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E7=9A=84=E5=8F=B3=E4=BE=A7=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E2=80=9C=E6=96=B0=E5=BB=BA=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E2=80=9D=E2=80=9C=E4=B8=8B=E4=B8=80=E4=BB=BB=E5=8A=A1=E2=80=9D?= =?UTF-8?q?=EF=BC=88=E5=A6=82=E6=9E=9C=E6=9C=89=E7=9A=84=E8=AF=9D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/challenges_controller.rb | 5 +++++ app/views/challenges/edit.html.erb | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 953a3575f..89e298286 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -92,6 +92,11 @@ class ChallengesController < ApplicationController end def edit + challenge_num = Challenge.where(:shixun_id => @shixun).count + challenge_pos = @challenge.position + if challenge_pos < challenge_num + @next_challenge = Challenge.where(:shixun_id => @shixun, :position => challenge_pos+1).first + end @tab = params[:tab].blank? ? 1 : params[:tab].to_i @editor = params[:editor] # 编辑模式 end diff --git a/app/views/challenges/edit.html.erb b/app/views/challenges/edit.html.erb index 55bae7a68..521b6c719 100644 --- a/app/views/challenges/edit.html.erb +++ b/app/views/challenges/edit.html.erb @@ -19,6 +19,12 @@

    阶段编辑(第<%= @challenge.position %>关)

    + <% unless @next_challenge.blank? %> + 下一阶段 + <% end %> + <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + 新建阶段 + <% end %>
    diff --git a/app/views/challenges/_skill_form.html.erb b/app/views/challenges/_skill_form.html.erb index d711ab15a..b1f6b80e8 100644 --- a/app/views/challenges/_skill_form.html.erb +++ b/app/views/challenges/_skill_form.html.erb @@ -49,8 +49,8 @@ function close_tag(thisObj){ // 获取父节点的id - var obj = thisObj.parentNode.id; - $("#"+obj).remove(); + var obj = $(thisObj).parent(); + $(obj).remove(); } function challenge_skill_update(){ From f3f9aea32cd72e3b8193bc2e83de738e95596c99 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 21 Jul 2017 17:21:03 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=9C=AC=E5=85=B3=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E4=BF=9D=E5=AD=98=E5=A5=BD=EF=BC=8C=E7=84=B6?= =?UTF-8?q?=E5=90=8E=E7=82=B9=E5=87=BB=E7=BC=96=E8=BE=91=EF=BC=8C=E5=86=8D?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=8F=96=E6=B6=88=EF=BC=8C=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=86=85=E5=AE=B9=E4=B8=8D=E8=A7=81=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/challenges/_task_pass_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/challenges/_task_pass_form.html.erb b/app/views/challenges/_task_pass_form.html.erb index 30ab40395..b5ca126ed 100644 --- a/app/views/challenges/_task_pass_form.html.erb +++ b/app/views/challenges/_task_pass_form.html.erb @@ -31,7 +31,7 @@ <% if params[:action] == "new" %> 取消 <% else %> - 取消 + 取消 <% end %>