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/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/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 diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb index 22df4499a..f10302079 100644 --- a/app/views/blogs/_article.html.erb +++ b/app/views/blogs/_article.html.erb @@ -78,18 +78,16 @@ 发帖时间:<%= 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) %>
-
-
- <% 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} %> +
<%#= 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 %>

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 %> diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 2007aec5a..9d3f76cc6 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -120,21 +120,19 @@
- <% 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/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb index e0d4f628f..d8df6a439 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 %> @@ -132,6 +132,11 @@
\ No newline at end of file diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 954c24dac..386022a82 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -50,13 +50,7 @@
-
-
- <% if activity.description? %> - <%= textAreailizable activity, :description, :attachments => activity.attachments %> - <% end %> -
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 75940b32c..66c672095 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -36,15 +36,12 @@ 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_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} %>
diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb index 3ce0926a8..b1823dcaa 100644 --- a/app/views/users/_user_blog.html.erb +++ b/app/views/users/_user_blog.html.erb @@ -33,11 +33,7 @@ 更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
-
-
- <%= activity.content.html_safe %> -
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index af48e2a21..15e4061f3 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -95,11 +95,7 @@ <% end %> -
-
- <%= homework_common.description.html_safe %> -
-
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>homework_common.id, :content=>homework_common.description} %>
diff --git a/app/views/users/user_system_messages.html.erb b/app/views/users/user_system_messages.html.erb index 66d7037e9..86ae56cc8 100644 --- a/app/views/users/user_system_messages.html.erb +++ b/app/views/users/user_system_messages.html.erb @@ -12,7 +12,7 @@ <%= system_message.subject.nil? ? "系统消息" : system_message.subject %>
-
+

<%= system_message.content.nil? ? system_message.description.html_safe : system_message.content.html_safe %>

diff --git a/config/routes.rb b/config/routes.rb index 8230e6848..ccbe67004 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' @@ -73,6 +74,7 @@ RedmineApp::Application.routes.draw do end end + constraints(Subdomain.new) do get '/', to: 'organizations#show' end @@ -1123,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) 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 diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 16ef3c5df..c483c953d 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1099,7 +1099,7 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{overflow: hidden; text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: normal !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index ac9b50d0f..13ea35974 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -581,7 +581,7 @@ a.homepageImageNumber:hover {color:#269ac9;} .homepageLeftMenuCourses {font-size:13px; border-bottom:1px solid #dddddd;} .homepageLeftMenuCoursesLine {height:38px; line-height:38px; vertical-align:middle;} .homepageLeftMenuCoursesLine:hover {background-color:#269ac9;} -a.coursesLineGrey {padding-left:25px; padding-right:25px; color:#808080; display:block;} +a.coursesLineGrey {padding-left:25px; padding-right:25px; color:#808080; display:block;} a.coursesLineGrey:hover {color:#ffffff;} .homepageLeftMenuMore {height:18px;} .homepageLeftMenuMore:hover {background-color:#269ac9;} @@ -836,7 +836,7 @@ a.sortArrowActiveU {background:url(images/post_image_list.png) -17px -20px no-re .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{overflow: hidden; text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: normal !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;display: inline} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 4cd41b31b..46364eee0 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -1109,7 +1109,7 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;} .postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} .postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} .postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} -.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{overflow: hidden; text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: normal !important;} +.homepagePostIntro p,.homepagePostIntro div,.homepagePostIntro em{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important;} .postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} .postDetailDate {color:#888888; font-size:12px; float:left;} .postDetailReply { margin-top:28px; color:#888888; float:right;}