二级目录帖子列表中添加编辑功能
This commit is contained in:
parent
df1c70880a
commit
a5be092c16
|
@ -65,25 +65,30 @@ class SubDocumentCommentsController < ApplicationController
|
|||
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])
|
||||
Attachment.attach_files(@org_document, params[:attachments])
|
||||
@sub_document = SubDocumentComment.find(params[:id])
|
||||
@sub_document.update_attributes(:title => params[:sub_document_comment][:title], :content => params[:sub_document_comment][:content])
|
||||
@organization = OrgSubfield.find(params[:org_subfield_id]).organization
|
||||
# Attachment.attach_files(@org_document, params[:attachments])
|
||||
# @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)
|
||||
if @sub_document.parent.nil?
|
||||
act = OrgActivity.where("org_act_type='SubDocumentComment' and org_act_id =?", @sub_document.id).first
|
||||
act.update_attributes(:updated_at => @sub_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)
|
||||
|
||||
# render :action => 'index', :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'
|
||||
redirect_to org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => params[:org_subfield_id], :sub_domain_id => params[:sub_domain_id])
|
||||
# render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'
|
||||
# redirect_to organization_path(@organization)
|
||||
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
|
||||
# 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
|
||||
|
@ -92,6 +97,7 @@ class SubDocumentCommentsController < ApplicationController
|
|||
def edit
|
||||
@sub_document = SubDocumentComment.find(params[:id])
|
||||
@flag = params[:flag]
|
||||
render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'
|
||||
end
|
||||
|
||||
def add_reply
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class SubDomain < ActiveRecord::Base
|
||||
attr_accessible :field_type, :hide, :name, :org_subfield_id, :priority, :status
|
||||
belongs_to :org_subfield, :foreign_key => :org_subfield_id
|
||||
has_many :sub_document_comments
|
||||
has_many :sub_document_comments, :dependent => :destroy
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<!--<%# end %>-->
|
||||
<!--</li>-->
|
||||
<li>
|
||||
<%= link_to "编辑文章", edit_org_subfield_sub_domain_sub_document_comment_path(document, :org_subfield_id=> params[:org_subfield_id], :sub_domain_id => document.sub_domain.id, :flag => flag), :method => 'update', :class => "postOptionLink" %>
|
||||
<%= link_to "编辑文章", edit_org_subfield_sub_domain_sub_document_comment_path(document, :org_subfield_id=> params[:org_subfield_id], :sub_domain_id => document.sub_domain.id, :flag => flag), :class => "postOptionLink" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "删除文章", org_subfield_sub_domain_sub_document_comment_path(document, :org_subfield_id=> params[:org_subfield_id], :sub_domain_id => document.sub_domain.id, :flag => flag), :method => 'delete',
|
||||
|
|
|
@ -27,15 +27,15 @@
|
|||
<div class="cl"></div>
|
||||
<div>
|
||||
<div class="resources" nhname="new_topic_form">
|
||||
<%= 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| %>
|
||||
<%= form_tag url_for(:controller => 'sub_document_comments',:action => 'update', :id => @sub_document.id, :flag => @flag, :org_subfield_id => params[:org_subfield_id], :sub_domain_id => params[:sub_domain_id]), :method => 'put', :id => 'new_org_document_form' do |f| %>
|
||||
<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 %>" />
|
||||
<input class="postDetailInput fl mr15" style="margin-bottom:15px;" name="sub_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" onblur="check_org_title();" value="<%= @sub_document.title %>" />
|
||||
</div>
|
||||
<div id="doc_title_hint"></div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<div class="mt10">
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='description_textarea' name="org_document_comment[content]"><%=@org_document.content.html_safe %></textarea>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='description_textarea' name="sub_document_comment[content]"><%=@sub_document.content.html_safe %></textarea>
|
||||
<%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -45,11 +45,11 @@
|
|||
<p id="e_tips" class="c_grey"></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="mt10">-->
|
||||
<!--<div class="fl" id="topic_attachments">-->
|
||||
<!--<%#= render :partial => 'org_document_comments/attachment', :locals => {:container => @sub_document} %>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_topic_submit_btn">确定</a>
|
||||
|
|
|
@ -123,14 +123,14 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
|
||||
resources :sub_domains, :only => [:index, :new, :create, :show, :update, :destroy] do
|
||||
resources :sub_document_comments, :only => [:index, :new, :create, :show, :update, :destroy] do
|
||||
resources :sub_document_comments, :only => [:index, :new, :create, :show, :update, :destroy, :edit] do
|
||||
member do
|
||||
post 'add_reply'
|
||||
get 'quote'
|
||||
post 'reply'
|
||||
post 'add_reply_in_doc'
|
||||
delete 'delete_reply'
|
||||
get 'edit'
|
||||
match 'edit'
|
||||
end
|
||||
collection do
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue