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/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/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb
new file mode 100644
index 000000000..325a5ff85
--- /dev/null
+++ b/app/controllers/org_document_comments_controller.rb
@@ -0,0 +1,54 @@
+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
+
+ 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..18724882c
--- /dev/null
+++ b/app/controllers/org_member_controller.rb
@@ -0,0 +1,53 @@
+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])
+ 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
+ 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..e11005b4a
--- /dev/null
+++ b/app/controllers/org_projects_controller.rb
@@ -0,0 +1,18 @@
+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
+ end
+end
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index a51093ad9..fbe3814a4 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -1,6 +1,6 @@
# encoding: utf-8
class OrganizationsController < ApplicationController
- # before_filter :find_organization, :except => [:show,:new,:index,:create]
+ before_filter :find_organization, :only => [:show]
layout 'base_org'
def index
@@ -26,7 +26,8 @@ class OrganizationsController < ApplicationController
def show
@organization = Organization.find(params[:id])
- @activities = OrgActivity.where('(org_act_id = ? and org_act_type = ?)', @organization.id, 'CreateOrganization ')
+ @activities = OrgActivity.where('(org_act_id = ? and org_act_type = ?) || (container_id =? and org_act_type =? and org_act_id !=?)',
+ @organization.id, 'CreateOrganization ', @organization.id, 'OrgDocumentComment', @organization.home_id).order('updated_at desc')
@activities = paginateHelper @activities, 10
end
@@ -67,4 +68,18 @@ class OrganizationsController < ApplicationController
def clear_org_avatar_temp
end
+
+ def set_homepage
+ org = Organization.find(params[:id])
+ org.home_id = params[:home_id]
+ org.save
+ end
+
+ def autocomplete_search
+ @project = Project.find(params[:project_id])
+ #@flag = params[:flag] || false
+ respond_to do |format|
+ format.js
+ end
+ end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index d26e465ba..a55251d5b 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -69,6 +69,24 @@ 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 = 1").where("name like ?", condition).page((params[:page].to_i || 1)-1).per(10)
+ @org_count = Organization.where("is_public = 1").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").where("name like ?", condition).page((params[:page].to_i || 1)-1).per(10)
+ @org_count = Organization.where("id not in #{project_org_ids} and is_public = 1").where("name like ?", condition)
+ end
+ render :json => {:orgs => @orgs_not_in_project, :count => @org_count}.to_json
+ end
+
def index
render_404
end
@@ -338,6 +356,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 = ""
@@ -826,5 +853,4 @@ class ProjectsController < ApplicationController
end
#gcmend
-
end
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..08313f4e9
--- /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', :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 e10d4026d..33d5dea6e 100644
--- a/app/helpers/organizations_helper.rb
+++ b/app/helpers/organizations_helper.rb
@@ -16,4 +16,5 @@ module OrganizationsHelper
}
s + content_tag('ul', links,:class => 'wlist', :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_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/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb
index d84bd5e8c..88acb59f6 100644
--- a/app/views/layouts/base_org.html.erb
+++ b/app/views/layouts/base_org.html.erb
@@ -14,6 +14,7 @@
<%= 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 -%>
@@ -30,7 +31,6 @@
<% end %>
- <% @organization = Organization.find(params[:id])%>
@@ -50,11 +50,15 @@
<% end %>
<% end%>
-
组织id:<%= @organization.id %>
+
组织id:<%= @organization.id %>
配置
-
+
+ <%= 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" %>
+ ) | 成员 ( <%= @organization.org_members.count %> )
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<%= render :partial => 'layouts/footer' %>
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index be178607f..3bf109f37 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -581,10 +581,7 @@
}
});
- //查询学校
- $("input[name='province']").on('input', function (e) {
- throttle(shcool_search_fn,window,e);
- });
+
function throttle(method,context,e){
clearTimeout(method.tId);
@@ -606,7 +603,10 @@
type: 'post',
success: function (data) {
schoolsResult = data.schools;
- count = data.count;
+ count = data.count; //查询学校
+ $("input[name='province']").on('input', function (e) {
+ throttle(shcool_search_fn,window,e);
+ });
maxPage = Math.ceil(count/100) //最大页码值
if(schoolsResult.length != undefined && schoolsResult.length != 0) {
var i = 0;
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..f47048bf9
--- /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/add_reply.js.erb b/app/views/org_document_comments/add_reply.js.erb
new file mode 100644
index 000000000..930c8ebb0
--- /dev/null
+++ b/app/views/org_document_comments/add_reply.js.erb
@@ -0,0 +1,3 @@
+$("#organization_document_<%= @document.id %>").html("");
+$("#organization_document_<%= @document.id %>").html("<%= 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/index.html.erb b/app/views/org_document_comments/index.html.erb
new file mode 100644
index 000000000..8915e020c
--- /dev/null
+++ b/app/views/org_document_comments/index.html.erb
@@ -0,0 +1,26 @@
+<%= 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_projects/create.js.erb b/app/views/org_projects/create.js.erb
new file mode 100644
index 000000000..cadad16b2
--- /dev/null
+++ b/app/views/org_projects/create.js.erb
@@ -0,0 +1,4 @@
+
+$("#search_orgs_result_list").next().html("");
+$("#added_orgs").html("");
+$("#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..ee3c67bbd
--- /dev/null
+++ b/app/views/org_projects/destroy.js.erb
@@ -0,0 +1,2 @@
+$("#added_orgs").html("");
+$("#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/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 %>
-
-
- <%= 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} %>
-
-
-
- <%= 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/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb
new file mode 100644
index 000000000..102867ce0
--- /dev/null
+++ b/app/views/organizations/_show_org_document.html.erb
@@ -0,0 +1,90 @@
+
+
+
+ <%= 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) %> | 组织
+
+
<%= document.title %>
+
+ 发帖时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
+ <% unless document.content.blank? %>
+
+ <%= document.content.html_safe %>
+
+ <% end %>
+
+
+ -
+
+ -
+ <%= 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 "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete',:remote => true, :class => 'postOptionLink' %>
+
+
+
+
+
+
+
+
+<% comments_for_doc = document.children.reorder("created_at desc") %>
+
+
+
回复(<%= document.children.count() %>)
+ <% if count > 3 %>
+
+ <% end %>
+
+
+
+ <% comments_for_doc.each do |comment| %>
+
<%= image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像") %>
+
+
+ <%= 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 %>
+
+
+
+ <%= image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像") %>
+
+
+
+ <%= 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/set_homepage.js.erb b/app/views/organizations/set_homepage.js.erb
new file mode 100644
index 000000000..bcebe9d37
--- /dev/null
+++ b/app/views/organizations/set_homepage.js.erb
@@ -0,0 +1 @@
+location.reload();
\ No newline at end of file
diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb
index 61e6b1534..e203b5eed 100644
--- a/app/views/organizations/setting.html.erb
+++ b/app/views/organizations/setting.html.erb
@@ -89,7 +89,8 @@
<%= 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) %>
-
+
+
- 角色
-
diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb
index 2f25ae8a3..2c94ed163 100644
--- a/app/views/organizations/show.html.erb
+++ b/app/views/organizations/show.html.erb
@@ -1,5 +1,7 @@
<%= javascript_include_tag "jquery.infinitescroll.js" %>
-
+<% 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)} %>
+ <% end %>
<% end %>
+ <% if act.org_act_type == 'OrgDocumentComment' %>
+ <%= 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%>
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..06d3ae439
--- /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..b7e58ee4c
--- /dev/null
+++ b/app/views/projects/settings/_join_org.html.erb
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+<%= 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/config/routes.rb b/config/routes.rb
index 639056b94..fc7b74cd8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -35,9 +35,19 @@ RedmineApp::Application.routes.draw do
member do
get 'setting'#, :action => 'settings', :as => 'settings'
get 'clear_org_avatar_temp'
+ put 'set_homepage'
end
collection do
get 'check_uniq'
+ get 'autocomplete_search'
+ end
+ resources :org_document_comments do
+ member do
+
+ end
+ collection do
+
+ end
end
end
@@ -50,6 +60,25 @@ RedmineApp::Application.routes.draw do
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'
@@ -493,6 +522,7 @@ RedmineApp::Application.routes.draw do
post 'unarchive'
post 'close'
post 'reopen'
+ post 'search_public_orgs_not_in_project'
match 'copy', :via => [:get, :post]
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 d75b4f7a4..90f58aa3c 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 => 20151104090032) do
+ActiveRecord::Schema.define(:version => 20151110011003) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -1209,8 +1209,9 @@ ActiveRecord::Schema.define(:version => 20151104090032) do
end
create_table "org_projects", :force => true do |t|
- t.integer "organization_id"
- t.integer "project_id"
+ t.integer "organization_id"
+ t.integer "project_id"
+ t.datetime "created_at"
end
create_table "organizations", :force => true do |t|
diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css
index 8d9275f31..3857b53e2 100644
--- a/public/stylesheets/org.css
+++ b/public/stylesheets/org.css
@@ -30,4 +30,15 @@ a.saveBtn:hover {background-color:#297fb8;}
.upbtn { margin: 40px 0px 0px 15px;
display: block;
padding: 2px 5px;
- border: 1px solid #EAEAEA;}
\ No newline at end of file
+ border: 1px solid #EAEAEA;}
+
+/*项目关联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;}
\ 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/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/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