From 879dee0cd6f4ee97b8f43fa6429a991bc187e73d Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 27 Nov 2015 17:27:55 +0800 Subject: [PATCH 01/45] =?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 6f9c89d67b7c88b82b8ae5414bd53406df426e65 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 30 Nov 2015 16:04:43 +0800 Subject: [PATCH 02/45] =?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 03/45] =?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 04/45] =?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 d4823e7c8b606fac2cf8d81c1d8501670c20dd06 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 1 Dec 2015 15:48:25 +0800 Subject: [PATCH 05/45] =?UTF-8?q?=E8=B4=B4=E5=90=A7=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/forums/_show_topics.html.erb | 2 +- app/views/memos/show.html.erb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/forums/_show_topics.html.erb b/app/views/forums/_show_topics.html.erb index bb8a91b69..dc3a20482 100644 --- a/app/views/forums/_show_topics.html.erb +++ b/app/views/forums/_show_topics.html.erb @@ -16,7 +16,7 @@
    最后回复:<%= author.name%>
    <%= format_date(topic.last_reply.created_at)%>
    <% end%> - + 更新时间:<%= format_date(topic.updated_at)%>
    diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index efcd15a66..c05b63427 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -79,6 +79,8 @@ <%= render :partial => 'attachments_links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %> <% end %>
    +
    + 更新时间:<%= format_date(@memo.updated_at)%>
From 35b543cd22ad41fb7cd8e2c562f2901bf1d757f0 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 1 Dec 2015 17:23:14 +0800 Subject: [PATCH 06/45] =?UTF-8?q?=E8=AE=BA=E5=9D=9B=E5=8F=91=E5=B8=96=20?= =?UTF-8?q?=E9=87=87=E7=94=A8ajax=E6=8F=90=E4=BA=A4=E3=80=82=E8=BF=99?= =?UTF-8?q?=E6=A0=B7=E5=AD=90=E7=BD=91=E7=BB=9C=E4=B8=8D=E5=A5=BD=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=E5=B0=B1=E4=B8=8D=E4=BC=9A=E4=B8=A2=E5=A4=B1?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BA=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/memos_controller.rb | 6 +++++- app/views/forums/show.html.erb | 18 ++++++++++++++++-- app/views/layouts/base_forums.html.erb | 2 +- app/views/memos/create.js.erb | 1 + app/views/memos/edit.html.erb | 16 +++++++++++++++- app/views/memos/update.js.erb | 5 +++++ 6 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 app/views/memos/create.js.erb create mode 100644 app/views/memos/update.js.erb diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 4181090a5..2d2c058d4 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -73,6 +73,7 @@ class MemosController < ApplicationController end end #end + format.js format.html { redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}" } format.json { render json: @memo, status: :created, location: @memo } else @@ -152,6 +153,7 @@ class MemosController < ApplicationController end def update + @flag = false respond_to do |format| if( #@memo.update_column(:subject, params[:memo][:subject]) && @memo.update_column(:content, params[:memo][:content]) && @@ -159,10 +161,12 @@ class MemosController < ApplicationController @memo.update_column(:lock, params[:memo][:lock]) && @memo.update_column(:subject,params[:memo][:subject])) @memo.save_attachments(params[:attachments] || (params[:memo] && params[:memo][:uploads])) - @memo.save + @flag = @memo.save # @memo.root.update_attribute(:updated_at, @memo.updated_at) + format.js format.html {redirect_to back_memo_url, notice: "#{l :label_memo_create_succ}"} else + format.js format.html { render action: "edit" } format.json { render json: @person.errors, status: :unprocessable_entity } end diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb index 05c086ed4..ad9195804 100644 --- a/app/views/forums/show.html.erb +++ b/app/views/forums/show.html.erb @@ -3,7 +3,7 @@
-
  •    截止时间快到了!
  • +
  •    截止时间快到啦
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> @@ -158,7 +158,7 @@
  • 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %>  23:59
  • <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%> -

    请您尽早完成匿评!如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。

    +

    请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。

    例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分

    <% end%>
    @@ -209,7 +209,7 @@ -
  •   您迟交了作品!
  • +
  •   您成功提交了作品(但被标记为迟交啦)
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> diff --git a/config/application.rb b/config/application.rb index 61f73ee3d..9e6d41abe 100644 --- a/config/application.rb +++ b/config/application.rb @@ -80,7 +80,7 @@ module RedmineApp elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n","")) Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`.gsub("\n","")) - Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true + Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200'], retry_on_failure: true else Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true 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/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/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 Date: Thu, 3 Dec 2015 18:33:08 +0800 Subject: [PATCH 17/45] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=AE=E8=AE=A2?= =?UTF-8?q?=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../student_work/_revise_attachments.html.erb | 30 +++++++++++++++++++ app/views/student_work/_show.html.erb | 25 ++++++++++++++++ .../20151203030635_add_attachment_type.rb | 9 ++++++ db/schema.rb | 2 +- public/stylesheets/courses.css | 5 ++++ 5 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 app/views/student_work/_revise_attachments.html.erb create mode 100644 db/migrate/20151203030635_add_attachment_type.rb diff --git a/app/views/student_work/_revise_attachments.html.erb b/app/views/student_work/_revise_attachments.html.erb new file mode 100644 index 000000000..1321da368 --- /dev/null +++ b/app/views/student_work/_revise_attachments.html.erb @@ -0,0 +1,30 @@ +
    +
    + + 上传附件 + <%#= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'blueCir ml5' %> + <%= file_field_tag 'attachments[dummy][file]', + :id => "_file#{work.id}", + :class => 'file_selector', + :multiple => true, + :onchange => "addReviseFiles(this, '#{work.id}');", + :style => 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all), + :containerid => "#{work.id}" + } %> + + <% content_for :header_tags do %> + <%= javascript_include_tag 'attachments' %> + <% end %> +
    + diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 1b0202536..894f9fb39 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -61,6 +61,31 @@ + + <%#= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%> + <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> + + <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> + <%#= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> + <%#= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> + +
    <%student_work_scores.each do |student_score|%>
    diff --git a/db/migrate/20151203030635_add_attachment_type.rb b/db/migrate/20151203030635_add_attachment_type.rb new file mode 100644 index 000000000..2c41aa5f2 --- /dev/null +++ b/db/migrate/20151203030635_add_attachment_type.rb @@ -0,0 +1,9 @@ +# encoding: utf-8 +class AddAttachmentType < ActiveRecord::Migration + def up + Attachmentstype.create(typeId:3,typeName:'修订附件') + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 442ceaab9..a7e3224d2 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 => 20151202064455) do +ActiveRecord::Schema.define(:version => 20151203030635) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 57838bdba..584a49a4f 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1192,3 +1192,8 @@ a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no- .addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;} .rightArrow {margin:50px 15px 0px 15px; float:left;} .relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;} + +.resubAtt {border-top:1px solid #dddddd; position:relative; margin-top:15px;} +.resubTitle {position:absolute; top:-10px; left:5px; background-color:#ffffff; display:block; font-weight:bold; padding:0px 2px;} +a.blueCir{ display:inline-block; padding:2px 5px; background-color:#ffffff;border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} +a:hover.blueCir{ background:#3598db; color:#fff;} From 838140ada86ec067f2df122edc0441c90b7ba016 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 3 Dec 2015 19:08:15 +0800 Subject: [PATCH 18/45] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E6=B5=8B=E9=AA=8C?= =?UTF-8?q?=E7=9A=84=E8=87=AA=E5=8A=A8=E5=8F=91=E5=B8=83=E5=92=8C=E6=88=AA?= =?UTF-8?q?=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 16 ++++++++++++++++ lib/tasks/exercise_publish.rake | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 lib/tasks/exercise_publish.rake diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 6d6d429b6..0c794fe33 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -6,6 +6,14 @@ class ExerciseController < ApplicationController include ExerciseHelper def index + publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) + publish_exercises.each do |exercise| + exercise.update_column('exercise_status', 2) + end + end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) + end_exercises.each do |exercise| + exercise.update_column('exercise_status', 3) + end if @course.is_public == 0 && !User.current.member_of_course?(@course) render_403 return @@ -24,6 +32,14 @@ class ExerciseController < ApplicationController end def show + publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) + publish_exercises.each do |exercise| + exercise.update_column('exercise_status', 2) + end + end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) + end_exercises.each do |exercise| + exercise.update_column('exercise_status', 3) + end unless User.current.member_of_course?(@course) render_403 return diff --git a/lib/tasks/exercise_publish.rake b/lib/tasks/exercise_publish.rake new file mode 100644 index 000000000..aacd67c1f --- /dev/null +++ b/lib/tasks/exercise_publish.rake @@ -0,0 +1,18 @@ +#coding=utf-8 + +namespace :exercise_publish do + desc "publish exercise and end exercise" + task :publish => :environment do + exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) + exercises.each do |exercise| + exercise.update_column('exercise_status', 2) + end + end + + task :end => :environment do + exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) + exercises.each do |exercise| + exercise.update_column('exercise_status', 3) + end + end +end From 4e9e7543baa592c5f2704c7195539a43a5051852 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 3 Dec 2015 19:21:35 +0800 Subject: [PATCH 19/45] =?UTF-8?q?chrome=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E4=BF=9D=E5=AD=98=E6=B5=8B=E9=AA=8C=E5=A4=B4?= =?UTF-8?q?=E9=83=A8=E4=BF=A1=E6=81=AF=E6=97=A0=E5=8F=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_edit_head.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/exercise/_edit_head.html.erb b/app/views/exercise/_edit_head.html.erb index 64f34b5aa..a071904ce 100644 --- a/app/views/exercise/_edit_head.html.erb +++ b/app/views/exercise/_edit_head.html.erb @@ -35,6 +35,5 @@ $("#exercise_time").val("<%=exercise.time if exercise.time!= -1 %>"); $("#exercise_publish_time").val("<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil?%>"); /*$("#exercise_description").text("<%#=exercise.exercise_description.html_safe %>");*/ - document.getElementById("exercise_description").innerHTML = <%=exercise.exercise_description.html_safe %>; } \ No newline at end of file From 89b8f7783da5be3c75d1594a399403e37cfa50e9 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 08:57:29 +0800 Subject: [PATCH 20/45] =?UTF-8?q?=E6=B7=BB=E5=8A=A0forked=5Fform=E7=9A=84i?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/show.html.erb | 2 +- ..._add_forked_from_project_id_to_projects.rb | 5 ++ db/schema.rb | 63 +++++++++---------- 3 files changed, 35 insertions(+), 35 deletions(-) create mode 100644 db/migrate/20151203072815_add_forked_from_project_id_to_projects.rb diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index e06542cba..324dc6202 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -15,7 +15,7 @@ 版本库地址:<%= @repos_url %> <% else %> 版本库地址:<%= h @repository.url %> - <% end %> + <% end %>-
    diff --git a/db/migrate/20151203072815_add_forked_from_project_id_to_projects.rb b/db/migrate/20151203072815_add_forked_from_project_id_to_projects.rb new file mode 100644 index 000000000..f679eaecd --- /dev/null +++ b/db/migrate/20151203072815_add_forked_from_project_id_to_projects.rb @@ -0,0 +1,5 @@ +class AddForkedFromProjectIdToProjects < ActiveRecord::Migration + def change + add_column :projects, :forked_from_project_id, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index c6ca6a0ce..886f233a8 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 => 20151203072815) 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| @@ -891,16 +894,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" @@ -970,6 +963,7 @@ ActiveRecord::Schema.define(:version => 20151130033906) 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" @@ -1303,27 +1297,28 @@ ActiveRecord::Schema.define(:version => 20151130033906) do end create_table "projects", :force => true do |t| - t.string "name", :default => "", :null => false + t.string "name", :default => "", :null => false t.text "description" - t.string "homepage", :default => "" - t.boolean "is_public", :default => true, :null => false + t.string "homepage", :default => "" + t.boolean "is_public", :default => true, :null => false t.integer "parent_id" t.datetime "created_on" t.datetime "updated_on" t.string "identifier" - t.integer "status", :default => 1, :null => false + t.integer "status", :default => 1, :null => false t.integer "lft" t.integer "rgt" - t.boolean "inherit_members", :default => false, :null => false + t.boolean "inherit_members", :default => false, :null => false t.integer "project_type" - t.boolean "hidden_repo", :default => false, :null => false - t.integer "attachmenttype", :default => 1 + t.boolean "hidden_repo", :default => false, :null => false + t.integer "attachmenttype", :default => 1 t.integer "user_id" - t.integer "dts_test", :default => 0 + t.integer "dts_test", :default => 0 t.string "enterprise_name" t.integer "organization_id" t.integer "project_new_type" t.integer "gpid" + t.integer "forked_from_project_id" end add_index "projects", ["lft"], :name => "index_projects_on_lft" From 6553559929f76759cc83849f7bfe772154488058 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 4 Dec 2015 10:56:16 +0800 Subject: [PATCH 21/45] =?UTF-8?q?=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 4 ++ app/controllers/users_controller.rb | 4 +- app/models/exercise.rb | 14 ++++ app/views/users/_user_message_course.html.erb | 70 +++++++++++++++++++ .../exercise_close_to_deadline_warn.rake | 22 ++++++ lib/tasks/exercise_publishtime.rake | 22 ++++++ 6 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 lib/tasks/exercise_close_to_deadline_warn.rake create mode 100644 lib/tasks/exercise_publishtime.rake diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 6d6d429b6..db09c50a5 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -316,6 +316,9 @@ class ExerciseController < ApplicationController @exercise.exercise_status = 2 @exercise.publish_time = Time.now if @exercise.save + @exercise.course.members.each do |m| + @exercise.course_messages << CourseMessage.create(:user_id =>m.user_id, :course_id => @exercise.course.id, :viewed => false,:status=>2) + end #redirect_to exercise_index_url(:course_id=> @course.id) respond_to do |format| format.js @@ -331,6 +334,7 @@ class ExerciseController < ApplicationController @exercise.exercise_questions.each do |exercise_question| exercise_question.exercise_answers.destroy_all end + @exercise.course_messages.destroy_all @exercise.exercise_users.destroy_all @exercise.exercise_status = 1 @exercise.publish_time = nil diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 626bb59fc..834009d71 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -92,7 +92,7 @@ class UsersController < ApplicationController end # 用户消息 - # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复 + # 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复,exercise:课程测验 # issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment) def user_messages if !User.current.logged? @@ -128,7 +128,7 @@ class UsersController < ApplicationController #课程相关消息 when 'homework' - @message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork') and user_id =?", @user).order("created_at desc") + @message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user).order("created_at desc") when 'course_message' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") when 'course_news' diff --git a/app/models/exercise.rb b/app/models/exercise.rb index d23e8f115..c91e59fd9 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -6,4 +6,18 @@ class Exercise < ActiveRecord::Base has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number" has_many :exercise_users, :dependent => :destroy has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过 + # 课程消息 + has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy + after_create :acts_as_course_message + def acts_as_course_message + if self.course + if self.exercise_status == 2 #未发布 + #self.course.members.each do |m| + self.course_messages << CourseMessage.create(:user_id => User.current.id, :course_id => self.course_id, :viewed => false,:status=>2) + #end + # else + # self.course_messages.destroy_all 这里的destory_all值得商榷。因为我这里是通过status来控制不同的status的 + end + end + end end diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 9f2c9b9ef..566677964 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -612,4 +612,74 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> + + + <% if ma.course_message_type == "Exercise" && ma.status == 2 %> +
      +
    • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
    • +
    • + <%=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.exercise_name, exercise_path(:id => 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 %>
    • +
    + <% end %> + + + <% if ma.course_message_type == "Exercise" && ma.status == 3 %> +
      +
    • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
    • +
    • + <%=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.exercise_name, exercise_path(:id => 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 %>
    • +
    + <% end %> <% end %> \ No newline at end of file diff --git a/lib/tasks/exercise_close_to_deadline_warn.rake b/lib/tasks/exercise_close_to_deadline_warn.rake new file mode 100644 index 000000000..2af513ee8 --- /dev/null +++ b/lib/tasks/exercise_close_to_deadline_warn.rake @@ -0,0 +1,22 @@ +#coding=utf-8 + +namespace :exercise_deadline_warn do + desc "exercise deadline warn" + task :deadline_warn => :environment do + exercises = Exercise.where("date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验 + exercises.each do |exercise| + if exercise.exercise_status == 2 #发布的作业才能告给学生发截止消息 + course = exercise.course + course.members.each do |m| + #CourseMessage status 1 未发布 status 2 已发布 status 3 已发布快截止了 + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3) unless m.user.allowed_to?(:as_teacher,m) + end + # if homework.course_acts.size == 0 + # homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id) + # end + # 邮件通知 + #Mailer.run.homework_added(homework) + end + end + end +end \ No newline at end of file diff --git a/lib/tasks/exercise_publishtime.rake b/lib/tasks/exercise_publishtime.rake new file mode 100644 index 000000000..6cef511e2 --- /dev/null +++ b/lib/tasks/exercise_publishtime.rake @@ -0,0 +1,22 @@ +#coding=utf-8 + +namespace :exercise_publishtime do + desc "start publish exercise" + task :publish => :environment do + exercises = Exercise.where("date_format(publish_time,'%Y-%m-%d')= '#{Date.today}'") + exercises.each do |exercise| + if exercise.exercise_status == 1 #未发布 + exercise.update_column('exercise_status', 2) #改为发布 + course = exercise.course + course.members.each do |m| + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end + # if homework.course_acts.size == 0 + # homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id) + # end + # 邮件通知 + #Mailer.run.homework_added(homework) + end + end + end +end \ No newline at end of file From 2855c0e409e104d66ef612fb88056e117442e5c7 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Fri, 4 Dec 2015 10:59:09 +0800 Subject: [PATCH 22/45] =?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 03588ca88ded7a776c16339d4bc6a65ad542ac35 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 4 Dec 2015 11:21:41 +0800 Subject: [PATCH 23/45] =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=B5=8B=E9=AA=8C?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E5=8F=91=E5=B8=83=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/exercise_publish.rake | 4 ++++ lib/tasks/exercise_publishtime.rake | 22 ---------------------- 2 files changed, 4 insertions(+), 22 deletions(-) delete mode 100644 lib/tasks/exercise_publishtime.rake diff --git a/lib/tasks/exercise_publish.rake b/lib/tasks/exercise_publish.rake index aacd67c1f..a27c6a6fb 100644 --- a/lib/tasks/exercise_publish.rake +++ b/lib/tasks/exercise_publish.rake @@ -6,6 +6,10 @@ namespace :exercise_publish do exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) exercises.each do |exercise| exercise.update_column('exercise_status', 2) + course = exercise.course + course.members.each do |m| + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end end end diff --git a/lib/tasks/exercise_publishtime.rake b/lib/tasks/exercise_publishtime.rake deleted file mode 100644 index 6cef511e2..000000000 --- a/lib/tasks/exercise_publishtime.rake +++ /dev/null @@ -1,22 +0,0 @@ -#coding=utf-8 - -namespace :exercise_publishtime do - desc "start publish exercise" - task :publish => :environment do - exercises = Exercise.where("date_format(publish_time,'%Y-%m-%d')= '#{Date.today}'") - exercises.each do |exercise| - if exercise.exercise_status == 1 #未发布 - exercise.update_column('exercise_status', 2) #改为发布 - course = exercise.course - course.members.each do |m| - exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) - end - # if homework.course_acts.size == 0 - # homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id) - # end - # 邮件通知 - #Mailer.run.homework_added(homework) - end - end - end -end \ No newline at end of file From 06122dab1dfad02ea5d9c36a2c36b08655153b72 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 4 Dec 2015 11:24:24 +0800 Subject: [PATCH 24/45] =?UTF-8?q?=E5=BD=93=E5=A4=A9=E6=88=AA=E6=AD=A2?= =?UTF-8?q?=E7=9A=84=E6=B5=8B=E9=AA=8C=E9=9C=80=E8=A6=81=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=88=AA=E6=AD=A2=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/exercise_close_to_deadline_warn.rake | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/tasks/exercise_close_to_deadline_warn.rake b/lib/tasks/exercise_close_to_deadline_warn.rake index 2af513ee8..890191167 100644 --- a/lib/tasks/exercise_close_to_deadline_warn.rake +++ b/lib/tasks/exercise_close_to_deadline_warn.rake @@ -3,9 +3,8 @@ namespace :exercise_deadline_warn do desc "exercise deadline warn" task :deadline_warn => :environment do - exercises = Exercise.where("date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验 + exercises = Exercise.where("exercise_status = 2 and date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验 exercises.each do |exercise| - if exercise.exercise_status == 2 #发布的作业才能告给学生发截止消息 course = exercise.course course.members.each do |m| #CourseMessage status 1 未发布 status 2 已发布 status 3 已发布快截止了 @@ -16,7 +15,6 @@ namespace :exercise_deadline_warn do # end # 邮件通知 #Mailer.run.homework_added(homework) - end end end end \ No newline at end of file From e2f5dcc3f977536513ea8e8becf4d705a5226472 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 4 Dec 2015 13:39:17 +0800 Subject: [PATCH 25/45] =?UTF-8?q?=E5=BD=93=E5=A4=A9=E6=88=AA=E6=AD=A2?= =?UTF-8?q?=E7=9A=84=E6=B5=8B=E9=AA=8C=E9=9C=80=E8=A6=81=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=88=AA=E6=AD=A2=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/exercise_close_to_deadline_warn.rake | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/tasks/exercise_close_to_deadline_warn.rake b/lib/tasks/exercise_close_to_deadline_warn.rake index 890191167..2deb7204e 100644 --- a/lib/tasks/exercise_close_to_deadline_warn.rake +++ b/lib/tasks/exercise_close_to_deadline_warn.rake @@ -3,6 +3,7 @@ namespace :exercise_deadline_warn do desc "exercise deadline warn" task :deadline_warn => :environment do + #exercise_status 1 未发布 2 已发布 3已截止 exercises = Exercise.where("exercise_status = 2 and date_format(end_time,'%Y-%m-%d')= '#{Date.today}'") #截止日期都是当天 23.59分,所以年月日相等的一定是今晚会截止的测验 exercises.each do |exercise| course = exercise.course From dbfc4969e071b8dea30c9861414aea22d643ea92 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 4 Dec 2015 15:36:19 +0800 Subject: [PATCH 26/45] =?UTF-8?q?=E6=B5=8B=E9=AA=8C=E6=B6=88=E6=81=AFbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 12 ++++++++++++ app/views/users/_user_message_course.html.erb | 6 +++--- lib/tasks/exercise_close_to_deadline_warn.rake | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 55daf0562..a99ab32ec 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -9,6 +9,10 @@ class ExerciseController < ApplicationController publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) publish_exercises.each do |exercise| exercise.update_column('exercise_status', 2) + course = exercise.course + course.members.each do |m| + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end end end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) end_exercises.each do |exercise| @@ -35,6 +39,10 @@ class ExerciseController < ApplicationController publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) publish_exercises.each do |exercise| exercise.update_column('exercise_status', 2) + course = exercise.course + course.members.each do |m| + exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end end end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) end_exercises.each do |exercise| @@ -504,6 +512,10 @@ class ExerciseController < ApplicationController @exercise.update_attributes(:show_result => params[:show_result]) @exercise.update_attributes(:exercise_status => 2) @exercise.update_attributes(:publish_time => Time.now) + course = @exercise.course + course.members.each do |m| + @exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) + end redirect_to exercise_url(@exercise) return elsif @exercise.publish_time > Time.now diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index 566677964..640f98b1f 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -640,9 +640,9 @@
  • 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
  • -
  • 答题时间:<%= ma.course_message.time == 0 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
  • +
  • 答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
  • <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%> -

    请记得在截止时间前完成测验噢,辛苦啦!

    +

    请记得在截止时间前完成测验噢,辛苦啦!

    <% end %>
    @@ -674,7 +674,7 @@
  • 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
  • 测验标题:<%= ma.course_message.exercise_name %>
  • 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
  • -
  • 答题时间:<%= ma.course_message.time == 0 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
  • +
  • 答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
  • 请及时完成课程测验,辛苦啦!

    diff --git a/lib/tasks/exercise_close_to_deadline_warn.rake b/lib/tasks/exercise_close_to_deadline_warn.rake index 2deb7204e..e2808818f 100644 --- a/lib/tasks/exercise_close_to_deadline_warn.rake +++ b/lib/tasks/exercise_close_to_deadline_warn.rake @@ -1,5 +1,5 @@ #coding=utf-8 - +#需要在0点以后执行 namespace :exercise_deadline_warn do desc "exercise deadline warn" task :deadline_warn => :environment do From c1747ab2172f695174736d68546129ccbb33e3c3 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 15:49:05 +0800 Subject: [PATCH 27/45] =?UTF-8?q?fork=E9=87=8D=E5=90=8D=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 63 ++++++++++++------- app/views/repositories/show.html.erb | 6 +- ...1204062220_add_forked_count_to_projects.rb | 5 ++ db/schema.rb | 14 +---- lib/gitlab-cli/lib/gitlab/client/projects.rb | 5 +- 5 files changed, 56 insertions(+), 37 deletions(-) create mode 100644 db/migrate/20151204062220_add_forked_count_to_projects.rb diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 2bd54954a..c1e124063 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -64,32 +64,53 @@ class RepositoriesController < ApplicationController end def forked - # 被forked的标识如果不满足单个用户唯一性,则不执行fork - if is_sigle_identifier?(User.current, @repository.identifier) - # REDO: 那些人有权限forked项目 - g = Gitlab.client - gproject = g.post ("/projects/fork/#{@project.gpid}?user_id=#{User.current.gid}") - if gproject - copy_project(@project, gproject) - end + # 如果当前用户已经fork过该项目,不会新fork项目,则跳至已fork的项 + unless has_forked?(@project, User.current) + project = project_from_current_project(@project.id, User.current.id) + redirect_to project_path(project) else - flash[:notice] = l(:project_gitlab_fork_double_message) - redirect_to settings_project_url(@project, :tab => 'repositories') + # 单个用户只能拥有一个名字一样的版本库,否则不能fork + # if is_sigle_identifier?(User.current, @repository.identifier) + # REDO: 那些人有权限forked项目 + g = Gitlab.client + gproject = g.fork(@project.gpid, User.current.gid) + if gproject + copy_project(@project, gproject) + forked_count = @project.forked_count.to_i + 1 + @project.update_attributes(:forked_count => forked_count) + end + # else + # flash[:notice] = l(:project_gitlab_fork_double_message) + # redirect_to settings_project_url(@project, :tab => 'repositories') + # end end + + end + + # 判断用户是否已经fork过该项目 + def has_forked?(project, user) + projects = Project.where("user_id =?", user) + projects.map(&:forked_from_project_id).detect{|s| s == @project.id}.nil? ? true : false + end + + # 获取当前用户fork过的项目 + def project_from_current_project(project, user) + project = Project.where("user_id =? and forked_from_project_id =?",user, project).first end # copy a project for fork - def copy_project(project, gproject) + def copy_project(tproject, gproject) project = Project.new - project.name = @project.name - project.is_public = @project.is_public - project.status = @project.status - project.description = @project.description - project.hidden_repo = @project.hidden_repo + project.name = tproject.name + project.is_public = tproject.is_public + project.status = tproject.status + project.description = tproject.description + project.hidden_repo = tproject.hidden_repo project.user_id = User.current.id project.project_type = 0 - project.project_new_type = @project.project_new_type + project.project_new_type = tproject.project_new_type project.gpid = gproject.id + project.forked_from_project_id = tproject.id if project.save r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first m = Member.new(:user => User.current, :roles => [r]) @@ -124,16 +145,16 @@ class RepositoriesController < ApplicationController def copy_repository(project, gproject) # 避免 - if is_sigle_identifier?(project.user_id, gproject.name) + # if is_sigle_identifier?(project.user_id, gproject.name) repository = Repository.factory('Git') repository.project_id = project.id repository.type = 'Repository::Gitlab' repository.url = gproject.name repository.identifier = gproject.name repository = repository.save - else - flash[:notice] = l(:project_gitlab_create_double_message) - end + # else + # flash[:notice] = l(:project_gitlab_create_double_message) + # end end def newrepo diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 324dc6202..d8b7c4625 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -25,8 +25,10 @@ -
    Fork 0
    - + + +
    <%= link_to "Fork", :controller => 'repositories', :action => 'forked'%> + <%= @project.forked_count.to_i %>
    <% if @changesets && !@changesets.empty? %> diff --git a/db/migrate/20151204062220_add_forked_count_to_projects.rb b/db/migrate/20151204062220_add_forked_count_to_projects.rb new file mode 100644 index 000000000..79fdc2573 --- /dev/null +++ b/db/migrate/20151204062220_add_forked_count_to_projects.rb @@ -0,0 +1,5 @@ +class AddForkedCountToProjects < ActiveRecord::Migration + def change + add_column :projects, :forked_count, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 6ad6c585f..a1e14c3bd 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 => 20151203072815) do +ActiveRecord::Schema.define(:version => 20151204062220) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -738,17 +738,6 @@ ActiveRecord::Schema.define(:version => 20151203072815) 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" @@ -1330,6 +1319,7 @@ ActiveRecord::Schema.define(:version => 20151203072815) do t.integer "project_new_type" t.integer "gpid" t.integer "forked_from_project_id" + t.integer "forked_count" end add_index "projects", ["lft"], :name => "index_projects_on_lft" diff --git a/lib/gitlab-cli/lib/gitlab/client/projects.rb b/lib/gitlab-cli/lib/gitlab/client/projects.rb index 3fab4347f..8d91edd06 100644 --- a/lib/gitlab-cli/lib/gitlab/client/projects.rb +++ b/lib/gitlab-cli/lib/gitlab/client/projects.rb @@ -241,8 +241,9 @@ class Gitlab::Client # Forks a project into the user namespace of the authenticated user. # @param [Integer] - The ID of the project to be forked - def fork(id) - post("/projects/fork/#{id}") + def fork(gpid, gid) + post ("/projects/fork/#{gpid}?user_id=#{gid}") + # post("/projects/fork/#{id}") end # Mark this project as forked from the other From 4a41039fa62546d4b7953507cc3378ef493250a0 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 15:58:56 +0800 Subject: [PATCH 28/45] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=8B=B1=E9=9B=84?= =?UTF-8?q?=E6=A6=9C=E6=94=B9=E6=88=90=E8=AF=BE=E7=A8=8B=E6=B4=BB=E8=B7=83?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_courses.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 981d44ce7..c37af0dc1 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -208,7 +208,7 @@
    <% unless contributor_course_scor(@course.id).count == 0 %>
      -

      课程贡献榜

      +

      课程活跃度

      <% contributor_course_scor(@course.id).each do |contributor_score| %> <% unless contributor_score.total_score ==0 %>
    • <%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %> From dfa9b4cf743f5f5165f3d5105683e97a5f0ce718 Mon Sep 17 00:00:00 2001 From: Tim Date: Fri, 4 Dec 2015 16:13:55 +0800 Subject: [PATCH 29/45] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/courses/member.html.erb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index ce336373b..e906bf778 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,9 +1,10 @@ -
      -

      <%= @subPage_title%>

      -
      -<% if @subPage_title == l(:label_student_list)%> - <%= render :partial => 'course_student', :locals => {:members => @members} %> -<% else%> - <%= render :partial => 'course_teacher', :locals => {:members => @members} %> -<% end%> - +
      +

      <%= @subPage_title%>

      + 修改角色 +
      +<% if @subPage_title == l(:label_student_list)%> + <%= render :partial => 'course_student', :locals => {:members => @members} %> +<% else%> + <%= render :partial => 'course_teacher', :locals => {:members => @members} %> +<% end%> + From 8fe53468e1e1ba3988370ae99d486951104dcc65 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 4 Dec 2015 16:21:11 +0800 Subject: [PATCH 30/45] =?UTF-8?q?=E4=BD=9C=E5=93=81=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 14 ++- app/helpers/student_work_helper.rb | 11 ++ app/models/student_work.rb | 1 + app/views/attachments/destroy.js.erb | 9 ++ .../_programing_work_show.html.erb | 29 ++++- .../student_work/_revise_attachment.html.erb | 28 +++++ .../student_work/_revise_attachments.html.erb | 30 ----- app/views/student_work/_show.html.erb | 57 +++++---- .../student_work/_upload_attachment.html.erb | 50 ++++++++ .../student_work/revise_attachment.js.erb | 2 + config/routes.rb | 1 + public/javascripts/attachments.js | 118 ++++++++++++++++++ public/stylesheets/courses.css | 18 +++ public/stylesheets/public.css | 2 +- public/stylesheets/public_new.css | 2 +- 15 files changed, 311 insertions(+), 61 deletions(-) create mode 100644 app/views/student_work/_revise_attachment.html.erb delete mode 100644 app/views/student_work/_revise_attachments.html.erb create mode 100644 app/views/student_work/_upload_attachment.html.erb create mode 100644 app/views/student_work/revise_attachment.js.erb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index dd2a5b5fc..5e71b0114 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -4,7 +4,7 @@ class StudentWorkController < ApplicationController 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] - before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work] + 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] before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment] @@ -527,6 +527,18 @@ class StudentWorkController < ApplicationController @course_activity = params[:course_activity].to_i end + def revise_attachment + Attachment.attach_filesex(@work, params[:attachments], params[:attachment_type]) + revise_attachments = @work.attachments.where("attachtype = 7").reorder("created_on desc") + if revise_attachments.count == 2 + revise_attachments.last.destroy + end + #@attachment = @work.attachments.where("attachtype = 7").order("created_on desc").first + respond_to do |format| + format.js + end + end + private def hsd_committed_work?(user, homework) sw = StudentWork.where("user_id =? and homework_common_id =?", user, homework).first diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index e1cf3464e..df5c872f8 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -126,4 +126,15 @@ module StudentWorkHelper end type end + + def revise_attachment_status homework, attach + date = Time.parse(format_time(attach.created_on.to_s)).strftime("%Y-%m-%d") + status = "" + if homework.homework_detail_manual && ((homework.anonymous_comment == 0 &&homework.homework_detail_manual.evaluation_start.to_s <= date) || (homework.anonymous_comment == 1 && homework.end_time < date)) + status = "此时其他同学作品已公开" + else + status = "此时其他同学作品尚未公开" + end + return status + end end \ No newline at end of file diff --git a/app/models/student_work.rb b/app/models/student_work.rb index 010ede635..884f4a089 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -10,6 +10,7 @@ class StudentWork < ActiveRecord::Base has_many :student_work_tests, order: 'id desc' # course's message has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy + has_many :attachments, :dependent => :destroy before_destroy :delete_praise before_save :set_program_score, :set_src diff --git a/app/views/attachments/destroy.js.erb b/app/views/attachments/destroy.js.erb index d23422e24..cfbe68085 100644 --- a/app/views/attachments/destroy.js.erb +++ b/app/views/attachments/destroy.js.erb @@ -1,5 +1,9 @@ <% if @is_destroy%> $("#attachment_<%= @attachment.id%>").remove(); + if(document.getElementById("uploadReviseBox")) { + $("#uploadReviseBox").removeClass('disable_link'); + $("#choose_revise_attach").attr("onclick","_file.click();"); + } <%else%> var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>'); //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start @@ -26,5 +30,10 @@ $('#upload_file_count'+containerid).html(""+count+""+"个文件"+"已上传"); } } + + if(document.getElementById("uploadReviseBox")) { + $("#uploadReviseBox").removeClass('disable_link'); + $("#choose_revise_attach").attr("onclick","_file.click();"); + } //modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end <% end%> \ No newline at end of file diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index fd541c643..fc246ab8b 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -89,6 +89,11 @@
    +
    + <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> +
    +
    +
    <%student_work_scores.each do |student_score|%>
    @@ -99,4 +104,26 @@ 收起
    -
    \ No newline at end of file +
    + diff --git a/app/views/student_work/_revise_attachment.html.erb b/app/views/student_work/_revise_attachment.html.erb new file mode 100644 index 000000000..968a4853b --- /dev/null +++ b/app/views/student_work/_revise_attachment.html.erb @@ -0,0 +1,28 @@ +<% revise_attachment = work.attachments.where("attachtype = 7").first %> +<% if @homework.end_time < Date.today %> + <% if revise_attachment && @is_teacher %> +
    + 追加修订附件 +
    +
    + 追加附件: + <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 2} %> + 追加时间:<%=format_time revise_attachment.created_on.to_s %>  (<%=revise_attachment_status @homework,revise_attachment %>) +
    + <% end %> + <% if work.user == User.current %> +
    + 追加修订附件 +
    + <% if revise_attachment %> +
    + 追加附件: + <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments.where("attachtype = 7"), :status => 1} %> + 追加时间:<%=format_time revise_attachment.created_on.to_s %> +
    + <% end %> + + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/student_work/_revise_attachments.html.erb b/app/views/student_work/_revise_attachments.html.erb deleted file mode 100644 index 1321da368..000000000 --- a/app/views/student_work/_revise_attachments.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -
    -
    - - 上传附件 - <%#= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'blueCir ml5' %> - <%= file_field_tag 'attachments[dummy][file]', - :id => "_file#{work.id}", - :class => 'file_selector', - :multiple => true, - :onchange => "addReviseFiles(this, '#{work.id}');", - :style => 'display:none', - :data => { - :max_file_size => Setting.attachment_max_size.to_i.kilobytes, - :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), - :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, - :upload_path => uploads_path(:format => 'js'), - :description_placeholder => l(:label_optional_description), - :field_is_public => l(:field_is_public), - :are_you_sure => l(:text_are_you_sure), - :file_count => l(:label_file_count), - :lebel_file_uploding => l(:lebel_file_uploding), - :delete_all_files => l(:text_are_you_sure_all), - :containerid => "#{work.id}" - } %> - - <% content_for :header_tags do %> - <%= javascript_include_tag 'attachments' %> - <% end %> -
    - diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index 894f9fb39..993b0f2aa 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -41,17 +41,18 @@
  • 附件: - <% if work.attachments.empty?%> + <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %> + <% if com_attachments.empty?%> 尚未提交附件 <% else%>
    - <%= render :partial => 'work_attachments_status', :locals => {:attachments => work.attachments, :status => @homework.homework_detail_manual.comment_status} %> + <%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %>
    <% end%>
  • - <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> + <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current)%>
    <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> @@ -61,30 +62,10 @@
  • - - <%#= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%> - <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %> - - <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%> - <%#= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %> - <%#= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %> - +
    <%student_work_scores.each do |student_score|%> @@ -96,4 +77,26 @@ 收起
    -
    \ No newline at end of file +
    + \ No newline at end of file diff --git a/app/views/student_work/_upload_attachment.html.erb b/app/views/student_work/_upload_attachment.html.erb new file mode 100644 index 000000000..d9c69fc17 --- /dev/null +++ b/app/views/student_work/_upload_attachment.html.erb @@ -0,0 +1,50 @@ + +上传附件 + +
    + <%= form_tag(revise_attachment_student_work_path(work.id), :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %> +
    + + +
    +
    + + + 选择文件 + <%= file_field_tag 'attachments[dummy][file]', + :id => '_file', + :class => ie8? ? '':'file_selector', + :multiple => true, + :onchange => 'addReviseInputFiles(this,"'+'upload_files_submit_btn'+'");', + :style => ie8? ? '': 'display:none', + :data => { + :max_file_size => Setting.attachment_max_size.to_i.kilobytes, + :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), + :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, + :upload_path => uploads_path(:format => 'js'), + :description_placeholder => l(:label_optional_description), + :field_is_public => l(:field_is_public), + :are_you_sure => l(:text_are_you_sure), + :file_count => l(:label_file_count), + :lebel_file_uploding => l(:lebel_file_uploding), + :delete_all_files => l(:text_are_you_sure_all) + } %> +
    + + +
    +
    +
    最多只能上传一个小于50MB的附件
    +
    +
    +
    +
    + <%= submit_tag '确定',:onclick=>'submit_files();',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %> +
    +
    + 取消 +
    +
    + <% end %> +
    +
    diff --git a/app/views/student_work/revise_attachment.js.erb b/app/views/student_work/revise_attachment.js.erb new file mode 100644 index 000000000..74813d27b --- /dev/null +++ b/app/views/student_work/revise_attachment.js.erb @@ -0,0 +1,2 @@ +closeModal(); +$("#revise_attachment").html('<%= escape_javascript( render :partial => 'revise_attachment' ,:locals=>{ :work => @work})%>'); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f6fe95a33..59eb29d70 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -206,6 +206,7 @@ RedmineApp::Application.routes.draw do resources :student_work do member do post 'add_score' + post 'revise_attachment' get 'retry_work' get 'praise_student_work' get 'forbidden_anonymous_comment' diff --git a/public/javascripts/attachments.js b/public/javascripts/attachments.js index d7b49c8be..b60b6ad28 100644 --- a/public/javascripts/attachments.js +++ b/public/javascripts/attachments.js @@ -154,6 +154,73 @@ function addFile(inputEl, file, eagerUpload,btnId) { } addFile.nextAttachmentId = 1; +function addReviseFile(inputEl, file, eagerUpload,btnId) { + + var attachments_frame = '#attachments_fields'; + if ($(attachments_frame).children().length < 30) { + deleteallfiles = $(inputEl).data('deleteAllFiles'); + var attachmentId = addFile.nextAttachmentId++; + + var fileSpan = $('', { + 'id': 'attachments_' + attachmentId, + 'class': 'attachment' + }); + + fileSpan.append( + $('', { + 'type': 'text', + 'class': 'upload_filename readonly', + 'name': 'attachments[' + attachmentId + '][filename]', + 'readonly': 'readonly' + }).val(file.name), +// $('', { +// 'type': 'text', +// 'class': 'description', +// 'name': 'attachments[' + attachmentId + '][description]', +// 'maxlength': 254, +// 'placeholder': $(inputEl).data('descriptionPlaceholder') +// }).toggle(!eagerUpload), +// $('' + $(inputEl).data('fieldIsPublic') + ':').attr({ +// 'class': 'ispublic-label' +// }), +// $('', { +// 'type': 'checkbox', +// 'class': 'is_public_checkbox', +// 'value': 1, +// 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', +// checked: 'checked' +// }).toggle(!eagerUpload), + $(' ').attr({ + 'href': "#", + 'class': 'remove-upload' + }).click(function() { + if (confirm($(inputEl).data('areYouSure'))) { + removeReviseFile(); + if (!eagerUpload) { + (function(e) { + reload(e); + })(fileSpan); + } + } + + }).toggle(!eagerUpload), + $('
    ', { + 'class': 'div_attachments', + 'name': 'div_' + 'attachments_' + attachmentId + }) + ).appendTo('#attachments_fields'); + + $("#uploadReviseBox").addClass('disable_link'); + $("#choose_revise_attach").attr("onclick","return false;"); + + if (eagerUpload) { + ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId); + } + return attachmentId; + } + return null; +} + function ajaxUpload(file, attachmentId, fileSpan, inputEl,btnId) { //上传开始调用函数 function onLoadstart(e) { @@ -293,6 +360,13 @@ function removeFile() { return false; } +function removeReviseFile() { + $(this).parent('span').remove(); + $("#uploadReviseBox").removeClass('disable_link'); + $("#choose_revise_attach").attr("onclick","_file.click();"); + return false; +} + //gcm delete all file //modify by yutao 2015-5-14 ��1��ҳ����ڶ���ϴ��ؼ�ʱ�˿�������bug �ʸ�֮ start function removeAll(containerid) { @@ -346,6 +420,30 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) { }); } +function addReviseInputFiles(inputEl,btnId) { + // var clearedFileInput = $(inputEl).clone().val(''); + if (inputEl.files) { + uploadAndAttachReviseFiles(inputEl.files, inputEl,btnId); + // $(inputEl).remove(); + } else { + // browser not supporting the file API, upload on form submission + var attachmentId; + var aFilename = inputEl.value.split(/\/|\\/); + var count = $('#attachments_fields>span').length; + attachmentId = addReviseFile(inputEl, { + name: aFilename[aFilename.length - 1] + }, false); + if (attachmentId) { + $(inputEl).attr({ + name: 'attachments[' + attachmentId + '][file]' + }).hide(); + if (count <= 0) count = 1; + } + } + + //clearedFileInput.insertAfter('#attachments_fields'); +} + function addInputFiles(inputEl,btnId) { // var clearedFileInput = $(inputEl).clone().val(''); if (inputEl.files) { @@ -405,6 +503,26 @@ function addInputFiles_board(inputEl, id,btnId) { //clearedFileInput.insertAfter('#attachments_fields'); } +function uploadAndAttachReviseFiles(files, inputEl,btnId) { + + var maxFileSize = $(inputEl).data('max-file-size'); + var maxFileSizeExceeded = $(inputEl).data('max-file-size-message'); + + var sizeExceeded = false; + $.each(files, function() { + if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) { + sizeExceeded = true; + } + }); + if (sizeExceeded) { + window.alert(maxFileSizeExceeded); + } else { + $.each(files, function() { + addReviseFile(inputEl, this, true,btnId); + }); + } +} + function uploadAndAttachFiles(files, inputEl,btnId) { var maxFileSize = $(inputEl).data('max-file-size'); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 584a49a4f..c2132c3fa 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1197,3 +1197,21 @@ a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no- .resubTitle {position:absolute; top:-10px; left:5px; background-color:#ffffff; display:block; font-weight:bold; padding:0px 2px;} a.blueCir{ display:inline-block; padding:2px 5px; background-color:#ffffff;border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} a:hover.blueCir{ background:#3598db; color:#fff;} + +/*上传资源弹窗*/ +.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} +.uploadDialogText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:140px; display:inline-block; font-weight: bold;} +.uploadBoxContainer {height:33px; line-height:33px; margin-top:10px; position:relative} +.uploadBox {width:100px; height:33px; line-height:33px; text-align:center; vertical-align:middle; background-color:#269ac9; border-radius:3px; float:left; margin-right:12px;} +a.uploadBoxIcon {background:url(images/resource_icon_list.png) -35px 10px no-repeat; float:left; display:block; width:81px; height:30px; padding-left:22px; font-size:14px; color:#ffffff;} +a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; width:100px; height:33px;} +.chooseFile {color:#ffffff; display:block; margin-left:32px;} +.uploadResourceIntr {width:250px; height:33px; float:left; line-height:33px; font-size:12px;} +.uploadResourceName {width:250px; display:inline-block; line-height:15px; font-size:12px; color:#444444; margin-bottom:2px;} +.uploadResourceIntr2 {width:250px; display:inline-block; line-height:15px; font-size:12px; color:#444444;} +.uploadType {margin:10px 0; border:1px solid #e6e6e6; width:100px; height:30px; outline:none; font-size:12px; color:#888888;} +.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 diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index a1dfe3f4d..70aad2cbe 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -410,7 +410,7 @@ a:hover.search_btn{ background: #0fa9bb;} .resourcesSendTo {float:left; height:20px; margin-top:15px;} .resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} .resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;} -.resourceClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block;} +.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;} .resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;} .searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} .courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;} diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css index db2d021d9..c60adf460 100644 --- a/public/stylesheets/public_new.css +++ b/public/stylesheets/public_new.css @@ -566,7 +566,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; .resourceSharePopup {width:300px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;} .sendText {font-size:16px; color:#15bccf; line-height:16px; padding-top:20px; width:100px; display:inline-block;} .resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;} -.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block;} +.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;} .resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;} .searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} .searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;} From b6edabed9c059ccd07750876799310c6f378f319 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 16:21:48 +0800 Subject: [PATCH 31/45] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 1 + app/views/courses/settings.html.erb | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index cd1de16fc..5da9db395 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -374,6 +374,7 @@ class CoursesController < ApplicationController def settings if User.current.allowed_to?(:as_teacher,@course) + @issue_custom_fields = IssueCustomField.sorted.all @issue_category ||= IssueCategory.new @member ||= @course.members.new diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 5c3918f00..8d3454776 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -1,6 +1,13 @@

    <%= l(:label_course_modify_settings)%>

    +
      @@ -118,4 +125,4 @@ } $("#time_selected").click(select); $("#term_selected").click(select); - + From 9716e99533600417b6b4f0b2b98ba9b2664e3560 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 4 Dec 2015 16:33:56 +0800 Subject: [PATCH 32/45] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E6=88=90=E5=91=98?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E2=80=9C=E4=BF=AE=E6=94=B9=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- app/views/courses/member.html.erb | 6 +++++- app/views/courses/settings.html.erb | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 5da9db395..0c61c449e 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -374,7 +374,7 @@ class CoursesController < ApplicationController def settings if User.current.allowed_to?(:as_teacher,@course) - + @select_tab = params[:tab] @issue_custom_fields = IssueCustomField.sorted.all @issue_category ||= IssueCategory.new @member ||= @course.members.new diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb index e906bf778..3aa7d4b57 100644 --- a/app/views/courses/member.html.erb +++ b/app/views/courses/member.html.erb @@ -1,6 +1,10 @@

      <%= @subPage_title%>

      - 修改角色 + <% if User.current.allowed_to?(:as_teacher,@course) %> + + <%=link_to "修改角色", :controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member' %> + + <% end %>
      <% if @subPage_title == l(:label_student_list)%> <%= render :partial => 'course_student', :locals => {:members => @members} %> diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb index 8d3454776..3456634d5 100644 --- a/app/views/courses/settings.html.erb +++ b/app/views/courses/settings.html.erb @@ -3,7 +3,7 @@
    \ 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 37/45] =?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 38/45] =?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 39/45] =?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 40/45] =?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 41/45] =?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 %>