From 399f7578115eb4a0fd714ae4a615350cf2a46bd8 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 4 May 2016 09:01:51 +0800 Subject: [PATCH] 0 --- .../sub_document_comments_controller.rb | 416 +++++++++--------- app/controllers/sub_domains_controller.rb | 96 ++-- .../org_document_comments/index.html.erb | 28 +- .../organizations/_org_subdomain.html.erb | 20 +- .../_show_newstyle.html.erb | 96 ++-- .../_show_sub_document.html.erb | 314 ++++++------- .../sub_document_comments/add_reply.js.erb | 4 +- .../sub_document_comments/index.html.erb | 40 +- app/views/sub_document_comments/show.html.erb | 350 +++++++-------- app/views/sub_domains/_new.html.erb | 4 +- app/views/sub_domains/new.html.erb | 10 +- 11 files changed, 689 insertions(+), 689 deletions(-) diff --git a/app/controllers/sub_document_comments_controller.rb b/app/controllers/sub_document_comments_controller.rb index ce1a54313..df5e64c5a 100644 --- a/app/controllers/sub_document_comments_controller.rb +++ b/app/controllers/sub_document_comments_controller.rb @@ -1,208 +1,208 @@ -class SubDocumentCommentsController < ApplicationController - before_filter :find_subdomain_and_subfield, :only => [:new, :create, :show, :index] - before_filter :find_subfield_content, :only => [:show, :index] - helper :attachments,:organizations - layout 'base_sub_domain' - - def new - @sub_document_comment = SubDocumentComment.new - end - - - def create - @sub_document_comment = SubDocumentComment.new(:sub_domain_id => params[:sub_domain_id], :creator_id => User.current.id, :org_subfield_id => params[:org_subfield_id]) - @sub_document_comment.title = params[:sub_document_comment][:title] - @sub_document_comment.content = params[:sub_document_comment][:content] - # @sub_document_comment.save_attachments(params[:attachments]) - if params[:field_id] - @sub_document_comment.org_subfield_id = params[:field_id].to_i - end - if @sub_document_comment.save - flash.keep[:notice] = l(:notice_successful_create) - redirect_to org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id) - # EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @sub_document_comment.id, :created_at => @sub_document_comment.updated_at) - # if params[:field_id] - # @org_subfield = OrgSubfield.find(params[:field_id]) - # if @org_subfield.subfield_subdomain_dir.nil? - # redirect_to organization_path(@organization, :org_subfield_id => params[:field_id]) - # else - # redirect_to show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => @org_subfield.subfield_subdomain_dir.name) - # end - # 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 - if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) - @document = SubDocumentComment.find(params[:id]) - respond_to do |format| - format.html {render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'} - end - else - render_403 - end - end - - def index - if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) - @documents = @subdomain.sub_document_comments.where("parent_id is null").order("created_at desc") - @is_remote = true - @limit = 2 - @atta_count = @documents.count - @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 - @offset ||= @atta_pages.offset - @documents = paginateHelper @documents,2 - respond_to do |format| - format.html {render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'} - end - 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]) - 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) - 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 = SubDocumentComment.find(params[:id]) - @flag = params[:flag] - @organization = Organization.find(params[:organization_id]) - end - - def add_reply - @document = SubDocumentComment.find(params[:id]).root - @subdomain = @document.sub_domain - @org_subfield = @subdomain.org_subfield - @organization = @org_subfield.organization - @act = OrgActivity.find(params[:id]) - @comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain, :creator_id => User.current.id, :reply_id => params[:id]) - @comment.content = params[:sub_content] - @document.children << @comment - @document.save - end - - def add_reply_in_doc - @document = SubDocumentComment.find(params[:id]).root - @subdomain = @document.sub_domain - @org_subfield = @subdomain.org_subfield - @organization = @org_subfield.organization - @comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain_id, :creator_id => User.current.id, :reply_id => params[:id]) - @comment.content = params[:org_comment][:sub_content] - @document.children << @comment - @document.save - respond_to do |format| - format.html {redirect_to org_subfield_sub_domain_sub_document_comment_path(:id => @document.id, :org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id)} - end - end - - def destroy - @sub_document_comment = OrgDocumentComment.find(params[:id]) - org = @sub_document_comment.organization - if @sub_document_comment.id == org.home_id - org.update_attributes(:home_id => nil) - end - if @sub_document_comment.destroy - end - respond_to do |format| - format.js - end - end - - def delete_reply - @sub_document_comment = OrgDocumentComment.find(params[:id]) - @document = @sub_document_comment.root - org = @sub_document_comment.organization - @sub_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 = "
#{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)}
#{@org_comment.content.html_safe}
".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 - - private - def find_subdomain_and_subfield - @subdomain = SubDomain.find(params[:sub_domain_id]) - @org_subfield = OrgSubfield.find(params[:org_subfield_id]) - @organization = @org_subfield.organization - rescue ActiveRecord::RecordNotFound - # source_subdomain_subfield not found - render_404 - end - - def find_subfield_content - @subfield_content = @organization.org_subfields.order("priority") - end -end +class SubDocumentCommentsController < ApplicationController + before_filter :find_subdomain_and_subfield, :only => [:new, :create, :show, :index] + before_filter :find_subfield_content, :only => [:show, :index] + helper :attachments,:organizations + layout 'base_sub_domain' + + def new + @sub_document_comment = SubDocumentComment.new + end + + + def create + @sub_document_comment = SubDocumentComment.new(:sub_domain_id => params[:sub_domain_id], :creator_id => User.current.id, :org_subfield_id => params[:org_subfield_id]) + @sub_document_comment.title = params[:sub_document_comment][:title] + @sub_document_comment.content = params[:sub_document_comment][:content] + # @sub_document_comment.save_attachments(params[:attachments]) + if params[:field_id] + @sub_document_comment.org_subfield_id = params[:field_id].to_i + end + if @sub_document_comment.save + flash.keep[:notice] = l(:notice_successful_create) + redirect_to org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id) + # EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @sub_document_comment.id, :created_at => @sub_document_comment.updated_at) + # if params[:field_id] + # @org_subfield = OrgSubfield.find(params[:field_id]) + # if @org_subfield.subfield_subdomain_dir.nil? + # redirect_to organization_path(@organization, :org_subfield_id => params[:field_id]) + # else + # redirect_to show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => @org_subfield.subfield_subdomain_dir.name) + # end + # 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 + if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) + @document = SubDocumentComment.find(params[:id]) + respond_to do |format| + format.html {render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'} + end + else + render_403 + end + end + + def index + if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) + @documents = @subdomain.sub_document_comments.where("parent_id is null").order("created_at desc") + @is_remote = true + @limit = 2 + @atta_count = @documents.count + @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1 + @offset ||= @atta_pages.offset + @documents = paginateHelper @documents,2 + respond_to do |format| + format.html {render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'} + end + 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]) + 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) + 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 = SubDocumentComment.find(params[:id]) + @flag = params[:flag] + @organization = Organization.find(params[:organization_id]) + end + + def add_reply + @document = SubDocumentComment.find(params[:id]).root + @subdomain = @document.sub_domain + @org_subfield = @subdomain.org_subfield + @organization = @org_subfield.organization + @act = OrgActivity.find(params[:id]) + @comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain, :creator_id => User.current.id, :reply_id => params[:id]) + @comment.content = params[:sub_content] + @document.children << @comment + @document.save + end + + def add_reply_in_doc + @document = SubDocumentComment.find(params[:id]).root + @subdomain = @document.sub_domain + @org_subfield = @subdomain.org_subfield + @organization = @org_subfield.organization + @comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain_id, :creator_id => User.current.id, :reply_id => params[:id]) + @comment.content = params[:org_comment][:sub_content] + @document.children << @comment + @document.save + respond_to do |format| + format.html {redirect_to org_subfield_sub_domain_sub_document_comment_path(:id => @document.id, :org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id)} + end + end + + def destroy + @sub_document_comment = OrgDocumentComment.find(params[:id]) + org = @sub_document_comment.organization + if @sub_document_comment.id == org.home_id + org.update_attributes(:home_id => nil) + end + if @sub_document_comment.destroy + end + respond_to do |format| + format.js + end + end + + def delete_reply + @sub_document_comment = OrgDocumentComment.find(params[:id]) + @document = @sub_document_comment.root + org = @sub_document_comment.organization + @sub_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 = "
#{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)}
#{@org_comment.content.html_safe}
".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 + + private + def find_subdomain_and_subfield + @subdomain = SubDomain.find(params[:sub_domain_id]) + @org_subfield = OrgSubfield.find(params[:org_subfield_id]) + @organization = @org_subfield.organization + rescue ActiveRecord::RecordNotFound + # source_subdomain_subfield not found + render_404 + end + + def find_subfield_content + @subfield_content = @organization.org_subfields.order("priority") + end +end diff --git a/app/controllers/sub_domains_controller.rb b/app/controllers/sub_domains_controller.rb index 7dd0e526e..318631ccd 100644 --- a/app/controllers/sub_domains_controller.rb +++ b/app/controllers/sub_domains_controller.rb @@ -1,48 +1,48 @@ -class SubDomainsController < ApplicationController - layout 'base_org' - before_filter :find_org_subfield_and_subdomain, :only => [:show, :index, :new] - - def new - @subdomain = SubDomain.new - - end - - def create - if SubDomain.where("org_subfield_id=#{params[:org_subfield_id]} and name=?",params[:name]).count == 0 - @res = true - # @organization = Organization.find(params[:organization_id]) - @subfield = OrgSubfield.find(params[:org_subfield_id]) - # @subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id],:priority => @organization.org_subfields.order("priority").last.priority + 1) - @subdomain = SubDomain.create(:name => params[:name], :org_subfield_id => params[:org_subfield_id],:priority => @subfield.sub_domains.blank? ? 1.1 : @subfield.sub_domains.order("priority").last.priority + 0.1) - # if !params[:sub_dir].blank? - # sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+ - # "and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'" - # if SubfieldSubdomainDir.find_by_sql(sql).count == 0 - # SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir].downcase) - # end - # end - @subdomain.update_column(:field_type, params[:field_type]) - else - @res = false - end - end - - def show - @subfield_content = @organization.org_subfields.order("priority") - render layout: @organization.switch_type ? 'base_sub_domain' : 'base_org' - end - - def index - - end - - private - def find_org_subfield_and_subdomain - @subfield = OrgSubfield.find(params[:org_subfield_id]) - @subdomain = SubDomain.find(params[:id]) - @organization = @subfield.organization - rescue ActiveRecord::RecordNotFound - # source_subdomain not found - render_404 - end -end +class SubDomainsController < ApplicationController + layout 'base_org' + before_filter :find_org_subfield_and_subdomain, :only => [:show, :index, :new] + + def new + @subdomain = SubDomain.new + + end + + def create + if SubDomain.where("org_subfield_id=#{params[:org_subfield_id]} and name=?",params[:name]).count == 0 + @res = true + # @organization = Organization.find(params[:organization_id]) + @subfield = OrgSubfield.find(params[:org_subfield_id]) + # @subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id],:priority => @organization.org_subfields.order("priority").last.priority + 1) + @subdomain = SubDomain.create(:name => params[:name], :org_subfield_id => params[:org_subfield_id],:priority => @subfield.sub_domains.blank? ? 1.1 : @subfield.sub_domains.order("priority").last.priority + 0.1) + # if !params[:sub_dir].blank? + # sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+ + # "and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'" + # if SubfieldSubdomainDir.find_by_sql(sql).count == 0 + # SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir].downcase) + # end + # end + @subdomain.update_column(:field_type, params[:field_type]) + else + @res = false + end + end + + def show + @subfield_content = @organization.org_subfields.order("priority") + render layout: @organization.switch_type ? 'base_sub_domain' : 'base_org' + end + + def index + + end + + private + def find_org_subfield_and_subdomain + @subfield = OrgSubfield.find(params[:org_subfield_id]) + @subdomain = SubDomain.find(params[:id]) + @organization = @subfield.organization + rescue ActiveRecord::RecordNotFound + # source_subdomain not found + render_404 + end +end diff --git a/app/views/org_document_comments/index.html.erb b/app/views/org_document_comments/index.html.erb index 0b8264d33..0d254b293 100644 --- a/app/views/org_document_comments/index.html.erb +++ b/app/views/org_document_comments/index.html.erb @@ -1,15 +1,15 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> -<% end %> - -<%= render :partial => 'new' %> -<% unless @documents.nil? %> - <% @documents.each do |document| %> - - <%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> - <% end %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> + +<%= render :partial => 'new' %> +<% unless @documents.nil? %> + <% @documents.each do |document| %> + + <%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_subdomain.html.erb b/app/views/organizations/_org_subdomain.html.erb index 4ed7c8d29..0ba460d61 100644 --- a/app/views/organizations/_org_subdomain.html.erb +++ b/app/views/organizations/_org_subdomain.html.erb @@ -1,11 +1,11 @@ -<% subdomains.each do |subdomain|%> -
  • - <%= link_to subdomain.name, org_subfield_sub_domain_sub_document_comments_path(subdomain, :org_subfield_id => org_subfield_id), :class => "coursesLineGrey hidden", :title => subdomain.name %> -
  • -<% end %> -<% if subdomains.size == 5 %> -
  • - - -
  • +<% subdomains.each do |subdomain|%> +
  • + <%= link_to subdomain.name, org_subfield_sub_domain_sub_document_comments_path(subdomain, :org_subfield_id => org_subfield_id), :class => "coursesLineGrey hidden", :title => subdomain.name %> +
  • +<% end %> +<% if subdomains.size == 5 %> +
  • + + +
  • <% end%> \ No newline at end of file diff --git a/app/views/sub_document_comments/_show_newstyle.html.erb b/app/views/sub_document_comments/_show_newstyle.html.erb index 90d503bd1..81f260227 100644 --- a/app/views/sub_document_comments/_show_newstyle.html.erb +++ b/app/views/sub_document_comments/_show_newstyle.html.erb @@ -1,49 +1,49 @@ -
    -
    -
    您的位置:<%= link_to "首页", organization_path(@organization) %> > - <%= @org_subfield.name %> > - <%= link_to @subdomain.name, org_subfield_sub_domain_path(@subdomain) %> > - <%= link_to @document.title, org_subfield_sub_domain_sub_document_comment_path(@document) %>
    -
    -
    -

    <%= @document.title %>

    -
    -

    来源:卫星导航仿真与测试开放实验室 发布时间::2016-04-08 浏览:200次

    -

    <%= @document.content.html_safe %>

    -
    -
    - - <% comments_for_doc = @document.children.reorder("created_at desc") %> - <% count = @document.children.count() %> -
    -

    留言板80条留言

    -
    - -
    - 发表 -
    -
    -
    -

    全部评论

    -
    -
    - - 与再有10分钟 -

    北斗真棒,北斗加油

    - (100) -
    -
    -
    - - 与再有10分钟 -

    北斗真棒,北斗加油

    - (100) -
    -
    - -
    -
    -
    +
    +
    +
    您的位置:<%= link_to "首页", organization_path(@organization) %> > + <%= @org_subfield.name %> > + <%= link_to @subdomain.name, org_subfield_sub_domain_path(@subdomain) %> > + <%= link_to @document.title, org_subfield_sub_domain_sub_document_comment_path(@document) %>
    +
    +
    +

    <%= @document.title %>

    +
    +

    来源:卫星导航仿真与测试开放实验室 发布时间::2016-04-08 浏览:200次

    +

    <%= @document.content.html_safe %>

    +
    +
    + + <% comments_for_doc = @document.children.reorder("created_at desc") %> + <% count = @document.children.count() %> +
    +

    留言板80条留言

    +
    + +
    + 发表 +
    +
    +
    +

    全部评论

    +
    +
    + + 与再有10分钟 +

    北斗真棒,北斗加油

    + (100) +
    +
    +
    + + 与再有10分钟 +

    北斗真棒,北斗加油

    + (100) +
    +
    + +
    +
    +
    \ No newline at end of file diff --git a/app/views/sub_document_comments/_show_sub_document.html.erb b/app/views/sub_document_comments/_show_sub_document.html.erb index 83d285976..83607f046 100644 --- a/app/views/sub_document_comments/_show_sub_document.html.erb +++ b/app/views/sub_document_comments/_show_sub_document.html.erb @@ -1,158 +1,158 @@ -
    -
    -
    - <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(document.creator_id) %> - <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %> -
    -
    -
    - <%= link_to User.find(document.creator_id), user_url_in_org(document.creator.id), :class => "newsBlue mr15" %> - TO  <%= link_to document.sub_domain.name, organization_path(@organization), :class => "newsBlue" %> - | - <%=link_to document.sub_domain.name, org_subfield_sub_domain_sub_document_comment_path(document, :org_subfield_id=> @org_subfield.id, :sub_domain_id => document.sub_domain.id), :class => "newsBlue" %> - <%# if document.organization.home_id == document.id %> - - <%# end %> -
    - -
    - 发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %> -
    -
    - 更新时间:<%= format_time(OrgActivity.where("org_act_type='#{document.class}' and org_act_id =#{document.id}").first.updated_at) %> -
    -
    - <% unless document.content.blank? %> - <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id => document.id, :content => document.content} %> - <% end %> -
    - - -
    -
    - <%#= render :partial=>"attachments/activity_attach", :locals=>{:activity => document} %> -
    - - <% if User.current.admin? || User.current.admin_of_org?(@organization) || User.current.id == document.creator_id %> -
    -
      -
    • -
        - - - - - -
      • - <%#= 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 => 'edit', :class => "postOptionLink" %> -
      • -
      • - <%#= 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', - :data => {:confirm => l(:text_are_you_sure)}, - :remote => true, :class => 'postOptionLink' %> -
      • -
      -
    • -
    -
    -
    - <% end %> - - -
    -
    - - <% comments_for_doc = document.children.reorder("created_at desc") %> - <% count = document.children.count() %> - -
    -
    -
    回复 - <%= count>0 ? "(#{count})" : "" %> - - - - - - - -
    - <% if count > 3 %> - - <% end %> -
    -
    -
      - <% reply_id = 0 %> - <% comments_for_doc.each do |comment| %> - <% reply_id += 1 %> -
    • -
      <%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_id) %>
      -
      -
      - <%= link_to User.find(comment.creator_id), user_url_in_org(comment.creator_id), :class => "newsBlue mr10 f14" %> - <%= format_activity_day(comment.created_at) %> <%= format_time(comment.created_at, false) %> - - - - - - - -
      - <% unless comment.content.blank? %> -
      <%= comment.content.html_safe %>
      - <% end %> -
      -
      -
    • - <% end %> -
    -
    -
    -
    - <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current.id) %> -
    -
    -
    - <%= form_for('new_form', :url => add_reply_org_subfield_sub_domain_sub_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %> - -
    - - - -
    -

    - <% end %> -
    -
    -
    -
    -
    -
    -
    - - \ No newline at end of file diff --git a/app/views/sub_document_comments/add_reply.js.erb b/app/views/sub_document_comments/add_reply.js.erb index bdc12d930..06919628b 100644 --- a/app/views/sub_document_comments/add_reply.js.erb +++ b/app/views/sub_document_comments/add_reply.js.erb @@ -1,2 +1,2 @@ -$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'sub_document_comments/show_sub_document', :locals => {:document => @document,:flag => params[:flag], :act => @act, :organization => @organization}) %>"); -sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>"); +$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'sub_document_comments/show_sub_document', :locals => {:document => @document,:flag => params[:flag], :act => @act, :organization => @organization}) %>"); +sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>"); diff --git a/app/views/sub_document_comments/index.html.erb b/app/views/sub_document_comments/index.html.erb index 9c48760fe..7e56b0242 100644 --- a/app/views/sub_document_comments/index.html.erb +++ b/app/views/sub_document_comments/index.html.erb @@ -1,20 +1,20 @@ -<% if @organization.switch_type %> - <% unless @documents.nil? %> - <%= render :partial => 'sub_document_comments/show_sub_document_newstyle', :locals => {:documents => @documents} %> - <% end %> -<% else %> - <%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> - <% end %> - <%= render :partial => 'new' %> - <% unless @documents.nil? %> - <% @documents.each do |document| %> - - <%= render :partial => 'sub_document_comments/show_sub_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='SubDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> - <% end %> - <% end %> -<% end %> +<% if @organization.switch_type %> + <% unless @documents.nil? %> + <%= render :partial => 'sub_document_comments/show_sub_document_newstyle', :locals => {:documents => @documents} %> + <% end %> +<% else %> + <%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> + <% end %> + <%= render :partial => 'new' %> + <% unless @documents.nil? %> + <% @documents.each do |document| %> + + <%= render :partial => 'sub_document_comments/show_sub_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='SubDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> + <% end %> + <% end %> +<% end %> diff --git a/app/views/sub_document_comments/show.html.erb b/app/views/sub_document_comments/show.html.erb index 8f8ba1363..ce63e0294 100644 --- a/app/views/sub_document_comments/show.html.erb +++ b/app/views/sub_document_comments/show.html.erb @@ -1,175 +1,175 @@ -<% if @organization.switch_type %> - <%= render :partial => 'sub_document_comments/show_newstyle', :locals => {:document => @document} %> -<% else %> - <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"create_kindeditor",'blog' %> - -
    -
    -
    - <%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %> -
    -
    -
    - <%= link_to User.find(@document.creator_id), user_url_in_org(@document.creator_id), :class => "newsBlue mr15" %> - TO  <%= link_to @organization.name, organization_path(@organization), :class => "newsBlue" %> - | - <%# if @organization.home_id == @document.id %> - - <%# else %> - - <%# end %> -
    -
    <%= link_to @document.title %>
    -
    - 发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %>
    - <% unless @document.content.blank? %> -
    - <%= @document.content.html_safe %> -
    - <% end %> -
    - <%#= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %> - <%#= link_to_attachments_course @document, :author => false %> -
    - - <% if User.current.admin? || User.current.admin_of_org?(@organization) || User.current.id == @document.creator_id %> -
    -
      -
    • -
        -
      • - <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @organization.id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %> - 设为首页 - <% end %> -
      • -
      • - <%#= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @organization.id, :flag => 1), :class => "postOptionLink" %> -
      • -
      • - <%#= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @organization.id, :detail_page => 1), :method => 'delete', - :data => {:confirm => l(:text_are_you_sure)}, - :remote => true, :class => 'postOptionLink' %> -
      • -
      -
    • -
    -
    -
    - <% end %> -
    -
    - <% comments_for_doc = @document.children.reorder("created_at desc") %> - <% count = @document.children.count() %> - -
    - <%# if count > 0 %> -
    -
    回复 - <%= count>0 ? "(#{count})" : "" %> - - <%# if @document.creator_id.to_i == User.current.id.to_i %> - - <%# else %> - <%#=render :partial=> "praise_tread/praise", :locals => {:activity=>@document, :user_activity_id=>@document.id,:type=>"activity"}%> - <%# end %> - -
    -
    -
    - <% comments_for_doc.each_with_index do |reply,i| %> - - <% user = User.find(reply.creator_id) %> -
    -
    - <%= link_to image_tag(url_to_avatar(user), :width => 33,:height => 33), user_url_in_org(user.id) %> -
    -
    - <%= link_to User.find(reply.creator_id).realname, user_url_in_org(reply.creator_id), :class => "newsBlue mr10 f14" %> -
    - <%= reply.content.html_safe unless reply.content.nil? %> -
    -
    - <%= format_time(reply.created_at) %> - -
    -

    -
    -
    -
    - <% end %> -
    -
    - <%# end %> - <% if User.current.logged?%> -
    - -
    -
    - <%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'sub_document_comments', :id => @document.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %> - <%= f.kindeditor :sub_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 %> -
    -
    -
    - <% end %> -
    -
    - - -<% end %> +<% if @organization.switch_type %> + <%= render :partial => 'sub_document_comments/show_newstyle', :locals => {:document => @document} %> +<% else %> + <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"create_kindeditor",'blog' %> + +
    +
    +
    + <%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(@document.creator_id) %> +
    +
    +
    + <%= link_to User.find(@document.creator_id), user_url_in_org(@document.creator_id), :class => "newsBlue mr15" %> + TO  <%= link_to @organization.name, organization_path(@organization), :class => "newsBlue" %> + | + <%# if @organization.home_id == @document.id %> + + <%# else %> + + <%# end %> +
    +
    <%= link_to @document.title %>
    +
    + 发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %>
    + <% unless @document.content.blank? %> +
    + <%= @document.content.html_safe %> +
    + <% end %> +
    + <%#= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %> + <%#= link_to_attachments_course @document, :author => false %> +
    + + <% if User.current.admin? || User.current.admin_of_org?(@organization) || User.current.id == @document.creator_id %> +
    +
      +
    • +
        +
      • + <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @organization.id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %> + 设为首页 + <% end %> +
      • +
      • + <%#= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @organization.id, :flag => 1), :class => "postOptionLink" %> +
      • +
      • + <%#= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @organization.id, :detail_page => 1), :method => 'delete', + :data => {:confirm => l(:text_are_you_sure)}, + :remote => true, :class => 'postOptionLink' %> +
      • +
      +
    • +
    +
    +
    + <% end %> +
    +
    + <% comments_for_doc = @document.children.reorder("created_at desc") %> + <% count = @document.children.count() %> + +
    + <%# if count > 0 %> +
    +
    回复 + <%= count>0 ? "(#{count})" : "" %> + + <%# if @document.creator_id.to_i == User.current.id.to_i %> + + <%# else %> + <%#=render :partial=> "praise_tread/praise", :locals => {:activity=>@document, :user_activity_id=>@document.id,:type=>"activity"}%> + <%# end %> + +
    +
    +
    + <% comments_for_doc.each_with_index do |reply,i| %> + + <% user = User.find(reply.creator_id) %> +
    +
    + <%= link_to image_tag(url_to_avatar(user), :width => 33,:height => 33), user_url_in_org(user.id) %> +
    +
    + <%= link_to User.find(reply.creator_id).realname, user_url_in_org(reply.creator_id), :class => "newsBlue mr10 f14" %> +
    + <%= reply.content.html_safe unless reply.content.nil? %> +
    +
    + <%= format_time(reply.created_at) %> + +
    +

    +
    +
    +
    + <% end %> +
    +
    + <%# end %> + <% if User.current.logged?%> +
    + +
    +
    + <%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'sub_document_comments', :id => @document.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %> + <%= f.kindeditor :sub_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 %> +
    +
    +
    + <% end %> +
    +
    + + +<% end %> diff --git a/app/views/sub_domains/_new.html.erb b/app/views/sub_domains/_new.html.erb index 6bf62d006..3c63c073d 100644 --- a/app/views/sub_domains/_new.html.erb +++ b/app/views/sub_domains/_new.html.erb @@ -1,3 +1,3 @@ -
    - test +
    + test
    \ No newline at end of file diff --git a/app/views/sub_domains/new.html.erb b/app/views/sub_domains/new.html.erb index a8c66f639..a497b71cf 100644 --- a/app/views/sub_domains/new.html.erb +++ b/app/views/sub_domains/new.html.erb @@ -1,6 +1,6 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'sub_domains/new',:locals => {:course => @course,:course_attachment_type => 1}) %>'); -showModal('ajax-modal', '513px'); -$('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); -$('#ajax-modal').parent().css("top","40%").css("left","50%").css("border","3px solid #269ac9"); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'sub_domains/new',:locals => {:course => @course,:course_attachment_type => 1}) %>'); +showModal('ajax-modal', '513px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","40%").css("left","50%").css("border","3px solid #269ac9"); $('#ajax-modal').parent().addClass("popbox_polls"); \ No newline at end of file