diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 4f3f3ec0d..4f78d61f5 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -37,6 +37,7 @@ class MessagesController < ApplicationController # Show a topic and its replies def show +=begin if @course topic_id = params[:r]?params[:r]:params[:id] parent_id = params[:id] @@ -44,6 +45,7 @@ class MessagesController < ApplicationController redirect_to url return; end +=end @isReply = true page = params[:page] diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index db174f30e..1dd8c655a 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,313 +1,91 @@ -
-
-

+<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %> + + +
+
+
<% 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_course_board) %> - <%= link_to l(:label_user_login_new), signin_path %> -
-<% 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 User.current.member_of_course?(@board.course) ? "#{topic.author.show_name}(#{topic.author.login})" : "#{topic.author}" , user_path(topic.author), - :class =>"talkmain_name fl f14",:title=>author, - :style=>'max-width:120px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %> -
-

  :

- -

  <%= 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) %> - - <% 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 %> - -
- <%= l(:button_reply) %> - -
- - -
-
- <% 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}.created_on 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.current.member_of_course?(@board.course) ? "#{message.author.show_name}(#{message.author.login})" : "#{message.author}", user_path(message.author),: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 => ' linkBlue fr f12' - ) if message.course_destroyable_by?(User.current) %> - <%= link_to( - l(:button_reply), - 'javascript:;', - :nhname =>'showbtn_child_reply', - :class => ' linkBlue fr f12', - :style => 'margin-right: 10px;', - 'data-topic-id' =>message.id, - :title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %> -
    -
    - -
  • - <% end %> -
-
- <%if topic.replies_count>2 %> - - <% end %> - <% end %> -
-
-
- - <% end %> -<% else %> -

<%= l(:label_no_data) %>

-<% 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 => "#{@course}: #{@board}") %> -<% end %> - -
- \ No newline at end of file + + <% if topic %> + <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %> + <% end %> + <% end %> + <% end %> + + + \ No newline at end of file diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 2d433d969..6106ee912 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -1,117 +1,146 @@ -
-

- <%= l(:label_board) %> -

-
+<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor","forum" %> + + + +
+
+
+ <%= 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%> +
+
    +
  • +
      +
    • + <%= link_to( + l(:button_edit), + {:action => 'edit', :id => @topic}, + :class => 'postOptionLink' + ) if @message.course_editable_by?(User.current) %> +
    • +
    • + <%= link_to( + l(:button_delete), + {:action => 'destroy', :id => @topic}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if @message.course_destroyable_by?(User.current) %> +
    • +
    +
  • +
+
+ <%end%> + +
+ +
+ <%= link_to @topic.author.name, user_path(@topic.author), :class => "linkBlue2", :target=> "_blank"%>
+
<%= format_date( @topic.created_on)%>
+
+
+ <%= @topic.content.html_safe%> +
+
+
+ <%= link_to_attachments_course @topic, :author => false %> +
+
+
- <%= link_to( - l(:button_delete), - {:action => 'destroy', :id => @topic}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'talk_edit fr' - ) if @message.course_destroyable_by?(User.current) %> - <%= link_to( - l(:button_edit), - {:action => 'edit', :id => @topic}, - :class => 'talk_edit fr' - ) if @message.course_editable_by?(User.current) %> -
-
<%= @topic.content.html_safe %>
-
<%= link_to_attachments_course @topic, :author => false %>
- -
- <% if User.current.logged? %> - <%= toggle_link l(:button_reply), "reply", :focus => 'message_subject',: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 %> +
+ <% unless @replies.empty? %> +
+
回复(<%=@reply_count %>)
+
+
+ <% if @reply_count > 2%> + 点击展开更多回复 + <% end %> +
+
+
+ <% @replies.each_with_index do |reply,i| %> +
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
-
- <%= 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) %> +
+
<%= reply.author.name%><%= format_date(reply.created_on) %>
+
<%= reply.content.html_safe%>
-
-
- <% end %> -<% end %> -<% if !@topic.locked? && authorize_for_course('messages', 'reply') %> - -<% end %> -
-
    - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
-<% html_title @topic.subject %> + <% end %> +
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => @topic.id, :is_board => 'false'},:method => "post", :remote => true) do |f|%> + + +
+ +
+

+ <% end%> +
+
+
+
+
+
+
\ No newline at end of file diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 8ec605567..9ce308014 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -15,9 +15,9 @@
<% if activity.parent_id.nil? %> - <%= link_to activity.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.id, :topic_id => activity.id,:host=> Setting.host_course), :class=> "postGrey" %> + <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %> <% else %> - <%= link_to activity.parent.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.parent_id, :topic_id => activity.id,:host=> Setting.host_course), :class=> "postGrey"%> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%> <% end %>
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 328570345..81700a106 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1040,3 +1040,35 @@ a:hover.c_grey{ color:#333;} a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;} a.postOptionLink:hover {color:#ffffff; background-color:#15bccf;} +/*讨论区内部样式*/ +.postDetailContainer {padding:15px; border:1px solid #dddddd; background-color:#ffffff;} +.postlabel {background-color:#edf1f2; color:#888888; padding:2px 5px; float:left; margin-bottom:5px;} +.postRightContainer {width:718px; border:1px solid #dddddd; padding:15px; background-color:#ffffff; float:left; margin-bottom:10px;} +.postDetailBanner {height:30px; width:720px; border-bottom:1px solid #efefef;} +.postDetailRow {width:720px; border-bottom:1px solid #efefef; padding:15px 0;} +.postDetailPortrait {width:50px; height:50px; float:left; margin-right:15px;} +.postDetailWrap {width:580px; float:left;} +.postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} +.postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} +.postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} +.postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} +.postDetailDate {color:#888888; font-size:12px; float:left;} +.postDetailReply { margin-top:28px; color:#888888; float:right;} +a.postReplyIcon {background:url(images/post_image_list.png) -40px 2px no-repeat; width:18px; height:18px; float:left;} +a.postReplyIcon:hover {background:url(images/post_image_list.png) -40px -29px no-repeat;} +.postDetailInput {width:713px; height:28px; border:1px solid #d9d9d9; outline:none !important;} +.postAttIcon {background:url(images/post_image_list.png) 0px -91px no-repeat; width:16px; height:16px; padding-left:20px;} +.postAttIcon:hover {background:url(images/post_image_list.png) 0px -113px no-repeat;} +.postThemeContainer {width:720px;} +.postThemeWrap {width:655px; float:left;position: relative} +.postLikeIcon {background:url(images/post_image_list.png) 0px -42px no-repeat ;float:right; padding-left:18px; margin-top:3px;} +.postLikeIcon:hover {background:url(images/post_image_list.png) 0px -64px no-repeat ;} +a.AnnexBtn{ background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; width:70px; height:20px; display:block; padding-left:20px; color:#888888;} +a:hover.AnnexBtn{background: url(images/homepage_icon2.png) -90px -343px no-repeat !important; color:#3598db;} +.postEdit {background:url(images/post_image_list.png) 0px -94px no-repeat; width:18px; height:18px; display:block; float:left;} +.postDelete {background:url(images/post_image_list.png) -42px -93px no-repeat; width:18px; height:18px; display:block; float:right;} +.pageBanner {width:968px; margin:0px auto; border:1px solid #dddddd; background-color: #FFF; padding: 10px 15px; float:left;} +.homepagePostReplyInput {width:543px; height:33px; max-width:543px; max-height:33px; border:1px solid #d9d9d9; outline:none;} +.postRouteContainer {padding:10px 15px; background-color:#ffffff; border:1px solid #dddddd; margin-top:10px; font-size:14px;} +a.postRouteLink {font-weight:bold; color:#484848;} +a.postRouteLink:hover {text-decoration:underline;}