diff --git a/app/assets/javascripts/org_subfields.js.coffee b/app/assets/javascripts/org_subfields.js.coffee
new file mode 100644
index 000000000..761567942
--- /dev/null
+++ b/app/assets/javascripts/org_subfields.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_subfields.css.scss b/app/assets/stylesheets/org_subfields.css.scss
new file mode 100644
index 000000000..19263385e
--- /dev/null
+++ b/app/assets/stylesheets/org_subfields.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the org_subfields 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/messages_controller.rb b/app/controllers/messages_controller.rb
index 9b090de9a..6f173b7c2 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -169,6 +169,11 @@ class MessagesController < ApplicationController
course_activity.updated_at = Time.now
course_activity.save
end
+ forge_activity = ForgeActivity.where("forge_act_type='Message' and forge_act_id=#{@topic.id}").first
+ if forge_activity
+ forge_activity.updated_at = Time.now
+ forge_activity.save
+ end
user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first
if user_activity
user_activity.updated_at = Time.now
diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb
index 02527bdfc..29b728268 100644
--- a/app/controllers/org_document_comments_controller.rb
+++ b/app/controllers/org_document_comments_controller.rb
@@ -13,7 +13,7 @@ class OrgDocumentCommentsController < ApplicationController
@org_document_comment.content = params[:org_document_comment][:content]
if @org_document_comment.save
flash.keep[:notice] = l(:notice_successful_create)
- OrgActivity
+ EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document_comment.id, :created_at => @org_document_comment.updated_at)
redirect_to organization_org_document_comments_path(@organization)
else
redirect_to new_org_document_comment_path(:organization_id => @organization.id)
@@ -36,13 +36,18 @@ class OrgDocumentCommentsController < ApplicationController
if @org_document.parent.nil?
act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", @org_document.id).first
act.update_attributes(:updated_at => @org_document.updated_at)
+ EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document.id, :created_at => Time.now)
end
respond_to do |format|
format.html {
if params[:flag].to_i == 0
redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id)
else
- redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id)
+ if params[:flag].to_i == 1
+ redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id)
+ else
+ redirect_to organization_path(@org_document.organization.id)
+ end
end
}
end
@@ -81,10 +86,10 @@ class OrgDocumentCommentsController < ApplicationController
def destroy
@org_document_comment = OrgDocumentComment.find(params[:id])
org = @org_document_comment.organization
+ if @org_document_comment.id == org.home_id
+ org.update_attributes(:home_id => nil)
+ end
if @org_document_comment.destroy
- if @org_document_comment.id == org.id
- org.home_id == nil
- end
end
respond_to do |format|
format.js
diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb
new file mode 100644
index 000000000..6fdf0ae40
--- /dev/null
+++ b/app/controllers/org_subfields_controller.rb
@@ -0,0 +1,20 @@
+class OrgSubfieldsController < ApplicationController
+ def create
+ @subfield = OrgSubfield.create(:name => params[:name])
+ @organization = Organization.find(params[:organization_id])
+ @organization.org_subfields << @subfield
+ @subfield.update_attributes(:priority => @subfield.id)
+ end
+
+ def destroy
+ @subfield = OrgSubfield.find(params[:id])
+ @organization = Organization.find(@subfield.organization_id)
+ @subfield.destroy
+ end
+
+ def update
+ @subfield = OrgSubfield.find(params[:id])
+ @organization = Organization.find(@subfield.organization_id)
+ @subfield.update_attributes(:name => params[:name])
+ end
+end
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index b326051e6..47a0930a5 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -37,6 +37,19 @@ class OrganizationsController < ApplicationController
@organization = Organization.new
render :layout => 'new_base'
end
+
+ def edit
+ @organization = Organization.find(params[:id])
+ end
+
+ def destroy
+ @organization = Organization.find(params[:id])
+ @organization.destroy
+ respond_to do |format|
+ format.html{ redirect_to admin_organization_path }
+ end
+ end
+
def create
@organization = Organization.new
@organization.name = params[:organization][:name]
@@ -81,7 +94,11 @@ class OrganizationsController < ApplicationController
end
@page = params[:page]
respond_to do |format|
- format.html
+ format.html {
+ if !params[:show_homepage].nil?
+ render :layout => 'base_organization'
+ end
+ }
format.js
end
else
@@ -89,6 +106,13 @@ class OrganizationsController < ApplicationController
end
end
+ def homepage
+ @organization = Organization.find(params[:id])
+ respond_to do |format|
+ format.html {render :layout => 'base_organization'}
+ end
+ end
+
def update
@organization = Organization.find(params[:id])
@organization.name = params[:organization][:name]
@@ -142,6 +166,12 @@ class OrganizationsController < ApplicationController
# end
end
+ def cancel_homepage
+ @org = Organization.find(params[:id])
+ @org.home_id = nil
+ @org.save
+ end
+
def autocomplete_search
@project = Project.find(params[:project_id])
#@flag = params[:flag] || false
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 715f56d3d..200bd4d69 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -320,9 +320,20 @@ class ProjectsController < ApplicationController
@activity.scope_select {|t| !has["show_#{t}"].nil?}
=end
+ @page = params[:page] ? params[:page].to_i + 1 : 0
# 根据私密性,取出符合条件的所有数据
if User.current.member_of?(@project) || User.current.admin?
- @events_pages = ForgeActivity.where("project_id = ? and forge_act_type != ?",@project, "Document" ).order("created_at desc").page(params['page'|| 1]).per(20);
+ case params[:type]
+ when nil
+ @events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo')",@project).order("updated_at desc").limit(10).offset(@page * 10)
+ when 'issue'
+ @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'",@project).order("updated_at desc").limit(10).offset(@page * 10)
+ when 'news'
+ @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'",@project).order("updated_at desc").limit(10).offset(@page * 10)
+ when 'message'
+ @events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'",@project).order("updated_at desc").limit(10).offset(@page * 10)
+ end
+
#events = @activity.events(@date_from, @date_to)
else
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public
diff --git a/app/helpers/org_subfields_helper.rb b/app/helpers/org_subfields_helper.rb
new file mode 100644
index 000000000..a9f8a396f
--- /dev/null
+++ b/app/helpers/org_subfields_helper.rb
@@ -0,0 +1,2 @@
+module OrgSubfieldsHelper
+end
diff --git a/app/models/course.rb b/app/models/course.rb
index 30a6bb439..1c1bedb3b 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -32,7 +32,7 @@ class Course < ActiveRecord::Base
:conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"
has_many :principals, :through => :member_principals, :source => :principal
has_many :users, :through => :members
- has_many :org_courses
+ has_many :org_courses, :dependent => :destroy
has_many :organizations, :through => :org_courses
# has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
diff --git a/app/models/editor_of_document.rb b/app/models/editor_of_document.rb
new file mode 100644
index 000000000..15d9e7e37
--- /dev/null
+++ b/app/models/editor_of_document.rb
@@ -0,0 +1,4 @@
+class EditorOfDocument < ActiveRecord::Base
+ belongs_to :user, :class_name => 'User', :foreign_key => 'editor_id'
+ belongs_to :org_document_comment
+end
\ No newline at end of file
diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb
index bb5f30442..115575289 100644
--- a/app/models/forge_activity.rb
+++ b/app/models/forge_activity.rb
@@ -48,8 +48,10 @@ class ForgeActivity < ActiveRecord::Base
def add_org_activity
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
- org_activity.created_at = self.created_at
- org_activity.save
+ if org_activity
+ org_activity.created_at = self.created_at
+ org_activity.save
+ end
else
OrgActivity.create(:user_id => self.user_id,
:org_act_id => self.forge_act_id,
diff --git a/app/models/org_document_comment.rb b/app/models/org_document_comment.rb
index 7b9f9cd75..e2ce350ce 100644
--- a/app/models/org_document_comment.rb
+++ b/app/models/org_document_comment.rb
@@ -3,7 +3,7 @@ class OrgDocumentComment < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :organization
belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id'
-
+ has_many :editor_of_documents, :dependent => :destroy
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
diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb
new file mode 100644
index 000000000..1660310f8
--- /dev/null
+++ b/app/models/org_subfield.rb
@@ -0,0 +1,3 @@
+class OrgSubfield < ActiveRecord::Base
+ belongs_to :organization, :foreign_key => :organization_id
+end
\ No newline at end of file
diff --git a/app/models/organization.rb b/app/models/organization.rb
index d3755b5ee..350dc3080 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -5,7 +5,8 @@ class Organization < ActiveRecord::Base
has_many :projects,:through => :org_projects
has_many :courses, :through => :org_courses
has_many :org_document_comments, :dependent => :destroy
- has_many :org_courses
+ has_many :org_courses, :dependent => :destroy
+ has_many :org_subfields, :dependent => :destroy
has_many :users, :through => :org_members
validates_uniqueness_of :name
after_create :save_as_org_activity
diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb
index ea904a63f..b0354b53f 100644
--- a/app/views/comments/create.js.erb
+++ b/app/views/comments/create.js.erb
@@ -1,3 +1,6 @@
+<% if @course %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
-
+<% else %>
+$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
+<% end %>
init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%");
diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb
index b071a7c3b..aa46c35ee 100644
--- a/app/views/layouts/base_org.html.erb
+++ b/app/views/layouts/base_org.html.erb
@@ -81,59 +81,8 @@
<%= link_to '成员', members_organization_path(@organization.id) %> (<%= link_to @organization.org_members.count, members_organization_path(@organization.id), :id => 'org_members_count_id', :class => "linkBlue" %>)
-
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
<% unless document.content.blank? %>
-
+
<%= document.content.html_safe %>
<% end %>
- <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id) || User.current.id == document.creator_id) %>
+ <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id)) || User.current.id == document.creator_id %>
@@ -36,7 +32,7 @@
<% end %>
- <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => 0), :class => "postOptionLink" %>
+ <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => flag), :class => "postOptionLink" %>
<%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete',
@@ -92,7 +88,7 @@
- <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id), :method => "post", :remote => true) do |f| %>
+ <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %>
diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb
new file mode 100644
index 000000000..6ba60245a
--- /dev/null
+++ b/app/views/organizations/_subfield_list.html.erb
@@ -0,0 +1,56 @@
+
+
+
+
+
+ <% subfields.each do |field| %>
+
+ <%= field.name %>
+
+ 新增
+ <%= link_to "删除",org_subfield_path(field), :method => 'delete',:remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr5" %>
+ 编辑
+
+
+ <% end %>
+
+
\ No newline at end of file
diff --git a/app/views/organizations/cancel_homepage.js.erb b/app/views/organizations/cancel_homepage.js.erb
new file mode 100644
index 000000000..bf9eb798c
--- /dev/null
+++ b/app/views/organizations/cancel_homepage.js.erb
@@ -0,0 +1 @@
+window.location.href = "<%= organization_path(@org) %>";
\ No newline at end of file
diff --git a/app/views/organizations/destroy.js.erb b/app/views/organizations/destroy.js.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/organizations/edit.html.erb b/app/views/organizations/edit.html.erb
new file mode 100644
index 000000000..c2e918708
--- /dev/null
+++ b/app/views/organizations/edit.html.erb
@@ -0,0 +1,108 @@
+
+<% @nav_dispaly_organization_label = 1
+ @nav_dispaly_forum_label = 1 %>
+<%= error_messages_for 'organization' %>
+
+
编辑组织
+
+
+
+
+ <%#= form_for( @organization,{:controller => 'organizations',:action => 'update',:id=>@organization,:html=>{:id=>'update_org_form',:method=>'put'}}) do %>
+ <%= labelled_form_for @organization, :html => {:id => "edit_organization_#{@organization.id}"} do |f|%>
+ <%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
公开 :
+ class="ml3" />
+
+
保存
+ <% end %>
+
+
+
+<% html_title(l(:label_organization_new)) -%>
+
+
+
diff --git a/app/views/organizations/setting.html.erb b/app/views/organizations/setting.html.erb
index 82b28fb8a..e0f262b99 100644
--- a/app/views/organizations/setting.html.erb
+++ b/app/views/organizations/setting.html.erb
@@ -2,7 +2,7 @@
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
- for(var i=1;i<=2;i++){
+ for(var i=1;i<=3;i++){
g('orgSetting_'+i).className='orgSettingOp';
g('orgContent_'+i).className='undis';}
g('orgContent_'+n).className='dis ml15 mr15';
@@ -34,6 +34,7 @@
@@ -45,13 +46,11 @@
<%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %>
-
* 组织名称:
-
+
-
组织描述:
-
+
@@ -106,4 +105,26 @@
-
\ No newline at end of file
+
+
+ <%= render :partial => 'organizations/subfield_list', :locals => {:subfields => @organization.org_subfields } %>
+
+
+
+
新增栏目
+ <%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %>
+
+
+
确定
+ <% end %>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb
index e44e0778d..9ee9d11c0 100644
--- a/app/views/organizations/show.html.erb
+++ b/app/views/organizations/show.html.erb
@@ -12,6 +12,7 @@
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
.homepagePostReplyInputContainer .ke-container {float: left;}
+<% if params[:show_homepage].nil? %>
-
-<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
+<% end %>
+<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
<% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %>
- <%= render :partial => 'show_org_document', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %>
+ <%= render :partial => 'show_home_page', :locals => {:document => OrgDocumentComment.find(@organization.home_id), :home_id => @organization.home_id, :act => act} %>
<% end %>
<% if @org_activities %>
<%= render :partial => 'organizations/org_activities',
diff --git a/app/views/projects/_attachment_acts.html.erb b/app/views/projects/_attachment_acts.html.erb
new file mode 100644
index 000000000..2baa8791a
--- /dev/null
+++ b/app/views/projects/_attachment_acts.html.erb
@@ -0,0 +1,35 @@
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <%= link_to activity.project.name.to_s+" | 项目附件", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
+
+
+ <%= link_to format_activity_title("#{l(:label_attachment)}: #{activity.filename}"), {:controller => 'attachments', :action => 'show', :id => activity.id}, :class => "problem_tit fl fb" %>
+ <%#= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
+
+
+
+ 发布时间:<%= format_time(activity.created_on) %>
+
+
<%= textAreailizable act, :description %>
+
+
+ <%#= activity.description.html_safe %>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb
new file mode 100644
index 000000000..f97646d3c
--- /dev/null
+++ b/app/views/projects/_project_activities.html.erb
@@ -0,0 +1,102 @@
+<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %>
+
+<% unless forge_acts.empty? %>
+ <% forge_acts.each do |activity| -%>
+
+
+ <% case activity.forge_act_type %>
+ <% when "ProjectCreateInfo" %>
+ <%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %>
+
+ <% when "Issue" %>
+ <%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id} %>
+
+
+ <% when "Message" %>
+ <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id} %>
+
+ <% when "News" %>
+ <% if !activity.forge_act.nil? and activity.forge_act.project %>
+ <%= render :partial => 'projects/project_news', :locals => {:activity=>activity.forge_act, :user_activity_id=>activity.id} %>
+ <% end %>
+
+ <% when "Attachment" %>
+ <%= render :partial => 'projects/attachment_acts', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id } %>
+
+
+
+
+
+
+
+
+ <%#= link_to format_activity_title("#{l(:label_attachment)}: #{act.filename}"), {:controller => 'attachments', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %>
+
+
+
+
+
+
+
+
+ <% end %>
+ <% end %>
+<% end %>
+
+<% if forge_acts.count == 10 %>
+
展开更多<%= link_to "", project_path(@project.id, :type => type, :page => page), :id => "more_forge_activities_link", :remote => "true", :class => "none" %>
+<% end %>
+
+
\ No newline at end of file
diff --git a/app/views/projects/_project_create.html.erb b/app/views/projects/_project_create.html.erb
new file mode 100644
index 000000000..d966d8e18
--- /dev/null
+++ b/app/views/projects/_project_create.html.erb
@@ -0,0 +1,38 @@
+<% project = Project.find(activity.project_id) %>
+<% user = User.find(project.user_id)%>
+
+
+
+ <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %>
+
+
+
+ <% if user.try(:realname) == ' ' %>
+ <%= link_to user, user_path(user), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to user.try(:realname), user_path(user), :class => "newsBlue mr15" %>
+ <% end %>
+ TO
+ <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %>
+
+
+ <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %>
+
+
+ 创建时间:<%= format_time(project.created_on) %>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb
new file mode 100644
index 000000000..919abc11e
--- /dev/null
+++ b/app/views/projects/_project_news.html.erb
@@ -0,0 +1,106 @@
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <%= link_to activity.project.name.to_s+" | 项目新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
+
+
+ <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
+
+ <% if activity.sticky == 1%>
+
置顶
+ <% end%>
+
+
+ 发布时间:<%= format_time(activity.created_on) %>
+
+
+
+ <%= activity.description.html_safe %>
+
+
+
+
+
+
+
+
+
+ <% count=activity.comments.count %>
+
+
+
+
+ 回复(<%= count %>)
+
+
<%#= format_date(activity.updated_on) %>
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.comments.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:author).try(:realname) == ' ' %>
+ <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
index a3a2845f8..a58aeb281 100644
--- a/app/views/projects/show.html.erb
+++ b/app/views/projects/show.html.erb
@@ -1,114 +1,33 @@
-<%= javascript_include_tag "jquery.infinitescroll.js" %>
-
-
<%= l(:label_activity) %>
-
-
-<% unless @events_pages.empty? %>
- <% @events_pages.each do |e| -%>
-
- <% if e.forge_act_type == "ProjectCreateInfo"%>
-
-
<%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %>
-
- <%= link_to e.user, user_path(e.user), :class => "problem_name c_orange fl" %>
<%= l(:label_project_create) %> :
- <%= link_to e.project.name,{} ,:class => "problem_tit fl fb" %>
-
<%= l :label_create_time %> :<%= format_time(e.project.created_on) %>
-
-
-
- <% end %>
- <% next if e.forge_act_type.safe_constantize.nil?
- act = e.forge_act;
- next if act.nil? %>
-
- <% if e.forge_act_type == "Issue" %>
-
-
- <% elsif e.forge_act_type == "Journal" %>
-
-
- <% elsif e.forge_act_type == "Message" %>
-
-
<%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %>
-
+ <%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %>
+
\ No newline at end of file
diff --git a/app/views/projects/show.js.erb b/app/views/projects/show.js.erb
new file mode 100644
index 000000000..384c111d1
--- /dev/null
+++ b/app/views/projects/show.js.erb
@@ -0,0 +1 @@
+$("#show_more_forge_activities").replaceWith("<%= escape_javascript( render :partial => 'projects/project_activities',:locals => {:forge_acts => @events_pages, :page => @page,:type => @type} )%>");
diff --git a/config/routes.rb b/config/routes.rb
index 59eb29d70..4e64ca505 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -36,6 +36,7 @@ RedmineApp::Application.routes.draw do
get 'setting'#, :action => 'settings', :as => 'settings'
get 'clear_org_avatar_temp'
put 'set_homepage'
+ put 'cancel_homepage'
get 'members'
get 'more_org_projects'
get 'more_org_courses'
@@ -69,6 +70,10 @@ RedmineApp::Application.routes.draw do
end
end
+ resources :org_subfields do
+
+ end
+
resources :org_document_comments do
member do
post 'add_reply'
diff --git a/db/migrate/20151130032658_create_org_docume_editor.rb b/db/migrate/20151130032658_create_org_docume_editor.rb
new file mode 100644
index 000000000..0dc9857ba
--- /dev/null
+++ b/db/migrate/20151130032658_create_org_docume_editor.rb
@@ -0,0 +1,12 @@
+class CreateOrgDocumeEditor < ActiveRecord::Migration
+ def up
+ create_table :editor_of_documents do |t|
+ t.integer :editor_id
+ t.integer :org_document_comment_id
+ t.timestamp :created_at
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20151130064556_copy_document_created_at_for_editor_of_document.rb b/db/migrate/20151130064556_copy_document_created_at_for_editor_of_document.rb
new file mode 100644
index 000000000..2361db3dd
--- /dev/null
+++ b/db/migrate/20151130064556_copy_document_created_at_for_editor_of_document.rb
@@ -0,0 +1,12 @@
+class CopyDocumentCreatedAtForEditorOfDocument < ActiveRecord::Migration
+ def up
+ OrgDocumentComment.all.each do |doc|
+ if doc.parent.nil?
+ EditorOfDocument.create(:editor_id => doc.creator_id, :org_document_comment_id => doc.id, :created_at => doc.updated_at)
+ end
+ end
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20151204030143_create_org_subfields.rb b/db/migrate/20151204030143_create_org_subfields.rb
new file mode 100644
index 000000000..2727cdef0
--- /dev/null
+++ b/db/migrate/20151204030143_create_org_subfields.rb
@@ -0,0 +1,13 @@
+class CreateOrgSubfields < ActiveRecord::Migration
+ def up
+ create_table :org_subfields do |t|
+ t.integer :organization_id
+ t.integer :priority
+ t.string :name
+ t.timestamps
+ end
+ end
+
+ def down
+ end
+end
diff --git a/public/images/home_logo.png b/public/images/home_logo.png
new file mode 100644
index 000000000..b1270a242
Binary files /dev/null and b/public/images/home_logo.png differ
diff --git a/public/stylesheets/org.css b/public/stylesheets/org.css
index a0118b263..897eb8734 100644
--- a/public/stylesheets/org.css
+++ b/public/stylesheets/org.css
@@ -54,4 +54,14 @@ a.cancelBtn:hover {background-color:#717171; color:#ffffff;}
/*关联项目弹窗*/
.projectRelate {float:left; max-height:118px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden; width:288px;}
-.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}
\ No newline at end of file
+.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}
+
+/*组织首页新151204Tim*/
+.orgNav {width:1000px; height:30px; background-color:#cfcfcf; margin:0 auto;}
+.orgContainer {width:100%; margin:0 auto; background-color:#cfcfcf;}
+.navOrgLogo {width:21px; height:30px; margin-left:2px; margin-right:15px;}
+.navOrgMenu {display:inline-block;height:30px; line-height:30px; vertical-align:middle;}
+a.linkGrey8 {color:#888888;}
+a.linkGrey8:hover {color:#585858;}
+.orgBorder {width:583px; height:21px; border-bottom:3px solid #e4e4e4; float:left;}
+.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px; color:#555555;}
\ No newline at end of file
diff --git a/spec/controllers/org_subfields_controller_spec.rb b/spec/controllers/org_subfields_controller_spec.rb
new file mode 100644
index 000000000..4bc89dae0
--- /dev/null
+++ b/spec/controllers/org_subfields_controller_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe OrgSubfieldsController, :type => :controller do
+
+end