From 878bcc8cf13008e9638379db127e4bd1c84665f2 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 9 May 2016 14:43:28 +0800 Subject: [PATCH 01/35] =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=B7=BB=E5=8A=A0=E8=80=81=E5=B8=88=E3=80=81?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/organizations_helper.rb | 6 ++++++ .../_org_left_subfield_list.html.erb | 1 - app/views/organizations/setting.html.erb | 20 +++++++++++++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 917ccc01c..4b6139a6a 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -148,4 +148,10 @@ module OrganizationsHelper org_acts end + def org_subfield_had_created?(org, type) + sub_field = org.org_subfields.select{|subfield| subfield.field_type == type} + result = sub_field.length > 0 ? true : false + result + end + end diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 39837df88..77a2a014b 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -118,7 +118,6 @@ <% end %> - <% else %>
<% if !field.subfield_subdomain_dir.nil? %> diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index c989b259c..4c9a9e92e 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -152,10 +152,22 @@ - - - - +
  • + + +
  • + <% unless org_subfield_had_created?(@organization, "Comptec") %> +
  • + + +
  • + <% end %> + <% unless org_subfield_had_created?(@organization, "Compstu") %> +
  • + + +
  • + <% end %>
  • 新增
  • From a98678e001ab0d61b0effd06d81ec3d164775611 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 9 May 2016 15:00:50 +0800 Subject: [PATCH 02/35] =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=AD=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=98=BE=E7=A4=BA=E6=96=B9=E6=B3=95=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/organizations_helper.rb | 15 +++++++++++++++ .../_org_left_subfield_list.html.erb | 2 +- app/views/organizations/_subfield_list.html.erb | 13 +++++-------- app/views/organizations/setting.html.erb | 6 +++--- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 4b6139a6a..981921d0b 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -154,4 +154,19 @@ module OrganizationsHelper result end + def org_subfield_type(field) + case field.field_type + when "Post" + result = "帖子" + when "Resource" + result = "资源" + when "Compstu" + result = "学生" + when "Comptec" + result = "教师" + when "Complex" + result = "综合" + end + end + end diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 77a2a014b..6e01e9c50 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -91,7 +91,7 @@ <% end %> <% else %>
    - <% if field.field_type == "Post" %> + <% if field.field_type == ("Post" || "Complex" || "Compstu" || "Comptec") %>
    <% if !field.subfield_subdomain_dir.nil? %> diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index 4619ed337..0d6b5aac2 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -8,7 +8,6 @@
  • 操作
  • - <% subfields.each do |field| %> <% if is_default_field?(field) %> <% name = get_default_name(field) %> @@ -32,10 +31,9 @@
    <%= select( :name,:group_id, subfield_status_option_default, { :include_blank => false,:selected => field.status}, - { :onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %> + { :onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %> <% end %> <% end %> -
  • 默认
  • <%= field.hide==0?"隐藏":"可见" %> @@ -60,20 +58,19 @@
  • 新增
  • <% if field.field_type == "Resource" %> - 列表 + 默认 <% else %> <%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %>
    <%= select( :name,:group_id, subfield_status_option, - { :include_blank => false,:selected => field.status}, - {:onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %> + { :include_blank => false,:selected => field.status}, + { :onchange=>"update_status('#update_status_form_#{field.id}');", :id =>"field_status_id", :name => "status",:class=>"undis class-edit fl", :style => "width:56px;"}) %> <% end %> - <% end %>
  • -
  • <%= field.field_type == "Post" ? "帖子" : "资源" %>
  • +
  • <%= org_subfield_type field %>
  • - +
  • <% unless org_subfield_had_created?(@organization, "Comptec") %>
  • - +
  • <% end %> <% unless org_subfield_had_created?(@organization, "Compstu") %>
  • - +
  • <% end %>
  • 新增
  • From fc36e4c01eb12f52154561cec393ea209dda912d Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 9 May 2016 18:10:22 +0800 Subject: [PATCH 03/35] =?UTF-8?q?=E6=95=99=E5=B8=88=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 10 +- .../_org_left_subfield_list.html.erb | 2 +- .../organizations/_show_students.html.erb | 36 +++++ .../organizations/_show_teachers.html.erb | 45 +++++++ app/views/organizations/show.html.erb | 126 ++++++++++-------- public/stylesheets/new_user.css | 1 + public/stylesheets/org.css | 20 ++- 7 files changed, 177 insertions(+), 63 deletions(-) create mode 100644 app/views/organizations/_show_students.html.erb create mode 100644 app/views/organizations/_show_teachers.html.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 3709dd24b..561ebf8a8 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -98,10 +98,16 @@ class OrganizationsController < ApplicationController else if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) @organization = Organization.find(params[:id]) + # params[:org_subfield_id] 存在即对应的栏目,否则进入组织动态 if params[:org_subfield_id] @org_subfield = OrgSubfield.find(params[:org_subfield_id]) - @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 - @org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) + if @org_subfield.field_type == "Comptec" || @org_subfield.field_type == "Compstu" + #@org_students = User.find_by_sql("SELECT * FROM users u, user_extensions ue where u.id = ue.user_id and ue.identity =1;") + @org_teachers = User.find_by_sql("SELECT * FROM users u, user_extensions ue where u.id = ue.user_id and ue.identity =0;") + else + @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 + @org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) + end else shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id) shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 6e01e9c50..90019354c 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -91,7 +91,7 @@ <% end %> <% else %>
    - <% if field.field_type == ("Post" || "Complex" || "Compstu" || "Comptec") %> + <% if field.field_type == "Post" || field.field_type == "Complex" || field.field_type == "Compstu" || field.field_type == "Comptec" %>
    <% if !field.subfield_subdomain_dir.nil? %> diff --git a/app/views/organizations/_show_students.html.erb b/app/views/organizations/_show_students.html.erb new file mode 100644 index 000000000..7f8d90203 --- /dev/null +++ b/app/views/organizations/_show_students.html.erb @@ -0,0 +1,36 @@ +
    +
    + + + +
    +
    +
    +
    +
    +
    +
    尹刚国防科学技术大学教授
    +
    +
    6000
    +
    课程数
    +
    +
    +
    +
    500
    +
    学生数
    +
    +
    +
    +
    8000
    +
    资源数
    +
    +
    + 添加 +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/organizations/_show_teachers.html.erb b/app/views/organizations/_show_teachers.html.erb new file mode 100644 index 000000000..a95efbfa9 --- /dev/null +++ b/app/views/organizations/_show_teachers.html.erb @@ -0,0 +1,45 @@ +
    +
    + + + +
    +
    + <% @org_teachers.each do |org_teacher| %> + <% school = School.where("id =?", org_teacher.school_id).first %> +
    +
    +
    +
    +
    <%= org_teacher.try(:realname).nil? ? org_teacher.try(:login) : org_teacher.try(:realname) %> + <% unless school.nil? %> + <%= school.name %> + <% end %> + <% unless org_teacher.nil? %> + <%= org_teacher.technical_title %>
    + <% end %> +
    +
    <%= User.current.courses.count %>
    +
    课程数
    +
    +
    +
    +
    500
    +
    学生数
    +
    +
    +
    +
    8000
    +
    资源数
    +
    +
    + 添加 +
    +
    +
    + <% end %> +
    \ No newline at end of file diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index f217f006e..24c1ab791 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -1,69 +1,77 @@ -<%= javascript_include_tag "jquery.infinitescroll.js" %> +<% if !params[:org_subfield_id].nil? && @org_subfield.field_type == "Compstu" %> + <%= render 'organizations/show_students', :field => @org_subfield %> +<% elsif !params[:org_subfield_id].nil? && @org_subfield.field_type == "Comptec" %> + <%= render 'organizations/show_teachers', :field => @org_subfield %> +<% else %> + <%= javascript_include_tag "jquery.infinitescroll.js" %> -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> -<% end %> + <%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <% end %> -<% if params[:show_homepage].nil? and User.current.logged? %> -
    -
    <%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %>
    - <% if params[:org_subfield_id].nil? %> -
      -
    • -
        -
      • -
          -
        • 课程动态
        • -
        • <%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%> -
        • -
        • <%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%> - -
        • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%> -
        • <%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> - - -
        -
      • -
      • -
          -
        • 项目动态
        • -
        • <%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%> -
        • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%> - -
        -
      • -
      • -
          -
        • 更多
        • -
        • <%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%> -
        • <%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%> + <% if params[:show_homepage].nil? and User.current.logged? %> +
          +
          <%= @org_subfield.nil? ? "最新动态":"#{@org_subfield.name}" %>
          + <% if params[:org_subfield_id].nil? %> +
            +
          • +
              +
            • +
                +
              • 课程动态
              • +
              • <%= link_to "作业动态", {:controller => "organizations", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%> +
              • +
              • <%= link_to "通知动态", {:controller => "organizations", :action => "show", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey"%> + +
              • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey"%> +
              • <%= link_to "问卷动态", {:controller => "organizations", :action => "show", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%> + + +
              +
            • +
            • +
                +
              • 项目动态
              • +
              • <%= link_to "问题动态", {:controller => "organizations", :action => "show", :type => "project_issue"}, :class => "homepagePostTypeQuestion postTypeGrey"%> +
              • <%= link_to "论坛动态", {:controller => "organizations", :action => "show", :type => "project_message"}, :class => "homepagePostTypeForum postTypeGrey"%> + +
              +
            • +
            • +
                +
              • 更多
              • +
              • <%= link_to "组织动态", {:controller => "organizations", :action => "show", :type => "org"}, :class =>"homepagePostTypeMessage postTypeGrey"%> +
              • <%= link_to "全部动态", {:controller => "organizations", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%> +
              +
            • +
            +
          -
        • -
        -
      • -
      - <% end %> -
    -<% end %> -<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> - - <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> + <% end %> +
    + <% end %> + <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %> + + <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> <%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> -<% end %> -<% if @org_activities %> - <%= render :partial => 'organizations/org_activities', - :locals => {:org_activities => @org_activities, - :page=> @page, - :org => @organization, - :org_act_count=> @org_activities.count} %> + <% end %> + <% if @org_activities %> + <%= render :partial => 'organizations/org_activities', + :locals => {:org_activities => @org_activities, + :page=> @page, + :org => @organization, + :org_act_count=> @org_activities.count} %> + <% end %> <% end %> + + diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 986e4183d..0d0602788 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -76,6 +76,7 @@ a.linkGrey6:hover {color:#ffffff !important;} .ml15{ margin-left:15px;} .ml20{ margin-left:20px;} .ml24{margin-left:24px;} +.ml25{margin-left:25px;} .ml36{ margin-left:36px; } .ml40{ margin-left:40px;} .ml45{ margin-left:45px;} diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index d05c94bbe..76309217d 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -159,4 +159,22 @@ a.blue-btn { background-color: #269ac9; cursor: pointer; text-align: center; -} \ No newline at end of file +} + +/*名师榜20160505*/ +.function-row {border-bottom:1px dashed #b2b2b2; padding-bottom:16px;} +.teacher-list-search {width:310px; height:23px; border:1px solid #ccc; border-right:none; outline:none;} +.teacher-search-icon {background:url(../images/search.png) 0 3px no-repeat; width:25px; height:23px; border:1px solid #ccc; border-left:none;} +.teacher-search-type {width:84px; height:23px; border:1px solid #ccc; outline:none;} +.teacher-list-row {border-bottom:1px dashed #b2b2b2; padding:18px 0;} +.teacher-avatar {float:left;} +.teacher-name {font-size:18px; color:#333; margin-right:15px;} +.teacher-social-block {width:90px; float:left; text-align:center;} +.block-num {font-size:16px; color:#000;} +.block-title {font-size:12px; color:#999;} +.block-slice {width:1px; height:40px; background-color:#e0e0e0; float:left; margin-top:3px;} +.teacher-intro {font-size:13px; color:#999; line-height:24px; height:72px; overflow:hidden;} +a.teacher-select {font-size:13px; color:#fff; padding:3px 18px; background-color:#269ac9;} +a.teacher-select:hover {background-color:#297fb8;} +a.follow-button {font-size:13px; color:#272727; padding:3px 5px; background-color:#f2efef;} +a.follow-button:hover {background-color:#c1c1c1;} From cf1cf58babb1f98869b99623513273aec077c6b7 Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 9 May 2016 18:44:20 +0800 Subject: [PATCH 04/35] =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=97=A8=E6=88=B7?= =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E7=9B=AE=E5=BD=95=E6=B7=BB=E5=8A=A0=E5=88=86?= =?UTF-8?q?=E6=A0=8F"|"=E4=BB=A5=E5=8F=8A=E7=99=BB=E5=BD=95=E6=9C=AA?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E4=BD=8D=E7=BD=AE=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org2.html.erb | 6 +- app/views/layouts/base_sub_domain.html.erb | 378 +- db/schema.rb | 4379 +++++++++-------- .../javascripts/code_review.js | 706 +-- .../stylesheets/activity.css | 6 +- .../stylesheets/code_review.css | 192 +- .../stylesheets/window_js/MIT-LICENSE | 38 +- .../stylesheets/window_js/alert.css | 238 +- .../stylesheets/window_js/alert_lite.css | 176 +- .../stylesheets/window_js/alphacube.css | 300 +- .../stylesheets/window_js/behavior.htc | 100 +- .../stylesheets/window_js/darkX.css | 242 +- .../stylesheets/window_js/debug.css | 50 +- .../stylesheets/window_js/default.css | 310 +- .../stylesheets/window_js/iefix/iepngfix.css | 6 +- .../stylesheets/window_js/iefix/iepngfix.htc | 106 +- .../stylesheets/window_js/lighting.css | 1920 ++++---- .../window_js/lighting/pngbehavior.htc | 134 +- .../stylesheets/window_js/mac_os_x.css | 666 +-- .../stylesheets/window_js/mac_os_x_dialog.css | 320 +- .../stylesheets/window_js/nuncio.css | 328 +- .../stylesheets/window_js/spread.css | 216 +- public/stylesheets/org2.css | 5 +- 23 files changed, 5428 insertions(+), 5394 deletions(-) diff --git a/app/views/layouts/base_org2.html.erb b/app/views/layouts/base_org2.html.erb index 0052cf077..4c76056d6 100644 --- a/app/views/layouts/base_org2.html.erb +++ b/app/views/layouts/base_org2.html.erb @@ -101,10 +101,11 @@ <%= field.name %> - <% else activity.container_type == 'OrgSubfield' %> @@ -39,6 +40,7 @@ <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "fl sn-index-wximg" %> <% end %>

    <%=link_to message.content.to_s.html_safe, board_message_url_in_org(message.board.id, message.id), :target => "_blank" %>

    +
    <% else %> @@ -51,6 +53,7 @@ <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), board_message_path(message.board, activity), :target => "_blank", :class => "fl sn-index-wximg" %> <% end %>

    <%=link_to message.content.to_s.html_safe, board_message_path(message.board, activity), :target => "_blank" %>

    +
    <% end %> @@ -66,6 +69,7 @@ <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "104", :height => "104"), news_path(news), :target => "_blank", :class => "fl sn-index-wximg" %> <% end %>

    <%=link_to news.description.to_s.html_safe, news_path(news), :target => "_blank" %>

    +
    <% end %> @@ -96,3 +100,12 @@ <% end %> <% end %> + + diff --git a/public/stylesheets/org2.css b/public/stylesheets/org2.css index 6e2954bf4..f7be08e71 100644 --- a/public/stylesheets/org2.css +++ b/public/stylesheets/org2.css @@ -52,6 +52,7 @@ a.sn-link-select {color:#809df9;} .sn-ml15 {margin-left:15px;} .sn-ml55 {margin-left:55px;} .sn-mr0 {margin-right:0px !important;} +.sn-mr20 {margin-right:20px;} .sn-mr50 {margin-right:50px;} .sn-w229 {width:229px;} /*头部样式*/ From e8424d9b971f53413cc6371668dfcaac0d12e4e2 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 10 May 2016 10:57:55 +0800 Subject: [PATCH 10/35] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=A4=A7=E5=B0=8F=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_boardlist.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_project_boardlist.html.erb b/app/views/users/_project_boardlist.html.erb index 5f61d26ef..55f576db1 100644 --- a/app/views/users/_project_boardlist.html.erb +++ b/app/views/users/_project_boardlist.html.erb @@ -44,7 +44,7 @@ <% end %>

    <%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>100} %>

    -
    +
    发帖时间:<%= format_time(activity.created_on) %> 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %> <% count=0 %> From 99d9a288285b59d70b1a635a494d832a11540477 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 10 May 2016 11:33:02 +0800 Subject: [PATCH 11/35] =?UTF-8?q?=E5=90=8D=E5=B8=88=E6=A6=9Csql=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 2 +- app/helpers/organizations_helper.rb | 6 +++++- app/models/school.rb | 1 + app/views/organizations/_show_teachers.html.erb | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 561ebf8a8..07bd55321 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -103,7 +103,7 @@ class OrganizationsController < ApplicationController @org_subfield = OrgSubfield.find(params[:org_subfield_id]) if @org_subfield.field_type == "Comptec" || @org_subfield.field_type == "Compstu" #@org_students = User.find_by_sql("SELECT * FROM users u, user_extensions ue where u.id = ue.user_id and ue.identity =1;") - @org_teachers = User.find_by_sql("SELECT * FROM users u, user_extensions ue where u.id = ue.user_id and ue.identity =0;") + @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 order by course_count desc") else @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 @org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10) diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index f84c71a59..d2974baae 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -170,7 +170,11 @@ module OrganizationsHelper end def org_teacher_resource_count user - results = Attachment.find_by_sql("SELECT * FROM `attachments` where author_id = #{user.user_id};") + results = Attachment.find_by_sql("SELECT count(*) FROM attachments where author_id = #{user.id};").count + end + + def org_teacher_course_count user + results = Course.find_by_sql("select count(*) from courses where courses.tea_id = #{user.id}").count end end diff --git a/app/models/school.rb b/app/models/school.rb index 6cafb0473..b9a1d88cb 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -5,4 +5,5 @@ class School < ActiveRecord::Base def to_s self.name.to_s end + end diff --git a/app/views/organizations/_show_teachers.html.erb b/app/views/organizations/_show_teachers.html.erb index 28e308b49..9418b861f 100644 --- a/app/views/organizations/_show_teachers.html.erb +++ b/app/views/organizations/_show_teachers.html.erb @@ -23,7 +23,7 @@ <%= org_teacher.technical_title %>
    <% end %>
    -
    <%= User.current.courses.count %>
    +
    <%= org_teacher.courses.count %>
    课程数
    @@ -33,7 +33,7 @@
    -
    <%= org_teacher_resource_count(org_teacher) %>8000
    +
    <%= org_teacher_resource_count(org_teacher) %>
    资源数
    From cabac5914c29e18c2a27c3660a6cc4a8f10db200 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 10 May 2016 13:41:21 +0800 Subject: [PATCH 12/35] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/organizations_helper.rb | 8 ++++++-- app/views/organizations/_show_teachers.html.erb | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index d2974baae..3db2345ce 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -170,11 +170,15 @@ module OrganizationsHelper end def org_teacher_resource_count user - results = Attachment.find_by_sql("SELECT count(*) FROM attachments where author_id = #{user.id};").count + results = Attachment.find_by_sql("SELECT * FROM attachments where author_id = #{user.id};").count end def org_teacher_course_count user - results = Course.find_by_sql("select count(*) from courses where courses.tea_id = #{user.id}").count + results = Course.find_by_sql("select * from courses where courses.tea_id = #{user.id}").count end + def org_student_course_count user + course_ids = user.courses.map { |c| c.is_delete == 0 && c.id} + results = Member.find_by_sql("select id from courses where courses.tea_id = #{user.id}").count + end end diff --git a/app/views/organizations/_show_teachers.html.erb b/app/views/organizations/_show_teachers.html.erb index 9418b861f..cbaed9f74 100644 --- a/app/views/organizations/_show_teachers.html.erb +++ b/app/views/organizations/_show_teachers.html.erb @@ -23,12 +23,12 @@ <%= org_teacher.technical_title %> <% end %>
    -
    <%= org_teacher.courses.count %>
    +
    <%= org_teacher_course_count(org_teacher) %>
    课程数
    -
    500
    +
    <%= org_student_course_count(org_teacher) %>500
    学生数
    From d7add63f560689b9882086758551c0ffab59b82e Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 10 May 2016 16:03:50 +0800 Subject: [PATCH 13/35] =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E6=A0=8F=E7=9B=AE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=A1=B5=E5=9B=9E=E5=A4=8D=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sub_document_comments/_show_sub_document_newstyle.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/sub_document_comments/_show_sub_document_newstyle.html.erb b/app/views/sub_document_comments/_show_sub_document_newstyle.html.erb index 0af0bb698..a82e24ad4 100644 --- a/app/views/sub_document_comments/_show_sub_document_newstyle.html.erb +++ b/app/views/sub_document_comments/_show_sub_document_newstyle.html.erb @@ -14,7 +14,7 @@
  • <%=link_to document.title, org_subfield_sub_domain_sub_document_comment_path(document, :org_subfield_id => @org_subfield, :sub_domain_id => @subdomain), :class => "sn-newslist-titile fl", :target => "_blank" %> <%= format_date(document.created_at) %> - 回复(<%= document.children.count %>) + 回复(<%= document.children.count %>)
  • From f4b10d45d2479046d9454cf2b4ee3656f5f42621 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 10 May 2016 16:26:05 +0800 Subject: [PATCH 14/35] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E9=BC=A0?= =?UTF-8?q?=E6=A0=87=E7=BB=8F=E8=BF=87=E7=9A=84=E6=97=B6=E5=80=99=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=85=B7=E4=BD=93=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_dir_list_content.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/repositories/_dir_list_content.html.erb b/app/views/repositories/_dir_list_content.html.erb index 60c4aa3bf..4dee108ee 100644 --- a/app/views/repositories/_dir_list_content.html.erb +++ b/app/views/repositories/_dir_list_content.html.erb @@ -43,7 +43,7 @@ - - 添加 + <% if User.current.admin? %> + <%= org_teacher.excellent_teacher==0?"设为名师":"取消设置" %> + + <% else %> + <%= render :partial => 'layouts/user_watch_btn', :locals => {:target => org_teacher} %> + 关注 + <% end %>
    -<% end %> \ No newline at end of file +<% end %> + + \ No newline at end of file diff --git a/app/views/organizations/reset_excellent_teacher.js.erb b/app/views/organizations/reset_excellent_teacher.js.erb new file mode 100644 index 000000000..fdf160bc4 --- /dev/null +++ b/app/views/organizations/reset_excellent_teacher.js.erb @@ -0,0 +1 @@ +$("#hide_<%= @ex_teacher.id %>").text("设为名师"); \ No newline at end of file diff --git a/app/views/organizations/set_excellent_teacher.js.erb b/app/views/organizations/set_excellent_teacher.js.erb new file mode 100644 index 000000000..32dc53689 --- /dev/null +++ b/app/views/organizations/set_excellent_teacher.js.erb @@ -0,0 +1 @@ +$("#hide_<%= @ex_teacher.id %>").text("取消设置"); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 0df73ea68..44eca36ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -93,6 +93,8 @@ RedmineApp::Application.routes.draw do get 'autocomplete_search' post 'hide_org_subfield' post 'show_org_subfield' + post 'set_excellent_teacher' + post 'reset_excellent_teacher' post 'agree_apply_subdomain' end end diff --git a/db/migrate/20160513012705_add_excellent_teacher_to_user.rb b/db/migrate/20160513012705_add_excellent_teacher_to_user.rb new file mode 100644 index 000000000..88a79ec26 --- /dev/null +++ b/db/migrate/20160513012705_add_excellent_teacher_to_user.rb @@ -0,0 +1,5 @@ +class AddExcellentTeacherToUser < ActiveRecord::Migration + def change + add_column :users, :excellent_teacher, :integer, :default => false + end +end diff --git a/db/schema.rb b/db/schema.rb index 9a13f24da..d8ddb7e0d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160506104128) do +ActiveRecord::Schema.define(:version => 20160513012705) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -52,6 +52,28 @@ ActiveRecord::Schema.define(:version => 20160506104128) do add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" + create_table "application_settings", :force => true do |t| + t.integer "default_projects_limit" + t.boolean "signup_enabled" + t.boolean "signin_enabled" + t.boolean "gravatar_enabled" + t.text "sign_in_text" + t.datetime "created_at" + t.datetime "updated_at" + t.string "home_page_url" + t.integer "default_branch_protection", :default => 2 + t.boolean "twitter_sharing_enabled", :default => true + t.text "restricted_visibility_levels" + t.boolean "version_check_enabled", :default => true + t.integer "max_attachment_size", :default => 10, :null => false + t.integer "default_project_visibility" + t.integer "default_snippet_visibility" + t.text "restricted_signup_domains" + t.boolean "user_oauth_applications", :default => true + t.string "after_sign_out_path" + t.integer "session_expire_delay", :default => 10080, :null => false + end + create_table "applied_projects", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false @@ -144,6 +166,20 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.string "typeName", :limit => 50 end + create_table "audit_events", :force => true do |t| + t.integer "author_id", :null => false + t.string "type", :null => false + t.integer "entity_id", :null => false + t.string "entity_type", :null => false + t.text "details" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id" + add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type" + add_index "audit_events", ["type"], :name => "index_audit_events_on_type" + create_table "auth_sources", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 60, :default => "", :null => false @@ -241,6 +277,17 @@ ActiveRecord::Schema.define(:version => 20160506104128) do add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" add_index "boards", ["project_id"], :name => "boards_project_id" + create_table "broadcast_messages", :force => true do |t| + t.text "message", :null => false + t.datetime "starts_at" + t.datetime "ends_at" + t.integer "alert_type" + t.datetime "created_at" + t.datetime "updated_at" + t.string "color" + t.string "font" + end + create_table "bug_to_osps", :force => true do |t| t.integer "osp_id" t.integer "relative_memo_id" @@ -540,6 +587,10 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.integer "visits", :default => 0 end + add_index "courses", ["id"], :name => "id", :unique => true + add_index "courses", ["tea_id"], :name => "tea_id" + add_index "courses", ["visits"], :name => "visits" + create_table "custom_fields", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 30, :default => "", :null => false @@ -601,6 +652,15 @@ ActiveRecord::Schema.define(:version => 20160506104128) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" + create_table "deploy_keys_projects", :force => true do |t| + t.integer "deploy_key_id", :null => false + t.integer "project_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id" + create_table "discuss_demos", :force => true do |t| t.string "title" t.text "body" @@ -650,6 +710,16 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.datetime "created_at" end + create_table "emails", :force => true do |t| + t.integer "user_id", :null => false + t.string "email", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true + add_index "emails", ["user_id"], :name => "index_emails_on_user_id" + create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -672,6 +742,25 @@ ActiveRecord::Schema.define(:version => 20160506104128) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + create_table "events", :force => true do |t| + t.string "target_type" + t.integer "target_id" + t.string "title" + t.text "data" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "action" + t.integer "author_id" + end + + add_index "events", ["action"], :name => "index_events_on_action" + add_index "events", ["author_id"], :name => "index_events_on_author_id" + add_index "events", ["created_at"], :name => "index_events_on_created_at" + add_index "events", ["project_id"], :name => "index_events_on_project_id" + add_index "events", ["target_id"], :name => "index_events_on_target_id" + add_index "events", ["target_type"], :name => "index_events_on_target_type" + create_table "exercise_answers", :force => true do |t| t.integer "user_id" t.integer "exercise_question_id" @@ -774,6 +863,15 @@ ActiveRecord::Schema.define(:version => 20160506104128) do add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at" + create_table "forked_project_links", :force => true do |t| + t.integer "forked_to_project_id", :null => false + t.integer "forked_from_project_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true + create_table "forums", :force => true do |t| t.string "name", :null => false t.text "description" @@ -903,6 +1001,17 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.datetime "updated_at", :null => false end + create_table "identities", :force => true do |t| + t.string "extern_uid" + t.string "provider" + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id" + add_index "identities", ["user_id"], :name => "index_identities_on_user_id" + create_table "invite_lists", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1046,6 +1155,20 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.integer "private", :default => 0 end + create_table "keys", :force => true do |t| + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + t.text "key" + t.string "title" + t.string "type" + t.string "fingerprint" + t.boolean "public", :default => false, :null => false + end + + add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id" + add_index "keys", ["user_id"], :name => "index_keys_on_user_id" + create_table "kindeditor_assets", :force => true do |t| t.string "asset" t.integer "file_size" @@ -1057,6 +1180,27 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.integer "owner_type", :default => 0 end + create_table "label_links", :force => true do |t| + t.integer "label_id" + t.integer "target_id" + t.string "target_type" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id" + add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type" + + create_table "labels", :force => true do |t| + t.string "title" + t.string "color" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "labels", ["project_id"], :name => "index_labels_on_project_id" + create_table "member_roles", :force => true do |t| t.integer "member_id", :null => false t.integer "role_id", :null => false @@ -1107,6 +1251,47 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.integer "viewed_count", :default => 0 end + create_table "merge_request_diffs", :force => true do |t| + t.string "state" + t.text "st_commits", :limit => 2147483647 + t.text "st_diffs", :limit => 2147483647 + t.integer "merge_request_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true + + create_table "merge_requests", :force => true do |t| + t.string "target_branch", :null => false + t.string "source_branch", :null => false + t.integer "source_project_id", :null => false + t.integer "author_id" + t.integer "assignee_id" + t.string "title" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "milestone_id" + t.string "state" + t.string "merge_status" + t.integer "target_project_id", :null => false + t.integer "iid" + t.text "description" + t.integer "position", :default => 0 + t.datetime "locked_at" + end + + add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id" + add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id" + add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id" + add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at" + add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id" + add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch" + add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id" + add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch" + add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true + add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title" + create_table "message_alls", :force => true do |t| t.integer "user_id" t.integer "message_id" @@ -1141,6 +1326,39 @@ ActiveRecord::Schema.define(:version => 20160506104128) do add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" + create_table "milestones", :force => true do |t| + t.string "title", :null => false + t.integer "project_id", :null => false + t.text "description" + t.date "due_date" + t.datetime "created_at" + t.datetime "updated_at" + t.string "state" + t.integer "iid" + end + + add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id" + add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date" + add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true + add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id" + + create_table "namespaces", :force => true do |t| + t.string "name", :null => false + t.string "path", :null => false + t.integer "owner_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "type" + t.string "description", :default => "", :null => false + t.string "avatar" + end + + add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id" + add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true + add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id" + add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true + add_index "namespaces", ["type"], :name => "index_namespaces_on_type" + create_table "news", :force => true do |t| t.integer "project_id" t.string "title", :limit => 60, :default => "", :null => false @@ -1166,6 +1384,31 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.datetime "updated_at", :null => false end + create_table "notes", :force => true do |t| + t.text "note" + t.string "noteable_type" + t.integer "author_id" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "project_id" + t.string "attachment" + t.string "line_code" + t.string "commit_id" + t.integer "noteable_id" + t.boolean "system", :default => false, :null => false + t.text "st_diff", :limit => 2147483647 + end + + add_index "notes", ["author_id"], :name => "index_notes_on_author_id" + add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id" + add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id" + add_index "notes", ["created_at"], :name => "index_notes_on_created_at" + add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type" + add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" + add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type" + add_index "notes", ["project_id"], :name => "index_notes_on_project_id" + add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at" + create_table "notificationcomments", :force => true do |t| t.string "notificationcommented_type" t.integer "notificationcommented_id" @@ -1175,6 +1418,49 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.datetime "updated_at", :null => false end + create_table "oauth_access_grants", :force => true do |t| + t.integer "resource_owner_id", :null => false + t.integer "application_id", :null => false + t.string "token", :null => false + t.integer "expires_in", :null => false + t.text "redirect_uri", :null => false + t.datetime "created_at", :null => false + t.datetime "revoked_at" + t.string "scopes" + end + + add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true + + create_table "oauth_access_tokens", :force => true do |t| + t.integer "resource_owner_id" + t.integer "application_id" + t.string "token", :null => false + t.string "refresh_token" + t.integer "expires_in" + t.datetime "revoked_at" + t.datetime "created_at", :null => false + t.string "scopes" + end + + add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true + add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id" + add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true + + create_table "oauth_applications", :force => true do |t| + t.string "name", :null => false + t.string "uid", :null => false + t.string "secret", :null => false + t.text "redirect_uri", :null => false + t.string "scopes", :default => "", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "owner_id" + t.string "owner_type" + end + + add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type" + add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true + create_table "onclick_times", :force => true do |t| t.integer "user_id" t.datetime "onclick_time" @@ -1330,6 +1616,23 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.integer "show_mode", :default => 0 end + create_table "permissions", :force => true do |t| + t.string "controller", :limit => 30, :default => "", :null => false + t.string "action", :limit => 30, :default => "", :null => false + t.string "description", :limit => 60, :default => "", :null => false + t.boolean "is_public", :default => false, :null => false + t.integer "sort", :default => 0, :null => false + t.boolean "mail_option", :default => false, :null => false + t.boolean "mail_enabled", :default => false, :null => false + end + + create_table "permissions_roles", :id => false, :force => true do |t| + t.integer "permission_id", :default => 0, :null => false + t.integer "role_id", :default => 0, :null => false + end + + add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id" + create_table "phone_app_versions", :force => true do |t| t.string "version" t.text "description" @@ -1412,6 +1715,11 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.datetime "updated_at", :null => false end + create_table "project_import_data", :force => true do |t| + t.integer "project_id" + t.text "data" + end + create_table "project_infos", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1501,6 +1809,16 @@ ActiveRecord::Schema.define(:version => 20160506104128) do add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + create_table "protected_branches", :force => true do |t| + t.integer "project_id", :null => false + t.string "name", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "developers_can_push", :default => false, :null => false + end + + add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id" + create_table "queries", :force => true do |t| t.integer "project_id" t.string "name", :default => "", :null => false @@ -1635,6 +1953,25 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.integer "is_teacher_score", :default => 0 end + create_table "services", :force => true do |t| + t.string "type" + t.string "title" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "active", :default => false, :null => false + t.text "properties" + t.boolean "template", :default => false + t.boolean "push_events", :default => true + t.boolean "issues_events", :default => true + t.boolean "merge_requests_events", :default => true + t.boolean "tag_push_events", :default => true + t.boolean "note_events", :default => true, :null => false + end + + add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id" + add_index "services", ["project_id"], :name => "index_services_on_project_id" + create_table "settings", :force => true do |t| t.string "name", :default => "", :null => false t.text "value" @@ -1673,6 +2010,26 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.datetime "updated_at", :null => false end + create_table "snippets", :force => true do |t| + t.string "title" + t.text "content", :limit => 2147483647 + t.integer "author_id", :null => false + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "file_name" + t.datetime "expires_at" + t.string "type" + t.integer "visibility_level", :default => 0, :null => false + end + + add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id" + add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id" + add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at" + add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at" + add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id" + add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level" + create_table "softapplications", :force => true do |t| t.string "name" t.text "description" @@ -1745,9 +2102,9 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.integer "absence_penalty", :default => 0 t.float "system_score", :default => 0.0 t.boolean "is_test", :default => false + t.float "work_score" t.integer "simi_id" t.integer "simi_value" - t.float "work_score" end add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" @@ -1795,13 +2152,13 @@ ActiveRecord::Schema.define(:version => 20160506104128) do create_table "sub_domains", :force => true do |t| t.integer "org_subfield_id" - t.integer "priority", :default => 0 + t.integer "priority" t.string "name" t.string "field_type" - t.integer "hide", :default => 0 - t.integer "status", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "hide" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "subfield_subdomain_dirs", :force => true do |t| @@ -1811,6 +2168,17 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.datetime "updated_at", :null => false end + create_table "subscriptions", :force => true do |t| + t.integer "user_id" + t.integer "subscribable_id" + t.string "subscribable_type" + t.boolean "subscribed" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true + create_table "system_messages", :force => true do |t| t.integer "user_id" t.string "content" @@ -2043,12 +2411,24 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.string "salt", :limit => 64 t.integer "gid" t.integer "visits", :default => 0 + t.integer "excellent_teacher", :default => 0 end add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" add_index "users", ["type"], :name => "index_users_on_type" + create_table "users_star_projects", :force => true do |t| + t.integer "project_id", :null => false + t.integer "user_id", :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id" + add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true + add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id" + create_table "versions", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "name", :default => "", :null => false @@ -2100,6 +2480,23 @@ ActiveRecord::Schema.define(:version => 20160506104128) do t.datetime "updated_at", :null => false end + create_table "web_hooks", :force => true do |t| + t.string "url" + t.integer "project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "type", :default => "ProjectHook" + t.integer "service_id" + t.boolean "push_events", :default => true, :null => false + t.boolean "issues_events", :default => false, :null => false + t.boolean "merge_requests_events", :default => false, :null => false + t.boolean "tag_push_events", :default => false + t.boolean "note_events", :default => false, :null => false + end + + add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id" + add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id" + create_table "wechat_logs", :force => true do |t| t.string "openid", :null => false t.text "request_raw" From 83ac35cc94f64f1646754c8912488aa32c6356ef Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 10:29:22 +0800 Subject: [PATCH 22/35] =?UTF-8?q?=E4=B8=8D=E5=90=8C=E7=9A=84=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E5=AE=9A=E5=88=B6=E6=98=AF=E5=90=A6=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=90=8D=E5=B8=88=E6=A6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 1 + app/views/organizations/setting.html.erb | 5 +++++ .../20160513021204_add_allow_teacher_to_organization.rb | 5 +++++ db/schema.rb | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20160513021204_add_allow_teacher_to_organization.rb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 922e9cb66..98483bb64 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -279,6 +279,7 @@ class OrganizationsController < ApplicationController # @organization.domain = params[:organization][:domain] @organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0 @organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0 + @organization.allow_teacher = params[:organization][:allow_teacher] == 'on' ? 1 : 0 @organization.show_mode = params[:show_mode] #@organization.name = params[:organization][:name] @organization.save diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index c841b68b5..7b82f3a6e 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -87,6 +87,11 @@  允许游客下载 <%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %> + <% if User.current.admin? %> +
    允许设置名师榜 : + class="ml3" /> +
    + <% end %> 保存 <% end %> diff --git a/db/migrate/20160513021204_add_allow_teacher_to_organization.rb b/db/migrate/20160513021204_add_allow_teacher_to_organization.rb new file mode 100644 index 000000000..07b39c9a0 --- /dev/null +++ b/db/migrate/20160513021204_add_allow_teacher_to_organization.rb @@ -0,0 +1,5 @@ +class AddAllowTeacherToOrganization < ActiveRecord::Migration + def change + add_column :organizations, :allow_teacher, :integer, :default => false + end +end diff --git a/db/schema.rb b/db/schema.rb index d8ddb7e0d..ac18f108b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160513012705) do +ActiveRecord::Schema.define(:version => 20160513021204) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1614,6 +1614,7 @@ ActiveRecord::Schema.define(:version => 20160513012705) do t.boolean "allow_guest_download", :default => true t.integer "visits", :default => 0 t.integer "show_mode", :default => 0 + t.integer "allow_teacher", :default => 0 end create_table "permissions", :force => true do |t| From a2418396dd644e05647ee0e77863ea3852633a9f Mon Sep 17 00:00:00 2001 From: Linda <2294690300@qq.com> Date: Fri, 13 May 2016 10:30:38 +0800 Subject: [PATCH 23/35] =?UTF-8?q?=E9=82=A6=E6=9C=AC=E5=BA=93zip=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=A0=B7=E5=BC=8F=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 2 ++ public/stylesheets/repository.css | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 82e6f871f..6fed85acf 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -1,6 +1,8 @@ <%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>

    <%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>

    + ZIP下载 +
    <% if @entries.nil? %> diff --git a/public/stylesheets/repository.css b/public/stylesheets/repository.css index 9e0e07a77..89dc34d7a 100644 --- a/public/stylesheets/repository.css +++ b/public/stylesheets/repository.css @@ -287,4 +287,7 @@ li.commit .commit-row-info .committed_ago { .rep_history_grey{ color: #7F7F7F; } -.rep_mail_name{max-width: 150px; overflow: hidden; text-overflow: ellipsis;} \ No newline at end of file +.rep_mail_name{max-width: 150px; overflow: hidden; text-overflow: ellipsis;} +a.btn_zipdown{ display:block; height:25px; width:80px; text-align: center; line-height: 25px; border: 1px solid #dddddd; background-image: linear-gradient(#FCFCFC, #EEE); + color: #7f7f7f; -webkit-border-radius:3px;-moz-border-radius:3px;-o-border-radius:3px;border-radius:3px; margin-top: 7px; margin-right: 5px;} +a:hover.btn_zipdown{color:#269ac9;} \ No newline at end of file From 1673ae451b7d39e39fe4670c06b568ffe573b50e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 10:50:34 +0800 Subject: [PATCH 24/35] =?UTF-8?q?=E5=90=8D=E5=B8=88=E6=A6=9C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=B8=80=E4=B8=AA=E5=90=8E=E5=B0=B1=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=86=8D=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/organization.rb | 4 ++++ app/views/org_subfields/create.js.erb | 1 + .../_setting_excellent_teachers.html.erb | 6 ++++++ app/views/organizations/setting.html.erb | 19 +++---------------- 4 files changed, 14 insertions(+), 16 deletions(-) create mode 100644 app/views/organizations/_setting_excellent_teachers.html.erb diff --git a/app/models/organization.rb b/app/models/organization.rb index 8f9d290eb..311a37bf8 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -26,4 +26,8 @@ class Organization < ActiveRecord::Base def switch_type self.show_mode.to_i == 1 ? true : false end + + def allow_set_teachers + self.allow_teacher.to_i == 1 ? true : false + end end diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb index 3e08d9f9e..5cc6d5c91 100644 --- a/app/views/org_subfields/create.js.erb +++ b/app/views/org_subfields/create.js.erb @@ -4,6 +4,7 @@ :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); $("#sub_field_left_lists").html(""); $("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); + $("#org_excellent_teachers").html("<%= escape_javascript(render :partial => 'organizations/setting_excellent_teachers') %>"); <% end %> $("#subfield_name").val(""); $("#sub_dir").val(""); \ No newline at end of file diff --git a/app/views/organizations/_setting_excellent_teachers.html.erb b/app/views/organizations/_setting_excellent_teachers.html.erb new file mode 100644 index 000000000..ea6c1c9a6 --- /dev/null +++ b/app/views/organizations/_setting_excellent_teachers.html.erb @@ -0,0 +1,6 @@ +<% if @organization.allow_set_teachers && !org_subfield_had_created?(@organization, "Comptec") %> +
  • + + +
  • +<% end %> \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 7b82f3a6e..2caeee726 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -157,22 +157,9 @@ -
  • - - -
  • - <% unless org_subfield_had_created?(@organization, "Comptec") %> -
  • - - -
  • - <% end %> - <% unless org_subfield_had_created?(@organization, "Compstu") %> -
  • - - -
  • - <% end %> +
    + <%= render :partial => 'organizations/setting_excellent_teachers' %> +
  • 新增
  • From 61803aa6966e36352bd6ed4c03b29a5417c01b61 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 10:54:33 +0800 Subject: [PATCH 25/35] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=90=8D=E5=B8=88?= =?UTF-8?q?=E6=A6=9C=E7=9A=84=E6=97=B6=E5=80=99=E5=B1=80=E9=83=A8=E5=88=B7?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_subfields/destroy.js.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/org_subfields/destroy.js.erb b/app/views/org_subfields/destroy.js.erb index d069b1cd8..c14eeae8f 100644 --- a/app/views/org_subfields/destroy.js.erb +++ b/app/views/org_subfields/destroy.js.erb @@ -2,4 +2,5 @@ $("#org_subfield_list").html(""); $("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields.order("priority") }) %>"); $("#sub_field_left_lists").html(""); -$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); \ No newline at end of file +$("#sub_field_left_lists").html("<%= escape_javascript(render :partial => 'organizations/org_left_subfield_list', :locals => {:organization => @organization}) %>"); +$("#org_excellent_teachers").html("<%= escape_javascript(render :partial => 'organizations/setting_excellent_teachers') %>"); \ No newline at end of file From f7a888ac3dce4bc1a67215d1b6861f8df1ddc5ba Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 11:11:09 +0800 Subject: [PATCH 26/35] =?UTF-8?q?=E5=90=8D=E5=B8=88=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 6 ++++++ app/views/organizations/_subfield_list.html.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 661073cdc..c628b25fc 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -15,6 +15,12 @@ class OrgSubfieldsController < ApplicationController end end @subfield.update_attributes(:field_type => params[:field_type]) + # 如果栏目是教师,不参入类型的配置,定义为右三模式 + # 新增模块命名规则,左边1开头,右边2开头,以前的不变 + # eg:23 右三 + if params[:field_type] == "Comptec" + @subfield.update_attributes(:status => 23) + end else @res = false end diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index 0d6b5aac2..3cdb2991c 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -57,7 +57,7 @@
  • 新增
  • - <% if field.field_type == "Resource" %> + <% if field.field_type == "Resource" || field.field_type == "Comptec" %> 默认 <% else %> <%= form_tag({:controller => 'org_subfields', :action => 'update_status', :id => field.id,},:remote=>'true', :method => 'post', :id=>"update_status_form_#{field.id}", :class => 'query_form') do %> From 7bd047f7e4bbc5ef3a4d0f86e3c2b99949fae842 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 11:25:05 +0800 Subject: [PATCH 27/35] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=BA=8C=E4=B8=AD=E5=90=8D=E5=B8=88=E6=A6=9C=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_org2.html.erb | 2 ++ .../_org_subfield_rightM2.html.erb | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 app/views/organizations/_org_subfield_rightM2.html.erb diff --git a/app/views/layouts/base_org2.html.erb b/app/views/layouts/base_org2.html.erb index 6a641d0f2..9b481fac5 100644 --- a/app/views/layouts/base_org2.html.erb +++ b/app/views/layouts/base_org2.html.erb @@ -157,6 +157,8 @@ <%= render :partial => 'organizations/org_subfield_rightM', :locals => {:field => field} %> <% elsif field.status.to_i == 8 %> <%= render :partial => 'organizations/org_subfield_rightD', :locals => {:field => field} %> + <% elsif field.status.to_i == 23 %> + <%= render :partial => 'organizations/org_subfield_rightM2', :locals => {:field => field} %> <% end %> <% end %>
  • diff --git a/app/views/organizations/_org_subfield_rightM2.html.erb b/app/views/organizations/_org_subfield_rightM2.html.erb new file mode 100644 index 000000000..1f954b66a --- /dev/null +++ b/app/views/organizations/_org_subfield_rightM2.html.erb @@ -0,0 +1,24 @@ +
    +

    名师风采更多

    +
    +
    张晓华国防科学技术大学
    +
    博客 8课程 2学生 218
    +
    +
    +
    +
    张晓华国防科学技术大学
    博客 8课程 2学生 218
    +
    +
    +
    +
    张晓华国防科学技术大学
    博客 8课程 2学生 218
    +
    +
    +
    +
    张晓华国防科学技术大学
    博客 8课程 2学生 218
    +
    +
    +
    +
    张晓华国防科学技术大学
    博客 8课程 2学生 218
    +
    +
    +
    \ No newline at end of file From 61470c9bd40aa3601017c733363240077ed30d67 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 13 May 2016 11:29:45 +0800 Subject: [PATCH 28/35] =?UTF-8?q?=E5=90=8D=E5=B8=88=E6=A6=9Ccss=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/org2.css | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/public/stylesheets/org2.css b/public/stylesheets/org2.css index f7be08e71..c26d9498b 100644 --- a/public/stylesheets/org2.css +++ b/public/stylesheets/org2.css @@ -50,6 +50,7 @@ a.sn-link-select {color:#809df9;} .sn-mt28 {margin-top:28px;} .sn-mb40 {margin-bottom:40px;} .sn-ml15 {margin-left:15px;} +.sn-ml20 {margin-left:20px;} .sn-ml55 {margin-left:55px;} .sn-mr0 {margin-right:0px !important;} .sn-mr20 {margin-right:20px;} @@ -152,7 +153,7 @@ a.more-btn{ display:block; width:185px; height:30px; text-align:center; backgrou .partner-btn{ width:35px; height:22px; background-color:#999; line-height:1.0; font-size:18px; color:#fff; text-align: center; margin-right:5px; cursor:pointer;} .partner-btn:hover{ background-color:#172b65;} /* index-active */ -.sn-index-activebox{ margin-bottom:20px; background:#fff; padding-bottom:10px;} +.sn-index-activebox, .sn-teacher-wrap{ margin-bottom:20px; background:#fff; padding-bottom:10px;} .active-title{width:330px; display:block;overflow:hidden;white-space:nowrap; text-overflow:ellipsis;} .sn-index-active{ margin:0px 20px 5px 20px;} .sn-index-active a.sn-activeimg{width:330px; height:210px;} @@ -237,6 +238,18 @@ ul.sn-inner-pages li a:hover{ background-color:#24366e; color:#fff; text-decorat .sn-inner-pages_select { background-color:#24366e; color:#fff; padding: 1px 5px 0px 5px; margin-left:3px;margin-top: -2px; border:1px solid #64bdd9;} .sn-inner-pages_select a{background-color: #24366e; color: #fff;cursor: default;} +/*名师榜*/ +.sn-teacher-list {margin:0 20px; padding:15px 0; border-bottom:1px solid #e9e9e9;} +a.sn-teacher-name {width:75px; font-size:18px; color:#777; float:left;} +.sn-teacher-unit {width:154px; font-size:14px; color:#999; float:left; margin-left:15px; margin-top:3px;} +.sn-teacher-info {height:30px; line-height:30px; vertical-align:middle; float:left; margin-left:15px;} +.sn-teacher-social {height:30px; line-height:30px; vertical-align:middle; float:left; color:#999; font-size:12px; margin-left:15px;} +.sn-border-none {border:none;} +.sn-teacher-block {width:163px; height:222px; border-right:1px solid #e5e7ec; margin:40px 0 24px 0; float:left;} +.sn-teacher-avatar2 {margin:0 18px; padding:18px 0;} +.sn-teacher-info2 {color:#666; text-align:center; font-size:16px;} +.sn-info2-hidden {width:153px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin:0 auto;} + /*弹框*/ .upload_con h2 { display: block; From 457bac0b9d63160c4ee63b691fe6ddf441acb278 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 11:30:49 +0800 Subject: [PATCH 29/35] 0 --- app/views/organizations/teachers.html.erb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/organizations/teachers.html.erb b/app/views/organizations/teachers.html.erb index 211641fcb..a7417fa1b 100644 --- a/app/views/organizations/teachers.html.erb +++ b/app/views/organizations/teachers.html.erb @@ -9,11 +9,12 @@ - + + + + + +
    名师列表
    From 3853d5b7ad8981f6ab7eabd260df9dac74943a10 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 13:39:44 +0800 Subject: [PATCH 30/35] =?UTF-8?q?=E5=8F=B3=E4=B8=89=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E5=AE=9A=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/organizations_helper.rb | 5 +++ app/models/user.rb | 14 +++++++ .../_org_subfield_rightM2.html.erb | 42 +++++++++---------- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb index 3db2345ce..6463bf854 100644 --- a/app/helpers/organizations_helper.rb +++ b/app/helpers/organizations_helper.rb @@ -181,4 +181,9 @@ module OrganizationsHelper course_ids = user.courses.map { |c| c.is_delete == 0 && c.id} results = Member.find_by_sql("select id from courses where courses.tea_id = #{user.id}").count end + + def excellent_teachers + User.where("excellent_teacher =?",true) + end + end diff --git a/app/models/user.rb b/app/models/user.rb index 2030adfdf..c3a4f8c25 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -308,6 +308,20 @@ class User < Principal end # ====================================================================== + def my_workplace + self.user_extensions.try(:occupation).to_s + end + + def my_blogs_count + self.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count + end + + def my_students + my_students=StudentsForCourse.find_by_sql("SELECT SUM(student_count) as students_count, c.tea_id FROM courses c, (SELECT course_id , COUNT(id) AS student_count FROM students_for_courses GROUP BY course_id) AS ct + WHERE c.id= ct.course_id and c.tea_id = #{self.id} GROUP BY c.tea_id").first + results = my_students.blank? ? 0 : my_students.students_count + results + end # 查询用户未读过的记录 # 用户留言记录 diff --git a/app/views/organizations/_org_subfield_rightM2.html.erb b/app/views/organizations/_org_subfield_rightM2.html.erb index 1f954b66a..567df26d9 100644 --- a/app/views/organizations/_org_subfield_rightM2.html.erb +++ b/app/views/organizations/_org_subfield_rightM2.html.erb @@ -1,24 +1,24 @@

    名师风采更多

    -
    -
    张晓华国防科学技术大学
    -
    博客 8课程 2学生 218
    -
    -
    -
    -
    张晓华国防科学技术大学
    博客 8课程 2学生 218
    -
    -
    -
    -
    张晓华国防科学技术大学
    博客 8课程 2学生 218
    -
    -
    -
    -
    张晓华国防科学技术大学
    博客 8课程 2学生 218
    -
    -
    -
    -
    张晓华国防科学技术大学
    博客 8课程 2学生 218
    -
    -
    + <% excellent_teachers.each do |teacher| %> +
    + <%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sn-fl", :style => "display:block;"), user_path(teacher), :alt => "用户头像", :target => '_blank' %> + +
    + <%=link_to teacher.try(:realname) ? teacher.try(:realname) :teacher.try(:login), user_path(teacher), :class => "sn-teacher-name sn-hidden", :title => '', :target => '_blank' %> + <%= teacher.my_workplace %>
    +
    + <% unless teacher.my_blogs_count == 0 %> + 博客 <%= teacher.my_blogs_count %> + <% end %> + <% unless teacher.courses.count == 0 %> + 课程 <%= teacher.courses.count %> + <% end %> + <% unless teacher.my_students == 0 %> + 学生 <%= teacher.my_students %> + <% end %> +
    +
    +
    + <% end %>
    \ No newline at end of file From e90da9d812d98f1f62dcc9ab7c6b6704fd3a5e6e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 14:00:05 +0800 Subject: [PATCH 31/35] =?UTF-8?q?teachers=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_left_subfield_list.html.erb | 2 +- app/views/organizations/_org_teachers_list.html.erb | 6 +++--- app/views/organizations/teachers.html.erb | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 681cd90c8..3fe57d223 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -107,7 +107,7 @@ <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %> <% end %> <% end %> - <% if User.current.logged? and User.current.admin_of_org?(organization) %> + <% if User.current.logged? and User.current.admin_of_org?(organization) && field.field_type != "Comptec" %> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %> <% end %>
    diff --git a/app/views/organizations/_org_teachers_list.html.erb b/app/views/organizations/_org_teachers_list.html.erb index 79634425d..3f8f5af8e 100644 --- a/app/views/organizations/_org_teachers_list.html.erb +++ b/app/views/organizations/_org_teachers_list.html.erb @@ -14,17 +14,17 @@ <%= org_teacher.technical_title %> <% end %>
    -
    <%= @org_count %>
    +
    <%= org_teacher.courses.count %>
    课程数
    -
    <%#= org_student_course_count(org_teacher) %>500
    +
    <%= org_teacher.my_students %>500
    学生数
    -
    <%#= org_teacher_resource_count(org_teacher) %>
    +
    <%= org_teacher_resource_count(org_teacher) %>
    资源数
    diff --git a/app/views/organizations/teachers.html.erb b/app/views/organizations/teachers.html.erb index a7417fa1b..35ba9c8fd 100644 --- a/app/views/organizations/teachers.html.erb +++ b/app/views/organizations/teachers.html.erb @@ -14,7 +14,9 @@ -
    名师列表
    +
    + <%= link_to "名师列表", teachers_organization_path(@organization), :class => "fontGrey" %> +
    From dc92e821a3f63acce61077d8a5869b1329b2e50a Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 13 May 2016 14:08:34 +0800 Subject: [PATCH 32/35] =?UTF-8?q?=E5=90=8D=E5=B8=88=E6=A6=9C=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_org_subfield_rightD.html.erb | 6 +- .../_org_subfield_rightM2.html.erb | 12 +- app/views/organizations/teachers.html.erb | 2 +- db/schema.rb | 408 +----------------- public/stylesheets/org.css | 2 +- public/stylesheets/org2.css | 1 + 6 files changed, 20 insertions(+), 411 deletions(-) diff --git a/app/views/organizations/_org_subfield_rightD.html.erb b/app/views/organizations/_org_subfield_rightD.html.erb index 398f679e1..2953d1a0a 100644 --- a/app/views/organizations/_org_subfield_rightD.html.erb +++ b/app/views/organizations/_org_subfield_rightD.html.erb @@ -10,7 +10,7 @@ <% org_acts = get_subfield_acts field %> <% unless org_acts.blank? %> <% activity = org_acts.first %> -
    +
    <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> <% document = activity.org_act %> <% org_subfield_id = params[:org_subfield_id] %> @@ -52,13 +52,13 @@ <% end %>
    <% else %> -
    +
    <% end %> <% elsif field.field_type == "Resource" %> <% org_attachs = get_attach_org2(field) %> -
    +
    <% if !field.subfield_subdomain_dir.nil? %> <% if !request.local? and Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 and Secdomain.where("sub_type=2 and pid=?", @organization.id).map(&:subname).include?(request.subdomain) %> <%= link_to image_tag("/images/default_blank/right-03.jpg", :width => "369", :height => "169"), show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :target => "_blank" %> diff --git a/app/views/organizations/_org_subfield_rightM2.html.erb b/app/views/organizations/_org_subfield_rightM2.html.erb index 567df26d9..5c82e52dc 100644 --- a/app/views/organizations/_org_subfield_rightM2.html.erb +++ b/app/views/organizations/_org_subfield_rightM2.html.erb @@ -9,16 +9,20 @@ <%= teacher.my_workplace %>
    <% unless teacher.my_blogs_count == 0 %> - 博客 <%= teacher.my_blogs_count %> + 博客 <%= teacher.my_blogs_count %> <% end %> <% unless teacher.courses.count == 0 %> - 课程 <%= teacher.courses.count %> + 课程 <%= teacher.courses.count %> <% end %> <% unless teacher.my_students == 0 %> - 学生 <%= teacher.my_students %> + 学生 <%= teacher.my_students %> <% end %>
    <% end %> -
    \ No newline at end of file +
    + + \ No newline at end of file diff --git a/app/views/organizations/teachers.html.erb b/app/views/organizations/teachers.html.erb index a7417fa1b..ea9923287 100644 --- a/app/views/organizations/teachers.html.erb +++ b/app/views/organizations/teachers.html.erb @@ -3,7 +3,7 @@ <%= form_tag( url_for(:controller => 'organizations', :action => 'teachers'), :remote => true , :method => 'get', :id => 'resource_search_form') do %> - <%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :style => 'border-style:none', :class => "teacher-search-icon fl" %> + <%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :class => "teacher-search-icon fl" %> <% end %> diff --git a/db/schema.rb b/db/schema.rb index ac18f108b..700d7cb4c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -52,28 +52,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token" add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id" - create_table "application_settings", :force => true do |t| - t.integer "default_projects_limit" - t.boolean "signup_enabled" - t.boolean "signin_enabled" - t.boolean "gravatar_enabled" - t.text "sign_in_text" - t.datetime "created_at" - t.datetime "updated_at" - t.string "home_page_url" - t.integer "default_branch_protection", :default => 2 - t.boolean "twitter_sharing_enabled", :default => true - t.text "restricted_visibility_levels" - t.boolean "version_check_enabled", :default => true - t.integer "max_attachment_size", :default => 10, :null => false - t.integer "default_project_visibility" - t.integer "default_snippet_visibility" - t.text "restricted_signup_domains" - t.boolean "user_oauth_applications", :default => true - t.string "after_sign_out_path" - t.integer "session_expire_delay", :default => 10080, :null => false - end - create_table "applied_projects", :force => true do |t| t.integer "project_id", :null => false t.integer "user_id", :null => false @@ -166,20 +144,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.string "typeName", :limit => 50 end - create_table "audit_events", :force => true do |t| - t.integer "author_id", :null => false - t.string "type", :null => false - t.integer "entity_id", :null => false - t.string "entity_type", :null => false - t.text "details" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "audit_events", ["author_id"], :name => "index_audit_events_on_author_id" - add_index "audit_events", ["entity_id", "entity_type"], :name => "index_audit_events_on_entity_id_and_entity_type" - add_index "audit_events", ["type"], :name => "index_audit_events_on_type" - create_table "auth_sources", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 60, :default => "", :null => false @@ -277,17 +241,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" add_index "boards", ["project_id"], :name => "boards_project_id" - create_table "broadcast_messages", :force => true do |t| - t.text "message", :null => false - t.datetime "starts_at" - t.datetime "ends_at" - t.integer "alert_type" - t.datetime "created_at" - t.datetime "updated_at" - t.string "color" - t.string "font" - end - create_table "bug_to_osps", :force => true do |t| t.integer "osp_id" t.integer "relative_memo_id" @@ -587,10 +540,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.integer "visits", :default => 0 end - add_index "courses", ["id"], :name => "id", :unique => true - add_index "courses", ["tea_id"], :name => "tea_id" - add_index "courses", ["visits"], :name => "visits" - create_table "custom_fields", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 30, :default => "", :null => false @@ -652,15 +601,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "deploy_keys_projects", :force => true do |t| - t.integer "deploy_key_id", :null => false - t.integer "project_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "deploy_keys_projects", ["project_id"], :name => "index_deploy_keys_projects_on_project_id" - create_table "discuss_demos", :force => true do |t| t.string "title" t.text "body" @@ -710,16 +650,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.datetime "created_at" end - create_table "emails", :force => true do |t| - t.integer "user_id", :null => false - t.string "email", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "emails", ["email"], :name => "index_emails_on_email", :unique => true - add_index "emails", ["user_id"], :name => "index_emails_on_user_id" - create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -742,25 +672,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" - create_table "events", :force => true do |t| - t.string "target_type" - t.integer "target_id" - t.string "title" - t.text "data" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "action" - t.integer "author_id" - end - - add_index "events", ["action"], :name => "index_events_on_action" - add_index "events", ["author_id"], :name => "index_events_on_author_id" - add_index "events", ["created_at"], :name => "index_events_on_created_at" - add_index "events", ["project_id"], :name => "index_events_on_project_id" - add_index "events", ["target_id"], :name => "index_events_on_target_id" - add_index "events", ["target_type"], :name => "index_events_on_target_type" - create_table "exercise_answers", :force => true do |t| t.integer "user_id" t.integer "exercise_question_id" @@ -863,15 +774,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type" add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at" - create_table "forked_project_links", :force => true do |t| - t.integer "forked_to_project_id", :null => false - t.integer "forked_from_project_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "forked_project_links", ["forked_to_project_id"], :name => "index_forked_project_links_on_forked_to_project_id", :unique => true - create_table "forums", :force => true do |t| t.string "name", :null => false t.text "description" @@ -1001,17 +903,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.datetime "updated_at", :null => false end - create_table "identities", :force => true do |t| - t.string "extern_uid" - t.string "provider" - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "identities", ["created_at", "id"], :name => "index_identities_on_created_at_and_id" - add_index "identities", ["user_id"], :name => "index_identities_on_user_id" - create_table "invite_lists", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1155,20 +1046,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.integer "private", :default => 0 end - create_table "keys", :force => true do |t| - t.integer "user_id" - t.datetime "created_at" - t.datetime "updated_at" - t.text "key" - t.string "title" - t.string "type" - t.string "fingerprint" - t.boolean "public", :default => false, :null => false - end - - add_index "keys", ["created_at", "id"], :name => "index_keys_on_created_at_and_id" - add_index "keys", ["user_id"], :name => "index_keys_on_user_id" - create_table "kindeditor_assets", :force => true do |t| t.string "asset" t.integer "file_size" @@ -1180,27 +1057,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.integer "owner_type", :default => 0 end - create_table "label_links", :force => true do |t| - t.integer "label_id" - t.integer "target_id" - t.string "target_type" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "label_links", ["label_id"], :name => "index_label_links_on_label_id" - add_index "label_links", ["target_id", "target_type"], :name => "index_label_links_on_target_id_and_target_type" - - create_table "labels", :force => true do |t| - t.string "title" - t.string "color" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "labels", ["project_id"], :name => "index_labels_on_project_id" - create_table "member_roles", :force => true do |t| t.integer "member_id", :null => false t.integer "role_id", :null => false @@ -1251,47 +1107,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.integer "viewed_count", :default => 0 end - create_table "merge_request_diffs", :force => true do |t| - t.string "state" - t.text "st_commits", :limit => 2147483647 - t.text "st_diffs", :limit => 2147483647 - t.integer "merge_request_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "merge_request_diffs", ["merge_request_id"], :name => "index_merge_request_diffs_on_merge_request_id", :unique => true - - create_table "merge_requests", :force => true do |t| - t.string "target_branch", :null => false - t.string "source_branch", :null => false - t.integer "source_project_id", :null => false - t.integer "author_id" - t.integer "assignee_id" - t.string "title" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "milestone_id" - t.string "state" - t.string "merge_status" - t.integer "target_project_id", :null => false - t.integer "iid" - t.text "description" - t.integer "position", :default => 0 - t.datetime "locked_at" - end - - add_index "merge_requests", ["assignee_id"], :name => "index_merge_requests_on_assignee_id" - add_index "merge_requests", ["author_id"], :name => "index_merge_requests_on_author_id" - add_index "merge_requests", ["created_at", "id"], :name => "index_merge_requests_on_created_at_and_id" - add_index "merge_requests", ["created_at"], :name => "index_merge_requests_on_created_at" - add_index "merge_requests", ["milestone_id"], :name => "index_merge_requests_on_milestone_id" - add_index "merge_requests", ["source_branch"], :name => "index_merge_requests_on_source_branch" - add_index "merge_requests", ["source_project_id"], :name => "index_merge_requests_on_source_project_id" - add_index "merge_requests", ["target_branch"], :name => "index_merge_requests_on_target_branch" - add_index "merge_requests", ["target_project_id", "iid"], :name => "index_merge_requests_on_target_project_id_and_iid", :unique => true - add_index "merge_requests", ["title"], :name => "index_merge_requests_on_title" - create_table "message_alls", :force => true do |t| t.integer "user_id" t.integer "message_id" @@ -1326,39 +1141,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" - create_table "milestones", :force => true do |t| - t.string "title", :null => false - t.integer "project_id", :null => false - t.text "description" - t.date "due_date" - t.datetime "created_at" - t.datetime "updated_at" - t.string "state" - t.integer "iid" - end - - add_index "milestones", ["created_at", "id"], :name => "index_milestones_on_created_at_and_id" - add_index "milestones", ["due_date"], :name => "index_milestones_on_due_date" - add_index "milestones", ["project_id", "iid"], :name => "index_milestones_on_project_id_and_iid", :unique => true - add_index "milestones", ["project_id"], :name => "index_milestones_on_project_id" - - create_table "namespaces", :force => true do |t| - t.string "name", :null => false - t.string "path", :null => false - t.integer "owner_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "type" - t.string "description", :default => "", :null => false - t.string "avatar" - end - - add_index "namespaces", ["created_at", "id"], :name => "index_namespaces_on_created_at_and_id" - add_index "namespaces", ["name"], :name => "index_namespaces_on_name", :unique => true - add_index "namespaces", ["owner_id"], :name => "index_namespaces_on_owner_id" - add_index "namespaces", ["path"], :name => "index_namespaces_on_path", :unique => true - add_index "namespaces", ["type"], :name => "index_namespaces_on_type" - create_table "news", :force => true do |t| t.integer "project_id" t.string "title", :limit => 60, :default => "", :null => false @@ -1384,31 +1166,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.datetime "updated_at", :null => false end - create_table "notes", :force => true do |t| - t.text "note" - t.string "noteable_type" - t.integer "author_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "project_id" - t.string "attachment" - t.string "line_code" - t.string "commit_id" - t.integer "noteable_id" - t.boolean "system", :default => false, :null => false - t.text "st_diff", :limit => 2147483647 - end - - add_index "notes", ["author_id"], :name => "index_notes_on_author_id" - add_index "notes", ["commit_id"], :name => "index_notes_on_commit_id" - add_index "notes", ["created_at", "id"], :name => "index_notes_on_created_at_and_id" - add_index "notes", ["created_at"], :name => "index_notes_on_created_at" - add_index "notes", ["noteable_id", "noteable_type"], :name => "index_notes_on_noteable_id_and_noteable_type" - add_index "notes", ["noteable_type"], :name => "index_notes_on_noteable_type" - add_index "notes", ["project_id", "noteable_type"], :name => "index_notes_on_project_id_and_noteable_type" - add_index "notes", ["project_id"], :name => "index_notes_on_project_id" - add_index "notes", ["updated_at"], :name => "index_notes_on_updated_at" - create_table "notificationcomments", :force => true do |t| t.string "notificationcommented_type" t.integer "notificationcommented_id" @@ -1418,49 +1175,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.datetime "updated_at", :null => false end - create_table "oauth_access_grants", :force => true do |t| - t.integer "resource_owner_id", :null => false - t.integer "application_id", :null => false - t.string "token", :null => false - t.integer "expires_in", :null => false - t.text "redirect_uri", :null => false - t.datetime "created_at", :null => false - t.datetime "revoked_at" - t.string "scopes" - end - - add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true - - create_table "oauth_access_tokens", :force => true do |t| - t.integer "resource_owner_id" - t.integer "application_id" - t.string "token", :null => false - t.string "refresh_token" - t.integer "expires_in" - t.datetime "revoked_at" - t.datetime "created_at", :null => false - t.string "scopes" - end - - add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true - add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id" - add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true - - create_table "oauth_applications", :force => true do |t| - t.string "name", :null => false - t.string "uid", :null => false - t.string "secret", :null => false - t.text "redirect_uri", :null => false - t.string "scopes", :default => "", :null => false - t.datetime "created_at" - t.datetime "updated_at" - t.integer "owner_id" - t.string "owner_type" - end - - add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type" - add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true - create_table "onclick_times", :force => true do |t| t.integer "user_id" t.datetime "onclick_time" @@ -1617,23 +1331,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.integer "allow_teacher", :default => 0 end - create_table "permissions", :force => true do |t| - t.string "controller", :limit => 30, :default => "", :null => false - t.string "action", :limit => 30, :default => "", :null => false - t.string "description", :limit => 60, :default => "", :null => false - t.boolean "is_public", :default => false, :null => false - t.integer "sort", :default => 0, :null => false - t.boolean "mail_option", :default => false, :null => false - t.boolean "mail_enabled", :default => false, :null => false - end - - create_table "permissions_roles", :id => false, :force => true do |t| - t.integer "permission_id", :default => 0, :null => false - t.integer "role_id", :default => 0, :null => false - end - - add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id" - create_table "phone_app_versions", :force => true do |t| t.string "version" t.text "description" @@ -1716,11 +1413,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.datetime "updated_at", :null => false end - create_table "project_import_data", :force => true do |t| - t.integer "project_id" - t.text "data" - end - create_table "project_infos", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1810,16 +1502,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" - create_table "protected_branches", :force => true do |t| - t.integer "project_id", :null => false - t.string "name", :null => false - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "developers_can_push", :default => false, :null => false - end - - add_index "protected_branches", ["project_id"], :name => "index_protected_branches_on_project_id" - create_table "queries", :force => true do |t| t.integer "project_id" t.string "name", :default => "", :null => false @@ -1954,25 +1636,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.integer "is_teacher_score", :default => 0 end - create_table "services", :force => true do |t| - t.string "type" - t.string "title" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "active", :default => false, :null => false - t.text "properties" - t.boolean "template", :default => false - t.boolean "push_events", :default => true - t.boolean "issues_events", :default => true - t.boolean "merge_requests_events", :default => true - t.boolean "tag_push_events", :default => true - t.boolean "note_events", :default => true, :null => false - end - - add_index "services", ["created_at", "id"], :name => "index_services_on_created_at_and_id" - add_index "services", ["project_id"], :name => "index_services_on_project_id" - create_table "settings", :force => true do |t| t.string "name", :default => "", :null => false t.text "value" @@ -2011,26 +1674,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.datetime "updated_at", :null => false end - create_table "snippets", :force => true do |t| - t.string "title" - t.text "content", :limit => 2147483647 - t.integer "author_id", :null => false - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "file_name" - t.datetime "expires_at" - t.string "type" - t.integer "visibility_level", :default => 0, :null => false - end - - add_index "snippets", ["author_id"], :name => "index_snippets_on_author_id" - add_index "snippets", ["created_at", "id"], :name => "index_snippets_on_created_at_and_id" - add_index "snippets", ["created_at"], :name => "index_snippets_on_created_at" - add_index "snippets", ["expires_at"], :name => "index_snippets_on_expires_at" - add_index "snippets", ["project_id"], :name => "index_snippets_on_project_id" - add_index "snippets", ["visibility_level"], :name => "index_snippets_on_visibility_level" - create_table "softapplications", :force => true do |t| t.string "name" t.text "description" @@ -2103,9 +1746,9 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.integer "absence_penalty", :default => 0 t.float "system_score", :default => 0.0 t.boolean "is_test", :default => false - t.float "work_score" t.integer "simi_id" t.integer "simi_value" + t.float "work_score" end add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" @@ -2153,13 +1796,13 @@ ActiveRecord::Schema.define(:version => 20160513021204) do create_table "sub_domains", :force => true do |t| t.integer "org_subfield_id" - t.integer "priority" + t.integer "priority", :default => 0 t.string "name" t.string "field_type" - t.integer "hide" - t.integer "status" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "hide", :default => 0 + t.integer "status", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "subfield_subdomain_dirs", :force => true do |t| @@ -2169,17 +1812,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.datetime "updated_at", :null => false end - create_table "subscriptions", :force => true do |t| - t.integer "user_id" - t.integer "subscribable_id" - t.string "subscribable_type" - t.boolean "subscribed" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "subscriptions", ["subscribable_id", "subscribable_type", "user_id"], :name => "subscriptions_user_id_and_ref_fields", :unique => true - create_table "system_messages", :force => true do |t| t.integer "user_id" t.string "content" @@ -2419,17 +2051,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do add_index "users", ["id", "type"], :name => "index_users_on_id_and_type" add_index "users", ["type"], :name => "index_users_on_type" - create_table "users_star_projects", :force => true do |t| - t.integer "project_id", :null => false - t.integer "user_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "users_star_projects", ["project_id"], :name => "index_users_star_projects_on_project_id" - add_index "users_star_projects", ["user_id", "project_id"], :name => "index_users_star_projects_on_user_id_and_project_id", :unique => true - add_index "users_star_projects", ["user_id"], :name => "index_users_star_projects_on_user_id" - create_table "versions", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "name", :default => "", :null => false @@ -2481,23 +2102,6 @@ ActiveRecord::Schema.define(:version => 20160513021204) do t.datetime "updated_at", :null => false end - create_table "web_hooks", :force => true do |t| - t.string "url" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.string "type", :default => "ProjectHook" - t.integer "service_id" - t.boolean "push_events", :default => true, :null => false - t.boolean "issues_events", :default => false, :null => false - t.boolean "merge_requests_events", :default => false, :null => false - t.boolean "tag_push_events", :default => false - t.boolean "note_events", :default => false, :null => false - end - - add_index "web_hooks", ["created_at", "id"], :name => "index_web_hooks_on_created_at_and_id" - add_index "web_hooks", ["project_id"], :name => "index_web_hooks_on_project_id" - create_table "wechat_logs", :force => true do |t| t.string "openid", :null => false t.text "request_raw" diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index 76309217d..abfeaef85 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -164,7 +164,7 @@ a.blue-btn { /*名师榜20160505*/ .function-row {border-bottom:1px dashed #b2b2b2; padding-bottom:16px;} .teacher-list-search {width:310px; height:23px; border:1px solid #ccc; border-right:none; outline:none;} -.teacher-search-icon {background:url(../images/search.png) 0 3px no-repeat; width:25px; height:23px; border:1px solid #ccc; border-left:none;} +.teacher-search-icon {background:url(../images/search.png) 0 3px no-repeat; width:25px; height:25px; border:1px solid #ccc; border-left:none; cursor:pointer;} .teacher-search-type {width:84px; height:23px; border:1px solid #ccc; outline:none;} .teacher-list-row {border-bottom:1px dashed #b2b2b2; padding:18px 0;} .teacher-avatar {float:left;} diff --git a/public/stylesheets/org2.css b/public/stylesheets/org2.css index c26d9498b..0ea602976 100644 --- a/public/stylesheets/org2.css +++ b/public/stylesheets/org2.css @@ -48,6 +48,7 @@ a.sn-link-select {color:#809df9;} .sn-mt13 {margin-top:13px;} .sn-mt15 {margin-top:15px;} .sn-mt28 {margin-top:28px;} +.sn-mb20 {margin-bottom:20px;} .sn-mb40 {margin-bottom:40px;} .sn-ml15 {margin-left:15px;} .sn-ml20 {margin-left:20px;} From 0feb1280fd0f2dcf1a0e866c4784f171390ec8f2 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 14:23:36 +0800 Subject: [PATCH 33/35] =?UTF-8?q?=E5=90=8D=E5=B8=88=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E5=88=97=E8=A1=A8=20=E5=8F=8A=E7=9B=B8=E5=85=B3=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 7 +++++++ app/views/organizations/_org_subfield_rightM2.html.erb | 4 +++- app/views/organizations/_org_teachers_list.html.erb | 2 +- app/views/organizations/teachers.html.erb | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 98483bb64..4747469cf 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -159,6 +159,10 @@ class OrganizationsController < ApplicationController end def teachers + unless @organization.allow_set_teachers + render_403 + return + end q = params[:search].nil? ? "" : "#{params[:search].strip}" if params[:type] == "courses" || params[:type].nil? @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count @@ -169,6 +173,9 @@ class OrganizationsController < ApplicationController elsif params[:type] == "resources" @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from attachments where attachments.author_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") + elsif params[:type] == "famous" + @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count + from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") end limit = 10 # @is_remote = true diff --git a/app/views/organizations/_org_subfield_rightM2.html.erb b/app/views/organizations/_org_subfield_rightM2.html.erb index 567df26d9..17a485583 100644 --- a/app/views/organizations/_org_subfield_rightM2.html.erb +++ b/app/views/organizations/_org_subfield_rightM2.html.erb @@ -1,5 +1,7 @@
    -

    名师风采更多

    +

    <%= field.name %> + <%= link_to "更多", teachers_organization_path(@organization, :type => "famous"), :target => "_blank", :class => "more" %> +

    <% excellent_teachers.each do |teacher| %>
    <%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sn-fl", :style => "display:block;"), user_path(teacher), :alt => "用户头像", :target => '_blank' %> diff --git a/app/views/organizations/_org_teachers_list.html.erb b/app/views/organizations/_org_teachers_list.html.erb index 3f8f5af8e..e24f53862 100644 --- a/app/views/organizations/_org_teachers_list.html.erb +++ b/app/views/organizations/_org_teachers_list.html.erb @@ -19,7 +19,7 @@
    -
    <%= org_teacher.my_students %>500
    +
    <%= org_teacher.my_students %>
    学生数
    diff --git a/app/views/organizations/teachers.html.erb b/app/views/organizations/teachers.html.erb index 35ba9c8fd..54a869221 100644 --- a/app/views/organizations/teachers.html.erb +++ b/app/views/organizations/teachers.html.erb @@ -15,7 +15,7 @@
    - <%= link_to "名师列表", teachers_organization_path(@organization), :class => "fontGrey" %> + <%= link_to "名师列表", teachers_organization_path(@organization, :type => "famous"), :class => "fontGrey" %>
    From 660cf7ef73d704aa81512d0c0c036b089beb177c Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 13 May 2016 14:52:33 +0800 Subject: [PATCH 34/35] =?UTF-8?q?=E5=90=8D=E5=B8=88=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=B1=80=E9=83=A8=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 9 +++++---- app/views/organizations/_org_teachers_list.html.erb | 2 +- app/views/organizations/teachers.html.erb | 4 ++-- app/views/organizations/teachers.js.erb | 5 +++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 4747469cf..b48488fb8 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -164,16 +164,17 @@ class OrganizationsController < ApplicationController return end q = params[:search].nil? ? "" : "#{params[:search].strip}" - if params[:type] == "courses" || params[:type].nil? + @type = params[:type] + if @type == "courses" || @type.nil? @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") - elsif params[:type] == "students" + elsif @type == "students" @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") - elsif params[:type] == "resources" + elsif @type == "resources" @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from attachments where attachments.author_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") - elsif params[:type] == "famous" + elsif @type == "famous" @org_teachers = User.find_by_sql("select u.*, ue.technical_title, ue.school_id,(select count(*) from courses where courses.tea_id = u.id) as course_count from users u, user_extensions ue where u.id = ue.user_id and ue.identity=0 and u.excellent_teacher =1 and concat(lastname,firstname,login) like '%#{q}%' order by course_count desc") end diff --git a/app/views/organizations/_org_teachers_list.html.erb b/app/views/organizations/_org_teachers_list.html.erb index e24f53862..702675464 100644 --- a/app/views/organizations/_org_teachers_list.html.erb +++ b/app/views/organizations/_org_teachers_list.html.erb @@ -1,4 +1,4 @@ -<% @org_teachers.each do |org_teacher| %> +<% org_teachers.each do |org_teacher| %> <% school = School.where("id =?", org_teacher.school_id).first %>
    diff --git a/app/views/organizations/teachers.html.erb b/app/views/organizations/teachers.html.erb index 42dac9070..b3e311ade 100644 --- a/app/views/organizations/teachers.html.erb +++ b/app/views/organizations/teachers.html.erb @@ -1,6 +1,6 @@
    -
    - <%= form_tag( url_for(:controller => 'organizations', :action => 'teachers'), +
    -
    <%= org_teacher.try(:realname).nil? ? org_teacher.try(:login) : org_teacher.try(:realname) %> +
    <%=link_to org_teacher.try(:realname).nil? ? org_teacher.try(:login) : org_teacher.try(:realname), user_url_in_org(org_teacher) %> <% unless school.nil? %> <%= school.name %> <% end %> @@ -28,12 +28,15 @@
    资源数
    - <% if User.current.admin? %> + <% if User.current.admin_of_org?(@organization) %> <%= org_teacher.excellent_teacher==0?"设为名师":"取消设置" %> <% else %> - <%= render :partial => 'layouts/user_watch_btn', :locals => {:target => org_teacher} %> - 关注 + + + + + <% end %>