From f52e74da61dea80ed6c6a544e2821d593a2faf33 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Jan 2016 16:11:26 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9issues=E6=80=BB?= =?UTF-8?q?=E6=95=B0=E8=AF=BB=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index cf0428c27..4217ca44e 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -71,7 +71,7 @@ 清空 <%#= link_to '新建问题', new_project_issue_path(@project) , :class => "green_u_btn fr ml10" %> -

<%= l(:label_issues_sum) %>:<%= @project.issues.visible.all.count %> +

<%= l(:label_issues_sum) %>:<%= @project.project_score.issue_num %> <%= l(:lable_issues_undo) %>:<%= @project.issues.where('status_id in (1,2,4,6)').visible.all.count %>

From b2746d0953824e3111f8e9cc94e5989c6c36c8e1 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Jan 2016 16:30:17 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E6=80=BB=E6=95=B0=E8=AE=A1=E5=85=A5=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E6=95=B0?= 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 bef5b7f4a..254b24f01 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -98,7 +98,7 @@ <% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> <% end %> From ed26242f94aee7335ab3b6020d0aa9d7ea72a309 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 15 Jan 2016 21:19:52 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=AC=A1=E6=95=B0=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20160115125217_update_rep_commits.rb | 32 +++++++++++++++++++ db/schema.rb | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20160115125217_update_rep_commits.rb diff --git a/db/migrate/20160115125217_update_rep_commits.rb b/db/migrate/20160115125217_update_rep_commits.rb new file mode 100644 index 000000000..ea8e3c815 --- /dev/null +++ b/db/migrate/20160115125217_update_rep_commits.rb @@ -0,0 +1,32 @@ +class UpdateRepCommits < ActiveRecord::Migration + def up + project_count = Project.all.count / 30 + 2 + transaction do + for i in 1 ... project_count do i + Project.page(i).per(30).each do |project| + puts project.id + if ProjectScore.where("project_id=?", project.id).first.nil? + puts "create project ==>#{project.id}" + ProjectScore.create(:project_id => project.id, :score => false) + end + unless project.project_score.nil? + # update boards + unless project.gpid.nil? + g = Gitlab.client + begin + puts project.id + count = g.project(project.gpid).commit_count + rescue + logger.error("The project's rep is not exit!") + end + project.project_score.update_attribute(:changeset_num, count) + end + end + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index d27ee5da3..bac1882c5 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 => 20160115023749) do +ActiveRecord::Schema.define(:version => 20160115125217) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false From c6aaaff8d19d379fbe2fe3ab5b10c092890e2e60 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 18 Jan 2016 10:07:12 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E5=AF=B9=E6=9C=89=E5=AD=90=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E7=9A=84=E7=BB=84=E7=BB=87=EF=BC=8C=E6=A0=8F=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E9=93=BE=E6=8E=A5=E5=BA=94=E4=B8=8D=E5=90=AB=E6=9C=89?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=8F=8A=E5=85=B6id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organizations/_org_left_subfield_list.html.erb | 12 ++++++++++-- config/routes.rb | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 7956af6d1..ffd86baa3 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -71,7 +71,11 @@
<% if field.field_type == "Post" %> <% if !field.subfield_subdomain_dir.nil? %> - <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% if !request.local? and !organization.domain.nil? and Organization.where("domain is not null").map(&:domain).include?(request.subdomain) %> + <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% else %> + <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% end %> <% else %> <%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %> <% end %> @@ -80,7 +84,11 @@ <% end %> <% else %> <% if !field.subfield_subdomain_dir.nil? %> - <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% if !request.local? and !organization.domain.nil? and Organization.where("domain is not null").map(&:domain).include?(request.subdomain) %> + <%= link_to "#{field.name}", show_subfield_without_id_path(:sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% else %> + <%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText" %> + <% end %> <% else %> <%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index ed1913c28..ce5b09aec 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -73,6 +73,7 @@ RedmineApp::Application.routes.draw do end end + get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_subfield_without_id' constraints(Subdomain.new) do get '/', to: 'organizations#show' end From 03df9abfebb35fa5c780766e0d1c0cd1dd09bb9d Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 18 Jan 2016 10:43:22 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E5=94=AF=E4=B8=80=E6=80=A7=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/org_subfields_controller.rb | 6 ++++- app/controllers/organizations_controller.rb | 4 +++ .../organizations/check_uniq_domain.js.erb | 5 ++++ app/views/organizations/setting.html.erb | 25 +++++++++++++++---- config/routes.rb | 1 + 5 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 app/views/organizations/check_uniq_domain.js.erb diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb index 9f1d964ef..d051a91f7 100644 --- a/app/controllers/org_subfields_controller.rb +++ b/app/controllers/org_subfields_controller.rb @@ -27,7 +27,11 @@ class OrgSubfieldsController < ApplicationController @sort = "" @order = "" @is_remote = false - @organization = Organization.find(params[:id]) + if params[:id] + @organization = Organization.find(params[:id]) + else + @organization = Organization.where("domain=?",request.subdomain).first + end @org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+ "subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+ " org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index b431678af..39ece6fbe 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -136,6 +136,10 @@ class OrganizationsController < ApplicationController end end + def check_uniq_domain + @is_exist = (Organization.where("domain=?", params[:org_domain]).count > 0) + end + def find_organization @organization = Organization.find(params[:id]) end diff --git a/app/views/organizations/check_uniq_domain.js.erb b/app/views/organizations/check_uniq_domain.js.erb new file mode 100644 index 000000000..e49bb0cad --- /dev/null +++ b/app/views/organizations/check_uniq_domain.js.erb @@ -0,0 +1,5 @@ +<% if @is_exist %> + $is_exist = true; +<% else %> + $is_exist = false; +<% end %> \ No newline at end of file diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb index 962a7a497..45ac302ca 100644 --- a/app/views/organizations/setting.html.erb +++ b/app/views/organizations/setting.html.erb @@ -149,18 +149,33 @@ if ($("#subfield_name").val().trim() != "") $("#add_subfield_form").submit(); } + var $is_exist = false; function apply_subdomain(id, domain){ var reg = new RegExp("^[a-zA-Z0-9_]{1,}$"); if (reg.exec(domain)){ $.ajax({ - url:"<%= apply_subdomain_organization_path %>", - type:'post', + url: "<%= check_uniq_domain_organizations_path %>", + type: 'get', data:{ - id:id, - domain:domain + org_domain:domain }, success:function(){ - $("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果"); + if(!$is_exist){ + $.ajax({ + url:"<%= apply_subdomain_organization_path %>", + type:'post', + data:{ + id:id, + domain:domain + }, + success:function(){ + $("#apply_hint").text("您的申请已提交,系统会以消息的形式通知您结果"); + } + }); + } + else{ + $("#apply_hint").text("您申请的子域名已存在,请重新输入"); + } } }); } diff --git a/config/routes.rb b/config/routes.rb index ce5b09aec..67694edb7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -66,6 +66,7 @@ RedmineApp::Application.routes.draw do end collection do get 'check_uniq' + get 'check_uniq_domain' get 'autocomplete_search' post 'hide_org_subfield' post 'show_org_subfield' From 5e102d24dd2f6d50dcc7ac51cd8991a3bbfca2d2 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 18 Jan 2016 11:01:04 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E6=8A=A5500=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blogs/_article.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index 22df4499a..0516a431a 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -78,7 +78,7 @@ 发帖时间:<%= format_time(activity.created_on) %>
- 更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %> + 更新时间:<%= format_time(activity.updated_on) %>
From 909e0e846b09a0fa24f3ddfd34c2e0c3907cc9a1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 18 Jan 2016 11:06:08 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index cdf715a0e..ccbe67004 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -74,7 +74,7 @@ RedmineApp::Application.routes.draw do end end - get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_subfield_without_id' + constraints(Subdomain.new) do get '/', to: 'organizations#show' end @@ -1125,6 +1125,8 @@ RedmineApp::Application.routes.draw do resources :at + get '/:sub_dir_name', :to => 'org_subfields#show', :as => 'show_subfield_without_id' + Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| file = File.join(plugin_dir, "config/routes.rb") if File.exists?(file) From d0c2eabddd127952088d28d195061a22a79d6cda Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 19 Jan 2016 16:42:10 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E9=99=86=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=EF=BC=8C=E4=B9=9F=E8=83=BD=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=8B=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/attachments_controller.rb | 2 +- app/helpers/application_helper.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index fd43977ee..514f68d49 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -600,7 +600,7 @@ private def has_login unless @attachment && @attachment.container_type == "PhoneAppVersion" - render_403 unless User.current.logged? + render_403 if !User.current.logged? && @attachment.container_type != 'OrgSubfield' && @attachment.container_type != 'OrgDocumentComment' end end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 07f7a0ed8..9f08a63ed 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1996,6 +1996,8 @@ module ApplicationHelper candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1) elsif attachment.container.is_a?(OrgSubfield) candown = true + elsif attachment.container.is_a?(OrgDocumentComment) + candown = true elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board && attachment.container.board.course course = attachment.container.board.course From 6e56a0706a9c9444a95607a4907c07aa93899399 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 19 Jan 2016 16:53:34 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E5=8A=A8=E6=80=81=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=8D=95=E8=AF=8D=E6=8A=98=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/blogs/_article.html.erb | 16 +++++++--------- app/views/blogs/_homepage.html.erb | 5 ++--- app/views/org_document_comments/show.html.erb | 7 ++++++- .../organizations/_org_course_homework.html.erb | 7 ++----- .../organizations/_org_course_message.html.erb | 16 +++++++--------- .../organizations/_org_course_news.html.erb | 6 +----- .../organizations/_org_course_poll.html.erb | 7 ++----- .../organizations/_org_project_issue.html.erb | 8 +------- .../organizations/_org_subfield_message.html.erb | 15 ++++++--------- .../organizations/_project_message.html.erb | 15 ++++++--------- app/views/organizations/_show_home_page.html.erb | 5 ++++- .../organizations/_show_org_document.html.erb | 5 ++++- app/views/projects/_project_news.html.erb | 6 +----- app/views/users/_course_homework.html.erb | 7 ++----- app/views/users/_course_message.html.erb | 15 ++++++--------- app/views/users/_course_news.html.erb | 6 +----- app/views/users/_course_poll.html.erb | 6 +----- app/views/users/_intro_content.html.erb | 12 ++++++++++++ app/views/users/_project_issue.html.erb | 8 +------- app/views/users/_project_message.html.erb | 15 ++++++--------- app/views/users/_user_blog.html.erb | 6 +----- app/views/users/_user_homework_detail.html.erb | 6 +----- app/views/users/user_system_messages.html.erb | 2 +- public/stylesheets/courses.css | 2 +- public/stylesheets/new_user.css | 4 ++-- public/stylesheets/project.css | 2 +- 26 files changed, 85 insertions(+), 124 deletions(-) create mode 100644 app/views/users/_intro_content.html.erb diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index 22df4499a..4e0270da2 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -81,15 +81,13 @@ 更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
-
-
- <% if activity.parent_id.nil? %> - <%= activity.content.to_s.html_safe%> - <% else %> - <%= activity.parent.content.to_s.html_safe%> - <% end %> -
-
+ <% if activity.parent_id.nil? %> + <% content= activity.content%> + <% else %> + <% content= activity.parent.content%> + <% end %> + <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %> +
- <% if User.current.logged? %> -
- <%= link_to '文章', organization_org_document_comments_path(@organization) %>  - <% if User.current.logged? %> - ( - <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> - ) - <% end %> -  |  - <%= link_to '成员', members_organization_path(@organization.id) %>  - <% if User.current.logged? %> - (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>) - <% end %> -
- <% end %> +
+ <%= link_to '文章', organization_org_document_comments_path(@organization) %>  + <%# if User.current.logged? %> + ( + <%= link_to OrgDocumentComment.where("organization_id =? and parent_id is null", @organization.id).count, organization_org_document_comments_path(@organization), :class => "linkBlue" %> + ) + <%# end %> + <% if User.current.logged? %> +  |  + <%= 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" %>) + <% end %> +
<%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %> diff --git a/app/views/organizations/_show_home_page.html.erb b/app/views/organizations/_show_home_page.html.erb index 32d3ad10d..f6d5fc9ea 100644 --- a/app/views/organizations/_show_home_page.html.erb +++ b/app/views/organizations/_show_home_page.html.erb @@ -2,15 +2,13 @@
- <% if User.current.logged? %>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
- <% end %> <% unless document.content.blank? %>
<%= document.content.html_safe %>
<% end %> - <% if params[:show_homepage].nil? and User.current.logged? %> + <% if params[:show_homepage].nil? %>
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>