diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 436418430..bab5dfb4c 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -93,7 +93,15 @@ class MessagesController < ApplicationController end call_hook(:controller_messages_new_after_save, { :params => params, :message => @message}) render_attachment_warning_if_needed(@message) - redirect_to board_message_url(@board, @message) + if params[:is_board] + if @project + redirect_to project_boards_path(@project) + elsif @course + redirect_to course_boards_path(@course) + end + else + redirect_to board_message_url(@board, @message) + end else layout_file = @project ? 'base_projects' : 'base_courses' render :action => 'new', :layout => layout_file @@ -131,9 +139,16 @@ class MessagesController < ApplicationController render_attachment_warning_if_needed(@reply) else #render file: 'messages#show', layout: 'base_courses' + end + if params[:is_board] + if @project + redirect_to project_boards_path(@project) + elsif @course + redirect_to course_boards_path(@course) + end + else + redirect_to board_message_url(@board, @topic, :r => @reply) end - redirect_to board_message_url(@board, @topic, :r => @reply) - end # Edit a message @@ -172,16 +187,20 @@ class MessagesController < ApplicationController @message.destroy # modify by nwb if @project - if @message.parent - redirect_to board_message_url(@board, @message.parent, :r => r) - else + if params[:is_board] redirect_to project_boards_url(@project) + else + redirect_to board_message_url(@board, @topic, :r => @reply) end elsif @course - if @message.parent - redirect_to board_message_url(@board, @message.parent, :r => r) + if params[:is_board] + redirect_to course_boards_url(@course) else - redirect_to course_board_url(@course, @board) + if @message.parent + redirect_to board_message_url(@board, @message.parent, :r => r) + else + redirect_to course_board_url(@course, @board) + end end end end diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb new file mode 100644 index 000000000..94ba51529 --- /dev/null +++ b/app/views/boards/_course_new.html.erb @@ -0,0 +1,9 @@ +<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form'} do |f| %> + + <%= render :partial => 'form_course', :locals => {:f => f} %> +
  • + <%= link_to l(:button_cancel), course_boards_path(@course), :class => 'grey_btn fr ml10' %> + <%= l(:button_submit)%> +
    +
  • +<% end %> diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb index ed2c20448..357071214 100644 --- a/app/views/boards/_course_show.html.erb +++ b/app/views/boards/_course_show.html.erb @@ -1,28 +1,26 @@ - +
    -

    <%= l(:label_board_plural) %>

    -
    +

    + <% if User.current.language == "zh"%> + <%= h @board.name %> + <% else %> + <%= l(:project_module_boards) %> + <% end %> +

    + <%= l(:label_message_new) %> +
    + + +
    +
    +
    + +
    <% if !User.current.logged?%>
    @@ -31,38 +29,127 @@
    <% end %> -
    -

    - <%= l(:label_totle) %> - <%= @topic_count %> - <%= l(:label_course_momes_count) %> -

    - <%= link_to l(:label_message_new), - new_board_message_path(@board), - :class => 'problem_new_btn fl c_dorange' if User.current.logged? %> -
    -
    + <% if @topics.any? %> <% @topics.each do |topic| %> -
    - <%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %> -
    - <%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title: topic.subject.to_s,:class => "problem_tit fl fb c_dblue" %> - <% if topic.sticky? %> - 置顶 +
    + <%= 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 " %> +

      <%= h(topic.subject) %>

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

    + <%= topic.content %>

    +
    + + + + +
    + + + <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %> +
    + <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %> + +
    +
    +
    + <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% if !topic.locked? && authorize_for('messages', 'reply') %> + +
    + <% end %> -
    -

    由<%= link_to topic.author,user_path(topic.author),:class => "problem_name" %>添加于<%= format_time(topic.created_on) %>

    -
    - <%=link_to (l(:label_reply) + topic.replies_count.to_s), board_message_path(@board, topic),:class => "talk_btn fr c_white" %> + <% replies_all = topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").offset(2). + all %> + <% replies_show = topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").limit(2). + all %> + <% unless replies_show.empty? %> + <% reply_count = 0 %> +
    +
      + <% replies_show.each do |message| %> + +
    • + <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %> +
      + <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %> +
      +

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

      + +
      + <%= format_time(message.created_on) %> + <%= link_to( + + l(:button_delete), + {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete), + :class => ' c_dblue fr' + ) if message.course_destroyable_by?(User.current) %> +
      +
      -
      -
    + + <% end %> + +
    + + + + <% end %> +
    <% end %> <% else %> -

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

    +

    <%= l(:label_no_data) %>

    <% end %>
    <% end %> - -
    -
    <%= l(:label_project_board_count , :count => @topic_count)%>
    -<% if @project.enabled_modules.where("name = 'boards'").count > 0 && User.current.member_of?(@project) %> - <%= link_to l(:project_module_boards_post), new_board_message_path(@board), - :class => 'problem_new_btn fl c_dorange', - :onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> - <% end %> -
    -
    + +
    +
    +
    + +
    + + <% if @topics.any? %> <% @topics.each do |topic| %> -
    - <%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %> -
    - <%= link_to h(topic.subject), board_message_path(@board, topic), title:topic.subject.to_s, :class =>"problem_tit fl" %> +
    + <%= 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 " %> +

      <%= h(topic.subject) %>

    <% if topic.sticky? %> <%= l(:label_board_sticky)%> <% end %> -
    - <%= l(:label_post_by)%><%= link_to topic.author, user_path(topic.author), :class =>"problem_name" %> -  <%= l(:label_post_by_time)%><%= format_time topic.created_on %> + + +
    + +

    + <%= topic.content %>

    +
    + + + + +
    + + + <%= l(:label_activity_time)%>:  <%= format_time topic.created_on %>
    - <%= link_to (l(:label_short_reply) + " "+topic.replies_count.to_s), board_message_path(@board, topic), :class => "talk_btn fr c_white" %> + <%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %> +
    - <% end %> +
    + <% reply = Message.new(:subject => "RE: #{@message.subject}")%> + <% if !topic.locked? && authorize_for('messages', 'reply') %> + +
    + + <% end %> + <% replies_all = topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").offset(2). + all %> + <% replies_show = topic.children. + includes(:author, :attachments, {:board => :project}). + reorder("#{Message.table_name}.created_on DESC").limit(2). + all %> + <% unless replies_show.empty? %> + <% reply_count = 0 %> +
    +
      + <% replies_show.each do |message| %> + +
    • + <%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %> +
      + <%= link_to_user_header message.author,false,:class => 'fl c_orange ' %> +
      +

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

      + +
      + <%= format_time(message.created_on) %> + <%= link_to( + + l(:button_delete), + {:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'}, + :method => :post, + :data => {:confirm => l(:text_are_you_sure)}, + :title => l(:button_delete), + :class => ' c_dblue fr' + ) if message.course_destroyable_by?(User.current) %> +
      +
      + +
    • + <% end %> +
    +
    + + + + <% end %> +
    + <% end %> <% else %>

    <%= l(:label_no_data) %>

    <% end %> @@ -61,3 +166,32 @@ <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %> <% end %> + \ No newline at end of file diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index c9a8645de..50d33be39 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -1,4 +1,122 @@ + + + <% if @project %> <%= render :partial => 'project_show', locals: {project: @project} %> <% elsif @course %> diff --git a/db/schema.rb b/db/schema.rb index 8b5ea1461..fa82de59a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -438,13 +438,6 @@ ActiveRecord::Schema.define(:version => 20150505025537) do add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - create_table "discuss_demos", :force => true do |t| - t.string "title" - t.text "body" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "documents", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 6dbb0ff6b..6dbc90271 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -58,7 +58,22 @@ function show_more_msg() { arrow.attr("src", "/images/jiantou.jpg") } } - +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") + } +} //项目版本库git帮助文档显示 function showhelpAndScrollTo(id) { @@ -84,7 +99,29 @@ function showhelpAndScrollTo(id) { information.attr("value", "show_help"); } } - +function showhelpAndScrollToMessage(id, id1) { + $('#' + 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("收起回复"); + information.attr("value", "hide_help"); + } + else + { + $(id1).text("展开回复"); + information.attr("value", "show_help"); + } +} $(function(){ diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index bb7294e2e..c303cd6ca 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -530,6 +530,40 @@ a.wzan_visited{background:url(../images/new_project/public_icon.png) 0px -503px a.files_tag_icon{ background:#e2f3f9; color:#54aeca; border:1px solid #bbe2ef; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px; } a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; padding:1px 10px; float:left; margin-right:10px;margin-bottom:10px;} +/* 20150505讨论区*/ +.w664{ width:664px;} +.w140{ width:140px;} +.talklist_box{ } +.talkmain_box{ width:670px; border-bottom:1px dashed #d9d9d9; padding-bottom:20px; margin-bottom:20px;} +.talkmain_pic{} +a.talkmain_pic{ display:block; width:42px; height:42px; padding:2px; border:1px solid #e3e3e3;} +a:hover.talkmain_pic{border:1px solid #64bdd9;} +.talkmain_txt{ width:610px; margin-left:10px; color:#333;} +a.talkmain_name{ color:#ff5722;} +a:hover.talkmain_name{ color:#d33503;} +.talkmain_tit{ color:#0781b4; width:450px; display:block; } +.talklist_main{ } +.talkWrapArrow{ display:block; float:right; margin-right:10px;background:url(../images/arrow.png) 0 0 no-repeat; height:7px; width:13px;} +.talkConIpt{ background:#f2f2f2; } +.talkWrapBox{ width:610px; margin-left:60px; } +.inputFeint{ border:1px solid #d9d9d9; background:#fff; width:583px; height:50px; margin:10px; margin-bottom:5px;color:#666;} +.inputFeint02{ border:1px solid #d9d9d9; background:#fff; width:535px; height:30px; margin:5px 0 5px 50px; color:#666;} +.inputFeint03{ border:1px solid #d9d9d9; background:#fff; width:490px; height:30px; margin:5px 0 5px 0px; color:#666;} +.talkWrapMsg{ background:#f2f2f2; padding:10px;} +a.Msg_pic{ display:block; width:34px; height:34px; padding:2px; border:1px solid #e3e3e3; float:left;} +a:hover.Msg_pic{border:1px solid #64bdd9;} +a.Reply_pic{ display:block; width:30px; height:30px; padding:2px; border:1px solid #e3e3e3; float:left;} +a:hover.Reply_pic{border:1px solid #64bdd9;} +.Msg_txt{ float:left; width:540px; margin-left:10px;} +.Msg_txt p{ } +.talkWrapMsg ul li{border-bottom:1px dashed #d9d9d9; padding-bottom:10px; margin-bottom:10px;} +.talkReply{ width:540px; margin-left:50px; border-top:1px dashed #d9d9d9; padding-top:10px; } +.Replybox{ float:left; width:495px; margin-left:5px;} +.talk_nextpage{ border:none; width:410px; margin:0 auto;} +.newtalk { margin-top:8px; margin-right:8px;} +.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;} +#about_newtalk{ display:none;} + diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index e6a244b0e..4da93d6ea 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -692,3 +692,37 @@ tr.open span.expander {background-image: url(../images/bullet_toggle_minus.png); .icon-file.application-pdf { background-image: url(../images/files/pdf.png); } .icon-file.application-zip { background-image: url(../images/files/zip.png); } .icon-file.application-x-gzip { background-image: url(../images/files/zip.png); } + +/* 20150505讨论区*/ +.w664{ width:664px;} +.w140{ width:140px;} +.talklist_box{ } +.talkmain_box{ width:670px; border-bottom:1px dashed #d9d9d9; padding-bottom:20px; margin-bottom:20px;} +.talkmain_pic{} +a.talkmain_pic{ display:block; width:42px; height:42px; padding:2px; border:1px solid #e3e3e3;} +a:hover.talkmain_pic{border:1px solid #64bdd9;} +.talkmain_txt{ width:610px; margin-left:10px; color:#333;} +a.talkmain_name{ color:#ff5722;} +a:hover.talkmain_name{ color:#d33503;} +.talkmain_tit{ color:#0781b4; width:450px; display:block; } +.talklist_main{ } +.talkWrapArrow{ display:block; float:right; margin-right:10px;background:url(../images/arrow.png) 0 0 no-repeat; height:7px; width:13px;} +.talkConIpt{ background:#f2f2f2; } +.talkWrapBox{ width:610px; margin-left:60px; } +.inputFeint{ border:1px solid #d9d9d9; background:#fff; width:583px; height:50px; margin:10px; margin-bottom:5px;color:#666;} +.inputFeint02{ border:1px solid #d9d9d9; background:#fff; width:535px; height:30px; margin:5px 0 5px 50px; color:#666;} +.inputFeint03{ border:1px solid #d9d9d9; background:#fff; width:490px; height:30px; margin:5px 0 5px 0px; color:#666;} +.talkWrapMsg{ background:#f2f2f2; padding:10px;} +a.Msg_pic{ display:block; width:34px; height:34px; padding:2px; border:1px solid #e3e3e3; float:left;} +a:hover.Msg_pic{border:1px solid #64bdd9;} +a.Reply_pic{ display:block; width:30px; height:30px; padding:2px; border:1px solid #e3e3e3; float:left;} +a:hover.Reply_pic{border:1px solid #64bdd9;} +.Msg_txt{ float:left; width:540px; margin-left:10px;} +.Msg_txt p{ } +.talkWrapMsg ul li{border-bottom:1px dashed #d9d9d9; padding-bottom:10px; margin-bottom:10px;} +.talkReply{ width:540px; margin-left:50px; border-top:1px dashed #d9d9d9; padding-top:10px; } +.Replybox{ float:left; width:495px; margin-left:5px;} +.talk_nextpage{ border:none; width:410px; margin:0 auto;} +.newtalk { margin-top:8px; margin-right:8px;} +.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;} +#about_newtalk{ display:none;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 4f65a17c1..5006a11e4 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -56,7 +56,6 @@ h4{ font-size:14px; color:#3b3b3b;} .ml10{ margin-left:10px;} .ml15{ margin-left:15px;} .ml20{ margin-left:20px;} -.ml25{ margin-left:25px;} .ml40{ margin-left:40px;} .ml45{ margin-left:45px;} .ml55{ margin-left:55px;} @@ -64,6 +63,7 @@ h4{ font-size:14px; color:#3b3b3b;} .ml60{ margin-left:60px;} .ml80{ margin-left:80px;} .ml90{ margin-left:90px;} +.ml100{ margin-left:100px;} .ml110{ margin-left:110px;} .mr5{ margin-right:5px;} .mr10{ margin-right:10px;} @@ -74,13 +74,13 @@ h4{ font-size:14px; color:#3b3b3b;} .mt5{ margin-top:5px;} .mt8{ margin-top:8px;} .mt10{ margin-top:10px;} -.mt13{ margin-top:13px;} -.mt43{ margin-top:43px;} -.mt40{ margin-top:40px;} .mb5{ margin-bottom:5px;} .mb10{ margin-bottom:10px;} -.mb13{ margin-bottom:13px;} +.mb20{ margin-bottom:20px;} .pl15{ padding-left:15px;} +.w20{ width:20px;} +.w60{ width:60px;} +.w70{ width:70px;} .w90{ width:90px;} .w210{ width:210px;} .w150{ width:150px;} @@ -93,8 +93,10 @@ h4{ font-size:14px; color:#3b3b3b;} .w350{ width:350px;} .w610{ width:610px;} .w600{ width:600px;} +.h22{ height:22px;} .h26{ height:26px;} .h50{ height:50px;} +.h70{ height:70px;} .h150{ height:150px;} /* Font & background Color */