From f638dd6810eca5b95c541a3d042b78d42eb5c83f Mon Sep 17 00:00:00 2001 From: alanlong9278 <547533434@qq.com> Date: Fri, 8 May 2015 09:55:19 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=20Signed-off-by:=20alanlong9278=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/javascripts/course.js | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/public/javascripts/course.js b/public/javascripts/course.js index c0c761bfa..cc57279f0 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -527,3 +527,44 @@ function search_tag_attachment(url,tag_name,q,course_id,sort) } ); } + +// 课程讨论区 +function showhelpAndScrollToMessage(id, id1, count) { + $('#' + id).toggle(); + if(cookieget("repositories_visiable") == "true") + { + cookiesave("repositories_visiable", false,'','',''); + } + else + { + cookiesave("repositories_visiable", true,'','',''); + } + var information = $(id1); + var val = information.attr("value"); + if(val=="show_help") + { + $(id1).text("收起回复(" + count + ")" ); + information.attr("value", "hide_help"); + } + else + { + $(id1).text("展开回复(" + count + ")"); + information.attr("value", "show_help"); + } +} +function show_more_reply(contentid, id2, id3) { + $(contentid).toggleClass("course_description_none"); + var information = $(id2); + var arrow = $(id3); + var val = information.attr("value"); + if (val == "show_more") { + $(id2).text("[收起]"); + information.attr("value", "hide_more"); + arrow.attr("src", "/images/jiantouup.jpg") + } + else { + $(id2).text("[展开]"); + information.attr("value", "show_more"); + arrow.attr("src", "/images/jiantou.jpg") + } +} \ No newline at end of file From 65c2c43dcba98556c5b858dfc115de21df4ee39d Mon Sep 17 00:00:00 2001 From: alanlong9278 <547533434@qq.com> Date: Fri, 8 May 2015 10:09:01 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=B1=95=E5=BC=80=E6=94=B6=E8=B5=B7?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=20Signed-off-by:=20alanlong9278=20<547533434?= =?UTF-8?q?@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_show.html.erb | 5 +++-- app/views/boards/_project_show.html.erb | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 045ff90f3..3b14ee767 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -141,8 +141,9 @@ <% end %> -
展开回复(<%= topic.replies_count.to_s%>)
- + <%if replies_all.first %> +
展开回复(<%= topic.replies_count.to_s%>)
+ <% end %> <% end %> <% end %> diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index b4fb47976..aff39b0f3 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -144,8 +144,9 @@ <% end %> + <%if replies_all.first %>
展开回复(<%= topic.replies_count.to_s%>)
- + <% end %> <% end %> <% end %> From 39fe748da7c6bf0ddd560b4ef2142f6444c10bc0 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 8 May 2015 10:10:35 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E4=B8=BB=E9=A2=98=E3=80=81=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0=E5=86=85=E5=AE=B9=E8=BF=87=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_project_show.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index b4fb47976..a65efde02 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -37,14 +37,14 @@
<% author = topic.author.to_s + ":" %> <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> -

  <%= h(topic.subject) %>

+

  <%= h(topic.subject) %>

<% if topic.sticky? %> <%= l(:label_board_sticky)%> <% end %>
-

+

<%= topic.content %>

@@ -95,7 +95,7 @@

<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
-

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

+

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


<%= format_time(message.created_on) %> @@ -124,7 +124,7 @@
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
-

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

+

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


<%= format_time(message.created_on) %> From 087f46bf647f62c049c0954eb7dcb60864d91009 Mon Sep 17 00:00:00 2001 From: alanlong9278 <547533434@qq.com> Date: Fri, 8 May 2015 10:24:26 +0800 Subject: [PATCH 4/9] Signed-off-by: alanlong9278 <547533434@qq.com> --- app/views/boards/_project_show.html.erb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index e93690e73..add60aa7a 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -37,6 +37,18 @@
<% author = topic.author.to_s + ":" %> <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> + <%= link_to( + l(:button_edit), + {:action => 'edit', :id => @topic}, + :class => 'talk_edit fr' + ) if @message.editable_by?(User.current) %> + <%= link_to( + l(:button_delete), + {:action => 'destroy', :id => @topic}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'talk_edit fr' + ) if @message.destroyable_by?(User.current) %>

  <%= h(topic.subject) %>

<% if topic.sticky? %> <%= l(:label_board_sticky)%> From 5167cf374c2d6253513d6a6466c32349fe82422e Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 8 May 2015 10:56:02 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=B7=A6=E4=BE=A7=E6=96=B0=E5=BB=BA=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E4=BC=A0=E5=8F=82=E8=B7=B3=E5=85=A5=EF=BC=88?= =?UTF-8?q?JS=E5=AE=9E=E7=8E=B0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_project_show.html.erb | 2 +- app/views/layouts/_base_development_group.html.erb | 2 +- app/views/layouts/_base_friend_group.html.erb | 2 +- app/views/layouts/_base_research_team.html.erb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index a65efde02..7b4c23a07 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -22,7 +22,7 @@
-
+
    <%= render :partial => 'project_new_topic' %>
diff --git a/app/views/layouts/_base_development_group.html.erb b/app/views/layouts/_base_development_group.html.erb index 570bbd063..891fa9d94 100644 --- a/app/views/layouts/_base_development_group.html.erb +++ b/app/views/layouts/_base_development_group.html.erb @@ -23,7 +23,7 @@ (<%= @project.boards.first.topics.count %>) <% end %> <% if User.current.member_of?(@project) %> - <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %> + <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %> <% end %>
<% end%> diff --git a/app/views/layouts/_base_friend_group.html.erb b/app/views/layouts/_base_friend_group.html.erb index 16ccc09e5..71d375501 100644 --- a/app/views/layouts/_base_friend_group.html.erb +++ b/app/views/layouts/_base_friend_group.html.erb @@ -12,7 +12,7 @@ (<%= @project.boards.first.topics.count %>) <% end %> <% if User.current.member_of?(@project) %> - <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %> + <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %> <% end %>
<% end%> diff --git a/app/views/layouts/_base_research_team.html.erb b/app/views/layouts/_base_research_team.html.erb index 17bf65b15..3f942bc40 100644 --- a/app/views/layouts/_base_research_team.html.erb +++ b/app/views/layouts/_base_research_team.html.erb @@ -23,7 +23,7 @@ (<%= @project.boards.first.topics.count %>) <% end %> <% if User.current.member_of?(@project) %> - <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %> + <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %> <% end %>
<% end%> From 63351fc049b485c2c9a4f527db13e38c3d187272 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 8 May 2015 10:59:11 +0800 Subject: [PATCH 6/9] Signed-off-by: alan <547533434@qq.com> --- app/views/boards/_project_show.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index add60aa7a..205e2262a 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -39,12 +39,12 @@ <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> <%= link_to( l(:button_edit), - {:action => 'edit', :id => @topic}, + {:action => 'edit', :id => topic}, :class => 'talk_edit fr' ) if @message.editable_by?(User.current) %> <%= link_to( l(:button_delete), - {:action => 'destroy', :id => @topic}, + {:action => 'destroy', :id => topic}, :method => :post, :data => {:confirm => l(:text_are_you_sure)}, :class => 'talk_edit fr' From 30c6a71cbce57c9857d76e1808e2e985bf4d1366 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 8 May 2015 11:25:25 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=96=B0=E5=BB=BA?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA=E5=8C=BA=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_show.html.erb | 2 +- app/views/boards/_project_show.html.erb | 3 ++- app/views/layouts/base_courses.html.erb | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 3b14ee767..172f23b7d 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -16,7 +16,7 @@
-
+
    <%= render :partial => 'course_new' %>
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 62ab2d08d..8792ffd8c 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -58,7 +58,8 @@

<%= topic.content %> -

+

+

diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 2a26ff59f..8361c3874 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -133,7 +133,7 @@

<% end %> - +

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

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

  <%= h(topic.subject) %>

<% if topic.sticky? %> - <%= l(:label_board_sticky)%> + <%= l(:label_board_sticky)%> <% end %> @@ -59,6 +70,11 @@
+
+
    + <%= render :partial => 'edit',locals: {:topic => topic} %> +
+
<% reply = Message.new(:subject => "RE: #{@message.subject}")%> <% if !topic.locked? && authorize_for('messages', 'reply') %> diff --git a/app/views/boards/_edit.html.erb b/app/views/boards/_edit.html.erb new file mode 100644 index 000000000..c41f723de --- /dev/null +++ b/app/views/boards/_edit.html.erb @@ -0,0 +1,42 @@ + + <% if topic.project %> + <%#= board_breadcrumb(@message) %> + +
+
    + <%= form_for topic, { :as => :message, + :url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id}, + :html => {:multipart => true, + :id => 'message-form' + topic.id.to_s, + :method => :post} + } do |f| %> + <%= render :partial => 'form_project', + :locals => {:f => f, :replying => !topic.parent.nil?} %> + <%= l(:button_submit)%> + <%= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %> +
+
+ <% end %> +<% elsif topic.course %> + <%#= course_board_breadcrumb(@message) %> +
+
    + <%= form_for topic, { + :as => :message, + :url => {:controller => 'messages',:action => 'edit', :is_board => 'true',:id => topic.id, :board_id => topic.board_id}, + :html => {:multipart => true, + :id => 'message-form' + topic.id.to_s, + :method => :post} + } do |f| %> + <%= render :partial => 'form_course', + :locals => {:f => f, :replying => !topic.parent.nil?} %> + <%= l(:button_submit)%> + <%= link_to l(:button_cancel), board_message_url(topic.board,topic.root, :r => (topic.parent_id &&topic.id)), :class => "blue_btn grey_btn fl c_white" %> + + <% end %> +
+
+<% end %> + + +
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 62ab2d08d..124472f5c 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -29,29 +29,28 @@
- +

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

<% if @topics.any? %> <% @topics.each do |topic| %> -
+
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<% author = topic.author.to_s + ":" %> <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> - <%= link_to( - l(:button_edit), - {:action => 'edit', :id => topic}, - :class => 'talk_edit fr' - ) if @message.editable_by?(User.current) %> - <%= link_to( + <% if topic.editable_by?(User.current) %> + <%= l(:button_edit) %> + <% end %> + <%= link_to( l(:button_delete), - {:action => 'destroy', :id => topic}, + {: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' - ) if @message.destroyable_by?(User.current) %> + ) if topic.destroyable_by?(User.current) %>

  <%= h(topic.subject) %>

<% if topic.sticky? %> - <%= l(:label_board_sticky)%> + <%= l(:label_board_sticky)%> <% end %>
@@ -74,6 +73,12 @@
+ +
+
    + <%= render :partial => 'edit',locals: {:topic => topic} %> +
+
<% reply = Message.new(:subject => "RE: #{@message.subject}")%> <% if !topic.locked? && authorize_for('messages', 'reply') %> @@ -157,7 +162,7 @@
<%if replies_all.first %> - + <% end %> <% end %>
diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index fefe54b78..9faf07b9a 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -31,7 +31,10 @@ function show_newtalk() $("#about_newtalk").toggle(); } - +function show_newtalk1(id) +{ + $(id).toggle(); +} <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %> From 2d93cd4bdc921b8c08f011696d50999beb95140b Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 8 May 2015 13:33:18 +0800 Subject: [PATCH 9/9] Signed-off-by: alan <547533434@qq.com> --- app/views/boards/_course_show.html.erb | 18 ++++++++++-------- app/views/boards/_project_show.html.erb | 21 ++++++++++++--------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index adc064e1a..f05f9befd 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -37,21 +37,23 @@
<% author = topic.author.to_s + ":" %> <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> - <% if topic.course_editable_by?(User.current) %> - <%= l(:button_edit) %> + +

  <%= h(topic.subject) %>

+ <% if topic.editable_by?(User.current) %> + <%= l(:button_edit) %> + <% end %> + <% if topic.sticky? %> + <%= l(:label_board_sticky)%> <% 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' + :class => 'talk_edit fr', + :style => ' margin-right: 10px;' ) if topic.destroyable_by?(User.current) %> -

  <%= h(topic.subject) %>

- <% if topic.sticky? %> - <%= l(:label_board_sticky)%> - <% end %>
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 124472f5c..a9698f546 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -37,21 +37,24 @@
<% author = topic.author.to_s + ":" %> <%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %> - <% if topic.editable_by?(User.current) %> - <%= l(:button_edit) %> + +

  <%= h(topic.subject) %>

+ <% if topic.editable_by?(User.current) %> + <%= l(:button_edit) %> + <% end %> + <% if topic.sticky? %> + <%= l(:label_board_sticky)%> <% end %> - <%= link_to( + <%= 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' + :class => 'talk_edit fr', + :style => ' margin-right: 10px;' ) if topic.destroyable_by?(User.current) %> -

  <%= h(topic.subject) %>

- <% if topic.sticky? %> - <%= l(:label_board_sticky)%> - <% end %> +