Merge branch 'dev_hjq' of https://git.trustie.net/jacknudt/trustieforge into dev_hjq
Conflicts: public/stylesheets/org.css
This commit is contained in:
commit
b0b4527ea1
|
@ -242,6 +242,8 @@ class AttachmentsController < ApplicationController
|
|||
format.html { redirect_to_referer_or mobile_version_path }
|
||||
elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgSubfield)
|
||||
format.html {redirect_to_referer_or org_subfield_files_path(@attachment.container)}
|
||||
elsif !@attachment.container.nil? && @attachment.container.is_a?(OrgDocumentComment)
|
||||
format.html {redirect_to_referer_or org_document_comment_path(@attachment.container)}
|
||||
else
|
||||
if @project.nil?
|
||||
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
class BoardsController < ApplicationController
|
||||
layout 'base_projects'#by young
|
||||
default_search_scope :messages
|
||||
before_filter :find_project_by_project_id, :find_board_if_available
|
||||
before_filter :authorize, :except => [:new, :show, :create, :index]
|
||||
before_filter :find_project_by_project_id, :find_board_if_available, :except => [:join_to_org_subfields]
|
||||
before_filter :authorize, :except => [:new, :show, :create, :index, :join_to_org_subfields]
|
||||
accept_rss_auth :index, :show
|
||||
|
||||
|
||||
|
@ -225,6 +225,16 @@ class BoardsController < ApplicationController
|
|||
redirect_to_settings_in_projects
|
||||
end
|
||||
|
||||
def join_to_org_subfields
|
||||
if params[:id]
|
||||
@board = Board.find(params[:id])
|
||||
@org_subfield_ids = params[:org_subfield_ids]
|
||||
@org_subfield_ids.each do |id|
|
||||
OrgSubfieldBoard.create(:org_subfield_id => id.to_i, :board_id => params[:id].to_i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def redirect_to_settings_in_projects
|
||||
redirect_to settings_project_url(@project, :tab => 'boards')
|
||||
|
|
|
@ -22,7 +22,7 @@ class MessagesController < ApplicationController
|
|||
default_search_scope :messages
|
||||
before_filter :find_board, :only => [:new, :preview,:edit]
|
||||
before_filter :find_attachments, :only => [:preview]
|
||||
before_filter :find_message, :except => [:new, :preview]
|
||||
before_filter :find_message, :except => [:new, :preview, :join_org_subfield, :get_subfield_on_click_org, :join_org_subfields]
|
||||
before_filter :authorize, :except => [:preview, :edit, :destroy, :new]
|
||||
|
||||
helper :boards
|
||||
|
@ -301,6 +301,31 @@ class MessagesController < ApplicationController
|
|||
render :partial => 'common/preview'
|
||||
end
|
||||
|
||||
def join_org_subfield
|
||||
@message = Message.find(params[:message_id])
|
||||
@organizations = User.current.organizations
|
||||
end
|
||||
|
||||
def get_subfield_on_click_org
|
||||
@org = Organization.find(params[:organization_id])
|
||||
end
|
||||
|
||||
def join_org_subfields
|
||||
org_subfield_ids = params[:org_subfields]
|
||||
@message = Message.find(params[:id])
|
||||
# @message.update_attribute(:updated_on, Time.now)
|
||||
type = @message.board.course_id.nil? ? "Project":"Course"
|
||||
org_subfield_ids.each do |field_id|
|
||||
OrgSubfieldMessage.create(:org_subfield_id => field_id.to_i, :message_id => @message.id, :message_type => type)
|
||||
org_acts = OrgActivity.where("container_type='OrgSubfield' and container_id=? and org_act_type='Message' and org_act_id=?", field_id.to_i, @message.id)
|
||||
if org_acts.all.size() > 0
|
||||
org_acts.first.update_attribute(:updated_at, Time.now)
|
||||
else
|
||||
OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => @message.id, :user_id => User.current.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def find_message
|
||||
return unless find_board
|
||||
|
|
|
@ -1,163 +1,166 @@
|
|||
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 params[:field_id]
|
||||
@org_document_comment.org_subfield_id = params[:field_id].to_i
|
||||
end
|
||||
if @org_document_comment.save
|
||||
flash.keep[:notice] = l(:notice_successful_create)
|
||||
EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document_comment.id, :created_at => @org_document_comment.updated_at)
|
||||
if params[:field_id]
|
||||
redirect_to organization_path(@organization, :org_subfield_id => params[:field_id])
|
||||
else
|
||||
redirect_to organization_org_document_comments_path(@organization)
|
||||
end
|
||||
else
|
||||
redirect_to new_org_document_comment_path(:organization_id => @organization.id)
|
||||
end
|
||||
end
|
||||
def show
|
||||
@document = OrgDocumentComment.find(params[:id])
|
||||
end
|
||||
|
||||
def index
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@documents = @organization.org_document_comments.where("parent_id is null").order("created_at desc")
|
||||
else
|
||||
render_403
|
||||
end
|
||||
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])
|
||||
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
|
||||
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, :org_subfield_id => params[:org_subfield_id])
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@org_document = OrgDocumentComment.find(params[:id])
|
||||
@flag = params[:flag]
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
end
|
||||
|
||||
def add_reply
|
||||
@document = OrgDocumentComment.find(params[:id]).root
|
||||
@act = OrgActivity.find(params[:id])
|
||||
@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 add_reply_in_doc
|
||||
@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_comment][:org_content]
|
||||
@document.children << @comment
|
||||
@document.save
|
||||
respond_to do |format|
|
||||
format.html {redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)}
|
||||
end
|
||||
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.id == org.home_id
|
||||
org.update_attributes(:home_id => nil)
|
||||
end
|
||||
if @org_document_comment.destroy
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def delete_reply
|
||||
@org_document_comment = OrgDocumentComment.find(params[:id])
|
||||
@document = @org_document_comment.root
|
||||
org = @org_document_comment.organization
|
||||
@org_document_comment.destroy
|
||||
respond_to do |format|
|
||||
format.html {redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)}
|
||||
end
|
||||
end
|
||||
def quote
|
||||
@org_comment = OrgDocumentComment.find(params[:id])
|
||||
@subject = @org_comment.content
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)}\n> "
|
||||
@temp = OrgDocumentComment.new
|
||||
#@course_id = params[:course_id]
|
||||
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)} <br/>#{@org_comment.content.html_safe}</blockquote>".html_safe
|
||||
respond_to do | format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def reply
|
||||
@document = OrgDocumentComment.find(params[:id]).root
|
||||
@quote = params[:quote][:quote]
|
||||
@org_document = OrgDocumentComment.new(:creator_id => User.current.id, :reply_id => params[:id])
|
||||
|
||||
# params[:blog_comment][:sticky] = params[:blog_comment][:sticky] || 0
|
||||
# params[:blog_comment][:locked] = params[:blog_comment][:locked] || 0
|
||||
@org_document.title = params[:org_document_comment][:title]
|
||||
@org_document.content = params[:org_document_comment][:content]
|
||||
@org_document.content = @quote + @org_document.content
|
||||
#@org_document.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
|
||||
@document.children << @org_document
|
||||
# @user_activity_id = params[:user_activity_id]
|
||||
# user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first
|
||||
# if user_activity
|
||||
# user_activity.updated_at = Time.now
|
||||
# user_activity.save
|
||||
# end
|
||||
# attachments = Attachment.attach_files(@org_document, params[:attachments])
|
||||
# render_attachment_warning_if_needed(@org_document)
|
||||
#@article.save
|
||||
# redirect_to user_blogs_path(:user_id=>params[:user_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
# if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的
|
||||
# redirect_to syllabus_course_path(:id=>params[:course_id])
|
||||
# else
|
||||
redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)
|
||||
# end
|
||||
|
||||
}
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
class OrgDocumentCommentsController < ApplicationController
|
||||
before_filter :find_organization, :only => [:new, :create, :show, :index]
|
||||
helper :attachments
|
||||
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]
|
||||
@org_document_comment.save_attachments(params[:attachments])
|
||||
if params[:field_id]
|
||||
@org_document_comment.org_subfield_id = params[:field_id].to_i
|
||||
end
|
||||
if @org_document_comment.save
|
||||
flash.keep[:notice] = l(:notice_successful_create)
|
||||
EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document_comment.id, :created_at => @org_document_comment.updated_at)
|
||||
if params[:field_id]
|
||||
redirect_to organization_path(@organization, :org_subfield_id => params[:field_id])
|
||||
else
|
||||
redirect_to organization_org_document_comments_path(@organization)
|
||||
end
|
||||
else
|
||||
redirect_to new_org_document_comment_path(:organization_id => @organization.id)
|
||||
end
|
||||
end
|
||||
def show
|
||||
@document = OrgDocumentComment.find(params[:id])
|
||||
end
|
||||
|
||||
def index
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@documents = @organization.org_document_comments.where("parent_id is null").order("created_at desc")
|
||||
else
|
||||
render_403
|
||||
end
|
||||
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])
|
||||
@org_document.save_attachments(params[:attachments])
|
||||
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
|
||||
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, :org_subfield_id => params[:org_subfield_id])
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@org_document = OrgDocumentComment.find(params[:id])
|
||||
@flag = params[:flag]
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
end
|
||||
|
||||
def add_reply
|
||||
@document = OrgDocumentComment.find(params[:id]).root
|
||||
@act = OrgActivity.find(params[:id])
|
||||
@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 add_reply_in_doc
|
||||
@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_comment][:org_content]
|
||||
@document.children << @comment
|
||||
@document.save
|
||||
respond_to do |format|
|
||||
format.html {redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)}
|
||||
end
|
||||
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.id == org.home_id
|
||||
org.update_attributes(:home_id => nil)
|
||||
end
|
||||
if @org_document_comment.destroy
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def delete_reply
|
||||
@org_document_comment = OrgDocumentComment.find(params[:id])
|
||||
@document = @org_document_comment.root
|
||||
org = @org_document_comment.organization
|
||||
@org_document_comment.destroy
|
||||
respond_to do |format|
|
||||
format.html {redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)}
|
||||
end
|
||||
end
|
||||
def quote
|
||||
@org_comment = OrgDocumentComment.find(params[:id])
|
||||
@subject = @org_comment.content
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)}\n> "
|
||||
@temp = OrgDocumentComment.new
|
||||
#@course_id = params[:course_id]
|
||||
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)} <br/>#{@org_comment.content.html_safe}</blockquote>".html_safe
|
||||
respond_to do | format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def reply
|
||||
@document = OrgDocumentComment.find(params[:id]).root
|
||||
@quote = params[:quote][:quote]
|
||||
@org_document = OrgDocumentComment.new(:creator_id => User.current.id, :reply_id => params[:id])
|
||||
|
||||
# params[:blog_comment][:sticky] = params[:blog_comment][:sticky] || 0
|
||||
# params[:blog_comment][:locked] = params[:blog_comment][:locked] || 0
|
||||
@org_document.title = params[:org_document_comment][:title]
|
||||
@org_document.content = params[:org_document_comment][:content]
|
||||
@org_document.content = @quote + @org_document.content
|
||||
#@org_document.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
|
||||
@document.children << @org_document
|
||||
# @user_activity_id = params[:user_activity_id]
|
||||
# user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first
|
||||
# if user_activity
|
||||
# user_activity.updated_at = Time.now
|
||||
# user_activity.save
|
||||
# end
|
||||
# attachments = Attachment.attach_files(@org_document, params[:attachments])
|
||||
# render_attachment_warning_if_needed(@org_document)
|
||||
#@article.save
|
||||
# redirect_to user_blogs_path(:user_id=>params[:user_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
# if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的
|
||||
# redirect_to syllabus_course_path(:id=>params[:course_id])
|
||||
# else
|
||||
redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)
|
||||
# end
|
||||
|
||||
}
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,24 +1,32 @@
|
|||
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, :field_type => params[:field_type])
|
||||
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
|
||||
|
||||
def show
|
||||
|
||||
end
|
||||
end
|
||||
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, :field_type => params[:field_type])
|
||||
end
|
||||
|
||||
def show
|
||||
@org_subfield = OrgSubfield.find(params[:id])
|
||||
@organization = @org_subfield.organization.id
|
||||
@messages = []
|
||||
@messages << @org_subfield.org_document_comments
|
||||
@messages << @org_subfield.messages
|
||||
@messages.sort{|a, b| b.updated_at <=> a.updated_at}
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_org'}
|
||||
end
|
||||
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
|
||||
|
|
|
@ -1,284 +1,284 @@
|
|||
# encoding: utf-8
|
||||
class OrganizationsController < ApplicationController
|
||||
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
include AvatarHelper
|
||||
include WordsHelper
|
||||
include GitlabHelper
|
||||
include UserScoreHelper
|
||||
|
||||
include PollHelper
|
||||
helper :user_score
|
||||
helper :journals
|
||||
|
||||
# added by liuping 关注
|
||||
|
||||
helper :watchers
|
||||
helper :activities
|
||||
|
||||
### added by william
|
||||
include ActsAsTaggableOn::TagsHelper
|
||||
|
||||
# fq
|
||||
helper :words
|
||||
helper :project_score
|
||||
helper :issues
|
||||
include UsersHelper
|
||||
before_filter :find_organization, :only => [:show, :members]
|
||||
layout 'base_org'
|
||||
def index
|
||||
|
||||
end
|
||||
def new
|
||||
@organization = Organization.new
|
||||
render :layout => 'new_base'
|
||||
end
|
||||
|
||||
def 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]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.is_public = params[:organization][:is_public]
|
||||
@organization.creator_id = User.current.id
|
||||
member = OrgMember.new(:user_id => User.current.id)
|
||||
|
||||
@organization.org_members << member
|
||||
if @organization.save
|
||||
OrgMemberRole.create(:org_member_id => member.id, :role_id => 11)
|
||||
redirect_to organization_path(@organization)
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@organization = Organization.find(params[:id])
|
||||
if params[:org_subfield_id]
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
@org_activities = OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
else
|
||||
project_ids = @organization.projects.map(&:id) << 0
|
||||
course_ids = @organization.courses.map(&:id) << 0
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||
case params[:type]
|
||||
when nil
|
||||
@org_activities = OrgActivity.where("(container_id =? and container_type =?) " +
|
||||
"or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+
|
||||
"or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
|
||||
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_issue'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'org'
|
||||
@org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_homework'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_news'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_poll'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
end
|
||||
end
|
||||
@page = params[:page]
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@organization = Organization.find(params[:id])
|
||||
@organization.name = params[:organization][:name]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.domain = params[:organization][:domain]
|
||||
@organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
|
||||
#@organization.name = params[:organization][:name]
|
||||
@organization.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to setting_organization_path(@organization)}
|
||||
end
|
||||
end
|
||||
|
||||
def check_uniq
|
||||
@check = false;
|
||||
@org_name = params[:org_name].strip
|
||||
@config_page = params[:config_page]
|
||||
sameName = @config_page ? Organization.where('name = ? and id != ?',params[:org_name],params[:org_id].to_i).count == 0 : Organization.where('name = ?',params[:org_name]).count == 0
|
||||
if sameName == true
|
||||
@check = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def find_organization
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
||||
def setting
|
||||
@organization = Organization.find(params[:id])
|
||||
|
||||
if User.current.admin? || User.current.admin_of_org?(@organization)
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def clear_org_avatar_temp
|
||||
|
||||
end
|
||||
|
||||
def set_homepage
|
||||
@org = Organization.find(params[:id])
|
||||
@org.home_id = params[:home_id]
|
||||
@org.save
|
||||
# respond_to do |format|
|
||||
# format.html {redirect_to organization_path(org)}
|
||||
# end
|
||||
end
|
||||
|
||||
def 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
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def members
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@members = OrgMember.where("organization_id =?", @organization.id)
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def more_org_projects
|
||||
@organization = Organization.find params[:id]
|
||||
@page = params[:page]
|
||||
@org_projects = @organization.projects.reorder('created_at').uniq.page((params[:page].to_i || 1) +1).per(5)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def more_org_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
@page = params[:page]
|
||||
@org_courses = @organization.courses.reorder('created_at').uniq.page((params[:page].to_i || 1) + 1 ).per(5)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_course_menu
|
||||
@organization = Organization.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def search_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
condition = '%%'
|
||||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"+
|
||||
"and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id})"
|
||||
#user_courses = Course.find_by_sql(sql)
|
||||
@courses = Course.find_by_sql(sql)
|
||||
# @added_course_ids = @organization.courses.map(&:id)
|
||||
# @courses = []
|
||||
# user_courses.each do |course|
|
||||
# if !@added_course_ids.include?(course.id)
|
||||
# @courses << course
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def join_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
course_ids = params[:courseNames]
|
||||
course_ids.each do |id|
|
||||
OrgCourse.create(:organization_id => @organization.id, :course_id => id.to_i, :created_at => Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_project_menu
|
||||
@organization = Organization.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def logout
|
||||
logout_user
|
||||
respond_to do |format|
|
||||
format.html {redirect_to organization_path(params[:id])}
|
||||
end
|
||||
end
|
||||
|
||||
def search_projects
|
||||
@organization = Organization.find(params[:id])
|
||||
condition = '%%'
|
||||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" +
|
||||
" and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id})"
|
||||
#user_projects = Course.find_by_sql(sql)
|
||||
@projects = Course.find_by_sql(sql)
|
||||
# @added_course_ids = @organization.projects.map(&:id)
|
||||
# @projects = []
|
||||
# user_projects.each do |project|
|
||||
# if !@added_course_ids.include?(project.id)
|
||||
# @projects << project
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def join_projects
|
||||
@organization = Organization.find(params[:id])
|
||||
project_ids = params[:projectNames]
|
||||
project_ids.each do |id|
|
||||
OrgProject.create(:organization_id => @organization.id, :project_id => id.to_i, :created_at => Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
class OrganizationsController < ApplicationController
|
||||
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
helper :custom_fields
|
||||
include CustomFieldsHelper
|
||||
include AvatarHelper
|
||||
include WordsHelper
|
||||
include GitlabHelper
|
||||
include UserScoreHelper
|
||||
|
||||
include PollHelper
|
||||
helper :user_score
|
||||
helper :journals
|
||||
|
||||
# added by liuping 关注
|
||||
|
||||
helper :watchers
|
||||
helper :activities
|
||||
|
||||
### added by william
|
||||
include ActsAsTaggableOn::TagsHelper
|
||||
|
||||
# fq
|
||||
helper :words
|
||||
helper :project_score
|
||||
helper :issues
|
||||
include UsersHelper
|
||||
before_filter :find_organization, :only => [:show, :members]
|
||||
layout 'base_org'
|
||||
def index
|
||||
|
||||
end
|
||||
def new
|
||||
@organization = Organization.new
|
||||
render :layout => 'new_base'
|
||||
end
|
||||
|
||||
def 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]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.is_public = params[:organization][:is_public]
|
||||
@organization.creator_id = User.current.id
|
||||
member = OrgMember.new(:user_id => User.current.id)
|
||||
|
||||
@organization.org_members << member
|
||||
if @organization.save
|
||||
OrgMemberRole.create(:org_member_id => member.id, :role_id => 11)
|
||||
redirect_to organization_path(@organization)
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@organization = Organization.find(params[:id])
|
||||
if params[:org_subfield_id]
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
@org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
else
|
||||
project_ids = @organization.projects.map(&:id) << 0
|
||||
course_ids = @organization.courses.map(&:id) << 0
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||
case params[:type]
|
||||
when nil
|
||||
@org_activities = OrgActivity.where("(container_id =? and container_type =?) " +
|
||||
"or (container_type ='Project' and org_act_type in ('Issue','Message','ProjectCreateInfo') and container_id in (#{project_ids.join(',')})) "+
|
||||
"or (container_type ='Course' and org_act_type in #{course_types} and container_id in (#{course_ids.join(',')}))",
|
||||
@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_issue'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Issue' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'project_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Project' and org_act_type = 'Message' and container_id in (#{project_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'org'
|
||||
@org_activities = OrgActivity.where("container_id =? and container_type =?",@organization.id, 'Organization').order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_homework'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'HomeworkCommon' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_news'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'News' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_message'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Message' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
when 'course_poll'
|
||||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
end
|
||||
end
|
||||
@page = params[:page]
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@organization = Organization.find(params[:id])
|
||||
@organization.name = params[:organization][:name]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.domain = params[:organization][:domain]
|
||||
@organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
|
||||
#@organization.name = params[:organization][:name]
|
||||
@organization.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to setting_organization_path(@organization)}
|
||||
end
|
||||
end
|
||||
|
||||
def check_uniq
|
||||
@check = false;
|
||||
@org_name = params[:org_name].strip
|
||||
@config_page = params[:config_page]
|
||||
sameName = @config_page ? Organization.where('name = ? and id != ?',params[:org_name],params[:org_id].to_i).count == 0 : Organization.where('name = ?',params[:org_name]).count == 0
|
||||
if sameName == true
|
||||
@check = true
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def find_organization
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
||||
def setting
|
||||
@organization = Organization.find(params[:id])
|
||||
|
||||
if User.current.admin? || User.current.admin_of_org?(@organization)
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def clear_org_avatar_temp
|
||||
|
||||
end
|
||||
|
||||
def set_homepage
|
||||
@org = Organization.find(params[:id])
|
||||
@org.home_id = params[:home_id]
|
||||
@org.save
|
||||
# respond_to do |format|
|
||||
# format.html {redirect_to organization_path(org)}
|
||||
# end
|
||||
end
|
||||
|
||||
def 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
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def members
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@members = OrgMember.where("organization_id =?", @organization.id)
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def more_org_projects
|
||||
@organization = Organization.find params[:id]
|
||||
@page = params[:page]
|
||||
@org_projects = @organization.projects.reorder('created_at').uniq.page((params[:page].to_i || 1) +1).per(5)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def more_org_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
@page = params[:page]
|
||||
@org_courses = @organization.courses.reorder('created_at').uniq.page((params[:page].to_i || 1) + 1 ).per(5)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_course_menu
|
||||
@organization = Organization.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def search_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
condition = '%%'
|
||||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"+
|
||||
"and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id})"
|
||||
#user_courses = Course.find_by_sql(sql)
|
||||
@courses = Course.find_by_sql(sql)
|
||||
# @added_course_ids = @organization.courses.map(&:id)
|
||||
# @courses = []
|
||||
# user_courses.each do |course|
|
||||
# if !@added_course_ids.include?(course.id)
|
||||
# @courses << course
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def join_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
course_ids = params[:courseNames]
|
||||
course_ids.each do |id|
|
||||
OrgCourse.create(:organization_id => @organization.id, :course_id => id.to_i, :created_at => Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_project_menu
|
||||
@organization = Organization.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def logout
|
||||
logout_user
|
||||
respond_to do |format|
|
||||
format.html {redirect_to organization_path(params[:id])}
|
||||
end
|
||||
end
|
||||
|
||||
def search_projects
|
||||
@organization = Organization.find(params[:id])
|
||||
condition = '%%'
|
||||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" +
|
||||
" and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id})"
|
||||
#user_projects = Course.find_by_sql(sql)
|
||||
@projects = Course.find_by_sql(sql)
|
||||
# @added_course_ids = @organization.projects.map(&:id)
|
||||
# @projects = []
|
||||
# user_projects.each do |project|
|
||||
# if !@added_course_ids.include?(project.id)
|
||||
# @projects << project
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def join_projects
|
||||
@organization = Organization.find(params[:id])
|
||||
project_ids = params[:projectNames]
|
||||
project_ids.each do |id|
|
||||
OrgProject.create(:organization_id => @organization.id, :project_id => id.to_i, :created_at => Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,6 +23,8 @@ class Message < ActiveRecord::Base
|
|||
belongs_to :board,:touch => true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
has_many :org_subfield_messages, :dependent => :destroy
|
||||
has_many :org_subfields, :through => :org_subfield_messages
|
||||
|
||||
acts_as_tree :counter_cache => :replies_count, :order => "#{Message.table_name}.created_on ASC"
|
||||
acts_as_attachable
|
||||
|
|
|
@ -1,20 +1,26 @@
|
|||
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'
|
||||
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
|
||||
|
||||
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')
|
||||
else
|
||||
act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", self.root.id).first
|
||||
act.update_attributes(:updated_at => self.updated_at)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
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'
|
||||
has_many :editor_of_documents, :dependent => :destroy
|
||||
acts_as_tree :order => "#{OrgDocumentComment.table_name}.sticky asc, #{OrgDocumentComment.table_name}.created_at desc"
|
||||
acts_as_attachable
|
||||
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')
|
||||
else
|
||||
act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", self.root.id).first
|
||||
act.update_attributes(:updated_at => self.updated_at)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def project
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
class OrgSubfield < ActiveRecord::Base
|
||||
belongs_to :organization, :foreign_key => :organization_id
|
||||
has_many :org_document_comments, :dependent => :destroy
|
||||
has_many :files
|
||||
acts_as_attachable
|
||||
|
||||
def project
|
||||
end
|
||||
class OrgSubfield < ActiveRecord::Base
|
||||
belongs_to :organization, :foreign_key => :organization_id
|
||||
has_many :org_document_comments, :dependent => :destroy
|
||||
has_many :files
|
||||
has_many :org_subfield_messages, :dependent => :destroy
|
||||
has_many :messages, :through => :org_subfield_messages
|
||||
acts_as_attachable
|
||||
|
||||
def project
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class OrgSubfieldMessage < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
end
|
|
@ -1,11 +1,65 @@
|
|||
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:html => {:nhname=>'form', :multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %>
|
||||
|
||||
<%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %>
|
||||
<li>
|
||||
<div class="ml55 fl" nhname="toolbar_container"></div>
|
||||
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
|
||||
|
||||
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false) %>
|
||||
<% end %>
|
||||
|
||||
<%= error_messages_for 'message' %>
|
||||
<div class="resources mt10">
|
||||
<div id="new_course_topic">
|
||||
<div class="homepagePostBrief c_grey">
|
||||
<div>
|
||||
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
|
||||
<p id="subjectmsg"></p>
|
||||
</div>
|
||||
<div id="topic_editor" style="display: none;">
|
||||
<%if User.current.member_of?(project)%>
|
||||
<div class="mt10">
|
||||
<%= f.check_box :sticky, :value => topic.sticky%>
|
||||
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
|
||||
<%= f.check_box :locked, :value => topic.locked%>
|
||||
<%= label_tag 'message_locked', l(:label_board_locked) %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="mt10">
|
||||
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
|
||||
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:owner_id => topic.nil? ? 0: topic.id,
|
||||
:owner_type => OwnerTypeHelper::MESSAGE,
|
||||
:width => '100%',
|
||||
:height => 300,
|
||||
:minHeight=>300,
|
||||
:class => 'talk_text fl',
|
||||
:input_html => { :id => 'message_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 },
|
||||
at_id: topic.id, at_type: topic.class.to_s
|
||||
%>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
<div class="fl" id="topic_attachments">
|
||||
<%= render :partial => 'attachments/form_course', :locals => {:container => topic, :isReply => @isReply} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<%if !edit_mode %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="message_content_editor.sync();$('#message-form').submit();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_topic();">取消</a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="message_content_editor.sync();$('#message-form').submit();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,204 +1,44 @@
|
|||
<div nhname="container_board">
|
||||
<div class="project_r_h" xmlns="http://www.w3.org/1999/html">
|
||||
<h2 class="project_h2 fl">
|
||||
<% if User.current.language == "zh"%>
|
||||
<%= h @board.name %>
|
||||
<% else %>
|
||||
<%= l(:project_module_boards) %>
|
||||
<% end %>
|
||||
</h2>
|
||||
<% if User.current.logged? %>
|
||||
<a href="javascript:void(0)" class="green_btn fr newtalk " id="new_topic_btn" nhname="showbtn"><%= l(:label_message_new) %></a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% if !User.current.logged? %>
|
||||
<div class="c_grey f14">
|
||||
<%= l(:label_user_login_project_board) %>
|
||||
<%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
function reset_topic(){
|
||||
$("#message_subject").val("");
|
||||
$("#subjectmsg").text("");
|
||||
document.getElementById("message_sticky").checked=false;
|
||||
document.getElementById("message_locked").checked=false;
|
||||
$("#topic_attachments").html("<%= escape_javascript(render :partial => 'attachments/form_course', :locals => {:container => Message.new, :isReply => @isReply})%>");
|
||||
message_content_editor.html("");
|
||||
$("#topic_editor").toggle();
|
||||
}
|
||||
<% if @is_new%>
|
||||
$(function(){
|
||||
$("#message_subject").focus();
|
||||
});
|
||||
<%end%>
|
||||
</script>
|
||||
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">
|
||||
项目讨论区
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class=" talklist_box" >
|
||||
<div class="talk_new ml15 mb10" nhname="about_talk" data-at-id="<%= project.id %>" data-at-type="Project" style="display:none;">
|
||||
<ul>
|
||||
<%= render :partial => 'project_new_topic' %>
|
||||
</ul>
|
||||
</div><!--talknew end-->
|
||||
</div>
|
||||
</div>
|
||||
<div class=" talklist_box" >
|
||||
<p class="c_dark mb5 f14">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
|
||||
<% if @topics.any? %>
|
||||
<% @topics.each do |topic| %>
|
||||
<div class="talkmain_box" id="topic<%= topic.id %>" nhname="container_board" mhname="container_board_reply" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
|
||||
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
|
||||
<div class="talkmain_txt fl mt5 f14">
|
||||
<% author = topic.author.to_s %>
|
||||
<div style="max-width:80px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
|
||||
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl f14",:title=>author,
|
||||
:style=>'max-width:80px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
|
||||
</div>
|
||||
<p style="float:left;color:#ff5722;"> :</p>
|
||||
|
||||
<p class="talkmain_tit fl fb break_word f14" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:390px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;"> <%= h(topic.subject) %></p>
|
||||
|
||||
<% if topic.editable_by?(User.current) %>
|
||||
<a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;margin-right: 10px;"><%= l(:button_edit) %></a>
|
||||
<% end %>
|
||||
<%= link_to(l(:button_delete), {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'talk_edit fr',
|
||||
:style => ' margin-right: 10px;') if topic.destroyable_by?(User.current) %>
|
||||
<% if topic.sticky? %>
|
||||
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
|
||||
<% end %>
|
||||
<script>
|
||||
//$(function(){if($("#contentmessage<%#=topic.id %>").height()>182){$("#project_show_<%#= topic.id%>").show();}});
|
||||
//解决由于图片加载慢造成div高度不够 以至于展开按钮不显示的bug
|
||||
$(function(){
|
||||
function nh_show_btn(){
|
||||
if($("#project_show_<%= topic.id%>").is(':hidden')){
|
||||
if($("#contentmessage<%=topic.id %>").height()>182){
|
||||
$("#project_show_<%= topic.id%>").show();
|
||||
}
|
||||
}
|
||||
}
|
||||
var div = $("#contentmessage<%=topic.id %>");
|
||||
var imgs = $('img',div);
|
||||
var lens = imgs.length;
|
||||
function nh_load_img_end(){
|
||||
nh_show_btn();
|
||||
// lens--;
|
||||
// if(lens <= 0){
|
||||
// nh_show_btn();
|
||||
// }
|
||||
}
|
||||
if(lens > 0){
|
||||
$('img',div).load(function(){
|
||||
nh_load_img_end();
|
||||
});
|
||||
}
|
||||
nh_show_btn();
|
||||
// if(lens <= 0){
|
||||
// nh_show_btn();
|
||||
// }else{
|
||||
// $('img',div).load(function(){
|
||||
// nh_load_img_end();
|
||||
// });
|
||||
// }
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="project_board_content break_word f14 list_style" id="content_<%=topic.id%>">
|
||||
<div id="contentmessage<%=topic.id %>" class="upload_img">
|
||||
<%= topic.content.html_safe %>
|
||||
<!-- -->
|
||||
</div>
|
||||
</div>
|
||||
<p style="display: none;" id="project_show_<%= topic.id%>">
|
||||
<a id="expend_more_information<%= topic.id%>" style="color: #0781b4;" href="javascript:void(0)" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</a>
|
||||
<span class="g-arr-down">
|
||||
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
|
||||
</span>
|
||||
</p>
|
||||
<%= link_to_attachments_course topic, :author => false %>
|
||||
<%= l(:label_activity_time)%>: <%= format_time topic.created_on %>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr f14" style="margin-right:10px;"><%= l(:button_reply) %></a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" data-at-id="<%= topic.id %>" data-at-type="<%= topic.class.name %>" style="display: none;border-top: 1px dashed #d9d9d9;padding-top:5px;margin-left:0px;padding-left:15px;">
|
||||
<ul>
|
||||
<%= render :partial => 'edit',locals: {:topic => topic} %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="talkWrapBox">
|
||||
<% reply = Message.new(:subject => "RE: #{topic.subject}")%>
|
||||
<% if !topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply" data-at-id="<%= topic.id %>" data-at-type="<%= topic.class.name %>" style="display: none;">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml15 mb10" style="margin-left:30px;" id="reply<%= topic.id %>">
|
||||
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
|
||||
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
|
||||
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
|
||||
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
|
||||
<div style="padding-top:5px;" class="fr">
|
||||
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10" style=""><%= l(:button_cancel)%></a>
|
||||
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style=""><%= l(:button_submit)%></a>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).reorder("#{Message.table_name}.id desc").all %>
|
||||
<% unless replies_all.empty? %>
|
||||
<div class="talkWrapMsg" nhname="nh_reply_div" id="nh_reply_div_<%= topic.id %>">
|
||||
<ul>
|
||||
<% replies_all_i = 0 %>
|
||||
<% replies_all.each do |message| %>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>">
|
||||
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
|
||||
<div class="Msg_txt">
|
||||
<%= link_to_user_header message.author,false,:class => 'fl c_orange f14 ' %>
|
||||
<br/>
|
||||
<div class="fl break_word f14 list_style">
|
||||
<%= textAreailizable message,:content,:attachments => message.attachments %>
|
||||
<!-- -->
|
||||
</div>
|
||||
<input nhname="nh_content_val" type="hidden" value="<%= message.content %>"/>
|
||||
<br/><div class="cl"></div>
|
||||
<span class=" c_grey fl f14"><%= format_time(message.created_on) %></span>
|
||||
<%= link_to(l(:button_delete),{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete),
|
||||
:class => ' c_dblue fr f14') if message.course_destroyable_by?(User.current) %>
|
||||
<%= link_to(l(:button_reply), 'javascript:;',
|
||||
:nhname =>'showbtn_child_reply',
|
||||
:class => ' c_dblue fr f14',
|
||||
:style => 'margin-right: 10px;',
|
||||
:title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<%if topic.replies_count>2 %>
|
||||
<div class="talkWrapMsg">
|
||||
<a nhname="reply_ex_btn" data-count="<%= topic.replies_count %>" data-init="0" href="javascript:void(0)" class="ml258 c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},
|
||||
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%#= render :partial => 'project_new_topic', :locals => {:f => f, :topic => @message, :edit_mode => false, :course => @board.course} %>
|
||||
<%= render :partial => 'project_new_topic', :locals => {:f => f, :topic => @message, :edit_mode => false, :project => @board.project} %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
|
||||
</ul>
|
||||
<!--讨论主类容 end-->
|
||||
|
||||
<%# other_formats_links do |f| %>
|
||||
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
<%# end %>
|
||||
<% html_title @board.name %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
|
||||
<% end %>
|
||||
<%= render :partial=> 'project_show_detail',:locals =>{:topics => @topics, :page => 0} %>
|
||||
</div>
|
||||
<div style="display:none;"><a href="#" id="nhjump"></a></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false) %>
|
||||
<%= javascript_include_tag "init_activity_KindEditor" %>
|
||||
<% end %>
|
||||
|
||||
<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>
|
||||
<% if topics%>
|
||||
<% topics.each do |topic| %>
|
||||
<script>
|
||||
function expand_reply(container, btnid) {
|
||||
var target = $(container);
|
||||
var btn = $(btnid);
|
||||
if (btn.data('init') == '0') {
|
||||
btn.data('init', 1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
} else {
|
||||
btn.data('init', 0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
|
||||
function expand_reply_input(id) {
|
||||
$(id).toggle();
|
||||
}
|
||||
|
||||
$(function () {
|
||||
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
|
||||
showNormalImage('activity_description_<%= topic.id %>');
|
||||
/*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
|
||||
if (description_images.length>0) {
|
||||
for (var i=0; i<description_images.length; i++){
|
||||
var image=$(description_images[i]);
|
||||
var element=$("<a></a>").attr("href",image.attr('src'));
|
||||
image.wrap(element);
|
||||
}
|
||||
}
|
||||
$('#activity_description_<%#= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});*/
|
||||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
<%= render :partial => 'users/project_message', :locals => {:activity => topic,:user_activity_id =>topic.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if topics.count == 10 %>
|
||||
<div id="show_more_course_topic" class="loadMore mt10 f_grey">展开更多<%= link_to "", boards_topic_path(@board, :project_id => @board.project.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %></div>
|
||||
<% end %>
|
||||
<% end%>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#show_more_course_topic").mouseover(function () {
|
||||
$("#more_topic_link").click();
|
||||
});
|
||||
</script>
|
|
@ -12,7 +12,7 @@
|
|||
<%= favicon %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'public', 'pleft', 'project','prettify','jquery/jquery-ui-1.9.2','header','repository' %>
|
||||
<%= stylesheet_link_tag 'public', 'pleft', 'project','courses','prettify','jquery/jquery-ui-1.9.2','header','repository' %>
|
||||
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %>
|
||||
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.course_destroyable_by?(User.current) %>
|
||||
<%= link_to "转发",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
||||
<%= error_messages_for 'message' %>
|
||||
<% replying ||= false %>
|
||||
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
|
||||
<% extra_option = replying ? { hidden: "hidden"} : { maxlength: 200 } %>
|
||||
|
||||
<li>
|
||||
<label><span class="c_red">*</span> <%= l(:field_subject) %> :</label>
|
||||
<div style="display:<%= replying ? 'none' : 'block'%>;" class="fl"><label><span class="c_red">*</span> <%= l(:field_subject) %> :</label></div>
|
||||
<% if replying %>
|
||||
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %>
|
||||
<div style="display: none;"><%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585 fl" }.merge(extra_option) %></div>
|
||||
<% else %>
|
||||
<%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %>
|
||||
<p id="subject_span" class="ml55"></p>
|
||||
<% end %>
|
||||
<p id="subject_span" class="ml55"></p>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="ml55 mb5">
|
||||
<li class="ml60 mb5">
|
||||
<% unless replying %>
|
||||
<% if @message.safe_attribute? 'sticky' %>
|
||||
<%= f.check_box :sticky %>
|
||||
|
@ -24,20 +31,45 @@
|
|||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
|
||||
<label class="fl ml3" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<div id="message_quote" class="wiki" style="width: 92%;word-break: break-all;word-wrap: break-word;margin-left: 40px;"></div>
|
||||
<!--<label class="fl" >
|
||||
<span class="c_red">*</span>
|
||||
<%#= l(:field_description) %> :
|
||||
</label>-->
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<% if replying %>
|
||||
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:width => '99%',
|
||||
:height => 100,
|
||||
:minHeight=>100,
|
||||
:input_html => { :id => 'message_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 }%>
|
||||
<% else %>
|
||||
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:owner_id => @message.nil? ? 0: @message.id,
|
||||
:owner_type => OwnerTypeHelper::MESSAGE,
|
||||
:width => '90%',
|
||||
:height => 300,
|
||||
:minHeight=>300,
|
||||
:class => 'talk_text fl',
|
||||
:input_html => { :id => 'message_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 }%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span" class="ml55"></p>
|
||||
<p id="message_content_span"></p>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li>
|
||||
<label class="fl"> <%= l(:label_attachment_plural) %> :</label>
|
||||
<div class="fl ml3">
|
||||
<%= render :partial => 'attachments/form_project', :locals => {:container => @message,:isReply => @isReply} %>
|
||||
</div>
|
||||
</li>
|
||||
<% unless replying %>
|
||||
<li>
|
||||
<label class="fl mt10"> <%= l(:label_attachment_plural) %> :</label>
|
||||
<div class="fl mt10">
|
||||
<%= render :partial => 'attachments/form_project', :locals => {:container => @message,:isReply => @isReply} %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<li >
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".resourcePopupClose").click(function(){
|
||||
$(".shareDP").css("display","none");
|
||||
});
|
||||
$(".sectionRow").toggle(
|
||||
function(){
|
||||
$(this).next().css("display","block");
|
||||
},
|
||||
function(){
|
||||
$(this).next().css("display","none");
|
||||
}
|
||||
);
|
||||
});
|
||||
function join_org(){
|
||||
if ($("#org_subfield_list input[type='checkbox']:checked").size() == 0)
|
||||
{
|
||||
alert("您还没有选择栏目!");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#join-form").submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<div class="relateText fl mb10">转发到</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="sectionWrap fl">
|
||||
|
||||
<div class="pl10 fontGrey3 sectionRow">
|
||||
<span class="shareArrow"></span>我的组织
|
||||
</div>
|
||||
<ul class="fontGrey3 sectionContent" id="sectionContent3">
|
||||
<% organizations.each do |org| %>
|
||||
<li><span><%= link_to org.name, messages_get_subfield_on_click_org_path(:organization_id => org.id), :remote => true %></span></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<%= form_tag url_for(:controller => 'messages', :action => 'join_org_subfields', :id => id), :id => 'join-form', :remote => true %>
|
||||
<div id="org_subfield_list">
|
||||
<%= render :partial => 'show_org_subfields', :locals => {:org => nil} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="courseSendCancel mr2" style="float:right;"><a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a></div>
|
||||
<div class="courseSendSubmit" style="float:right;"><a href="javascript:void(0);" onclick="join_org();" class="sendSourceText">确定</a></div>
|
||||
<div class="cl"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,104 +1,3 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= h @board.name %></h2>
|
||||
</div>
|
||||
<div class="problem_main">
|
||||
<div class="ping_dispic">
|
||||
<%=link_to image_tag(url_to_avatar(@topic.author), :width => "46", :height => "46"), user_path(@topic.author) %>
|
||||
</div>
|
||||
<div class="talk_txt fl">
|
||||
<p class="problem_tit fl fb" style="word-break:break-all;" >
|
||||
<%= @topic.subject %></p>
|
||||
<br/>
|
||||
<p>由<%= link_to_user_header @topic.author,false,:class=> 'problem_name c_orange' %> 添加于<%= format_time(@topic.created_on) %></p>
|
||||
</div>
|
||||
<!-- <a class="talk_edit fr">删除</a><a class="talk_edit fr">编辑</a><a class="talk_edit fr">置顶</a> -->
|
||||
<%#= watcher_link(@topic, User.current) %>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:action => 'edit', :id => @topic},
|
||||
:class => 'talk_edit fr'
|
||||
) if @message.editable_by?(User.current) %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => @topic},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'talk_edit fr'
|
||||
) if @message.destroyable_by?(User.current) %>
|
||||
<div class="cl"></div>
|
||||
<div class="talk_info mb10" style="word-break:break-all;"><%= textilizable(@topic, :content) %></div>
|
||||
<div class="talk_info mb10"><%= link_to_attachment_project @topic, :author => false %></div>
|
||||
<!-- <a href="#" class=" link_file ml60">附件:爱覅俄方if.zip(27.5kB)</a>-->
|
||||
<div class="cl"></div>
|
||||
<% if User.current.logged? %>
|
||||
<%= toggle_link l(:button_reply), "reply", :focus => 'message_content',:class => 'talk_edit fr' %>
|
||||
<% else %>
|
||||
<%= link_to l(:button_reply), signin_path,:class => 'talk_edit fr' %>
|
||||
<% end %>
|
||||
<%= link_to(
|
||||
l(:button_quote),
|
||||
{:action => 'quote', :id => @topic},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'talk_edit fr',
|
||||
:remote => true) if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<div class="cl"></div>
|
||||
</div><!--讨论主类容 end-->
|
||||
<% unless @replies.empty? %>
|
||||
<% reply_count = 0 %>
|
||||
<% @replies.each do |message| %>
|
||||
<div class="ping_C mb10" id="<%= "message-#{message.id}" %>">
|
||||
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(message.author), :width => '46',:height => '46'), user_path(message.author) %></div>
|
||||
<div class="ping_discon">
|
||||
<div class="ping_distop upload_img break_word">
|
||||
<%= link_to_user_header message.author,false,:class => 'c_blue fb fl mb10 ' %>
|
||||
<span class="c_grey fr"><%= format_time(message.created_on) %></span>
|
||||
<div class="cl"></div>
|
||||
<p class="break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
|
||||
<%= link_to_attachments_course message, :author => false %>
|
||||
</div>
|
||||
<div class="ping_disfoot">
|
||||
<%= link_to(
|
||||
l(:button_quote),
|
||||
{:action => 'quote', :id => message},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<%= link_to(
|
||||
#image_tag('edit.png'),
|
||||
l(:button_edit),
|
||||
{:action => 'edit', :id => message},
|
||||
:title => l(:button_edit)
|
||||
) if message.course_editable_by?(User.current) %>
|
||||
<%= link_to(
|
||||
#image_tag('delete.png'),
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => message},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if message.course_destroyable_by?(User.current) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---留言内容-->
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<div id="reply" style="display:none;">
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
|
||||
<p class="talk_top"><%= l(:label_message_reply) %></p>
|
||||
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
|
||||
<a href="#" onclick="submit_message_replay();"class="blue_btn fl c_white ml5" style="margin-left: 50px;"><%= l(:button_submit)%></a>
|
||||
<% end %>
|
||||
<div id="preview" class="wiki"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
<% html_title @topic.subject %>
|
||||
|
||||
<script type="text/javascript">
|
||||
// var flag = false;
|
||||
|
@ -107,7 +6,7 @@
|
|||
// });
|
||||
function submit_message_replay()
|
||||
{
|
||||
if(flag)
|
||||
if(regexContent() == false)
|
||||
{
|
||||
$("#message_form").submit();
|
||||
}
|
||||
|
@ -119,13 +18,213 @@
|
|||
{
|
||||
$("#message_content_span").text("<%= l(:label_reply_empty) %>");
|
||||
$("#message_content_span").css('color','#ff0000');
|
||||
flag = false;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#message_content_span").text("<%= l(:label_field_correct) %>");
|
||||
$("#message_content_span").css('color','#008000');
|
||||
flag = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container).children();
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
function project_board_submit_message_replay()
|
||||
{
|
||||
if(MessageReplayVevify())
|
||||
{
|
||||
message_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
|
||||
$("#message_form").submit();
|
||||
}
|
||||
}
|
||||
|
||||
function project_board_canel_message_replay()
|
||||
{
|
||||
$("#reply").hide(200);
|
||||
$("#message_quote").html("");
|
||||
}
|
||||
|
||||
function MessageReplayVevify() {
|
||||
var content = message_content_editor.html();//$.trim($("#message_content").val());
|
||||
if (message_content_editor.isEmpty()) {
|
||||
$("#message_content_span").text("回复不能为空");
|
||||
$("#message_content_span").css('color', '#ff0000');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$("#message_content_span").text("填写正确");
|
||||
$("#message_content_span").css('color', '#008000');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @topic.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="postRightContainer ml10" onmouseover="$('#message_setting_<%= @topic.id%>').show();" onmouseout="$('#message_setting_<%= @topic.id%>').hide();">
|
||||
<div class="postThemeContainer">
|
||||
<div class="postDetailPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
|
||||
</div>
|
||||
<div class="postThemeWrap">
|
||||
<% if @topic.author.id == User.current.id%>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @topic.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:action => 'edit', :id => @topic},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => @topic},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if @message.destroyable_by?(User.current) %>
|
||||
<%= link_to "转发",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="postDetailTitle fl">
|
||||
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @topic.subject%></a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="postDetailCreater">
|
||||
<% if @topic.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to @topic.try(:author), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% else %>
|
||||
<%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @topic.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
<div class="memo-content upload_img break_word" id="message_description_<%= @topic.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<%= @topic.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course @topic, :author => false %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostReply">
|
||||
<% unless @replies.empty? %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=@reply_count %>)</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<!-- <div class="homepagePostReplyBannerMore">
|
||||
<%# if @reply_count > 2%>
|
||||
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
|
||||
<%# end %>
|
||||
</div>-->
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @topic.id %>">
|
||||
<% @replies.each_with_index do |reply,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe%>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:action => 'quote', :id => reply},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:action => 'destroy', :id => reply},
|
||||
:method => :post,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.destroyable_by?(User.current) %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id%>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @topic.id %>">
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
|
||||
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
|
||||
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'project_board_cancel_message_replay();', :class => "blue_btn grey_btn fr c_white mt10 mr5" %>
|
||||
<%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'project_board_submit_message_replay();', :class => "blue_btn fr c_white mt10", :style => "margin-left: 50px;" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,13 @@
|
|||
<ul class="columnWrap fr">
|
||||
<!--<span class="fontBlue pl10">请在左侧选择要转发的位置</span>-->
|
||||
<% if !org.nil? %>
|
||||
<span class="fontBlue pl10">组织:<%= org.name %></span>
|
||||
<% org.org_subfields.where("field_type='Post'").each do |subfield| %>
|
||||
<li>
|
||||
<label><input type="checkbox" name='org_subfields[]' value='<%= subfield.id %>' class="mt3 fl mr5"/><span><%= subfield.name %></span></label>
|
||||
</li>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<span class="fontBlue pl10">请在左侧选择要转发的位置</span>
|
||||
<% end %>
|
||||
</ul>
|
|
@ -0,0 +1,2 @@
|
|||
$("#org_subfield_list").html("");
|
||||
$("#org_subfield_list").html("<%= escape_javascript(render :partial => 'show_org_subfields', :locals => {:org => @org}) %>");
|
|
@ -0,0 +1,11 @@
|
|||
$('#topnav_course_menu').hide();
|
||||
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_org_subfield_menu', :locals => {:organizations => @organizations, :id => @message.id}) %>');
|
||||
showModal('ajax-modal', '430px');
|
||||
$('#ajax-modal').siblings().hide();
|
||||
$('#ajax-modal').before(
|
||||
"<a href='javascript:' onclick='hideModal();' class='resourceClose' style='margin-left: 410px;'></a>");
|
||||
//$('#ajax-modal').css('position','absolute')
|
||||
$('#ajax-modal').css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("resourceSharePopup");
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
hideModal();
|
||||
alert("转发成功!");
|
|
@ -0,0 +1,79 @@
|
|||
<style type="text/css">
|
||||
input.is_public,input.is_public_checkbox{height:12px;}
|
||||
input.is_public_checkbox{margin-left:4px;margin-right:4px;}
|
||||
</style>
|
||||
<div class="fl">
|
||||
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
|
||||
<% if defined?(container) && container && container.saved_attachments %>
|
||||
<% container.attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>" class="attachment">
|
||||
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %><%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %><span class="ispublic-label"><%= l(:field_is_public) %>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %>
|
||||
<%= if attachment.id.nil?
|
||||
#待补充代码
|
||||
else
|
||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
|
||||
end
|
||||
%>
|
||||
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% container.saved_attachments.each_with_index do |attachment, i| %>
|
||||
<span id="attachments_p<%= i %>" class="attachment">
|
||||
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly => 'readonly') %>
|
||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style => "display: inline-block;") %>
|
||||
<span class="ispublic-label"><%= l(:field_is_public) %>:</span>
|
||||
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, attachment.is_public == 1 ? true : false, :class => 'is_public') %>
|
||||
<%= if attachment.id.nil?
|
||||
#待补充代码
|
||||
else
|
||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
|
||||
end
|
||||
%>
|
||||
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||
|
||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<span class="add_attachment" style="font-weight:normal;">
|
||||
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
|
||||
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
|
||||
<%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
|
||||
<a href="javascript:void(0);" onclick="_file.click();" class="AnnexBtn fl mr15">上传附件</a>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => 'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addInputFiles(this);',
|
||||
:style => ie8? ? '' : 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:upload_path => uploads_path(:format => 'js'),
|
||||
:description_placeholder => l(:label_optional_description),
|
||||
:field_is_public => l(:field_is_public),
|
||||
:are_you_sure => l(:text_are_you_sure),
|
||||
:file_count => l(:label_file_count),
|
||||
:lebel_file_uploding => l(:lebel_file_uploding),
|
||||
:delete_all_files => l(:text_are_you_sure_all)
|
||||
} %>
|
||||
<span id="upload_file_count">
|
||||
<%= l(:label_no_file_uploaded) %>
|
||||
</span>
|
||||
(<%= l(:label_max_size) %>:
|
||||
<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</span>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -1,50 +1,55 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
||||
<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 mb5" style="margin-bottom:5px;">
|
||||
<div class="NewsBannerName">编辑文章</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %>
|
||||
<div class="resources">
|
||||
<div>
|
||||
<input 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();" value="<%= @org_document.title %>" />
|
||||
</div>
|
||||
<div id="doc_title_hint"></div>
|
||||
<div class="cl"></div>
|
||||
<div id="org_document_editor" >
|
||||
<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="location=document.referrer;" class="fr mr10 mt3">取消</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
||||
<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 mb5" style="margin-bottom:5px;">
|
||||
<div class="NewsBannerName">编辑文章</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<%= form_tag url_for(:controller => 'org_document_comments',:action => 'update', :id => @org_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id]),:method => 'put', :id => 'new_org_document_form' do |f| %>
|
||||
<div class="resources">
|
||||
<div>
|
||||
<input 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();" value="<%= @org_document.title %>" />
|
||||
</div>
|
||||
<div id="doc_title_hint"></div>
|
||||
<div class="cl"></div>
|
||||
<div id="org_document_editor" >
|
||||
<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="mt10">
|
||||
<div class="fl" id="topic_attachments">
|
||||
<%= render :partial => 'org_document_comments/attachment', :locals => {:container => @org_document} %>
|
||||
</div>
|
||||
</div>
|
||||
<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="location=document.referrer;" class="fr mr10 mt3">取消</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
|
@ -1,56 +1,60 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
||||
<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(){
|
||||
location.href = document.referrer;
|
||||
}
|
||||
</script>
|
||||
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_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();" placeholder="请输入文章标题"></textarea>
|
||||
</div>
|
||||
<div id="doc_title_hint"></div>
|
||||
<div id="org_document_editor" class="mt15" >
|
||||
<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="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>
|
||||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
||||
<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(){
|
||||
location.href = document.referrer;
|
||||
}
|
||||
</script>
|
||||
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_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();" placeholder="请输入文章标题"></textarea>
|
||||
</div>
|
||||
<div id="doc_title_hint"></div>
|
||||
<div id="org_document_editor" class="mt15" >
|
||||
<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="mt10">
|
||||
<div class="fl" id="topic_attachments">
|
||||
<%= render :partial => 'org_document_comments/attachment', :locals => {:container => nil} %>
|
||||
</div>
|
||||
</div>
|
||||
<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 %>
|
|
@ -1,148 +1,151 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= @document.id%>,null,"85%", "<%=@document.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @document.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="resources mt10" id="organization_document_<%= @document.id %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_path(@document.creator_id) %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo">
|
||||
<%= link_to User.find(@document.creator_id), user_path(@document.creator.id), :class => "newsBlue mr15" %>
|
||||
TO <%= link_to @document.organization.name, organization_path(@document.organization), :class => "newsBlue" %>
|
||||
|
|
||||
<% if @document.organization.home_id == @document.id %>
|
||||
<span style="color:#269ac9;">首页</span>
|
||||
<% else %>
|
||||
<span style="color:#269ac9;">组织文章</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostTitle postGrey"><%= link_to @document.title, org_document_comment_path(:id => @document.id, :organization_id => @document.organization.id) %></div>
|
||||
<div class="homepagePostDate">
|
||||
发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %></div>
|
||||
<% unless @document.content.blank? %>
|
||||
<div class="homepagePostIntro" style="width:640px;">
|
||||
<%= @document.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- <%# if defined?(home_id) %>
|
||||
<div style="float:right;">最后编辑:<%#= User.find() %></div>
|
||||
<%# end %>-->
|
||||
<% if User.current.admin? || User.current.admin_of_org?(Organization.find(@document.organization_id) || User.current.id == @document.creator_id) %>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @document.organization_id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %>
|
||||
<a href="javascript:void(0);" class="postOptionLink" onclick="$(this).parent().submit();">设为首页</a>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :detail_page => 1), :method => 'delete',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:remote => true, :class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% comments_for_doc = @document.children.reorder("created_at desc") %>
|
||||
<% count = @document.children.count() %>
|
||||
|
||||
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
|
||||
<% if count > 0 %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%= count %>)</div>
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @document.id %>">
|
||||
<% comments_for_doc.each_with_index do |reply,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% user = User.find(reply.creator_id) %>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id %>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(user), :width => 33,:height => 33), user_path(user) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<%= link_to User.find(reply.creator_id).realname, user_path(reply.creator_id), :class => "newsBlue mr10 f14" %>
|
||||
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe unless reply.content.nil? %>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_at) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'org_document_comments',:action => 'quote',:user_id=>reply.creator_id, :id => reply.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if User.current.logged? %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'org_document_comments',:action => 'delete_reply', :id => reply.id},
|
||||
:method => :delete,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.creator_id == User.current.id %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id %>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% if User.current.logged?%>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @document.id %>">
|
||||
<%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'org_document_comments', :id => @document.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
|
||||
<%= f.kindeditor :org_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor' %>
|
||||
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %>
|
||||
<%= link_to l(:button_reply), "javascript:void(0)", :onclick => "message_content_editor.sync();$('#message_form').submit();", :class => "blue_btn fr c_white mt10 mb10", :style => "margin-right: 5px;" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function expand_reply(container, btnid) {
|
||||
var target = $(container);
|
||||
var btn = $(btnid);
|
||||
if (btn.data('init') == '0') {
|
||||
btn.data('init', 1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
} else {
|
||||
btn.data('init', 0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= @document.id%>,null,"85%", "<%=@document.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @document.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="resources mt10" id="organization_document_<%= @document.id %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_path(@document.creator_id) %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo">
|
||||
<%= link_to User.find(@document.creator_id), user_path(@document.creator.id), :class => "newsBlue mr15" %>
|
||||
TO <%= link_to @document.organization.name, organization_path(@document.organization), :class => "newsBlue" %>
|
||||
|
|
||||
<% if @document.organization.home_id == @document.id %>
|
||||
<span style="color:#269ac9;">首页</span>
|
||||
<% else %>
|
||||
<span style="color:#269ac9;">组织文章</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostTitle postGrey"><%= link_to @document.title, org_document_comment_path(:id => @document.id, :organization_id => @document.organization.id) %></div>
|
||||
<div class="homepagePostDate">
|
||||
发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %></div>
|
||||
<% unless @document.content.blank? %>
|
||||
<div class="homepagePostIntro" style="width:640px;">
|
||||
<%= @document.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<%= link_to_attachments_course @document, :author => false %>
|
||||
</div>
|
||||
<!-- <%# if defined?(home_id) %>
|
||||
<div style="float:right;">最后编辑:<%#= User.find() %></div>
|
||||
<%# end %>-->
|
||||
<% if User.current.admin? || User.current.admin_of_org?(Organization.find(@document.organization_id) || User.current.id == @document.creator_id) %>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @document.organization_id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %>
|
||||
<a href="javascript:void(0);" class="postOptionLink" onclick="$(this).parent().submit();">设为首页</a>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :detail_page => 1), :method => 'delete',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:remote => true, :class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% comments_for_doc = @document.children.reorder("created_at desc") %>
|
||||
<% count = @document.children.count() %>
|
||||
|
||||
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
|
||||
<% if count > 0 %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%= count %>)</div>
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @document.id %>">
|
||||
<% comments_for_doc.each_with_index do |reply,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% user = User.find(reply.creator_id) %>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id %>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(user), :width => 33,:height => 33), user_path(user) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<%= link_to User.find(reply.creator_id).realname, user_path(reply.creator_id), :class => "newsBlue mr10 f14" %>
|
||||
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe unless reply.content.nil? %>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_at) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'org_document_comments',:action => 'quote',:user_id=>reply.creator_id, :id => reply.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if User.current.logged? %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'org_document_comments',:action => 'delete_reply', :id => reply.id},
|
||||
:method => :delete,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.creator_id == User.current.id %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id %>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% if User.current.logged?%>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @document.id %>">
|
||||
<%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'org_document_comments', :id => @document.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
|
||||
<%= f.kindeditor :org_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor' %>
|
||||
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %>
|
||||
<%= link_to l(:button_reply), "javascript:void(0)", :onclick => "message_content_editor.sync();$('#message_form').submit();", :class => "blue_btn fr c_white mt10 mb10", :style => "margin-right: 5px;" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function expand_reply(container, btnid) {
|
||||
var target = $(container);
|
||||
var btn = $(btnid);
|
||||
if (btn.data('init') == '0') {
|
||||
btn.data('init', 1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
} else {
|
||||
btn.data('init', 0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,70 +1,80 @@
|
|||
<% unless org_activities.nil? %>
|
||||
<% org_activities.each do |act| %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= act.id%>, null, "87%", "<%=act.class.to_s%>");
|
||||
});
|
||||
</script>
|
||||
<% if act.container_type == 'Organization' %>
|
||||
<% 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' && act.org_act_id != @organization.home_id %>
|
||||
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act, :flag => 2, :org_subfield_id => params[:org_subfield_id]} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'Project' %>
|
||||
<% case act.org_act_type.to_s %>
|
||||
<% when 'Issue' %>
|
||||
<%= render :partial => 'organizations/org_project_issue', :locals => {:activity => Issue.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'organizations/project_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% when 'ProjectCreateInfo'%>
|
||||
<%= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'Course' %>
|
||||
<% case act.org_act_type.to_s %>
|
||||
<% when 'HomeworkCommon' %>
|
||||
<%= render :partial => 'org_course_homework', :locals => {:activity => HomeworkCommon.find(act.org_act_id),:user_activity_id =>act.id,:course_activity => 0} %>
|
||||
<% when 'News' %>
|
||||
<%= render :partial => 'org_course_news', :locals => {:activity => News.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% when 'Message'%>
|
||||
<%= render :partial => 'org_course_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% when 'Poll' %>
|
||||
<%= render :partial => 'org_course_poll', :locals => {:activity => Poll.find(act.org_act_id), :user_activity_id => act.id} %>
|
||||
<% when 'Course'%>
|
||||
<%= render :partial => 'org_course_create', :locals => {:activity => Course.find(act.org_act_id), :user_activity_id => act.id} %>
|
||||
<% end %>
|
||||
<% 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 %>
|
||||
|
||||
<% if org_act_count == 10 %>
|
||||
<div id="show_more_activities" class="loadMore mt10 f_grey">展开更多<%=link_to "", organization_path(org,:page => page.to_i + 1, :show_homepage =>params[:show_homepage],:type => params[:type]),:id => "more_org_activities_link",:remote => "true",:class => "none" %></div>
|
||||
<%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
|
||||
<% end%>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
$("#show_more_activities").mouseover(function(){
|
||||
$("#more_org_activities_link").click();
|
||||
})
|
||||
})
|
||||
|
||||
<% unless org_activities.nil? %>
|
||||
<% org_activities.each do |act| %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= act.id%>, null, "87%", "<%=act.class.to_s%>");
|
||||
});
|
||||
</script>
|
||||
<% if act.container_type == 'Organization' %>
|
||||
<% 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' && act.org_act_id != @organization.home_id %>
|
||||
<%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act, :flag => 2, :org_subfield_id => params[:org_subfield_id]} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'Project' %>
|
||||
<% case act.org_act_type.to_s %>
|
||||
<% when 'Issue' %>
|
||||
<%= render :partial => 'organizations/org_project_issue', :locals => {:activity => Issue.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'organizations/project_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% when 'ProjectCreateInfo'%>
|
||||
<%= render :partial => 'organizations/project_create', :locals => {:activity => act,:user_activity_id =>act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'Course' %>
|
||||
<% case act.org_act_type.to_s %>
|
||||
<% when 'HomeworkCommon' %>
|
||||
<%= render :partial => 'org_course_homework', :locals => {:activity => HomeworkCommon.find(act.org_act_id),:user_activity_id =>act.id,:course_activity => 0} %>
|
||||
<% when 'News' %>
|
||||
<%= render :partial => 'org_course_news', :locals => {:activity => News.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% when 'Message'%>
|
||||
<%= render :partial => 'org_course_message', :locals => {:activity => Message.find(act.org_act_id),:user_activity_id =>act.id} %>
|
||||
<% when 'Poll' %>
|
||||
<%= render :partial => 'org_course_poll', :locals => {:activity => Poll.find(act.org_act_id), :user_activity_id => act.id} %>
|
||||
<% when 'Course'%>
|
||||
<%= render :partial => 'org_course_create', :locals => {:activity => Course.find(act.org_act_id), :user_activity_id => act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% if act.container_type == 'OrgSubfield' %>
|
||||
<% if act.org_act_type == 'Message' %>
|
||||
<% message = Message.find(act.org_act_id) %>
|
||||
<% if !message.board.course_id.nil? %>
|
||||
<%= render :partial => 'org_course_message', :locals => {:activity => message,:user_activity_id =>act.id} %>
|
||||
<% else %>
|
||||
<%= render :partial => 'organizations/project_message', :locals => {:activity => message,:user_activity_id =>act.id} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% 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 %>
|
||||
|
||||
<% if org_act_count == 10 %>
|
||||
<div id="show_more_activities" class="loadMore mt10 f_grey">展开更多<%=link_to "", organization_path(org,:page => page.to_i + 1, :show_homepage =>params[:show_homepage],:type => params[:type]),:id => "more_org_activities_link",:remote => "true",:class => "none" %></div>
|
||||
<%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
|
||||
<% end%>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
$("#show_more_activities").mouseover(function(){
|
||||
$("#more_org_activities_link").click();
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
|
@ -1,42 +1,43 @@
|
|||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>
|
||||
<% if User.current.logged? %>
|
||||
<%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuProjects" style="display:<%= organization.projects.count == 0?'none':'' %>">
|
||||
<ul >
|
||||
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
|
||||
<% if User.current.logged? %>
|
||||
<%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses" style="display:<%= organization.courses.count == 0 ?'none':'' %>">
|
||||
<ul >
|
||||
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
|
||||
</ul>
|
||||
</div>
|
||||
<% organization.org_subfields.each do |field| %>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<% if field.field_type == "Post" %>
|
||||
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
|
||||
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
|
||||
<% else %>
|
||||
<%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %>
|
||||
<% if User.current.member_of_org?organization %>
|
||||
<%= link_to "", subfield_upload_file_org_subfield_files_path(field.id, :in_org => 1),:method => "post", :remote => true, :class => "homepageMenuSetting fr", :title => "上传资源" %>
|
||||
<!--<a class="homepageMenuSetting fr" title="上传资源" href="javascript:void(0);" onclick="org_subfield_files_upload(<%#= field.id %>);"> </a>-->
|
||||
<% end %>
|
||||
<!--<a href="javascript:void(0);" class="homepageMenuText"><%#= field.name %></a>-->
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuField_<%= field.id %>" style="display:none;">
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>
|
||||
<% if User.current.logged? %>
|
||||
<%=link_to "", join_project_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联项目"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuProjects" style="display:<%= organization.projects.count == 0?'none':'' %>">
|
||||
<ul >
|
||||
|
||||
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>organization.projects.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
|
||||
<% if User.current.logged? %>
|
||||
<%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联课程"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses" style="display:<%= organization.courses.count == 0 ?'none':'' %>">
|
||||
<ul >
|
||||
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%>
|
||||
</ul>
|
||||
</div>
|
||||
<% organization.org_subfields.each do |field| %>
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<% if field.field_type == "Post" %>
|
||||
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText" %>
|
||||
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子"%>
|
||||
<% else %>
|
||||
<%= link_to "#{field.name}", org_subfield_files_path(field), :class => "homepageMenuText" %>
|
||||
<% if User.current.member_of_org?organization %>
|
||||
<%= link_to "", subfield_upload_file_org_subfield_files_path(field.id, :in_org => 1),:method => "post", :remote => true, :class => "homepageMenuSetting fr", :title => "上传资源" %>
|
||||
<!--<a class="homepageMenuSetting fr" title="上传资源" href="javascript:void(0);" onclick="org_subfield_files_upload(<%#= field.id %>);"> </a>-->
|
||||
<% end %>
|
||||
<!--<a href="javascript:void(0);" class="homepageMenuText"><%#= field.name %></a>-->
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses" id="homepageLeftMenuField_<%= field.id %>" style="display:none;">
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,119 +1,119 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %>
|
||||
TO
|
||||
<%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%>
|
||||
<!--<a href="javascript:void(0);" class="newsBlue ml15 mr5"><%= activity.project.name %>(项目讨论区)</a>-->
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word">
|
||||
<% if activity.parent_id.nil? %>
|
||||
<%= link_to activity.subject.to_s.html_safe, project_boards_path(activity.project,:parent_id =>activity.id, :topic_id => activity.id), :class=> "postGrey"
|
||||
%>
|
||||
<% else %>
|
||||
<%= link_to activity.parent.subject.to_s.html_safe, project_boards_path(activity.project,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey"
|
||||
%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostDate">
|
||||
时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostIntro break_word upload_img list_style maxh360 lh18 table_maxWidth" id="activity_description_<%= user_activity_id%>">
|
||||
<div id="intro_content_<%= user_activity_id%>">
|
||||
<% if activity.parent_id.nil? %>
|
||||
<%= activity.content.to_s.html_safe%>
|
||||
<% else %>
|
||||
<%= activity.parent.content.to_s.html_safe%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count = 0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
|
||||
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
|
||||
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
|
||||
<%=count %>
|
||||
)</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% activity= activity.parent_id.nil? ? activity : activity.parent %>
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.children.reorder("created_on desc").each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
|
||||
<%= reply.content.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo break_word mt-4">
|
||||
<% if activity.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% else %>
|
||||
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
|
||||
<% end %>
|
||||
TO
|
||||
<%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%>
|
||||
<!--<a href="javascript:void(0);" class="newsBlue ml15 mr5"><%= activity.project.name %>(项目讨论区)</a>-->
|
||||
</div>
|
||||
<div class="homepagePostTitle break_word">
|
||||
<% if activity.parent_id.nil? %>
|
||||
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
|
||||
%>
|
||||
<% else %>
|
||||
<%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
|
||||
%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostDate">
|
||||
时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostIntro break_word upload_img list_style maxh360 lh18 table_maxWidth" id="activity_description_<%= user_activity_id%>">
|
||||
<div id="intro_content_<%= user_activity_id%>">
|
||||
<% if activity.parent_id.nil? %>
|
||||
<%= activity.content.to_s.html_safe%>
|
||||
<% else %>
|
||||
<%= activity.parent.content.to_s.html_safe%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% count = 0 %>
|
||||
<% if activity.parent %>
|
||||
<% count=activity.parent.children.count%>
|
||||
<% else %>
|
||||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
|
||||
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
|
||||
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
|
||||
<%=count %>
|
||||
)</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
|
||||
<%if count>3 %>
|
||||
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% activity= activity.parent_id.nil? ? activity : activity.parent %>
|
||||
<% replies_all_i = 0 %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= user_activity_id %>">
|
||||
<ul>
|
||||
<% activity.children.reorder("created_on desc").each do |reply| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_content_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<div class="homepagePostReplyPublisher mt-4">
|
||||
<% if reply.try(:author).try(:realname) == ' ' %>
|
||||
<%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% else %>
|
||||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= reply.id %>">
|
||||
<%= reply.content.html_safe %></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -406,6 +406,7 @@ RedmineApp::Application.routes.draw do
|
|||
|
||||
# boards
|
||||
match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message'
|
||||
match 'boards/:id/join_to_org_subfields', :to => 'boards#join_to_org_subfields'
|
||||
get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message'
|
||||
match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post]
|
||||
get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
|
||||
|
@ -414,6 +415,9 @@ RedmineApp::Application.routes.draw do
|
|||
post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply'
|
||||
post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
|
||||
post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
|
||||
match 'messages/join_org_subfield', :to => 'messages#join_org_subfield'
|
||||
match 'messages/get_subfield_on_click_org', :to => 'messages#get_subfield_on_click_org'
|
||||
match 'messages/join_org_subfields', :to => 'messages#join_org_subfields'
|
||||
# boards end
|
||||
|
||||
# Misc issue routes. TODO: move into resources
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class CreateOrgSubfieldMessages < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :org_subfield_messages do |t|
|
||||
t.integer :org_subfield_id
|
||||
t.integer :message_id
|
||||
t.string :message_type
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
3906
db/schema.rb
3906
db/schema.rb
File diff suppressed because it is too large
Load Diff
|
@ -69,7 +69,7 @@ a.linkGrey8:hover {color:#585858;}
|
|||
.orgMenuArrow2 {background:url(../images/nav_icon.png) -10px -132px no-repeat; position:relative; display:inline-block; width:20px; height:30px;}
|
||||
.org_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-53px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 30px;}
|
||||
#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;}
|
||||
.org_login_list a {color:#269ac9;}
|
||||
.org_login_list a {color:#269ac9;}
|
||||
|
||||
.orgListStatus {width:55px; float:left;}
|
||||
.reCon{ margin:5px; width:710px;}
|
||||
|
@ -86,4 +86,17 @@ a.linkGrey8:hover {color:#585858;}
|
|||
.re_con_top span{ color:#999999; font-weight:bold;}
|
||||
ul.wlist{ float:right; border-bottom:none; height:30px; margin-top:20px; }
|
||||
|
||||
.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
|
||||
.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
|
||||
|
||||
/*转发样式*/
|
||||
.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;}
|
||||
.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;}
|
||||
.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:220px; background-color:#f1f1f1; min-height:150px; padding-top:5px;}
|
||||
.columnWrap {float:left; max-height:148px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; background-color:#fffff; min-height:148px; padding-top:5px; border:1px solid #f1f1f1;}
|
||||
.columnWrap li {padding-left:10px; color:#585858;}
|
||||
.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block;}
|
||||
.sectionRow:hover {background-color:#cccccc; cursor:pointer;}
|
||||
.sectionContent {display:none;}
|
||||
.sectionContent li {padding-left:30px;}
|
||||
.sectionContent li:hover {background-color:#cccccc; cursor:pointer;}
|
||||
.sectionContent span {width:175px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:18px; vertical-align:middle;}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,6 @@
|
|||
FactoryGirl.define do
|
||||
factory :org_subfield_board, :class => 'OrgSubfieldBoards' do
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
FactoryGirl.define do
|
||||
factory :org_subfield_message, :class => 'OrgSubfieldMessage' do
|
||||
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe OrgSubfieldBoards, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe OrgSubfieldMessage, :type => :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue