From 6261b92c7f75386c965757bd4e62cdc4142fa3a3 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 14 Nov 2016 17:04:26 +0800 Subject: [PATCH 01/43] =?UTF-8?q?=E5=BF=BD=E7=95=A5oneapm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 9d33b264c..601f691a1 100644 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ public/javascripts/wechat/node_modules/ .access_token tmux*.log config/wechat.yml +config/oneapm.yml From e33146813d260db65ddfd1a985ed31562e43a283 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 15 Nov 2016 09:25:58 +0800 Subject: [PATCH 02/43] =?UTF-8?q?=E5=8A=A0=E6=97=A5=E5=BF=97=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/message.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/app/models/message.rb b/app/models/message.rb index 1d76c8ef6..6b2e29428 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -147,6 +147,7 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少 def decrease_boards_count + tStarttime = Time.now if self.project && !project.project_score.nil? # 讨论区 if self.parent_id.nil? @@ -157,13 +158,22 @@ class Message < ActiveRecord::Base self.project.project_score.update_attribute(:board_message_num, count < 0 ? 0 : count) end end + + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "message_time decrease_boards_count! user wait time = #{tUsedtime} ms" end def reset_counters! + tStarttime = Time.now if parent && parent.id Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id}) end board.reset_counters! + + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "message_time reset_counters! user wait time = #{tUsedtime} ms" end def sticky=(arg) @@ -358,6 +368,7 @@ class Message < ActiveRecord::Base #减少用户分数 def down_user_score + tStarttime = Time.now if self.parent_id.nil? && !self.board.project.nil? UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id }) update_memo_number(User.current,1) @@ -371,6 +382,10 @@ class Message < ActiveRecord::Base update_replay_for_memo(self.author,2,self.board.project) end end + + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "message_time down_user_score! user wait time = #{tUsedtime} ms" end def send_mail @@ -381,7 +396,13 @@ class Message < ActiveRecord::Base # Author lizanle # Description 删除对应消息的图片资源 def delete_kindeditor_assets + tStarttime = Time.now + delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE + + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "message_time delete_kindeditor_assets! user wait time = #{tUsedtime} ms" end # 课程成员得分(活跃度) @@ -399,6 +420,7 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数 def down_course_score + tStarttime = Time.now if self.course if self.parent_id.nil? # 发帖 down_course_score_num(self.course.id, self.author_id, "Message") @@ -407,6 +429,9 @@ class Message < ActiveRecord::Base down_course_score_num(self.course.id, self.author_id, "MessageReply") end end + tEndtime = Time.now + tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 + logger.info "message_time down_course_score! user wait time = #{tUsedtime} ms" end def delete_org_activities From 85938bf3f1fb2ff069ea5ee24b44a2fa0e12e2a2 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 15 Nov 2016 09:28:42 +0800 Subject: [PATCH 03/43] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/message.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/message.rb b/app/models/message.rb index 6b2e29428..0ae8d442b 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -147,6 +147,7 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少 def decrease_boards_count + logger.info 'decrease_boards_count! start' tStarttime = Time.now if self.project && !project.project_score.nil? # 讨论区 @@ -165,6 +166,7 @@ class Message < ActiveRecord::Base end def reset_counters! + logger.info 'reset_counters! start' tStarttime = Time.now if parent && parent.id Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id}) @@ -368,6 +370,7 @@ class Message < ActiveRecord::Base #减少用户分数 def down_user_score + logger.info 'down_user_score start' tStarttime = Time.now if self.parent_id.nil? && !self.board.project.nil? UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id }) @@ -396,6 +399,7 @@ class Message < ActiveRecord::Base # Author lizanle # Description 删除对应消息的图片资源 def delete_kindeditor_assets + logger.info 'delete_kindeditor_assets start' tStarttime = Time.now delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE @@ -420,6 +424,7 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数 def down_course_score + logger.info 'down_course_score start' tStarttime = Time.now if self.course if self.parent_id.nil? # 发帖 From 19e2c349177e6334be556c63f35f7c0bf230fd49 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 15 Nov 2016 10:33:28 +0800 Subject: [PATCH 04/43] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/message.rb | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/app/models/message.rb b/app/models/message.rb index 0ae8d442b..1d76c8ef6 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -147,8 +147,6 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少 def decrease_boards_count - logger.info 'decrease_boards_count! start' - tStarttime = Time.now if self.project && !project.project_score.nil? # 讨论区 if self.parent_id.nil? @@ -159,23 +157,13 @@ class Message < ActiveRecord::Base self.project.project_score.update_attribute(:board_message_num, count < 0 ? 0 : count) end end - - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "message_time decrease_boards_count! user wait time = #{tUsedtime} ms" end def reset_counters! - logger.info 'reset_counters! start' - tStarttime = Time.now if parent && parent.id Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id}) end board.reset_counters! - - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "message_time reset_counters! user wait time = #{tUsedtime} ms" end def sticky=(arg) @@ -370,8 +358,6 @@ class Message < ActiveRecord::Base #减少用户分数 def down_user_score - logger.info 'down_user_score start' - tStarttime = Time.now if self.parent_id.nil? && !self.board.project.nil? UserScore.joint(:delete_message, self.author,nil,self, { message_id: self.id }) update_memo_number(User.current,1) @@ -385,10 +371,6 @@ class Message < ActiveRecord::Base update_replay_for_memo(self.author,2,self.board.project) end end - - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "message_time down_user_score! user wait time = #{tUsedtime} ms" end def send_mail @@ -399,14 +381,7 @@ class Message < ActiveRecord::Base # Author lizanle # Description 删除对应消息的图片资源 def delete_kindeditor_assets - logger.info 'delete_kindeditor_assets start' - tStarttime = Time.now - delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE - - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "message_time delete_kindeditor_assets! user wait time = #{tUsedtime} ms" end # 课程成员得分(活跃度) @@ -424,8 +399,6 @@ class Message < ActiveRecord::Base # 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数 def down_course_score - logger.info 'down_course_score start' - tStarttime = Time.now if self.course if self.parent_id.nil? # 发帖 down_course_score_num(self.course.id, self.author_id, "Message") @@ -434,9 +407,6 @@ class Message < ActiveRecord::Base down_course_score_num(self.course.id, self.author_id, "MessageReply") end end - tEndtime = Time.now - tUsedtime = (tEndtime.to_i-tStarttime.to_i)*1000+(tEndtime.usec - tStarttime.usec)/1000 - logger.info "message_time down_course_score! user wait time = #{tUsedtime} ms" end def delete_org_activities From 14552abd5611e6cc00c07946c67b67cbd856375c Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 21 Nov 2016 10:08:27 +0800 Subject: [PATCH 05/43] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E4=BA=BA=E6=B0=94?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=B8=BB=E9=A1=B5=E5=85=B3=E6=B3=A8BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/blogs_controller.rb | 2 +- app/controllers/watchers_controller.rb | 7 ++++++- app/views/layouts/new_base_user.html.erb | 2 +- app/views/users/_user_fans_item.html.erb | 12 +++++++++++- app/views/users/user_fanslist.html.erb | 9 --------- app/views/watchers/_set_watcher.js.erb | 4 +++- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb index eeea2d01a..8c6cc4f0c 100644 --- a/app/controllers/blogs_controller.rb +++ b/app/controllers/blogs_controller.rb @@ -26,7 +26,7 @@ class BlogsController < ApplicationController @type = 2 @topics.each do |topic| - topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count) + topic[:infocount] = get_praise_num(topic) + BlogComment.where("root_id = #{topic.id}").count if topic[:infocount] < 0 topic[:infocount] = 0 end diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index da0c5733a..6f0d96dfa 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -37,7 +37,9 @@ class WatchersController < ApplicationController @list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); @action = 'fans' else - + if params[:target_id] + @user = User.find(params[:target_id]) + end end if params[:object_type] == 'project' @@ -78,6 +80,9 @@ class WatchersController < ApplicationController @list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); @action = 'fans' else + if params[:target_id] + @user = User.find(params[:target_id]) + end end if params[:object_type] == 'project' @project = Project.find(params[:object_id]) diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 783aade75..b27f144e9 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -148,7 +148,7 @@
  • 粉丝
    - <%= @user.watcher_users.count %> + <%= @user.watcher_users.count %>
  • diff --git a/app/views/users/_user_fans_item.html.erb b/app/views/users/_user_fans_item.html.erb index b3fc7905c..8614e0b61 100644 --- a/app/views/users/_user_fans_item.html.erb +++ b/app/views/users/_user_fans_item.html.erb @@ -52,4 +52,14 @@
    <% end %> -<% end %> \ No newline at end of file +
    +
    + +
    +
    +
    +<% else %> +

    <%= l(:label_no_data) %>

    +<% end %> diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 47bdc9126..77d85565e 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -26,16 +26,7 @@ <%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %> <%# end %> -

    <%= l(:label_no_data) %>

    -
    -
    - -
    -
    -
    diff --git a/app/views/watchers/_set_watcher.js.erb b/app/views/watchers/_set_watcher.js.erb index fee58c15c..83358b049 100644 --- a/app/views/watchers/_set_watcher.js.erb +++ b/app/views/watchers/_set_watcher.js.erb @@ -1,7 +1,9 @@ <% if( params[:object_type] == 'user') %> //点击头像下面的添加关注按钮 <% if( params[:target_id] == params[:object_id] ) %> - $("#watch_user_btn_div").html("<%= escape_javascript render(:partial => "layouts/user_watch_btn", :locals => {:target => watched.first}) %>"); + <% if @user %> + $("#watch_user_btn_div").html("<%= escape_javascript render(:partial => "layouts/user_watch_btn", :locals => {:target => watched.first}) %>"); + <% end %> $("#user_fans_number").html("<%= watched.first.watcher_users.count.to_s%>"); $(".add_cancel_watch_<%= watched.first.id %>").html("<%= escape_javascript (render :partial => 'users/watch_btn_for_picture', :locals => {:user => watched.first}) %>"); $(".fans_count_<%= watched.first.id %>").text("<%= watched.first.watcher_users.count.to_s %>"); From 3099b37f5eeae84c6bdf5163e2adea3c82fd0082 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 21 Nov 2016 12:07:14 +0800 Subject: [PATCH 06/43] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E5=85=B3=E6=B3=A8BUG=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_fans_item.html.erb | 114 +++++++++++------------ app/views/users/user_fanslist.html.erb | 43 +++++---- 2 files changed, 78 insertions(+), 79 deletions(-) diff --git a/app/views/users/_user_fans_item.html.erb b/app/views/users/_user_fans_item.html.erb index 8614e0b61..36d1b1b73 100644 --- a/app/views/users/_user_fans_item.html.erb +++ b/app/views/users/_user_fans_item.html.erb @@ -1,65 +1,55 @@ <% unless list.nil?%> -<% for item in list %> -
    -
    - - <%= image_tag(url_to_avatar(item), :style=>"width:64px;height:64px;",:alt=>"头像") %> - -
    -
    - <%= item.show_name %> -
    -
    - <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> -

    个性签名:<%= item.user_extensions.brief_introduction %>

    + <% for item in list %> +
    + +
    + <%= item.show_name %> +
    +
    + <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> +

    个性签名:<%= item.user_extensions.brief_introduction %>

    + <% end %> + + + + <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> + + + <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> + + + <% elsif item.user_extensions.identity == 2 %> + + + <% end %> +
    加入时间:<%= format_date(item.created_on) %>工作单位: +
  • + <%= item.user_extensions.school.name %> +
  • +
    工作单位: +
  • + <%= item.user_extensions.occupation %> +
  • +
    工作单位: +
  • + <%= item.show_name %> +
  • +
    +
    +
    + + <% if(User.current.logged? && User.current != item )%> + <%if(item.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> <% end %> - - - - <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> - - - <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> - - - <% elsif item.user_extensions.identity == 2 %> - - - <% end %> -
    加入时间:<%= format_date(item.created_on) %>工作单位: -
  • - <%= item.user_extensions.school.name %> -
  • -
    工作单位: -
  • - <%= item.user_extensions.occupation %> -
  • -
    工作单位: -
  • - <%= item.show_name %> -
  • -
    +
    -
    - - <% if(User.current.logged? && User.current != item )%> - <%if(item.watched_by?(User.current))%> - 取消关注 - <% else %> - 添加关注 - <% end %> - <% end %> -
    -
    -<% end %> -
    -
    -
      - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true%> -
    -
    -
    -
    -<% else %> -

    <%= l(:label_no_data) %>

    -<% end %> + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 77d85565e..041dabd03 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -7,30 +7,39 @@ } -
    -
    - <% if @action == 'fans' %> +
    +
    + <% if @action == 'fans' %>

    粉丝

    共有<%=@obj_count%>名粉丝
    - <% elsif @action == 'visitor' %> + <% elsif @action == 'visitor' %>

    访客

    共有<%=@obj_count%>访客
    - <% else %> + <% else %>

    关注

    一共关注<%=@obj_count%>
    - <% end %> + <% end %> +
    +
    +
    + <%# for item in @list %> + <%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %> + <%# end %> +
    +

    <%= l(:label_no_data) %>

    + +
    +
    +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true%> +
    -
    - <%# for item in @list %> - <%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %> - <%# end %> -
    - - - - - -
    + + + + + +
    From c31287f2f528332e73e4af4972c22dd3bb72a02f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 21 Nov 2016 15:21:51 +0800 Subject: [PATCH 07/43] =?UTF-8?q?temp=E7=94=A8=E6=88=B7=EF=BC=8C=E9=93=83?= =?UTF-8?q?=E9=93=9B=E6=B6=88=E6=81=AF=E6=8A=A5500=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=82=B9=E5=87=BB=E5=90=8D=E7=A7=B0=E8=BF=9B?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=EF=BC=88=E7=9B=AE=E5=89=8D?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=B1=BB=E6=B6=88=E6=81=AF=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E8=BF=9B=E8=87=AA=E5=B7=B1=E4=B8=BB=E9=A1=B5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_user_message_applied_schools.html.erb | 2 +- app/views/users/_user_message_course.html.erb | 11 +++++-- app/views/users/user_messages.html.erb | 1 + ...0161121063025_delete_temp_error_message.rb | 12 +++++++ db/schema.rb | 32 ++++++++----------- 5 files changed, 37 insertions(+), 21 deletions(-) create mode 100644 db/migrate/20161121063025_delete_temp_error_message.rb diff --git a/app/views/users/_user_message_applied_schools.html.erb b/app/views/users/_user_message_applied_schools.html.erb index 9de70a03a..1e2ff86ba 100644 --- a/app/views/users/_user_message_applied_schools.html.erb +++ b/app/views/users/_user_message_applied_schools.html.erb @@ -2,6 +2,6 @@ <% if ma.status != 0 %> 系统提示 <% else %> - <%=link_to User.where("id=?", ma.applied_user_id).first.show_name, user_path(ma.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to User.where("id=?", ma.applied_user_id).first.show_name, user_path(ma.applied_user_id), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> <% end %> "><%= applied_school_tip(ma) %> \ No newline at end of file diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 40f25d429..3520bf529 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -1,8 +1,15 @@ <% if ma.class == CourseMessage %> <% if ma.course_message_type == "News" && ma.course_message %>
      -
    • <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author), :target => '_blank' %>
    • -
    • <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>">发布了通知:
    • +
    • + + <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author), :target => '_blank' %> + +
    • +
    • + <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + ">发布了通知: +
    • <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id }, :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 2baa9f2f2..b1ae0aff2 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -87,3 +87,4 @@ + diff --git a/db/migrate/20161121063025_delete_temp_error_message.rb b/db/migrate/20161121063025_delete_temp_error_message.rb new file mode 100644 index 000000000..7e5063be5 --- /dev/null +++ b/db/migrate/20161121063025_delete_temp_error_message.rb @@ -0,0 +1,12 @@ +class DeleteTempErrorMessage < ActiveRecord::Migration + def up + Organization.where(:id => 68).update_all(:name => "blankname") + MessageAll.where(:message_id => 171).destroy_all + OrgMessage.where(:id => 171).destroy_all + MessageAll.where(:message_id => 16).destroy_all + OrgMessage.where(:id => 16).destroy_all + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 2739d5dcd..5e5833771 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -996,6 +996,19 @@ ActiveRecord::Schema.define(:version => 20161117060138) do t.datetime "updated_at", :null => false end + create_table "ii", :force => true do |t| + t.integer "project_id" + t.string "author_login" + t.string "rep_identifier" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sonar_version", :default => 0 + t.string "path" + t.string "branch" + t.string "language" + t.string "sonar_name" + end + create_table "innodb_monitor", :id => false, :force => true do |t| t.integer "a" end @@ -1587,6 +1600,7 @@ ActiveRecord::Schema.define(:version => 20161117060138) do t.boolean "hidden_repo", :default => false, :null => false t.integer "attachmenttype", :default => 1 t.integer "user_id" + t.integer "dts_test", :default => 0 t.string "enterprise_name" t.integer "organization_id" t.integer "project_new_type" @@ -1594,11 +1608,6 @@ ActiveRecord::Schema.define(:version => 20161117060138) do t.integer "forked_from_project_id" t.integer "forked_count" t.integer "publish_resource", :default => 0 - t.integer "boards_count", :default => 0 - t.integer "news_count", :default => 0 - t.integer "acts_count", :default => 0 - t.integer "journals_count", :default => 0 - t.integer "boards_reply_count", :default => 0 t.integer "visits", :default => 0 t.integer "hot", :default => 0 t.string "invite_code" @@ -1625,19 +1634,6 @@ ActiveRecord::Schema.define(:version => 20161117060138) do t.datetime "updated_at", :null => false end - create_table "quality_analyses", :force => true do |t| - t.integer "project_id" - t.string "author_login" - t.string "rep_identifier" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "sonar_version", :default => 0 - t.string "path" - t.string "branch" - t.string "language" - t.string "sonar_name" - end - create_table "queries", :force => true do |t| t.integer "project_id" t.string "name", :default => "", :null => false From c40288b8c39ca307f3de3056260d96bebbbcabeb Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 21 Nov 2016 16:26:14 +0800 Subject: [PATCH 08/43] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=BE=93=E5=85=A5=E5=8E=9F=E5=AF=86=E7=A0=81=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E4=B8=8B=E6=8B=89=E6=A1=86=E8=A6=81=E5=8E=BB=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 2a4b3b480..fd7425aab 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -214,7 +214,8 @@
    • 确认密码 : 
      -
    • + +
    • 请输入8-12个字符
    • From e585687e9cb234e2c78ee51189b02a840b426f49 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 21 Nov 2016 16:30:37 +0800 Subject: [PATCH 09/43] =?UTF-8?q?=E9=93=83=E9=93=9B=E6=B6=88=E6=81=AF?= =?UTF-8?q?=EF=BC=8C=E5=B0=86=E7=99=BB=E5=BD=95=E5=90=8D=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=A7=93=E5=90=8D=EF=BC=8C=E5=B9=B6=E5=B0=86?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=B2=A1=E6=9C=89=E9=93=BE=E6=8E=A5=E7=9A=84?= =?UTF-8?q?=E5=8A=A0=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/users_helper.rb | 2 +- app/views/users/_user_at_message.html.erb | 4 +- app/views/users/_user_message_course.html.erb | 8 ++-- app/views/users/_user_message_forge.html.erb | 42 +++++++++++++------ app/views/users/_user_message_forum.html.erb | 2 +- .../_user_message_userfeedaback.html.erb | 11 +++-- 6 files changed, 46 insertions(+), 23 deletions(-) diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 228e83080..4dd3399a3 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -100,7 +100,7 @@ module UsersHelper def applied_project_users applied_message # case applied_message.status # when 3,2,1,5,4,7,6 - user = User.find(applied_message.applied_user_id) + user = User.find(applied_message.applied_user_id).show_name # end end diff --git a/app/views/users/_user_at_message.html.erb b/app/views/users/_user_at_message.html.erb index 7bcbe8aa8..024934471 100644 --- a/app/views/users/_user_at_message.html.erb +++ b/app/views/users/_user_at_message.html.erb @@ -2,7 +2,9 @@
      • <%=link_to image_tag(url_to_avatar(ma.author), :width => "30", :height => "30"),user_path(ma.author) %>
      • - <%= ma.author.login %>提到了你: + + <%= link_to ma.author.show_name, user_path(ma.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + 提到了你:
      • <% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %> diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 3520bf529..159da2789 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -29,7 +29,7 @@ <% if ma.course_message_type == "Comment" && ma.course_message %>
        • <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %>
        • -
        • <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>">评论了通知:
        • +
        • <%=link_to User.find(ma.course_message.author_id).show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>">评论了通知:
        • <%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id }, :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" , :target => '_blank'%> @@ -298,7 +298,7 @@
          • <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %>
          • - <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>"> + <%=link_to ma.course_message.author.show_name, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>"> <%= ma.course_message.parent_id.nil? ? "发布了班级帖子:" : "评论了班级帖子:" %>
          • <% if ma.course_message.parent_id.nil? %>
          • @@ -622,7 +622,7 @@ <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id), :target => '_blank' %>
          • - <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to User.find(ma.course_message_id).show_name, user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">将您加入了班级:
          • @@ -690,7 +690,7 @@ <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id), :target => '_blank' %>
          • - <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to User.find(ma.course_message_id).show_name, user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">将您移出了班级:
          • diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 479710002..5a1cecfb6 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -26,7 +26,7 @@ <%=link_to image_tag(url_to_avatar(User.find(ma.forge_message_id)), :width => "30", :height => "30"), user_path(ma.forge_message_id), :target => '_blank' %>
          • - <%=link_to User.find(ma.forge_message_id), user_path(User.find(ma.forge_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to User.find(ma.forge_message_id).show_name, user_path(User.find(ma.forge_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">将您加入了项目:
          • @@ -47,7 +47,7 @@ <%=link_to image_tag(url_to_avatar(User.find(ma.forge_message_id)), :width => "30", :height => "30"), user_path(ma.forge_message_id), :target => '_blank' %>
          • - <%=link_to User.find(ma.forge_message_id), user_path(User.find(ma.forge_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to User.find(ma.forge_message_id).show_name, user_path(User.find(ma.forge_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> ">将您移出了项目:
          • @@ -99,11 +99,15 @@ <%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %>
          • - <%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> - "><%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%> + <%=link_to User.find(ma.forge_message.author_id).show_name, user_path(ma.forge_message.author), + :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + "> + <%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%> +
          • - <%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> + <%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id), + :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> @@ -117,8 +121,11 @@ <%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %>
          • - <%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> - "><%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%> + <%=link_to User.find(ma.forge_message.author_id).show_name, user_path(ma.forge_message.author), + :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + "> + <%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%> +
          • <%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> @@ -133,10 +140,12 @@ <% if ma.forge_message_type == "Journal" && ma.forge_message %>
            • - <%=link_to image_tag(url_to_avatar(ma.forge_message.user), :width => "30", :height => "30"), user_path(ma.forge_message.user), :target => '_blank' %> + + <%=link_to image_tag(url_to_avatar(ma.forge_message.user), :width => "30", :height => "30"), user_path(ma.forge_message.user), :target => '_blank' %> +
            • - <%=link_to ma.forge_message.user, user_path(ma.forge_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%= link_to User.find(ma.forge_message.user_id).show_name, user_path(ma.forge_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> 更新了问题状态:
            • @@ -153,7 +162,7 @@ <% if ma.forge_message_type == "Message" %>
              • <%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %>
              • -
              • <%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> +
              • <%=link_to User.find(ma.forge_message.user_id).show_name, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %>
              • <%= link_to ma.forge_message.subject, board_message_path(ma.forge_message.board_id, ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> @@ -166,9 +175,16 @@ <% end %> <% if ma.forge_message_type == "Comment" %>
                  -
                • <%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %>
                • -
                • <%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> - ">评论了新闻:
                • +
                • + + <%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author), :target => '_blank' %> + +
                • +
                • + <%=link_to User.find(ma.forge_message.user_id).show_name, user_path(ma.forge_message.author), + :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + ">评论了新闻: +
                • <%= link_to "#{ma.forge_message.commented.title}", {:controller => 'news', :action => 'show', :id => ma.forge_message.commented.id },:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %> diff --git a/app/views/users/_user_message_forum.html.erb b/app/views/users/_user_message_forum.html.erb index 5d6c5bcad..37ad1a744 100644 --- a/app/views/users/_user_message_forum.html.erb +++ b/app/views/users/_user_message_forum.html.erb @@ -5,7 +5,7 @@ <%=link_to image_tag(url_to_avatar(ma.memo.author), :width => "30", :height => "30"), user_path(ma.memo.author), :target => '_blank' %>
                • - <%=link_to ma.memo.author, user_path(ma.memo.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + <%=link_to User.find(ma.memo.author_id).show_name, user_path(ma.memo.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> " ><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %>
                • <% if ma.memo.parent_id.nil? %> diff --git a/app/views/users/_user_message_userfeedaback.html.erb b/app/views/users/_user_message_userfeedaback.html.erb index 666fa37a3..00fa78eeb 100644 --- a/app/views/users/_user_message_userfeedaback.html.erb +++ b/app/views/users/_user_message_userfeedaback.html.erb @@ -2,11 +2,16 @@ <% if ma.journals_for_message_type == "JournalsForMessage" %>
                  • - <%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user), :target => '_blank' %> + + <%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), + user_path(ma.journals_for_message.user), :target => '_blank' %> +
                  • - <%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> - "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %> + <%=link_to User.find(ma.journals_for_message.user_id).show_name, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> + "> + <%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %> +
                  • <%= link_to message_content(ma.journals_for_message.notes), feedback_path(ma.journals_for_message.jour_id, :anchor => "user_activity_#{ma.journals_for_message.id}"), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank'%> From 4388b7625e619c8b601a3dc52ed0b8845d1106f7 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 21 Nov 2016 16:58:25 +0800 Subject: [PATCH 10/43] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E5=BD=92=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 47 ++++++++++++++++++- app/views/courses/archive_course.js.erb | 2 + .../syllabuses/_syllabus_course_list.html.erb | 19 +------- app/views/users/_courses_list.html.erb | 28 ++++++----- .../users/_syllabus_course_list.html.erb | 6 +-- app/views/users/user_archive_courses.html.erb | 0 app/views/users/user_courselist.html.erb | 8 +++- config/routes.rb | 1 + public/javascripts/application.js | 16 +++++++ public/stylesheets/css/courses.css | 8 +++- public/stylesheets/syllabus.css | 2 +- 11 files changed, 98 insertions(+), 39 deletions(-) create mode 100644 app/views/users/user_archive_courses.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 56b536d30..1a8c7f7f0 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3397,7 +3397,11 @@ class UsersController < ApplicationController @my_syllabuses = @user.syllabuses - my_syllabus_ids = @my_syllabuses.empty? ? "(-1)" : "(" + @my_syllabuses.map{|syllabus| syllabus.id}.join(',') + ")" + if @user == User.current + archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1").map{|course| course.syllabus_id}.join(",") + ")" + @archive_syllabuses = Syllabus.where("id in #{archive_ids}") + end + sy_courses = @user.courses.visible.not_deleted syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")" syllabus_members = SyllabusMember.where("user_id = #{@user.id}") @@ -3469,6 +3473,47 @@ class UsersController < ApplicationController end end + #归档班级列表 + def user_archive_courses + if User.current.logged? + @order, @c_sort, @type, @list_type = params[:order] || 1, params[:sort] || 1, params[:type] || 1, params[:list_type] || 1 + + #确定 sort_type + if @order.to_i == @type.to_i + @c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序 + else + @c_sort = 2 + end + + sort_name = "updated_at" + archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1").map{|course| course.syllabus_id}.join(",") + ")" + @archive_syllabuses = Syllabus.where("id in #{archive_ids}") + + if @order.to_i == 1 #根据 班级更新时间排序 + @archive_syllabuses = syllabus_course_list_sort @archive_syllabuses + @c_sort == 1 ? (@archive_syllabuses = @archive_syllabuses.sort{|x,y| x[:last_update] <=> y[:last_update] }) : (@archive_syllabuses = @archive_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]}) + @type = 1 + elsif @order.to_i == 2 #根据 作业+资源数排序 + @type = 2 + @archive_syllabuses.each do |syllabus| + count = 0 + courses = syllabus.courses.not_deleted + courses.each do |c| + count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count) + end + syllabus[:infocount] = count + end + @c_sort == 1 ? (@archive_syllabuses = @syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@archive_syllabuses = @archive_syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]}) + @archive_syllabuses = sortby_time_countcommon_nosticky @archive_syllabuses,sort_name + else + @type = 1 + end + respond_to do |format| + format.html + end + end + end + #展开课程下的班级 def expand_courses @syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first diff --git a/app/views/courses/archive_course.js.erb b/app/views/courses/archive_course.js.erb index 9d66c8441..c7cd0f729 100644 --- a/app/views/courses/archive_course.js.erb +++ b/app/views/courses/archive_course.js.erb @@ -13,5 +13,7 @@ function click_OK(){ hideModal(); <% if params[:source] == "1" %> window.location.href = "<%=syllabus_courselist_syllabus_path(@syllabus, :list_type => params[:type].to_i) %>"; + <% else params[:source] == "0" %> + window.location.href = "<%=user_courselist_path(User.current) %>"; <% end %> } \ No newline at end of file diff --git a/app/views/syllabuses/_syllabus_course_list.html.erb b/app/views/syllabuses/_syllabus_course_list.html.erb index 1ce62a1b4..995514db5 100644 --- a/app/views/syllabuses/_syllabus_course_list.html.erb +++ b/app/views/syllabuses/_syllabus_course_list.html.erb @@ -68,11 +68,11 @@ <%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green fr mt5",:method => "post"%> <% end %> <% if User.current == course.teacher || User.current.admin? %> - 归档 + 归档 <% end %> <% else %> <% if User.current == course.teacher || User.current.admin? %> - 恢复 + 恢复 <% end %> <% end %>
                    @@ -119,19 +119,4 @@ $(function() { $(".sy_con_l").css("min-height",$(".sy_con_r").height()); }); - function archive_course(id, type){ - if(type == 0){ - var htmlvalue = '

                    提示

                    '+ - '

                    您是否确定归档此班级

                    ' + - '取  消' + - '确  定
                    '; - pop_box_new(htmlvalue, 400, 132); - } else{ - var htmlvalue = '

                    提示

                    '+ - '

                    您和您的学生将可以重新在此班级中互动
                    此班级的动态会在首页中显示

                    ' + - '您是否确定恢复此班级

                    取  消' + - '确  定
                    '; - pop_box_new(htmlvalue, 400, 200); - } - } \ No newline at end of file diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb index d79215f9a..439a24d10 100644 --- a/app/views/users/_courses_list.html.erb +++ b/app/views/users/_courses_list.html.erb @@ -7,30 +7,32 @@
                    -
                    +
                    " class="syllabus_class_title fl" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= course.name %> <%= course.is_public == 0 ? '私有' : '公开' %> -

                    更新:<%= format_date Time.at(course.updatetime) %> - 学期:<%= current_time_and_term(course) %>

                    - -

                    - <% student_link = (User.current.logged? && course.open_student == 1 && course.is_public == 1) || (User.current.member_of_course?(course)) || User.current.admin? %> - " target="_blank" title="<%= student_link ? "" : "学生列表不对外公开" %>"><%= studentCount course %>学生 - | - " target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= visable_course_homework course %>作业 - | - " target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= visable_attachemnts_incourse(course).count %>资源 + 创建老师:<%= link_to course.teacher.show_name, user_path(course.teacher) %>

                    -
                    - + <% if User.current == course.teacher || User.current.admin? %> +
                    + 归档 +
                    + + +

                    此班级的信息将不再显示
                    + 您和您的学生将不能在此班级中继续互动
                    + 但您可以点击上方的“归档管理” +

                    +
                    +
                    + <% end %>
                  • diff --git a/app/views/users/_syllabus_course_list.html.erb b/app/views/users/_syllabus_course_list.html.erb index 0759cb5b6..6c8e2140e 100644 --- a/app/views/users/_syllabus_course_list.html.erb +++ b/app/views/users/_syllabus_course_list.html.erb @@ -1,16 +1,12 @@
                    <% if @type.to_i == 2 %> <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :style => "margin-right: 5px;", :remote => true %> - <% else %> - <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fr", :style => "margin-right: 5px;", :remote => true %> <% end %> <%= link_to "人气", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fr", :remote => true %> <% if @type.to_i == 1 %> <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :remote => true %> - <% else %> - <%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fr", :remote => true %> <% end %> - <%= link_to "时间", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fr", :remote => true %> + <%= link_to "时间", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt mr5 fr", :remote => true %> <%=@user == User.current ? "我" : "他" %><%= list_type == 1 ? "创建" : "加入"%>的课程
                    diff --git a/app/views/users/user_archive_courses.html.erb b/app/views/users/user_archive_courses.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/users/user_courselist.html.erb b/app/views/users/user_courselist.html.erb index 8f41b051e..b247ed230 100644 --- a/app/views/users/user_courselist.html.erb +++ b/app/views/users/user_courselist.html.erb @@ -1,5 +1,11 @@
                    -

                    课程列表

                    +
                    +

                    课程列表

                    + <% if @user == User.current && !@archive_syllabuses.blank? %> + <%= link_to "归档管理", user_archive_courses_users_path(), :class => "linkBlue2 mt15 fr mr20 f14"%> + <% end %> +
                    +
                    <%= render :partial => 'users/user_syllabus_list'%>
                    diff --git a/config/routes.rb b/config/routes.rb index 3848c4b46..f3cc8c159 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -579,6 +579,7 @@ RedmineApp::Application.routes.draw do post 'user_select_homework' post 'check_homework' get 'all_journals' + get 'user_archive_courses' end member do diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 3f5a739f9..6c0f615dd 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -2240,3 +2240,19 @@ function getIssueStatistics(url){ } +function archive_course(id, type, source){ + if(type == 0){ + var htmlvalue = '

                    提示

                    '+ + '

                    您是否确定归档此班级

                    ' + + '取  消' + + '确  定
                    '; + pop_box_new(htmlvalue, 400, 132); + } else{ + var htmlvalue = '

                    提示

                    '+ + '

                    您和您的学生将可以重新在此班级中互动
                    此班级的动态会在首页中显示

                    ' + + '您是否确定恢复此班级

                    取  消' + + '确  定
                    '; + pop_box_new(htmlvalue, 400, 200); + } +} + diff --git a/public/stylesheets/css/courses.css b/public/stylesheets/css/courses.css index 1f7301772..91a22a177 100644 --- a/public/stylesheets/css/courses.css +++ b/public/stylesheets/css/courses.css @@ -597,4 +597,10 @@ a:hover.blueCir{ background:#3598db; color:#fff;} a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:27px; display:block;float:right;} a:hover.ex_icon_de{ background:url(/images/course/icons.png) -20px -342px no-repeat;} .ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:27px; display:block;float:right; margin-right:10px;} -a:hover.ex_icon_edit{ background:url(/images/course/icons.png) -21px -276px no-repeat;} \ No newline at end of file +a:hover.ex_icon_edit{ background:url(/images/course/icons.png) -21px -276px no-repeat;} + +/*首页课程列表归档按钮提示*/ +/*分组作业评分提示框*/ +.archive_course_notice {width:220px; position:absolute; padding:5px 10px; white-space:nowrap; background-color:#fff; right:-265px; top:-15px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);} +.archive_course_notice em {display:block; border-width:10px; position:absolute;top:26px; left:-20px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;} +.archive_course_notice span {display:block; border-width:10px; position:absolute;top:26px; left:-18px; border-style:dashed solid dashed dashed; border-color:transparent #fff transparent transparent; font-size:0; line-height:0;} diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css index 64640f96f..499e4a336 100644 --- a/public/stylesheets/syllabus.css +++ b/public/stylesheets/syllabus.css @@ -65,7 +65,7 @@ input.syllabus_input_min{ .syllabus_class_list_more{padding:8px; text-align:center;border-left:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7;} .syllabus_class_list_more:hover{ background:#ececec;} .syllabus_class_list_more a{ color:#ff7e00;} -a.syllabus_class_title{ font-size:14px; color:#333; max-width:480px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } +a.syllabus_class_title{ font-size:14px; color:#333; max-width:520px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .syllabus_class_w{ width:650px;} .syllabus_class_property {font-size:12px; padding:0 5px; border-radius:3px; line-height:14px;} .syllabus_class_private {color:#ff4a1b; border:1px solid #ff4a1b;} From 428cb8e928d9a30b2362b0651fc5262db49a19f1 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 21 Nov 2016 17:21:15 +0800 Subject: [PATCH 11/43] =?UTF-8?q?=E9=A1=B9=E7=9B=AEissue=E3=80=82=E9=87=8C?= =?UTF-8?q?=E7=A8=8B=E7=A2=91=E4=B8=BA=E7=A9=BA=EF=BC=8C=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E4=B8=BA100%=E7=9A=84issue=E7=AD=9B=E9=80=89=E4=B8=8D=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 5 +++-- db/migrate/20161121091826_modify_fixed_version_id.rb | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20161121091826_modify_fixed_version_id.rb diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index a137b7cd1..b5e92546f 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -284,11 +284,11 @@ class IssuesController < ApplicationController # 用户编辑更改issue def update - # params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0 + # params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0 + # params[:fixed_version_id] = nil if params[:fixed_version_id].to_i == 0 if params[:issue_detail] issue = Issue.find(params[:id]) issue = update_user_issue_detail(issue, params) - @issue.assigned_to_id = nil if @issue.assigned_to_id == 0 @saved = update_user_issue_detail(issue, params) return else @@ -296,6 +296,7 @@ class IssuesController < ApplicationController return unless update_issue_from_params @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) @issue.assigned_to_id = nil if @issue.assigned_to_id == 0 + @issue.fixed_version_id = nil if @issue.fixed_version_id == 0 saved = false begin @saved = @issue.save_issue_with_child_records(params, @time_entry) diff --git a/db/migrate/20161121091826_modify_fixed_version_id.rb b/db/migrate/20161121091826_modify_fixed_version_id.rb new file mode 100644 index 000000000..3456aec28 --- /dev/null +++ b/db/migrate/20161121091826_modify_fixed_version_id.rb @@ -0,0 +1,8 @@ +class ModifyFixedVersionId < ActiveRecord::Migration + def up + Issue.where(:fixed_version_id => 0).update_all(:fixed_version_id => nil) + end + + def down + end +end From f1ad70bb335fbf4e21695a9fe8d48fc62726b1ea Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 22 Nov 2016 08:52:19 +0800 Subject: [PATCH 12/43] =?UTF-8?q?=E5=85=B3=E6=B3=A8BUG=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81BUG=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 3 +- app/views/users/_user_fans_item.html.erb | 114 +++++++++++------------ app/views/users/user_fanslist.html.erb | 43 +++++---- 3 files changed, 80 insertions(+), 80 deletions(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 2a4b3b480..fd7425aab 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -214,7 +214,8 @@
                  • 确认密码 : 
                    -
                  • + +
                  • 请输入8-12个字符
                  • diff --git a/app/views/users/_user_fans_item.html.erb b/app/views/users/_user_fans_item.html.erb index 8614e0b61..36d1b1b73 100644 --- a/app/views/users/_user_fans_item.html.erb +++ b/app/views/users/_user_fans_item.html.erb @@ -1,65 +1,55 @@ <% unless list.nil?%> -<% for item in list %> -
                    - -
                    - <%= item.show_name %> -
                    -
                    - <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> -

                    个性签名:<%= item.user_extensions.brief_introduction %>

                    + <% for item in list %> +
                    + +
                    + <%= item.show_name %> +
                    +
                    + <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> +

                    个性签名:<%= item.user_extensions.brief_introduction %>

                    + <% end %> + + + + <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> + + + <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> + + + <% elsif item.user_extensions.identity == 2 %> + + + <% end %> +
                    加入时间:<%= format_date(item.created_on) %>工作单位: +
                  • + <%= item.user_extensions.school.name %> +
                  • +
                    工作单位: +
                  • + <%= item.user_extensions.occupation %> +
                  • +
                    工作单位: +
                  • + <%= item.show_name %> +
                  • +
                    +
                    +
                    + + <% if(User.current.logged? && User.current != item )%> + <%if(item.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> <% end %> - - - - <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> - - - <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> - - - <% elsif item.user_extensions.identity == 2 %> - - - <% end %> -
                    加入时间:<%= format_date(item.created_on) %>工作单位: -
                  • - <%= item.user_extensions.school.name %> -
                  • -
                    工作单位: -
                  • - <%= item.user_extensions.occupation %> -
                  • -
                    工作单位: -
                  • - <%= item.show_name %> -
                  • -
                    +
                    -
                    - - <% if(User.current.logged? && User.current != item )%> - <%if(item.watched_by?(User.current))%> - 取消关注 - <% else %> - 添加关注 - <% end %> - <% end %> -
                    -
                    -<% end %> -
                    -
                    -
                      - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true%> -
                    -
                    -
                    -
                    -<% else %> -

                    <%= l(:label_no_data) %>

                    -<% end %> + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 77d85565e..041dabd03 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -7,30 +7,39 @@ } -
                    -
                    - <% if @action == 'fans' %> +
                    +
                    + <% if @action == 'fans' %>

                    粉丝

                    共有<%=@obj_count%>名粉丝
                    - <% elsif @action == 'visitor' %> + <% elsif @action == 'visitor' %>

                    访客

                    共有<%=@obj_count%>访客
                    - <% else %> + <% else %>

                    关注

                    一共关注<%=@obj_count%>
                    - <% end %> + <% end %> +
                    +
                    +
                    + <%# for item in @list %> + <%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %> + <%# end %> +
                    +

                    <%= l(:label_no_data) %>

                    + +
                    +
                    +
                      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true, :is_new => true%> +
                    -
                    - <%# for item in @list %> - <%= render :partial => 'users/user_fans_item', :locals => {:list => @list,:target=>@user,:action_name=>@action,:page=>params[:page]} %> - <%# end %> -
                    - - - - - -
                    + + + + + +
                    From 0eb6a607b20ae241f1ce1f5c497057b6063d4fc9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 22 Nov 2016 09:23:16 +0800 Subject: [PATCH 13/43] =?UTF-8?q?=E9=A1=B9=E7=9B=AEissue=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E5=90=8D=E7=A7=B0=E5=90=8E=E7=BC=80=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/organization.rb | 1 + app/views/attachments/_project_file_links.html.erb | 14 +++++++------- public/stylesheets/css/common.css | 1 + 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/models/organization.rb b/app/models/organization.rb index 50f62ea11..284754c03 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -9,6 +9,7 @@ class Organization < ActiveRecord::Base has_many :org_subfields, :dependent => :destroy has_many :users, :through => :org_members has_many :files + has_many :org_messages, :class_name => 'OrgMessage', :dependent => :destroy acts_as_attachable validates_uniqueness_of :name after_create :save_as_org_activity, :add_default_subfields diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index cccc8382c..a1a978a48 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -30,9 +30,9 @@ <% for attachment in attachments %>

                    - <%if is_float%> -

                    - <% end%> + <% if is_float %> +
                    + <% end %> <% if options[:length] %> <% if User.current.logged? %> @@ -42,15 +42,15 @@ <% end %> <% else %> <% if User.current.logged? %> - <%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%> + <%= link_to_short_attachment attachment, :length => 58,:class => 'hidden link_file_a fl newsBlue mw400 h15', :download => true -%> <% else %> - <%= link_to(attachment.filename, signin_url_without_domain,:length=> 58, :class => "hidden link_file_a fl newsBlue mw400") %> + <%= link_to(attachment.filename, signin_url_without_domain,:length => 58, :class => "hidden link_file_a fl newsBlue mw400 h15") %> <% end %> <% end %> - <%if is_float%> + <% if is_float %>
                    - <% end%> + <% end %> <% if attachment.is_text? %> <%= link_to image_tag('magnifier.png'), diff --git a/public/stylesheets/css/common.css b/public/stylesheets/css/common.css index bbc85f3ce..89664a633 100644 --- a/public/stylesheets/css/common.css +++ b/public/stylesheets/css/common.css @@ -300,6 +300,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/ .w720{width:721px;} .w730{width:730px;} .w770{ width:770px;} +.h15{ height: 15px; } .h28{height: 28px;} .h20{height: 20px;} .h22{ height:22px;} From 8d980b16dba84b107f6007f2714e7af814a967fb Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 22 Nov 2016 10:10:53 +0800 Subject: [PATCH 14/43] =?UTF-8?q?=E6=8D=A2=E8=A1=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index f9a88baf8..3467214c9 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,5 +1,5 @@ -
                    +
                    <%= render :partial => 'projects/invite_code' %>
                    <% if @project.description.blank? %> From c571d195483065c15af0aaf02d3571d12c1357b4 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 22 Nov 2016 10:16:09 +0800 Subject: [PATCH 15/43] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=AE=80=E4=BB=8B?= =?UTF-8?q?=E5=8D=95=E8=AF=8D=E4=B8=8D=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 09ed2216a..5a38e3b38 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,5 +1,5 @@ -
                    +
                    <%= render :partial => 'projects/invite_code' %>
                    <% if @project.description.blank? %> From eeacd76aa9ff0d49a728cc87ba19c3533da96c7e Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 22 Nov 2016 10:27:56 +0800 Subject: [PATCH 16/43] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E5=BD=92=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/syllabuses_controller.rb | 2 +- app/controllers/users_controller.rb | 14 +++-- app/views/courses/archive_course.js.erb | 8 ++- app/views/layouts/base_users_new.html.erb | 12 ++-- app/views/layouts/new_base_user.html.erb | 10 ++-- app/views/users/_courses_list.html.erb | 23 ++++--- .../users/_syllabus_course_list.html.erb | 3 + .../users/_user_archive_course_list.html.erb | 60 +++++++++++++++++++ app/views/users/user_archive_courses.html.erb | 40 +++++++++++++ app/views/users/user_archive_courses.js.erb | 1 + app/views/users/user_courselist.html.erb | 2 +- 11 files changed, 149 insertions(+), 26 deletions(-) create mode 100644 app/views/users/_user_archive_course_list.html.erb create mode 100644 app/views/users/user_archive_courses.js.erb diff --git a/app/controllers/syllabuses_controller.rb b/app/controllers/syllabuses_controller.rb index cad65f88d..13bacbd4b 100644 --- a/app/controllers/syllabuses_controller.rb +++ b/app/controllers/syllabuses_controller.rb @@ -92,7 +92,7 @@ class SyllabusesController < ApplicationController def destroy if @syllabus && @syllabus.courses.not_deleted.empty? @syllabus.destroy - redirect_to user_courselist_user_path(User.current.id) + redirect_to user_courselist_user_path(User.current) end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 1a8c7f7f0..04a3df24a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3476,7 +3476,7 @@ class UsersController < ApplicationController #归档班级列表 def user_archive_courses if User.current.logged? - @order, @c_sort, @type, @list_type = params[:order] || 1, params[:sort] || 1, params[:type] || 1, params[:list_type] || 1 + @order, @c_sort, @type = params[:order] || 1, params[:sort] || 1, params[:type] || 1 #确定 sort_type if @order.to_i == @type.to_i @@ -3485,6 +3485,7 @@ class UsersController < ApplicationController @c_sort = 2 end + @user = User.current sort_name = "updated_at" archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1").map{|course| course.syllabus_id}.join(",") + ")" @archive_syllabuses = Syllabus.where("id in #{archive_ids}") @@ -3503,13 +3504,14 @@ class UsersController < ApplicationController end syllabus[:infocount] = count end - @c_sort == 1 ? (@archive_syllabuses = @syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@archive_syllabuses = @archive_syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]}) + @c_sort == 1 ? (@archive_syllabuses = @archive_syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@archive_syllabuses = @archive_syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]}) @archive_syllabuses = sortby_time_countcommon_nosticky @archive_syllabuses,sort_name else @type = 1 end respond_to do |format| - format.html + format.js + format.html {render :layout => 'new_base_user'} end end end @@ -3518,7 +3520,11 @@ class UsersController < ApplicationController def expand_courses @syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first unless @syllabus.nil? - @courses = @syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") + if params[:is_delete] && params[:is_delete] == '1' + @courses = @syllabus.courses.where("is_delete = 1").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") + else + @courses = @syllabus.courses.not_deleted.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc") + end respond_to do |format| format.js end diff --git a/app/views/courses/archive_course.js.erb b/app/views/courses/archive_course.js.erb index c7cd0f729..a5ef39035 100644 --- a/app/views/courses/archive_course.js.erb +++ b/app/views/courses/archive_course.js.erb @@ -13,7 +13,11 @@ function click_OK(){ hideModal(); <% if params[:source] == "1" %> window.location.href = "<%=syllabus_courselist_syllabus_path(@syllabus, :list_type => params[:type].to_i) %>"; - <% else params[:source] == "0" %> - window.location.href = "<%=user_courselist_path(User.current) %>"; + <% elsif params[:source] == "0" %> + <% if params[:type] == "0" %> + window.location.href = "<%=user_courselist_user_path(User.current) %>"; + <% else %> + window.location.href = "<%=user_archive_courses_users_path() %>"; + <% end %> <% end %> } \ No newline at end of file diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb index 2f3ef2928..316d10c4c 100644 --- a/app/views/layouts/base_users_new.html.erb +++ b/app/views/layouts/base_users_new.html.erb @@ -140,25 +140,25 @@ - <% all_comments = []%> - <% all_replies = OrgDocumentComment.where("root_id = #{activity.id}").reorder("created_at desc") %> - <% count = all_replies.count %> +
                    - <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %> - - <% comments = all_replies[0..2] %> - <% if count > 0 %> -
                    - <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id, :is_course => 0, :is_board =>0}%> -
                    - <% end %> - -
                    -
                    <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
                    -
                    - <% if User.current.logged? %> -
                    - <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id,:is_course => 0, :is_board => 0},:method => "post", :remote => true) do |f|%> - - -
                    - - -
                    -

                    - <% end%> -
                    - <% else %> - <%= render :partial => "users/show_unlogged" %> - <% end %> -
                    -
                    -
                    +
                    + <%=render :partial => 'organizations/org_message_post_reply', :locals => {:activity => activity, :user_activity_id => user_activity_id} %>
                    -