From bd4ea6a19902b9b248d235247333263cecbf08b8 Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Thu, 26 Nov 2015 09:13:41 +0800 Subject: [PATCH 001/111] just test tag1 --- tag1.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 tag1.txt diff --git a/tag1.txt b/tag1.txt new file mode 100644 index 000000000..391fb7fb3 --- /dev/null +++ b/tag1.txt @@ -0,0 +1 @@ +just test \ No newline at end of file From 580cc6b8d8160b969103859078617139de5075b1 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 27 Nov 2015 16:14:42 +0800 Subject: [PATCH 002/111] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/schema.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/schema.rb b/db/schema.rb index 8e2082b37..504052365 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1151,6 +1151,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do create_table "org_members", :force => true do |t| t.integer "user_id" t.integer "organization_id" + t.string "role" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false end From 879dee0cd6f4ee97b8f43fa6429a991bc187e73d Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 27 Nov 2015 17:27:55 +0800 Subject: [PATCH 003/111] =?UTF-8?q?=E5=85=B3=E9=97=AD=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=85=B3=E8=81=94=E9=A1=B9=E7=9B=AE=E6=88=96=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=EF=BC=8C=E5=88=B7=E6=96=B0=E6=95=B4=E4=B8=AA?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_join_course_menu.html.erb | 1 + app/views/organizations/_join_project_menu.html.erb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/organizations/_join_course_menu.html.erb b/app/views/organizations/_join_course_menu.html.erb index e66d0bcce..d875550de 100644 --- a/app/views/organizations/_join_course_menu.html.erb +++ b/app/views/organizations/_join_course_menu.html.erb @@ -13,6 +13,7 @@ $(".resourcePopupClose").click(function(){ + location.reload(); $(".resourceSharePopup").css("display","none"); }); }); diff --git a/app/views/organizations/_join_project_menu.html.erb b/app/views/organizations/_join_project_menu.html.erb index 765b4b23a..e13e1416e 100644 --- a/app/views/organizations/_join_project_menu.html.erb +++ b/app/views/organizations/_join_project_menu.html.erb @@ -13,6 +13,7 @@ $(".resourcePopupClose").click(function(){ + location.reload(); $(".resourceSharePopup").css("display","none"); }); }); From 3516cde5553c138c43f5e376e6f3f0602eaf1404 Mon Sep 17 00:00:00 2001 From: "Gan Yi.ang" Date: Sat, 28 Nov 2015 10:25:53 +0800 Subject: [PATCH 004/111] =?UTF-8?q?sync=5Fgitlab=5Fuser=E5=8A=A0=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/sync_gitlab_user.rake | 39 ++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/lib/tasks/sync_gitlab_user.rake b/lib/tasks/sync_gitlab_user.rake index fb84f5f08..9259353c0 100644 --- a/lib/tasks/sync_gitlab_user.rake +++ b/lib/tasks/sync_gitlab_user.rake @@ -6,32 +6,55 @@ namespace :gitlab do users = User.find_by_sql("select * from users where gid is null") s = Trustie::Gitlab::Sync.new g = Gitlab.client - logger = Logger.new('./log/add_gid.log', 'daily') #按天生成 + logger_i = Logger.new('./log/task_add_gid.log', 'daily') + logger_e = Logger.new('./log/task_add_gid_error.log', 'daily') + NAMESPACE_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'.freeze + MAIL_REGEX_STR ='^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$'.freeze + error_cnt=0 + success_cnt=0 + p "同步Gitlab用户开始..." users.each do |user| + info="userid=#{user.id},mail=#{user.mail},login(username)=#{user.login},name=#{user.show_name}" + # username不能有特殊字符,不能有保留字符,邮箱特殊字符(比如‘>’)导致search失败的,name不能为空串 + if !(user.login =~ /\A#{NAMESPACE_REGEX_STR}\Z/.freeze) + logger_e.error("#{info},error=校验失败:username特殊字符") + error_cnt+=1 + next + elsif !(user.mail.downcase =~ /#{MAIL_REGEX_STR}/) + logger_e.error("#{info},error=校验失败:邮箱特殊字符") + error_cnt+=1 + next + elsif user.show_name.lstrip.rstrip.blank? + logger_e.error("#{info},error=校验失败:name不正常") + error_cnt+=1 + next + end begin us = g.get("/users?search=#{user.mail}") - puts user.mail if us.blank? - puts "55555555555555555" s.sync_user(user) + logger_i.info("sync_remote_user:id=#{user.id},mail=#{user.mail}") + success_cnt+=1 else - # 解决查询的时候出现多值的情况,比如:123@163.com和g123@163.com - puts "66666666666666666666" - puts user.id if Array === us us.each do |u| if u.email == user.mail user.gid = u.id - user.save + # !爆炸方法抛出异常 + user.save! + logger_i.info("sync_local_user:#{info}") + success_cnt+=1 end end end end rescue => e - logger.error("userid=#{user.id},mail=#{user.mail},login=#{user.login},error=#{e}") + logger_e.error("#{info},error=#{e}") puts e end end + p "同步Gitlab用户结束..." + p "同步成功#{success_cnt},未完成#{error_cnt}" end task :sync_members => :environment do From 6f9c89d67b7c88b82b8ae5414bd53406df426e65 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 30 Nov 2015 16:04:43 +0800 Subject: [PATCH 005/111] =?UTF-8?q?1.=E6=9B=B4=E6=94=B9=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E5=86=85=E5=AE=B9=EF=BC=8C=E4=B8=8D=E6=98=BE=E7=A4=BA=E4=BD=9C?= =?UTF-8?q?=E8=80=85=E7=AD=89=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E9=A6=96=E9=A1=B5=E3=80=81=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E3=80=81=E5=88=A0=E9=99=A4=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E7=AD=89=E5=8A=9F=E8=83=BD=EF=BC=9B=202.=E5=A2=9E=E5=8A=A0edit?= =?UTF-8?q?or=5Fof=5Fdocuments=E8=A1=A8=EF=BC=8C=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E7=BC=96=E8=BE=91=E7=9A=84=E4=BD=9C=E8=80=85?= =?UTF-8?q?=E3=80=81=E6=97=B6=E9=97=B4=E7=AD=89=EF=BC=8C=E5=B9=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=A6=96=E9=A1=B5=E7=9A=84=E6=9C=80=E5=90=8E=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E4=BA=BA=EF=BC=9B=203.=E5=9C=A8=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=96=87=E7=AB=A0=E5=90=8E=EF=BC=8C=E5=BA=94?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E9=A6=96=E9=A1=B5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org_document_comments_controller.rb | 15 ++-- app/controllers/organizations_controller.rb | 6 ++ app/models/editor_of_document.rb | 4 ++ app/models/org_document_comment.rb | 2 +- .../org_document_comments/index.html.erb | 2 +- app/views/org_document_comments/show.html.erb | 2 +- .../organizations/_org_activities.html.erb | 2 +- .../organizations/_show_home_page.html.erb | 69 +++++++++++++++++++ .../organizations/_show_org_document.html.erb | 10 +-- .../organizations/cancel_homepage.js.erb | 1 + app/views/organizations/show.html.erb | 4 +- config/routes.rb | 1 + ...20151130032658_create_org_docume_editor.rb | 12 ++++ ...ument_created_at_for_editor_of_document.rb | 12 ++++ 14 files changed, 124 insertions(+), 18 deletions(-) create mode 100644 app/models/editor_of_document.rb create mode 100644 app/views/organizations/_show_home_page.html.erb create mode 100644 app/views/organizations/cancel_homepage.js.erb create mode 100644 db/migrate/20151130032658_create_org_docume_editor.rb create mode 100644 db/migrate/20151130064556_copy_document_created_at_for_editor_of_document.rb diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index 02527bdfc..29b728268 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -13,7 +13,7 @@ class OrgDocumentCommentsController < ApplicationController @org_document_comment.content = params[:org_document_comment][:content] if @org_document_comment.save flash.keep[:notice] = l(:notice_successful_create) - OrgActivity + EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document_comment.id, :created_at => @org_document_comment.updated_at) redirect_to organization_org_document_comments_path(@organization) else redirect_to new_org_document_comment_path(:organization_id => @organization.id) @@ -36,13 +36,18 @@ class OrgDocumentCommentsController < ApplicationController if @org_document.parent.nil? act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", @org_document.id).first act.update_attributes(:updated_at => @org_document.updated_at) + EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document.id, :created_at => Time.now) end respond_to do |format| format.html { if params[:flag].to_i == 0 redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id) else - redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id) + if params[:flag].to_i == 1 + redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id) + else + redirect_to organization_path(@org_document.organization.id) + end end } end @@ -81,10 +86,10 @@ class OrgDocumentCommentsController < ApplicationController def destroy @org_document_comment = OrgDocumentComment.find(params[:id]) org = @org_document_comment.organization + if @org_document_comment.id == org.home_id + org.update_attributes(:home_id => nil) + end if @org_document_comment.destroy - if @org_document_comment.id == org.id - org.home_id == nil - end end respond_to do |format| format.js diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index b326051e6..70ac952ea 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -142,6 +142,12 @@ class OrganizationsController < ApplicationController # end end + def cancel_homepage + @org = Organization.find(params[:id]) + @org.home_id = nil + @org.save + end + def autocomplete_search @project = Project.find(params[:project_id]) #@flag = params[:flag] || false diff --git a/app/models/editor_of_document.rb b/app/models/editor_of_document.rb new file mode 100644 index 000000000..15d9e7e37 --- /dev/null +++ b/app/models/editor_of_document.rb @@ -0,0 +1,4 @@ +class EditorOfDocument < ActiveRecord::Base + belongs_to :user, :class_name => 'User', :foreign_key => 'editor_id' + belongs_to :org_document_comment +end \ No newline at end of file diff --git a/app/models/org_document_comment.rb b/app/models/org_document_comment.rb index 7b9f9cd75..e2ce350ce 100644 --- a/app/models/org_document_comment.rb +++ b/app/models/org_document_comment.rb @@ -3,7 +3,7 @@ class OrgDocumentComment < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :organization belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id' - + has_many :editor_of_documents, :dependent => :destroy acts_as_tree :order => "#{OrgDocumentComment.table_name}.sticky asc, #{OrgDocumentComment.table_name}.created_at desc" has_many :org_acts, :class_name => 'OrgActivity',:as =>:org_act ,:dependent => :destroy after_create :document_save_as_org_activity diff --git a/app/views/org_document_comments/index.html.erb b/app/views/org_document_comments/index.html.erb index d967c42fd..9a9f74ac6 100644 --- a/app/views/org_document_comments/index.html.erb +++ b/app/views/org_document_comments/index.html.erb @@ -19,6 +19,6 @@ init_activity_KindEditor_data(<%= OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first.id %>, null, "87%"); }); - <%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first} %> + <%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> <% end %> <% end %> \ No newline at end of file diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index 31e4f7e05..7655f996e 100644 --- a/app/views/org_document_comments/show.html.erb +++ b/app/views/org_document_comments/show.html.erb @@ -25,7 +25,7 @@
发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %>
<% unless @document.content.blank? %> -
+
<%= @document.content.html_safe %>
<% end %> diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index 33ac13e76..60238091f 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -22,7 +22,7 @@
<% end %> <% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %> - <%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act} %> + <%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act, :flag => 2} %> <% end %> <% end %> <% if act.container_type == 'Project' %> diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb new file mode 100644 index 000000000..ade3f7ba8 --- /dev/null +++ b/app/views/organizations/_show_home_page.html.erb @@ -0,0 +1,69 @@ +
+
+ +
+ +
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
+ + <% unless document.content.blank? %> +
+ <%= document.content.html_safe %> +
+ <% end %> +
+ 发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %> +
+
+
+ 最后编辑:<%= User.find(EditorOfDocument.where("org_document_comment_id =?", document.id).order("created_at desc").first.editor_id).realname %> +
+ + <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %> +
+
    +
  • +
      +
    • + <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'cancel_homepage', :id => document.organization_id, :home_id => document.id}, :method => "put", :remote => true) do |f| %> + 取消首页 + <% end %> +
    • +
    • + <%= link_to "编辑首页", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => 2), :class => "postOptionLink" %> +
    • +
    • + <%= link_to "删除首页", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete', + :data => {:confirm => l(:text_are_you_sure)}, + :remote => true, :class => 'postOptionLink' %> +
    • +
    +
  • +
+
+
+ <% end %> +
+
+ +
+ + \ No newline at end of file diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 888cbbf68..4d1393897 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -8,24 +8,20 @@ <%= link_to User.find(document.creator_id), user_path(document.creator.id), :class => "newsBlue mr15" %> TO  <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %> | - <% if document.organization.home_id == document.id %> - 首页 - <% else %> 组织文章 - <% end %>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
<% unless document.content.blank? %> -
+
<%= document.content.html_safe %>
<% end %> - <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %> + <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id)) || User.current.id == document.creator_id %>
  • @@ -36,7 +32,7 @@ <% end %>
  • - <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => 0), :class => "postOptionLink" %> + <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => flag), :class => "postOptionLink" %>
  • <%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete', diff --git a/app/views/organizations/cancel_homepage.js.erb b/app/views/organizations/cancel_homepage.js.erb new file mode 100644 index 000000000..bf9eb798c --- /dev/null +++ b/app/views/organizations/cancel_homepage.js.erb @@ -0,0 +1 @@ +window.location.href = "<%= organization_path(@org) %>"; \ No newline at end of file diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index e44e0778d..9e0fc365c 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -52,14 +52,14 @@
-<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %> +<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %> <% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %> - <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %> + <%= 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', diff --git a/config/routes.rb b/config/routes.rb index d12a38425..bb6d7b940 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -36,6 +36,7 @@ RedmineApp::Application.routes.draw do get 'setting'#, :action => 'settings', :as => 'settings' get 'clear_org_avatar_temp' put 'set_homepage' + put 'cancel_homepage' get 'members' get 'more_org_projects' get 'more_org_courses' diff --git a/db/migrate/20151130032658_create_org_docume_editor.rb b/db/migrate/20151130032658_create_org_docume_editor.rb new file mode 100644 index 000000000..0dc9857ba --- /dev/null +++ b/db/migrate/20151130032658_create_org_docume_editor.rb @@ -0,0 +1,12 @@ +class CreateOrgDocumeEditor < ActiveRecord::Migration + def up + create_table :editor_of_documents do |t| + t.integer :editor_id + t.integer :org_document_comment_id + t.timestamp :created_at + end + end + + def down + end +end diff --git a/db/migrate/20151130064556_copy_document_created_at_for_editor_of_document.rb b/db/migrate/20151130064556_copy_document_created_at_for_editor_of_document.rb new file mode 100644 index 000000000..2361db3dd --- /dev/null +++ b/db/migrate/20151130064556_copy_document_created_at_for_editor_of_document.rb @@ -0,0 +1,12 @@ +class CopyDocumentCreatedAtForEditorOfDocument < ActiveRecord::Migration + def up + OrgDocumentComment.all.each do |doc| + if doc.parent.nil? + EditorOfDocument.create(:editor_id => doc.creator_id, :org_document_comment_id => doc.id, :created_at => doc.updated_at) + end + end + end + + def down + end +end From 3750a49b6541b4201146129f905a2b66d36f6392 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 30 Nov 2015 16:10:29 +0800 Subject: [PATCH 006/111] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=B8=8B=E6=8B=89=E6=A1=86=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_show_home_page.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index ade3f7ba8..3628b4929 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -20,7 +20,7 @@ - <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %> + <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id)) || User.current.id == document.creator_id %>
  • From 0aba11f175e767f186890f7ec5bcc9c3f0f02b79 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 1 Dec 2015 11:28:33 +0800 Subject: [PATCH 007/111] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=9C=A8360=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=BC=E5=AE=B9=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/setting.html.erb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 82b28fb8a..96fef706a 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -45,13 +45,11 @@ <%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %> -
    组织名称: - +
    组织名称:
    -
    组织描述: - +
    组织描述:
    From ae218fa86caeeac6ca57cae314c5379dc25955eb Mon Sep 17 00:00:00 2001 From: cxt Date: Wed, 2 Dec 2015 11:14:46 +0800 Subject: [PATCH 008/111] =?UTF-8?q?=E5=8F=91=E5=B8=83=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=97=B6=E6=B7=BB=E5=8A=A0=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_group_attr.html.erb | 24 +++++++ .../users/_user_homework_attachment.html.erb | 10 +-- app/views/users/_user_homework_form.html.erb | 11 +++ public/images/course/hwork_icon.png | Bin 0 -> 4494 bytes public/javascripts/homework.js | 65 +++++++++++++++++- public/stylesheets/courses.css | 12 +++- public/stylesheets/new_user.css | 11 +++ 7 files changed, 126 insertions(+), 7 deletions(-) create mode 100644 app/views/users/_user_group_attr.html.erb create mode 100644 public/images/course/hwork_icon.png diff --git a/app/views/users/_user_group_attr.html.erb b/app/views/users/_user_group_attr.html.erb new file mode 100644 index 000000000..42d35c5d7 --- /dev/null +++ b/app/views/users/_user_group_attr.html.erb @@ -0,0 +1,24 @@ +分组设置 + +
    + 每组最小人数: + 人 +
    +
    + 每组最大人数: + 人 +
    +
    + +

    提醒:勾选后各小组必须在Trustie平台创建项目,教师可随时观察平台对各小组最新进展的实时统计。

    +
    +
    + 确定 +
    +
    + 取消 +
    +
    \ No newline at end of file diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 24d37ae63..28dc35026 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -43,16 +43,18 @@ :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all) } %> +
    - 上传附件 - <%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr20",:remote => true%> + 上传附件 + <%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr15",:title=>"请从资源库中选择文件作为作品的附件",:remote => true%> <% if defined?(has_program) && has_program %> - 编程 - + 编程 + + 分组 <% end %>
    diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index efaed2d9d..5c4cd1734 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -97,7 +97,18 @@
    + + + \ No newline at end of file diff --git a/public/images/course/hwork_icon.png b/public/images/course/hwork_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..82c78ac60defdaafaf7e2e8c55530e6939b5b86f GIT binary patch literal 4494 zcmb_g2UJtpx<<#LS+D^L48(vKYDj?4g@h!)AfbqWR3QWikOY!o=-B8*PyqphGbkuV zKuV1CQA9x6pfr(yG%2AdAidl$>dd_N?z;EgweDG`{AaKK``iBZzxFw?78s-bf?|R^ zJUshNjFDE{Cz*Rq@bhx-s(>eU+{bY$%8q)LNbx`EnU0|Xq^6%a`9B~r8l^?-la)#l1O z!(brb4;8A99`I{Wc4ig;LlPMWP*+w}!m2Wd^{0|+=G)dZ;r)I_Li!Zg)XU} z+GrG9)ewe6YH6V15C}>gp{}NaRzs<(YH7mZS{fSPu_i0^pCj zYUBTjf4Bxz1*!%|7;0*1a1(}TqP1Ws6*LT?u7cKpXc+>(Vcq|eT7kJifOp97H*$O* z;xcYW{FCb3mp>N^j>ughWbRT3Jtn%ByFA-WkZ|k3zG-?$f@6< z(%QMoi}XF?mYLVel1$e4h=_A*myCrYEbe{aR>r2u24j{PHfC}; zvB{b80zb|_{J~p%|{GROG=I*0~ zFW|C?Oi$?osn$}=+QW%$q?Bs))w-T@xtTLAltYEMXWqAur;<{ z>EfL;sHl*1hw1aqUt~=@i41x4uSi1c=NdZp@XY z%1bN7=KB5oHA|6IOm7j#Jb$NPI`O1l{za$B_FIFmCkM}M11i&Cd-^xM_P0dV`|8MI z?u|BWF*9lEBv?Pg9bAtX?m`Okouu1OJ$uAtZP=m2iZjmyX(Jr-U;N&s1~qb19V#ZX zuT@F?^f4OOp9}+1cMb zrCe%R`1*{7EK^Ya_>Ib$)Y8irGO}fK_-ULdfN9#<$z&iT(>}{7@7`V(EBb--NL6)j zL`s^NM0~?Lx8>+X-FnjjLCdQz&dFbX#ImBBHg1(NtJ!Ypt#-x5zn*g6R5JZRbH#hX zx`79{3%NUH&q0BduhKOxJ^!bK_=B=Mz!Trd`g6MyZk(o!i?>wMpzzT-&_^*=qHR*z?zsvhbMOXMql-X0|Ge||r-`=94X0_-A5N{w zLzC|Lw=d6PhP_@aTs7cKyNEN#=&4h^F*l%6B5`xxtSmYi_u-XV(p`_@$`x#pFD?ZP zR;RVnZn!<3DM-{bjamr*9ICo@G00?pb=VU>tokBYac_lBh45Rmd%2aK@0&Kmt{dMA zF!Ow;fM~Qy%X^ukb!6>%AJdp1-8hz)EAh+op`qMVv^0~~_MD9jL7}Ue-q{kJodZ%; zClFfu1`-2(pPv;K@)h!-%v?Kg{ph%hofkSxR4#X4u2rs@iT&$^euByCS6-&wD^@`@ zl|LdXyY4%lR#QF)8XTOLmA-efS&$tWP}yfuZ#(O3*Kg3xhQ7dNY$-4gn5k7*&)-+D z@Et_0Ns#?J!=j`+PhBj^aexPHx*Zde=VME^{b-Y`AFT_5*H=D7d~tHec}?V{Ry-tI z%VVc(GcT zzc=)Y?zTa|woc&?n0}1@uI=Z|<0tAjY($Uq)_`~?dvzK%s%Kw;e6Z52^xHbN*RS3v zdL^_^Br5PKK3CQ$t^~Jb$0!1hKajmUJi+jP?F$+_;;&Jmte86B#6Ddp+a9_tK7-!8 zHGgXeQg(mif?8rl^a@th;rwW+=oFuey|=#3;owuL$%Le;OA4JFlDJf_e)2++u73G^ zYIW)cMK@}y9#i58S`=Nu8m-CSh^|Eqg8Rirub>JY<)+Z>NIIsed91nIaVs?6@pRS2 zcWZYi%5=bac*lXMLt5+vJ|H37V!qlzXn&+*Cz7h&1$LRfUtdxbwY2}5d4E;G;x0*G ze#R75aZ@#HuoPRO7@LE+`5?J-rYvSWR^WO%#_1Kl^I3?V9Qeajx9Mv6M_jXQ!EAVn zF0ZU7$7y&i8>9R*pFY)+UM*R)dV-Rk>{6MC9Clugki^gUmD{a>MAZ_laF?`ax}BAS z6HGT8nMo5*Ru&Lq^p_o%6Bzc>G90#Y)1IGaD{zlPMcdWi-0gF2((|u*TF3sak=;+q z&ypP0`q=)&08=nYxAds1iI+J3e#<&7SIEfHwlc^K=jBcgq^=_$ICGB1jj3j|Z9zv? z`L@&R$zvT))cnF3@m1L6568`8NoLGpK2L4`7CGx0pT~=fiCx18>F!g4HIME(67_z= zThLTFQpfgPuf@^%S@FFRABv>@-fVW-&e#6+UD_OuGve1>@5iQRE1bkH^-n*Sx|6lt zdTT?xu{i=i{Zn+!v7>RV6EE=c4+wFa(E5@ylrO^J+Z_F+F(kafzGkmjGUa>-m_0!0*qSB%JvbKt)OTNhfyyr$bB0j$9tl))z!5?aZynhAqRNf z+tS1le_4{{o8(vrmWGGt67SgSFnH(a-JE`iPR}QDRJxY}@;65s9Z8c(O=<9;ZZ*eR z{792EaGUOMe5~ivJ2JZ{7~YHt=MbH<2Y-*z4fA%}Y_5ytC;6w8%iCB|T(@r5YElNh zPQ2Hk?-BBeo9(n-FI3#O$-C{bZIZQd@Wz}vg%sHOC<%XZFL{P~zzkv5FrOxYYoNRc zAN3Urx49{?Y!bm1T{P(tg&{{*3LohdhP6i1Go2^ePy&SX*_I>NMuh`ap?=#3PktE_ zYNL~?1{eA}lGkDgN)auKNaAcv|4s8At10aOXV|i zPT6zM>R?J=-td{|d)eoEl^Ts^hklHbh)Wa~3K{2>Ft>S`jhkU}oW~+J*Xfs6eK=yT z`qF&Fd%D=iMg_!|F_?b-6n}i9auyh9!_ ztG}XqbHmjn##msojc1#+%XO>X51cH1;!Oag3G0@pIz1%hJIe^^w1d6argO=;_!-T77=e zV@V&6C2IhPaeg~8ES%b|!djZt{3VIuy-NADk0)g|zND-Qw%DQBMf3Z)T9yBbWu1%a zG0F9op@s#2-fAE7 zUUP`IMx~%cZQ0*rP4ZOX&xl8vcFZE&q6K<5;c3pR0!p}{mCuc-YD#>ok=RcZ)~G*J zl`*b3;WzQwJ3|tbYa0DvYO+W{xT>~m>KeUm^>93AG*lnolU{qiMObpEU9b8)ir2R| ze=ORwq~GvRKAWR(S2v@59JGl*%#Sp~Xhp(PpUyiqI+)!V@l7|)!LV;f^yRe}ZY+te z>s+7CyvrzfNn3x;Aq{O{uD*X7W@xmR>RKG43mZ5=8)n#NvB{~;6p(zcTFnDJjR4P1 zyi|Z{Mk|O6I=aPBST!#zU}eRpn_5n_fs59bJ_irivf$;l4+v!{N`HOFE_}d-WH<}lCu$?yITf1)0Vbwl;R#foTy{ueQzanEf zE*CLN@f>&Oh|u7X#TIusH}nrXywgD`g}e>v_Y90fD=7&r=`qt@Z1fm0>KwzHOdm9t z`@lhCcO@hq%3OvBc~1%#YF^<-*+-tux|mP~{3-pjG!9&eDQr^=hBq|fGZ=4E>EX~r z8PlZTb>2dYDC6tOHMn|F%<#K^-}rXg;{V#r{oidJLMHRSzvKJfdcQX2@9p^i5zEfE m&`vo2Zj1TMe#_y~E}nVbXZnw;Ok{WdkeHw_$U?-0EB^qHH0+cB literal 0 HcmV?d00001 diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index f1b6e1814..39351cc6b 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -124,7 +124,6 @@ $(function(){ $('#textarea_input_test').focus(); }); - var saveProgramAnswers = function() { var test_numbers = 0; var valid = true; @@ -171,7 +170,7 @@ $(function(){ $("input[name=homework_type]").after(html); } return valid; - } + }; $("#BluePopupBox a.BlueCirBtn").live('click', function(){ if(saveProgramAnswers()){ @@ -198,6 +197,68 @@ $(function(){ $(this).parent('.mt10').remove(); }); + //分组作业 + $("#GroupPopupBox").dialog({ + modal: true, + autoOpen: false, + dialogClass: 'BluePopupBox', + minWidth: 290 + }); + + $('a.groupBtn').live('click', function(){ + $("#GroupPopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.popClose").on('click', function(){ + $("#GroupPopupBox" ).dialog("close"); + }); + $("#cancel_group").on('click', function(){ + $("#GroupPopupBox" ).dialog("close"); + }); + $('#min_num').focus(); + }); + + var saveGroupAttr = function() { + var valid = true; + var base_on_project = 0; + var min = $.trim($("#min_num").val()); + var max = $.trim($("#max_num").val()); + if(min.length <= 0) { + $("#min_num").focus(); + valid = false; + return false; + } + if(max.length <= 0) { + $("#max_num").focus(); + valid = false; + return false; + } + if ($("#base_on_project").is(":checked")) { + base_on_project = 1; + } + if (valid) { + $("input[name=homework_type]").val(3); + $('span.group_detail_info').text('分组人数:'+min+'-'+max+' 人'); + //保存js值 + var data = { + base_on_project: base_on_project, + min_num: min, + max_num: max + }; + //构建到form中 + $('.group-input').remove(); + var html=bt('t:group-input-list',data); + $("input[name=homework_type]").after(html); + } + return valid; + }; + + $("#GroupPopupBox a.group_btn").live('click', function(){ + if(saveGroupAttr()){ + if($( "#GroupPopupBox" ).dialog( "isOpen" )){ + $("#GroupPopupBox").dialog( "close" ); + } + } + }); //代码编辑器 if (typeof CodeMirror != "undefined") { diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 2fb32e2d0..93594794e 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1175,4 +1175,14 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;} .rankList li p {width:100%; overflow:hidden; white-space:normal; text-overflow:ellipsis; color:#585858;word-wrap: normal; word-break: normal;} .rankPortrait {border-radius:50%; width:35px; height:35px;} .numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; color:#585858; white-space: nowrap;} -.font_cus {font-family: "微软雅黑","宋体"; font-size: 12px; line-height: 1.5;} +.font_cus {font-family: "微软雅黑","宋体"; font-size: 12px; line-height: 1.5;} +/*20151130课程项目集成Tim*/ +a.testBtn{background: url(/images/course/hwork_icon.png) -2px -5px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.testBtn{background: url(/images/course/hwork_icon.png) -81px -5px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a.groupBtn{ background: url(/images/course/hwork_icon.png) -2px -61px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.groupBtn{background: url(/images/course/hwork_icon.png) -80px -61px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +.markInput { outline:none; border:1px solid #e6e6e6; height:30px; width:50px; color:#3d3c3c; margin-right:5px; text-align:center; padding-left:0px;} +.groupPopUp {width:290px; height:auto; padding:15px; background-color:#ffffff; z-index:1000; position:relative;} +.popClose {background:url(/images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:2px; top:3px;} +a.memberBtn{ background: url(/images/course/hwork_icon.png) -7px -90px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index a08fd6f33..90ac82f2b 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1349,3 +1349,14 @@ span.author { font-size: 0.9em; color: #888; } .pageCell:hover {border:1px solid #3498db; z-index:10;} .pageCellActive {background-color:#3498db; border:1px solid #3498db !important; position:relative; color:#ffffff;} +/*20151130课程项目集成Tim*/ +a.testBtn{background: url(/images/course/hwork_icon.png) -2px -5px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.testBtn{background: url(/images/course/hwork_icon.png) -81px -5px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a.groupBtn{ background: url(/images/course/hwork_icon.png) -2px -61px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.groupBtn{background: url(/images/course/hwork_icon.png) -80px -61px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +.markInput { outline:none; border:1px solid #e6e6e6; height:30px; width:50px; color:#3d3c3c; margin-right:5px; text-align:center; padding-left:0px;} +.groupPopUp {width:290px; height:auto; padding:15px; background-color:#ffffff; z-index:1000; position:relative;} +.popClose {background:url(/images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:2px; top:3px;} +a.memberBtn{ background: url(/images/course/hwork_icon.png) -7px -90px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} +a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-repeat !important; color:#3598db; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;} + From 95b071a8f727080e5f67cc27952d4a54098f88f3 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 2 Dec 2015 16:48:49 +0800 Subject: [PATCH 009/111] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/org_document_comments/add_reply.js.erb | 2 +- app/views/organizations/_show_org_document.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/org_document_comments/add_reply.js.erb b/app/views/org_document_comments/add_reply.js.erb index 40ed2eeb2..1906cae95 100644 --- a/app/views/org_document_comments/add_reply.js.erb +++ b/app/views/org_document_comments/add_reply.js.erb @@ -1,3 +1,3 @@ -$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document, :act => @act}) %>"); +$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => params[:flag], :act => @act}) %>"); init_activity_KindEditor_data(<%= @act.id %>,"","87%"); \ No newline at end of file diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb index 4d1393897..7588c7f6f 100644 --- a/app/views/organizations/_show_org_document.html.erb +++ b/app/views/organizations/_show_org_document.html.erb @@ -88,7 +88,7 @@
- <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id), :method => "post", :remote => true) do |f| %> + <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %> From 9baeb850a3ac9a099c2dcab0cca715428a519cf8 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 2 Dec 2015 17:34:21 +0800 Subject: [PATCH 010/111] =?UTF-8?q?=E5=9C=A8=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=B8=AD=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E7=9A=84=E7=BC=96=E8=BE=91=E5=92=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 13 +++ app/views/organizations/destroy.js.erb | 0 app/views/organizations/edit.html.erb | 108 ++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 app/views/organizations/destroy.js.erb create mode 100644 app/views/organizations/edit.html.erb diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 70ac952ea..85f57917b 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -37,6 +37,19 @@ class OrganizationsController < ApplicationController @organization = Organization.new render :layout => 'new_base' end + + def edit + @organization = Organization.find(params[:id]) + end + + def destroy + @organization = Organization.find(params[:id]) + @organization.destroy + respond_to do |format| + format.html{ redirect_to admin_organization_path } + end + end + def create @organization = Organization.new @organization.name = params[:organization][:name] diff --git a/app/views/organizations/destroy.js.erb b/app/views/organizations/destroy.js.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/organizations/edit.html.erb b/app/views/organizations/edit.html.erb new file mode 100644 index 000000000..c2e918708 --- /dev/null +++ b/app/views/organizations/edit.html.erb @@ -0,0 +1,108 @@ + +<% @nav_dispaly_organization_label = 1 + @nav_dispaly_forum_label = 1 %> +<%= error_messages_for 'organization' %> +
+

编辑组织

+
+
+ + + <%#= form_for( @organization,{:controller => 'organizations',:action => 'update',:id=>@organization,:html=>{:id=>'update_org_form',:method=>'put'}}) do %> + <%= labelled_form_for @organization, :html => {:id => "edit_organization_#{@organization.id}"} do |f|%> + <%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %> + + +
组织名称: +
+
+
+
组织描述: +
+
+
+ + + + + + + + +
公开 : + class="ml3" /> +
+ 保存 + <% end %> +
+
+ +<% html_title(l(:label_organization_new)) -%> + + + From cf41b13f3ab81c5b25a4ae6ffe1bf8875c245425 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Wed, 2 Dec 2015 17:38:41 +0800 Subject: [PATCH 011/111] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E8=A1=A8=E5=92=8C=E7=BB=84=E7=BB=87=E8=AF=BE=E7=A8=8B=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=85=B3=E8=81=94=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 2 +- app/models/organization.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index ec1afd611..143358abe 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -18,7 +18,7 @@ class Course < ActiveRecord::Base :conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})" has_many :principals, :through => :member_principals, :source => :principal has_many :users, :through => :members - has_many :org_courses + has_many :org_courses, :dependent => :destroy has_many :organizations, :through => :org_courses # has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy has_many :journals_for_messages, :as => :jour, :dependent => :destroy diff --git a/app/models/organization.rb b/app/models/organization.rb index d3755b5ee..a35f68c26 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -5,7 +5,7 @@ class Organization < ActiveRecord::Base has_many :projects,:through => :org_projects has_many :courses, :through => :org_courses has_many :org_document_comments, :dependent => :destroy - has_many :org_courses + has_many :org_courses, :dependent => :destroy has_many :users, :through => :org_members validates_uniqueness_of :name after_create :save_as_org_activity From f90ff781ab405ab473eb13ae2da2b715b347c816 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 3 Dec 2015 09:17:36 +0800 Subject: [PATCH 012/111] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E9=A1=B5=E9=9D=A2=E7=9A=84=E5=90=88=E4=BD=9C?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 9 +++ app/models/homework_common.rb | 5 ++ app/models/homework_detail_group.rb | 4 ++ app/views/homework_common/index.html.erb | 2 +- .../_choose_group_member.html.erb | 41 +++++++++++++ .../student_work/_relate_project.html.erb | 30 ++++++++++ app/views/student_work/edit.html.erb | 2 +- app/views/student_work/new.html.erb | 30 ++++++++-- app/views/student_work/retry_work.js.erb | 2 +- app/views/users/_user_group_attr.html.erb | 15 +++-- .../users/_user_homework_attachment.html.erb | 8 ++- app/views/users/_user_homework_form.html.erb | 5 +- app/views/users/user_homeworks.html.erb | 2 +- app/views/users/user_select_homework.js.erb | 2 +- ...202064455_create_homework_detail_groups.rb | 14 +++++ db/schema.rb | 56 ++++++++++-------- public/images/course/right-arrow.png | Bin 0 -> 1325 bytes public/javascripts/homework.js | 2 +- public/javascripts/new_user.js | 13 ++++ public/stylesheets/courses.css | 6 ++ public/stylesheets/new_user.css | 7 ++- spec/factories/homework_detail_groups.rb | 11 ++++ spec/models/homework_detail_group_spec.rb | 5 ++ 23 files changed, 225 insertions(+), 46 deletions(-) create mode 100644 app/models/homework_detail_group.rb create mode 100644 app/views/student_work/_choose_group_member.html.erb create mode 100644 app/views/student_work/_relate_project.html.erb create mode 100644 db/migrate/20151202064455_create_homework_detail_groups.rb create mode 100644 public/images/course/right-arrow.png create mode 100644 spec/factories/homework_detail_groups.rb create mode 100644 spec/models/homework_detail_group_spec.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 9ff833f48..9090a814c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -551,12 +551,21 @@ class UsersController < ApplicationController ) end end + end + #分组作业 + if homework.homework_type == 3 + homework_detail_group = HomeworkDetailGroup.new + homework.homework_detail_group = homework_detail_group + homework_detail_group.min_num = params[:min_num].to_i + homework_detail_group.max_num = params[:max_num].to_i + homework_detail_group.base_on_project = params[:base_on_project].to_i end if homework.save homework_detail_manual.save if homework_detail_manual homework_detail_programing.save if homework_detail_programing + homework_detail_group.save if homework_detail_group if params[:is_in_course] == "1" redirect_to homework_common_index_path(:course => homework.course_id) diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 8d421a98f..461c7d35b 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -9,6 +9,7 @@ class HomeworkCommon < ActiveRecord::Base belongs_to :user has_one :homework_detail_manual, :dependent => :destroy has_one :homework_detail_programing, :dependent => :destroy + has_one :homework_detail_group, :dependent => :destroy has_many :homework_tests, :dependent => :destroy has_many :student_works, :dependent => :destroy, :conditions => "is_test=0" has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 @@ -74,6 +75,10 @@ class HomeworkCommon < ActiveRecord::Base self.homework_type == 2 && self.homework_detail_programing end + def is_group_homework? + self.homework_type == 3 && self.homework_detail_group + end + ###添加回复 def self.add_homework_jour(user, notes, id , options = {}) homework = HomeworkCommon.find(id) diff --git a/app/models/homework_detail_group.rb b/app/models/homework_detail_group.rb new file mode 100644 index 000000000..0a9cb5fe2 --- /dev/null +++ b/app/models/homework_detail_group.rb @@ -0,0 +1,4 @@ +class HomeworkDetailGroup < ActiveRecord::Base + belongs_to :homework_common + attr_accessible :base_on_project, :homework_common_id, :max_num, :min_num +end diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index 3b3877228..010bc8ec9 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -4,7 +4,7 @@ $("#homework_publish_time").val(""); $("#homework_end_time").val(""); $("#course_id").val($("#option_select").val()); - $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true })%>"); + $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true})%>"); homework_description_editor.html(""); $("#homework_editor").toggle(); } diff --git a/app/views/student_work/_choose_group_member.html.erb b/app/views/student_work/_choose_group_member.html.erb new file mode 100644 index 000000000..c14e8a06e --- /dev/null +++ b/app/views/student_work/_choose_group_member.html.erb @@ -0,0 +1,41 @@ +
请添加小组成员
+ +
+
+
+ +
+
+
+
    +
  • + 同学一(061530301) +
  • +
  • + 同学二同学二(061530302) +
  • +
  • + 同学三(061530303) +
  • +
  • + 同学四同学四(061530304) +
  • +
  • + 同学五同学五(061530305) +
  • +
  • + 同学六同学六(061530306) +
  • +
  • + 同学七同学七(061530307) +
  • +
+
+
    +
  • TimTang(040930319)×
  • +
  • suntao(060930106)×
  • +
+
+ + +
\ No newline at end of file diff --git a/app/views/student_work/_relate_project.html.erb b/app/views/student_work/_relate_project.html.erb new file mode 100644 index 000000000..06649baba --- /dev/null +++ b/app/views/student_work/_relate_project.html.erb @@ -0,0 +1,30 @@ +
关联项目 +
+ +
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+ + +
+
\ No newline at end of file diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index d506b5542..bfdf8c316 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -48,7 +48,7 @@
- <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false} %> + <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %>
diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 45c26654e..995126cb5 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -95,20 +95,32 @@
- <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false} %> + <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %>
+ <% if @homework.homework_type == 3 %> + + + <% end %> + +
-
- <%= select_tag :project_id, options_for_select(user_projects_option, @student_work.project_id), {:class => "InputBox W680 fl"} %> +
提交 @@ -120,6 +132,14 @@
\ No newline at end of file diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index 28dc35026..f1c0ae97e 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -52,9 +52,11 @@ 上传附件 <%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3 mr15",:title=>"请从资源库中选择文件作为作品的附件",:remote => true%> <% if defined?(has_program) && has_program %> - 编程 - - 分组 + 编程 + + <% end %> + <% if defined?(has_group) && has_group %> + 分组 <% end %>
diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb index 5c4cd1734..40c8ac5bd 100644 --- a/app/views/users/_user_homework_form.html.erb +++ b/app/views/users/_user_homework_form.html.erb @@ -4,6 +4,9 @@ <% end %> @@ -54,7 +57,7 @@
- <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type == 1)} %> + <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>!(edit_mode && homework.homework_type != 3)} %>
diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb index 121450d4d..7be803720 100644 --- a/app/views/users/user_homeworks.html.erb +++ b/app/views/users/user_homeworks.html.erb @@ -4,7 +4,7 @@ $("#homework_publish_time").val(""); $("#homework_end_time").val(""); $("#course_id").val($("#option_select").val()); - $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true })%>"); + $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true })%>"); homework_description_editor.html(""); $("#homework_editor").toggle(); } diff --git a/app/views/users/user_select_homework.js.erb b/app/views/users/user_select_homework.js.erb index 1d9cc8d70..cd94a6816 100644 --- a/app/views/users/user_select_homework.js.erb +++ b/app/views/users/user_select_homework.js.erb @@ -5,7 +5,7 @@ $("#homework_end_time").val("<%= @homework.end_time%>"); <% if @select_course == "0"%> $("#course_id").val("<%= @homework.course_id%>"); <% end%> -$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true })%>"); +$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true,:has_group => true })%>"); homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>"); $("#BluePopupBox").html("<%=escape_javascript( render :partial => 'users/user_programing_attr', :locals => {:edit_mode => true, :homework => @homework})%>"); //$("input[name='homework_type']").val("<%#= @homework.homework_type%>"); diff --git a/db/migrate/20151202064455_create_homework_detail_groups.rb b/db/migrate/20151202064455_create_homework_detail_groups.rb new file mode 100644 index 000000000..a77e50f01 --- /dev/null +++ b/db/migrate/20151202064455_create_homework_detail_groups.rb @@ -0,0 +1,14 @@ +class CreateHomeworkDetailGroups < ActiveRecord::Migration + def change + create_table :homework_detail_groups do |t| + t.integer :homework_common_id + t.integer :min_num + t.integer :max_num + t.integer :base_on_project + t.references :homework_common + + t.timestamps + end + add_index :homework_detail_groups, :homework_common_id + end +end diff --git a/db/schema.rb b/db/schema.rb index c6ca6a0ce..442ceaab9 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 => 20151130033906) do +ActiveRecord::Schema.define(:version => 20151202064455) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -543,23 +543,26 @@ ActiveRecord::Schema.define(:version => 20151130033906) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :force => true do |t| - t.string "IPLineCode" - t.string "Description" - t.string "Num" - t.string "Variable" - t.string "TraceInfo" - t.string "Method" + create_table "dts", :primary_key => "Num", :force => true do |t| + t.string "Defect", :limit => 50 + t.string "Category", :limit => 50 t.string "File" - t.string "IPLine" - t.string "Review" - t.string "Category" - t.string "Defect" - t.string "PreConditions" - t.string "StartLine" + t.string "Method" + t.string "Module", :limit => 20 + t.string "Variable", :limit => 50 + t.integer "StartLine" + t.integer "IPLine" + t.string "IPLineCode", :limit => 200 + t.string "Judge", :limit => 15 + t.integer "Review", :limit => 1 + t.string "Description" + t.text "PreConditions", :limit => 2147483647 + t.text "TraceInfo", :limit => 2147483647 + t.text "Code", :limit => 2147483647 t.integer "project_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" + t.integer "id", :null => false end create_table "enabled_modules", :force => true do |t| @@ -735,6 +738,17 @@ ActiveRecord::Schema.define(:version => 20151130033906) do add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" + create_table "homework_detail_groups", :force => true do |t| + t.integer "homework_common_id" + t.integer "min_num" + t.integer "max_num" + t.integer "base_on_project" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id" + create_table "homework_detail_manuals", :force => true do |t| t.float "ta_proportion" t.integer "comment_status" @@ -891,16 +905,6 @@ ActiveRecord::Schema.define(:version => 20151130033906) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" diff --git a/public/images/course/right-arrow.png b/public/images/course/right-arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..b152e9ce9f65165d57377cb50087c2a5ede4f311 GIT binary patch literal 1325 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRs!3HE%f6fyGQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?=ezLn2Bde0{8v^Kf6`()~Xj@TAnpKdC8`Lf!&sHg;q@=(~U%$M( zT(8_%FTW^V-_X+15@d#vkuFe$ZgFK^Nn(X=Ua>OF1ees}t-3#_`hBq$Z(46Le)Ln;eW^@CE2 z^Gl18f$@>14ATq@JNy=b6armi<&vLVnwy$e;^|_m1QgLr$xN{_cXl-~GjTJuw6HWb zG;}q!Ff(&@c6KqcGGjMjE=kNwPKD{sMCdiatJli8C^fMpzbGU>KL-|j z0U7xv`NbLe1q#l=W(wh%c`5nj#h`$Nx-+#Xvn(~mttdZN0UR<`nMk&~S{j>}nz*=` z7`Pc5I~h1TyBfQhIGI?w8oC&onV7gKLG`2{`Iev_eW2y~plC#jR+tblt$>*DL<;1< zlX+?$Fl`qB6Y-fD5;+VEjGH}O978H@EtzWT&Fm=9_T7n#Q-hJUHR4#kg4v>04y79^ zT}g{rnmZB_pP%0#?DB~HQM$0SD@$NN&Xr3>Ym*kX%+U~YstJ3iBDcMGr^SbqzLfjr z<>}wmrsdxD_gd*aqxpN*)>S1D)0V#K?Pd)LL6QkIJ;0Vw8o9DLV^Ga-RJyqPAdvMA0kd`GcmEIn<>CbQS?3X*9 zJpHA}mXka?b*?OlzAqd$dyCf8uFL?wu!ScpS|*-wp2Gih-=TR+SN)H98W=GxE&XTt zk}3C1<(j`Xn17Pnv}V&2Q;FxNogDmkq<+)c`Q+{)lSjUuJs;X;EsZT)>&UlpU4@T8 z{A9HU7o(3vMoc_%L^Ng3Bl+ZAMKfq ew!is*#1a_(E}x^jPDLDCf_b|7xvX :model do + pending "add some examples to (or delete) #{__FILE__}" +end From b91c65798d5a576e3e89fe0b20cdd75324be7d12 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 3 Dec 2015 20:44:29 +0800 Subject: [PATCH 013/111] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/member.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index ce336373b..08cf27f17 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,5 +1,8 @@
-

<%= @subPage_title%>

+

<%= @subPage_title%>

+
+ <%= link_to "修改角色", url_for(:controller => 'courses', :action => 'settings', :id => @course.id) %> +
<% if @subPage_title == l(:label_student_list)%> <%= render :partial => 'course_student', :locals => {:members => @members} %> From 8d891a9faa93c5ccbdd04e7773e7560cb93b9dd6 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 3 Dec 2015 20:57:09 +0800 Subject: [PATCH 014/111] =?UTF-8?q?fork=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 9601e5188..7cd93f5b0 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -25,7 +25,10 @@ -
Fork 0
+ <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> + <% if User.current.id != @project.user_id || User.current.projects.count !=0 %> +
Fork 0
+ <% end %>
<% if @changesets && !@changesets.empty? %> From 057d9a33371de1decdf7edf48d4beb869d652969 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 00:15:47 +0800 Subject: [PATCH 015/111] 0 --- app/controllers/courses_controller.rb | 76 +++++++++++++-------------- app/views/courses/settings.html.erb | 24 ++++----- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index cd1de16fc..6c275850b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -55,11 +55,11 @@ class CoursesController < ApplicationController def join if User.current.logged? - cs = CoursesService.new - @user = User.current - join = cs.join_course params,@user - @state = join[:state] - @course = join[:course] + cs = CoursesService.new + @user = User.current + join = cs.join_course params,@user + @state = join[:state] + @course = join[:course] # else # @course = Course.find_by_id params[:object_id] # CourseMessage.create(:user_id => @course.tea_id, :course_id => @course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest') @@ -70,7 +70,7 @@ class CoursesController < ApplicationController end @object_id = params[:object_id] respond_to do |format| - format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} } + format.js #{ render :partial => 'set_join', :locals => {:user => @user, :course => @course, :object_id => params[:object_id]} } end end @@ -85,7 +85,7 @@ class CoursesController < ApplicationController end end - + def join_private_courses respond_to do |format| format.js @@ -98,14 +98,14 @@ class CoursesController < ApplicationController c = cs.edit_course params,@course,User.current @course = c[:course] if @course.errors.full_messages.count <= 0 - respond_to do |format| - format.html { - # render :layout => 'base_courses' - flash[:notice] = l(:notice_successful_update) - redirect_to settings_course_url(@course) - } - format.api { render_api_ok } - end + respond_to do |format| + format.html { + # render :layout => 'base_courses' + flash[:notice] = l(:notice_successful_update) + redirect_to settings_course_url(@course) + } + format.api { render_api_ok } + end else respond_to do |format| format.html { @@ -134,8 +134,8 @@ class CoursesController < ApplicationController courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'").order("time desc, created_at desc") @courses = paginateHelper courses,10 end - @name = params[:name] - @type = 'courses' + @name = params[:name] + @type = 'courses' respond_to do |format| format.html { render :layout => 'course_base' @@ -277,7 +277,7 @@ class CoursesController < ApplicationController def member ## 有角色参数的才是课程,没有的就是项目 if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) - + @render_file = 'new_member_list' @score_sort_by = "desc" @canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1' @@ -312,7 +312,7 @@ class CoursesController < ApplicationController def export_course_member_excel @all_members = student_homework_score(0,0,0,"desc") filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; - + respond_to do |format| format.xls { send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", @@ -426,7 +426,7 @@ class CoursesController < ApplicationController end def course - @school_id = params[:school_id] + @school_id = params[:school_id] per_page_option = 10 if @school_id == "0" or @school_id.nil? @courses_all = Course.active.visible. @@ -514,8 +514,8 @@ class CoursesController < ApplicationController def index if !User.current.admin? - render_404 - return + render_404 + return end @course_type = params[:course_type] @school_id = params[:school_id] @@ -564,7 +564,7 @@ class CoursesController < ApplicationController respond_to do |format| format.html { - render :layout => 'base' + render :layout => 'base' } format.atom { courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all @@ -683,10 +683,10 @@ class CoursesController < ApplicationController end def feedback - @course.journals_for_messages.each do |messages| - query = messages.course_messages.where("user_id = ?", User.current.id) - query.update_all(:viewed => true); - end + @course.journals_for_messages.each do |messages| + query = messages.course_messages.where("user_id = ?", User.current.id) + query.update_all(:viewed => true); + end if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) page = params[:page] @@ -737,20 +737,20 @@ class CoursesController < ApplicationController #从课程创建的老师那里选择课程大纲 def course_outline - @teacher = User.find(@course.tea_id) - @blog_articles = @teacher.blog.articles - @is_in_show_outline_page = params[:is_in_show_outline_page] - respond_to do |format| - format.js - end + @teacher = User.find(@course.tea_id) + @blog_articles = @teacher.blog.articles + @is_in_show_outline_page = params[:is_in_show_outline_page] + respond_to do |format| + format.js + end end #根据关键字搜索,查找方法一样的,但返回内容不一样 def search_course_outline - @article_title = params[:title] - @teacher = User.find(@course.tea_id) - @blog_articles = @teacher.blog.articles.like(@article_title) - render :json=>@blog_articles.to_json + @article_title = params[:title] + @teacher = User.find(@course.tea_id) + @blog_articles = @teacher.blog.articles.like(@article_title) + render :json=>@blog_articles.to_json end #设置或者更改课程的大纲 @@ -796,7 +796,7 @@ class CoursesController < ApplicationController def can_show_course @first_page = FirstPage.find_by_page_type('project') if @first_page.try(:show_course) == 2 - render_404 + render_404 end end diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 5c3918f00..ce56537c1 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -107,15 +107,15 @@
+ function select() { + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/term_select') %>'); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before("" + + ""); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); + } + $("#time_selected").click(select); + $("#term_selected").click(select); + From 2855c0e409e104d66ef612fb88056e117442e5c7 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 4 Dec 2015 10:59:09 +0800 Subject: [PATCH 016/111] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=8A=A8=E6=80=81=EF=BC=8C=E4=BD=BF=E5=85=B6=E4=B8=8E=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E5=8A=A8=E6=80=81=E5=8F=8A=E4=B8=AA=E4=BA=BA=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E7=9A=84=E6=A0=B7=E5=BC=8F=E4=B8=80=E8=87=B4=EF=BC=8C?= =?UTF-8?q?=E5=8C=85=E6=8B=AC=E6=9C=89=E5=9B=9E=E5=A4=8D=E6=A1=86=E3=80=81?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E8=8F=9C=E5=8D=95=E3=80=81=E5=AE=BD=E5=BA=A6?= =?UTF-8?q?=E3=80=81=E9=97=B4=E8=B7=9D=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 5 + app/controllers/projects_controller.rb | 13 +- app/models/forge_activity.rb | 6 +- app/views/comments/create.js.erb | 5 +- app/views/layouts/base_projects.html.erb | 2 +- app/views/projects/_attachment_acts.html.erb | 35 +++++ .../projects/_project_activities.html.erb | 102 ++++++++++++ app/views/projects/_project_create.html.erb | 38 +++++ app/views/projects/_project_news.html.erb | 106 +++++++++++++ app/views/projects/show.html.erb | 145 ++++-------------- app/views/projects/show.js.erb | 1 + 11 files changed, 340 insertions(+), 118 deletions(-) create mode 100644 app/views/projects/_attachment_acts.html.erb create mode 100644 app/views/projects/_project_activities.html.erb create mode 100644 app/views/projects/_project_create.html.erb create mode 100644 app/views/projects/_project_news.html.erb create mode 100644 app/views/projects/show.js.erb diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 9b090de9a..6f173b7c2 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -169,6 +169,11 @@ class MessagesController < ApplicationController course_activity.updated_at = Time.now course_activity.save end + forge_activity = ForgeActivity.where("forge_act_type='Message' and forge_act_id=#{@topic.id}").first + if forge_activity + forge_activity.updated_at = Time.now + forge_activity.save + end user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first if user_activity user_activity.updated_at = Time.now diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 715f56d3d..200bd4d69 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -320,9 +320,20 @@ class ProjectsController < ApplicationController @activity.scope_select {|t| !has["show_#{t}"].nil?} =end + @page = params[:page] ? params[:page].to_i + 1 : 0 # 根据私密性,取出符合条件的所有数据 if User.current.member_of?(@project) || User.current.admin? - @events_pages = ForgeActivity.where("project_id = ? and forge_act_type != ?",@project, "Document" ).order("created_at desc").page(params['page'|| 1]).per(20); + case params[:type] + when nil + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo')",@project).order("updated_at desc").limit(10).offset(@page * 10) + when 'issue' + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'",@project).order("updated_at desc").limit(10).offset(@page * 10) + when 'news' + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'",@project).order("updated_at desc").limit(10).offset(@page * 10) + when 'message' + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'",@project).order("updated_at desc").limit(10).offset(@page * 10) + end + #events = @activity.events(@date_from, @date_to) else @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index bb5f30442..115575289 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -48,8 +48,10 @@ class ForgeActivity < ActiveRecord::Base def add_org_activity if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil? org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first - org_activity.created_at = self.created_at - org_activity.save + if org_activity + org_activity.created_at = self.created_at + org_activity.save + end else OrgActivity.create(:user_id => self.user_id, :org_act_id => self.forge_act_id, diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb index ea904a63f..b0354b53f 100644 --- a/app/views/comments/create.js.erb +++ b/app/views/comments/create.js.erb @@ -1,3 +1,6 @@ +<% if @course %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); - +<% else %> +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>"); +<% end %> init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%"); diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 9e9bd688f..1d68c9fa0 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -12,7 +12,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %> + <%= stylesheet_link_tag 'public', 'pleft', 'project','courses','prettify','jquery/jquery-ui-1.9.2','header','repository' %> <%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %> <%= call_hook :view_layouts_base_html_head %> diff --git a/app/views/projects/_attachment_acts.html.erb b/app/views/projects/_attachment_acts.html.erb new file mode 100644 index 000000000..2baa8791a --- /dev/null +++ b/app/views/projects/_attachment_acts.html.erb @@ -0,0 +1,35 @@ +
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> +
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 项目附件", project_news_index_path(activity.project), :class => "newsBlue ml15" %> +
+ +
+
+ 发布时间:<%= format_time(activity.created_on) %> +
+

<%= textAreailizable act, :description %>

+
+
+ <%#= activity.description.html_safe %> +
+
+
+ +
+
+
+ +
\ No newline at end of file diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb new file mode 100644 index 000000000..f97646d3c --- /dev/null +++ b/app/views/projects/_project_activities.html.erb @@ -0,0 +1,102 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %> + +<% unless forge_acts.empty? %> + <% forge_acts.each do |activity| -%> + + + <% case activity.forge_act_type %> + <% when "ProjectCreateInfo" %> + <%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %> + + <% when "Issue" %> + <%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id} %> + + + <% when "Message" %> + <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id} %> + + <% when "News" %> + <% if !activity.forge_act.nil? and activity.forge_act.project %> + <%= render :partial => 'projects/project_news', :locals => {:activity=>activity.forge_act, :user_activity_id=>activity.id} %> + <% end %> + + <% when "Attachment" %> + <%= render :partial => 'projects/attachment_acts', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id } %> + + + + + + + + + <%#= link_to format_activity_title("#{l(:label_attachment)}: #{act.filename}"), {:controller => 'attachments', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %> + + + + + + + + + <% end %> + <% end %> +<% end %> + +<% if forge_acts.count == 10 %> +
展开更多<%= link_to "", project_path(@project.id, :type => type, :page => page), :id => "more_forge_activities_link", :remote => "true", :class => "none" %>
+<% end %> + + \ No newline at end of file diff --git a/app/views/projects/_project_create.html.erb b/app/views/projects/_project_create.html.erb new file mode 100644 index 000000000..d966d8e18 --- /dev/null +++ b/app/views/projects/_project_create.html.erb @@ -0,0 +1,38 @@ +<% project = Project.find(activity.project_id) %> +<% user = User.find(project.user_id)%> +
+
+
+ <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %> +
+
+
+ <% if user.try(:realname) == ' ' %> + <%= link_to user, user_path(user), :class => "newsBlue mr15" %> + <% else %> + <%= link_to user.try(:realname), user_path(user), :class => "newsBlue mr15" %> + <% end %> + TO + <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> +
+
+ <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %> +
+
+ 创建时间:<%= format_time(project.created_on) %> +
+ +
+
+
+
\ No newline at end of file diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb new file mode 100644 index 000000000..919abc11e --- /dev/null +++ b/app/views/projects/_project_news.html.erb @@ -0,0 +1,106 @@ +
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> +
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %> + <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> + <% end %> TO + <%= link_to activity.project.name.to_s+" | 项目新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %> +
+ + <% if activity.sticky == 1%> + 置顶 + <% end%> +
+
+ 发布时间:<%= format_time(activity.created_on) %> +
+
+
+ <%= activity.description.html_safe %> +
+
+
+ + +
+
+
+
+ <% count=activity.comments.count %> +
+
+
+
+ 回复(<%= count %>) +
+
<%#= format_date(activity.updated_on) %>
+ <%if count>3 %> + + <% end %> +
+ + <% replies_all_i = 0 %> + <% if count > 0 %> +
+
    + <% activity.comments.reorder("created_on desc").each do |comment| %> + + <% replies_all_i = replies_all_i + 1 %> +
  • +
    + <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> +
    +
    +
    + <% if comment.try(:author).try(:realname) == ' ' %> + <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(comment.created_on) %> +
    +
    + <%= comment.comments.html_safe %>
    +
    +
    +
  • + <% end %> +
+
+ <% end %> + +
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> + + +
+ +
+

+ <% end%> +
+
+
+
+
+
+
\ No newline at end of file diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index a3a2845f8..a58aeb281 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -1,114 +1,33 @@ -<%= javascript_include_tag "jquery.infinitescroll.js" %> -
-

<%= l(:label_activity) %>

-
- -<% unless @events_pages.empty? %> - <% @events_pages.each do |e| -%> - - <% if e.forge_act_type == "ProjectCreateInfo"%> -
- <%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %> -
- <%= link_to e.user, user_path(e.user), :class => "problem_name c_orange fl" %> <%= l(:label_project_create) %> : - <%= link_to e.project.name,{} ,:class => "problem_tit fl fb" %>
-


<%= l :label_create_time %> :<%= format_time(e.project.created_on) %>

-
-
-
- <% end %> - <% next if e.forge_act_type.safe_constantize.nil? - act = e.forge_act; - next if act.nil? %> - - <% if e.forge_act_type == "Issue" %> - - - <% elsif e.forge_act_type == "Journal" %> - - - <% elsif e.forge_act_type == "Message" %> -
- <%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %> -
- - <%= h(e.project) if @project.nil? || @project.id != e.project_id %> - <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %> <%= l(:label_new_activity) %> : +<%#= stylesheet_link_tag 'courses' %> + + +
+
+
项目动态
+
    +
  • +
      +
    • +
        +
      • <%= link_to "全部动态", {:controller => "projects", :action => "show", :type => nil}, :class => "homepagePostTypeAll postTypeGrey" %>
      • +
      • <%= link_to "问题动态", {:controller => "projects", :action => "show", :type => "issue"}, :class => "homepagePostTypeMessage postTypeGrey" %>
      • + +
      • <%= link_to "新闻动态", {:controller => "projects", :action => "show", :type => "news"}, :class => "homepagePostTypeNotice postTypeGrey" %>
      • + +
      • <%= link_to "讨论区动态", {:controller => "projects", :action => "show", :type => "message"}, :class => "homepagePostTypeForum postTypeGrey" %>
      • + +
      +
    • +
    +
  • +
+ - <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - project_boards_path(@project,:topic_id => act.id), - :class => "problem_tit fl fb " %> -
-

<%= textAreailizable act,:content %>
-

- <%= l :label_create_time %> :<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %>

-
-
-
- - <% elsif e.forge_act_type == "News" %> - - - - <% elsif e.forge_act_type == "Attachment" %> -
- <%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %> -
- - <%= h(e.project) if @project.nil? || @project.id != e.project_id %> - <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %> <%= l(:label_new_activity) %> : - <%= link_to format_activity_title("#{l(:label_attachment)}: #{act.filename}"), {:controller => 'attachments', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %>
-

<%= textAreailizable act,:description %>
- <%= l :label_create_time %> :<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %>

-
-
-
- <% end %> - <% end %> -<% end %> -<%= paginate @events_pages, :left => 3, :right => 3 %> +
+ <%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %> +
\ No newline at end of file diff --git a/app/views/projects/show.js.erb b/app/views/projects/show.js.erb new file mode 100644 index 000000000..384c111d1 --- /dev/null +++ b/app/views/projects/show.js.erb @@ -0,0 +1 @@ +$("#show_more_forge_activities").replaceWith("<%= escape_javascript( render :partial => 'projects/project_activities',:locals => {:forge_acts => @events_pages, :page => @page,:type => @type} )%>"); From d115a97f785d0a242aace0866d2cc95369b91da0 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 4 Dec 2015 16:49:14 +0800 Subject: [PATCH 017/111] =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E9=99=84=E4=BB=B6?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/courses.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index c2132c3fa..54e550426 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1213,5 +1213,4 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; .uploadKeyword {margin-bottom:10px; outline:none; border:1px solid #e6e6e6; height:30px; width:280px;} .mb10 {margin-bottom: 10px} .mb15 {margin-bottom: 15px} -div.disable_link {background-color: #c1c1c1 !important;} -div.disable_link :hover {background-color: #c1c1c1} \ No newline at end of file +div.disable_link {background-color: #c1c1c1 !important;} \ No newline at end of file From 120a7274d335023812a2f7dc52269d5f8d42df57 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 17:22:22 +0800 Subject: [PATCH 018/111] =?UTF-8?q?fork=E6=A0=B7=E5=BC=8F=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 4 +++- config/locales/mailers/zh.yml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index d8b7c4625..c41945885 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -27,7 +27,9 @@ -
<%= link_to "Fork", :controller => 'repositories', :action => 'forked'%> +
<%= link_to "".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn"%> + <%#= link_to "My span #{@user.profile.my_data}".html_safe, "#", class: 'button white' %> + <%= @project.forked_count.to_i %>
diff --git a/config/locales/mailers/zh.yml b/config/locales/mailers/zh.yml index 1d432cbff..97f0029ea 100644 --- a/config/locales/mailers/zh.yml +++ b/config/locales/mailers/zh.yml @@ -27,5 +27,5 @@ zh: mail_homework_endtime: "作业截止时间快到了!" mail_homework: "作业:" mail_anonymous_comment_close: "作业匿评已经关闭!" - mail_anonymous_comment_open: "作业匿评已经开启!" + mail_anonymous_comment_open: "作业匿评已经开启,请您关注!" mail_anonymous_comment_failed: "作业匿评开启失败!" \ No newline at end of file From 19c34de6432a72d54c1c5b562654da2533eeabd7 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Dec 2015 17:29:39 +0800 Subject: [PATCH 019/111] =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E6=97=B6=E5=BC=B9=E5=87=BA=E7=9A=84=E4=BD=9C=E5=93=81=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E6=A1=86=E4=B8=8D=E6=8F=90=E4=BE=9B=E9=87=8D=E8=AF=95?= =?UTF-8?q?=E7=9A=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_work_edit_information.html.erb | 33 +++++++++++++++++++ app/views/student_work/update.js.erb | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 app/views/student_work/_work_edit_information.html.erb diff --git a/app/views/student_work/_work_edit_information.html.erb b/app/views/student_work/_work_edit_information.html.erb new file mode 100644 index 000000000..38670d9e4 --- /dev/null +++ b/app/views/student_work/_work_edit_information.html.erb @@ -0,0 +1,33 @@ +
+
+ 请您确认刚刚上传的作品信息 +

+ 作品名称:<%=@student_work.name%> +

+

+ 作品描述:<%=@student_work.description%> +

+

+ 件: + <% if @student_work.attachments.empty? %> + <%= "无附件"%> + <% else %> +

+ <%= render :partial => 'work_attachments_status', :locals => {:attachments => @student_work.attachments, :status => 2} %> +
+ <% end %> +

+
+ +
+
+ + \ No newline at end of file diff --git a/app/views/student_work/update.js.erb b/app/views/student_work/update.js.erb index 79733db31..f485cb8cc 100644 --- a/app/views/student_work/update.js.erb +++ b/app/views/student_work/update.js.erb @@ -1,5 +1,5 @@ <% if @submit_result%> -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_information') %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/work_edit_information') %>'); showModal('ajax-modal', '500px'); $('#ajax-modal').siblings().remove(); $('#ajax-modal').before("" + From 6fad26cabf1c16c7cd566b59d931dae4ca7158b9 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 17:32:56 +0800 Subject: [PATCH 020/111] =?UTF-8?q?=E5=8E=BB=E6=AD=BB=E5=A5=A5placebold?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index c41945885..ca62b9664 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -22,7 +22,7 @@ <% else %> <%= render :partial => 'navigation' %>
克隆网址:
- + From ab4d0e46785d92818b0f5771426d72f3f7787b4d Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 4 Dec 2015 17:34:48 +0800 Subject: [PATCH 021/111] =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javascripts/org_subfields.js.coffee | 3 + app/assets/stylesheets/org_subfields.css.scss | 3 + app/controllers/org_subfields_controller.rb | 19 ++++++ app/helpers/org_subfields_helper.rb | 2 + app/models/org_subfield.rb | 3 + app/models/organization.rb | 1 + app/views/layouts/base_org.html.erb | 55 +---------------- app/views/org_subfields/create.js.erb | 4 ++ app/views/org_subfields/destroy.js.erb | 4 ++ app/views/org_subfields/update.js.erb | 1 + .../_org_left_subfield_list.html.erb | 60 +++++++++++++++++++ .../organizations/_subfield_list.html.erb | 51 ++++++++++++++++ app/views/organizations/setting.html.erb | 27 ++++++++- config/routes.rb | 4 ++ .../20151204030143_create_org_subfields.rb | 13 ++++ public/stylesheets/org.css | 12 +++- .../org_subfields_controller_spec.rb | 5 ++ 17 files changed, 211 insertions(+), 56 deletions(-) create mode 100644 app/assets/javascripts/org_subfields.js.coffee create mode 100644 app/assets/stylesheets/org_subfields.css.scss create mode 100644 app/controllers/org_subfields_controller.rb create mode 100644 app/helpers/org_subfields_helper.rb create mode 100644 app/models/org_subfield.rb create mode 100644 app/views/org_subfields/create.js.erb create mode 100644 app/views/org_subfields/destroy.js.erb create mode 100644 app/views/org_subfields/update.js.erb create mode 100644 app/views/organizations/_org_left_subfield_list.html.erb create mode 100644 app/views/organizations/_subfield_list.html.erb create mode 100644 db/migrate/20151204030143_create_org_subfields.rb create mode 100644 spec/controllers/org_subfields_controller_spec.rb diff --git a/app/assets/javascripts/org_subfields.js.coffee b/app/assets/javascripts/org_subfields.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/org_subfields.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/org_subfields.css.scss b/app/assets/stylesheets/org_subfields.css.scss new file mode 100644 index 000000000..19263385e --- /dev/null +++ b/app/assets/stylesheets/org_subfields.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the org_subfields controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb new file mode 100644 index 000000000..da20b6fcf --- /dev/null +++ b/app/controllers/org_subfields_controller.rb @@ -0,0 +1,19 @@ +class OrgSubfieldsController < ApplicationController + def create + @subfield = OrgSubfield.create(:name => params[:name]) + @organization = Organization.find(params[:organization_id]) + @organization.org_subfields << @subfield + @subfield.update_attributes(:priority => @subfield.id) + end + + def destroy + @subfield = OrgSubfield.find(params[:id]) + @organization = Organization.find(@subfield.organization_id) + @subfield.destroy + end + + def update + @subfield = OrgSubfield.find(params[:id]) + @subfield.update_attributes(:name => params[:name]) + end +end diff --git a/app/helpers/org_subfields_helper.rb b/app/helpers/org_subfields_helper.rb new file mode 100644 index 000000000..a9f8a396f --- /dev/null +++ b/app/helpers/org_subfields_helper.rb @@ -0,0 +1,2 @@ +module OrgSubfieldsHelper +end diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb new file mode 100644 index 000000000..1660310f8 --- /dev/null +++ b/app/models/org_subfield.rb @@ -0,0 +1,3 @@ +class OrgSubfield < ActiveRecord::Base + belongs_to :organization, :foreign_key => :organization_id +end \ No newline at end of file diff --git a/app/models/organization.rb b/app/models/organization.rb index a35f68c26..350dc3080 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -6,6 +6,7 @@ class Organization < ActiveRecord::Base has_many :courses, :through => :org_courses has_many :org_document_comments, :dependent => :destroy has_many :org_courses, :dependent => :destroy + has_many :org_subfields, :dependent => :destroy has_many :users, :through => :org_members validates_uniqueness_of :name after_create :save_as_org_activity diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index b071a7c3b..aa46c35ee 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -81,59 +81,8 @@ <%= link_to '成员', members_organization_path(@organization.id) %> (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>)
-
-
- <%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %> -
-
- 项目 - <%=link_to "", join_project_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> - - - - - - - - - - - - - -
-
-
    - <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.projects.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=>1}%> - - - - -
-
-
- 课程 - <%=link_to "", join_course_menu_organization_path(@organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> - <%#= link_to "关联课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%> - - - - - - - - - - - - - -
-
-
    - <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>@organization.courses.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=>1}%> -
-
+
+ <%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %>
diff --git a/app/views/org_subfields/create.js.erb b/app/views/org_subfields/create.js.erb new file mode 100644 index 000000000..8a676e93e --- /dev/null +++ b/app/views/org_subfields/create.js.erb @@ -0,0 +1,4 @@ +$("#org_subfield_list").html(""); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>"); +$("#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 diff --git a/app/views/org_subfields/destroy.js.erb b/app/views/org_subfields/destroy.js.erb new file mode 100644 index 000000000..8a676e93e --- /dev/null +++ b/app/views/org_subfields/destroy.js.erb @@ -0,0 +1,4 @@ +$("#org_subfield_list").html(""); +$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'organizations/subfield_list',:locals => {:subfields => @organization.org_subfields }) %>"); +$("#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 diff --git a/app/views/org_subfields/update.js.erb b/app/views/org_subfields/update.js.erb new file mode 100644 index 000000000..2def5c5f8 --- /dev/null +++ b/app/views/org_subfields/update.js.erb @@ -0,0 +1 @@ +$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>"); \ No newline at end of file diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb new file mode 100644 index 000000000..7c30aa600 --- /dev/null +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -0,0 +1,60 @@ +
+ <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %> +
+
+ 项目 + <%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> + + + + + + + + + + + + + +
+
+
    + <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> + + + + +
+
+
+ 课程 + <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> + <%#= link_to "关联课程",join_course_menu_organization_path(organization),:remote => true,:class => "menuGrey",:method => "post"%> + + + + + + + + + + + + + +
+
+
    + <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> +
+
+<% organization.org_subfields.each do |field| %> +
+ <%= field.name %> + <%=link_to "", :title => "关联#{field.name}"%> +
+
+
+<% end %> \ No newline at end of file diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb new file mode 100644 index 000000000..f148fc561 --- /dev/null +++ b/app/views/organizations/_subfield_list.html.erb @@ -0,0 +1,51 @@ + +
    +
  • 已有栏目
  • +
  • 状态
  • +
    +
+
    +
  • 动态
  • +
  • 默认
  • +
    +
+
    +
  • 项目
  • +
  • 默认
  • +
    +
+
    +
  • 课程
  • +
  • 默认
  • +
    +
+ <% subfields.each do |field| %> +
    +
  • <%= field.name %>
  • +
  • 新增
  • + <%= link_to "删除",org_subfield_path(field), :method => 'delete',:remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr5" %> + 编辑 +
    +
+ <% end %> + + \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 96fef706a..138a7993a 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -2,7 +2,7 @@ function g(o){return document.getElementById(o);} function HoverLi(n){ //如果有N个标签,就将i<=N; - for(var i=1;i<=2;i++){ + for(var i=1;i<=3;i++){ g('orgSetting_'+i).className='orgSettingOp'; g('orgContent_'+i).className='undis';} g('orgContent_'+n).className='dis ml15 mr15'; @@ -34,6 +34,7 @@
  • 信息
  • 成员
  • +
  • 分栏
@@ -104,4 +105,26 @@
- \ No newline at end of file +
+
+ <%= render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields } %> +
+
+
+

新增栏目

+ <%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %> + +
+ 确定 + <% end %> +
+
+
+
+ + \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index bb6d7b940..27e9d7861 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -70,6 +70,10 @@ RedmineApp::Application.routes.draw do end end + resources :org_subfields do + + end + resources :org_document_comments do member do post 'add_reply' diff --git a/db/migrate/20151204030143_create_org_subfields.rb b/db/migrate/20151204030143_create_org_subfields.rb new file mode 100644 index 000000000..2727cdef0 --- /dev/null +++ b/db/migrate/20151204030143_create_org_subfields.rb @@ -0,0 +1,13 @@ +class CreateOrgSubfields < ActiveRecord::Migration + def up + create_table :org_subfields do |t| + t.integer :organization_id + t.integer :priority + t.string :name + t.timestamps + end + end + + def down + end +end diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index a0118b263..897eb8734 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -54,4 +54,14 @@ a.cancelBtn:hover {background-color:#717171; color:#ffffff;} /*关联项目弹窗*/ .projectRelate {float:left; max-height:118px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden; width:288px;} -.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;} \ No newline at end of file +.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;} + +/*组织首页新151204Tim*/ +.orgNav {width:1000px; height:30px; background-color:#cfcfcf; margin:0 auto;} +.orgContainer {width:100%; margin:0 auto; background-color:#cfcfcf;} +.navOrgLogo {width:21px; height:30px; margin-left:2px; margin-right:15px;} +.navOrgMenu {display:inline-block;height:30px; line-height:30px; vertical-align:middle;} +a.linkGrey8 {color:#888888;} +a.linkGrey8:hover {color:#585858;} +.orgBorder {width:583px; height:21px; border-bottom:3px solid #e4e4e4; float:left;} +.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px; color:#555555;} \ No newline at end of file diff --git a/spec/controllers/org_subfields_controller_spec.rb b/spec/controllers/org_subfields_controller_spec.rb new file mode 100644 index 000000000..4bc89dae0 --- /dev/null +++ b/spec/controllers/org_subfields_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrgSubfieldsController, :type => :controller do + +end From 4cb58211ad9a79696c3648f21ef398494160e021 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 17:44:46 +0800 Subject: [PATCH 022/111] =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=AD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/mailer/send_mail_anonymous_comment_open.html.erb | 2 +- config/locales/mailers/zh.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/mailer/send_mail_anonymous_comment_open.html.erb b/app/views/mailer/send_mail_anonymous_comment_open.html.erb index 5409ade55..3aa3d1c21 100644 --- a/app/views/mailer/send_mail_anonymous_comment_open.html.erb +++ b/app/views/mailer/send_mail_anonymous_comment_open.html.erb @@ -2,7 +2,7 @@
  • <%= l(:mail_issue_content)%> -

    <%=link_to @author, user_url(@author) %> 发布的作业:<%=link_to @anonymous_comment_close_name, @anonymous_comment_close_url%> 已经开启匿评了!

    +

    <%=link_to @author, user_url(@author) %> 发布的作业:<%=link_to @anonymous_comment_close_name, @anonymous_comment_close_url%> 已经开启匿评了,请您关注!

diff --git a/config/locales/mailers/zh.yml b/config/locales/mailers/zh.yml index 97f0029ea..7b56011b1 100644 --- a/config/locales/mailers/zh.yml +++ b/config/locales/mailers/zh.yml @@ -26,6 +26,6 @@ zh: mail_attention: "请您关注!" mail_homework_endtime: "作业截止时间快到了!" mail_homework: "作业:" - mail_anonymous_comment_close: "作业匿评已经关闭!" + mail_anonymous_comment_close: "作业匿评已经关闭,请您关注!" mail_anonymous_comment_open: "作业匿评已经开启,请您关注!" - mail_anonymous_comment_failed: "作业匿评开启失败!" \ No newline at end of file + mail_anonymous_comment_failed: "作业匿评开启失败,请您关注!" \ No newline at end of file From 5b0bdb5069f7f5c4faae4853187890ae1545da5c Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 4 Dec 2015 18:19:35 +0800 Subject: [PATCH 023/111] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E7=9A=84=E5=86=85=E5=AE=B9=E5=8F=8A=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_org_left_subfield_list.html.erb | 4 ++-- app/views/organizations/_subfield_list.html.erb | 11 ++++++++--- app/views/organizations/setting.html.erb | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 7c30aa600..52201fd52 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -45,7 +45,7 @@ -
+
    <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
@@ -55,6 +55,6 @@ <%= field.name %> <%=link_to "", :title => "关联#{field.name}"%>
-
+ <% end %> \ No newline at end of file diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index f148fc561..6ba60245a 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -34,7 +34,12 @@ function edit(show_id, edit_id){ $(show_id).toggle(); $(edit_id).toggle(); - $(edit_id).focus(); + $(edit_id).find('input').focus(); + $(edit_id).find('input').on('keypress',function(e){ + if(e.keyCode == 13){ + this.blur(); + } + }) } function update_subfield(show_id, edit_id, field_id, input_value) { if ($(show_id).html().trim() != input_value.trim()) { @@ -44,8 +49,8 @@ type :'put' }); } - $(show_id).show(); - $(edit_id).hide(); + $(show_id).show(); + $(edit_id).hide(); // $(edit_id).focus(); } \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 138a7993a..e0f262b99 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -34,7 +34,7 @@
  • 信息
  • 成员
  • -
  • 分栏
  • +
  • 栏目
From 01b82e59d80d0ad3e5cf1381b68f8f2e5b682bef Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Sat, 5 Dec 2015 11:30:05 +0800 Subject: [PATCH 024/111] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 1 + app/controllers/organizations_controller.rb | 13 +- app/views/layouts/base_organization.html.erb | 113 ++++++++++++++++++ app/views/org_subfields/update.js.erb | 4 +- .../_org_left_subfield_list.html.erb | 34 +----- app/views/organizations/show.html.erb | 4 +- public/images/home_logo.png | Bin 0 -> 1213 bytes 7 files changed, 134 insertions(+), 35 deletions(-) create mode 100644 app/views/layouts/base_organization.html.erb create mode 100644 public/images/home_logo.png diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index da20b6fcf..6fdf0ae40 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -14,6 +14,7 @@ class OrgSubfieldsController < ApplicationController def update @subfield = OrgSubfield.find(params[:id]) + @organization = Organization.find(@subfield.organization_id) @subfield.update_attributes(:name => params[:name]) end end diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 85f57917b..47a0930a5 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -94,7 +94,11 @@ class OrganizationsController < ApplicationController end @page = params[:page] respond_to do |format| - format.html + format.html { + if !params[:show_homepage].nil? + render :layout => 'base_organization' + end + } format.js end else @@ -102,6 +106,13 @@ class OrganizationsController < ApplicationController end end + def homepage + @organization = Organization.find(params[:id]) + respond_to do |format| + format.html {render :layout => 'base_organization'} + end + end + def update @organization = Organization.find(params[:id]) @organization.name = params[:organization][:name] diff --git a/app/views/layouts/base_organization.html.erb b/app/views/layouts/base_organization.html.erb new file mode 100644 index 000000000..653708bab --- /dev/null +++ b/app/views/layouts/base_organization.html.erb @@ -0,0 +1,113 @@ + + +<%= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %> +<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','org'%> + + + 课程主页 + + + + + + + + + +
+
+ + + +
+
+
+
+
+
+ + + +
+ <%= link_to @organization.name, organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %> + <% if @organization.is_public? %> + <%= l(:label_public)%> + <% else %> + <%= l(:label_private)%> + <% end %> +
+ + <% if User.current.admin_of_org?(@organization) and params[:show_homepage].nil? %> + 配置 + <% end %> + +
+
+ <%= link_to '文章', organization_org_document_comments_path(@organization) %> ( + <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> + ) |  + <%= link_to '成员', members_organization_path(@organization.id) %> (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) +
+
+
+ <%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %> +
+
+
+ <%= render_flash_messages %> + <%= yield %> + <%= call_hook :view_layouts_base_content %> +
+
+
+
+
+ + + diff --git a/app/views/org_subfields/update.js.erb b/app/views/org_subfields/update.js.erb index 2def5c5f8..06982ccfc 100644 --- a/app/views/org_subfields/update.js.erb +++ b/app/views/org_subfields/update.js.erb @@ -1 +1,3 @@ -$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>"); \ No newline at end of file +$("#subfield_show_<%= @subfield.id %>").html("<%= @subfield.name %>"); +$("#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 diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 52201fd52..3bfabf5ae 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -1,49 +1,21 @@ +
+ <%= link_to "组织首页",organization_path(@organization, :show_homepage => 1), :class => 'homepageMenuText', :target => '_blank' %> +
<%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
项目 <%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> - - - - - - - - - - - - -
    <%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> - - - -
课程 <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> - <%#= link_to "关联课程",join_course_menu_organization_path(organization),:remote => true,:class => "menuGrey",:method => "post"%> - - - - - - - - - - - - -
    diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index 9e0fc365c..9ee9d11c0 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -12,6 +12,7 @@ .homepagePostReplyInputContainer .ke-inline-block {display: none;} .homepagePostReplyInputContainer .ke-container {float: left;} +<% if params[:show_homepage].nil? %>
    最新动态
      @@ -49,9 +50,8 @@
-
- +<% end %> <% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %> + +
- +
    - + <% if User.current.logged? %> <% else %> @@ -73,10 +87,12 @@
    <%= link_to @organization.name, organization_path(@organization.id), :class=>"pr_info_name fl c_dark fb break_word" %> - <% if @organization.is_public? %> - <%= l(:label_public)%> - <% else %> - <%= l(:label_private)%> + <% if User.current.logged? %> + <% if @organization.is_public? %> + <%= l(:label_public)%> + <% else %> + <%= l(:label_private)%> + <% end %> <% end %>
    @@ -95,10 +111,17 @@
    - <%= link_to '文章', organization_org_document_comments_path(@organization) %> ( - <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> - ) |  - <%= link_to '成员', members_organization_path(@organization.id) %> (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) + <%= link_to '文章', organization_org_document_comments_path(@organization) %>  + <% if User.current.logged? %> + ( + <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> + ) + <% end %> +  |  + <%= link_to '成员', members_organization_path(@organization.id) %>  + <% if User.current.logged? %> + (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) + <% end %>
@@ -152,6 +175,17 @@ $("#projectMenu").mouseleave(function(){ $("#topnav_project_menu").hide(); }); + + function show_homepage(id, has_homepage){ + if (has_homepage == 1) + { + window.location.href = "/organizations/" + id + "?show_homepage=1"; + } + else + { + alert("您还没有设置首页! 您可以把您喜欢的文章设为组织首页。"); + } + } diff --git a/app/views/organizations/_join_course_menu.html.erb b/app/views/organizations/_join_course_menu.html.erb index d875550de..fa507db28 100644 --- a/app/views/organizations/_join_course_menu.html.erb +++ b/app/views/organizations/_join_course_menu.html.erb @@ -22,11 +22,10 @@ -
+
请选择关联到组织的课程
-
<%=form_tag url_for(:controller => 'organizations', :action => 'join_courses', :organization_id => organization_id),:method => 'post', :id => 'join_courses_form', :remote => true,:class=>"resourcesSearchBox" do %> @@ -42,7 +41,7 @@
-
+ + $(document).ready(function(){ + $("#orgUser,#orgSwitch").click(function(){ + $(".org_login_list").toggle(); + if($("#orgArrow").attr("class") == "orgMenuArrow"){ + $("#orgArrow").attr("class","orgMenuArrow2"); + } + else { + $("#orgArrow").attr("class","orgMenuArrow") ; + } + }); + if($(".org_login_list").children().click){ + $(".org_login_list").css("display","none"); + $("#orgArrow").attr("class","orgMenuArrow"); + }; + }); + diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css index 897eb8734..220120346 100644 --- a/public/stylesheets/org.css +++ b/public/stylesheets/org.css @@ -64,4 +64,8 @@ a.cancelBtn:hover {background-color:#717171; color:#ffffff;} a.linkGrey8 {color:#888888;} a.linkGrey8:hover {color:#585858;} .orgBorder {width:583px; height:21px; border-bottom:3px solid #e4e4e4; float:left;} -.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px; color:#555555;} \ No newline at end of file +.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px; color:#555555;} +.orgMenuArrow {background:url(../images/nav_icon.png) -10px -165px no-repeat; position:relative; display:inline-block; width:20px; height:30px;} +.orgMenuArrow2 {background:url(../images/nav_icon.png) -10px -132px no-repeat; position:relative; display:inline-block; width:20px; height:30px;} +.org_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-53px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 30px;} +#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;} \ No newline at end of file From 9f30c7a44e9ebb1309950642e25d11fa51c8c64e Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Dec 2015 14:37:35 +0800 Subject: [PATCH 038/111] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=99=BB=E9=99=86=EF=BC=8C=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=9C=A8=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E6=88=96=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_left_subfield_list.html.erb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 065d362d6..cb604f6ba 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -3,7 +3,9 @@
项目 - <%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> + <% if User.current.logged? %> + <%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%> + <% end %>
    @@ -12,7 +14,9 @@
课程 - <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> + <% if User.current.logged? %> + <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%> + <% end %>
    From 5eb249515c7244cdcc2600e4a68d70e463c02d60 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 7 Dec 2015 15:12:30 +0800 Subject: [PATCH 039/111] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index be303a2ab..259e8c185 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -28,10 +28,9 @@ <% unless User.current.id == @project.user_id %>
    <%= link_to "".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn"%> + <%= @project.forked_count.to_i %> +
    <% end %> - <%#= link_to "My span #{@user.profile.my_data}".html_safe, "#", class: 'button white' %> - - <%= @project.forked_count.to_i %>
<% if @changesets && !@changesets.empty? %> @@ -53,12 +52,14 @@ - <%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %> 提交 - + <%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, + :repository_id => @repository.identifier_param, + :rev => @rev,:page=>1 , + :commit_count =>"#{@changesets_all_count}"} %> 提交
<% end %> -
+ <% if !@entries.nil? && authorize_for('repositories', 'browse') %> @@ -67,14 +68,14 @@ <%# end %> <%= render :partial => 'dir_list' %> <% end %> -<%= render_properties(@properties) %> +<%#= render_properties(@properties) %> -<%= render_properties(@properties) %> +<%#= render_properties(@properties) %> 如何提交代码 - +
<% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> <% end %> From 8e999ed9f00a5bff6f67d5c5e0f58b5b8c02e7ae Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 7 Dec 2015 15:18:32 +0800 Subject: [PATCH 040/111] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E5=A4=8D=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=8F=AA=E5=9C=A8=E9=BC=A0=E6=A0=87=E8=BF=9B=E5=85=A5=E6=97=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_homework.html.erb | 12 +++++++----- app/views/users/_user_homework_detail.html.erb | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 4e8553ee8..309b8b95a 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -142,7 +142,7 @@ }); <% replies_all_i = replies_all_i + 1 %> -
  • +
  • <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
    @@ -154,10 +154,12 @@ <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(comment.created_on) %> - <% if User.current.admin? ||is_teacher || comment.user == User.current%> - <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity}, - :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %> - <% end %> +
  • <%= comment.notes.html_safe %>
    diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 23f65e03e..5bf406c59 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -149,7 +149,7 @@ }); <% replies_all_i = replies_all_i + 1 %> -
  • +
  • <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
    @@ -161,10 +161,12 @@ <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(comment.created_on) %> - <% if User.current.admin? ||is_teacher || comment.user == User.current%> - <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course,:course_activity=>-1}, - :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %> - <% end %> +
  • <%= comment.notes.html_safe %>
    From ad2d9fa374bfd1d4e348de8bdf3f3fda6a1849d7 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 7 Dec 2015 15:32:57 +0800 Subject: [PATCH 041/111] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E7=9A=84=E5=85=A8=E6=96=87=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 640f98b1f..cc6415c14 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -173,19 +173,25 @@ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">关闭了作业匿评:
  • - <%= link_to "作业题目:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))"%>
  • <%= time_tag(ma.created_at).html_safe %>
  • From 76db95aa0339b85ad7fd168e9d89c45ed3996162 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Dec 2015 15:52:13 +0800 Subject: [PATCH 042/111] =?UTF-8?q?1.=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E9=80=80=E5=87=BA=E5=90=8E=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2=EF=BC=9B=202.=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E9=A1=B5=E9=9D=A2=E4=B8=AD=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E2=80=9C=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=E2=80=9D=EF=BC=8C?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=96=B0=E7=9A=84=E9=A1=B5=E9=9D=A2=EF=BC=9B?= =?UTF-8?q?=203.=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2=E9=A1=B5=E9=A6=96?= =?UTF-8?q?=E9=83=A8=E5=88=86=EF=BC=8C=E7=94=A8=E6=88=B7=E5=90=8D=E4=B8=8D?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E7=94=A8=E6=88=B7=E9=A1=B5=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 7 +++++++ app/views/layouts/base_org.html.erb | 7 ++++--- config/routes.rb | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 85f57917b..d182640ed 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -239,6 +239,13 @@ class OrganizationsController < ApplicationController end end + def logout + logout_user + respond_to do |format| + format.html {redirect_to organization_path(params[:id])} + end + end + def search_projects @organization = Organization.find(params[:id]) condition = '%%' diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 5af5c9ad0..4c33dcca5 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -46,12 +46,13 @@ - + <% else %> diff --git a/config/routes.rb b/config/routes.rb index 4e64ca505..15e41955d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -46,6 +46,7 @@ RedmineApp::Application.routes.draw do get 'search_projects' post 'join_project_menu' post 'join_projects' + post 'logout' end collection do get 'check_uniq' From 9e01f02a661890fe6700192da1dd8873d4d8fcae Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 7 Dec 2015 15:52:22 +0800 Subject: [PATCH 043/111] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E9=A2=98=E7=9B=AE?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=94=B9=E4=B8=BA=E4=BD=9C=E4=B8=9A=E6=A0=87?= =?UTF-8?q?=E9=A2=98=20=20=E4=BD=9C=E4=B8=9A=E5=8C=BF=E8=AF=84=E6=88=AA?= =?UTF-8?q?=E6=AD=A2=E6=B6=88=E6=81=AF=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index cc6415c14..4d838d4d1 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -45,12 +45,12 @@
  • <% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %> - <%= link_to "作业题目:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id), + <%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> <% else %> - <%= link_to "作业题目:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), + <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :onmouseover => "message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> @@ -103,7 +103,7 @@ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :title => "#{ma.course_message.user.lastname + ma.course_message.user.firstname}老师" %> ">发布的作业:
  • - <%= link_to "作业题目:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), + <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :onmouseover => "message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %> @@ -142,7 +142,7 @@ ">启动了作业匿评:
  • - <%= link_to "作业题目:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", + <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :onmouseover => "message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>
  • @@ -180,14 +180,14 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • + <% end %> <% end %> - + <% if ma.forge_message_type == "RemoveFromProject" %>
    • diff --git a/db/schema.rb b/db/schema.rb index 9ce76c447..91a9fbb5d 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 => 20151210110210) do +ActiveRecord::Schema.define(:version => 20151209085942) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -459,7 +459,7 @@ ActiveRecord::Schema.define(:version => 20151210110210) do t.integer "open_student", :default => 0 t.integer "outline", :default => 0 t.integer "publish_resource", :default => 0 - t.integer "is_delete" + t.integer "is_delete", :default => 0 end create_table "custom_fields", :force => true do |t| @@ -970,7 +970,6 @@ ActiveRecord::Schema.define(:version => 20151210110210) do t.integer "course_group_id", :default => 0 end - add_index "members", ["course_id"], :name => "index_members_on_course_id" add_index "members", ["project_id"], :name => "index_members_on_project_id" add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true add_index "members", ["user_id"], :name => "index_members_on_user_id" From f2b8335912c918facd7e47bd11064a8dc704ab80 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 13:48:52 +0800 Subject: [PATCH 090/111] =?UTF-8?q?=E7=A7=BB=E5=87=BA=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=88=A0=E9=99=A4=E9=A1=B9=E7=9B=AE=E5=90=8E?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E5=85=B3=E8=81=94=E5=88=A0=E9=99=A4=E8=80=8C?= =?UTF-8?q?=E5=BC=95=E8=B5=B7=E7=9A=84400=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_forge.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb index 4e42cd5ae..967941a88 100644 --- a/app/views/users/_user_message_forge.html.erb +++ b/app/views/users/_user_message_forge.html.erb @@ -57,6 +57,7 @@ <% end %> <% if ma.forge_message_type == "RemoveFromProject" %> + <% unless ma.project.nil? %> + <% end %> <% end %> <% if ma.forge_message_type == "ProjectInvite" %> From f880ccd749c81a99b2c2a23687de47f93522ffad Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 14:57:09 +0800 Subject: [PATCH 091/111] =?UTF-8?q?=E5=88=86=E7=BB=84=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_common_controller.rb | 39 +++-- app/controllers/student_work_controller.rb | 144 +++++++++++++++++- app/helpers/application_helper.rb | 28 +++- app/models/homework_common.rb | 2 +- app/models/project.rb | 2 +- app/models/student_work.rb | 2 +- app/models/user.rb | 2 +- .../_choose_group_member.html.erb | 108 +++++++++---- .../student_work/_evaluation_title.html.erb | 8 +- .../_evaluation_un_title.html.erb | 8 +- .../student_work/_evaluation_un_work.html.erb | 24 ++- .../student_work/_evaluation_work.html.erb | 55 ++++--- .../student_work/_relate_project.html.erb | 24 +-- app/views/student_work/_show.html.erb | 32 +++- .../student_work/_student_work_list.html.erb | 7 +- app/views/student_work/new.html.erb | 38 +++-- .../search_course_students.js.erb | 33 ++++ app/views/users/_course_homework.html.erb | 32 ++-- .../users/_user_homework_attachment.html.erb | 20 ++- .../users/_user_homework_detail.html.erb | 28 ++-- config/routes.rb | 1 + lib/tasks/homework_evaluation.rake | 35 ++++- public/images/course/proRelated.png | Bin 0 -> 1249 bytes public/javascripts/course.js | 22 ++- public/javascripts/new_user.js | 22 ++- 25 files changed, 562 insertions(+), 154 deletions(-) create mode 100644 app/views/student_work/search_course_students.js.erb create mode 100644 public/images/course/proRelated.png diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 67499655f..a8d6dfe8f 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -126,14 +126,33 @@ class HomeworkCommonController < ApplicationController if @homework_detail_manual.comment_status == 1 student_works = @homework.student_works if student_works && student_works.size >= 2 - student_works.each_with_index do |work, index| - user = work.user - n = @homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 - assigned_homeworks = get_assigned_homeworks(student_works, n, index) - assigned_homeworks.each do |h| - student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) - student_works_evaluation_distributions.save + if @homework.homework_type == 3 + student_work_projects = @homework.student_work_projects.where("student_work_id is not null") + student_work_projects.each_with_index do |pro_work, pro_index| + n = @homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + work_index = -1 + student_works.each_with_index do |stu_work, stu_index| + if stu_work.id.to_i == pro_work.student_work_id.to_i + work_index = stu_index + end + end + assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + else + student_works.each_with_index do |work, index| + user = work.user + n = @homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + assigned_homeworks = get_assigned_homeworks(student_works, n, index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) + student_works_evaluation_distributions.save + end end end @homework_detail_manual.update_column('comment_status', 2) @@ -143,7 +162,8 @@ class HomeworkCommonController < ApplicationController Mailer.send_mail_anonymous_comment_open(@homework).deliver else @statue = 2 - end + + end else @statue = 3 end @@ -277,6 +297,7 @@ class HomeworkCommonController < ApplicationController @homework = HomeworkCommon.find params[:id] @homework_detail_manual = @homework.homework_detail_manual @homework_detail_programing = @homework.homework_detail_programing + @homework_detail_group = @homework.homework_detail_group @course = @homework.course rescue render_404 diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index b50f6ea0f..f79646ade 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -3,7 +3,7 @@ class StudentWorkController < ApplicationController include StudentWorkHelper require 'bigdecimal' require "base64" - before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work,:revise_attachment] before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] @@ -95,12 +95,27 @@ class StudentWorkController < ApplicationController @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + else + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + end elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 - my_work = @homework.student_works.where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + my_work = @homework.student_works.where(:id => pro.student_work_id) + else + my_work = @homework.student_works.where(:user_id => User.current.id) + end @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + else + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + end if my_work.empty? @stundet_works = [] else @@ -116,12 +131,27 @@ class StudentWorkController < ApplicationController @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name @show_all = true elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + else + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + end elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 - my_work = @homework.student_works.where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + my_work = @homework.student_works.where(:id => pro.student_work_id) + else + my_work = @homework.student_works.where(:user_id => User.current.id) + end @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的 - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if @homework.homework_type == 3 + pro = @homework.student_work_projects.where(:user_id => User.current.id).first + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) + else + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + end if my_work.empty? @stundet_works = [] else @@ -190,6 +220,10 @@ class StudentWorkController < ApplicationController student_work.user_id = User.current.id student_work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(student_work) + if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 + @student_work_project = @homework.student_work_projects.where("user_id = #{User.current.id}").first + student_work.project_id = @student_work_project.project_id + end #提交作品时,计算是否迟交 if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") student_work.late_penalty = @homework.late_penalty @@ -197,6 +231,35 @@ class StudentWorkController < ApplicationController student_work.late_penalty = 0 end if student_work.save + if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 + @student_work_project.student_work_id = student_work.id + @student_work_project.save + members = params[:group_member_ids].split(',') + for i in 1 .. members.count-1 + stu_project = StudentWorkProject.new + stu_project.homework_common_id = @homework.id + stu_project.student_work_id = student_work.id + stu_project.project_id = @student_work_project.project_id + stu_project.user_id = members[i].to_i + stu_project.is_leader = 0 + stu_project.save + end + elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 + members = params[:group_member_ids].split(',') + for i in 0 .. members.count-1 + stu_project = StudentWorkProject.new + stu_project.homework_common_id = @homework.id + stu_project.student_work_id = student_work.id + stu_project.project_id = -1 + stu_project.user_id = members[i].to_i + if i == 0 + stu_project.is_leader = 1 + else + stu_project.is_leader = 0 + end + stu_project.save + end + end course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first if course_activity course_activity.updated_at = Time.now @@ -276,6 +339,18 @@ class StudentWorkController < ApplicationController def destroy if @work.destroy + if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 + pros = @work.student_work_projects.where("is_leader = 0") + pros.each do |pro| + pro.destroy + end + project = @work.student_work_projects.where("is_leader = 1").first + project.update_attributes(:student_work_id => nil) + elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 + @work.student_work_projects.each do |pro2| + pro2.destroy + end + end respond_to do |format| format.html { redirect_to student_work_index_url(:homework => @homework.id) @@ -288,12 +363,36 @@ class StudentWorkController < ApplicationController @work = StudentWork.where("user_id =? and homework_common_id =?", User.current.id, @homework.id).first if @work @work.destroy + if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 + pros = @work.student_work_projects.where("is_leader = 0") + pros.each do |pro| + pro.destroy + end + project = @work.student_work_projects.where("is_leader = 1").first + project.update_attributes(:student_work_id => nil) + elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 + @work.student_work_projects.each do |pro2| + pro2.destroy + end + end end redirect_to user_homeworks_user_path(User.current.id) end def retry_work if @work.destroy + if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 + pros = @work.student_work_projects.where("is_leader = 0") + pros.each do |pro| + pro.destroy + end + project = @work.student_work_projects.where("is_leader = 1").first + project.update_attributes(:student_work_id => nil) + elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 + @work.student_work_projects.each do |pro2| + pro2.destroy + end + end @student_work = StudentWork.new respond_to do |format| format.js @@ -555,6 +654,7 @@ class StudentWorkController < ApplicationController @project.homework_common_id = @homework.id @project.project_id = (Project.find params[:projectName].to_i).id @project.user_id = User.current.id + @project.is_leader = 1 if @project.save @user_activity_id = params[:user_activity_id].to_i @is_in_course = params[:is_in_course].to_i @@ -579,6 +679,20 @@ class StudentWorkController < ApplicationController end end + #查找课程的学生 + def search_course_students + name = "" + unless params[:name].nil? + name = params[:name] + end + all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" + all_students = User.where("id in #{all_student_ids}") + @users = searchstudent_by_name all_students,name + respond_to do |format| + format.js + end + end + def cancel_relate_project relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first if relate_pro.destroy @@ -592,6 +706,22 @@ class StudentWorkController < ApplicationController end private + def searchstudent_by_name users, name + mems = [] + if name != "" + name = name.to_s.downcase + users.each do |m| + username = m.lastname.to_s.downcase + m.firstname.to_s.downcase + if(m.login.to_s.downcase.include?(name) || m.user_extensions[:student_id].to_s.downcase.include?(name) || username.include?(name)) + mems << m + end + end + else + mems = users + end + mems + end + def hsd_committed_work?(user, homework) sw = StudentWork.where("user_id =? and homework_common_id =?", user, homework).first sw.nil? ? result = false : result = true diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a19d44997..8f4679c67 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2435,10 +2435,19 @@ module ApplicationHelper link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" else #学生显示提交作品、修改作品等按钮 work = cur_user_works_for_homework homework + project = cur_user_projects_for_homework homework if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") - link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1 + link_to "提交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品' + else + link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue' + end elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") - link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red' + if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1 + link_to "补交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品' + else + link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red' + end else if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前 link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品" @@ -2462,7 +2471,7 @@ module ApplicationHelper def relate_project homework,is_teacher,is_in_course,user_activity_id,course_activity if User.current.member_of_course?(homework.course) if is_teacher - link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" + #link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" else projects = cur_user_projects_for_homework homework works = cur_user_works_for_homework homework @@ -2471,7 +2480,7 @@ module ApplicationHelper elsif works.nil? link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework.id,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' else - link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" + #link_to "已关联(#{homework.student_work_projects.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" end end end @@ -2492,7 +2501,16 @@ module ApplicationHelper #获取当前用户在指定作业下提交的作业的集合 def cur_user_works_for_homework homework - homework.student_works.where("user_id = ?",User.current).first + work = homework.student_works.where("user_id = ?",User.current).first + if homework.homework_type == 3 + pro = homework.student_work_projects.where("user_id = #{User.current.id}").first + if pro.nil? || pro.student_work_id == "" || pro.student_work_id.nil? + work = nil + else + work = StudentWork.find pro.student_work_id + end + end + work end #获取当前用户在指定作业下关联的项目的集合 def cur_user_projects_for_homework homework diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index a665909e2..0ad667bd1 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -10,7 +10,7 @@ class HomeworkCommon < ActiveRecord::Base has_one :homework_detail_manual, :dependent => :destroy has_one :homework_detail_programing, :dependent => :destroy has_one :homework_detail_group, :dependent => :destroy - has_many :student_work_projects + has_many :student_work_projects, :dependent => :destroy has_many :homework_tests, :dependent => :destroy has_many :student_works, :dependent => :destroy, :conditions => "is_test=0" has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 diff --git a/app/models/project.rb b/app/models/project.rb index a80982413..44b9a7912 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -43,7 +43,7 @@ class Project < ActiveRecord::Base end end - has_many :student_work_projects + has_many :student_work_projects,:dependent => :destroy has_many :student_works has_many :time_entry_activities has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}" diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 59b98b9b2..c6e2a6584 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -4,7 +4,7 @@ class StudentWork < ActiveRecord::Base belongs_to :homework_common belongs_to :user - has_one :student_work_project + has_many :student_work_projects has_many :student_works_evaluation_distributions, :dependent => :destroy has_many :student_works_scores, :dependent => :destroy belongs_to :project diff --git a/app/models/user.rb b/app/models/user.rb index fa6f005b6..1c5d1b0c8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -107,7 +107,7 @@ class User < Principal has_many :student_works, :dependent => :destroy has_many :student_works_evaluation_distributions, :dependent => :destroy has_many :student_works_scores, :dependent => :destroy - has_many :student_work_projects + has_many :student_work_projects, :dependent => :destroy #end has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)}, diff --git a/app/views/student_work/_choose_group_member.html.erb b/app/views/student_work/_choose_group_member.html.erb index 4671dd2a5..1ec8ed0fa 100644 --- a/app/views/student_work/_choose_group_member.html.erb +++ b/app/views/student_work/_choose_group_member.html.erb @@ -9,36 +9,88 @@ -
        -
      • - 同学一(061530301) -
      • -
      • - 同学二同学二(061530302) -
      • -
      • - 同学三(061530303) -
      • -
      • - 同学四同学四(061530304) -
      • -
      • - 同学五同学五(061530305) -
      • -
      • - 同学六同学六(061530306) -
      • -
      • - 同学七同学七(061530307) -
      • -
      +
        -
          -
        • TimTang(040930319)×
        • -
        • suntao(060930106)×
        • +
            +
          • <%=User.current.show_name %> + <% unless User.current.user_extensions.student_id == "" %> + (<%=User.current.user_extensions.student_id %>) + <% end %> +
          - +
          - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/student_work/_evaluation_title.html.erb b/app/views/student_work/_evaluation_title.html.erb index cfd9632c2..7398dbee1 100644 --- a/app/views/student_work/_evaluation_title.html.erb +++ b/app/views/student_work/_evaluation_title.html.erb @@ -1,8 +1,12 @@
          • 作品名称 - 姓名 - 学号 + <% if @homework.homework_type != 3 %> + 姓名 + 学号 + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> + 关联项目 + <% end %>
          • diff --git a/app/views/student_work/_evaluation_un_title.html.erb b/app/views/student_work/_evaluation_un_title.html.erb index 4ed0a538a..9988bd6e0 100644 --- a/app/views/student_work/_evaluation_un_title.html.erb +++ b/app/views/student_work/_evaluation_un_title.html.erb @@ -1,8 +1,12 @@
            • 作品名称 - 姓名 - 学号 + <% if @homework.homework_type != 3 %> + 姓名 + 学号 + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> + 关联项目 + <% end %>
            • diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb index 2a0962244..641405fe4 100644 --- a/app/views/student_work/_evaluation_un_work.html.erb +++ b/app/views/student_work/_evaluation_un_work.html.erb @@ -13,14 +13,22 @@
            • -
                -
              • - <%= student_work.user.show_name%> -
              • -
              • - <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> -
              • -
              + <% if @homework.homework_type != 3 %> +
                +
              • + <%= student_work.user.show_name%> +
              • +
              • + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> +
              • +
              + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> +
                +
              • + <%= student_work.project.name %> +
              • +
              + <% end %>
            diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index e336b0282..58f611b55 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -1,6 +1,11 @@
              - <% is_my_work = student_work.user == User.current%> + <% if @homework.homework_type != 3 %> + <% is_my_work = student_work.user == User.current%> + <% else %> + <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> + <% is_my_work = pro && pro.student_work_id == student_work.id%> + <% end %>
              • <% if is_my_work%> @@ -14,14 +19,22 @@
              • -
                  -
                • - <%= student_work.user.show_name%> -
                • -
                • - <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> -
                • -
                + <% if @homework.homework_type != 3 %> +
                  +
                • + <%= student_work.user.show_name%> +
                • +
                • + <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> +
                • +
                + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> +
                  +
                • + <%= student_work.project.name %> +
                • +
                + <% end %>
              • <% else%>
              • @@ -33,14 +46,22 @@
              • -
                  -
                • - 匿名 -
                • -
                • - -- -
                • -
                + <% if @homework.homework_type != 3 %> +
                  +
                • + 匿名 +
                • +
                • + -- +
                • +
                + <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %> +
                  +
                • + 匿名 +
                • +
                + <% end %>
              • <% end%> diff --git a/app/views/student_work/_relate_project.html.erb b/app/views/student_work/_relate_project.html.erb index bcfd9eb8e..43f59c9c9 100644 --- a/app/views/student_work/_relate_project.html.erb +++ b/app/views/student_work/_relate_project.html.erb @@ -7,28 +7,6 @@

                  -
                  @@ -56,7 +34,7 @@ },500); } - //查询组织 + //查询项目 $("input[name='project']").on('input', function (e) { throttle(search_pros,window,e); }); diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 993b0f2aa..801c252cb 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -1,5 +1,12 @@
                  + <% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %> + <% if @homework.homework_type != 3 %> + <% is_my_work = work.user == User.current%> + <% else %> + <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> + <% is_my_work = pro && pro.student_work_id == work.id%> + <% end %>
                  • 上交时间: @@ -15,7 +22,7 @@ <%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%>
                  • <% end%> - <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> + <% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %>
                  • <%= render :partial => 'student_work_praise' %> @@ -25,11 +32,24 @@ - <% if work.project%> -
                  • - 关联项目: - <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> + <% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %> +
                    +
                  • + 参与人员: + <%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%> + <% members = work.student_work_projects.where("is_leader = 0") %> + <% members.each do |member| if !members.empty? %> + 、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %> + <% end %> + <% end %>
                  • + <% if @homework.homework_detail_group.base_on_project == 1 %> +
                  • + 关联项目: + <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> + (综合评分:<%=work.project.project_score.score.to_i %>) +
                  • + <% end %> <% end%>
                  • @@ -52,7 +72,7 @@
                  • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current)%> + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
                    <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> diff --git a/app/views/student_work/_student_work_list.html.erb b/app/views/student_work/_student_work_list.html.erb index e9b056c84..5598092e9 100644 --- a/app/views/student_work/_student_work_list.html.erb +++ b/app/views/student_work/_student_work_list.html.erb @@ -40,12 +40,17 @@ <% end%>
                    - <% if student_work.user == User.current && !@is_evaluation %> + <% if @homework.homework_type != 3 && student_work.user == User.current && !@is_evaluation %> <% if @homework.homework_type == 2%> <%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> <% else %> <%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> <% end %> + <% elsif @homework.homework_type == 3 %> + <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> + <% if pro && pro.student_work_id == student_work.id && !@is_evaluation %> + <%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %> + <% end %> <% end %>
                    diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index d14da5fa2..c3a61d4c8 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -54,11 +54,21 @@ function popupRegex(){ if(regexStudentWorkName()&®exStudentWorkDescription()) { - $('#ajax-modal').html("

                    作品信息完整性校验中,请稍等...

                    "); - showModal('ajax-modal', '500px'); - $('#ajax-modal').siblings().remove(); - $('#ajax-modal').parent().css("top","").css("left",""); - $('#ajax-modal').parent().addClass("anonymos"); + if($("#group_member_ids").length > 0) { + if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { + $('#ajax-modal').html("

                    作品信息完整性校验中,请稍等...

                    "); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); + } + } else { + $('#ajax-modal').html("

                    作品信息完整性校验中,请稍等...

                    "); + showModal('ajax-modal', '500px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("anonymos"); + } } } @@ -106,7 +116,11 @@ 提示:作品名称和描述中不要出现真实的姓名信息
                    - + <% if @homework.homework_type == 3 %> + + + <%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %> + <% end %>
                    <%= f.text_field "name", :required => true, :size => 60, :class => "InputBox W700", :maxlength => 200, :placeholder => "请简洁的概括作品的功能或特性", :onkeyup => "regexStudentWorkName();" %>
                    @@ -125,12 +139,16 @@
                    <%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false,:has_group=>false} %>
                    +
                    +
                    +
                    +
                    - <%# if @homework.homework_type == 3 %> - - <%# end %> +
                    + <% end %> + 已关联项目:
                  - <% activity.student_work_projects.each do |pro| %> + <% activity.student_work_projects.where("is_leader = 1").each do |pro| %>
                  - <% project = Project.find pro.project_id %> + <% project = Project.find pro.project_id || User.current.member_of?(project) || User.current.admin? %> <% if project.is_public || project.user_id == User.current.id %> <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:alt =>"项目头像" %> <% else %> diff --git a/app/views/users/_user_homework_attachment.html.erb b/app/views/users/_user_homework_attachment.html.erb index f1c0ae97e..7aefbd0b0 100644 --- a/app/views/users/_user_homework_attachment.html.erb +++ b/app/views/users/_user_homework_attachment.html.erb @@ -43,7 +43,25 @@ :lebel_file_uploding => l(:lebel_file_uploding), :delete_all_files => l(:text_are_you_sure_all) } %> - + +
                  + +
                  + <% if @homework && @homework.homework_type == 3 %> + + 合作成员:<%=User.current.show_name %>(组长) + + + <% end %> +
                  + + <% if @homework %> + <% unless @homework.student_work_projects.where("user_id = #{User.current.id}").empty? %> + <% project = Project.find @homework.student_work_projects.where("user_id = #{User.current.id}").first.project_id %> + 关联项目:<%=project.name %> + <% end %> + <% end %> +
                  diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 8e01ee908..57fe57c07 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -49,10 +49,19 @@ 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合! <% end %>
                  - <% if homework_common.homework_type == 3%> -
                  - <%= relate_project(homework_common,is_teacher,is_in_course,-1,-1) %> -
                  + <% if homework_common.homework_type == 3 && !is_teacher && homework_common.homework_detail_group.base_on_project == 1%> + <% projects = cur_user_projects_for_homework homework_common %> + <% works = cur_user_works_for_homework homework_common %> + <% if works.nil? && projects.nil? %> +
                  + <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1),remote: true,:class=> 'c_blue', :title=> '请选择分组作业关联的项目' %> + <%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %> +
                  + <% elsif works.nil? %> +
                  + <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %> +
                  + <% end %> <% end %>
                  <%= user_for_homework_common homework_common,is_teacher %> @@ -90,15 +99,16 @@ <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
                  - <% if homework_common.homework_type == 3 && !homework_common.student_work_projects.empty? %> + <% if homework_common.homework_type == 3 && !homework_common.student_work_projects.empty? && homework_common.homework_detail_group.base_on_project == 1 %>
                  -
                  - +
                  + + 已关联项目:
                  - <% homework_common.student_work_projects.each do |pro| %> + <% homework_common.student_work_projects.where("is_leader = 1").each do |pro| %>
                  <% project = Project.find pro.project_id %> - <% if project.is_public == 1 %> + <% if project.is_public == 1 || User.current.member_of?(project) || User.current.admin? %> <%=link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name) %> <% else %> <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius") %> diff --git a/config/routes.rb b/config/routes.rb index 2be4f7221..db63fe3ee 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -221,6 +221,7 @@ RedmineApp::Application.routes.draw do post 'student_work_project' get 'new_student_work_project' get 'search_user_projects' + get 'search_course_students' get 'cancel_relate_project' get 'delete_work' get 'destroy_score_reply' diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake index 84082eb9b..585d91737 100644 --- a/lib/tasks/homework_evaluation.rake +++ b/lib/tasks/homework_evaluation.rake @@ -14,14 +14,33 @@ namespace :homework_evaluation do if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评 student_works = homework_common.student_works if student_works && student_works.size >= 2 - student_works.each_with_index do |work, index| - user = work.user - n = homework_detail_manual.evaluation_num - n = n < student_works.size ? n : student_works.size - 1 - assigned_homeworks = get_assigned_homeworks(student_works, n, index) - assigned_homeworks.each do |h| - student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) - student_works_evaluation_distributions.save + if homework_common.homework_type == 3 + student_work_projects = homework_common.student_work_projects.where("student_work_id is not null") + student_work_projects.each_with_index do |pro_work, pro_index| + n = homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + work_index = -1 + student_works.each_with_index do |stu_work, stu_index| + if stu_work.id.to_i == pro_work.student_work_id.to_i + work_index = stu_index + end + end + assigned_homeworks = get_assigned_homeworks(student_works, n, work_index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id) + student_works_evaluation_distributions.save + end + end + else + student_works.each_with_index do |work, index| + user = work.user + n = homework_detail_manual.evaluation_num + n = n < student_works.size ? n : student_works.size - 1 + assigned_homeworks = get_assigned_homeworks(student_works, n, index) + assigned_homeworks.each do |h| + student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id) + student_works_evaluation_distributions.save + end end end homework_detail_manual.update_column('comment_status', 2) diff --git a/public/images/course/proRelated.png b/public/images/course/proRelated.png new file mode 100644 index 0000000000000000000000000000000000000000..2cc1252cc0918a854d382c3bc6aebb1211f2a3b9 GIT binary patch literal 1249 zcmeAS@N?(olHy`uVBq!ia0vp^8X(NU1|)m_?Z^dEk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m<2LJB1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`kBtHuNWFoz#!AFNG#Ad)HBe}%?0@jth%@)C>7xhtg4GcDhpEegHnt0 zON)|$@sXws(+mtd{1$-}0$pR}lAm0fo0?bR>0+w{6wyn`OtEq^b#rwzaCEYCb~ZLN zbTxHyb2e~wGIcU?HaB*5bTNkM^~@_SNz6-5h3U;i=yk-a*UGslHL)bWC?r2W2Nrt) z8Tlpo#Toep3eLf13gMY~Df#8apn!$CGqotQEH%ZgC_h&L95Pm!NVYqfIXYT6ni!fG z8CV*cIU1Nd8JnBBS{j==n;1B`8kj3V^`s#AmY^Pepym3YXhe!um=G|nfSB+^3gp0( zd1@XoZ5II(@xN_dJq!$t>7Fi*Ar-gITu)rrtiZ$YVC$ljyZ@iubJjS}+HjYJ@|FvS zGB(L`UCuuU$yrBd9~dkS*MTK1eatgSYG3OtKT^*h>mFd(F1GN 0) { + if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { + $("#new_student_work").submit(); + $("#ajax-indicator").hide(); + } + } else { + $("#new_student_work").submit(); + $("#ajax-indicator").hide(); + } } } diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index dcd8a35ca..d375a90ee 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -251,8 +251,15 @@ function new_student_work() { if(regexStudentWorkName()&®exStudentWorkDescription()) { - $("#new_student_work").submit(); - $("#ajax-indicator").hide(); + if($("#group_member_ids").length > 0) { + if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) { + $("#new_student_work").submit(); + $("#ajax-indicator").hide(); + } + } else { + $("#new_student_work").submit(); + $("#ajax-indicator").hide(); + } } } @@ -298,6 +305,17 @@ function regexStudentWorkDescription() } } +function regexStudentWorkMember(min, max) { + var members = $.trim($("#group_member_ids").val()).split(','); + if ( min <= members.length && members.length <= max ){ + $("#student_work_group_textarea").text(""); + return true; + } else { + $("#student_work_group_textarea").text("合作成员人数应为:"+min+"-"+max+"人"); + return false; + } +} + //学生作品 function show_project() { From c6470bc69b2b9abbb39b32bd4239fd7d24ad506c Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 15:31:15 +0800 Subject: [PATCH 092/111] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E5=88=86=E7=BB=84=E6=88=90=E5=91=98=E6=97=B6?= =?UTF-8?q?=E8=8B=A5=E6=9F=90=E4=B8=80=E4=B8=AA=E5=AD=A6=E7=94=9F=E5=B7=B2?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=88=B0=E5=85=B6=E4=BB=96=E5=88=86=E7=BB=84?= =?UTF-8?q?=E5=88=99=E4=B8=8D=E5=8F=AF=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 + app/views/student_work/search_course_students.js.erb | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index f79646ade..86e521b55 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -687,6 +687,7 @@ class StudentWorkController < ApplicationController end all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")" all_students = User.where("id in #{all_student_ids}") + @commit_student_ids = @homework.student_work_projects.map{|student| student.user_id} @users = searchstudent_by_name all_students,name respond_to do |format| format.js diff --git a/app/views/student_work/search_course_students.js.erb b/app/views/student_work/search_course_students.js.erb index fb595e51f..1cea9f27e 100644 --- a/app/views/student_work/search_course_students.js.erb +++ b/app/views/student_work/search_course_students.js.erb @@ -18,7 +18,7 @@ $("#all_students_list").empty(); } } } - <% if user.id.to_i != User.current.id.to_i %> + <% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %> if (str.indexOf(<%=user.id.to_s %>) < 0) { $("#student_<%=user.id %>").one("click",function choose_student() { var li = "
                • + if (str.indexOf(<%=user.id.to_s %>) < 0) { + $("#student_<%=user.id %>").attr("title","该学生已加入其它分组"); + } <% end %> <% end %> \ No newline at end of file From 03318aac97d23e101926b693f2dc152e9d419a92 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 11 Dec 2015 15:36:59 +0800 Subject: [PATCH 093/111] =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8D=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E4=BF=AE=E6=94=B9=E8=A6=81=E5=8F=98=E6=88=90=E7=81=B0?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/my/account.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index fa9171496..b95c8f049 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -30,7 +30,7 @@
                •   
                  -
                • <%= f.text_field :login,:no_label=>true, :required => true, :nh_required=>"1",:disabled=>'disabled', :name => "login",:class=>"w210"%>
                • +
                • <%= f.text_field :login,:no_label=>true, :required => true,:style=>"color:grey", :nh_required=>"1",:disabled=>'disabled', :name => "login",:class=>"w210"%>
                • <%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%>
                • From b981f3dcea5d203595baf07d4ec1aab38d339588 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 11 Dec 2015 15:39:38 +0800 Subject: [PATCH 094/111] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=A0=E9=99=A4403=E9=97=AE=E9=A2=98=20=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E7=9A=84=E6=97=B6=E5=80=99=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 +- app/views/courses/settings.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 88aae0f8b..ab2cfa2ba 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -30,7 +30,7 @@ class ProjectsController < ApplicationController before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] - before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] + before_filter :require_admin, :only => [ :copy, :unarchive, :destroy, :calendar] before_filter :file, :statistics #:watcherlist # 除非项目内人员,不可查看成员, TODO: 完了写报表里去 # before_filter :memberAccess, only: :member diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 650127aef..634f26495 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -89,7 +89,7 @@ <% end %>
                <% if @course.is_delete == 1 %> -
                <%=link_to "恢复该课程", renew_course_path(@course) %>
                +
                <%=link_to "恢复该课程", renew_course_path(@course) %>
                <% else %>
                <%=link_to "删除该课程", course_path(@course), :method => :delete, :confirm=>"确认要删除该课程吗?" %> From d1423ebc7ed268b2d9526093185bd68504d241b3 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 11 Dec 2015 15:41:41 +0800 Subject: [PATCH 095/111] =?UTF-8?q?ke=E9=AB=98=E5=BA=A6=E5=B0=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/init_activity_KindEditor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index 977c62117..a23b83607 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -159,4 +159,5 @@ function init_activity_KindEditor_data(id){ div_form = $("div[nhname='new_message_" + id + "']"); $(".ke-edit", div_form).css("height","33px"); + $(".ke-edit-iframe",div_form).css("height","33px"); } \ No newline at end of file From b178fb7f0a318b1f65dc600c09e74fe4d4b40031 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 11 Dec 2015 15:56:37 +0800 Subject: [PATCH 096/111] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8F=90=E9=86=92=20?= =?UTF-8?q?=E7=97=85=E5=8F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 1ca8f5e1a..9f7b90ee4 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -180,7 +180,7 @@
              • -
              • +
              • <% if exercise.created_at%> <%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>  <% end %> From 6c9a1394500c16c73d84cd43fc3a22d6b6722e43 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 16:36:19 +0800 Subject: [PATCH 100/111] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=88=86=E7=BB=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=9A=84=E4=BD=9C=E5=93=81=E6=8A=A5500?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 86e521b55..355743dd7 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -299,7 +299,6 @@ class StudentWorkController < ApplicationController @submit_result = true @work.name = params[:student_work][:name] @work.description = params[:student_work][:description] - @work.project_id = params[:student_work][:project] @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save From be590497b9c11d60606d9fb1ca7044c542db5e31 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 11 Dec 2015 16:58:00 +0800 Subject: [PATCH 101/111] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E8=AE=BE=E4=B8=BA=E9=A6=96=E9=A1=B5=E5=90=8E=EF=BC=8C=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E8=87=B3=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/index.html.erb | 2 +- app/views/organizations/set_homepage.js.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index d442b9112..dff20a20b 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -3,7 +3,7 @@ <%= render :partial => 'project_file_new', locals: {project: @project} %> <% elsif @container_type == 1 %> <%= render :partial => 'course_file', locals: {course: @course} %> - <% elsif @container_type == 2 %> + <% elsif @container_type == 2 %> <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %> <% end %> diff --git a/app/views/organizations/set_homepage.js.erb b/app/views/organizations/set_homepage.js.erb index 5b56d57b3..97824bb3a 100644 --- a/app/views/organizations/set_homepage.js.erb +++ b/app/views/organizations/set_homepage.js.erb @@ -1,2 +1,2 @@ //location.reload(); -window.location.href ='<%= organization_path(@org, :show_homepage => params[:show_homepage])%>'; \ No newline at end of file +window.location.href ='<%= organization_path(@org, :show_homepage => 1)%>'; \ No newline at end of file From e5192c7b1a1e8f1539b47474468e9e2c5e04e970 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 11 Dec 2015 17:02:34 +0800 Subject: [PATCH 102/111] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E7=9A=84=E6=8F=90=E4=BA=A4=E5=92=8C=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 5 +++++ app/models/course_message.rb | 4 ++-- app/views/exercise/_student_exercise.html.erb | 8 -------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 355743dd7..1fe798328 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -270,6 +270,9 @@ class StudentWorkController < ApplicationController user_activity.updated_at = Time.now user_activity.save end + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>student_work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 + course_message.save + @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first respond_to do |format| format.js @@ -302,6 +305,8 @@ class StudentWorkController < ApplicationController @work.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@work) if @work.save + course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 + course_message.save =begin respond_to do |format| format.html { diff --git a/app/models/course_message.rb b/app/models/course_message.rb index 11b0165c5..79d27f3c5 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -1,5 +1,5 @@ class CourseMessage < ActiveRecord::Base - # status说明: status在课程不同的类型,区分不同的功能 + # status说明: status在课程不同的类型,区分不同的功能 status = 9 作品的提交记录 # HomeworkCommon:status: # nil:发布了作业; 1:作业截止时间到了提醒!;2:开启匿评; 3:关闭匿评; 4:匿评开始失败 attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status @@ -19,7 +19,7 @@ class CourseMessage < ActiveRecord::Base def add_user_message #unless self.course_message_type == 'JoinCourseRequest' - if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? && self.status != 9 self.message_alls << MessageAll.new(:user_id => self.user_id) end #end diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 3983fb0c4..9c9916e60 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -53,19 +53,11 @@
              • <%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
              • - <%# end_time = Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
                • <%=exercise.user.show_name %> - <%# name = exercise.user.show_name %> - <%# if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %> - <%#= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %> - <%# else %> - - <%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %> - <%# end %>
                • <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%> From c2d21b5a6bcffa8a3778cb050ed1914c2a2fe25a Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 11 Dec 2015 17:11:11 +0800 Subject: [PATCH 103/111] =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=A0=8F=E7=9B=AE=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_left_subfield_list.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index dbeaa6117..367c23843 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -29,7 +29,8 @@ <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> <%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%> <% else %> - <%= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> + <%#= link_to "#{field.name}", org_subfield_files_path(field, :organization_id => organization.id), :class => "homepageMenuText" %> + <%= field.name %> <% end %>