From 9e0b88c186d84c1bce17e706e5f158394fd87daa Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Thu, 24 Dec 2015 09:46:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=94=B9=E6=88=90=E6=96=B9=E5=9D=97=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_project_new_topic.html.erb | 72 +++- app/views/boards/_project_show.html.erb | 232 ++----------- .../boards/_project_show_detail.html.erb | 70 ++++ app/views/layouts/base_projects.html.erb | 2 +- app/views/messages/_form_project.html.erb | 64 +++- app/views/messages/_project_show.html.erb | 309 ++++++++++++------ app/views/users/_project_message.html.erb | 4 +- 7 files changed, 424 insertions(+), 329 deletions(-) create mode 100644 app/views/boards/_project_show_detail.html.erb diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb index 00a3d2016..2259cc5bb 100644 --- a/app/views/boards/_project_new_topic.html.erb +++ b/app/views/boards/_project_new_topic.html.erb @@ -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| %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: true, prettify: false) %> +<% end %> - <%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %> -
  • -
    - <%= l(:button_cancel) %> +<%= error_messages_for 'message' %> +
    +
    +
    +
    + +

    +
    +
  • -<% end %> \ No newline at end of file + <%= 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 + %> +
    +

    + +
    +
    +
    + <%= render :partial => 'attachments/form_course', :locals => {:container => topic, :isReply => @isReply} %> +
    +
    +
    +
    + <%if !edit_mode %> + 确定 + + 取消 + <% else %> + 确定 + + <%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%> + <% end %> +
    +
    + + + + \ No newline at end of file diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 839d587b2..8a11d2859 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -1,204 +1,44 @@ -
    -
    -

    - <% if User.current.language == "zh"%> - <%= h @board.name %> - <% else %> - <%= l(:project_module_boards) %> - <% end %> -

    - <% if User.current.logged? %> - <%= l(:label_message_new) %> - <% end %> -
    -
    - <% if !User.current.logged? %> -
    - <%= l(:label_user_login_project_board) %> - <%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %> + + +
    +
    +
    + 项目讨论区
    - <% end %> -
    -
    -
    -
    -
    -

    讨论区共有<%= @topic_count %>个帖子

    - <% if @topics.any? %> - <% @topics.each do |topic| %> -
    - <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> -
    - <% author = topic.author.to_s %> -
    - <%= 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;' %> -
    -

      :

    - -

      <%= h(topic.subject) %>

    - - <% if topic.editable_by?(User.current) %> - <%= l(:button_edit) %> - <% 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? %> - <%= l(:label_board_sticky)%> - <% end %> - - -
    -
    -
    - <%= topic.content.html_safe %> - -
    -
    - - <%= link_to_attachments_course topic, :author => false %> - <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> -
    - <% if User.current.logged? %> - <%= l(:button_reply) %> - <% end %> -
    - -
    -
    - <% reply = Message.new(:subject => "RE: #{topic.subject}")%> - <% if !topic.locked? && authorize_for('messages', 'reply') %> - - <% end %> -
    - <% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).reorder("#{Message.table_name}.id desc").all %> - <% unless replies_all.empty? %> -
    -
      - <% replies_all_i = 0 %> - <% replies_all.each do |message| %> - <% replies_all_i=replies_all_i+1 %> -
    • - <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %> -
      - <%= link_to_user_header message.author,false,:class => 'fl c_orange f14 ' %> -
      -
      - <%= textAreailizable message,:content,:attachments => message.attachments %> - -
      - -
      - <%= format_time(message.created_on) %> - <%= 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') %> -
      -
      -
    • - <% end %> -
    -
    - <%if topic.replies_count>2 %> - - <% end %> - <% end %> -
    -
    + <% 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 %> -

    <%= l(:label_no_data) %>

    - <% end %> -
      - <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %> -
    - - -<%# 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} %>
    -
    + + + + + + <% if topic %> + <%= render :partial => 'users/project_message', :locals => {:activity => topic,:user_activity_id =>topic.id} %> + <% end %> + <% end %> + + <% if topics.count == 10 %> +
    展开更多<%= link_to "", boards_topic_path(@board, :project_id => @board.project.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %>
    + <% end %> +<% end%> + + \ No newline at end of file diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index f7dcc40f5..433d30214 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -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 %> diff --git a/app/views/messages/_form_project.html.erb b/app/views/messages/_form_project.html.erb index bf91b3517..57d8a27c2 100644 --- a/app/views/messages/_form_project.html.erb +++ b/app/views/messages/_form_project.html.erb @@ -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 } %> +
  • - +
    <% if replying %> - <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %> +
    <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585 fl" }.merge(extra_option) %>
    <% else %> <%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %> +

    <% end %> -

    +
  • -
  • +
  • <% unless replying %> <% if @message.safe_attribute? 'sticky' %> <%= f.check_box :sticky %> @@ -24,20 +31,45 @@
  • -
    - +
    + <%= 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 %>
    -

    +

  • -
  • - -
    - <%= render :partial => 'attachments/form_project', :locals => {:container => @message,:isReply => @isReply} %> -
    -
  • +<% unless replying %> +
  • + +
    + <%= render :partial => 'attachments/form_project', :locals => {:container => @message,:isReply => @isReply} %> +
    +
  • +<% end %>
  • -
  • \ No newline at end of file + diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index 28b9e28d5..b20a7c22d 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -1,104 +1,3 @@ -
    -

    <%= h @board.name %>

    -
    -
    -
    - <%=link_to image_tag(url_to_avatar(@topic.author), :width => "46", :height => "46"), user_path(@topic.author) %> -
    -
    -

    - <%= @topic.subject %>

    -
    -

    由<%= link_to_user_header @topic.author,false,:class=> 'problem_name c_orange' %> 添加于<%= format_time(@topic.created_on) %>

    -
    - - <%#= 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) %> -
    -
    <%= textilizable(@topic, :content) %>
    -
    <%= link_to_attachment_project @topic, :author => false %>
    - -
    - <% 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') %> -
    -
    -<% unless @replies.empty? %> - <% reply_count = 0 %> - <% @replies.each do |message| %> -
    "> -
    <%= link_to image_tag(url_to_avatar(message.author), :width => '46',:height => '46'), user_path(message.author) %>
    -
    -
    - <%= link_to_user_header message.author,false,:class => 'c_blue fb fl mb10 ' %> - <%= format_time(message.created_on) %> -
    -

    <%= textAreailizable message,:content,:attachments => message.attachments %>

    - <%= link_to_attachments_course message, :author => false %> -
    -
    - <%= 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) %> -
    -
    -
    -
    -
    - <% end %> -<% end %> -<% if !@topic.locked? && authorize_for('messages', 'reply') %> - -<% end %> -
      - <%= pagination_links_full @reply_pages, @reply_count, :per_page_links => false, :remote => false, :flag => true%> -
    -<% html_title @topic.subject %> \ No newline at end of file + + + + +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> + + + + +
    +
    +
    + <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> +
    +
    + <% if @topic.author.id == User.current.id%> + + <%end%> + +
    + +
    + <% 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 %> +
    +
    <%= format_time( @topic.created_on)%>
    +
    +
    + <%= @topic.content.html_safe%> +
    +
    +
    + <%= link_to_attachments_course @topic, :author => false %> +
    +
    +
    +
    +
    +
    + <% unless @replies.empty? %> +
    +
    回复(<%=@reply_count %>)
    +
    + +
    +
    + <% @replies.each_with_index do |reply,i| %> + +
    +
    + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
    +
    +
    + <% 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 %> +
    +
    + <%= reply.content.html_safe%> +
    +
    + <%= format_time(reply.created_on) %> + +
    +

    +
    +
    +
    + <% end %> +
    + + <% end %> +
    + <% if !@topic.locked? && authorize_for('messages', 'reply') %> +
    + +
    +
    + <%= 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 %> +
    +
    +
    + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index 14c37096e..96d74d82f 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -16,10 +16,10 @@
    <% 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" + <%= 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, project_boards_path(activity.project,:parent_id =>activity.parent_id, :topic_id => activity.id), :class=> "postGrey" + <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey" %> <% end %>