From 1c9b9dff793a9e13c3f95d3d63ba4c68c64a6643 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 22 May 2015 13:57:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8A=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E8=BF=98=E5=8E=9F=E3=80=8B=E3=80=8A=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E6=B7=BB=E5=8A=A0=E3=80=8B=20Signed?= =?UTF-8?q?-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_new.html.erb | 2 +- app/views/boards/_course_show.html.erb | 349 +++++++++---------- app/views/boards/_form_course.html.erb | 8 +- app/views/boards/_form_project.html.erb | 4 +- app/views/boards/_project_new_topic.html.erb | 2 +- app/views/boards/_project_show.html.erb | 28 +- public/javascripts/project.js | 19 +- public/stylesheets/leftside.css | 1 + public/stylesheets/pleft.css | 1 + 9 files changed, 209 insertions(+), 205 deletions(-) diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index aaf6d66e5..6ca6b074a 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -3,7 +3,7 @@ <%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
  • <%= l(:button_cancel) %> - <%= l(:button_submit)%> + <%= l(:button_submit)%>
  • <% end %> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index cf3cd6ec5..d7eb7c215 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -10,19 +10,17 @@ <% end %> - <% if User.current.logged? %> - <%= l(:label_message_new) %> - <% end %> + <%= l(:label_message_new) %>
    -
    - -
    +
    + +
    <% if !User.current.logged?%>
    @@ -31,186 +29,166 @@
    <% 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 " %> +

    讨论区共有<%= @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 " %> -

      <%= h(topic.subject) %>

    - <% if topic.course_editable_by?(User.current) %> - <%= l(:button_edit) %> - <% end %> +

      <%= h(topic.subject) %>

    + <% if topic.course_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) %> + <%= 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 %> -
    + <% if topic.sticky? %> + <%= l(:label_board_sticky)%> + <% end %> +
    - -
    -
    - <%= topic.content.html_safe %> -
    + +
    +
    + <%= topic.content.html_safe %>
    +
    - - <%= link_to_attachments_course topic, :author => false %> +

    + <%= link_to_attachments_course topic, :author => false %> - <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> + <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> -
    - <% if User.current.logged? %> - <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => "about_newtalk#{topic.id}",:class => ' c_dblue fr' %> - <% end %> - -
    - - -
    - -
    - <% reply = Message.new(:subject => "RE: #{@message.subject}")%> - <% if !topic.locked? && authorize_for('messages', 'reply') %> - -
    - - <% end %> - <% replies_all = topic.children. - includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.created_on DESC").offset(2). - all %> - <% replies_show = topic.children. - includes(:author, :attachments, {:board => :project}). - reorder("#{Message.table_name}.created_on DESC").limit(2). - all %> - <% unless replies_show.empty? %> - <% reply_count = 0 %> -
    -
      - <% replies_show.each do |message| %> +
      -
    • - <%= 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 ' %> -
      -

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

      -
      - <%= format_time(message.created_on) %> - <%= link_to( +
      + +
      + <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% if !topic.locked? && authorize_for('messages', 'reply') %> + +
      + -
      - -
    • - <% end %> -
    -
    - - <%if replies_all.first %> - + <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %> + <%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %> + <%= l(:label_memo_create)%> <% end %> - <% end %> -
    - <% end %> - <% else %> -

    <%= l(:label_no_data) %>

    - <% end %> +
    +
    + <% end %> + <% replies_all = topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").offset(2). + all %> + <% replies_show = topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").limit(2). + all %> + <% unless replies_show.empty? %> + <% reply_count = 0 %> +
    +
      + <% replies_show.each do |message| %> + +
    • + <%= 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 ' %> +
      +

      <%= 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' + ) if message.course_destroyable_by?(User.current) %> +
      +
      + +
    • + <% end %> +
    +
    + + <%if replies_all.first %> + + <% end %> + <% end %> +
    + <% end %> +<% else %> +

    <%= l(:label_no_data) %>

    +<% end %> <%# other_formats_links do |f| %> - <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> +<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> <%# end %> <% html_title @board.name %> @@ -224,49 +202,52 @@ KindEditor.ready(function(K){ $("div[name='container_board']").each(function(){ var container=$(this); - + var messege = $("p[aa='message_show']",container); + var subject = $("input[aa='subject']",container); var textarea= $("textarea[aa='content']",container); - var message = $("p[aa='message_show']", container); + var form = $("form",container); var editor = K.create(textarea, { resizeType : 1, allowPreviewEmoticons : false, allowImageUpload : false, width:"89%", - items : ['emoticons'] + items : [] }); +// form.submit(function(){ +// alert(textarea.html()); +// }); +// $("a[name='submitbtn']",container).click(function(){ +// form.submit(); +// }); $("a[name='submitbtn']",container).click(function(){ - textarea[0].value = editor.html(); + textarea[0].value = editor.html() ; var id = textarea[0].id.toString().substr(15); - var subject = document.getElementById("message_subject"); - if(subject.value == "RE: ") { - if (textarea[0].value.length == 0) { - message[0].text("描述不能为空"); - message[0].css('color', '#ff0000'); + if(subject.val() == "RE: ") { + if (editor.html() == "") { + messege.html("回复内容不能为空") ; + messege.css('color', '#ff0000'); + messege.show(); } else { - - message[0].text("填写正确"); - message[0].css('color', '#008000'); + messege.html("填写正确"); + messege.css('color', '#008000'); + messege.show(); this.parentNode.submit(); } } else { - if (regexContent(id) && regexSubject(id)) { - if (this.parentNode.name.toString() == 'message-form') { + if(regexContent(id) && regexSubject(id)) { + if (this.parentNode.name == 'message-form') { this.parentNode.submit(); } - else { - + else this.parentNode.parentNode.submit(); - - } } } - - }); + }); }); }); diff --git a/app/views/boards/_form_course.html.erb b/app/views/boards/_form_course.html.erb index de5928923..cfef18f93 100644 --- a/app/views/boards/_form_course.html.erb +++ b/app/views/boards/_form_course.html.erb @@ -5,17 +5,17 @@
  • - <%= 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", :aa=>"subject" }.merge(extra_option) %> -

    +

  • <% else %> -
  • +
  • - <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585", :aa=>"subject" }.merge(extra_option) %>

  • diff --git a/app/views/boards/_form_project.html.erb b/app/views/boards/_form_project.html.erb index 2ab36c774..eb9c4e416 100644 --- a/app/views/boards/_form_project.html.erb +++ b/app/views/boards/_form_project.html.erb @@ -18,7 +18,7 @@
  • - <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585", :aa=>'subject' }.merge(extra_option) %>

    @@ -28,7 +28,7 @@ - <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585" }.merge(extra_option) %> + <%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585", :aa=>'subject' }.merge(extra_option) %>

  • diff --git a/app/views/boards/_project_new_topic.html.erb b/app/views/boards/_project_new_topic.html.erb index 611a58738..5c8691529 100644 --- a/app/views/boards/_project_new_topic.html.erb +++ b/app/views/boards/_project_new_topic.html.erb @@ -4,7 +4,7 @@
  • <%= l(:button_cancel) %> - <%= l(:button_submit)%> + <%= l(:button_submit)%>
  • <% 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 86c50897b..2129c3a9f 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -8,7 +8,7 @@ <% if User.current.logged? %> - <%= l(:label_message_new) %> + <%= l(:label_message_new) %> <% end %>
    @@ -174,7 +174,7 @@

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

    -
    +
    <%= format_time(message.created_on) %> <%= link_to( @@ -246,28 +246,32 @@ KindEditor.ready(function(K){ $("div[name='container_board']").each(function(){ var container=$(this); - + var form =$("form", container); + var messege = $("p[aa='message_show']",container); var textarea= $("textarea[aa='content']",container); var editor = K.create(textarea, { resizeType : 1, allowPreviewEmoticons : false, allowImageUpload : false, width:"89%", - items : ['emoticons'] + items : [] }); $("a[name='submitbtn']",container).click(function(){ textarea[0].value = editor.html(); - var id = textarea[0].id.toString().substr(15); - if(regexContent(id) && regexSubject(id)) { - if (this.parentNode.name.toString() == 'message-form') { - this.parentNode.submit(); - } - else { - this.parentNode.parentNode.submit(); - } + if (editor.html() == "") { + + messege.html("回复内容不能为空") ; + messege.css('color', '#ff0000'); + messege.show(); + } + else { + messege.html("填写正确"); + messege.css('color', '#008000'); + messege.show(); + form.submit(); } }); diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 3611fe380..8c21e6ce0 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -77,7 +77,24 @@ function show_more_reply(contentid, id2, id3) { information.attr("style", "color:#0781b4;"); } } - +function show_more_reply1(contentid, id2, id3) { + $(contentid).toggleClass("course_description_none"); + var information = $(id2); + var arrow = $(id3); + var val = information.attr("value"); + if (val == "show_more") { + $(id2).text("[收起]"); + information.attr("value", "hide_more"); + information.attr("style", "color:#3ca5c6"); + arrow.attr("src", "/images/jiantouup.jpg") + } + else { + $(id2).text("[展开]"); + information.attr("value", "show_more"); + arrow.attr("src", "/images/jiantou.jpg") + information.attr("style", "color:#0781b4;"); + } +} //项目版本库git帮助文档显示 function showhelpAndScrollTo(id) { $('#' + id).toggle(); diff --git a/public/stylesheets/leftside.css b/public/stylesheets/leftside.css index 53d382f20..9095cc6e3 100644 --- a/public/stylesheets/leftside.css +++ b/public/stylesheets/leftside.css @@ -46,6 +46,7 @@ a:hover.subnav_green{ background:#14ad5a;} .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} .course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;} .project_board_content{overflow: hidden;max-height: 182px;word-break: break-all;word-wrap: break-word;} +.project_board_content1{overflow: hidden;max-height: 72px;word-break: break-all;word-wrap: break-word;} .course_description_none{max-height: none;} .lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;} .lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;} diff --git a/public/stylesheets/pleft.css b/public/stylesheets/pleft.css index a8d4409e3..acf470dfe 100644 --- a/public/stylesheets/pleft.css +++ b/public/stylesheets/pleft.css @@ -50,6 +50,7 @@ a:hover.subnav_green{ background:#14ad5a;} .project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} .course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;} .project_board_content{overflow: hidden;max-height: 182px;word-break: break-all;word-wrap: break-word;} +.project_board_content1{overflow: hidden;max-height: 72px;word-break: break-all;word-wrap: break-word;} .course_description_none{max-height: none;} .lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;} .lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;}