diff --git a/app/assets/javascripts/org_document_comment.js.coffee b/app/assets/javascripts/org_document_comment.js.coffee
new file mode 100644
index 000000000..761567942
--- /dev/null
+++ b/app/assets/javascripts/org_document_comment.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/javascripts/org_member.js.coffee b/app/assets/javascripts/org_member.js.coffee
new file mode 100644
index 000000000..761567942
--- /dev/null
+++ b/app/assets/javascripts/org_member.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/javascripts/org_projects.js.coffee b/app/assets/javascripts/org_projects.js.coffee
new file mode 100644
index 000000000..761567942
--- /dev/null
+++ b/app/assets/javascripts/org_projects.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/javascripts/organizations.js.coffee b/app/assets/javascripts/organizations.js.coffee
new file mode 100644
index 000000000..761567942
--- /dev/null
+++ b/app/assets/javascripts/organizations.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_document_comment.css.scss b/app/assets/stylesheets/org_document_comment.css.scss
new file mode 100644
index 000000000..9359415ae
--- /dev/null
+++ b/app/assets/stylesheets/org_document_comment.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the org_document_comment controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/org_member.css.scss b/app/assets/stylesheets/org_member.css.scss
new file mode 100644
index 000000000..4bab7e008
--- /dev/null
+++ b/app/assets/stylesheets/org_member.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the OrgMember controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/org_projects.css.scss b/app/assets/stylesheets/org_projects.css.scss
new file mode 100644
index 000000000..12f4fef6a
--- /dev/null
+++ b/app/assets/stylesheets/org_projects.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the org_projects controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/organizations.css.scss b/app/assets/stylesheets/organizations.css.scss
new file mode 100644
index 000000000..39819880e
--- /dev/null
+++ b/app/assets/stylesheets/organizations.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the organizations 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/files_controller.rb b/app/controllers/files_controller.rb
index dd8dc84c4..cbbf36ea8 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -374,30 +374,29 @@ class FilesController < ApplicationController
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
Mailer.run.attachments_added(attachments[:files])
end
-
- if params[:course_attachment_type] && params[:course_attachment_type] != "5"
- case params[:course_attachment_type]
- when "1"
- tag_name = l(:label_courseware)
- when "2"
- tag_name = l(:label_software)
- when "3"
- tag_name = l(:label_media)
- when "4"
- tag_name = l(:label_code)
- when "6"
- tag_name = "论文"
- else
- tag_name = ""
+ if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
+ params[:course_attachment_type].each do |type|
+ tag_name = get_tag_name_by_type_number type
+ if !attachments.empty? && attachments[:files] && tag_name != ""
+ attachments[:files].each do |attachment|
+ attachment.tag_list.add(tag_name)
+ attachment.save
+ end
+ end
end
- if !attachments.empty? && attachments[:files] && tag_name != ""
- attachments[:files].each do |attachment|
- attachment.tag_list.add(tag_name)
- attachment.save
+ else
+ if params[:course_attachment_type] && params[:course_attachment_type] != "5"
+ tag_name = get_tag_name_by_type_number params[:course_attachment_type]
+ if !attachments.empty? && attachments[:files] && tag_name != ""
+ attachments[:files].each do |attachment|
+ attachment.tag_list.add(tag_name)
+ attachment.save
+ end
end
end
end
+
# TODO: 临时用 nyan
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
@@ -424,6 +423,23 @@ class FilesController < ApplicationController
end
end
+ def get_tag_name_by_type_number type
+ case type
+ when "1"
+ tag_name = l(:label_courseware)
+ when "2"
+ tag_name = l(:label_software)
+ when "3"
+ tag_name = l(:label_media)
+ when "4"
+ tag_name = l(:label_code)
+ when "6"
+ tag_name = "论文"
+ else
+ tag_name = ""
+ end
+ end
+
def tag_saveEx
@tags = params[:tag_name][:name]
@obj_id = params[:object_id]
diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb
new file mode 100644
index 000000000..60522dc3f
--- /dev/null
+++ b/app/controllers/org_document_comments_controller.rb
@@ -0,0 +1,63 @@
+class OrgDocumentCommentsController < ApplicationController
+ before_filter :find_organization, :only => [:new, :create, :show, :index]
+
+ layout 'base_org'
+
+ def new
+ @org_document_comment = OrgDocumentComment.new
+ end
+
+ def create
+ @org_document_comment = OrgDocumentComment.new(:organization_id => @organization.id, :creator_id => User.current.id)
+ @org_document_comment.title = params[:org_document_comment][:title]
+ @org_document_comment.content = params[:org_document_comment][:content]
+ if @org_document_comment.save
+ #flash[:notice] = 'success'
+ OrgActivity
+ redirect_to organization_org_document_comments_path(@organization)
+ else
+ redirect_to new_org_document_comment_path(:organization_id => @organization.id)
+ end
+ end
+ def show
+
+ end
+
+ def index
+ @documents = @organization.org_document_comments.where("parent_id is null").order("created_at desc")
+ end
+ def update
+ @org_document = OrgDocumentComment.find(params[:id])
+ @org_document.update_attributes(:title => params[:org_document_comment][:title], :content => params[:org_document_comment][:content])
+ respond_to do |format|
+ format.html {redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id)}
+ end
+ end
+
+ def edit
+ @org_document = OrgDocumentComment.find(params[:id])
+ @organization = Organization.find(params[:organization_id])
+ end
+
+ def add_reply
+ @document = OrgDocumentComment.find(params[:id]).root
+ @comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
+ @comment.content = params[:org_content]
+ @document.children << @comment
+ @document.save
+ end
+
+ def find_organization
+ @organization = Organization.find(params[:organization_id])
+ end
+
+ def destroy
+ @org_document_comment = OrgDocumentComment.find(params[:id])
+ org = @org_document_comment.organization
+ if @org_document_comment.destroy
+ if @org_document_comment.id == org.id
+ org.home_id == nil
+ end
+ end
+ end
+end
diff --git a/app/controllers/org_member_controller.rb b/app/controllers/org_member_controller.rb
new file mode 100644
index 000000000..4b842f9dc
--- /dev/null
+++ b/app/controllers/org_member_controller.rb
@@ -0,0 +1,57 @@
+class OrgMemberController < ApplicationController
+
+ def org_member_autocomplete
+ @org = Organization.find(params[:org])
+ @flag = params[:flag] || false
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def create
+ @org = Organization.find(params[:org])
+ if params[:membership].nil?
+ @fail_hint = l(:label_blank_user_lists_for_org)
+ else
+ member_ids = params[:membership][:user_ids]
+ role_id = params[:orgRole]
+ member_ids.each do |user_id|
+ member = OrgMember.create(:user_id=>user_id)
+ @org.org_members << member
+ OrgMemberRole.create(:org_member_id => member.id, :role_id => role_id)
+ end
+ end
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def update
+ @member = OrgMember.find(params[:id])
+ #@member.change_role params[:org_member][:role_ids]
+ @member_role = @member.org_member_roles[0]
+ @member_role.role_id = params[:org_member][:role_ids][0]
+ @member_role.save
+ @org = @member.organization
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def new
+
+ end
+
+ def destroy
+ member = OrgMember.find(params[:id])
+ @org = member.organization
+ member.destroy
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def index
+
+ end
+end
diff --git a/app/controllers/org_projects_controller.rb b/app/controllers/org_projects_controller.rb
new file mode 100644
index 000000000..733df95b7
--- /dev/null
+++ b/app/controllers/org_projects_controller.rb
@@ -0,0 +1,31 @@
+class OrgProjectsController < ApplicationController
+ def create
+ org_ids = params[:orgNames]
+ @project = Project.find(params[:project_id])
+ org_ids.each do |org_id|
+ OrgProject.create(:organization_id => org_id.to_i, :project_id => params[:project_id].to_i, :created_at => Time.now)
+ p 1
+ end
+ respond_to do |format|
+ format.js
+ end
+ end
+ def destroy
+ @project = Project.find(params[:project_id])
+ @org_project = OrgProject.find(params[:id])
+ @org_project.destroy
+
+ condition = '%%'
+ project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:project_id]}").map(&:organization_id)
+ if project_org_ids.empty?
+ @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page( 1).per(10)
+ @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count
+ else
+ project_org_ids = "(" + project_org_ids.join(',') + ")"
+ @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page( 1).per(10)
+ @org_count = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count
+ end
+ # @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count
+ @orgs_page = Paginator.new @org_count, 10,1
+ end
+end
diff --git a/app/controllers/organization_controller.rb b/app/controllers/organization_controller.rb
deleted file mode 100644
index 748fc1732..000000000
--- a/app/controllers/organization_controller.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-class OrganizationController < ApplicationController
- # layout 'base_projects'
- before_filter :require_admin, :except => [:index]
-
- def index
- #@projects = Project.find_by_sql("SELECT * FROM projects WHERE id IN (select MAX(id) from projects GROUP BY enterprise_name)")
- @organizations = Organization.all
- respond_to do |format|
- format.html
- end
- end
-
- def new
- @organizations = Organization.new
- respond_to do |format|
- format.html
- end
- end
-
- def create
- @organizations = Organization.new
- @organizations.name = params[:organization][:name]
- if @organizations.save
- redirect_to admin_organization_url
- end
- end
-
- def edit
- @organization = Organization.find params[:id]
- respond_to do |format|
- format.html
- end
- rescue Exception => e
- render_404
- end
-
- def update
- @organization = Organization.find params[:id]
- @organization.name = params[:organization][:name]
- if @organization.save
- redirect_to admin_organization_url
- end
- rescue Exception => e
- render_404
- end
-
- def destroy
- @organization = Organization.find params[:id]
- if @organization.destroy
- redirect_to admin_organization_url
- end
- rescue Exception => e
- render_404
- end
-end
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
new file mode 100644
index 000000000..b75742164
--- /dev/null
+++ b/app/controllers/organizations_controller.rb
@@ -0,0 +1,149 @@
+# encoding: utf-8
+class OrganizationsController < ApplicationController
+
+
+ helper :sort
+ include SortHelper
+ helper :custom_fields
+ include CustomFieldsHelper
+ include AvatarHelper
+ include WordsHelper
+ include GitlabHelper
+ include UserScoreHelper
+
+ include PollHelper
+ helper :user_score
+ helper :journals
+
+ # added by liuping 关注
+
+ helper :watchers
+ helper :activities
+
+ ### added by william
+ include ActsAsTaggableOn::TagsHelper
+
+ # fq
+ helper :words
+ helper :project_score
+ helper :issues
+ include UsersHelper
+ before_filter :find_organization, :only => [:show, :members]
+ layout 'base_org'
+ def index
+
+ end
+ def new
+ @organization = Organization.new
+ render :layout => 'new_base'
+ end
+ def create
+ @organization = Organization.new
+ @organization.name = params[:organization][:name]
+ @organization.description = params[:organization][:description]
+ @organization.is_public = params[:organization][:is_public]
+ @organization.creator_id = User.current.id
+ member = OrgMember.new(:user_id => User.current.id)
+
+ @organization.org_members << member
+ if @organization.save
+ OrgMemberRole.create(:org_member_id => member.id, :role_id => 11)
+ redirect_to organization_path(@organization)
+ end
+ end
+
+ def show
+ if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
+ @organization = Organization.find(params[:id])
+ @org_activities = OrgActivity.where('container_id =? and container_type =? ',
+ @organization.id, 'Organization ').order('updated_at desc').page(params[:page]).per(10)
+ @org_activities_count = OrgActivity.where('container_id =? and container_type =? ',
+ @organization.id, 'Organization ').order('updated_at desc').count
+ project_ids = @organization.projects.map(&:id) << 0
+ @org_project_activties = ForgeActivity.where("project_id in (#{project_ids.join(',')}) and forge_act_type in('Issue','Message','ProjectCreateInfo')").order("updated_at desc").page(params[:page] || 1).per(10)
+ @org_project_activties_count = ForgeActivity.where('project_id in (?)',project_ids.join(',')).count
+ #@org_activities = paginateHelper @org_activities, 10
+ @page = params[:page]
+ else
+ render_403
+ end
+ respond_to do |format|
+ format.html
+ format.js
+ end
+ end
+
+ def update
+ @organization = Organization.find(params[:id])
+ @organization.name = params[:organization][:name]
+ @organization.description = params[:organization][:description]
+ @organization.domain = params[:organization][:domain]
+ @organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
+ #@organization.name = params[:organization][:name]
+ @organization.save
+ respond_to do |format|
+ format.html { redirect_to setting_organization_path(@organization)}
+ end
+ end
+
+ def check_uniq
+ @check = false;
+ @org_name = params[:org_name].strip
+ @config_page = params[:config_page]
+ sameName = @config_page ? Organization.where('name = ? and id != ?',params[:org_name],params[:org_id].to_i).count == 0 : Organization.where('name = ?',params[:org_name]).count == 0
+ if sameName == true
+ @check = true
+ end
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def find_organization
+ @organization = Organization.find(params[:id])
+ end
+
+ def setting
+ @organization = Organization.find(params[:id])
+
+ if User.current.admin? || User.current.admin_of_org?(@organization)
+ else
+ render_403
+ end
+ end
+
+
+ def clear_org_avatar_temp
+
+ end
+
+ def set_homepage
+ @org = Organization.find(params[:id])
+ @org.home_id = params[:home_id]
+ @org.save
+ # respond_to do |format|
+ # format.html {redirect_to organization_path(org)}
+ # end
+ end
+
+ def autocomplete_search
+ @project = Project.find(params[:project_id])
+ #@flag = params[:flag] || false
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def members
+ @members = OrgMember.where("organization_id =?", @organization.id)
+ end
+
+ def more_org_projects
+ @organization = Organization.find params[:id]
+ @page = params[:page]
+ @org_projects = @organization.org_projects.reorder('created_at').page((params[:page].to_i || 1) +1).per(5)
+ respond_to do |format|
+ format.js
+ end
+ end
+end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 065adf596..baa7db060 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -69,6 +69,29 @@ class ProjectsController < ApplicationController
### added by william
include ActsAsTaggableOn::TagsHelper
+ #查找组织
+ def search_public_orgs_not_in_project
+ condition = '%%'
+ if !params[:name].nil?
+ condition = "%#{params[:name].strip}%".gsub(" ","")
+ end
+ project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:id]}").map(&:organization_id)
+ if project_org_ids.empty?
+ @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(10)
+ @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count
+ else
+ project_org_ids = "(" + project_org_ids.join(',') + ")"
+ @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(10)
+ @org_count = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count
+ end
+ # @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count
+ @orgs_page = Paginator.new @org_count, 10,params[:page]
+ #render :json => {:orgs => @orgs_not_in_project, :count => @org_count}.to_json
+ respond_to do |format|
+ format.js
+ end
+ end
+
def index
render_404
end
@@ -338,6 +361,15 @@ class ProjectsController < ApplicationController
@wiki ||= @project.wiki
@select_tab = params[:tab]
+ #找出所有不属于项目的公共组织
+ project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{@project.id}")
+ if project_org_ids.empty?
+ @orgs_not_in_project = Organization.where("is_public = 1")
+ else
+ project_org_ids = "(" + project_org_ids.join(',') + ")"
+ @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and is_public = 1")
+ end
+
# 处理从新建版本库返回来的错误信息
if !params[:repository_error_message].to_s.blank?
html = ""
@@ -833,5 +865,4 @@ class ProjectsController < ApplicationController
end
#gcmend
-
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 0d9588d24..273d48ccf 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1910,6 +1910,14 @@ class UsersController < ApplicationController
end
end
+ def user_organizations
+ @user = User.current
+ @orgs = @user.organizations
+ respond_to do |format|
+ format.html {render :layout => 'static_base'}
+ end
+ end
+
private
def find_user
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index e5cd9b52b..e08259b11 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -48,6 +48,15 @@ module ApplicationHelper
end
end
end
+ # 获取组织成员中文名字
+ def get_org_member_role_name member
+ case member.roles[0].name
+ when 'orgManager'
+ '管理人员'
+ when 'orgMember'
+ '组织成员'
+ end
+ end
# Time 2015-03-24 16:38:05
# Author lizanle
diff --git a/app/helpers/org_document_comment_helper.rb b/app/helpers/org_document_comment_helper.rb
new file mode 100644
index 000000000..b430114f2
--- /dev/null
+++ b/app/helpers/org_document_comment_helper.rb
@@ -0,0 +1,2 @@
+module OrgDocumentCommentHelper
+end
diff --git a/app/helpers/org_member_helper.rb b/app/helpers/org_member_helper.rb
new file mode 100644
index 000000000..fd70a0516
--- /dev/null
+++ b/app/helpers/org_member_helper.rb
@@ -0,0 +1,16 @@
+module OrgMemberHelper
+ include ApplicationHelper
+ def find_user_not_in_current_org_by_name org
+ if params[:q] && params[:q].lstrip.rstrip != ""
+ scope = Principal.active.sorted.not_member_of_org(org).like(params[:q])
+ else
+ scope = []
+ end
+ principals = paginateHelper scope,10
+ s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')
+ links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
+ link_to text, org_member_autocomplete_org_member_index_path(parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js')), :remote => true
+ }
+ s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" )
+ end
+end
diff --git a/app/helpers/org_projects_helper.rb b/app/helpers/org_projects_helper.rb
new file mode 100644
index 000000000..f3a7025bd
--- /dev/null
+++ b/app/helpers/org_projects_helper.rb
@@ -0,0 +1,2 @@
+module OrgProjectsHelper
+end
diff --git a/app/helpers/organizations_helper.rb b/app/helpers/organizations_helper.rb
index 10321ba16..607d2af5c 100644
--- a/app/helpers/organizations_helper.rb
+++ b/app/helpers/organizations_helper.rb
@@ -1,2 +1,22 @@
-module EnterprisesHelper
+# encoding: utf-8
+module OrganizationsHelper
+ include ApplicationHelper
+
+
+ def find_user_not_in_current_org_by_name org
+ if params[:q] && params[:q].lstrip.rstrip != ""
+ scope = Principal.active.sorted.not_member_of_org(org).like(params[:q])
+ else
+ scope = []
+ end
+ principals = paginateHelper scope,10
+ s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals')
+ links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
+ link_to text, org_member_autocomplete_org_member_index_path( parameters.merge(:q => params[:q],:flag => true,:org=>org, :format => 'js')), :remote => true
+ }
+ s + content_tag('ul', links,:class => 'wlist',:style=>'float:left !important', :id => "org_member_pagination_links" )
+ end
+
+
+
end
diff --git a/app/models/org_activity.rb b/app/models/org_activity.rb
new file mode 100644
index 000000000..c48ebdf8e
--- /dev/null
+++ b/app/models/org_activity.rb
@@ -0,0 +1,5 @@
+class OrgActivity < ActiveRecord::Base
+ # attr_accessible :title, :body
+ belongs_to :org_act ,:polymorphic => true
+ belongs_to :container,:polymorphic => true
+end
diff --git a/app/models/org_document_comment.rb b/app/models/org_document_comment.rb
new file mode 100644
index 000000000..2b3c9132a
--- /dev/null
+++ b/app/models/org_document_comment.rb
@@ -0,0 +1,16 @@
+class OrgDocumentComment < ActiveRecord::Base
+ attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title,:sticky,:locked
+ include Redmine::SafeAttributes
+ belongs_to :organization
+ belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id'
+
+ 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
+
+ def document_save_as_org_activity
+ if(self.parent().nil?)
+ self.org_acts << OrgActivity.new(:user_id => User.current.id, :container_id => self.organization.id, :container_type => 'Organization')
+ end
+ end
+end
diff --git a/app/models/org_member.rb b/app/models/org_member.rb
new file mode 100644
index 000000000..a1c61f99d
--- /dev/null
+++ b/app/models/org_member.rb
@@ -0,0 +1,8 @@
+class OrgMember < ActiveRecord::Base
+ attr_accessible :organization_id, :role, :user_id
+ belongs_to :organization
+ belongs_to :user
+ has_many :roles ,:through => :org_member_roles,:foreign_key => 'role_id'
+ has_many :org_member_roles,:dependent => :destroy
+
+end
diff --git a/app/models/org_member_role.rb b/app/models/org_member_role.rb
new file mode 100644
index 000000000..0ce4f8141
--- /dev/null
+++ b/app/models/org_member_role.rb
@@ -0,0 +1,5 @@
+class OrgMemberRole < ActiveRecord::Base
+ # attr_accessible :title, :body
+ belongs_to :org_member
+ belongs_to :role
+end
diff --git a/app/models/org_project.rb b/app/models/org_project.rb
new file mode 100644
index 000000000..ec01013fc
--- /dev/null
+++ b/app/models/org_project.rb
@@ -0,0 +1,5 @@
+class OrgProject < ActiveRecord::Base
+ # attr_accessible :title, :body
+ belongs_to :organization
+ belongs_to :project
+end
diff --git a/app/models/organization.rb b/app/models/organization.rb
index 5f52dee98..7778da477 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -1,5 +1,14 @@
class Organization < ActiveRecord::Base
- attr_accessible :logo_link, :name
+ attr_accessible :name, :description, :creator_id, :home_id, :domain, :is_public
+ has_many :org_members, :dependent => :destroy
+ has_many :org_projects ,:dependent => :destroy
+ has_many :projects,:through => :org_projects
+ has_many :org_document_comments, :dependent => :destroy
+ has_many :users, :through => :org_members
+ validates_uniqueness_of :name
+ after_create :save_as_org_activity
- has_many :projects
+ def save_as_org_activity
+ OrgActivity.create(:user_id => User.current.id, :org_act_id => self.id, :org_act_type => 'CreateOrganization', :container_id => self.id, :container_type => 'Organization')
+ end
end
diff --git a/app/models/principal.rb b/app/models/principal.rb
index 0f0746f78..dd376f609 100644
--- a/app/models/principal.rb
+++ b/app/models/principal.rb
@@ -87,6 +87,16 @@ class Principal < ActiveRecord::Base
end
}
+ scope :not_member_of_org, lambda {|org|
+ orgs = [org] unless org.is_a?(Array)
+ if orgs.empty?
+ where("1=0")
+ else
+ ids = orgs.map(&:id)
+ where("#{Principal.table_name}.id NOT IN (SELECT DISTINCT user_id FROM #{OrgMember.table_name} WHERE organization_id IN (?))", ids)
+ end
+ }
+
scope :sorted, lambda { order(*Principal.fields_for_order_statement)}
scope :applied_members, lambda {|project|
diff --git a/app/models/project.rb b/app/models/project.rb
index fd1012fa0..0b0420920 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -69,6 +69,7 @@ class Project < ActiveRecord::Base
has_many :applied_projects, :dependent => :destroy
has_many :invite_lists, :dependent => :destroy
has_one :dts
+ has_many :organizations,:through => :org_projects
# end
#ADDED BY NIE
@@ -96,7 +97,8 @@ class Project < ActiveRecord::Base
# 关联虚拟表
has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy
- belongs_to :organization
+ has_many :org_projects,:dependent => :destroy
+ has_many :organization,:through => :org_projects
# has_many :journals
diff --git a/app/models/role.rb b/app/models/role.rb
index 8bf5ebc05..f6a24a27f 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -55,6 +55,8 @@ class Role < ActiveRecord::Base
has_many :member_roles, :dependent => :destroy
has_many :members, :through => :member_roles
+ has_many :org_member_roles, :dependent => :destroy
+ has_many :org_members,:through => :org_member_roles
acts_as_list
serialize :permissions, ::Role::PermissionsAttributeCoder
diff --git a/app/models/user.rb b/app/models/user.rb
index d79ae575a..3e7bc2ddb 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -100,8 +100,11 @@ class User < Principal
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'"
has_one :blog, :class_name => 'Blog', :foreign_key => "author_id"
+ has_many :org_document_comments, :dependent =>:destroy
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
belongs_to :auth_source
+ has_many :org_members
+ has_many :organizations, :through => :org_members
belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang
## added by xianbo for delete
# has_many :biding_projects, :dependent => :destroy
@@ -775,6 +778,21 @@ class User < Principal
courses.to_a.include?(course)
end
+ def member_of_org?(org)
+ OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count > 0
+ end
+
+ def admin_of_org?(org)
+ if OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count == 0
+ return false
+ end
+ role = OrgMember.where("user_id =? and organization_id =?", self.id, org.id)[0].roles[0]
+ unless role.nil?
+ role.name == 'orgManager' ? true : false
+ else
+ false
+ end
+ end
def member_of_course_group?(course_group)
course_groups.to_a.include?(course_group)
end
diff --git a/app/views/files/_upload_course_files.erb b/app/views/files/_upload_course_files.erb
index f023e8413..86ec79e67 100644
--- a/app/views/files/_upload_course_files.erb
+++ b/app/views/files/_upload_course_files.erb
@@ -10,12 +10,12 @@
- 课件 |
- 软件 |
- 媒体 |
- 代码 |
- 论文 |
- 其他
+ 课件 |
+ 软件 |
+ 媒体 |
+ 代码 |
+ 论文 |
+ 其他
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index c750ff3b5..6e62e2d5e 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -86,6 +86,12 @@
<%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
+
+ <%= link_to "我的组织", user_organizations_user_path(:id => User.current.id), :class => "menuGrey"%>
+
+
+ <%= link_to "新建组织", new_organization_path, :class => "menuGrey"%>
+
<%= link_to "退出",signout_path,:class => "menuGrey",:method => "post"%>
diff --git a/app/views/layouts/_org_projects.html.erb b/app/views/layouts/_org_projects.html.erb
new file mode 100644
index 000000000..be65fd516
--- /dev/null
+++ b/app/views/layouts/_org_projects.html.erb
@@ -0,0 +1,12 @@
+<% projects.each do |project|%>
+ <% pro = Project.find project.project_id %>
+
+<% end %>
+<% if projects.size == 5%>
+
+<% end%>
\ No newline at end of file
diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb
new file mode 100644
index 000000000..6b4eab72a
--- /dev/null
+++ b/app/views/layouts/base_org.html.erb
@@ -0,0 +1,117 @@
+<% @nav_dispaly_project_label = 1
+ @nav_dispaly_forum_label = 1 %>
+<%#@nav_dispaly_project_label = 1 %>
+
+
+
+
+
<%= h html_title %>
+
+
+ <%= csrf_meta_tag %>
+ <%= favicon %>
+ <%= javascript_heads %>
+ <%= heads_for_theme %>
+ <%= 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'%>
+
+ <%= call_hook :view_layouts_base_html_head %>
+
+ <%= yield :header_tags -%>
+
+
+
+
+
+
+ <% if User.current.logged? %>
+ <%= render :partial => 'layouts/logined_header' %>
+ <% else %>
+ <%= render :partial => 'layouts/unlogin_header' %>
+ <% end %>
+
+
+
+
+
+
+
+
+
+
+ <%= image_tag(url_to_avatar(@organization),width:"60", height: "60", :id=>'nh_user_tx') %>
+ <% if User.current.logged?%>
+ <% if User.current.id == @organization.creator_id%>
+
+ <% end %>
+ <% end%>
+
+
+
+ <%= 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) %>
+
配置
+ <% 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 => 'layouts/footer' %>
+
+
+
+
diff --git a/app/views/layouts/new_base.html.erb b/app/views/layouts/new_base.html.erb
index 6ab83d393..a2bbee9e3 100644
--- a/app/views/layouts/new_base.html.erb
+++ b/app/views/layouts/new_base.html.erb
@@ -13,7 +13,7 @@
<%= javascript_heads %>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
- <%= stylesheet_link_tag 'public', 'leftside', 'courses','header','prettify'%>
+ <%= stylesheet_link_tag 'public', 'leftside', 'courses','header','prettify', 'org'%>
<%= javascript_include_tag "course","header",'prettify' %>
<%= yield :header_tags -%>
diff --git a/app/views/org_document_comments/_new.html.erb b/app/views/org_document_comments/_new.html.erb
new file mode 100644
index 000000000..3a3356c66
--- /dev/null
+++ b/app/views/org_document_comments/_new.html.erb
@@ -0,0 +1,57 @@
+<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
+
+<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
+
+
+
+
+
+
+
+
+ <%= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
+
+
+
+
+
+
+
+
+
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/org_document_comments/add_reply.js.erb b/app/views/org_document_comments/add_reply.js.erb
new file mode 100644
index 000000000..5d54af2bf
--- /dev/null
+++ b/app/views/org_document_comments/add_reply.js.erb
@@ -0,0 +1,3 @@
+
+$("#organization_document_<%= @document.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document}) %>");
+init_activity_KindEditor_data(<%= @document.id %>,"","87%");
\ No newline at end of file
diff --git a/app/views/org_document_comments/destroy.js.erb b/app/views/org_document_comments/destroy.js.erb
new file mode 100644
index 000000000..bcebe9d37
--- /dev/null
+++ b/app/views/org_document_comments/destroy.js.erb
@@ -0,0 +1 @@
+location.reload();
\ No newline at end of file
diff --git a/app/views/org_document_comments/edit.html.erb b/app/views/org_document_comments/edit.html.erb
new file mode 100644
index 000000000..b4f8662a3
--- /dev/null
+++ b/app/views/org_document_comments/edit.html.erb
@@ -0,0 +1,44 @@
+<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
+
+
+<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id),:method => 'put', :id => 'new_org_document_form' do |f| %>
+
+
+
+
+
+
+
+
+ <%= kindeditor_tag 'org_document_comment[content]',@org_document.content, :editor_id => 'org_document_description_editor', :height => "150px" %>
+
+
+
+
+
+
+
+
+
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/org_document_comments/index.html.erb b/app/views/org_document_comments/index.html.erb
new file mode 100644
index 000000000..d9b1d9579
--- /dev/null
+++ b/app/views/org_document_comments/index.html.erb
@@ -0,0 +1,24 @@
+<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor" %>
+
+<%= render :partial => 'new' %>
+<% unless @documents.nil? %>
+ <% @documents.each do |document| %>
+
+ <%= render :partial => 'organizations/show_org_document', :locals => {:document => document} %>
+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/org_document_comments/new.html.erb b/app/views/org_document_comments/new.html.erb
new file mode 100644
index 000000000..11a7e9359
--- /dev/null
+++ b/app/views/org_document_comments/new.html.erb
@@ -0,0 +1,40 @@
+<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
+
+<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
+
+
+
+
+
+
+
+ <%= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
+
+
+
+
+
+
+
+
+
+
+
+<% 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
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/org_member/create.js.erb b/app/views/org_member/create.js.erb
new file mode 100644
index 000000000..f1e48281f
--- /dev/null
+++ b/app/views/org_member/create.js.erb
@@ -0,0 +1,7 @@
+<% if @fail_hint %>
+ alert("<%= @fail_hint %>");
+<% else %>
+ $("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
+ $("#principals_for_new_member").html('');
+ $("#org_members_count_id").html("<%= @org.org_members.count %>");
+<% end %>
\ No newline at end of file
diff --git a/app/views/org_member/destroy.js.erb b/app/views/org_member/destroy.js.erb
new file mode 100644
index 000000000..d87e62c17
--- /dev/null
+++ b/app/views/org_member/destroy.js.erb
@@ -0,0 +1,3 @@
+$("#org_members_count_id").html("");
+$("#org_members_count_id").html("<%= @org.org_members.count %>")
+$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
\ No newline at end of file
diff --git a/app/views/org_member/org_member_autocomplete.js.erb b/app/views/org_member/org_member_autocomplete.js.erb
new file mode 100644
index 000000000..05cf3947c
--- /dev/null
+++ b/app/views/org_member/org_member_autocomplete.js.erb
@@ -0,0 +1,23 @@
+<% if @org%>
+ var checked = $("#principals_for_new_member input:checked").size();
+ if(checked > 0)
+ {
+ alert('翻页或搜索后将丢失当前选择的用户数据!');
+ }
+ <% if @flag == "true"%>
+ $('#principals_for_new_member').html('<%= escape_javascript(find_user_not_in_current_org_by_name(@org)) %>');
+ <% else%>
+ $('#principals_for_new_member').html('<%= escape_javascript(find_user_not_in_current_org_by_name(@org)) %>');
+ <% end%>
+
+<%end%>
+var collection=$("#principals_for_new_member").children("#principals").children("label");
+collection.css("text-overflow","ellipsis");
+collection.css("white-space","nowrap");
+collection.css("width","200px");
+collection.css("overflow","hidden");
+for(i=0;i
"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
\ No newline at end of file
diff --git a/app/views/org_projects/create.js.erb b/app/views/org_projects/create.js.erb
new file mode 100644
index 000000000..545918c73
--- /dev/null
+++ b/app/views/org_projects/create.js.erb
@@ -0,0 +1,6 @@
+
+$("#search_orgs_result_list").html("");
+//$("#search_orgs_result_list").append('');
+$("#added_orgs").html("");
+$("#paginator").css("display", "none");
+$("#added_orgs").html('<%= escape_javascript(render :partial => "projects/settings/added_orgs", :locals => {:orgs => @project.organizations, :project_id => @project.id}) %>')
\ No newline at end of file
diff --git a/app/views/org_projects/destroy.js.erb b/app/views/org_projects/destroy.js.erb
new file mode 100644
index 000000000..49ea1dc33
--- /dev/null
+++ b/app/views/org_projects/destroy.js.erb
@@ -0,0 +1,22 @@
+//$("#search_orgs_result_list").html("");
+////$("#paginator").css("display", "none");
+$("#added_orgs").html("");
+$("#added_orgs").html('<%= escape_javascript(render :partial => "projects/settings/added_orgs", :locals => {:orgs => @project.organizations, :project_id => @project.id}) %>')
+//$.ajax({
+// url: '<%#= url_for(:controller => 'projects', :action => 'search_public_orgs_not_in_project') %>'+'?page=1',
+// type:'get'
+//});
+$("#search_orgs_result_list").html("");
+$("#search_orgs_result_list").append('')
+<% if @org_count > 10 %>
+$("#paginator").html(' <%= pagination_links_full @orgs_page, @org_count ,:per_page_links => true,:remote =>true,:flag=>true%>');
+$("#paginator").css("display", "block");
+<% else %>
+$("#paginator").css("display", "none");
+<% end %>
+
diff --git a/app/views/organization/_form.html.erb b/app/views/organization/_form.html.erb
deleted file mode 100644
index 80cc76850..000000000
--- a/app/views/organization/_form.html.erb
+++ /dev/null
@@ -1,21 +0,0 @@
-<%= error_messages_for 'project' %>
-
-<% unless @organizations.new_record? %>
-
- <%= render :partial=>"avatar/avatar_form",:locals=> {source:@organizations} %>
-
-<% end %>
-
-
- <%= l(:label_organization_name)%>:
-
-
- <%= f.text_field :name, :required => true, :size => 60, :style => "width:290px;" %>
-
-
-
- <%#= l(:field_description)%>
-
-
-
-
diff --git a/app/views/organization/edit.html.erb b/app/views/organization/edit.html.erb
deleted file mode 100644
index 60b7c06a0..000000000
--- a/app/views/organization/edit.html.erb
+++ /dev/null
@@ -1,25 +0,0 @@
-<%= form_for(@organization) do |f|%>
-
- <%=l(:label_organization_edit)%>
-
-
- <%= error_messages_for 'project' %>
-
- <%= render :partial=>"avatar/avatar_form",:locals=> {source:@organization} %>
-
-
-
- <%= l(:label_organization_name)%>:
-
-
- <%= f.text_field :name, :required => true, :size => 60, :style => "width:290px;" %>
-
-
- <%= submit_tag l(:button_create), :class => "enterprise"%>
-
-
- <%#= submit_tag l(:button_create_and_continue), :name => 'continue' %>
- <%= javascript_tag "$('#project_name').focus();" %>
-<% end %>
-
-<% html_title(l(:label_organization_edit)) -%>
\ No newline at end of file
diff --git a/app/views/organization/index.html.erb b/app/views/organization/index.html.erb
deleted file mode 100644
index f1c50d6ab..000000000
--- a/app/views/organization/index.html.erb
+++ /dev/null
@@ -1,31 +0,0 @@
-
- <%= l(:label_all_enterprises) %>
-
-
-
- <%= l(:label_all_enterprises) %>
-
-
- <% if @organizations.empty? %>
-
- <%= l(:label_enterprise_nil) %>
-
- <% else %>
- <% @organizations.each do |organization| %>
- <% unless organization.name.blank? %>
-
-
-
- <%= link_to organization.name, home_path(:organization => organization.id) %>
-
-
- <% end %>
- <% end %>
- <% end %>
-
-
-
-
-<% html_title(l(:label_enterprise_all)) -%>
diff --git a/app/views/organization/new.html.erb b/app/views/organization/new.html.erb
deleted file mode 100644
index 163f4a5f5..000000000
--- a/app/views/organization/new.html.erb
+++ /dev/null
@@ -1,18 +0,0 @@
-<%= form_for(@organizations, :method => :post,
- :name => 'new_form',
- :url => {:controller => 'organization',
- :action => 'create'}) do |f|%>
-
- <%=l(:label_organization_new)%>
-
-
- <%= render :partial => 'form', :locals => { :f => f } %>
-
- <%= submit_tag l(:button_create), :class => "enterprise"%>
-
-
- <%#= submit_tag l(:button_create_and_continue), :name => 'continue' %>
- <%= javascript_tag "$('#project_name').focus();" %>
-<% end %>
-
-<% html_title(l(:label_organization_new)) -%>
\ No newline at end of file
diff --git a/app/views/organizations/_new_org_avatar_form.html.erb b/app/views/organizations/_new_org_avatar_form.html.erb
new file mode 100644
index 000000000..8b80641e8
--- /dev/null
+++ b/app/views/organizations/_new_org_avatar_form.html.erb
@@ -0,0 +1,33 @@
+
+
+
+
+<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "upbtn fl" %>
+
+<%= file_field_tag 'avatar[image]',
+ :id => 'upload_org_logo',
+ :class => 'undis upload_file',
+ :size => "1",
+ :multiple => true,
+ :data => {
+ :max_file_size => Setting.upload_avatar_max_size,
+ :max_file_size_message => l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i)),
+ :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
+ :file_type => Redmine::Configuration['pic_types'].to_s,
+ :type_support_message => l(:error_pic_type),
+ :upload_path => upload_avatar_path(:format => 'js'),
+ :description_placeholder => nil ,# l(:label_optional_description)
+ :source_type => source.class.to_s,
+ :source_id => source.id.to_s
+ } %>
+
+<% content_for :header_tags do %>
+ <%= javascript_include_tag 'jq-upload/jquery.ui.widget', 'jq-upload/jquery.iframe-transport', 'jq-upload/jquery.fileupload', 'jq-upload/upload' %>
+<% end %>
+
diff --git a/app/views/organizations/_org_member_list.html.erb b/app/views/organizations/_org_member_list.html.erb
new file mode 100644
index 000000000..f67b25811
--- /dev/null
+++ b/app/views/organizations/_org_member_list.html.erb
@@ -0,0 +1,42 @@
+<% members.each do |member|%>
+
+ <%= User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %>
+
+ <%= get_org_member_role_name member %>
+ <%= form_for(member, {:as => :org_member, :remote => true, :url => org_member_path(member),
+ :method => :put,
+ :html => {:id => "org-member-#{member.id}-roles-form", :style=>'display:none'}}
+ ) do |f| %>
+ <% Role.givable.where("id in (11,12)").each do |role| %>
+
+ <%= radio_button_tag 'org_member[role_ids][]', role.id, member.roles.include?(role) %>
+
+ <% if User.current.language == "zh" %>
+ <% if role.id == 11 %>
+ 管理人员
+ <% elsif role.id == 12 %>
+ 组织成员
+ <% end %>
+ <% else %>
+ <%= h role %>
+ <% end %>
+
+
+ <% end %>
+ <%= hidden_field_tag 'membership[role_ids][]', '' %>
+
+ <% end %>
+
+ <% if ( (User.current.id == member.organization.creator_id || User.current.admin_of_org?(member.organization) ) && member.user_id != member.organization.creator_id )%>
+ 编辑
+ <%= link_to '删除', org_member_path(member.id),:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/organizations/_org_members.html.erb b/app/views/organizations/_org_members.html.erb
new file mode 100644
index 000000000..3940a6576
--- /dev/null
+++ b/app/views/organizations/_org_members.html.erb
@@ -0,0 +1,29 @@
+<%= stylesheet_link_tag 'courses' %>
+
+
+
组织成员
+
+
+
+
+
+
+ <% members.each do |member| %>
+
+
+ <% end%>
+
+
+ <%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/organizations/_org_project_activities.html.erb b/app/views/organizations/_org_project_activities.html.erb
new file mode 100644
index 000000000..b46996661
--- /dev/null
+++ b/app/views/organizations/_org_project_activities.html.erb
@@ -0,0 +1,28 @@
+<% org_project_activties.each do |act|%>
+<% if act %>
+ <% if act %>
+ <% case act.forge_act_type.to_s %>
+ <% when 'Issue' %>
+ <%= render :partial => 'organizations/org_project_issue', :locals => {:activity => act.forge_act,:user_activity_id =>act.id} %>
+ <% when 'Message' %>
+ <%= render :partial => 'organizations/project_message', :locals => {:activity => act.forge_act,:user_activity_id =>act.id} %>
+ <% when 'ProjectCreateInfo'%>
+ <%= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %>
+ <% end %>
+ <% end %>
+<% end %>
+<% end %>
+<% if org_act_count == 10 || pro_act_count == 10 %>
+ 展开更多<%=link_to "", organization_path(org,:page => page.to_i + 1),:id => "more_org_activities_link",:remote => "true",:class => "none" %>
+ <%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
+<% end%>
+
+
+
diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb
new file mode 100644
index 000000000..573429752
--- /dev/null
+++ b/app/views/organizations/_org_project_issue.html.erb
@@ -0,0 +1,136 @@
+
+
+
+ <%= 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_issues_path(activity.project), :class => "newsBlue ml15"%>
+
+
+ <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %>
+
+ <%#= get_issue_priority(activity.priority_id)[1] %>
+
+
+
+
指派给
+ <% unless activity.assigned_to_id.nil? %>
+ <% if activity.try(:assigned_to).try(:realname) == ' ' %>
+ <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %>
+ <% end %>
+ <% end %>
+
+
+ 时间:
+ <%=format_time(activity.created_on) %>
+
+
+
+
+ <% if activity.description? %>
+ <%= textAreailizable activity, :description, :attachments => activity.attachments %>
+ <% end %>
+
+
+
+
+
+
+
+ <% if activity.attachments.any? %>
+ <% activity.attachments.each do |attachment| %>
+
+
+
+ <%= link_to_short_attachment attachment,:length=> 58, :class => 'link_file_a fl newsBlue', :download => true -%>
+
+ <% if attachment.is_text? %>
+ <%= link_to image_tag('magnifier.png'),
+ :controller => 'attachments',
+ :action => 'show',
+ :id => attachment,
+ :class => 'fl',
+ :filename => attachment.filename %>
+ <% end %>
+
+ (
+ <%= number_to_human_size attachment.filesize %>)
+
+
+ <%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
+ <%= format_time(attachment.created_on) %>
+
+
+ <% end %>
+ <% end %>
+
+
+
+
+ <% count = activity.journals.count %>
+
+
+
+
回复(<%= count %>)
+
<%#= format_date(activity.updated_on) %>
+ <% if count > 3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.journals.reorder("created_on desc").each do |reply| %>
+
+ <% replies_all_i=replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:user).try(:realname) == ' ' %>
+ <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+
+ <% if reply.details.any? %>
+ <% details_to_strings(reply.details).each do |string| %>
+
<%= string %>
+ <% end %>
+ <% end %>
+
<%= reply.notes.nil? ? "" : reply.notes.html_safe %>
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
+
+
diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb
new file mode 100644
index 000000000..d966d8e18
--- /dev/null
+++ b/app/views/organizations/_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/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb
new file mode 100644
index 000000000..85ed08f2f
--- /dev/null
+++ b/app/views/organizations/_project_message.html.erb
@@ -0,0 +1,100 @@
+
+
+
+ <%= 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_boards_path(activity.project), :class => "newsBlue ml15 mr5"%>
+
+
+
+ <% if activity.parent_id.nil? %>
+ <%= link_to activity.subject.to_s.html_safe, project_boards_path(activity.project,:parent_id =>activity.id, :topic_id => activity.id), :class=> "postGrey"
+ %>
+ <% else %>
+ <%= link_to activity.parent.subject.to_s.html_safe, project_boards_path(activity.project,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey"
+ %>
+ <% end %>
+
+
+ 时间:<%= format_time(activity.created_on) %>
+
+
+
+ <% if activity.parent_id.nil? %>
+ <%= activity.content.to_s.html_safe%>
+ <% else %>
+ <%= activity.parent.content.to_s.html_safe%>
+ <% end %>
+
+
+
+
+
+
+
+
+
+ <% count = 0 %>
+ <% if activity.parent %>
+ <% count=activity.parent.children.count%>
+ <% else %>
+ <% count=activity.children.count%>
+ <% end %>
+
+
+
+
回复(
+ <%=count %>
+ )
+
<%#=format_date(activity.updated_on)%>
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% activity= activity.parent_id.nil? ? activity : activity.parent %>
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.children.reorder("created_on desc").each do |reply| %>
+
+ <% replies_all_i=replies_all_i+1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %>
+ <%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+
+ <%= reply.content.html_safe %>
+
+
+
+ <% end %>
+
+
+ <% 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
new file mode 100644
index 000000000..4177c3688
--- /dev/null
+++ b/app/views/organizations/_show_org_document.html.erb
@@ -0,0 +1,130 @@
+
+
+
+ <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_path(document.creator_id) %>
+
+
+
+ <%= 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 %>
+
+
<%= document.title %>
+
+ 发布时间:<%= 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) %>
+
+
+
+
+
+ <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_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), :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 %>
+
+
+ <% comments_for_doc = document.children.reorder("created_at desc") %>
+ <% count = document.children.count() %>
+
+
+
+
回复(<%= count %>)
+ <% if count > 3 %>
+
+ <% end %>
+
+
+
+ <% reply_id = 0 %>
+ <% comments_for_doc.each do |comment| %>
+ <% reply_id += 1 %>
+
+ <%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_path(comment.creator_id) %>
+
+
+ <%= link_to User.find(comment.creator_id), user_path(comment.creator_id), :class => "newsBlue mr10 f14" %>
+ <%= format_activity_day(comment.created_at) %> <%= format_time(comment.created_at, false) %>
+
+ <% unless comment.content.blank? %>
+
<%= comment.content.html_safe %>
+ <% end %>
+
+
+
+ <% end %>
+
+
+
+
+ <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %>
+
+
+
+ <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id), :method => "post", :remote => true) do |f| %>
+
+
+
+
+
发送
+
+
+
+ <% end %>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/organizations/autocomplete_search.js.erb b/app/views/organizations/autocomplete_search.js.erb
new file mode 100644
index 000000000..357ef668c
--- /dev/null
+++ b/app/views/organizations/autocomplete_search.js.erb
@@ -0,0 +1,13 @@
+<% if @project%>
+var checked = $("#not_org_members input:checked").size();
+if(checked > 0)
+{
+ alert('翻页或搜索后将丢失当前选择的用户数据!');
+}
+<% if @flag == "true"%>
+$('#new_orgs_for_project').html('<%= escape_javascript(search_public_orgs_not_in_project(@project.id)) %>');
+<% else%>
+$('#new_orgs_for_project').html('<%= escape_javascript(search_public_orgs_not_in_project(@project.id)) %>');
+<% end%>
+
+<%end%>
diff --git a/app/views/organizations/check_uniq.js.erb b/app/views/organizations/check_uniq.js.erb
new file mode 100644
index 000000000..f38578025
--- /dev/null
+++ b/app/views/organizations/check_uniq.js.erb
@@ -0,0 +1,22 @@
+<% if !@org_name.blank? %>
+ <%if @check == false %>
+ $checkName = false
+ <% if @config_page%>
+ $("#check_name_hint").html('名字不能重复').show();
+ <% else%>
+ $("#organization_name_notice").html('名字不能重复').show();
+
+ <%end%>
+
+ <% else %>
+ $checkName = true;
+ <% if @config_page%>
+ $("#check_name_hint").html('名字可以使用 ').show();
+ <% else%>
+
+ $("#organization_name_notice").html('名字可以使用 ').show();
+ <%end%>
+ <%end%>
+<% else %>
+$("#check_name_hint").html('名字不能为空 ').show();
+<% end %>
\ No newline at end of file
diff --git a/app/views/organizations/create.js.erb b/app/views/organizations/create.js.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/organizations/members.html.erb b/app/views/organizations/members.html.erb
new file mode 100644
index 000000000..91e80b232
--- /dev/null
+++ b/app/views/organizations/members.html.erb
@@ -0,0 +1 @@
+<%= render :partial => 'org_members', :locals => {:members => @members, :organization => @organization} %>
\ No newline at end of file
diff --git a/app/views/organizations/more_org_projects.js.erb b/app/views/organizations/more_org_projects.js.erb
new file mode 100644
index 000000000..029661d39
--- /dev/null
+++ b/app/views/organizations/more_org_projects.js.erb
@@ -0,0 +1 @@
+$("#show_more_org_project").replaceWith("<%= escape_javascript( render :partial => 'layouts/org_projects',:locals => {:projects => @org_projects,:org_id => @organization, :page => @page} )%>");
diff --git a/app/views/organizations/new.html.erb b/app/views/organizations/new.html.erb
new file mode 100644
index 000000000..1ab3ad933
--- /dev/null
+++ b/app/views/organizations/new.html.erb
@@ -0,0 +1,110 @@
+
+<% @nav_dispaly_organization_label = 1
+ @nav_dispaly_forum_label = 1 %>
+<%= error_messages_for 'organization' %>
+
+
<%= l(:label_organization_new)%>
+
+
+
+ <%= labelled_form_for @organization do |f| %>
+
+
+
+ * <%= l(:label_organization_name)%> :
+
+
+
+
+
+
+ <%= l(:label_organization_description) %> :
+
+
+
+
+
+ <%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :maxlength => Project::IDENTIFIER_MAX_LENGTH,
+ value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
+
+
+
+ 公开 :
+
+ (打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)
+
+
+
+ 提交
+ <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
+
+
+ <% end%>
+
+
+
+
+<% html_title(l(:label_organization_new)) -%>
+
+
+
diff --git a/app/views/organizations/set_homepage.js.erb b/app/views/organizations/set_homepage.js.erb
new file mode 100644
index 000000000..b25c4c4d4
--- /dev/null
+++ b/app/views/organizations/set_homepage.js.erb
@@ -0,0 +1,2 @@
+//location.reload();
+window.location.href ='<%= organization_path(@org)%>'
\ No newline at end of file
diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb
new file mode 100644
index 000000000..82b28fb8a
--- /dev/null
+++ b/app/views/organizations/setting.html.erb
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+ <%#= form_for( @organization,{:controller => 'organizations',:action => 'update',:id=>@organization,:html=>{:id=>'update_org_form',:method=>'put'}}) do %>
+ <%= labelled_form_for @organization do |f|%>
+ <%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
公开 :
+ class="ml3" />
+
+
保存
+ <% end %>
+
+
+
+
+
+ <%= render :partial=>"org_member_list",:locals=> {:members=>@organization.org_members} %>
+
+
+
+
+
添加成员
+ <%= form_tag url_for(:controller => 'org_member',:action => 'create',:org=>@organization),:id=>'org_member_add_form',:remote=>true do |f|%>
+
+ <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript org_member_autocomplete_org_member_index_path(:org=>@organization, :format => 'js') }')" %>
+
+ <%= find_user_not_in_current_org_by_name(@project) %>
+
+
+
新增成员
+ <% end %>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb
new file mode 100644
index 000000000..0b624d479
--- /dev/null
+++ b/app/views/organizations/show.html.erb
@@ -0,0 +1,79 @@
+<%= javascript_include_tag "jquery.infinitescroll.js" %>
+<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor" %>
+
+
+
+<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
+
+
+ <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %>
+<% end %>
+
+ <% unless @org_activities.nil? %>
+ <% @org_activities.each do |act| %>
+ <% if act.org_act_type == 'CreateOrganization' %>
+
+ <% end %>
+ <% if act.org_act_type == 'OrgDocumentComment' && act.org_act_id != @organization.home_id %>
+
+ <%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %>
+ <% end %>
+ <% end %>
+
+ <%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
+
+ <% end %>
+
+ <%# @org_project_activties.each do |org_act|%>
+ <%= render :partial => 'organizations/org_project_activities',
+ :locals => {:org_project_activties =>@org_project_activties,
+ :page=>@page,
+ :org => @organization,
+ :org_act_count=>@org_activities.count,
+ :pro_act_count=>@org_project_activties.count}%>
+ <%# end %>
+
+
+
+
diff --git a/app/views/organizations/show.js.erb b/app/views/organizations/show.js.erb
new file mode 100644
index 000000000..b0a447910
--- /dev/null
+++ b/app/views/organizations/show.js.erb
@@ -0,0 +1,7 @@
+$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'organizations/org_project_activities',
+ :locals => {:org_project_activties =>@org_project_activties,
+ :page=>@page,
+ :org => @organization,
+ :org_act_count=>@org_activities.count,
+ :pro_act_count=>@org_project_activties.count} )%>");
+
diff --git a/app/views/projects/search_public_orgs_not_in_project.js.erb b/app/views/projects/search_public_orgs_not_in_project.js.erb
new file mode 100644
index 000000000..69005d304
--- /dev/null
+++ b/app/views/projects/search_public_orgs_not_in_project.js.erb
@@ -0,0 +1,13 @@
+$("#search_orgs_result_list").html("");
+$("#search_orgs_result_list").append('')
+<% if @org_count > 10 %>
+$("#paginator").html(' <%= pagination_links_full @orgs_page, @org_count ,:per_page_links => true,:remote =>true,:flag=>true%>');
+$("#paginator").css("display", "block");
+<% else %>
+$("#paginator").css("display", "none");
+<% end %>
diff --git a/app/views/projects/settings.html.erb b/app/views/projects/settings.html.erb
index 3fc9a89d6..76258b9e9 100644
--- a/app/views/projects/settings.html.erb
+++ b/app/views/projects/settings.html.erb
@@ -12,6 +12,7 @@
project_setting(6);
$("#pro_st_edit_ku").toggle();
<%else%>
+ project_setting(5);
<% end%>
<% end%>
$("div[nhname='pro_setting']").show();
@@ -36,6 +37,7 @@
<% if User.current.allowed_to?(:manage_members, @project) %>
成员
<% end %>
+ 组织
<% if User.current.allowed_to?(:manage_versions, @project) %>
版本
<% end %>
@@ -63,6 +65,7 @@
<%= render :partial=>"projects/settings/new_members" if User.current.allowed_to?(:manage_members, @project)%>
+
<%= render :partial=>"projects/settings/new_versions" if User.current.allowed_to?(:manage_versions, @project)%>
@@ -70,6 +73,9 @@
+
+ <%= render :partial=>"projects/settings/join_org" %>
+
<%= render :partial=>"projects/settings/new_repositories" if User.current.allowed_to?(:manage_repository, @project)%>
diff --git a/app/views/projects/settings/_added_orgs.html.erb b/app/views/projects/settings/_added_orgs.html.erb
new file mode 100644
index 000000000..d07ead277
--- /dev/null
+++ b/app/views/projects/settings/_added_orgs.html.erb
@@ -0,0 +1,9 @@
+
+ 名称 操作
+ <% orgs.each do |org| %>
+ <%= org.name %>
+ <%= link_to "取消关联", org_project_path(:id => OrgProject.where(:organization_id => org.id, :project_id => project_id).first.id, :project_id => project_id),
+ :method => 'delete',:remote => true, :class => "relatedListOption fl linkGrey3" %>
+
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/projects/settings/_join_org.html.erb b/app/views/projects/settings/_join_org.html.erb
new file mode 100644
index 000000000..57ae714bd
--- /dev/null
+++ b/app/views/projects/settings/_join_org.html.erb
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+<%= stylesheet_link_tag 'org' %>
+
+
+
+
+
关联组织
+
+ <%= form_tag url_for(:controller => 'org_projects', :action => 'create', :project_id => @project.id), :id => 'join_orgs_for_project', :remote => true %>
+
+
+
+
关联
+
取消
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb
index 6f47e3535..156da0f07 100644
--- a/app/views/users/_resources_list.html.erb
+++ b/app/views/users/_resources_list.html.erb
@@ -7,7 +7,7 @@
<% attachments.each do |attach| %>
-
+
diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb
index 0baf31ab2..efaed2d9d 100644
--- a/app/views/users/_user_homework_form.html.erb
+++ b/app/views/users/_user_homework_form.html.erb
@@ -17,12 +17,16 @@
<%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%>
-
截止日期:
-
+ <% if edit_mode %>
+
截止日期:
+ <% end %>
+
<%= calendar_for('homework_end_time')%>
-
发布日期(可选):
+ <% if edit_mode %>
+
发布日期(可选):
+ <% end %>
<%= calendar_for('homework_publish_time')%>
diff --git a/app/views/users/user_organizations.html.erb b/app/views/users/user_organizations.html.erb
new file mode 100644
index 000000000..50fa03bbe
--- /dev/null
+++ b/app/views/users/user_organizations.html.erb
@@ -0,0 +1,35 @@
+<%= stylesheet_link_tag 'pleft','header','new_user','repository','org' %>
+<%#= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %>
+
+
+
+
+ <% @orgs.each do |org| %>
+
+
+ <%= link_to image_tag(url_to_avatar(org), :width => '78', :height => '78', :alt => '组织logo'), organization_path(org), :class => "linkGrey2" %>
+
+
+
+ <%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %>
+
+
<%= org.description %>
+
创建者:<%= link_to User.find(org.creator_id), user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %>
+
创建时间:<%= format_activity_day(org.created_at) %> <%= format_time(org.created_at, false) %>
+
您的身份:<%= User.current.admin_of_org?(org) ? "组织管理员" : "组织成员" %>
+
+
+
+
+ <% end %>
+
+
+
\ No newline at end of file
diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb
index f6bb3c8cb..4fd4d0cb9 100644
--- a/app/views/users/user_resource.html.erb
+++ b/app/views/users/user_resource.html.erb
@@ -287,7 +287,11 @@
//批量删除
function batch_delete(){
var data = $("#resources_list_form").serialize();
- if(data != "" && confirm('您删不掉这其中上传者不是您的资源,确认要删除这些资源吗?')) {
+ if($("input[type=checkbox][data-deleteble=N]:checked").length != 0){
+ alert("您只能删除自己上传的资源,请重新选择后再删除。");
+ return;
+ }
+ if(data != "" && confirm('确认要删除这些资源吗?')) {
$.post(
'<%= user_resource_delete_user_path(@user)%>',
$("#resources_list_form").serialize(),//只会对选中的控件进行序列化提交
diff --git a/app/views/users/user_resource_create.js.erb b/app/views/users/user_resource_create.js.erb
index 2d6c4f4d8..f69057273 100644
--- a/app/views/users/user_resource_create.js.erb
+++ b/app/views/users/user_resource_create.js.erb
@@ -2,6 +2,6 @@
closeModal();
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
//这里不能将翻页的更新
-$("#res_all_count").html(parseInt($("#res_all_count").html())+1);
+$("#res_all_count").html('<%= @atta_count%>');
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
\ No newline at end of file
diff --git a/app/views/users/user_resource_delete.js.erb b/app/views/users/user_resource_delete.js.erb
index a956ed212..e16abf28d 100644
--- a/app/views/users/user_resource_delete.js.erb
+++ b/app/views/users/user_resource_delete.js.erb
@@ -1,2 +1,5 @@
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
-$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
\ No newline at end of file
+$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
+$("#res_all_count").html('<%= @atta_count%>')
+$("#res_count").html(0);
+$("#checkboxAll").attr('checked',false);
\ No newline at end of file
diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml
index ee361cc2f..d65606678 100644
--- a/config/locales/commons/zh.yml
+++ b/config/locales/commons/zh.yml
@@ -288,6 +288,10 @@ zh:
label_tags_project_name: "项目名称:"
label_projects_new_name: "项目名称"
label_tags_project_description: "项目描述"
+
+ label_organization_name: "组织名称"
+ label_organization_description: "组织描述"
+ label_organization_new: "新建组织"
label_tags_user_mail: "用户邮箱:"
label_tags_user_name: "用户名:"
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 12c1b9258..4563944c8 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -2090,5 +2090,7 @@ zh:
label_forums: 贴吧交流
label_language: 语言
label_license: 湘ICP备09019772
+ label_org_name: 组织名称:
+ label_blank_user_lists_for_org: 用户不能为空
diff --git a/config/routes.rb b/config/routes.rb
index f1c41f65f..3f1ca2ba0 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -31,6 +31,56 @@ RedmineApp::Application.routes.draw do
# Enable Grack support
# mount Trustie::Grack.new, at: '/', constraints: lambda { |request| /[-\/\w\.]+\.git\//.match(request.path_info) }, via: [:get, :post]
+ resources :organizations do
+ member do
+ get 'setting'#, :action => 'settings', :as => 'settings'
+ get 'clear_org_avatar_temp'
+ put 'set_homepage'
+ get 'members'
+ get 'more_org_projects'
+ end
+ collection do
+ get 'check_uniq'
+ get 'autocomplete_search'
+ end
+ resources :org_document_comments do
+ member do
+
+ end
+ collection do
+
+ end
+ end
+ end
+
+ resources :org_member do
+ member do
+
+ end
+ collection do
+ get 'org_member_autocomplete'
+ end
+ end
+
+ resources :org_document_comments do
+ member do
+ post 'add_reply'
+ end
+ collection do
+
+ end
+ end
+
+ resources :org_projects do
+ member do
+
+ end
+ collection do
+
+ end
+ end
+ #match '/organizations/:organization_id/org_document_comments/new', :to => 'org_document_comments#new', :as => 'new_org_documents', :via => [:get, :post]
+ #match '/organizations/:organization_id/org_document_comments/create', :to => 'org_document_comments#create', :as => 'create_org_documents', :via => [:post]
resources :homework_users
resources :no_uses
delete 'no_uses', :to => 'no_uses#delete'
@@ -38,9 +88,9 @@ RedmineApp::Application.routes.draw do
resources :apply_project_masters
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
- resources :organization, :except => [:show] do
-
- end
+ # resources :organization, :except => [:show] do
+ #
+ # end
resources :school, :except => [:show] do
collection do
@@ -404,6 +454,7 @@ RedmineApp::Application.routes.draw do
post 'import_resources_to_homework'
get 'dealwith_apply_request'
get 'store_selected_resource'
+ get 'user_organizations'
# end
end
#resources :blogs
@@ -450,7 +501,7 @@ RedmineApp::Application.routes.draw do
################# added by william
match 'users/tag_save', :via => :post, :as => 'tag'
match 'users/tag_saveEx', :via => [:get, :post]
-
+ #get 'users/:id/user_organizations', :to => 'users#user_organizations', :as => 'user_organizations'
post 'watchers/watch', :to => 'watchers#watch', :as => 'watch'
delete 'watchers/watch', :to => 'watchers#unwatch'
get 'watchers/new', :to => 'watchers#new'
@@ -488,6 +539,7 @@ RedmineApp::Application.routes.draw do
post 'unarchive'
post 'close'
post 'reopen'
+ get 'search_public_orgs_not_in_project'
match 'copy', :via => [:get, :post]
end
diff --git a/db/migrate/20151102090519_create_org_members.rb b/db/migrate/20151103011119_create_org_members.rb
similarity index 76%
rename from db/migrate/20151102090519_create_org_members.rb
rename to db/migrate/20151103011119_create_org_members.rb
index 037d8a3c6..6ef208794 100644
--- a/db/migrate/20151102090519_create_org_members.rb
+++ b/db/migrate/20151103011119_create_org_members.rb
@@ -1,14 +1,11 @@
class CreateOrgMembers < ActiveRecord::Migration
- def up
+ def change
create_table :org_members do |t|
t.integer :user_id
t.integer :organization_id
t.string :role
+ t.timestamps
end
end
-
- def down
- drop_table :org_members
- end
end
diff --git a/db/migrate/20151104020233_create_org_document_comments.rb b/db/migrate/20151104020233_create_org_document_comments.rb
new file mode 100644
index 000000000..e300785aa
--- /dev/null
+++ b/db/migrate/20151104020233_create_org_document_comments.rb
@@ -0,0 +1,13 @@
+class CreateOrgDocumentComments < ActiveRecord::Migration
+ def change
+ create_table :org_document_comments do |t|
+ t.string :title
+ t.text :content
+ t.integer :organization_id
+ t.integer :creator_id
+ t.integer :parent_id
+ t.integer :reply_id
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20151104024335_add_locked_and_sticky_column_to_entity_org_document_comments.rb b/db/migrate/20151104024335_add_locked_and_sticky_column_to_entity_org_document_comments.rb
new file mode 100644
index 000000000..313800985
--- /dev/null
+++ b/db/migrate/20151104024335_add_locked_and_sticky_column_to_entity_org_document_comments.rb
@@ -0,0 +1,6 @@
+class AddLockedAndStickyColumnToEntityOrgDocumentComments < ActiveRecord::Migration
+ def change
+ add_column :org_document_comments,:locked,:boolean,:default => false
+ add_column :org_document_comments,:sticky,:integer,:default => 0
+ end
+end
diff --git a/db/migrate/20151104032831_create_org_activity.rb b/db/migrate/20151104032831_create_org_activity.rb
new file mode 100644
index 000000000..8d78102b3
--- /dev/null
+++ b/db/migrate/20151104032831_create_org_activity.rb
@@ -0,0 +1,16 @@
+class CreateOrgActivity < ActiveRecord::Migration
+ def up
+ create_table :org_activities do |t|
+ t.integer :user_id
+ t.integer :act_id
+ t.string :act_type
+ t.integer :container_id
+ t.string :container_type
+
+ t.timestamps
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20151104070007_create_org_projects.rb b/db/migrate/20151104070007_create_org_projects.rb
new file mode 100644
index 000000000..db83f9632
--- /dev/null
+++ b/db/migrate/20151104070007_create_org_projects.rb
@@ -0,0 +1,11 @@
+class CreateOrgProjects < ActiveRecord::Migration
+ def up
+ create_table :org_projects do |t|
+ t.integer :organization_id
+ t.integer :project_id
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20151104070455_delete_column_role_from_org_members.rb b/db/migrate/20151104070455_delete_column_role_from_org_members.rb
new file mode 100644
index 000000000..2e986dd9b
--- /dev/null
+++ b/db/migrate/20151104070455_delete_column_role_from_org_members.rb
@@ -0,0 +1,8 @@
+class DeleteColumnRoleFromOrgMembers < ActiveRecord::Migration
+ def up
+ remove_column :org_members, :role
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20151104073902_rename_column_for_org_activity.rb b/db/migrate/20151104073902_rename_column_for_org_activity.rb
new file mode 100644
index 000000000..e644c16cb
--- /dev/null
+++ b/db/migrate/20151104073902_rename_column_for_org_activity.rb
@@ -0,0 +1,6 @@
+class RenameColumnForOrgActivity < ActiveRecord::Migration
+ def change
+ rename_column :org_activities,:act_id,:org_act_id
+ rename_column :org_activities,:act_type,:org_act_type
+ end
+end
diff --git a/db/migrate/20151104090032_create_org_member_roles.rb b/db/migrate/20151104090032_create_org_member_roles.rb
new file mode 100644
index 000000000..d97d6eda7
--- /dev/null
+++ b/db/migrate/20151104090032_create_org_member_roles.rb
@@ -0,0 +1,11 @@
+class CreateOrgMemberRoles < ActiveRecord::Migration
+ def up
+ create_table :org_member_roles do |t|
+ t.integer :org_member_id
+ t.integer :role_id
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20151110011003_add_time_to_org_project.rb b/db/migrate/20151110011003_add_time_to_org_project.rb
new file mode 100644
index 000000000..dfe370103
--- /dev/null
+++ b/db/migrate/20151110011003_add_time_to_org_project.rb
@@ -0,0 +1,5 @@
+class AddTimeToOrgProject < ActiveRecord::Migration
+ def change
+ add_column :org_projects, :created_at, :timestamp
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 19bd05677..ef391a0cb 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -528,26 +528,23 @@ ActiveRecord::Schema.define(:version => 20151113025751) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id"
- 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 "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
+ create_table "dts", :force => true do |t|
+ t.string "IPLineCode"
t.string "Description"
- t.text "PreConditions", :limit => 2147483647
- t.text "TraceInfo", :limit => 2147483647
- t.text "Code", :limit => 2147483647
+ t.string "Num"
+ t.string "Variable"
+ t.string "TraceInfo"
+ t.string "Method"
+ t.string "File"
+ t.string "IPLine"
+ t.string "Review"
+ t.string "Category"
+ t.string "Defect"
+ t.string "PreConditions"
+ t.string "StartLine"
t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "id", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "enabled_modules", :force => true do |t|
@@ -871,6 +868,16 @@ ActiveRecord::Schema.define(:version => 20151113025751) 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"
@@ -1093,10 +1100,45 @@ ActiveRecord::Schema.define(:version => 20151113025751) do
t.integer "project_id"
end
+ create_table "org_activities", :force => true do |t|
+ t.integer "user_id"
+ t.integer "org_act_id"
+ t.string "org_act_type"
+ t.integer "container_id"
+ t.string "container_type"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "org_document_comments", :force => true do |t|
+ t.string "title"
+ t.text "content"
+ t.integer "organization_id"
+ t.integer "creator_id"
+ t.integer "parent_id"
+ t.integer "reply_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.boolean "locked", :default => false
+ t.integer "sticky", :default => 0
+ end
+
+ create_table "org_member_roles", :force => true do |t|
+ t.integer "org_member_id"
+ t.integer "role_id"
+ end
+
create_table "org_members", :force => true do |t|
- t.integer "user_id"
- t.integer "organization_id"
- t.string "role"
+ t.integer "user_id"
+ t.integer "organization_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "org_projects", :force => true do |t|
+ t.integer "organization_id"
+ t.integer "project_id"
+ t.datetime "created_at"
end
create_table "organizations", :force => true do |t|
diff --git a/public/images/org_default.jpg b/public/images/org_default.jpg
new file mode 100644
index 000000000..ad1b4f007
Binary files /dev/null and b/public/images/org_default.jpg differ
diff --git a/public/javascripts/org.js b/public/javascripts/org.js
new file mode 100644
index 000000000..e26995931
--- /dev/null
+++ b/public/javascripts/org.js
@@ -0,0 +1,45 @@
+//�����֯��Ա���ύ����
+function submit_add_org_members(){
+ $("#org_member_add_form").submit();
+}
+
+function observeSearchfield(fieldId, targetId, url) {
+ $('#'+fieldId).each(function() {
+ var $this = $(this);
+ $this.addClass('autocomplete');
+ $this.attr('data-value-was', $this.val());
+ var check = function() {
+ var val = $this.val();
+ if ($this.attr('data-value-was') != val){
+ $this.attr('data-value-was', val);
+ $.ajax({
+ url: url,
+ type: 'get',
+ data: {q: $this.val()},
+ success: function(data){ if(targetId) $('#'+targetId).html(data); },
+ beforeSend: function(){ $this.addClass('ajax-loading'); },
+ complete: function(){ $this.removeClass('ajax-loading'); }
+ });
+ }
+ };
+ var reset = function() {
+ if (timer) {
+ clearInterval(timer);
+ timer = setInterval(check, 300);
+ }
+ };
+ var timer = setInterval(check, 300);
+ $this.bind('keyup click mousemove', reset);
+ });
+}
+
+//显示更多的项目
+function show_more_org_project(url){
+ $.get(
+ url,
+ { page: $("#org_project_page_num").val() },
+ function (data) {
+
+ }
+ );
+}
\ No newline at end of file
diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css
new file mode 100644
index 000000000..c8116003e
--- /dev/null
+++ b/public/stylesheets/org.css
@@ -0,0 +1,52 @@
+@charset "utf-8";
+/* CSS Document */
+
+.orgName {width:130px; color:#484848;}
+.organization_r_h02{ width:970px; height:40px; background:#eaeaea; margin-bottom:10px;}
+.organization_h2{ background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;}
+
+.orgSettingOp {width:45px; height:21px; color:#269ac9; text-align:center; border-bottom:3px solid #e4e4e4; float:left; font-weight:bold; cursor:pointer;}
+.orgBorder {width:628px; height:21px; border-bottom:3px solid #e4e4e4; float:left;}
+.orgOpActive {border-bottom:3px solid #269ac9 !important; color:#444444;}
+.logoBorder {border:1px solid #eaeaea; padding:2px;}
+.logoBorder:hover {border:1px solid #269ac9;}
+.logoEnter {border:1px solid #eaeaea; padding:2px 5px; margin-top:37px;}
+.orgNameInput {width:600px; outline:none; border:1px solid #eaeaea; float:right; height:22px;}
+.orgRow {font-size:14px; color:#484848;}
+.orgDes {width:600px; height:150px; outline:none; border:1px solid #eaeaea; float:right; resize:none;}
+.w607 {width:607px;}
+.orgUrlInput {width:200px; outline:none; border:1px solid #eaeaea; height:22px;}
+a.saveBtn {padding:3px 5px; background-color:#269ac9; color:#ffffff;}
+a.saveBtn:hover {background-color:#297fb8;}
+.orgMemberList {width:410px; float:left;}
+.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px;}
+.orgListUser {width:119px; float:left;}
+.orgListRole {width:180px; float:left;}
+.orgMemContainer {width:278px;}
+.orgMemberAdd {float:right; width:240px;}
+.orgAddSearch {border:1px solid #dddddd; outline:none; width:180px; height:22px; color:#9b9b9b;}
+.undis {display:none;}
+.dis {display:inline-block;}
+.upbtn { margin: 40px 0px 0px 15px;
+ display: block;
+ padding: 2px 5px;
+ border: 1px solid #EAEAEA;}
+
+a.org_member_btn{ padding:1px 5px; background:#15bccf; color:#fff;}
+
+/*项目关联css*/
+.relateOrg {width:335px;}
+.relatedList {width:335px;}
+.searchOrg {height:24px; width:200px; color:#9b9b9b9; border:1px solid #15bccf;}
+a.cancelBtn {padding:3px 5px; background-color:#D9D9D9; color:#656565;}
+a.cancelBtn:hover {background-color:#717171; color:#ffffff;}
+.relatedList ul li {border-bottom:1px solid #e4e4e4; width:320px; height:22px; vertical-align:middle; line-height:22px;}
+.relatedListName {width:240px; text-align:left; max-width:240px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;}
+.relatedListOption {width:80px; text-align:center;}
+.relateOrgName {width:240px; max-width:240px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis;color:#656565;}
+
+/*组织列表*/
+.mt28 {margin-top:28px;}
+.orgWrap {width:880px; float:left;}
+.orgTitle {width:880px; max-width:880px; margin-bottom:5px;word-break: break-all; word-wrap:break-word; }
+.orgIntro {width:880px; max-width:880px; margin-bottom:6px; color:#484848;}
\ No newline at end of file
diff --git a/spec/controllers/org_document_comment_controller_spec.rb b/spec/controllers/org_document_comment_controller_spec.rb
new file mode 100644
index 000000000..016416264
--- /dev/null
+++ b/spec/controllers/org_document_comment_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe OrgDocumentCommentController, :type => :controller do
+
+end
diff --git a/spec/controllers/org_member_controller_spec.rb b/spec/controllers/org_member_controller_spec.rb
new file mode 100644
index 000000000..a116db00f
--- /dev/null
+++ b/spec/controllers/org_member_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe OrgMemberController, :type => :controller do
+
+end
diff --git a/spec/controllers/org_projects_controller_spec.rb b/spec/controllers/org_projects_controller_spec.rb
new file mode 100644
index 000000000..8adc91d66
--- /dev/null
+++ b/spec/controllers/org_projects_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe OrgProjectsController, :type => :controller do
+
+end
diff --git a/spec/controllers/organizations_controller_spec.rb b/spec/controllers/organizations_controller_spec.rb
new file mode 100644
index 000000000..cf00f4cf9
--- /dev/null
+++ b/spec/controllers/organizations_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe OrganizationsController, :type => :controller do
+
+end
diff --git a/spec/factories/org_activities.rb b/spec/factories/org_activities.rb
new file mode 100644
index 000000000..552ea70f9
--- /dev/null
+++ b/spec/factories/org_activities.rb
@@ -0,0 +1,6 @@
+FactoryGirl.define do
+ factory :org_activity do
+
+ end
+
+end
diff --git a/spec/factories/org_document_comments.rb b/spec/factories/org_document_comments.rb
new file mode 100644
index 000000000..206c471aa
--- /dev/null
+++ b/spec/factories/org_document_comments.rb
@@ -0,0 +1,11 @@
+FactoryGirl.define do
+ factory :org_document_comment do
+ title "MyString"
+content "MyText"
+organization_id 1
+creator_id 1
+parent_id 1
+reply_id 1
+ end
+
+end
diff --git a/spec/factories/org_members.rb b/spec/factories/org_members.rb
new file mode 100644
index 000000000..90997fd30
--- /dev/null
+++ b/spec/factories/org_members.rb
@@ -0,0 +1,8 @@
+FactoryGirl.define do
+ factory :org_member do
+ user_id 1
+organization_id 1
+role "MyString"
+ end
+
+end
diff --git a/spec/models/org_activity_spec.rb b/spec/models/org_activity_spec.rb
new file mode 100644
index 000000000..e452fe172
--- /dev/null
+++ b/spec/models/org_activity_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe OrgActivity, :type => :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/org_document_comment_spec.rb b/spec/models/org_document_comment_spec.rb
new file mode 100644
index 000000000..ba5dd15a4
--- /dev/null
+++ b/spec/models/org_document_comment_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe OrgDocumentComment, :type => :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/org_member_spec.rb b/spec/models/org_member_spec.rb
new file mode 100644
index 000000000..e7058e5b3
--- /dev/null
+++ b/spec/models/org_member_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe OrgMember, :type => :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end