From 73adf1844f79628f070f97cc60f15a7d3f41d42b Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Oct 2017 14:13:59 +0800 Subject: [PATCH 01/11] =?UTF-8?q?TPI=E8=AF=84=E8=AE=BA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 12 +- app/views/games/_game_show.html.erb | 6 +- .../games/_shixun_comment_block.html.erb | 26 ++- app/views/games/_shixun_comment_list.html.erb | 208 ++++++++++++++---- app/views/shixuns/_shixun_reply.html.erb | 8 + .../shixuns/_shixun_reply_detail.html.erb | 42 ++++ 6 files changed, 240 insertions(+), 62 deletions(-) create mode 100644 app/views/shixuns/_shixun_reply.html.erb create mode 100644 app/views/shixuns/_shixun_reply_detail.html.erb diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 2fb901d77..0ed9da3c5 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -769,13 +769,13 @@ class ShixunsController < ApplicationController end def shixun_discuss - @discusses = @shixun.discusses.where(:parent_id => nil).reorder("created_at desc") + @discusses = @shixun.discusses.reorder("created_at desc") @discusses_count = @discusses.count - @limit = 15 - @is_remote = true - @discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1 - @offset ||= @discusses_pages.offset - @discusses = paginateHelper @discusses, @limit + #@limit = 15 + #@is_remote = true + #@discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1 + # @offset ||= @discusses_pages.offset + #@discusses = paginateHelper @discusses, @limit #@game_challenge = params[:challenge_id].blank? ? Challenge.find(@discusses.challenge_id) : Challenge.find(params[:challenge_id]) @game_challenge = Challenge.find(params[:challenge_id].to_i) end diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 98e1391c5..5751bf232 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -81,12 +81,12 @@ + + + + +<% if false %> +
+
+
+
+ <% if @shixun.discusses.blank? %> + <%= render :partial => "welcome/no_data" %> + <% else %> + <% @discusses.each do |dis| %> +
+ <%= link_to image_tag(url_to_avatar(dis.user), :alt => "头像", :width => 35, :height => 35), user_path(dis.user),:class => "fl mt5", :target => '_blank' %> +
+

+ <%= link_to dis.user.show_name, user_path(dis.user), :class => "fl link-color-grey mr20" ,:style => "display: block" %> + <%= time_from_now dis.created_at %> + <% if dis.try(:challenge_id).present? %> + [第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关] + <% end %> + <%= render :partial => "discusses/dis_praise", :locals => {:discuss => dis} %> @@ -27,15 +138,15 @@ <% end %> -

-

<%= dis.content %>

+

+

<%= dis.content %>

-
- <% dis.children.each do |child| %> -
-

- 老师回复 - <%= time_from_now child.created_at %> +

+ <% dis.children.each do |child| %> +
+

+ 老师回复 + <%= time_from_now child.created_at %> <%= render :partial => "discusses/dis_praise", :locals => {:discuss => child} %> @@ -44,9 +155,9 @@ 删除 <% end %> -

-

<%= child.content %>

- -
-
- <% end %> +
+
+ <% end %> +
+
+ <% end %> + +
+
+
    + <%= pagination_links_full @discusses_pages, @discusses_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
+
<% end %> - -
-
-
    - <%= pagination_links_full @discusses_pages, @discusses_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> -
-
-
-
- <% end %> +
+ +
-
- - - +<% end %> \ No newline at end of file diff --git a/app/views/shixuns/_shixun_reply.html.erb b/app/views/shixuns/_shixun_reply.html.erb new file mode 100644 index 000000000..40d9244ba --- /dev/null +++ b/app/views/shixuns/_shixun_reply.html.erb @@ -0,0 +1,8 @@ +
+ <% unless comment.parent.nil? %> +
+ <%= render :partial => 'shixuns/shixun_reply', :locals => {:comment => comment.parent, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %> +
+ <% end %> + <%= render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => comment, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %> +
\ No newline at end of file diff --git a/app/views/shixuns/_shixun_reply_detail.html.erb b/app/views/shixuns/_shixun_reply_detail.html.erb new file mode 100644 index 000000000..20fe648d3 --- /dev/null +++ b/app/views/shixuns/_shixun_reply_detail.html.erb @@ -0,0 +1,42 @@ +
+ <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "32", :height => "32"), user_path(comment.creator_user), :target => "_blank", :alt => "用户头像" %> +
+ +
+
+
+ <%= comment.content_detail.html_safe %> +
+ + <%= link_to comment.creator_user.show_real_name, user_path(comment.creator_user), :class => "content-username hide fl" %> + <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %> +
+
+
+ <%= link_to('回复'.html_safe, + {:controller => 'users', + :action => 'reply_to_comment', + :reply_id => comment.id, + :type => type, + :user_activity_id => user_activity_id, + :parent_id => parent_id}, + :remote => true, + :method => 'get',:class=>"color-grey", + :title => l(:button_reply)) %>| + + <%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + +
+
+
+ +
+ +
+
+
\ No newline at end of file From 26de87d603596a723fd92988fea0adf535a124d6 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Oct 2017 14:34:33 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E7=82=B9=E5=87=BB=E6=84=8F=E8=A7=81?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E5=BA=94=E8=AF=A5=E8=B7=B3=E8=BD=AC=E5=88=B0?= =?UTF-8?q?=E7=BB=99Educoder=E7=95=99=E8=A8=80=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index ab4313c78..98fe4b9ce 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -273,7 +273,7 @@
- +
From ce33efba30d7680e677c2cd2fe71424f5d345e04 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 9 Oct 2017 17:23:17 +0800 Subject: [PATCH 03/11] =?UTF-8?q?TPI=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/_game_show.html.erb | 4 +- .../games/_shixun_comment_block.html.erb | 2 +- app/views/games/_shixun_comment_list.html.erb | 51 ++++++++++--------- app/views/praise_tread/_edu_praise.html.erb | 4 +- app/views/shixuns/_shixun_reply.html.erb | 2 +- .../shixuns/_shixun_reply_detail.html.erb | 36 ++++++------- app/views/users/_reply_to_comment.html.erb | 2 +- public/stylesheets/css/edu-common.css | 2 +- 8 files changed, 53 insertions(+), 50 deletions(-) diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 5751bf232..c61c1dd2b 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -79,10 +79,10 @@
diff --git a/app/views/praise_tread/_edu_praise.html.erb b/app/views/praise_tread/_edu_praise.html.erb index 0704eebad..84a727c5c 100644 --- a/app/views/praise_tread/_edu_praise.html.erb +++ b/app/views/praise_tread/_edu_praise.html.erb @@ -6,7 +6,7 @@ 赞 <%# num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %> - <%= get_praise_num(activity) %> + <%= get_praise_num(activity)>0 ? get_praise_num(activity):"" %> <% else %> 赞 - <%= get_praise_num(activity) %> + <%= get_praise_num(activity)>0 ? get_praise_num(activity):"" %> <%# num = activity.praise_tread_cache ? activity.praise_tread_cache.praise_num : 0 %> diff --git a/app/views/shixuns/_shixun_reply.html.erb b/app/views/shixuns/_shixun_reply.html.erb index 40d9244ba..f1a8d28b3 100644 --- a/app/views/shixuns/_shixun_reply.html.erb +++ b/app/views/shixuns/_shixun_reply.html.erb @@ -1,4 +1,4 @@ -
+
<% unless comment.parent.nil? %>
<%= render :partial => 'shixuns/shixun_reply', :locals => {:comment => comment.parent, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %> diff --git a/app/views/shixuns/_shixun_reply_detail.html.erb b/app/views/shixuns/_shixun_reply_detail.html.erb index 20fe648d3..479e77279 100644 --- a/app/views/shixuns/_shixun_reply_detail.html.erb +++ b/app/views/shixuns/_shixun_reply_detail.html.erb @@ -8,33 +8,33 @@ });
-
+
<%= comment.content_detail.html_safe %>
- - <%= link_to comment.creator_user.show_real_name, user_path(comment.creator_user), :class => "content-username hide fl" %> - <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %> -
-
-
- <%= link_to('回复'.html_safe, - {:controller => 'users', - :action => 'reply_to_comment', - :reply_id => comment.id, - :type => type, - :user_activity_id => user_activity_id, - :parent_id => parent_id}, - :remote => true, - :method => 'get',:class=>"color-grey", - :title => l(:button_reply)) %>| +
+ <%= link_to comment.creator_user.show_real_name, user_path(comment.creator_user), :class => "content-username hide fl" %> + <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %> +
+
+ <%= link_to('回复'.html_safe, + {:controller => 'users', + :action => 'reply_to_comment', + :reply_id => comment.id, + :type => type, + :user_activity_id => user_activity_id, + :parent_id => parent_id}, + :remote => true, + :method => 'get',:class=>"color-grey", + :title => l(:button_reply)) %>| <%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> -
+
+
diff --git a/app/views/users/_reply_to_comment.html.erb b/app/views/users/_reply_to_comment.html.erb index 7449c1285..9ce1a439a 100644 --- a/app/views/users/_reply_to_comment.html.erb +++ b/app/views/users/_reply_to_comment.html.erb @@ -1,4 +1,4 @@ -
+
<% if User.current.logged? %>
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
diff --git a/public/stylesheets/css/edu-common.css b/public/stylesheets/css/edu-common.css index 30b12ad56..0fb798733 100644 --- a/public/stylesheets/css/edu-common.css +++ b/public/stylesheets/css/edu-common.css @@ -198,7 +198,7 @@ a.course-bth-blue{cursor: pointer;background-color:#199ed8 ;color: #ffffff !impo .break_word_firefox{white-space: pre-wrap !important;word-break: break-all;} .pre_word{white-space: pre-wrap;word-wrap: break-word;word-break: normal;} .pr {position:relative;} -.df {display:flex;} +.df {display:flex;display: -webkit-flex;display: -ms-flex;} .w100{width: 100px;} .w150{width: 150px;} .w200{width: 200px;} From 6eeaf998f41b39f55cf192e8e0af90db86aa5576 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 9 Oct 2017 17:30:35 +0800 Subject: [PATCH 04/11] =?UTF-8?q?html=E5=AE=9E=E8=AE=AD=EF=BC=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E8=AF=84=E6=B5=8B=E5=90=8E=EF=BC=8C=E8=BF=98=E6=98=AF?= =?UTF-8?q?=E4=B8=80=E7=89=87=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/_code_actions.html.erb | 5 ++++- public/javascripts/edu/edu_tpi.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/games/_code_actions.html.erb b/app/views/games/_code_actions.html.erb index 5dbeb1731..3866f42af 100644 --- a/app/views/games/_code_actions.html.erb +++ b/app/views/games/_code_actions.html.erb @@ -39,6 +39,7 @@ <% end %> // 渲染用户的HTML的CODE。 function tpi_html_show(){ + $($(".blacktab_con")[0]).trigger("click"); var contents = editor_CodeMirror.getValue(); $("#data_param").val(contents); $("#html_form").attr("action", "/iframes/html_content"); @@ -194,8 +195,10 @@ data.language, data.compile_success ); - $("#blacktab_nav_1").trigger("click"); if(data.status == 2){ + if(data.language == "Html"){ + tpi_html_show(); + } clearInterval(cm); clearInterval(intId); var icon = $("#game_status_<%= @game_challenge.id %>"); // 实训列表的icon diff --git a/public/javascripts/edu/edu_tpi.js b/public/javascripts/edu/edu_tpi.js index 4afdd76a5..0609d2608 100644 --- a/public/javascripts/edu/edu_tpi.js +++ b/public/javascripts/edu/edu_tpi.js @@ -167,6 +167,7 @@ function choice_answer(st, nThis){ // 评测区域点击TAB切换样式 function check_tab(allClassName,addClassName,item){ + console.log(editor_CodeMirror); //点击tab添加样式 $("."+allClassName).removeClass(addClassName); $(item).addClass(addClassName); From 0b08a7005b3f3567232e3a2dc51e506fee86bdb2 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Oct 2017 09:20:17 +0800 Subject: [PATCH 05/11] =?UTF-8?q?TPI=E8=AF=84=E8=AE=BA=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E5=B1=80=E9=83=A8=E5=88=B7=E6=96=B0=E6=A0=B7=E5=BC=8F=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/discusses/_dis_praise.html.erb | 4 ++-- app/views/praise_tread/praise_minus.js.erb | 2 +- app/views/praise_tread/praise_plus.js.erb | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/discusses/_dis_praise.html.erb b/app/views/discusses/_dis_praise.html.erb index 5cbb6c287..529ff0f81 100644 --- a/app/views/discusses/_dis_praise.html.erb +++ b/app/views/discusses/_dis_praise.html.erb @@ -2,14 +2,14 @@ - + 赞 <%= discuss.praise_tread_cache ? (discuss.praise_tread_cache.praise_num == 0 ? "" : discuss.praise_tread_cache.praise_num ) : "" %> <% else %> - + 赞 <%= discuss.praise_tread_cache ? (discuss.praise_tread_cache.praise_num == 0 ? "" : discuss.praise_tread_cache.praise_num ) : "" %> <% end %> \ No newline at end of file diff --git a/app/views/praise_tread/praise_minus.js.erb b/app/views/praise_tread/praise_minus.js.erb index 3b974fe5c..f9906e82d 100644 --- a/app/views/praise_tread/praise_minus.js.erb +++ b/app/views/praise_tread/praise_minus.js.erb @@ -8,7 +8,7 @@ <% elsif @type.to_s == 'Memo' %> $('#praise_count_<%= @obj.id %>').html('<%= j(render :partial => 'praise_tread/activity_praise', :locals => {:activity => @obj, :user_activity_id => @obj.id, :type => "Memo"})%>'); <% else @type.to_s == 'reply' %> - <% if ((@obj_type == 'JournalsForMessage' && @obj.jour_type == 'HomeworkCommon') || @obj_type == 'Message') && @obj_id == @user_activity_id %> + <% if ((@obj_type == 'JournalsForMessage' && @obj.jour_type == 'HomeworkCommon') || @obj_type == 'Message' || @obj_type == 'Discuss') && @obj_id == @user_activity_id %> $('.reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/edu_praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); <% else %> $('.reply_praise_count_<%=@obj_id %>').html('<%=j(render :partial=> "praise_tread/praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); diff --git a/app/views/praise_tread/praise_plus.js.erb b/app/views/praise_tread/praise_plus.js.erb index fe1c72c29..56af5cd45 100644 --- a/app/views/praise_tread/praise_plus.js.erb +++ b/app/views/praise_tread/praise_plus.js.erb @@ -12,6 +12,8 @@ $('.reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/edu_praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); <% elsif @obj_type == 'Memo' %> $('.reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/edu_praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); + <% elsif @obj_type == 'Discuss' %> + $('.reply_praise_count_<%=@user_activity_id %>').html('<%=j(render :partial=> "praise_tread/edu_praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); <% else %> $('.reply_praise_count_<%=@obj_id %>').html('<%=j(render :partial=> "praise_tread/praise", :locals => {:activity=>@obj, :user_activity_id=>@user_activity_id,:type=>"reply"})%>'); <% end %> From c1efa0778803813b044ccc3fba25b7afe0118a29 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Oct 2017 15:11:53 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E5=AE=9E=E8=AE=ADTPM=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=AF=84=E8=AE=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 7 +- app/views/games/_game_show.html.erb | 8 +- app/views/games/_shixun_comment_list.html.erb | 245 ++++++------------ app/views/layouts/base_shixun.html.erb | 5 +- app/views/shixuns/shixun_discuss.html.erb | 18 ++ app/views/shixuns/shixun_discuss.js.erb | 4 +- app/views/users/_reply_to.html.erb | 7 +- app/views/users/reply_to.js.erb | 6 +- 8 files changed, 124 insertions(+), 176 deletions(-) create mode 100644 app/views/shixuns/shixun_discuss.html.erb diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 0ed9da3c5..5fa2e541c 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -777,7 +777,12 @@ class ShixunsController < ApplicationController # @offset ||= @discusses_pages.offset #@discusses = paginateHelper @discusses, @limit #@game_challenge = params[:challenge_id].blank? ? Challenge.find(@discusses.challenge_id) : Challenge.find(params[:challenge_id]) - @game_challenge = Challenge.find(params[:challenge_id].to_i) + challenge_id = params[:challenge_id].nil? ? @shixun.challenges.first.try(:id) : params[:challenge_id].to_i + @game_challenge = Challenge.find(challenge_id) + respond_to do |format| + format.js + format.html + end end def destroy diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index c61c1dd2b..f47e82a37 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -74,7 +74,13 @@
diff --git a/app/views/games/_shixun_comment_list.html.erb b/app/views/games/_shixun_comment_list.html.erb index 40da83e39..7c49cbca2 100644 --- a/app/views/games/_shixun_comment_list.html.erb +++ b/app/views/games/_shixun_comment_list.html.erb @@ -1,104 +1,98 @@ <% no_children_comments = get_no_children_comments_all @discusses %> -
-
-
-
- <% if @discusses.blank? %> - <%= render :partial => "welcome/no_data" %> - <% else %> - <% no_children_comments.each do |comment| %> - <% unless comment.nil? %> - -
-
- <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 50, :height => 50, :alt => "用户头像"), user_url_in_org(comment.creator_user), :target => '_blank' %> -
-
-
-
- <% if !comment.parent.nil? %> - <% parents_rely = [] %> - <% parents_rely = get_reply_parents parents_rely, comment %> - <% length = parents_rely.length %> -
- <% if length <= 5 %> - <%=render :partial => 'shixuns/shixun_reply', :locals => {:comment => comment.parent, :parent_id => comment.id, :user_activity_id => @game_challenge.id, :type => @game_challenge.class.to_s} %> - <% else %> +
+ <% if @discusses.blank? %> + <%= render :partial => "welcome/no_data" %> + <% else %> + <% no_children_comments.each do |comment| %> + <% unless comment.nil? %> + +
+
+ <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 50, :height => 50, :alt => "用户头像"), user_url_in_org(comment.creator_user), :target => '_blank' %> +
+
+
+
+ <% if !comment.parent.nil? %> + <% parents_rely = [] %> + <% parents_rely = get_reply_parents parents_rely, comment %> + <% length = parents_rely.length %> +
+ <% if length <= 5 %> + <%=render :partial => 'shixuns/shixun_reply', :locals => {:comment => comment.parent, :parent_id => comment.id, :user_activity_id => @game_challenge.id, :type => @game_challenge.class.to_s} %> + <% else %> +
+
+
-
-
-
- <%=render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %> -
-
- - <%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class, :user_activity_id => @game_challenge.id, :parent_id => comment.id),:remote=>true, :class => '' %> -
- <%=render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => parents_rely[3], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %> -
- <%=render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => parents_rely[2], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %> -
- <%=render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => parents_rely[1], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %> + <%=render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %>
- <%=render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => parents_rely[0], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %> +
+ + <%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class, :user_activity_id => @game_challenge.id, :parent_id => comment.id),:remote=>true, :class => '' %> +
+ <%=render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => parents_rely[3], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %>
- <% end %> + <%=render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => parents_rely[2], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %> +
+ <%=render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => parents_rely[1], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %> +
+ <%=render :partial => 'shixuns/shixun_reply_detail', :locals => {:comment => parents_rely[0], :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id, :parent_id => comment.id} %>
<% end %> - -
-
<%= comment.content.html_safe %>
+
+ <% end %> + +
+
<%= comment.content.html_safe %>
-
-
- <%= link_to comment.creator_user.show_real_name, user_url_in_org(comment.creator_user), :class => "content-username hide fl" %> - <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %> -
-

- <% if comment.creator_user == User.current || User.current.admin? || User.current.manager_of_shixun?(comment.dis_id) %> - 删除 - <% end %> - | - <%= link_to( - '回复'.html_safe, - {:controller => 'users' ,:action => 'reply_to',:reply_id => comment.id, :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id}, - :remote => true, - :method => 'get', - :title => l(:button_reply),:class => "color-grey") %> - | +

+
+ <%= link_to comment.creator_user.show_real_name, user_url_in_org(comment.creator_user), :class => "content-username hide fl" %> + <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %> +
+

+ <% if comment.creator_user == User.current || User.current.admin? || User.current.manager_of_shixun?(comment.dis_id) %> + 删除 + <% end %> + | + <%= link_to( + '回复'.html_safe, + {:controller => 'users' ,:action => 'reply_to',:reply_id => comment.id, :type => @game_challenge.class.to_s, :user_activity_id => @game_challenge.id}, + :remote => true, + :method => 'get', + :title => l(:button_reply),:class => "color-grey" + ) %> + | <%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> -

-
- -
-
-
-
-
- -
+

+
+
+
+
- -
-
+
- <% end %> - <% end %> - <% end %> -
-
-
+
+
+
+
+ <% end %> + <% end %> + <% end %>
+ -<% if false %> -
-
-
-
- <% if @shixun.discusses.blank? %> - <%= render :partial => "welcome/no_data" %> - <% else %> - <% @discusses.each do |dis| %> -
- <%= link_to image_tag(url_to_avatar(dis.user), :alt => "头像", :width => 35, :height => 35), user_path(dis.user),:class => "fl mt5", :target => '_blank' %> -
-

- <%= link_to dis.user.show_name, user_path(dis.user), :class => "fl link-color-grey mr20" ,:style => "display: block" %> - <%= time_from_now dis.created_at %> - <% if dis.try(:challenge_id).present? %> - [第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关] - <% end %> - - <%= render :partial => "discusses/dis_praise", :locals => {:discuss => dis} %> - - - <% if User.current.manager_of_shixun?(@shixun) && dis.children.count == 0 %> - 回复 - <% end %> - <% if (User.current.manager_of_shixun?(@shixun) || User.current == dis.user) && dis.children.count == 0 %> - 删除 - <% end %> - -

-

<%= dis.content %>

- -
- <% dis.children.each do |child| %> -
-

- 老师回复 - <%= time_from_now child.created_at %> - - <%= render :partial => "discusses/dis_praise", :locals => {:discuss => child} %> - - - <% if User.current.manager_of_shixun?(@shixun) || (User.current == dis.user && dis.children.count == 0) %> - 删除 - <% end %> - -

-

<%= child.content %>

- -
-
- <% end %> -
-
- <% end %> - -
-
-
    - <%= pagination_links_full @discusses_pages, @discusses_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> -
-
-
-
- <% end %> -
- -
-
-
-<% end %> - - \ No newline at end of file diff --git a/app/views/shixuns/shixun_discuss.js.erb b/app/views/shixuns/shixun_discuss.js.erb index 81a34c89f..39af37924 100644 --- a/app/views/shixuns/shixun_discuss.js.erb +++ b/app/views/shixuns/shixun_discuss.js.erb @@ -2,7 +2,9 @@ $("#shixun_comment_block").replaceWith("<%= j(render :partial => "games/shixun_c $(".-tab-nav li").removeClass("tab_hover"); $('#tab_nav_4').addClass("tab_hover"); $(".tab-info").hide(); -$('#tab_con_4').show().html("<%= j(render :partial => "games/shixun_comment_list") %>"); +$('#tab_con_4').show(); +$("#game_comment_show").html("<%= j(render :partial => "games/shixun_comment_list") %>"); + <% if @discusses_count > 0 %> $("#discusses_count").html("<%= @discusses_count %>"); <% end %> diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb index 2c4a7b6cc..b9e01a157 100644 --- a/app/views/users/_reply_to.html.erb +++ b/app/views/users/_reply_to.html.erb @@ -109,7 +109,7 @@

<% end%> - <% else @type == 'Memo' %> + <% else %> <%= form_for('discuss', :url => {:controller => 'discusses', :action => 'create', :dis_id => reply.dis_id, :dis_type => "Shixun", :challenge_id => reply.try(:challenge_id)}, :method => "post", :remote => true, :html => {:id => 'new_comment_form'}) do |f| %>
@@ -117,7 +117,8 @@ 发送

- <% end%> <% end %> + <% end%> + <% end %>
@@ -125,4 +126,4 @@ <%= render :partial => "users/show_unlogged_reply" %> <% end %>
-
\ No newline at end of file +
diff --git a/app/views/users/reply_to.js.erb b/app/views/users/reply_to.js.erb index 00bceece4..81f588d25 100644 --- a/app/views/users/reply_to.js.erb +++ b/app/views/users/reply_to.js.erb @@ -1,13 +1,13 @@ if($("#reply_message_<%= @reply.id%>").html() == "") { $(".reply_to_message").html(""); <% if params[:is_project] %> - $("#reply_message_<%= @reply.id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/reply_to', :locals => {:reply => @reply}) %>"); + $("#reply_message_<%= @reply.id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/reply_to', :locals => {:reply => @reply}) %>"); <% else %> - $("#reply_message_<%= @reply.id%>").html("<%= escape_javascript(render :partial => 'users/reply_to', :locals => {:reply => @reply}) %>"); + $("#reply_message_<%= @reply.id%>").html("<%= escape_javascript(render :partial => 'users/reply_to', :locals => {:reply => @reply}) %>"); <% end %> $("#reply_iconup_<%=@reply.id %>").show(); $(function(){ - sd_create_editor_from_data(<%= @reply.id%>,null,"100%", "<%=@reply.class.to_s%>"); + sd_create_editor_from_data(<%= @reply.id%>,null,"100%", "<%= @reply.class.to_s%>"); }); }else { $("#reply_message_<%= @reply.id%>").html(""); From 8a88006e69c835572da86e4a3b42666105b6a3d0 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 10 Oct 2017 15:24:13 +0800 Subject: [PATCH 07/11] =?UTF-8?q?TPI=20and=20TPM=20=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/shixuns/_shixun_reply.html.erb | 2 +- .../shixuns/_shixun_reply_detail.html.erb | 78 ++++++++++--------- 2 files changed, 41 insertions(+), 39 deletions(-) diff --git a/app/views/shixuns/_shixun_reply.html.erb b/app/views/shixuns/_shixun_reply.html.erb index f1a8d28b3..40d9244ba 100644 --- a/app/views/shixuns/_shixun_reply.html.erb +++ b/app/views/shixuns/_shixun_reply.html.erb @@ -1,4 +1,4 @@ -
+
<% unless comment.parent.nil? %>
<%= render :partial => 'shixuns/shixun_reply', :locals => {:comment => comment.parent, :parent_id => parent_id, :type => type, :user_activity_id => user_activity_id} %> diff --git a/app/views/shixuns/_shixun_reply_detail.html.erb b/app/views/shixuns/_shixun_reply_detail.html.erb index 479e77279..57bd65674 100644 --- a/app/views/shixuns/_shixun_reply_detail.html.erb +++ b/app/views/shixuns/_shixun_reply_detail.html.erb @@ -1,42 +1,44 @@ -
- <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "32", :height => "32"), user_path(comment.creator_user), :target => "_blank", :alt => "用户头像" %> -
- -
-
-
- <%= comment.content_detail.html_safe %> +
+
+ <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "32", :height => "32"), user_path(comment.creator_user), :target => "_blank", :alt => "用户头像" %>
-
- <%= link_to comment.creator_user.show_real_name, user_path(comment.creator_user), :class => "content-username hide fl" %> - <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %> -
-
- <%= link_to('回复'.html_safe, - {:controller => 'users', - :action => 'reply_to_comment', - :reply_id => comment.id, - :type => type, - :user_activity_id => user_activity_id, - :parent_id => parent_id}, - :remote => true, - :method => 'get',:class=>"color-grey", - :title => l(:button_reply)) %>| - - <%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> - + +
+
+
+ <%= comment.content_detail.html_safe %> +
+
+ <%= link_to comment.creator_user.show_real_name, user_path(comment.creator_user), :class => "content-username hide fl" %> + <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %> +
+
+ <%= link_to('回复'.html_safe, + {:controller => 'users', + :action => 'reply_to_comment', + :reply_id => comment.id, + :type => type, + :user_activity_id => user_activity_id, + :parent_id => parent_id}, + :remote => true, + :method => 'get',:class=>"color-grey", + :title => l(:button_reply)) %>| + + <%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + +
+
+ +
+ +
- - -
- -
-
-
\ No newline at end of file +
+
\ No newline at end of file From 091ee1e352cca703423c7f0bdb474dbd70e49962 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Oct 2017 17:05:00 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E5=90=84=E7=A7=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=88=E6=97=A0=E6=9D=83=E9=99=90=E7=AD=89?= =?UTF-8?q?=EF=BC=89=E7=9A=84=E7=94=A8=E6=88=B7=E5=8F=8D=E9=A6=88=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E8=AE=BA=E5=9D=9B=E4=B8=AD=E7=9A=84=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E6=96=87=E5=AD=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/commons/zh.yml | 2 +- db/migrate/20171011084944_modify_content_for_memos.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20171011084944_modify_content_for_memos.rb diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index 001cfec7a..c7d9c5121 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -367,7 +367,7 @@ zh: label_feedback_tips: "在此输入对平台的问题和建议,您也可以通过QQ、微信留言,谢谢!" label_technical_support: "QQ 在线支持:" label_feedback_success: "您的意见已经反馈到公共贴吧的新手讨论吧,我们会第一时间解决您的问题,谢谢支持!" - label_feedback_value: "该帖来自用户反馈:)" + label_feedback_value: "来自用户反馈" label_email_feedback_tips: "请留下您的联系方式(注册邮箱除外),否则我们无法及时联系到您。请管理员尽快帮我解决邮箱激活问题" diff --git a/db/migrate/20171011084944_modify_content_for_memos.rb b/db/migrate/20171011084944_modify_content_for_memos.rb new file mode 100644 index 000000000..0ef42aa14 --- /dev/null +++ b/db/migrate/20171011084944_modify_content_for_memos.rb @@ -0,0 +1,10 @@ +#encoding: utf-8 +class ModifyContentForMemos < ActiveRecord::Migration + def up + memos = Memo.where("content like '该帖来自用户反馈%'") + memos.update_all(:content => "来自用户反馈") if memos.present? + end + + def down + end +end From c49b82d5142141bd3fb63837212f737575e32960 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 12 Oct 2017 16:40:35 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=9C=BA=E5=88=B6?= =?UTF-8?q?=E6=9C=AA=E4=B8=8A=E7=BA=BF=E4=B9=8B=E5=89=8D=EF=BC=8C=E8=AF=B7?= =?UTF-8?q?=E5=B0=86=E5=AE=9E=E8=AE=AD=E7=9A=84=E8=AF=84=E8=AE=BA=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E5=8F=91=E7=95=99=E8=A8=80=E7=9A=84=E5=BD=A2=E5=BC=8F?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/discusses_controller.rb | 33 ++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/app/controllers/discusses_controller.rb b/app/controllers/discusses_controller.rb index 37f3bb165..e434eaef9 100644 --- a/app/controllers/discusses_controller.rb +++ b/app/controllers/discusses_controller.rb @@ -1,3 +1,4 @@ +# encoding: utf-8 class DiscussesController < ApplicationController include ApplicationHelper before_filter :find_dis_object, :except => [:destroy] @@ -6,10 +7,40 @@ class DiscussesController < ApplicationController def create if @model if params[:reply_id].blank? + notes = User.current.show_name.to_s + " 评论了你发布的实训:#{params[:content]}" @model.discusses << Discuss.new(:content => params[:content], :user_id => User.current.id, :praise_count => 0, :challenge_id => params[:challenge_id]) + JournalsForMessage.create( + :jour_id => @model.user_id, + :jour_type => "Principal", + :user_id => User.current.id, + :reply_id => 0, + :is_readed => 0, + :private => 1, + :notes => notes + ) else - @model.discusses << Discuss.new(:content => params[:content], :user_id => User.current.id, :parent_id => params[:reply_id], :root_id => params[:reply_id], :praise_count => 0, :challenge_id => params[:challenge_id]) + notes = User.current.show_name.to_s + " 评论了你的回复:#{params[:content]}" + user_id = Discuss.find(params[:reply_id]).try(:user_id) + @model.discusses << Discuss.new( + :content => params[:content], + :user_id => User.current.id, + :parent_id => params[:reply_id], + :root_id => params[:reply_id], + :praise_count => 0, + :challenge_id => params[:challenge_id] + ) + JournalsForMessage.create( + :jour_id => user_id, + :jour_type => "Principal", + :user_id => User.current.id, + :reply_id => 0, + :is_readed => 0, + :private => 1, + :notes => notes + ) end + + if params[:dis_type] == "Shixun" redirect_to shixun_discuss_shixun_path(@model, :challenge_id => params[:challenge_id]) end From 24dda6a3c63a4572809c1986dbb33ffc86dce43f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 12 Oct 2017 16:41:38 +0800 Subject: [PATCH 10/11] =?UTF-8?q?TPI=E7=9A=84webssh=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/games/_repository.html.erb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/views/games/_repository.html.erb b/app/views/games/_repository.html.erb index 2faefaefa..f735604cc 100644 --- a/app/views/games/_repository.html.erb +++ b/app/views/games/_repository.html.erb @@ -54,11 +54,6 @@
<%= file_update_myshixun_game_path(@game, :myshixun_id => @myshixun, :path => @path) %>