From 0ef84d9691df297fe179756adfbc81c704f5eef5 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 8 Oct 2015 14:41:55 +0800 Subject: [PATCH 01/51] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E2=80=9C=E9=A1=B9=E7=9B=AE=E7=BC=BA=E9=99=B7=E2=80=9D?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E2=80=9C=E9=A1=B9=E7=9B=AE=E8=BF=9B=E5=B1=95?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 2c429a93f..9c0fce992 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -10,7 +10,7 @@ <% else %> <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.project.name.to_s+" | 项目缺陷", project_issues_path(activity.project), :class => "newsBlue ml15"%> + <%= link_to activity.project.name.to_s+" | 项目进展", project_issues_path(activity.project), :class => "newsBlue ml15"%>
<%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> From c5133997faa3de250ca7abb83f555378ae909c03 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 9 Oct 2015 08:42:18 +0800 Subject: [PATCH 02/51] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E9=A1=B9=E7=9B=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_issue.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb index 9c0fce992..02d1940a6 100644 --- a/app/views/users/_project_issue.html.erb +++ b/app/views/users/_project_issue.html.erb @@ -10,7 +10,7 @@ <% else %> <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <% end %> TO - <%= link_to activity.project.name.to_s+" | 项目进展", project_issues_path(activity.project), :class => "newsBlue ml15"%> + <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%>
<%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %> From 0f6ea4779278965fbb80e6e292d92171a9052d94 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 9 Oct 2015 14:39:40 +0800 Subject: [PATCH 03/51] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E7=9A=84=E5=88=97=E8=A1=A8=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 2 + app/views/boards/_course_show.html.erb | 382 +++++------------------ app/views/messages/_course_show.html.erb | 241 +++++++------- app/views/users/_course_message.html.erb | 4 +- public/stylesheets/courses.css | 32 ++ 5 files changed, 251 insertions(+), 410 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 4f3f3ec0d..4f78d61f5 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -37,6 +37,7 @@ class MessagesController < ApplicationController # Show a topic and its replies def show +=begin if @course topic_id = params[:r]?params[:r]:params[:id] parent_id = params[:id] @@ -44,6 +45,7 @@ class MessagesController < ApplicationController redirect_to url return; end +=end @isReply = true page = params[:page] diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index db174f30e..1dd8c655a 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,313 +1,91 @@ -
-
-

+<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %> + + +
+
+
<% if User.current.language == "zh"%> <%= h @board.name %> <% else %> <%= l(:project_module_boards) %> <% end %> - -

- <% if User.current.logged? %> - <%= l(:label_message_new) %> - <% end %> -
-
-
-
- -
-
- -
- -<% if !User.current.logged?%> -
- <%= l(:label_user_login_course_board) %> - <%= link_to l(:label_user_login_new), signin_path %> -
-<% end %> -

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

-<% if @topics.any? %> - <% @topics.each do |topic| %> -
- <%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %> -
- <% author = topic.author.to_s %> -
- <%= link_to User.current.member_of_course?(@board.course) ? "#{topic.author.show_name}(#{topic.author.login})" : "#{topic.author}" , user_path(topic.author), - :class =>"talkmain_name fl f14",:title=>author, - :style=>'max-width:120px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %> -
-

  :

+
-

  <%= h(topic.subject) %>

- <% if topic.course_editable_by?(User.current) %> - <%= l(:button_edit) %> - <% end %> - - <%= link_to(l(:button_delete), {:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'talk_edit fr', - :style => ' margin-right: 10px;') if topic.destroyable_by?(User.current) %> - - <% if topic.sticky? %> - <%= l(:label_board_sticky)%> - <% end %> -
- - -
-
- <%= topic.content.html_safe %> - -
-
+ + <% if topic %> + <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %> + <% end %> + <% end %> + <% end %> + -
- -
- <%= format_time(message.created_on) %> - <%= link_to( - - l(:button_delete), - {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete), - :class => ' linkBlue fr f12' - ) if message.course_destroyable_by?(User.current) %> - <%= link_to( - l(:button_reply), - 'javascript:;', - :nhname =>'showbtn_child_reply', - :class => ' linkBlue fr f12', - :style => 'margin-right: 10px;', - 'data-topic-id' =>message.id, - :title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %> -
-
- - - <% end %> - -
- <%if topic.replies_count>2 %> -
展开回复(<%= topic.replies_count.to_s%>)
- <% end %> - <% end %> - -
- - - <% end %> -<% else %> -

<%= l(:label_no_data) %>

-<% end %> - -<%# other_formats_links do |f| %> -<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> -<%# end %> - -<% html_title @board.name %> - -<% content_for :header_tags do %> - <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@course}: #{@board}") %> -<% end %> - -
- \ No newline at end of file + --> + \ No newline at end of file diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 2d433d969..6106ee912 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -1,117 +1,146 @@ -
-

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

-
+<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor","forum" %> + + + +
+
+
+ <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> +
+
+ <% if @topic.author.id == User.current.id%> +
+
    +
  • +
      +
    • + <%= link_to( + l(:button_edit), + {:action => 'edit', :id => @topic}, + :class => 'postOptionLink' + ) if @message.course_editable_by?(User.current) %> +
    • +
    • + <%= link_to( + l(:button_delete), + {:action => 'destroy', :id => @topic}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'postOptionLink' + ) if @message.course_destroyable_by?(User.current) %> +
    • +
    +
  • +
+
+ <%end%> + +
+ +
+ <%= link_to @topic.author.name, user_path(@topic.author), :class => "linkBlue2", :target=> "_blank"%>
+
<%= format_date( @topic.created_on)%>
+
+
+ <%= @topic.content.html_safe%> +
+
+
+ <%= link_to_attachments_course @topic, :author => false %> +
+
+
-
-

- <%= @topic.subject %> -

-
-

- 由<%= link_to_user_header @topic.author,false,:class=> 'problem_name' %> - 添加于<%= format_time(@topic.created_on) %> -

-
- <%= link_to( - l(:button_delete), - {:action => 'destroy', :id => @topic}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'talk_edit fr' - ) if @message.course_destroyable_by?(User.current) %> - <%= link_to( - l(:button_edit), - {:action => 'edit', :id => @topic}, - :class => 'talk_edit fr' - ) if @message.course_editable_by?(User.current) %>
-
<%= @topic.content.html_safe %>
-
<%= link_to_attachments_course @topic, :author => false %>
- -
- <% if User.current.logged? %> - <%= toggle_link l(:button_reply), "reply", :focus => 'message_subject',:class => 'talk_edit fr' %> - <% else %> - <%= link_to l(:button_reply), signin_path,:class => 'talk_edit fr' %> - <% end %> - <%= link_to( - l(:button_quote), - {:action => 'quote', :id => @topic}, - :remote => true, - :method => 'get', - :class => 'talk_edit fr', - :remote => true) if !@topic.locked? && authorize_for('messages', 'reply') %> -
-
-<% unless @replies.empty? %> - <% reply_count = 0 %> - <% @replies.each do |message| %> -
"> -
<%= link_to image_tag(url_to_avatar(message.author), :width => '46',:height => '46'), user_path(message.author) %>
-
-
- <%= link_to_user_header message.author,false,:class => 'c_blue fb fl mb10 ' %> - <%= format_time(message.created_on) %> -
-

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

- <%= link_to_attachments_course message, :author => false %> +
+ <% unless @replies.empty? %> +
+
回复(<%=@reply_count %>)
+
+
+ <% if @reply_count > 2%> + 点击展开更多回复 + <% end %> +
+
+
+ <% @replies.each_with_index do |reply,i| %> +
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
-
- <%= link_to( - l(:button_quote), - {:action => 'quote', :id => message}, - :remote => true, - :method => 'get', - :title => l(:button_quote)) if !@topic.locked? && authorize_for('messages', 'reply') %> - <%= link_to( - #image_tag('edit.png'), - l(:button_edit), - {:action => 'edit', :id => message}, - :title => l(:button_edit) - ) if message.course_editable_by?(User.current) %> - <%= link_to( - #image_tag('delete.png'), - l(:button_delete), - {:action => 'destroy', :id => message}, - :method => :post, - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete) - ) if message.course_destroyable_by?(User.current) %> +
+
<%= reply.author.name%><%= format_date(reply.created_on) %>
+
<%= reply.content.html_safe%>
-
-
- <% end %> -<% end %> -<% if !@topic.locked? && authorize_for_course('messages', 'reply') %> - -<% end %> -
-
    - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
-<% html_title @topic.subject %> + <% end %> +
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => @topic.id, :is_board => 'false'},:method => "post", :remote => true) do |f|%> + + +
+ +
+

+ <% end%> +
+
+
+
+
+
+
\ No newline at end of file diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 8ec605567..9ce308014 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -15,9 +15,9 @@
<% if activity.parent_id.nil? %> - <%= link_to activity.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.id, :topic_id => activity.id,:host=> Setting.host_course), :class=> "postGrey" %> + <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %> <% else %> - <%= link_to activity.parent.subject.to_s.html_safe, course_boards_path(activity.course,:parent_id =>activity.parent_id, :topic_id => activity.id,:host=> Setting.host_course), :class=> "postGrey"%> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%> <% end %>
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 328570345..81700a106 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1040,3 +1040,35 @@ a:hover.c_grey{ color:#333;} a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;} a.postOptionLink:hover {color:#ffffff; background-color:#15bccf;} +/*讨论区内部样式*/ +.postDetailContainer {padding:15px; border:1px solid #dddddd; background-color:#ffffff;} +.postlabel {background-color:#edf1f2; color:#888888; padding:2px 5px; float:left; margin-bottom:5px;} +.postRightContainer {width:718px; border:1px solid #dddddd; padding:15px; background-color:#ffffff; float:left; margin-bottom:10px;} +.postDetailBanner {height:30px; width:720px; border-bottom:1px solid #efefef;} +.postDetailRow {width:720px; border-bottom:1px solid #efefef; padding:15px 0;} +.postDetailPortrait {width:50px; height:50px; float:left; margin-right:15px;} +.postDetailWrap {width:580px; float:left;} +.postDetailTitle {width:580px; max-width:580px; margin-bottom:5px;} +.postDetailDes {width:580px; max-width:580px; margin-bottom:6px; color:#888888;display:block;overflow:hidden;word-break:keep-all;text-overflow:ellipsis;} +.postDetailDes p,div,em{word-break: break-all;word-wrap: break-word;} +.postDetailCreater {color:#888888; font-size:12px; float:left; margin-right:25px;} +.postDetailDate {color:#888888; font-size:12px; float:left;} +.postDetailReply { margin-top:28px; color:#888888; float:right;} +a.postReplyIcon {background:url(images/post_image_list.png) -40px 2px no-repeat; width:18px; height:18px; float:left;} +a.postReplyIcon:hover {background:url(images/post_image_list.png) -40px -29px no-repeat;} +.postDetailInput {width:713px; height:28px; border:1px solid #d9d9d9; outline:none !important;} +.postAttIcon {background:url(images/post_image_list.png) 0px -91px no-repeat; width:16px; height:16px; padding-left:20px;} +.postAttIcon:hover {background:url(images/post_image_list.png) 0px -113px no-repeat;} +.postThemeContainer {width:720px;} +.postThemeWrap {width:655px; float:left;position: relative} +.postLikeIcon {background:url(images/post_image_list.png) 0px -42px no-repeat ;float:right; padding-left:18px; margin-top:3px;} +.postLikeIcon:hover {background:url(images/post_image_list.png) 0px -64px no-repeat ;} +a.AnnexBtn{ background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; width:70px; height:20px; display:block; padding-left:20px; color:#888888;} +a:hover.AnnexBtn{background: url(images/homepage_icon2.png) -90px -343px no-repeat !important; color:#3598db;} +.postEdit {background:url(images/post_image_list.png) 0px -94px no-repeat; width:18px; height:18px; display:block; float:left;} +.postDelete {background:url(images/post_image_list.png) -42px -93px no-repeat; width:18px; height:18px; display:block; float:right;} +.pageBanner {width:968px; margin:0px auto; border:1px solid #dddddd; background-color: #FFF; padding: 10px 15px; float:left;} +.homepagePostReplyInput {width:543px; height:33px; max-width:543px; max-height:33px; border:1px solid #d9d9d9; outline:none;} +.postRouteContainer {padding:10px 15px; background-color:#ffffff; border:1px solid #dddddd; margin-top:10px; font-size:14px;} +a.postRouteLink {font-weight:bold; color:#484848;} +a.postRouteLink:hover {text-decoration:underline;} From ebb7ed1f1a1000b4265b54fcf6477b0bf5070e41 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 12 Oct 2015 17:19:55 +0800 Subject: [PATCH 04/51] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E5=8D=95?= =?UTF-8?q?=E4=B8=AA=E5=B8=96=E5=AD=90=E9=A1=B5=E9=9D=A2=E7=9A=84=E4=BA=8C?= =?UTF-8?q?=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/boards_controller.rb | 121 ++++++++++--------- app/views/boards/_course_show.html.erb | 28 ++--- app/views/boards/show.html.erb | 17 ++- app/views/boards/show.js.erb | 1 + app/views/messages/_course_show.html.erb | 75 +++++++++--- app/views/messages/_course_show_old.html.erb | 117 ++++++++++++++++++ app/views/messages/_form_course.html.erb | 28 +++-- app/views/messages/_reply_message.html.erb | 34 ++++++ app/views/messages/quote.js.erb | 12 +- config/routes.rb | 7 +- public/stylesheets/courses.css | 5 +- public/stylesheets/new_user.css | 2 +- public/stylesheets/public.css | 2 +- 13 files changed, 331 insertions(+), 118 deletions(-) create mode 100644 app/views/boards/show.js.erb create mode 100644 app/views/messages/_course_show_old.html.erb create mode 100644 app/views/messages/_reply_message.html.erb diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 434ea4470..62f39c04e 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -90,65 +90,66 @@ class BoardsController < ApplicationController end end end + + sort_init 'updated_on', 'desc' + sort_update 'created_on' => "#{Message.table_name}.created_on", + 'replies' => "#{Message.table_name}.replies_count", + 'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)" + + @topic_count = @board ? @board.topics.count : 0 + if @project + @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] + #现在发布帖子的时候置顶功能已经没有了。所以取消这个置顶排序 #{Message.table_name}.sticky DESC, + @topics = @board.topics. + reorder("#{Message.table_name}.created_on desc"). + includes(:last_reply). + limit(@topic_pages.per_page). + offset(@topic_pages.offset). + + preload(:author, {:last_reply => :author}). + all + elsif @course + # + # board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc"). + # includes(:last_reply). + # # limit(@topic_pages.per_page). + # # offset(@topic_pages.offset). + # + # preload(:author, {:last_reply => :author}). + # all : [] + # @topics = paginateHelper board_topics,10 + if (@board) + limit = 10; + #pageno = params[:page]; + #if(pageno == nil || pageno=='') + # dw_topic = nil; + # if( params[:parent_id]!=nil && params[:parent_id]!='' ) + # dw_topic = @board.topics.where(id:params[:parent_id]).first(); + # end + # if( dw_topic != nil ) + # dw_count = @board.topics.where('(sticky>?) or (sticky=? and created_on>?)',dw_topic.sticky,dw_topic.sticky,dw_topic.created_on).count(); + # dw_count = dw_count+1; + # pageno = dw_count%10==0 ? (dw_count/limit) : (dw_count/limit+1) + # end + #end + #if(pageno == nil || pageno=='') + # pageno=1; + #end + @topic_count = @board.topics.count(); + @topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10 + @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc"). + limit(limit).offset(@topic_pages).includes(:last_reply). + preload(:author, {:last_reply => :author}).all(); + else + @topics = []; + end + end + + @message = Message.new(:board => @board) + #modify by nwb respond_to do |format| format.js format.html { - sort_init 'updated_on', 'desc' - sort_update 'created_on' => "#{Message.table_name}.created_on", - 'replies' => "#{Message.table_name}.replies_count", - 'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)" - - @topic_count = @board ? @board.topics.count : 0 - if @project - @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] - #现在发布帖子的时候置顶功能已经没有了。所以取消这个置顶排序 #{Message.table_name}.sticky DESC, - @topics = @board.topics. - reorder("#{Message.table_name}.created_on desc"). - includes(:last_reply). - limit(@topic_pages.per_page). - offset(@topic_pages.offset). - - preload(:author, {:last_reply => :author}). - all - elsif @course - # - # board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc"). - # includes(:last_reply). - # # limit(@topic_pages.per_page). - # # offset(@topic_pages.offset). - # - # preload(:author, {:last_reply => :author}). - # all : [] - # @topics = paginateHelper board_topics,10 - if( @board ) - limit = 10; - pageno = params[:page]; - if(pageno == nil || pageno=='') - dw_topic = nil; - if( params[:parent_id]!=nil && params[:parent_id]!='' ) - dw_topic = @board.topics.where(id:params[:parent_id]).first(); - end - if( dw_topic != nil ) - dw_count = @board.topics.where('(sticky>?) or (sticky=? and created_on>?)',dw_topic.sticky,dw_topic.sticky,dw_topic.created_on).count(); - dw_count = dw_count+1; - pageno = dw_count%10==0 ? (dw_count/limit) : (dw_count/limit+1) - end - end - if(pageno == nil || pageno=='') - pageno=1; - end - @topic_count = @board.topics.count(); - @topic_pages = Paginator.new @topic_count, limit, pageno - @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc"). - limit(limit).offset(@topic_pages.offset).includes(:last_reply). - preload(:author, {:last_reply => :author}).all(); - else - @topics = []; - end - end - - @message = Message.new(:board => @board) - #modify by nwb if @project render :action => 'show', :layout => 'base_projects' elsif @course @@ -158,10 +159,10 @@ class BoardsController < ApplicationController } format.atom { @messages = @board.messages. - reorder('created_on DESC'). - includes(:author, :board). - limit(Setting.feeds_limit.to_i). - all + reorder('created_on DESC'). + includes(:author, :board). + limit(Setting.feeds_limit.to_i). + all if @project render_feed(@messages, :title => "#{@project}: #{@board}") elsif @course diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 1dd8c655a..871aa7e39 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -17,18 +17,9 @@ $("#Container").css("width","1000px"); }); -
-
-
- <% if User.current.language == "zh"%> - <%= h @board.name %> - <% else %> - <%= l(:project_module_boards) %> - <% end %> -
-
- <% @topics.each do |topic| if @topics %> + <% if topics%> + <% topics.each do |topic| %> diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index a9c0e9101..6005f9258 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -30,11 +30,20 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> <%#= javascript_include_tag "/assets/kindeditor/kindeditor-min" %> -<% if @project %> + + + <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %> -<% elsif @course %> - <%= render :partial => 'course_show', locals: {course: @course} %> -<% end %> + <% elsif @course %> +
+
+
+ 课程讨论区 +
+
+ <%= render :partial => 'course_show', :locals => {:topics => @topics, :page => 0} %> +
+ <% end %>
@@ -107,15 +88,15 @@
回复(<%=@reply_count %>)
-
- <% if @reply_count > 2%> - 点击展开更多回复 - <% end %> -
+
<% @replies.each_with_index do |reply,i| %> -
+
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
@@ -169,23 +150,5 @@
- -
\ No newline at end of file diff --git a/app/views/messages/_reply_message.html.erb b/app/views/messages/_reply_message.html.erb index 10fbee6e8..3e9550ee2 100644 --- a/app/views/messages/_reply_message.html.erb +++ b/app/views/messages/_reply_message.html.erb @@ -1,4 +1,3 @@ - - - -
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
- <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => reply.id,},:method => "post", :remote => true) do |f|%> + <%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %> diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb index 965c458e9..78ba0c142 100644 --- a/app/views/messages/quote.js.erb +++ b/app/views/messages/quote.js.erb @@ -6,7 +6,11 @@ $('#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");*/ -$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message,:temp =>@temp,:subject =>@subject}) %>"); -$(function(){ - init_activity_KindEditor_data(<%= @message.id%>,null,"87%"); -}); \ No newline at end of file +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}) %>"); + $(function(){ + init_activity_KindEditor_data(<%= @message.id%>,null,"85%"); + }); +}else if($("#reply_to_message_<%= @message.id%>").length >0) { + $("#reply_to_message_<%= @message.id%>").replaceWith("

"); +} \ No newline at end of file diff --git a/public/javascripts/init_activity_KindEditor.js b/public/javascripts/init_activity_KindEditor.js index decbbb341..db871e723 100644 --- a/public/javascripts/init_activity_KindEditor.js +++ b/public/javascripts/init_activity_KindEditor.js @@ -5,7 +5,7 @@ function init_editor(params){ var paramsWidth = params.width == undefined ? "100%" : params.width; var editor = params.kindutil.create(params.textarea, { - resizeType : 1,minWidth:"1px",width:"95%", + resizeType : 1,minWidth:"1px",width:"94%", height:"33px",// == undefined ? "30px":paramsHeight+"px", minHeight:"33px",// == undefined ? "30px":paramsHeight+"px", items:['emoticons'], @@ -25,7 +25,7 @@ function init_editor(params){ $('#reply_image_' + id).addClass('imageFuzzy'); if(/^\s*<\w*\s*\w*\=\"\w*\"\s*\w*\=\"\w*\:\s*\#\d*\;\s*\w*\-\w*\:\s*\w*\;\"\>[\u4e00-\u9fa5]*<\/\w*\>\s*$/.test(this.edit.html())){ params.submit_btn.hide(); - this.resize("95%", null); + this.resize("94%", null); }else if(edit.html().val().trim() != ""){ params.submit_btn.show(); } @@ -157,5 +157,6 @@ function init_activity_KindEditor_data(id){ }); }); - $(".ke-edit").css("height","33px"); + div_form = $("div[nhname='new_message_" + id + "']"); + $(".ke-edit", div_form).css("height","33px"); } \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 54416e7f4..2da36a991 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1074,4 +1074,4 @@ a.postRouteLink {font-weight:bold; color:#484848;} a.postRouteLink:hover {text-decoration:underline;} .ReplyToMessageContainer {border-bottom:1px solid #e3e3e3; width:632px; margin:0px auto; margin-top:15px; min-height:60px;} -.ReplyToMessageInputContainer {width:282px; float:left;} \ No newline at end of file +.ReplyToMessageInputContainer {width:582px; float:left;} \ No newline at end of file From 53a7b1dda423f587e011e8dc26375520b63af4f9 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 13 Oct 2015 11:03:56 +0800 Subject: [PATCH 06/51] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=8A=A8=E6=80=81=E6=8C=89=E6=9C=80=E5=90=8E=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/boards_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 62f39c04e..09a0fc342 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -137,7 +137,7 @@ class BoardsController < ApplicationController #end @topic_count = @board.topics.count(); @topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10 - @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc"). + @topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) desc"). limit(limit).offset(@topic_pages).includes(:last_reply). preload(:author, {:last_reply => :author}).all(); else From d006c2691b5eef53a4b4fca0d32c9386265cd429 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Tue, 13 Oct 2015 13:54:31 +0800 Subject: [PATCH 07/51] =?UTF-8?q?issue=E6=A8=A1=E5=9D=97=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=97=AE=E9=A2=98=E6=97=B6=EF=BC=8C=E7=BB=99?= =?UTF-8?q?=E5=87=BA=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF=E2=80=9C=E8=AF=B7?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E9=97=AE=E9=A2=98=E5=90=8D=E7=A7=B0=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/issues/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/issues/index.html.erb b/app/views/issues/index.html.erb index 670f5c51a..29c038226 100644 --- a/app/views/issues/index.html.erb +++ b/app/views/issues/index.html.erb @@ -47,7 +47,7 @@ <%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'true', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %> <%= hidden_field_tag 'set_filter', '1' %> From b9b7f6fa9e501e7d6b36070b83fab6358107068f Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 13 Oct 2015 16:51:44 +0800 Subject: [PATCH 08/51] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5?= =?UTF-8?q?=E7=95=99=E8=A8=80=E5=8A=A8=E6=80=81=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journals_for_message.rb | 6 ++ app/models/principal_activity.rb | 34 ++++++ app/models/user.rb | 6 ++ .../users/_course_journalsformessage.html.erb | 6 +- .../users/_user_journalsformessage.html.erb | 101 ++++++++++++++++++ ...51013081912_create_principal_activities.rb | 12 +++ db/schema.rb | 25 +++-- spec/factories/principal_activities.rb | 10 ++ spec/models/principal_activity_spec.rb | 5 + 9 files changed, 191 insertions(+), 14 deletions(-) create mode 100644 app/models/principal_activity.rb create mode 100644 app/views/users/_user_journalsformessage.html.erb create mode 100644 db/migrate/20151013081912_create_principal_activities.rb create mode 100644 spec/factories/principal_activities.rb create mode 100644 spec/models/principal_activity_spec.rb diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index dde34abfd..72ef9ee88 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -56,6 +56,7 @@ class JournalsForMessage < ActiveRecord::Base acts_as_attachable has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy + has_many :principal_acts, :class_name => 'PrincipalActivity',:as =>:principal_act ,:dependent => :destroy # 课程动态 has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # 消息关联 @@ -133,6 +134,11 @@ class JournalsForMessage < ActiveRecord::Base end end + #用户动态公共表记录 + def act_as_principal_activity + self.principal_acts << PrincipalActivity.new(:user_id => self.id,:principal_id => self.id) + end + def reset_counters! self.class.reset_counters!(self) end diff --git a/app/models/principal_activity.rb b/app/models/principal_activity.rb new file mode 100644 index 000000000..877492d91 --- /dev/null +++ b/app/models/principal_activity.rb @@ -0,0 +1,34 @@ +class PrincipalActivity < ActiveRecord::Base + attr_accessible :principal_act_id, :principal_act_type, :principal_id, :user_id + #虚拟关联 + belongs_to :principal_act ,:polymorphic => true + belongs_to :user + validates :user_id,presence: true + validates :principal_id,presence: true + validates :principal_act_id,presence: true + validates :principal_act_type, presence: true + has_many :user_acts, :class_name => 'UserAcivity',:as =>:act + after_save :add_user_activity + before_destroy :destroy_user_activity + + #在个人动态里面增加当前动态 + def add_user_activity + user_activity = UserActivity.where("act_type = '#{self.principal_act_type.to_s}' and act_id = '#{self.principal_act_id}'").first + if user_activity + user_activity.save + else + user_activity = UserActivity.new + user_activity.act_id = self.principal_act_id + user_activity.act_type = self.principal_act_type + user_activity.container_type = "Principal" + user_activity.container_id = self.principal_id + user_activity.user_id = self.user_id + user_activity.save + end + end + + def destroy_user_activity + user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'") + user_activity.destroy_all + end +end diff --git a/app/models/user.rb b/app/models/user.rb index 0ed8aeda0..e1dc45669 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -114,6 +114,7 @@ class User < Principal has_many :students_for_courses #has_many :courses, :through => :students_for_courses, :source => :project has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy + has_many :principal_acts, :class_name => 'PrincipalActivity',:as =>:principal_act ,:dependent => :destroy has_many :file_commit, :class_name => 'Attachment', :foreign_key => 'author_id', :conditions => "container_type = 'Project' or container_type = 'Version'" #### # added by bai @@ -1006,6 +1007,11 @@ class User < Principal self.acts << Activity.new(:user_id => self.id) end + #用户动态公共表记录 + def act_as_principal_activity + self.principal_acts << PrincipalActivity.new(:user_id => self.id,:principal_id => self.id) + end + # 注册用户的时候消息默认点击时间为用户创建时间 def add_onclick_time if OnclickTime.where("user_id =?" , self.id).first.nil? diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb index aab26c20b..ac4652a32 100644 --- a/app/views/users/_course_journalsformessage.html.erb +++ b/app/views/users/_course_journalsformessage.html.erb @@ -5,7 +5,7 @@
- <% if @ctivity.try(:user).try(:realname) == ' ' %> + <% if activity.try(:user).try(:realname) == ' ' %> <%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %> <% else %> <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %> @@ -30,7 +30,7 @@
-
+
回复(<%= count %>)
@@ -84,7 +84,7 @@ <% end %> <%= format_time reply.created_on %>
-
+
<%= reply.notes.html_safe %>
diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb new file mode 100644 index 000000000..1e925d7c4 --- /dev/null +++ b/app/views/users/_user_journalsformessage.html.erb @@ -0,0 +1,101 @@ +
+
+
+ <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> +
+
+
+ <% if activity.try(:user).try(:realname) == ' ' %> + <%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %> + <% else %> + <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %> + <% end %> TO + <% if @user.try(:realname) == ' '%> + <% name = @user.login.to_s %> + <% else %> + <% name = @user.try(:realname).to_s %> + <% end %> + <%= link_to name+"("+@user.login.to_s+")的留言", feedback_path(@user, :host=> Setting.host_user), :class => "newsBlue ml15" %> +
+
+ <% if activity.parent %> + <%= link_to activity.parent.notes.html_safe, feedback_path(@user, :host=> Setting.host_user), :class => "postGrey" %> + <% else %> + <%= link_to activity.notes.html_safe, feedback_path(@user, :host=> Setting.host_user), :class => "postGrey" %> + <% end %> +
+
+ 留言时间:<%= format_time(activity.created_on) %> +
+
+
+
+ <% count=fetch_user_leaveWord_reply(activity).count %> +
+
+
+
+ 回复(<%= count %>) +
+
+ <%if count>2 %> + + <% end %> +
+ + <% replies_all_i = 0 %> + <% if count > 0 %> +
+
    + <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %> + <% replies_all_i = replies_all_i + 1 %> +
  • +
    + <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %> +
    +
    +
    + <% if comment.try(:user).try(:realname) == ' ' %> + <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> + <% else %> + <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> + <% end %> + <%= format_time(comment.created_on) %> +
    +
    + <%= comment.notes.html_safe %>
    + <% end %> +
    +
    +
  • +
+
+ <% end %> + +
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id},:method => "post", :remote => true) do |f|%> + <%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %> + <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %> + <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %> + <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %> + <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> + +
+ +
+

+ <% end%> +
+
+
+
+
+
+
\ No newline at end of file diff --git a/db/migrate/20151013081912_create_principal_activities.rb b/db/migrate/20151013081912_create_principal_activities.rb new file mode 100644 index 000000000..f688ed807 --- /dev/null +++ b/db/migrate/20151013081912_create_principal_activities.rb @@ -0,0 +1,12 @@ +class CreatePrincipalActivities < ActiveRecord::Migration + def change + create_table :principal_activities do |t| + t.integer :user_id + t.integer :principal_id + t.integer :principal_act_id + t.string :principal_act_type + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index abc7017e6..b03813032 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150917022239) do +ActiveRecord::Schema.define(:version => 20151013081912) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -575,6 +575,8 @@ ActiveRecord::Schema.define(:version => 20150917022239) do t.integer "viewed" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.string "secret_key" + t.integer "status" end create_table "forums", :force => true do |t| @@ -783,16 +785,6 @@ ActiveRecord::Schema.define(:version => 20150917022239) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" @@ -911,6 +903,7 @@ ActiveRecord::Schema.define(:version => 20150917022239) do t.datetime "updated_on", :null => false t.boolean "locked", :default => false t.integer "sticky", :default => 0 + t.integer "reply_id" end add_index "messages", ["author_id"], :name => "index_messages_on_author_id" @@ -1093,6 +1086,15 @@ ActiveRecord::Schema.define(:version => 20150917022239) do t.datetime "updated_at", :null => false end + create_table "principal_activities", :force => true do |t| + t.integer "user_id" + t.integer "principal_id" + t.integer "principal_act_id" + t.string "principal_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "project_infos", :force => true do |t| t.integer "project_id" t.integer "user_id" @@ -1376,6 +1378,7 @@ ActiveRecord::Schema.define(:version => 20150917022239) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.text "description" + t.string "subject" end create_table "taggings", :force => true do |t| diff --git a/spec/factories/principal_activities.rb b/spec/factories/principal_activities.rb new file mode 100644 index 000000000..58e52fa17 --- /dev/null +++ b/spec/factories/principal_activities.rb @@ -0,0 +1,10 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :principal_activity do + user_id 1 + principal_id 1 + principal_act_id 1 + principal_act_type "MyString" + end +end diff --git a/spec/models/principal_activity_spec.rb b/spec/models/principal_activity_spec.rb new file mode 100644 index 000000000..3ae176e25 --- /dev/null +++ b/spec/models/principal_activity_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe PrincipalActivity, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 9eb498dbc4206d282f3974fea8df34eb387848cb Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 13 Oct 2015 17:05:47 +0800 Subject: [PATCH 09/51] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9B=AE=E5=BD=95=EF=BC=88=E6=9C=AA=E5=AE=8C=E6=88=90?= =?UTF-8?q?--=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 995c45e9b..5c1b54f92 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -255,11 +255,12 @@ update @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? g = Gitlab.client - # r = g.get("/users?search=#{user.mail}").first - # rr = g.trees(@project.id, @path) + project = g.project(11) + # rr = g.trees(project.id, @path) # r = g.get ("/projects/#{@project}/repository/tree") # :name, :path, :kind, :size, :lastrev, :changeset - @entries = @repository.entries(@path, @rev) + # @entries = @repository.entries(@path, @rev) + @entries = g.trees(project.id, @path) @changeset = @repository.find_changeset_by_name(@rev) #@project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT From 64ec4651268035e2405ad79fb896143e4361b9e5 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 14 Oct 2015 09:25:54 +0800 Subject: [PATCH 10/51] =?UTF-8?q?=E6=84=8F=E8=A7=81=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_new_feedback.html.erb | 2 +- public/images/blue_line.png | Bin 2819 -> 944 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/_new_feedback.html.erb b/app/views/layouts/_new_feedback.html.erb index 136e49b37..66d25a4b1 100644 --- a/app/views/layouts/_new_feedback.html.erb +++ b/app/views/layouts/_new_feedback.html.erb @@ -22,7 +22,7 @@ <% end %>
diff --git a/public/images/blue_line.png b/public/images/blue_line.png index 4ae87f34320f80b3839409e80f275f205369f5e8..b7654fb6aff5595d81b60c78a8f62b244400dbfa 100644 GIT binary patch literal 944 zcmaJ=J#W)M7`93VTB#Ca+l7OE`)gOU;CE>`P*$zB}v-b|Nv9 z1u?KN!oZ3c_yY_Koyy9_#xG!F=A0%e1HrO=A9|kWeeZprd);Y2+TPmR;y7;GKDAsn zzGL6U?G5%9Ke~twyR_M(T|A(fpFpl2;ywg+><^&}{c!s13f4I879V*%+H)T30geT~ zzzBIv7@Om2CpqzhF{GdmhY>RPUthlRAPNostm;S(G2tjWoh7h4YkR?L9B3hb@&MFw zoe9K{`XGHbo|f@zRMghm*FLecNz2{m|@>Gcs}vXVvVqD-t{V(t@B7Np`xOQ7TY9~#Fi zbV^-#lkY!;Q*TP3=)x3Fl7KaCuwR5Cx|u+q;>5%Fd|AcL2veMnFac&)1qWvl3UQVm z&hd_;+bE?z3ZQKnJW~*&DAeVaWU2Lf^H`A;S#DM}si8J4O>3B@)l${Ul562$5<^6n z-0+6mTFWi05EB;Jf=ToohOGq0V18shTAz!#R&T)#*XLrb<%%pBv1sgHjb3gs_Y~8W zZP{XFe2AFa6K3o0uQoGwCGOc)-OGRUz4w#17Z*PVpLQ<~cD_A)@%s>5Rrc;&ZgQm^ X?!%MP8*;ZaDDIHmY+IijPhb84Bm*If literal 2819 zcmV+e3;gtnP)KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C z05C~JK~#9!VietT{yzf)1H&t41BOvB3aAal_FiCMU|?Wi8V!n3Ko0-_009600{|>P V1*1Is;UEA2002ovPDHLkV1lWASCaq$ From 918c6f46ba46a51ca9d7e58e771c870415f2938b Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Wed, 14 Oct 2015 11:10:19 +0800 Subject: [PATCH 11/51] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=85=A8=E7=AB=99?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=87=BA=E7=8E=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_tag_yun.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index 41ae5f335..3d1ded552 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -1,4 +1,4 @@ -<% if course && tag_list.empty? == false%> +<% if course && tag_list && tag_list.empty? == false%> Date: Wed, 14 Oct 2015 11:34:23 +0800 Subject: [PATCH 12/51] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/_join_private_course.html.erb | 27 +++++++++++++------ app/views/courses/join_private_courses.js.erb | 2 +- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index 4cc8b9fbf..8e1e1c421 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -11,10 +11,10 @@ ul,li{ list-style-type:none} .cl{ clear:both; overflow:hidden; } a{ text-decoration:none; } - a:hover{ } + a:hover{} .alert_box {width:488px;height:550px;position:fixed;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; } - #popbox{width:488px;height:308px;} + #popbox{width:488px;height:368px;} .alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; } .C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px; } .C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;} @@ -22,12 +22,15 @@ .C_form{ margin:20px 0 0 60px;} .C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; } .C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; } - .C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:90px;} + .C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:97px;} .width190{ width:190px; height:26px; border-color:#e1e1e1;} .C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;} .C_form a:hover{ text-decoration:underline;} - .C_form a.btn{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#15bccf; color:#fff; font-size:14px; margin:20px 20px 0 95px;} - .C_form a.btn:hover{ background:#ff821d;} + .C_form a.btn_join{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#269ac9; color:#fff; font-size:14px; margin:20px 20px 0 95px;} + .C_form a.btn_join:hover{ background:#297fb8; text-decoration: none;} + .C_form a.btn_cancel{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#c1c1c1; color:#fff; font-size:14px; margin:20px 20px 0 95px;} + .C_form a.btn_cancel:hover{ background:#717171; text-decoration: none;} + .IDType {border:1px solid #e1e1e1; outline: none; width: 65px; height: 25px;} +
+
+
+ 编辑帖子 +
+
+ <%= render :partial => 'boards/course_new', + :locals => {:f => f, :edit_mode => edit_mode, :topic => topic} %> +
\ No newline at end of file diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index 61c774a95..9eb7e49ad 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -1,12 +1,66 @@ -<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<%= error_messages_for 'message' %> +
\ No newline at end of file diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index 783531027..ef16d0c23 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,79 +1,107 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %> +
+
+
+ 课程讨论区 +
+
+ <% if User.current.logged? %> + <%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, + :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> + <%= render :partial => 'course_new', :locals => {:f => f, :topic => @message, :edit_mode => false} %> + <% end %> + <% end %> + <% if topics%> - <% topics.each do |topic| %> - - <% if topic %> - <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %> - <% end %> + $('#reply_content_<%= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); + }); + + <% if topic %> + <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %> <% end %> + <% end %> - <% if topics.count == 10 %> -
展开更多<%= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %>
- <% end %> - <% end%> + <% if topics.count == 10 %> +
展开更多<%= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %>
+ <% end %> +<% end%> +
-
+
<%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
<% if @topic.author.id == User.current.id%> -
+
<% @replies.each_with_index do |reply,i| %> -
+
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
@@ -111,22 +111,24 @@
<%= reply.content.html_safe%>
- <%= format_date(reply.created_on) %> - <%= link_to( - l(:button_reply), - {:action => 'quote', :id => reply}, - :remote => true, - :method => 'get', - :class => 'fr newsBlue', - :title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %> - <%= link_to( - l(:button_delete), - {:action => 'destroy', :id => reply}, - :method => :post, - :class => 'fr newsGrey mr10', - :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete) - ) if reply.course_destroyable_by?(User.current) %> + <%= format_date(reply.created_on) %> +

diff --git a/app/views/messages/edit.html.erb b/app/views/messages/edit.html.erb index d30aee45d..0817594ab 100644 --- a/app/views/messages/edit.html.erb +++ b/app/views/messages/edit.html.erb @@ -1,45 +1,38 @@ -
-

<%= l(:label_course_board) %>

-
+<% if @message.project %> +
+

<%= l(:label_course_board) %>

+
+ - <% if @message.project %> <%#= board_breadcrumb(@message) %> - -
-
    - <%= form_for @message, { :as => :message, - :url => {:action => 'edit'}, - :html => {:multipart => true, - :id => 'message-form', - :method => :post} - } do |f| %> + +
    +
      + <%= form_for @message, {:as => :message, + :url => {:action => 'edit'}, + :html => {:multipart => true, + :id => 'message-form', + :method => :post} + } do |f| %> <%= render :partial => 'form_project', - :locals => {:f => f, :replying => !@message.parent.nil?} %> - <%= l(:button_submit)%> - <%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "blue_btn grey_btn fl c_white" %> -
    -
    - <% end %> + :locals => {:f => f, :replying => !@message.parent.nil?} %> + <%= l(:button_submit) %> + <%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "blue_btn grey_btn fl c_white" %> +
+
+ <% end %> <% elsif @message.course %> - <%#= course_board_breadcrumb(@message) %> -
-
    0 - <%= form_for @message, { - :as => :message, - :url => {:action => 'edit'}, - :html => {:multipart => true, - :id => 'message-form', - :method => :post} - } do |f| %> - <%= render :partial => 'form_course', - :locals => {:f => f, :replying => !@message.parent.nil?} %> - <%= l(:button_submit)%> - <%= link_to l(:button_cancel), board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id)), :class => "blue_btn grey_btn fl c_white" %> + <%= form_for @message, { + :as => :message, + :url => {:action => 'edit'}, + :html => {:multipart => true, + :id => 'message-form', + :method => :post} + } do |f| %> + <%= render :partial => 'boards/course_message_edit', + :locals => {:f => f, :edit_mode => true, :topic => @message} %> - <% end %> -
-
+ <% end %> <% end %> -
diff --git a/public/javascripts/course.js b/public/javascripts/course.js index 3818d447d..3baa11970 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -148,6 +148,65 @@ function submit_edit_course(id) $("#edit_course_"+id).submit(); } } +//课程讨论区 +function regexTopicSubject() { + var name = $("#message_subject").val(); + if(name.length ==0) + { + $("#subjectmsg").text("标题不能为空"); + $("#subjectmsg").css('color','#ff0000'); + $("#message_subject").focus(); + return false; + } + else if(name.length <= 255) + { + $("#subjectmsg").text("填写正确"); + $("#subjectmsg").css('color','#008000'); + return true; + } + else + { + $("#subjectmsg").text("标题超过255个字符"); + $("#subjectmsg").css('color','#ff0000'); + $("#message_subject").focus(); + return false; + } +} + +function regexTopicDescription() +{ + var name = message_content_editor.html(); + if(name.length ==0) + { + $("#message_content_span").text("描述不能为空"); + $("#message_content_span").css('color','#ff0000'); + return false; + } + else if(name.length >=6000){ + $("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)"); + $("#message_content_span").css('color','#ff0000'); + return false; + } + else + { + $("#message_content_span").text("填写正确"); + $("#message_content_span").css('color','#008000'); + return true; + } +} + +function submit_topic() +{ + if(regexTopicSubject() && regexTopicDescription()) + { + message_content_editor.sync(); + $("#message-form").submit(); + } +} + +function reset_topic(){ + +} /////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////课程讨论区 diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 2da36a991..d6af2102b 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -904,6 +904,7 @@ a:hover.BlueCirBtn{ background:#269ac9; color:#fff;} .w720{width:721px;} .w709{width: 709px;} .w701{width: 701px;} +.w704{width: 704px;} a.AnnexBtn{ background: url(images/homepage_icon2.png) 0px -343px no-repeat !important; height:20px; display:block; padding-left:20px; color:#888888;} a:hover.AnnexBtn{background: url(images/homepage_icon2.png) -90px -343px no-repeat !important; color:#3598db;} a.FilesBtn{ background: url(../images/homepage_icon2.png) 0px -373px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;} From 0f0351b3430b3d42a6e1bd88c88628f2284b937c Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 15 Oct 2015 16:28:03 +0800 Subject: [PATCH 33/51] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/boards_controller.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index a0f2bf379..2ec3cac0d 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -148,7 +148,10 @@ class BoardsController < ApplicationController @message = Message.new(:board => @board) #modify by nwb - + respond_to do |format| + format.js + format.html { + if @project render :action => 'show', :layout => 'base_projects' elsif @course @params=params @@ -157,6 +160,10 @@ class BoardsController < ApplicationController } format.atom { @messages = @board.messages. + reorder('created_on DESC'). + includes(:author, :board). + limit(Setting.feeds_limit.to_i). + all if @project render_feed(@messages, :title => "#{@project}: #{@board}") elsif @course From 0a43f462f5a5229b63b6f8f452f0a9fa7f2f5fc7 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 15 Oct 2015 16:44:49 +0800 Subject: [PATCH 34/51] =?UTF-8?q?=E5=B8=96=E5=AD=90=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BD=AE=E9=A1=B6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_message.html.erb | 6 +++++- public/stylesheets/courses.css | 1 + public/stylesheets/new_user.css | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 08ab39cd6..7fe15bd1e 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -13,13 +13,17 @@ TO <%= link_to activity.course.name.to_s+" | 课程讨论区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
-
+ + <% if activity.sticky == 1%> + 置顶 + <% end%> +
发帖时间:<%= format_time(activity.created_on) %>
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index d6af2102b..e8ecf897f 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -171,6 +171,7 @@ a.f_grey:hover {color:#000000;} .grey_btn_cir{ background:#b2b2b2; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} .blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} +.sticky_btn_cir{ background:#269ac9; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} .bgreen_btn_cir{ background:#1abc9c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} .homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;} a.homepageWhite {color:#ffffff;} diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 9d45ff753..75ffd716c 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -296,6 +296,7 @@ a:hover.bgreen_n_btn{background:#08a384;} .grey_btn_cir{ background:#b2b2b2; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} .blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} .orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} +.sticky_btn_cir{ background:#269ac9; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} .bgreen_btn_cir{ background:#1abc9c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} /* commonpic */ .pic_date{ display:block; background:url(../images/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; } From c5b881cb43030e074f57b330e04ff096fa75f349 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 15 Oct 2015 16:59:17 +0800 Subject: [PATCH 35/51] =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=9A=84=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/boards/_course_new.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb index 9eb7e49ad..a5cbc1c1e 100644 --- a/app/views/boards/_course_new.html.erb +++ b/app/views/boards/_course_new.html.erb @@ -39,6 +39,7 @@ <%= render :partial => 'attachments/form_course', :locals => {:container => topic, :isReply => @isReply} %>
+
<%if !edit_mode %> 确定 From 94d60e4150558eef4360fc4bd24d172aac18069a Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 15 Oct 2015 17:02:16 +0800 Subject: [PATCH 36/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=20=E6=9B=B4=E6=96=B0gem?= =?UTF-8?q?=E9=95=9C=E5=83=8F=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- config/configuration.yml | 12 ++++++------ lib/grack/Gemfile | 2 +- lib/grack/Gemfile.lock | 2 +- plugins/redmine_ckeditor/Gemfile | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index d1993359e..cf6e9f773 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -source 'http://ruby.taobao.org' +source 'https://ruby.taobao.org' #source 'http://ruby.sdutlinux.org/' unless RUBY_PLATFORM =~ /w32/ diff --git a/config/configuration.yml b/config/configuration.yml index ef39f6493..2ac986927 100644 --- a/config/configuration.yml +++ b/config/configuration.yml @@ -83,12 +83,12 @@ default: email_delivery: delivery_method: :smtp smtp_settings: - address: smtp.163.com - port: 25 - domain: smtp.163.com - authentication: :plain - user_name: "huang.jingquan@163.com" - password: 'xinhu1ji2qu366' + address: mail.trustie.net + port: 25 + domain: mail.trustie.net + authentication: :login + user_name: "mail@trustie.net" + password: "loong2010" # Absolute path to the directory where attachments are stored. # The default is the 'files' directory in your Redmine instance. diff --git a/lib/grack/Gemfile b/lib/grack/Gemfile index b7113caa8..80932e7e4 100644 --- a/lib/grack/Gemfile +++ b/lib/grack/Gemfile @@ -1,4 +1,4 @@ -source "http://ruby.taobao.org" +source "https://ruby.taobao.org" gemspec diff --git a/lib/grack/Gemfile.lock b/lib/grack/Gemfile.lock index 52d60f85d..68fa71a2b 100644 --- a/lib/grack/Gemfile.lock +++ b/lib/grack/Gemfile.lock @@ -5,7 +5,7 @@ PATH rack (~> 1.5.1) GEM - remote: http://ruby.taobao.org/ + remote: https://ruby.taobao.org/ specs: byebug (4.0.5) columnize (= 0.9.0) diff --git a/plugins/redmine_ckeditor/Gemfile b/plugins/redmine_ckeditor/Gemfile index ce2f3c583..07a2bac50 100644 --- a/plugins/redmine_ckeditor/Gemfile +++ b/plugins/redmine_ckeditor/Gemfile @@ -1,4 +1,4 @@ -source 'http://ruby.taobao.org' +source 'https://ruby.taobao.org' gem 'rich', '1.4.6' gem 'kaminari' From e3a660cf18f3667d975db8d46213abaa5291f714 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Thu, 15 Oct 2015 17:06:42 +0800 Subject: [PATCH 37/51] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=A6=E6=A0=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/school_controller.rb | 11 ++++ app/views/my/account.html.erb | 81 +++++++++++++++++++++------- app/views/school/add_school.js.erb | 1 + config/routes.rb | 1 + 4 files changed, 74 insertions(+), 20 deletions(-) create mode 100644 app/views/school/add_school.js.erb diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 5e68dc2bd..062b0fa34 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -132,4 +132,15 @@ class SchoolController < ApplicationController # end render :json => @school.to_json end + + #添加学校 + def add_school + @school = School.new + @school.name = params[:name].strip + @school.pinyin = Pinyin.t(params[:name].strip, splitter: '') + @school.save + respond_to do |format| + format.js + end + end end diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 987bb6fbd..d0125cd3b 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -72,22 +72,22 @@
  • <% if User.current.user_extensions.nil? %> - + <% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %> - + <% elsif User.current.user_extensions.school.nil? %> - + <% else %> - + @@ -144,7 +144,7 @@
  • <%= f.select :language, :Chinese => :zh, :English => :en %>
  • - 确认 + 确认
  • @@ -170,7 +170,7 @@
  • 确认 - +
  • @@ -185,7 +185,7 @@
    @@ -532,12 +532,33 @@ $("#search_school_result_list").hide(); $("#hint").hide(); } + function add_school(name){ + $.ajax({ + url: '<%= url_for(:controller => 'school',:action => 'add_school') %>' + '?name=' + name, + type: 'post', + success: function (data) { + + } + }); + } var lastSearchCondition = ''; $(function() { +// $("input[name='province']").keydown(function(e){ +// if(e.keyCode == 13 && $("#search_school_result_list").css('display') == 'block'){ +// str = $("#search_school_result_list").children().eq(0).attr('onclick').match(/\(.*\)/)[0] +// +// str = str.replace(/\(/,'').replace(/\)/,''); +// arr = str.split(','); +// id = arr[1].replace(/\'/,'') +// name = arr.replace(/\'/,'') +// changeValue(name,id); +// return false; +// } +// }); //查询学校 $("input[name='province']").on('input', function (e) { $("input[name='occupation']").val(''); //一旦有输入就清空id。 - if($(e.target).val().trim() == lastSearchCondition){ + if($(e.target).val().trim() == lastSearchCondition && $(e.target).val().trim() != ''){ return; } lastSearchCondition = $(e.target).val().trim(); @@ -545,7 +566,7 @@ url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value, type: 'post', success: function (data) { - if(data.lengh != 0) { + if(data.length != undefined && data.length != 0) { var i = 0; $("#search_school_result_list").html(''); for (; i < data.length; i++) { @@ -557,13 +578,16 @@ $("#search_school_result_list").css("position", "absolute"); $("#search_school_result_list").show(); if($(e.target).val().trim() != '') { - $("#hint").html('平台找到了' + data.length + '个包含"' + e.target.value + '"的高校'); + str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value; + $("#hint").html('找到了' + data.length + '个包含"' + str + '"的高校'); $("#hint").show(); }else{ $("#hint").hide(); } }else{ - $("#hint").html('平台没有找到包含"'+e.target.value+'"的高校,创建该高校'); + $("#search_school_result_list").html(''); + str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value; + $("#hint").html('没有找到包含"'+str+'"的高校,创建高校'); $("#hint").show(); } } @@ -577,20 +601,37 @@ } }) $("input[name='province']").on('focus', function (e) { + if($(e.target).val() == ''){ + return; + } $.ajax({ url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value, type: 'post', success: function (data) { - var i = 0; - $("#search_school_result_list").html(''); - for ( ;i' +data[i].school.name+'
    '; - $("#search_school_result_list").append(link); + if(data.length != undefined && data.length != 0) { + var i = 0; + $("#search_school_result_list").html(''); + for (; i < data.length; i++) { + link = '' + data[i].school.name + '
    '; + $("#search_school_result_list").append(link); + } + $("#search_school_result_list").css('left', $(e.target).offset().left); + $("#search_school_result_list").css('top', $(e.target).offset().top + 28); + $("#search_school_result_list").css("position", "absolute"); + $("#search_school_result_list").show(); + if ($(e.target).val().trim() != '') { + str = e.target.value.length > 8 ? e.target.value.substr(0, 6) + "..." : e.target.value; + $("#hint").html('找到了' + data.length + '个包含"' + str + '"的高校'); + $("#hint").show(); + } else { + $("#hint").hide(); + } + }else { + $("#search_school_result_list").html(''); + str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value; + $("#hint").html('没有找到包含"'+str+'"的高校,创建高校'); + $("#hint").show(); } - $("#search_school_result_list").css('left',$(e.target).offset().left); - $("#search_school_result_list").css('top',$(e.target).offset().top + 28); - $("#search_school_result_list").css("position", "absolute"); - $("#search_school_result_list").show(); } }); }); diff --git a/app/views/school/add_school.js.erb b/app/views/school/add_school.js.erb new file mode 100644 index 000000000..181c4e03b --- /dev/null +++ b/app/views/school/add_school.js.erb @@ -0,0 +1 @@ +$("input[name='occupation']").val('<%= @school.id%>'); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 01e9500d8..6839b0433 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -880,6 +880,7 @@ RedmineApp::Application.routes.draw do get 'school/search_school/', :to => 'school#search_school' post 'school/on_search' + post 'school/add_school' ######added by nie match 'tags/show_projects_tags' ########### added by liuping From 998c7e1c1b89541023e844bfae81909b9b95db07 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 15 Oct 2015 17:06:48 +0800 Subject: [PATCH 38/51] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E5=8D=95=E4=B8=AA=E5=B8=96=E5=AD=90=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=E8=B6=85=E5=87=BA=E8=BE=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_course_show.html.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 8aa1f71bc..1611bc725 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -71,7 +71,7 @@ <%= link_to @topic.try(:author).try(:realname), user_path(@topic.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %> <% end %>
    -
    <%= format_date( @topic.created_on)%>
    +
    <%= format_time( @topic.created_on)%>
    <%= @topic.content.html_safe%> @@ -109,9 +109,9 @@ <%= 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%>
    +
    <%= reply.content.html_safe%>
    - <%= format_date(reply.created_on) %> + <%= format_time(reply.created_on) %>