From a3443ba968934dc56ac703c11bf00558f6893508 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 12 Nov 2015 09:32:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=A8=A1=E5=9D=97=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org_document_comment.js.coffee | 3 + app/assets/javascripts/org_member.js.coffee | 3 + app/assets/javascripts/org_projects.js.coffee | 3 + .../stylesheets/org_document_comment.css.scss | 3 + app/assets/stylesheets/org_member.css.scss | 3 + app/assets/stylesheets/org_projects.css.scss | 3 + .../org_document_comments_controller.rb | 54 +++++++++ app/controllers/org_member_controller.rb | 53 +++++++++ app/controllers/org_projects_controller.rb | 18 +++ app/controllers/organizations_controller.rb | 19 ++- app/controllers/projects_controller.rb | 28 ++++- app/helpers/org_document_comment_helper.rb | 2 + app/helpers/org_member_helper.rb | 16 +++ app/helpers/org_projects_helper.rb | 2 + app/helpers/organizations_helper.rb | 1 + app/models/org_activity.rb | 5 + app/models/org_document_comment.rb | 16 +++ app/models/org_project.rb | 5 + app/views/layouts/base_org.html.erb | 91 ++------------- app/views/my/account.html.erb | 10 +- app/views/org_document_comments/_new.html.erb | 40 +++++++ .../org_document_comments/add_reply.js.erb | 3 + .../org_document_comments/destroy.js.erb | 1 + .../org_document_comments/index.html.erb | 26 +++++ app/views/org_document_comments/new.html.erb | 40 +++++++ app/views/org_document_comments/show.html.erb | 0 app/views/org_projects/create.js.erb | 4 + app/views/org_projects/destroy.js.erb | 2 + app/views/organization/_form.html.erb | 21 ---- app/views/organization/edit.html.erb | 25 ---- app/views/organization/index.html.erb | 31 ----- app/views/organization/new.html.erb | 18 --- .../organizations/_show_org_document.html.erb | 90 +++++++++++++++ .../organizations/autocomplete_search.js.erb | 13 +++ app/views/organizations/set_homepage.js.erb | 1 + app/views/organizations/setting.html.erb | 3 +- app/views/organizations/show.html.erb | 7 +- app/views/projects/settings.html.erb | 6 + .../projects/settings/_added_orgs.html.erb | 9 ++ .../projects/settings/_join_org.html.erb | 108 ++++++++++++++++++ config/routes.rb | 30 +++++ ...1104020233_create_org_document_comments.rb | 13 +++ ..._column_to_entity_org_document_comments.rb | 6 + .../20151104032831_create_org_activity.rb | 16 +++ .../20151104070007_create_org_projects.rb | 11 ++ ...455_delete_column_role_from_org_members.rb | 8 ++ ...04073902_rename_column_for_org_activity.rb | 6 + .../20151104090032_create_org_member_roles.rb | 11 ++ .../20151110011003_add_time_to_org_project.rb | 5 + db/schema.rb | 7 +- public/stylesheets/org.css | 13 ++- .../org_document_comment_controller_spec.rb | 5 + .../controllers/org_member_controller_spec.rb | 5 + .../org_projects_controller_spec.rb | 5 + spec/factories/org_activities.rb | 6 + spec/factories/org_document_comments.rb | 11 ++ spec/models/org_activity_spec.rb | 5 + spec/models/org_document_comment_spec.rb | 5 + 58 files changed, 761 insertions(+), 193 deletions(-) create mode 100644 app/assets/javascripts/org_document_comment.js.coffee create mode 100644 app/assets/javascripts/org_member.js.coffee create mode 100644 app/assets/javascripts/org_projects.js.coffee create mode 100644 app/assets/stylesheets/org_document_comment.css.scss create mode 100644 app/assets/stylesheets/org_member.css.scss create mode 100644 app/assets/stylesheets/org_projects.css.scss create mode 100644 app/controllers/org_document_comments_controller.rb create mode 100644 app/controllers/org_member_controller.rb create mode 100644 app/controllers/org_projects_controller.rb create mode 100644 app/helpers/org_document_comment_helper.rb create mode 100644 app/helpers/org_member_helper.rb create mode 100644 app/helpers/org_projects_helper.rb create mode 100644 app/models/org_activity.rb create mode 100644 app/models/org_document_comment.rb create mode 100644 app/models/org_project.rb create mode 100644 app/views/org_document_comments/_new.html.erb create mode 100644 app/views/org_document_comments/add_reply.js.erb create mode 100644 app/views/org_document_comments/destroy.js.erb create mode 100644 app/views/org_document_comments/index.html.erb create mode 100644 app/views/org_document_comments/new.html.erb create mode 100644 app/views/org_document_comments/show.html.erb create mode 100644 app/views/org_projects/create.js.erb create mode 100644 app/views/org_projects/destroy.js.erb delete mode 100644 app/views/organization/_form.html.erb delete mode 100644 app/views/organization/edit.html.erb delete mode 100644 app/views/organization/index.html.erb delete mode 100644 app/views/organization/new.html.erb create mode 100644 app/views/organizations/_show_org_document.html.erb create mode 100644 app/views/organizations/autocomplete_search.js.erb create mode 100644 app/views/organizations/set_homepage.js.erb create mode 100644 app/views/projects/settings/_added_orgs.html.erb create mode 100644 app/views/projects/settings/_join_org.html.erb create mode 100644 db/migrate/20151104020233_create_org_document_comments.rb create mode 100644 db/migrate/20151104024335_add_locked_and_sticky_column_to_entity_org_document_comments.rb create mode 100644 db/migrate/20151104032831_create_org_activity.rb create mode 100644 db/migrate/20151104070007_create_org_projects.rb create mode 100644 db/migrate/20151104070455_delete_column_role_from_org_members.rb create mode 100644 db/migrate/20151104073902_rename_column_for_org_activity.rb create mode 100644 db/migrate/20151104090032_create_org_member_roles.rb create mode 100644 db/migrate/20151110011003_add_time_to_org_project.rb create mode 100644 spec/controllers/org_document_comment_controller_spec.rb create mode 100644 spec/controllers/org_member_controller_spec.rb create mode 100644 spec/controllers/org_projects_controller_spec.rb create mode 100644 spec/factories/org_activities.rb create mode 100644 spec/factories/org_document_comments.rb create mode 100644 spec/models/org_activity_spec.rb create mode 100644 spec/models/org_document_comment_spec.rb 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 %>
配置
-
文章 ( 3 ) | 成员 ( 10 )
+
+ <%= 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 %>  ) +
@@ -77,90 +81,9 @@ <%= call_hook :view_layouts_base_content %>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
<%= 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| %> +
+
+ +
+
+ +
+<% 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| %> +
+
+ +
+
+ +
+<% 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? %> -
    -
  • - <%= organization.name%> - <%= 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) %> -
+ +