From cc649ae64b775c9056436c4421a5ecb527eb8270 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 4 Jul 2016 14:14:51 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E3=80=81=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA?= =?UTF-8?q?=E3=80=81=E5=B8=96=E5=AD=90=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E4=BA=8C=E7=BA=A7=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 80 +++++++------ app/controllers/users_controller.rb | 16 ++- app/helpers/application_helper.rb | 4 +- app/views/messages/_course_show.html.erb | 33 ++++-- app/views/messages/_project_show.html.erb | 110 +++++++++--------- app/views/messages/_reply_message.html.erb | 9 +- app/views/messages/destroy.js.erb | 8 ++ app/views/messages/quote.js.erb | 14 +-- .../users/_comment_reply_detail.html.erb | 6 +- app/views/users/_course_message.html.erb | 20 ++-- app/views/users/_message_contents.html.erb | 23 ++++ app/views/users/_message_replies.html.erb | 61 ++++++++++ .../users/_message_reply_banner.html.erb | 18 +++ app/views/users/_project_message.html.erb | 18 ++- app/views/users/_reply_to.html.erb | 18 ++- app/views/users/all_journals.js.erb | 2 + app/views/users/show_all_replies.js.erb | 2 + public/javascripts/application.js | 35 ++++++ public/stylesheets/courses.css | 4 +- public/stylesheets/public.css | 46 +++++++- 20 files changed, 382 insertions(+), 145 deletions(-) create mode 100644 app/views/messages/destroy.js.erb create mode 100644 app/views/users/_message_contents.html.erb create mode 100644 app/views/users/_message_replies.html.erb create mode 100644 app/views/users/_message_reply_banner.html.erb diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 8ef399d10..f5ad89832 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -44,7 +44,8 @@ class MessagesController < ApplicationController offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i]) page = 1 + offset / REPLIES_PER_PAGE end - @reply_count = @topic.children.count + all_comments = [] + @reply_count = get_all_children(all_comments, @topic).count @reply = Message.new(:subject => "RE: #{@message.subject}") if @course messages_replies = @topic.children. @@ -137,26 +138,32 @@ class MessagesController < ApplicationController # Reply to a topic def reply - if params[:reply][:content] == "" - if params[:is_board] - if @project - (redirect_to project_boards_path(@project), :notice => l(:label_reply_empty);return) - elsif @course - (redirect_to course_boards_path(@course), :notice => l(:label_reply_empty);return) - end - else - (redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return) - end + if params[:parent_id] + parent = Message.find params[:parent_id] + @reply = Message.new + @reply.author = User.current + @reply.board = parent.board + @reply.content = params[:content] + @reply.subject = "RE: #{parent.subject}" + @reply.reply_id = params[:reply_id] + # @reply.reply_id = params[:id] + parent.children << @reply + @topic = params[:activity_id].nil? ? parent : Message.find(params[:activity_id].to_i) + @user_activity_id = params[:user_activity_id] if params[:user_activity_id] + @is_course = params[:is_course] if params[:is_course] + @is_board = params[:is_board] if params[:is_board] + else + @quote = params[:quote][:quote] + @reply = Message.new + @reply.author = User.current + @reply.board = @board + @reply.safe_attributes = params[:reply] + @reply.content = @quote + @reply.content + @reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] + @topic.children << @reply + # @reply.reply_id = params[:id] end - @quote = params[:quote][:quote] - @reply = Message.new - @reply.author = User.current - @reply.board = @board - @reply.safe_attributes = params[:reply] - @reply.content = @quote + @reply.content - @reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] - # @reply.reply_id = params[:id] - @topic.children << @reply + update_course_activity(@topic.class,@topic.id) update_user_activity(@topic.class,@topic.id) update_forge_activity(@topic.class,@topic.id) @@ -182,14 +189,10 @@ class MessagesController < ApplicationController respond_to do |format| format.js end - elsif params[:is_board] - if @project - redirect_to project_boards_path(@project) - elsif @course - redirect_to course_boards_path(@course) - end + return else - redirect_to board_message_url(@board, @topic, :r => @reply) + redirect_to board_message_url(@board, @topic) + return end end @@ -251,6 +254,17 @@ class MessagesController < ApplicationController # Delete a messages def destroy + if params[:user_activity_id] + @message.destroy + @topic = Message.find(params[:activity_id].to_i) + @user_activity_id = params[:user_activity_id] + @is_course = params[:is_course] + @is_board = params[:is_board] + respond_to do |format| + format.js + end + return + end if @project (render_403; return false) unless @message.destroyable_by?(User.current) elsif @course @@ -299,12 +313,12 @@ class MessagesController < ApplicationController end def quote - @subject = @message.subject - @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:') - - @content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> " - @temp = Message.new - @temp.content = "
#{ll(Setting.default_language, :text_user_wrote, @message.author.show_name)}
#{@message.content.html_safe}
".html_safe + # @subject = @message.subject + # @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:') + # + # @content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> " + # @temp = Message.new + # @temp.content = "
#{ll(Setting.default_language, :text_user_wrote, @message.author.show_name)}
#{@message.content.html_safe}
".html_safe end def preview diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 69a38610e..fe42e6919 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -90,6 +90,8 @@ class UsersController < ApplicationController case params[:type] when 'JournalsForMessage' @comment = JournalsForMessage.find params[:comment].to_i + when 'Message' + @comment = Message.find params[:comment].to_i end end @@ -111,6 +113,13 @@ class UsersController < ApplicationController @user_activity_id = params[:user_activity_id] @activity_id = params[:activity_id] @type = 'JournalsForMessage' + when 'Message' + @reply = Message.find params[:reply_id] + @user_activity_id = params[:user_activity_id] + @activity_id = params[:activity_id] + @is_course = params[:is_course] + @is_board = params[:is_board] + @type = 'Message' end respond_to do |format| format.js @@ -3281,7 +3290,12 @@ class UsersController < ApplicationController @journals = obj.children.reorder("created_at desc") when 'Message' obj = Message.where('id = ?', params[:id].to_i).first - @journals = obj.children.reorder("created_on desc") + @type = 'Message' + @is_course = params[:is_course] + @is_board = params[:is_board] + @user_activity_id = params[:div_id].to_i if params[:div_id] + comments = [] + @journals = get_all_children(comments, obj) when 'News' obj = News.where('id = ?', params[:id].to_i).first @journals = obj.comments.reorder("created_on desc") diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cb8b06a8f..1d79d45ce 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3138,9 +3138,9 @@ def get_reply_parents_no_root parents_rely, comment parents_rely end -#获取留言的所有子节点 +#获取所有子节点 def get_all_children result, jour - if jour.kind_of? JournalsForMessage + if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message) jour.children.each do |jour_child| result << jour_child get_all_children result, jour_child diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 560925070..232be1f35 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -95,9 +95,10 @@ - <% unless @replies.empty? %> + <% all_comments = []%> + <% comments = get_all_children(all_comments, @topic) %>
- <% @replies.each_with_index do |reply,i| %> + <% comments.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) %> - -
-

-
-
+ <% all_comments = []%> + <% comments = get_all_children(all_comments, @topic) %> +
+ <% comments.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 reply.creator_user.show_name, user_url_in_org(reply.creator_user.id), :class => "newsBlue mr10 f14" %> + <%= time_from_now(reply.created_on) %>
- <% end %> -
+ <% if !reply.parent.nil? && !reply.parent.parent.nil? %> + <%= render :partial => 'users/message_contents', :locals => {:comment => reply}%> + <% end %> +
+ <%= reply.content.html_safe%> +
+
+
+ + + <%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %> + + + <%= link_to( + l(:button_reply), + {:action => 'quote', :id => reply}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %> + + + <%= link_to( + l(:button_delete), + {:action => 'destroy', :id => reply}, + :method => :post, + :class => 'fr mr20', + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete) + ) if reply.course_destroyable_by?(User.current) %> + - <% end %> +
+
+
+

+
+
+
+ <% end %> +
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
diff --git a/app/views/messages/_reply_message.html.erb b/app/views/messages/_reply_message.html.erb index d4d9d77a0..923734001 100644 --- a/app/views/messages/_reply_message.html.erb +++ b/app/views/messages/_reply_message.html.erb @@ -4,11 +4,12 @@
<% if User.current.logged? %>
- <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %> - - + <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :method => "post", :id => 'new_form' do |f| %> + <%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %> + <%= hidden_field_tag 'reply_id', params[:reply_id], :value => reply.author.id %> + <%= hidden_field_tag 'activity_id',params[:activity_id],:value =>@topic.id %>
- +

diff --git a/app/views/messages/destroy.js.erb b/app/views/messages/destroy.js.erb new file mode 100644 index 000000000..109df3a0e --- /dev/null +++ b/app/views/messages/destroy.js.erb @@ -0,0 +1,8 @@ +<%if @project%> +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>"); +<%elsif @course%> +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>"); +<% elsif @org_subfield %> +$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>"); +<%end%> +sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity"); \ No newline at end of file diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb index 89f953bb9..9bd723157 100644 --- a/app/views/messages/quote.js.erb +++ b/app/views/messages/quote.js.erb @@ -1,16 +1,8 @@ -/*$('#message_subject').val("<%#= raw escape_javascript(@subject) %>"); -$('#message_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>"); -//$('#message_content').val("<#%= raw escape_javascript(@content) %>"); -$('#quote_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>"); - -showAndScrollTo("reply", "message_content"); -$('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight; -$("img").removeAttr("align");*/ if($("#reply_message_<%= @message.id%>").length > 0) { - $("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message,:temp =>@temp,:subject =>@subject}) %>"); + $("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message}) %>"); $(function(){ - $('#reply_subject').val("<%= raw escape_javascript(@subject) %>"); - $('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>"); + /*$('#reply_subject').val("<%#= raw escape_javascript(@subject) %>"); + $('#quote_quote').val("<%#= raw escape_javascript(@temp.content.html_safe) %>");*/ sd_create_editor_from_data(<%= @message.id%>,null,"100%", "<%=@message.class.to_s%>"); }); }else if($("#reply_to_message_<%= @message.id%>").length >0) { diff --git a/app/views/users/_comment_reply_detail.html.erb b/app/views/users/_comment_reply_detail.html.erb index 4ced798d0..266a0b32b 100644 --- a/app/views/users/_comment_reply_detail.html.erb +++ b/app/views/users/_comment_reply_detail.html.erb @@ -1,9 +1,9 @@
-<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %> +<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "33", :height => "33"), user_path(comment.creator_user.id), :alt => "用户头像" %>
- <%= link_to comment.user.show_name, user_path(comment.user_id), :class => "content-username" %> + <%= link_to comment.creator_user.show_name, user_path(comment.creator_user.id), :class => "content-username" %> <%= time_from_now(comment.created_on) %> -
<%= comment.notes.html_safe %>
+
<%= comment.content_detail.html_safe %>
\ 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 d4db3df1f..70a7e6c7d 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -78,20 +78,18 @@
- <% count=0 %> - <% if activity.parent %> - <% count=activity.parent.children.count%> - <% else %> - <% count=activity.children.count%> - <% end %> + <% all_comments = []%> + <% count=get_all_children(all_comments, activity).count %> + <%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %> + <%# count = fetch_user_leaveWord_reply(activity).count %>
- <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> + <%= render :partial => 'users/message_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %> - <% activity= activity.parent ? activity.parent : activity%> - <% comments = activity.children.reorder("created_on desc").limit(3) %> - <% if count > 0 %> + <% all_comments = []%> + <% comments = get_all_children(all_comments, activity)[0..2] %> + <% if count > 0 %>
- <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%> + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id, :is_course => is_course, :is_board =>is_board}%>
<% end %> diff --git a/app/views/users/_message_contents.html.erb b/app/views/users/_message_contents.html.erb new file mode 100644 index 000000000..eab125006 --- /dev/null +++ b/app/views/users/_message_contents.html.erb @@ -0,0 +1,23 @@ +<% parents_rely = [] %> +<% parents_rely = get_reply_parents_no_root parents_rely, comment %> +<% length = parents_rely.length %> +
+ <% if length <= 3 %> + <%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent} %> + <% else %> +
+
+
+ <%=render :partial => 'users/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %> +
+ <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %> +
+
+ + + <%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %> +
+ <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %> +
+ <% end %> +
\ No newline at end of file diff --git a/app/views/users/_message_replies.html.erb b/app/views/users/_message_replies.html.erb new file mode 100644 index 000000000..c6f9d91b0 --- /dev/null +++ b/app/views/users/_message_replies.html.erb @@ -0,0 +1,61 @@ +
    + <% comments.each do |comment| %> + +
  • +
    + <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %> +
    +
    +
    + <%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %> + <%= time_from_now(comment.created_on) %> +
    + <% if !comment.parent.nil? && !comment.parent.parent.nil? %> + <%= render :partial => 'users/message_contents', :locals => {:comment => comment}%> + <% end %> + <% if !comment.content_detail.blank? %> +
    + <%= comment.content_detail.html_safe %> +
    +
    +
    + + + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + + + <%= link_to( + l(:button_reply), + {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :is_course => is_course, :is_board => is_board}, + :remote => true, + :method => 'get', + :title => l(:button_reply)) %> + + + <% if comment.course_destroyable_by?(User.current) %> + <%= link_to( + l(:button_delete), + delete_board_message_path(comment,:board_id =>comment.board.id, :user_activity_id => user_activity_id, :activity_id => activity_id, :is_course => is_course, :is_board => is_board), + :method => :post, + :remote => true, + :class => 'fr mr20', + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete) + ) %> + <% end %> + +
    +
    +
    +

    + <% end %> +
    +
    +
  • + <% end %> +
\ No newline at end of file diff --git a/app/views/users/_message_reply_banner.html.erb b/app/views/users/_message_reply_banner.html.erb new file mode 100644 index 000000000..0c8cda379 --- /dev/null +++ b/app/views/users/_message_reply_banner.html.erb @@ -0,0 +1,18 @@ +
+
+ 回复 + ︿ + <%= count>0 ? "(#{count})" : "" %> + + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + +
+
<%#= format_date(activity.updated_on) %>
+ <%if count>3 %> + + <% 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 1abc36a31..d1bb99296 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -77,20 +77,18 @@
- <% count = 0 %> - <% if activity.parent %> - <% count=activity.parent.children.count%> - <% else %> - <% count=activity.children.count%> - <% end %> + <% all_comments = []%> + <% count=get_all_children(all_comments, activity).count %> + <%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %> + <%# count = fetch_user_leaveWord_reply(activity).count %>
- <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %> + <%= render :partial => 'users/message_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %> - <% activity= activity.parent_id.nil? ? activity : activity.parent %> - <% comments = activity.children.reorder("created_on desc").limit(3) %> + <% all_comments = []%> + <% comments = get_all_children(all_comments, activity)[0..2] %> <% if count > 0 %>
- <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%> + <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id, :is_course => is_course, :is_board =>is_board}%>
<% end %> diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb index 621b56fbd..8a2909ad4 100644 --- a/app/views/users/_reply_to.html.erb +++ b/app/views/users/_reply_to.html.erb @@ -16,7 +16,7 @@

<% end%> <% elsif @type == 'JournalsForMessage' %> - <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => reply.id}, :method => "post", :remote => true) do |f|%> + <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => reply.id}, :method => "post", :remote => true) do |f|%> <%= hidden_field_tag 'reference_id', params[:reference_id], :value => reply.id %> <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => reply.user.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => reply.id %> @@ -28,6 +28,22 @@
<% end%> + <% elsif @type == 'Message' %> + <%= form_for('new_form',:url => {:controller => 'messages', :action => 'reply', :id => reply.id, :board_id => reply.board.id}, :method => "post", :remote => true) do |f|%> + <%= hidden_field_tag 'is_course', params[:is_course], :value => @is_course %> + <%= hidden_field_tag 'is_board', params[:is_board], :value => @is_board %> + <%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %> + <%= hidden_field_tag 'reply_id', params[:reply_id], :value => reply.author.id %> + <%= hidden_field_tag 'activity_id',params[:activity_id],:value =>@activity_id %> + <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %> + +
+ + +
+

+ <% end%> <% end %>
diff --git a/app/views/users/all_journals.js.erb b/app/views/users/all_journals.js.erb index 6d227e93b..d03e13742 100644 --- a/app/views/users/all_journals.js.erb +++ b/app/views/users/all_journals.js.erb @@ -2,6 +2,8 @@ $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/homework_replies', :locals => {:comments => @journals, :is_in_course =>@is_in_course,:course_activity=>@course_activity, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id}) %>'); <% elsif params[:type] == 'JournalsForMessage' %> $('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/journal_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :allow_delete => @allow_delete, :activity_id =>params[:id].to_i}) %>'); +<% elsif params[:type] == 'Message' %> +$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id =>params[:id].to_i,:is_course => @is_course, :is_board => @is_board}) %>'); <% else %> $('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals}) %>'); <% end %> diff --git a/app/views/users/show_all_replies.js.erb b/app/views/users/show_all_replies.js.erb index 5f5ea6c3f..ae8803653 100644 --- a/app/views/users/show_all_replies.js.erb +++ b/app/views/users/show_all_replies.js.erb @@ -1,6 +1,8 @@ <% unless @comment.parent.nil? %> <% if params[:type] == 'JournalsForMessage' && (@comment.jour_type == 'Principal' || @comment.jour_type == 'Course') %> $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent})%>"); + <% elsif @comment.class.to_s == 'Message' %> + $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent})%>"); <% else %> $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent})%>"); <% end %> diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 016526512..91467cca4 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1374,6 +1374,41 @@ function expand_journal_reply(container, btnid, id, type, div_id, allow_delete) } } +function expand_message_reply(container, btnid, id, type, div_id, is_course, is_board) { + var target = $(container); + var btn = $(btnid); + if (btn.data('init') == '0') { + btn.data('init', 1); + $.get( + '/users/all_journals', + { + type: type, + id: id, + div_id: div_id, + is_course: is_course, + is_board: is_board + }, + function(data) { + + } + ); + btn.html('收起回复'); + //target.show(); + } else if(btn.data('init') == '1') { + btn.data('init', 3); + btn.html('展开更多'); + target.hide(); + target.eq(0).show(); + target.eq(1).show(); + target.eq(2).show(); + } + else { + btn.data('init', 1); + btn.html('收起回复'); + target.show(); + } +} + function expand_reply_homework(container, btnid, id, type, div_id, is_in_course, course_activity, user_activity_id) { var target = $(container); var btn = $(btnid); diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 96c9947b1..9f7aeeafc 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -190,7 +190,7 @@ a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;} .imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;} .homepagePostReplyDes {float:left; width:632px; margin-left:15px;} .homepagePostReplyPublisher {font-size:12px; color:#888888; margin-bottom:5px;} -.homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;} +.homepagePostReplyContent {font-size:12px; color:#484848; margin:3px 5px 12px 5px;} .homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 20px;} .homepagePostReplyContent ul li{list-style-type: disc;margin-left: 20px;} .homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;} @@ -1429,4 +1429,4 @@ a.pages-big{ width:50px;} .W300 {width:300px !important;} .W600{ width:600px;} -.syllabus_input {width: 290px; border: 1px solid #64bdd9; height: 30px;} +.syllabus_input {width: 290px; border: 1px solid #64bdd9; height: 30px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 7cfb7f9e0..154cda201 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -666,7 +666,7 @@ a.postReplyCancel:hover {color:#ffffff;} .homepagePostReplyPortrait {float:left; width:45px;} .homepagePostReplyDes {float:left; width:620px; margin-left:15px;} .homepagePostReplyPublisher {font-size:12px; color:#484848; margin-bottom:5px;} -.homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;} +.homepagePostReplyContent {font-size:12px; color:#484848; margin:3px 5px 12px 5px;} .homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 40px;} .homepagePostReplyContent ul li{list-style-type: disc;margin-left: 40px;} .homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;} @@ -1184,4 +1184,46 @@ a.shadowbox_news_all{ display:block; width:305px; height:40px; line-height:40px; .reply_iconup{ position:absolute; top:21px; left:13px; color:#d4d4d4; font-size:16px; background:#f1f1f1; line-height:13px;} /*20160622代码分析弹窗*/ -.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;} +.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;} + +/* 二级回复 */ +.clearfix:after { content:"."; display:block; height:0; visibility:hidden; clear:both; } +.clearfix { zoom:1; } +.clearit { clear:both; height:0; font-size:0; overflow:hidden; } +.comment_item{ width:720px; background-color:#f1f1f1; color:#888;} +.comment_top{ height:15px; border: 1px solid #e4e4e4; padding:10px; position:relative;} +.reply_iconup{ position:absolute; top:21px; left:13px; color:#d4d4d4; font-size:16px; background:#f1f1f1; line-height:13px;} +.fl{ float:left;} +.fr{ float:right;} +.comment_item_cont{ padding:15px; border-bottom:1px solid #e3e3e3;} +.J_Comment_Face img{ width:40px; height:40px; } +.t_content{ width:92%; margin-left:15px;} +a.content-username { color:#269ac9; font-size:14px; margin-right:15px;} +a.content-username:hover{ color:#297fb8;} +.orig_user img{width:32px; height:32px;} +.reply-right{ float:right; position:relative;} +.reply_iconup02{ position:absolute; top:16px; left:4px; color:#d4d4d4; font-size:16px; background:#f1f1f1; line-height:13px;} +.comment_orig_content{margin:10px 0; color:#999;} +.comment_orig_content .comment_orig_content{margin-top:0;} +.orig_cont{ border:solid 1px #F3DDB3; background:#FFFEF4; padding:4px;color:#999;margin-top:-1px;} +.orig_cont_sub{ border-top:0} +.orig_index{ float:right; color:#666; font-family:Arial; padding-right:5px;line-height:30px;} +.orig_user{ margin:10px 15px 10px 5px;} +.orig_user span{ color:#999; padding-right:5px;} +.orig_content{padding:5px 0px 5px 0px;line-height:24px; color:#333; } +.orig_right{ width:80%; margin-top:5px;} +a.comment_ding_link{ height:24px;line-height:24px;display:inline-block;padding-left:2px;vertical-align:middle; color:#333; } +a:hover.comment_ding_link{ color:#269ac9;} +.comment_ding_link span{display: inline-block;padding: 0 0px 0 8px;} +.comment_ding_link em{font-style: normal;font-family: arial;} +.comment_reply_link{ display:inline-block; width:50px; height:24px;line-height: 24px; vertical-align:middle;text-align: center;} +.comment_reply_link:link,.comment_reply_link:visited{color:#333;text-decoration: none;} +.comment_content{ color:#333;} +.t_txt{ margin-top:10px;} +.orig_reply_box{border-top:1px solid #e3e3e3; width:95%; padding:15px 0px 15px 25px;} +.orig_reply_box2{border-top:1px solid #e3e3e3; width:95%; padding:10px 25px 10px 0;} +.orig_textarea{width:90%; margin-bottom:10px;} +.orig_sub{ float:right; background-color:#269ac9; color:#fff; height:25px; line-height:25px; text-align:center; width:80px; border:none;} +.orig_sub:hover{ background:#297fb8;} +.orig_cont_hide{ text-align:center; width:624px; display:block; font-size:14px; color:#333; border-bottom:1px solid #F3DDB3; padding:8px 0;} +.orig_icon{ color:#888; margin-right:10px; font-size:14px; font-weight:bold;} From 0dd7ef4460b794fcd66f74f554a5e892e4015c5a Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 4 Jul 2016 14:45:50 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=B8=96=E5=AD=90=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E5=A4=8D=E6=95=B0=E4=B8=8E=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E4=B8=8D=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/boards_controller.rb | 4 +++- app/views/users/_course_boardlist.html.erb | 8 ++------ app/views/users/_project_boardlist.html.erb | 8 ++------ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 9a72bb4df..ceb63d7b0 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -125,7 +125,9 @@ class BoardsController < ApplicationController if @order.to_i == 2 @type = 2 @topics.each do |topic| - topic[:infocount] = get_praise_num(topic) + (topic.parent ? topic.parent.children.count : topic.children.count) + all_comments = [] + count=get_all_children(all_comments, topic).count + topic[:infocount] = get_praise_num(topic) + count if topic[:infocount] < 0 topic[:infocount] = 0 end diff --git a/app/views/users/_course_boardlist.html.erb b/app/views/users/_course_boardlist.html.erb index 5cb2c27a7..bdff80d33 100644 --- a/app/views/users/_course_boardlist.html.erb +++ b/app/views/users/_course_boardlist.html.erb @@ -46,12 +46,8 @@ 发帖人: <%=(u.try(:realname) != " " ? u.lastname + u.firstname : u.try(:login)) %> 更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %> - <% count=0 %> - <% if activity.parent %> - <% count=activity.parent.children.count%> - <% else %> - <% count=activity.children.count%> - <% end %> + <% all_comments = []%> + <% count=get_all_children(all_comments, activity).count %>

<%= count>0 ? "#{count}" : "0" %>回复|<%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %>

diff --git a/app/views/users/_project_boardlist.html.erb b/app/views/users/_project_boardlist.html.erb index fe7bc03f2..3ba0244d9 100644 --- a/app/views/users/_project_boardlist.html.erb +++ b/app/views/users/_project_boardlist.html.erb @@ -46,12 +46,8 @@ 发帖人:<%=(u.try(:realname) != " " ? u.lastname + u.firstname : u.try(:login)) %> 更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %> - <% count=0 %> - <% if activity.parent %> - <% count=activity.parent.children.count%> - <% else %> - <% count=activity.children.count%> - <% end %> + <% all_comments = []%> + <% count=get_all_children(all_comments, activity).count %>

<%= count>0 ? "#{count}" : "0" %>回复|<%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %>

From da19bbd3a0d043d4f8e0f30e01edcdb914efe108 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Tue, 5 Jul 2016 09:02:34 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E4=B8=8B?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B5=84=E6=96=99=E7=95=8C=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/school_controller.rb | 26 ++-- app/models/apply_add_schools.rb | 1 + app/views/my/_apply_add_school.html.erb | 187 ------------------------ app/views/my/account.html.erb | 185 ----------------------- public/javascripts/application.js | 186 +++++++++++++++++++++++ 5 files changed, 202 insertions(+), 383 deletions(-) diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 44f4378fe..dab752afb 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -155,47 +155,51 @@ class SchoolController < ApplicationController def apply_add_school data = {result:0,name:params[:name],school_id:0} - #0 成功 1参数错误 2名称已存在 + #0 成功 1参数错误 2名称已存在 3.失败 data[:result] = 0 #检验参数 if params[:name] == "" || params[:province] == "" || params[:city] == "" || params[:address] == "" data[:result] = 1 else - school_id = School.find_by_sql("select id from schools where name='#{params[:name]}'").first - if school_id + school = School.where("name = '#{params[:name]}'").first + if school data[:result] = 2 else school = School.new school.name = params[:name].strip school.pinyin = Pinyin.t(params[:name].strip, splitter: '') - school.save #status 0未处理 1通过 2拒绝 applyschool = ApplyAddSchools.new - applyschool.school_id = school.id + + #用belongs_to 可以一起存数据库 + applyschool.school = school applyschool.name = school.name applyschool.province = params[:province] applyschool.city = params[:city] applyschool.address = params[:address] applyschool.remarks = params[:remarks] - applyschool.save - data[:school_id] = school.id + if applyschool.save + data[:school_id] = school.id + else + data[:result] = 3 + end end end render :json =>data end def search_repeat_schoolname - status = 0 + status = 0 #没有重复的 name = params[:name] if name - school_id = School.find_by_sql("select id from schools where name='#{name}'").first + school = School.where("name = '#{name}'").first - if school_id - status = 1 + if school + status = 1 #有重复的 end end diff --git a/app/models/apply_add_schools.rb b/app/models/apply_add_schools.rb index 2082c0012..efa56e808 100644 --- a/app/models/apply_add_schools.rb +++ b/app/models/apply_add_schools.rb @@ -1,3 +1,4 @@ class ApplyAddSchools < ActiveRecord::Base attr_accessible :address, :city, :name, :province, :remarks, :school_id, :status + belongs_to :school end diff --git a/app/views/my/_apply_add_school.html.erb b/app/views/my/_apply_add_school.html.erb index 1449fa1f1..c7b08e305 100644 --- a/app/views/my/_apply_add_school.html.erb +++ b/app/views/my/_apply_add_school.html.erb @@ -120,193 +120,6 @@ }); } - function showcity(province, cityField) { - $("#provincenotice").hide(); - switch (province) { - case "北京" : - var cityOptions = new Array( - "东城", "西城", "朝阳", "丰台", "石景山", "海淀", "门头沟", - "房山", "通州", "顺义", "昌平", "大兴", "平谷", "怀柔", "密云", "延庆"); - break; - case "上海" : - var cityOptions = new Array( - "崇明", "黄浦", "卢湾", "徐汇", "长宁", "静安", "普陀", "闸北", "虹口", "杨浦", "闵行", - "宝山", "嘉定", "浦东", "金山", "松江", "青浦", "南汇", "奉贤"); - break; - case "广东" : - var cityOptions = new Array( - "广州", "深圳", "珠海", "东莞", "中山", "佛山", "惠州", "河源", "潮州", "江门", "揭阳", "茂名", - "梅州", "清远", "汕头", "汕尾", "韶关", "顺德", "阳江", "云浮", "湛江", "肇庆"); - break; - case "江苏" : - var cityOptions = new Array( - "南京", "常熟", "常州", "海门", "淮安", "江都", "江阴", "昆山", "连云港", "南通", - "启东", "沭阳", "宿迁", "苏州", "太仓", "泰州", "同里", "无锡", "徐州", "盐城", - "扬州", "宜兴", "仪征", "张家港", "镇江", "周庄"); - break; - case "重庆" : - var cityOptions = new Array( - "万州", "涪陵", "渝中", "大渡口", "江北", "沙坪坝", "九龙坡", "南岸", "北碚", "万盛", - "双挢", "渝北", "巴南", "黔江", "长寿", "綦江", "潼南", "铜梁", "大足", "荣昌", "壁山", - "梁平", "城口", "丰都", "垫江", "武隆", "忠县", "开县", "云阳", "奉节", "巫山", "巫溪", - "石柱", "秀山", "酉阳", "彭水", "江津", "合川", "永川", "南川"); - break; - case "安徽" : - var cityOptions = new Array( - "合肥", "安庆", "蚌埠", "亳州", "巢湖", "滁州", "阜阳", "贵池", "淮北", "淮化", "淮南", - "黄山", "九华山", "六安", "马鞍山", "宿州", "铜陵", "屯溪", "芜湖", "宣城"); - break; - case "福建" : - var cityOptions = new Array( - "福州", "厦门", "泉州", "漳州", "龙岩", "南平", "宁德", "莆田", "三明"); - break; - case "甘肃" : - var cityOptions = new Array( - "兰州", "白银", "定西", "敦煌", "甘南", "金昌", "酒泉", "临夏", "平凉", "天水", - "武都", "武威", "西峰", "张掖"); - break; - case "广西" : - var cityOptions = new Array( - "南宁", "百色", "北海", "桂林", "防城港", "贵港", "河池", "贺州", "柳州", "钦州", "梧州", "玉林"); - break; - case "贵州" : - var cityOptions = new Array( - "贵阳", "安顺", "毕节", "都匀", "凯里", "六盘水", "铜仁", "兴义", "玉屏", "遵义"); - break; - case "海南" : - var cityOptions = new Array( - "海口", "儋县", "陵水", "琼海", "三亚", "通什", "万宁"); - break; - case "河北" : - var cityOptions = new Array( - "石家庄", "保定", "北戴河", "沧州", "承德", "丰润", "邯郸", "衡水", "廊坊", "南戴河", "秦皇岛", - "唐山", "新城", "邢台", "张家口"); - break; - case "黑龙江" : - var cityOptions = new Array( - "哈尔滨", "北安", "大庆", "大兴安岭", "鹤岗", "黑河", "佳木斯", "鸡西", "牡丹江", "齐齐哈尔", - "七台河", "双鸭山", "绥化", "伊春"); - break; - case "河南" : - var cityOptions = new Array( - "郑州", "安阳", "鹤壁", "潢川", "焦作", "济源", "开封", "漯河", "洛阳", "南阳", "平顶山", - "濮阳", "三门峡", "商丘", "新乡", "信阳", "许昌", "周口", "驻马店"); - break; - case "香港" : - var cityOptions = new Array( - "香港", "九龙", "新界"); - break; - case "湖北" : - var cityOptions = new Array( - "武汉", "恩施", "鄂州", "黄冈", "黄石", "荆门", "荆州", "潜江", "十堰", "随州", "武穴", - "仙桃", "咸宁", "襄阳", "襄樊", "孝感", "宜昌"); - break; - case "湖南" : - var cityOptions = new Array( - "长沙", "常德", "郴州", "衡阳", "怀化", "吉首", "娄底", "邵阳", "湘潭", "益阳", "岳阳", - "永州", "张家界", "株洲"); - break; - case "江西" : - var cityOptions = new Array( - "南昌", "抚州", "赣州", "吉安", "景德镇", "井冈山", "九江", "庐山", "萍乡", - "上饶", "新余", "宜春", "鹰潭"); - break; - case "吉林" : - var cityOptions = new Array( - "长春", "吉林", "白城", "白山", "珲春", "辽源", "梅河", "四平", "松原", "通化", "延吉"); - break; - case "辽宁" : - var cityOptions = new Array( - "沈阳", "鞍山", "本溪", "朝阳", "大连", "丹东", "抚顺", "阜新", "葫芦岛", "锦州", - "辽阳", "盘锦", "铁岭", "营口"); - break; - case "澳门" : - var cityOptions = new Array("澳门"); - break; - case "内蒙古" : - var cityOptions = new Array( - "呼和浩特", "阿拉善盟", "包头", "赤峰", "东胜", "海拉尔", "集宁", "临河", "通辽", "乌海", - "乌兰浩特", "锡林浩特"); - break; - case "宁夏" : - var cityOptions = new Array( - "银川", "固源", "石嘴山", "吴忠"); - break; - case "青海" : - var cityOptions = new Array( - "西宁", "德令哈", "格尔木", "共和", "海东", "海晏", "玛沁", "同仁", "玉树"); - break; - case "山东" : - var cityOptions = new Array( - "济南", "滨州", "兖州", "德州", "东营", "菏泽", "济宁", "莱芜", "聊城", "临沂", - "蓬莱", "青岛", "曲阜", "日照", "泰安", "潍坊", "威海", "烟台", "枣庄", "淄博"); - break; - case "山西" : - var cityOptions = new Array( - "太原", "长治", "大同", "候马", "晋城", "离石", "临汾", "宁武", "朔州", "忻州", - "阳泉", "榆次", "运城"); - break; - case "陕西" : - var cityOptions = new Array( - "西安", "安康", "宝鸡", "汉中", "渭南", "商州", "绥德", "铜川", "咸阳", "延安", "榆林"); - break; - case "四川" : - var cityOptions = new Array( - "成都", "巴中", "达川", "德阳", "都江堰", "峨眉山", "涪陵", "广安", "广元", "九寨沟", - "康定", "乐山", "泸州", "马尔康", "绵阳", "眉山", "南充", "内江", "攀枝花", "遂宁", - "汶川", "西昌", "雅安", "宜宾", "自贡", "资阳"); - break; - case "台湾" : - var cityOptions = new Array( - "台北", "基隆", "台南", "台中", "高雄", "屏东", "南投", "云林", "新竹", "彰化", "苗栗", - "嘉义", "花莲", "桃园", "宜兰", "台东", "金门", "马祖", "澎湖"); - break; - case "天津" : - var cityOptions = new Array( - "天津", "和平", "东丽", "河东", "西青", "河西", "津南", "南开", "北辰", "河北", "武清", "红挢", - "塘沽", "汉沽", "大港", "宁河", "静海", "宝坻", "蓟县"); - break; - case "新疆" : - var cityOptions = new Array( - "乌鲁木齐", "阿克苏", "阿勒泰", "阿图什", "博乐", "昌吉", "东山", "哈密", "和田", "喀什", - "克拉玛依", "库车", "库尔勒", "奎屯", "石河子", "塔城", "吐鲁番", "伊宁"); - break; - case "西藏" : - var cityOptions = new Array( - "拉萨", "阿里", "昌都", "林芝", "那曲", "日喀则", "山南"); - break; - case "云南" : - var cityOptions = new Array( - "昆明", "大理", "保山", "楚雄", "大理", "东川", "个旧", "景洪", "开远", "临沧", "丽江", - "六库", "潞西", "曲靖", "思茅", "文山", "西双版纳", "玉溪", "中甸", "昭通"); - break; - case "浙江" : - var cityOptions = new Array( - "杭州", "安吉", "慈溪", "定海", "奉化", "海盐", "黄岩", "湖州", "嘉兴", "金华", "临安", - "临海", "丽水", "宁波", "瓯海", "平湖", "千岛湖", "衢州", "江山", "瑞安", "绍兴", "嵊州", - "台州", "温岭", "温州", "余姚", "舟山"); - break; - case "海外" : - var cityOptions = new Array( - "美国", "日本", "英国", "法国", "德国", "其他"); - break; - default: - var cityOptions = new Array(""); - break; - } - - cityField.options.length = 0; - for (var i = 0; i < cityOptions.length; i++) { - cityField.options[i] = new Option(cityOptions[i], cityOptions[i]); - /* - if (cityField.options[i].value==city) - { - //alert("here put City ok!"); - document.oblogform["city"].selectedIndex = i; - }*/ - } - } - function ifNameRepeat(){ //名称不能为空也不能重复 diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 589541c39..d356756c1 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -249,191 +249,6 @@ <% end %> \ No newline at end of file diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb index cc1404eb5..bddba3eee 100644 --- a/app/views/organizations/_org_activities.html.erb +++ b/app/views/organizations/_org_activities.html.erb @@ -46,7 +46,7 @@ <% end %> - <% if act.org_act_type == 'OrgDocumentComment' %> + <% if act.org_act_type == 'OrgDocumentComment' && act.org_act.organization.home_id != act.org_act.id %> <%= render :partial => 'show_org_document', :locals => {:document => act.org_act, :act => act, :flag => 2, :org_subfield_id => params[:org_subfield_id]} %> <% end %> <% end %> diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb index 5d06a7001..5c6f07bb1 100644 --- a/app/views/users/_user_activities.html.erb +++ b/app/views/users/_user_activities.html.erb @@ -93,7 +93,9 @@ <%# cache (act) do %> <% case user_activity.act_type.to_s %> <% when 'BlogComment' %> - <%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <% if !(act.blog.homepage_id and act.id == act.blog.homepage_id) %> + <%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %> + <% end %> <% end %> <%# end %> <% end %>