diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index fd1266095..431577f9a 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -93,15 +93,7 @@ class MessagesController < ApplicationController
end
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
render_attachment_warning_if_needed(@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
+ redirect_to board_message_url(@board, @message)
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
@@ -131,24 +123,17 @@ class MessagesController < ApplicationController
#@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record?
if params[:asset_id]
- ids = params[:asset_id].split(',')
- update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE
+ ids = params[:asset_id].split(',')
+ update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE
end
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
attachments = Attachment.attach_files(@reply, params[:attachments])
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)
+ #render file: 'messages#show', layout: 'base_courses'
end
+ redirect_to board_message_url(@board, @topic, :r => @reply)
+
end
# Edit a message
@@ -165,15 +150,7 @@ class MessagesController < ApplicationController
render_attachment_warning_if_needed(@message)
flash[:notice] = l(:notice_successful_update)
@message.reload
- 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(@message.board, @message.root, :r => (@message.parent_id && @message.id))
- end
+ redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
elsif request.get?
respond_to do |format|
format.html {
@@ -195,20 +172,16 @@ class MessagesController < ApplicationController
@message.destroy
# modify by nwb
if @project
- if params[:is_board]
- redirect_to project_boards_url(@project)
+ if @message.parent
+ redirect_to board_message_url(@board, @message.parent, :r => r)
else
- redirect_to board_message_url(@board, @topic, :r => @reply)
+ redirect_to project_boards_url(@project)
end
elsif @course
- if params[:is_board]
- redirect_to course_boards_url(@course)
+ if @message.parent
+ redirect_to board_message_url(@board, @message.parent, :r => r)
else
- if @message.parent
- redirect_to board_message_url(@board, @message.parent, :r => r)
- else
- redirect_to course_board_url(@course, @board)
- end
+ redirect_to course_board_url(@course, @board)
end
end
end
@@ -229,7 +202,7 @@ class MessagesController < ApplicationController
render :partial => 'common/preview'
end
-private
+ private
def find_message
return unless find_board
@message = @board.messages.find(params[:id], :include => :parent)
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb
index ebb7c2fc8..69d8bc3a6 100644
--- a/app/controllers/my_controller.rb
+++ b/app/controllers/my_controller.rb
@@ -122,7 +122,7 @@ class MyController < ApplicationController
if @user.save && @se.save
# 头像保存
- FileUtils.mv diskfile1, diskfile, force: true
+ FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1
@user.pref.save
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
set_language_if_valid @user.language
diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb
index d0fd6215a..af568bbff 100644
--- a/app/views/boards/_project_show.html.erb
+++ b/app/views/boards/_project_show.html.erb
@@ -1,186 +1,59 @@
-
-
+
+
<% if User.current.language == "zh"%>
<%= h @board.name %>
<% else %>
<%= l(:project_module_boards) %>
<% end %>
-
-
<%= l(:label_message_new) %>
-
<% if !User.current.logged? %>
- <%= l(:label_user_login_project_board) %>
- <%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %>
+ <%= l(:label_user_login_project_board) %>
+ <%= link_to l(:label_user_login_new), signin_path, :class => "c_blue ml5" %>
<% end %>
-
-
-
-
-
- <%= render :partial => 'project_new_topic' %>
-
-
-
-
-
讨论区共有<%= @topic_count %>个帖子
+
+
+
<%= 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=>"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.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',
- :style => ' margin-right: 10px;'
- ) if topic.destroyable_by?(User.current) %>
-
-
-
-
-
- <%= 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' %>
-
-
-
-
-
-
- <%= render :partial => 'edit',locals: {:topic => topic} %>
-
-
-
- <% reply = Message.new(:subject => "RE: #{@message.subject}")%>
- <% if !topic.locked? && authorize_for('messages', 'reply') %>
-
-
-
- <%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s} do |f| %>
-
- <%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
-
<%= l(:label_memo_create)%>
- <% end %>
-
-
- <% 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 %>
-
-
-
-
- <% replies_all.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) %>
-
-
-
-
+ <% @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" %>
+ <% if topic.sticky? %>
+
<%= l(:label_board_sticky)%>
<% end %>
-
-
- <%if replies_all.first %>
-
- <% end %>
- <% end %>
-
- <% end %>
- <% else %>
- <%= l(:label_no_data) %>
- <% 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 %>
+
+ <%= link_to (l(:label_short_reply) + " "+topic.replies_count.to_s), board_message_path(@board, topic), :class => "talk_btn fr c_white" %>
+
+
+ <% end %>
+<% else %>
+
<%= l(:label_no_data) %>
+<% end %>
- <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
-
-
+ <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
+
+
<%# other_formats_links do |f| %>
- <%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
+<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
<%# end %>
<% html_title @board.name %>
@@ -188,33 +61,3 @@
<% 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/layouts/_base_development_group.html.erb b/app/views/layouts/_base_development_group.html.erb
index 891fa9d94..24f975f66 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), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
+ <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :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 71d375501..16ccc09e5 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), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
+ <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :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 3f942bc40..a214e8c20 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), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
+ <%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %>
<% end%>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 8361c3874..2a26ff59f 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -133,7 +133,7 @@
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
<%= link_to "(#{@course.boards.first ? @course.boards.first.topics.count : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %>
- <%= link_to( "+#{l(:label_message_new)}", course_boards_path(@course, :flag => true), :class => 'subnav_green ml95 c_white') if User.current.member_of_course?(@course) && @course.boards.first %>
+ <%= link_to( "+#{l(:label_message_new)}", new_board_message_path(@course.boards.first), :class => 'subnav_green ml95 c_white') if User.current.member_of_course?(@course) && @course.boards.first %>
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>
diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb
index 579b26d65..2d433d969 100644
--- a/app/views/messages/_course_show.html.erb
+++ b/app/views/messages/_course_show.html.erb
@@ -28,11 +28,6 @@
添加于<%= format_time(@topic.created_on) %>
- <%= link_to(
- l(:button_edit),
- {:action => 'edit', :id => @topic},
- :class => 'talk_edit fr'
- ) if @message.course_editable_by?(User.current) %>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @topic},
@@ -40,6 +35,11 @@
: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 %>
@@ -105,6 +105,7 @@
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
<%= link_to l(:button_submit),"javascript:void(0)",:onclick => 'course_board_submit_message_replay();' ,:class => "blue_btn fl c_white" ,:style=>"margin-left: 50px;"%>
+ <%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'course_board_canel_message_replay();', :class => "blue_btn grey_btn fl c_white" %>
<% end %>
<% end %>
diff --git a/app/views/messages/_form_course.html.erb b/app/views/messages/_form_course.html.erb
index 9324ea59e..1161e9f8a 100644
--- a/app/views/messages/_form_course.html.erb
+++ b/app/views/messages/_form_course.html.erb
@@ -1,16 +1,17 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= error_messages_for 'message' %>
<% replying ||= false %>
-<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
+<% extra_option = replying ? { hidden: "hidden"} : { maxlength: 200 } %>
-
+
<% if replying %>
- <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585" }.merge(extra_option) %>
+ <%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585 fl" }.merge(extra_option) %>
<% else %>
<%= f.text_field :subject, { size: 60, id: "message_subject", onkeyup: "regexSubject();",:class=>"talk_input w585" }.merge(extra_option) %>
+
<% end %>
-
+
<% unless replying %>
@@ -26,7 +27,7 @@
-
+
-
+
<% unless replying %>
<% if @message.safe_attribute? 'sticky' %>
<%= f.check_box :sticky %>
diff --git a/app/views/messages/edit.html.erb b/app/views/messages/edit.html.erb
index 1545fa610..8fbeafcb9 100644
--- a/app/views/messages/edit.html.erb
+++ b/app/views/messages/edit.html.erb
@@ -5,7 +5,7 @@
<% if @message.project %>
<%#= board_breadcrumb(@message) %>
-
+
<%= form_for @message, { :as => :message,
:url => {:action => 'edit'},
diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb
index 157e20764..e7ee0bca0 100644
--- a/app/views/messages/quote.js.erb
+++ b/app/views/messages/quote.js.erb
@@ -5,3 +5,4 @@ $('#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");
diff --git a/public/javascripts/course.js b/public/javascripts/course.js
index cc57279f0..f0b1338da 100644
--- a/public/javascripts/course.js
+++ b/public/javascripts/course.js
@@ -8,6 +8,10 @@ function course_setting(id)
$('#tbc_0'+(3-id)).removeClass().addClass("undis");
}
+$(function(){
+ $("img").removeAttr("align");
+});
+
///////////////////////////////////////////////////////////////
//添加分班
function add_group(url,course_id) {
@@ -266,6 +270,13 @@ function course_board_submit_message_replay()
$("#message_form").submit();
}
}
+
+function course_board_canel_message_replay()
+{
+ $("#reply").hide(200);
+ $("#message_quote").html("");
+}
+
function MessageReplayVevify() {
var content = message_content_editor.html();//$.trim($("#message_content").val());
if (content.length == 0) {
@@ -515,6 +526,7 @@ $(function(){
//查找TAG资源
function search_tag_attachment(url,tag_name,q,course_id,sort)
{
+ //alert("111");
$.get(
url,
{
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 4643be06b..f49ef22f1 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -437,6 +437,7 @@ a.link_file_board{ background:url(../images/pic_file.png) 0 3px no-repeat !impor
/*上传图片处理*/
.upload_img img{max-width: 100%;}
+blockquote img{max-width: 100%;}
/*
The following fixes a problem where IE7 and IE8 replace a PNG's alpha transparency with a black fill
@@ -480,13 +481,13 @@ a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; col
/*日历选择图*/
img.ui-datepicker-trigger {
display:block;
- background:url(/images/public_icon.png) -31px 0 no-repeat;
+ background:url(../images/public_icon.png) -31px 0 no-repeat;
cursor: pointer;
vertical-align: middle;
margin-left: 5px;
margin-top: 5px;
- width:16px;
- height:15px;
+ width:16px;
+ height:15px;
float:left;
}
@@ -561,7 +562,7 @@ a:hover.Reply_pic{border:1px solid #64bdd9;}
.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;}
+/*.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;}*/
#about_newtalk{ display:none;}