commit
8b2ed1d336
@ -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/
|
@ -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/
|
@ -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/
|
@ -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/
|
@ -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/
|
@ -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/
|
@ -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
|
@ -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
|
@ -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
|
@ -0,0 +1,2 @@
|
|||||||
|
module OrgDocumentCommentHelper
|
||||||
|
end
|
@ -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
|
@ -0,0 +1,2 @@
|
|||||||
|
module OrgProjectsHelper
|
||||||
|
end
|
@ -1,2 +1,20 @@
|
|||||||
|
# encoding: utf-8
|
||||||
module OrganizationsHelper
|
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
|
end
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
class OrgActivity < ActiveRecord::Base
|
||||||
|
# attr_accessible :title, :body
|
||||||
|
belongs_to :org_act ,:polymorphic => true
|
||||||
|
belongs_to :container,:polymorphic => true
|
||||||
|
end
|
@ -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
|
@ -1,4 +1,8 @@
|
|||||||
class OrgMember < ActiveRecord::Base
|
class OrgMember < ActiveRecord::Base
|
||||||
attr_accessible :organization_id, :role, :user_id
|
attr_accessible :organization_id, :role, :user_id
|
||||||
belongs_to :organization
|
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
|
end
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
class OrgMemberRole < ActiveRecord::Base
|
||||||
|
# attr_accessible :title, :body
|
||||||
|
belongs_to :org_member
|
||||||
|
belongs_to :role
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class OrgProject < ActiveRecord::Base
|
||||||
|
# attr_accessible :title, :body
|
||||||
|
belongs_to :organization
|
||||||
|
belongs_to :project
|
||||||
|
end
|
@ -1,5 +1,14 @@
|
|||||||
class Organization < ActiveRecord::Base
|
class Organization < ActiveRecord::Base
|
||||||
attr_accessible :name, :description, :creator_id, :home_id, :domain, :is_public
|
attr_accessible :name, :description, :creator_id, :home_id, :domain, :is_public
|
||||||
has_many :org_members, :dependent => :destroy
|
has_many :org_members, :dependent => :destroy
|
||||||
has_many :projects
|
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
|
||||||
|
|
||||||
|
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
|
end
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
|
||||||
|
<script>
|
||||||
|
function check_org_title()
|
||||||
|
{
|
||||||
|
if($("#document_title").val().trim() == "")
|
||||||
|
{
|
||||||
|
$("#doc_title_hint").html("<span class='c_red'>标题不能为空</span>").show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#doc_title_hint").hide();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function create_org_document()
|
||||||
|
{
|
||||||
|
if(check_org_title() == true)
|
||||||
|
{
|
||||||
|
org_document_description_editor.sync();
|
||||||
|
$('#new_org_document_form').submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function cancel_create_org_document(){
|
||||||
|
$("#document_title").val("");
|
||||||
|
org_document_description_editor.html("");
|
||||||
|
org_document_description_editor.sync();
|
||||||
|
$('#org_document_editor').hide(); $('#doc_title_hint').hide();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
|
||||||
|
<div class="resources">
|
||||||
|
<div>
|
||||||
|
<input class="postDetailInput fl" maxlength="250" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" placeholder="请输入文章标题" />
|
||||||
|
</div>
|
||||||
|
<div id="doc_title_hint"></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div id="org_document_editor" class="mt10" style="display: none">
|
||||||
|
<div>
|
||||||
|
<%= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p id="homework_course_id_span" class="c_red mt5"></p>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div class="mt5">
|
||||||
|
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="create_org_document();">确定</a>
|
||||||
|
<span class="fr mr10 mt3">或</span>
|
||||||
|
<a href="javascript:void(0);" onclick="cancel_create_org_document();" class="fr mr10 mt3">取消</a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
@ -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%");
|
@ -0,0 +1 @@
|
|||||||
|
location.reload();
|
@ -0,0 +1,43 @@
|
|||||||
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
|
||||||
|
<script>
|
||||||
|
function check_org_title(title)
|
||||||
|
{
|
||||||
|
if($("#document_title").val().trim() == "")
|
||||||
|
{
|
||||||
|
$("#doc_title_hint").html("<span class='c_red'>标题不能为空</span>").show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#doc_title_hint").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<div class="homepageRightBanner mb10">
|
||||||
|
<div class="NewsBannerName">编辑文章</div>
|
||||||
|
</div>
|
||||||
|
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id),:method => 'put', :id => 'new_org_document_form' do |f| %>
|
||||||
|
<div class="resources">
|
||||||
|
<div>
|
||||||
|
<input class="postDetailInput fl mr15" style="margin-bottom:15px;" maxlength="250" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" value="<%= @org_document.title %>" />
|
||||||
|
</div>
|
||||||
|
<div id="doc_title_hint"></div>
|
||||||
|
<div id="org_document_editor" class="mt15" style="">
|
||||||
|
<div class="mt10">
|
||||||
|
<%= kindeditor_tag 'org_document_comment[content]',@org_document.content, :editor_id => 'org_document_description_editor', :height => "150px" %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p id="homework_course_id_span" class="c_red mt5"></p>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div class="mt5">
|
||||||
|
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="org_document_description_editor.sync();$('#new_org_document_form').submit();">确定</a>
|
||||||
|
<span class="fr mr10 mt3">或</span>
|
||||||
|
<a href="javascript:void(0);" onclick="$('#org_document_editor').hide(); $('#doc_title_hint').hide();" class="fr mr10 mt3">取消</a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
@ -0,0 +1,27 @@
|
|||||||
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor" %>
|
||||||
|
<style type="text/css">
|
||||||
|
/*回复框*/
|
||||||
|
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
|
||||||
|
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
|
||||||
|
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
|
||||||
|
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
|
||||||
|
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
|
||||||
|
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
|
||||||
|
.homepagePostReplyInputContainer .ke-outline {border: none;}
|
||||||
|
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
|
||||||
|
.homepagePostReplyInputContainer .ke-container {float: left;}
|
||||||
|
</style>
|
||||||
|
<%= render :partial => 'new' %>
|
||||||
|
<% unless @documents.nil? %>
|
||||||
|
<% @documents.each do |document| %>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
console.log(111)
|
||||||
|
init_activity_KindEditor_data(<%= document.id%>, null, "87%");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div id="organization_document_<%= document.id %>">
|
||||||
|
<%= render :partial => 'organizations/show_org_document', :locals => {:document => document} %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
@ -0,0 +1,40 @@
|
|||||||
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
|
||||||
|
<script>
|
||||||
|
function check_org_title(title)
|
||||||
|
{
|
||||||
|
if($("#document_title").val().trim() == "")
|
||||||
|
{
|
||||||
|
$("#doc_title_hint").html("<span class='c_red'>标题不能为空</span>").show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#doc_title_hint").hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id), :id => 'new_org_document_form' do |f| %>
|
||||||
|
<div class="resources">
|
||||||
|
<div>
|
||||||
|
<textarea class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" placeholder="请输入文章标题"></textarea>
|
||||||
|
</div>
|
||||||
|
<div id="doc_title_hint"></div>
|
||||||
|
<div id="org_document_editor" class="mt15" style="display: none">
|
||||||
|
<div class="mt10">
|
||||||
|
<%= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p id="homework_course_id_span" class="c_red mt5"></p>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div class="mt5">
|
||||||
|
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="org_document_description_editor.sync();$('#new_org_document_form').submit();">确定</a>
|
||||||
|
<span class="fr mr10 mt3">或</span>
|
||||||
|
<a href="javascript:void(0);" onclick="$('#org_document_editor').hide(); $('#doc_title_hint').hide();" class="fr mr10 mt3">取消</a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
@ -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 %>
|
@ -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}) %>');
|
@ -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<collection.length;i++){ //增加悬浮显示
|
||||||
|
var label=collection[i];
|
||||||
|
var text=$(label).text();
|
||||||
|
$(label).attr("title",text);
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
|
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
$("#search_orgs_result_list").html("");
|
||||||
|
//$("#search_orgs_result_list").append('<ul class="ml20">');
|
||||||
|
$("#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}) %>')
|
@ -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('<ul class="ml20">');
|
||||||
|
<% @orgs_not_in_project.each do |org|%>
|
||||||
|
link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='orgNames[]' value='<%=org.id%>'/><span class='relateOrgName fl'> <%=org.name %> </span></label></li><div class='cl mt5'></div>";
|
||||||
|
$("#search_orgs_result_list").append(link );
|
||||||
|
<%end %>
|
||||||
|
$("#search_orgs_result_list").append('</ul>')
|
||||||
|
<% 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 %>
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
<title>
|
|
||||||
<%= l(:label_all_enterprises) %>
|
|
||||||
</title>
|
|
||||||
<div class="content_syqy">
|
|
||||||
<div class="list">
|
|
||||||
<%= l(:label_all_enterprises) %>
|
|
||||||
</div>
|
|
||||||
<div class="syqy_box">
|
|
||||||
<% if @organizations.empty? %>
|
|
||||||
<h3>
|
|
||||||
<%= l(:label_enterprise_nil) %>
|
|
||||||
</h3>
|
|
||||||
<% else %>
|
|
||||||
<% @organizations.each do |organization| %>
|
|
||||||
<% unless organization.name.blank? %>
|
|
||||||
<ul>
|
|
||||||
<li >
|
|
||||||
<img src="/images/organization_logo.jpg" width="30" height="30" alt="<%= organization.name%>" />
|
|
||||||
<%= link_to organization.name, home_path(:organization => organization.id) %>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div style="clear: both"></div>
|
|
||||||
<div class="school-index">
|
|
||||||
<ul id="schoollist" style="line-height: 25px"></ul>
|
|
||||||
</div>
|
|
||||||
<% html_title(l(:label_enterprise_all)) -%>
|
|
@ -1,18 +0,0 @@
|
|||||||
<%= form_for(@organizations, :method => :post,
|
|
||||||
:name => 'new_form',
|
|
||||||
:url => {:controller => 'organization',
|
|
||||||
:action => 'create'}) do |f|%>
|
|
||||||
<h3>
|
|
||||||
<%=l(:label_organization_new)%>
|
|
||||||
</h3>
|
|
||||||
<div class="box tabular" >
|
|
||||||
<%= render :partial => 'form', :locals => { :f => f } %>
|
|
||||||
<span style="padding-left: 60px">
|
|
||||||
<%= submit_tag l(:button_create), :class => "enterprise"%>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<%#= submit_tag l(:button_create_and_continue), :name => 'continue' %>
|
|
||||||
<%= javascript_tag "$('#project_name').focus();" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% html_title(l(:label_organization_new)) -%>
|
|
@ -0,0 +1,33 @@
|
|||||||
|
<!--<a href="javascript:void(0)" class="mr10 logoBorder fl ml10">-->
|
||||||
|
<!--<%#= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>-->
|
||||||
|
<!--</a>-->
|
||||||
|
<div class="orgLogo mb10">
|
||||||
|
<a href="javascript:void(0);">
|
||||||
|
<%= image_tag(url_to_avatar(source), id: "avatar_image",:height => 55,:width => 55, :class=>'mr10 logoBorder fl ml10',:alt=>"上传图片") %>
|
||||||
|
</a>
|
||||||
|
<a href="javascript:void(0);" onclick="$('#upload_org_logo').click();" class="logoEnter fl linkGrey4"><%= l(:button_upload_photo) %></a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<%#= 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
|
||||||
|
} %>
|
||||||
|
<!--</span>-->
|
||||||
|
<% 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 %>
|
||||||
|
<div class="cl"></div>
|
@ -0,0 +1,43 @@
|
|||||||
|
<% members.each do |member|%>
|
||||||
|
<ul class="orgListRow">
|
||||||
|
<li class="orgListUser"><a href="<%= user_path(User.find(member.user_id))%>" class="linkBlue"><%= User.find(member.user_id).realname.blank? ? User.find(member.user_id).login : User.find(member.user_id).realname %></a></li>
|
||||||
|
<li class="orgListRole">
|
||||||
|
<%= 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| %>
|
||||||
|
<ul style="text-align: left;" >
|
||||||
|
<%= radio_button_tag 'org_member[role_ids][]', role.id, member.roles.include?(role) %>
|
||||||
|
<!--编辑时候显示成员,中英文切换后面需从数据库的角度优化-->
|
||||||
|
<% if User.current.language == "zh" %>
|
||||||
|
<% if role.id == 11 %>
|
||||||
|
<label >管理人员</label>
|
||||||
|
<% elsif role.id == 12 %>
|
||||||
|
<label >组织成员</label>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<label ><%= h role %></label>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<!--<br/>-->
|
||||||
|
<% end %>
|
||||||
|
<%= hidden_field_tag 'membership[role_ids][]', '' %>
|
||||||
|
<div class="pt5">
|
||||||
|
<a href="javascript:void(0)" class="org_member_btn" onclick="$('#org-member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
|
||||||
|
<%= l(:button_change)%>
|
||||||
|
</a>
|
||||||
|
<a href="javascript:void(0)" class="org_member_btn" onclick="$('#org-member-<%= member.id%>-roles-form').hide();$(this).parent().parent().parent().parent().height(18)">
|
||||||
|
<%= l(:button_cancel)%>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<!-- -->
|
||||||
|
<% if ( (User.current.id == member.organization.creator_id || member.roles[0].name == "orgManager" ) && member.user_id != member.organization.creator_id )%>
|
||||||
|
<a href="javascript:void(0);" style="color: #0781B4;margin-left: 30px;float: left" onclick="$(this).parent().height(70);$('#org-member-<%= member.id%>-roles-form').show();">编辑</a>
|
||||||
|
<%= link_to '删除', org_member_path(member.id),:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
@ -0,0 +1,29 @@
|
|||||||
|
<%= stylesheet_link_tag 'courses' %>
|
||||||
|
<div class="resources">
|
||||||
|
<div class="project_r_h" style="width: 720px;">
|
||||||
|
<h2 class="project_h2"> 组织成员</h2>
|
||||||
|
</div>
|
||||||
|
<div class="st_list" style="width: 720px;">
|
||||||
|
<div class="st_box">
|
||||||
|
<span class="fr fb fontGrey3">加入时间</span>
|
||||||
|
<div class="cl"></div><!--st_box_top end-->
|
||||||
|
|
||||||
|
<% members.each do |member| %>
|
||||||
|
<div class="st_boxlist">
|
||||||
|
<a href="javascript:" class="st_img">
|
||||||
|
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
|
||||||
|
</a>
|
||||||
|
<span class="fl ml10 c_grey"><%= l(:label_username)%></span>
|
||||||
|
<%= link_to(member.user.show_name, user_path(member.user),:class => "ml5 c_blue02") %><br />
|
||||||
|
<span class="fl c_grey ml10">身份:<%= member.user.admin_of_org?(organization)?"组织管理员":"组织成员" %></span>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
<ul class="wlist">
|
||||||
|
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||||
|
</ul>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -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%>
|
@ -0,0 +1,22 @@
|
|||||||
|
<% if !@org_name.blank? %>
|
||||||
|
<%if @check == false %>
|
||||||
|
$checkName = false
|
||||||
|
<% if @config_page%>
|
||||||
|
$("#check_name_hint").html('<span class="c_red">名字不能重复<span>').show();
|
||||||
|
<% else%>
|
||||||
|
$("#organization_name_notice").html('<span class="c_red">名字不能重复<span>').show();
|
||||||
|
|
||||||
|
<%end%>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
$checkName = true;
|
||||||
|
<% if @config_page%>
|
||||||
|
$("#check_name_hint").html('<span class="c_green">名字可以使用</span>').show();
|
||||||
|
<% else%>
|
||||||
|
|
||||||
|
$("#organization_name_notice").html('<span class="c_green">名字可以使用</span>').show();
|
||||||
|
<%end%>
|
||||||
|
<%end%>
|
||||||
|
<% else %>
|
||||||
|
$("#check_name_hint").html('<span class="c_green">名字不能为空</span>').show();
|
||||||
|
<% end %>
|
@ -0,0 +1 @@
|
|||||||
|
<%= render :partial => 'org_members', :locals => {:members => @members, :organization => @organization} %>
|
@ -0,0 +1,2 @@
|
|||||||
|
//location.reload();
|
||||||
|
window.location.href ='<%= organization_path(@org)%>'
|
@ -1,4 +1,71 @@
|
|||||||
<%= javascript_include_tag "jquery.infinitescroll.js" %>
|
<%= javascript_include_tag "jquery.infinitescroll.js" %>
|
||||||
<div class="project_r_h">
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor" %>
|
||||||
<h2 class="project_h2">组织活动</h2>
|
<style type="text/css">
|
||||||
|
/*回复框*/
|
||||||
|
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
|
||||||
|
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
|
||||||
|
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
|
||||||
|
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
|
||||||
|
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
|
||||||
|
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
|
||||||
|
.homepagePostReplyInputContainer .ke-outline {border: none;}
|
||||||
|
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
|
||||||
|
.homepagePostReplyInputContainer .ke-container {float: left;}
|
||||||
|
</style>
|
||||||
|
<div class="homepageRightBanner">
|
||||||
|
<div class="NewsBannerName">最新动态</div>
|
||||||
|
<!-- <ul class="resourcesSelect">
|
||||||
|
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||||
|
<ul class="resourcesType">
|
||||||
|
<li class="mt-4"><a href="javascript:void(0);" class="homepagePostTypeAll postTypeGrey">全部动态</a></li>
|
||||||
|
<li class="mt-4"><a href="/users/8523/user_activities?type=current_user" class="homepagePostTypeMine postTypeGrey">我的动态</a> </li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
init_activity_KindEditor_data(<%= @organization.home_id%>, null, "87%");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div id="organization_document_<%= @organization.home_id %>">
|
||||||
|
<%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id} %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% unless @activities.nil? %>
|
||||||
|
<% @activities.each do |act| %>
|
||||||
|
<% if act.org_act_type == 'CreateOrganization' %>
|
||||||
|
<div class="resources mt10">
|
||||||
|
<div class="homepagePostBrief">
|
||||||
|
<div class="homepagePostPortrait">
|
||||||
|
<a href="javascript:void(0);"><%= image_tag(url_to_avatar(User.find(act.user_id)), :width => "45", :height => "45") %></a>
|
||||||
|
</div>
|
||||||
|
<div class="homepagePostDes">
|
||||||
|
<div class="homepagePostTo"><%= link_to User.find(act.user_id), user_path(act.user_id) %> 创建了 <a href="<%= organization_path(@organization)%>" class="newsBlue ml10"><%= Organization.find(act.org_act_id).name %>
|
||||||
|
| 组织</a></div>
|
||||||
|
<div class="homepagePostDate"> 创建时间:<%= format_activity_day(act.created_at) %> <%= format_time(act.created_at, false) %> </div>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% if act.org_act_type == 'OrgDocumentComment' %>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
init_activity_KindEditor_data(<%= act.org_act.id%>, null, "87%");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div id="organization_document_<%= act.org_act.id %>">
|
||||||
|
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act} %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<ul class="wlist" style=" border:none; padding-top: 15px;">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
$("#search_orgs_result_list").html("");
|
||||||
|
$("#search_orgs_result_list").append('<ul class="ml20">');
|
||||||
|
<% @orgs_not_in_project.each do |org|%>
|
||||||
|
link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='orgNames[]' value='<%=org.id%>'/><span class='relateOrgName fl'> <%=org.name %> </span></label></li><div class='cl mt5'></div>";
|
||||||
|
$("#search_orgs_result_list").append(link );
|
||||||
|
<%end %>
|
||||||
|
$("#search_orgs_result_list").append('</ul>')
|
||||||
|
<% 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 %>
|
@ -0,0 +1,9 @@
|
|||||||
|
<ul>
|
||||||
|
<li><span class="relatedListName fb fl">名称</span><span class="relatedListOption fb fl">操作</span></li>
|
||||||
|
<% orgs.each do |org| %>
|
||||||
|
<li><a href="<%= organization_path(org) %>" class="relatedListName linkBlue fl"><%= org.name %></a>
|
||||||
|
<%= 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" %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
@ -0,0 +1,107 @@
|
|||||||
|
<!--<div class="members_left">-->
|
||||||
|
<!--<input type="text" id="orgs_not_project_member_search" name="orgAddSearch" placeholder="支持姓名、邮箱、昵称搜索" class="orgAddSearch mb20" />-->
|
||||||
|
<!--<%#= javascript_tag "observeSearchfield('orgs_not_project_member_search', null, '#{ escape_javascript autocomplete_search_organizations_path(:project_id=> @project.id, :format => 'js') }')" %>-->
|
||||||
|
<!--<div id="new_orgs_for_project">-->
|
||||||
|
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<%= stylesheet_link_tag 'org' %>
|
||||||
|
|
||||||
|
<ul class="mb10">
|
||||||
|
<li class="orgSettingOp orgOpActive" id="orgSetting_1">组织</li>
|
||||||
|
<li class="orgBorder" style="width:625px;"></li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</ul>
|
||||||
|
<div>
|
||||||
|
<div class="relateOrg fl">
|
||||||
|
<span class="pic_add fl mr5 mt3"></span><span class="f14 fontBlue fl">关联组织</span>
|
||||||
|
<div class="cl mb5"></div>
|
||||||
|
<%= form_tag url_for(:controller => 'org_projects', :action => 'create', :project_id => @project.id), :id => 'join_orgs_for_project', :remote => true %>
|
||||||
|
<input type="text" name="orgs" class="searchOrg mb5 ml20" placeholder="请输入组织名称" />
|
||||||
|
<div id="search_orgs_result_list" class="ml20"></div>
|
||||||
|
<ul id="paginator" class="wlist ml20" style="float:none;"></ul>
|
||||||
|
<a href="javascript:void(0);" class="saveBtn db fl ml20 mr15 mb5" onclick="$('#join_orgs_for_project').submit();">关联</a>
|
||||||
|
<a href="javascript:void(0);" class="cancelBtn db fl" onclick="cancel_join_orgs();">取消</a>
|
||||||
|
</div>
|
||||||
|
<div class="relatedList fr">
|
||||||
|
<div class="fr mr15">
|
||||||
|
<span class="f14 fontBlue">已关联组织</span>
|
||||||
|
<div id="added_orgs">
|
||||||
|
<%= render :partial => 'projects/settings/added_orgs', :locals => {:orgs => @project.organizations, :project_id => params[:id]} %>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var lastSearchCondition = '';
|
||||||
|
var page = 1;
|
||||||
|
var count = 0;
|
||||||
|
var maxPage = 0;
|
||||||
|
function search_orgs(e){
|
||||||
|
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lastSearchCondition = $(e.target).val().trim();
|
||||||
|
page = 1;
|
||||||
|
$.ajax({
|
||||||
|
url: '<%= url_for(:controller => 'projects', :action => 'search_public_orgs_not_in_project') %>'+'?name='+ e.target.value+'&page='+page,
|
||||||
|
type:'get'
|
||||||
|
// success: function(data){
|
||||||
|
// orgs = data.orgs;
|
||||||
|
// count = data.count;
|
||||||
|
// maxPage = Math.ceil(count/10);
|
||||||
|
// $("#search_orgs_result_list").next().html("");
|
||||||
|
// if(orgs.length != undefined && orgs.length != 0){
|
||||||
|
// var i = 0;
|
||||||
|
// for(; i<orgs.length; i++){
|
||||||
|
// link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='orgNames[]' value='"+ orgs[i].organization.id + "'/><span class='relateOrgName fl'>" + orgs[i].organization.name + "</span></label></li><div class='cl mt5'></div>";
|
||||||
|
// console.log(link)
|
||||||
|
// $("#search_orgs_result_list").next().append(link );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function throttle(method,context,e){
|
||||||
|
clearTimeout(method.tId);
|
||||||
|
method.tId=setTimeout(function(){
|
||||||
|
method.call(context,e);
|
||||||
|
},500);
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询组织
|
||||||
|
$("input[name='orgs']").on('input', function (e) {
|
||||||
|
throttle(search_orgs,window,e);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
$.ajax({
|
||||||
|
url: '<%= url_for(:controller => 'projects', :action => 'search_public_orgs_not_in_project') %>'+'?page=1',
|
||||||
|
type:'get'
|
||||||
|
// success: function(data){
|
||||||
|
// orgs = data.orgs;
|
||||||
|
// count = data.count;
|
||||||
|
// maxPage = Math.ceil(count/10);
|
||||||
|
// $("#search_orgs_result_list").next().html("");
|
||||||
|
// if(orgs.length != undefined && orgs.length != 0){
|
||||||
|
// var i = 0;
|
||||||
|
// for(; i<orgs.length; i++){
|
||||||
|
// link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='orgNames[]' value='"+ orgs[i].organization.id + "'/><span class='relateOrgName fl'>" + orgs[i].organization.name + "</span></label></li><div class='cl mt5'></div>";
|
||||||
|
// console.log(link)
|
||||||
|
// $("#search_orgs_result_list").next().append(link );
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function cancel_join_orgs() {
|
||||||
|
$("#search_orgs_result_list").html("");
|
||||||
|
}
|
||||||
|
</script>
|
@ -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' %>
|
||||||
|
<div class="homepageContentContainer">
|
||||||
|
<div class="homepageContent">
|
||||||
|
<div class="postContainer">
|
||||||
|
<div class="postBanner" style="padding-bottom:5px;">
|
||||||
|
<span class="linkGrey2 f16">组织列表</span>
|
||||||
|
|
||||||
|
<form class="resourcesSearchloadBox" style="float:right; margin-top:-5px;">
|
||||||
|
<input type="text" name="serach" placeholder="输入关键词进行搜索" class="searchResource"/>
|
||||||
|
<a href="javascript:void(0);" class="homepageSearchIcon"></a>
|
||||||
|
</form>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<% @orgs.each do |org| %>
|
||||||
|
<div class="postRow">
|
||||||
|
<div class="postPortrait">
|
||||||
|
<%= link_to image_tag(url_to_avatar(org), :width => '78', :height => '78', :alt => '组织logo'), organization_path(org), :class => "linkGrey2" %>
|
||||||
|
</div>
|
||||||
|
<div class="orgWrap">
|
||||||
|
<div class="orgTitle">
|
||||||
|
<%= link_to org.name, organization_path(org), :class => 'f16 linkBlue' %>
|
||||||
|
</div>
|
||||||
|
<div class="orgIntro"><%= org.description %></div>
|
||||||
|
<div class="postCreater">创建者:<%= link_to User.find(org.creator_id), user_path(org.creator_id), :class => 'linkGrey2', :target => '_blank' %></div>
|
||||||
|
<div class="postDate fl mr40">创建时间:<%= format_activity_day(org.created_at) %> <%= format_time(org.created_at, false) %></div>
|
||||||
|
<div class="postCreater">您的身份:<%= User.current.admin_of_org?(org) ? "组织管理员" : "组织成员" %></div>
|
||||||
|
</div>
|
||||||
|
<!--<div class="mt28 fr"><a href="javascript:void(0);" class="linkGrey5">申请加入</a></div>-->
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -0,0 +1,8 @@
|
|||||||
|
class DeleteColumnRoleFromOrgMembers < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
remove_column :org_members, :role
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
@ -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
|
@ -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
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddTimeToOrgProject < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :org_projects, :created_at, :timestamp
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1,34 @@
|
|||||||
|
//添加组织成员的提交函数
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe OrgDocumentCommentController, :type => :controller do
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe OrgMemberController, :type => :controller do
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe OrgProjectsController, :type => :controller do
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :org_activity do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -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
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe OrgActivity, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe OrgDocumentComment, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in new issue