Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-05-13 09:56:50 +08:00
commit 7112d91706
23 changed files with 565 additions and 147 deletions

View File

@ -27,7 +27,7 @@ class BoardsController < ApplicationController
include SortHelper
helper :watchers
helper :project_score
helper :attachments
def index
#modify by nwb
@flag = params[:flag] || false

View File

@ -93,10 +93,27 @@ 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
if params[:is_board]
if @project
redirect_to project_boards_path(@project, :flag => true)
elsif @course
redirect_to course_boards_path(@course, :flag => true)
end
else
layout_file = @project ? 'base_projects' : 'base_courses'
render :action => 'new', :layout => layout_file
end
end
else
respond_to do |format|
@ -111,7 +128,15 @@ class MessagesController < ApplicationController
# Reply to a topic
def reply
if params[:reply][:content] == ""
(redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
if params[:is_board]
if @project
(redirect_to project_boards_path(@project), :notice => l(:label_reply_empty);return)
elsif @course
(redirect_to course_boards_path(@course), :notice => l(:label_reply_empty);return)
end
else
(redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
end
end
@quote = params[:quote][:quote]
@reply = Message.new
@ -132,7 +157,15 @@ class MessagesController < ApplicationController
else
#render file: 'messages#show', layout: 'base_courses'
end
redirect_to board_message_url(@board, @topic, :r => @reply)
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
end
@ -144,13 +177,22 @@ class MessagesController < ApplicationController
else
(render_403; return false) unless @message.course_editable_by?(User.current)
end
@message.safe_attributes = params[:message]
if request.post? && @message.save
attachments = Attachment.attach_files(@message, params[:attachments])
render_attachment_warning_if_needed(@message)
flash[:notice] = l(:notice_successful_update)
@message.reload
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
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
elsif request.get?
respond_to do |format|
format.html {
@ -172,16 +214,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

View File

@ -1,4 +1,4 @@
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<span id="attachments_fields<%= container.id %>" class="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% if isReply %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
@ -38,12 +38,12 @@
<span class="add_attachment">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag "#{l(:button_browse)}", :type=>"button", :onclick=>"_file.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<%= button_tag "#{l(:button_browse)}", :type=>"button", :onclick=>"file#{container.id}.click()",:class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:id => "file#{container.id}",
:class => 'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:onchange => "addInputFiles_board(this, '#{container.id}');",
:style => 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,

View File

@ -1,4 +1,4 @@
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
<span id="attachments_fields<%= container.id %>" class="attachments_fields" xmlns="http://www.w3.org/1999/html">
<% if defined?(container) && container && container.saved_attachments %>
<% if isReply %>
<% container.saved_attachments.each_with_index do |attachment, i| %>
@ -38,12 +38,12 @@
<span class="add_attachment">
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
<%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<%= button_tag "文件浏览", :type=>"button", :onclick=>"file#{container.id}.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
<%= file_field_tag 'attachments[dummy][file]',
:id => '_file',
:id => "file#{container.id}",
:class => 'file_selector',
:multiple => true,
:onchange => 'addInputFiles(this);',
:onchange => "addInputFiles_board(this, '#{container.id}');",
:style => 'display:none',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,

View File

@ -1,8 +1,8 @@
<%= 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} %>
<%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
<li>
<%= link_to l(:button_cancel), course_boards_path(@course), :class => 'grey_btn fr ml10' %>
<a href="javascript:void(0)" onclick="show_newtalk();" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
<a href="#" onclick="$('#message-form').submit();" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div>
</li>

View File

@ -1,28 +1,26 @@
<div id="add-message" class="add_frame" style="display:none;">
<% if User.current.logged? %>
<h3>
<%= link_to h(@board.name), course_board_path(@course, @board) %>
<%= l(:label_message_new) %>
</h3>
<div class="add_frame_header" >
<%= l(:label_message_new) %>
</div>
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => false, :id => 'message-form'} do |f| %>
<%= render :partial => 'messages/form_course', :locals => {:f => f} %>
<p>
<a href="javascript:void(0)" onclick="submitCoursesBoard();"class="ButtonColor m3p10"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => '$("#add-message").hide(); return false;' ,:class => 'ButtonColor m3p10' %>
</p>
<% end %>
<div id="preview" class="wiki"></div>
<% end %>
</div>
<!--display the board-->
<div class="project_r_h">
<h2 class="project_h2"><%= l(:label_board_plural) %></h2>
</div>
<h2 class="project_h2 fl">
<% if User.current.language == "zh"%>
<%= h @board.name %>
<% else %>
<%= l(:project_module_boards) %>
<% end %>
</h2>
<a href="javascript:void(0)" class="green_btn fr newtalk " onclick="show_newtalk();"><%= l(:label_message_new) %></a>
<div class="cl"></div>
</div>
<!-- 发布新帖部分 -->
<div class="cl"></div>
<div class=" talklist_box" >
<div class="talk_new ml15 mb10" id="about_newtalk" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;" >
<ul>
<%= render :partial => 'course_new' %>
</ul>
</div><!--talknew end-->
<% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;">
@ -31,44 +29,159 @@
<hr/>
</div>
<% end %>
<div class="talk_top ml15">
<p class="fl">
<%= l(:label_totle) %>
<span><%= @topic_count %></span>
<%= l(:label_course_momes_count) %>
</p>
<%= link_to l(:label_message_new),
new_board_message_path(@board),
:class => 'problem_new_btn fl c_dorange' if User.current.logged? %>
<div class="cl"></div>
</div>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %>
<div class="talk_txt fl">
<%= link_to h(topic.subject), board_message_path(@board, topic),title: topic.subject.to_s,:class => "problem_tit fl fb c_dblue" %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red">置顶</a>
<% end %>
<br/>
<p>由<%= link_to topic.author,user_path(topic.author),:class => "problem_name" %>添加于<%= format_time(topic.created_on) %></p>
</div>
<%=link_to (l(:label_reply) + topic.replies_count.to_s), board_message_path(@board, topic),:class => "talk_btn fr c_white" %>
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5">
<% author = topic.author.to_s + "" %>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% end %>
<% else %>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% end %>
<p class="talkmain_tit fl fb break_word">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<% if topic.course_editable_by?(User.current) %>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;float: left;
margin-left: 20px;"><%= l(:button_edit) %></a>
<% end %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% 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) %>
<div class="cl"></div>
<p id="contentmessage<%=topic.id %>" class="project_board_content break_word">
<%= topic.content %>
</p>
<% if topic.content.size > 300 %>
<p>
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#contentmessage<%=topic.id %>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
<span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>
<% end %>
<%= link_to_attachments_course topic, :author => false %>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div>
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display: none">
<ul>
<%= render :partial => 'edit',locals: {:topic => topic} %>
</ul>
</div>
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml15 mb10" style="display: none" id="reply<%= topic.id %>">
<%= 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} %>
<a href="#" onclick="$('#message_form<%= topic.id%>').submit();" class="talk_btn fr c_white" style=""><%= l(:label_memo_create)%></a>
<% end %>
<div class="cl"></div>
</div>
<% 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 %>
<div class="talkWrapMsg">
<ul>
<% replies_show.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= 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) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<div class="talkWrapMsg" id="talkWrapMsg<%= topic.id %>" style="display: none">
<ul>
<% replies_all.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= 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) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<%if replies_all.first %>
<div class="talkWrapMsg"><a class=" ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %>
<% end %>
</div>
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<%# 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 %>

View File

@ -11,9 +11,10 @@
:method => :post}
} do |f| %>
<%= render :partial => 'form_project',
:locals => {:f => f, :replying => !topic.parent.nil?} %>
<a href="#" onclick="$('#message-form<%= topic.id%>').submit();"class="blue_btn fl c_white" ><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %>
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
<a href="#" onclick="$('#message-form<%= topic.id%>').submit();" class="blue_btn fl c_white" ><%= l(:button_submit)%></a>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" class="blue_btn grey_btn fl c_white"><%= l(:button_cancel) %></a>
<%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %>
</ul>
</div>
<% end %>
@ -29,7 +30,7 @@
:method => :post}
} do |f| %>
<%= render :partial => 'form_course',
:locals => {:f => f, :replying => !topic.parent.nil?} %>
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
<a href="javascript:void(0)" onclick="$('#message-form<%= topic.id%>').submit();"class="blue_btn fl c_white"><%= l(:button_submit)%></a>
<%= link_to l(:button_cancel), board_message_url(topic.board,topic.root, :r => (topic.parent_id &&topic.id)), :class => "blue_btn grey_btn fl c_white" %>

View File

@ -51,7 +51,7 @@
<li>
<% unless replying %>
<div class="fl ml3" style="padding-left: 52px;">
<%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %>
<%= render :partial => 'attachments/form_course', :locals => {:container => topic,:isReply => @isReply} %>
</div>
<% end %>
</li>

View File

@ -51,7 +51,7 @@
<li>
<% unless replying %>
<div class="fl ml3" style="padding-left: 52px;">
<%= render :partial => 'attachments/form_project', :locals => {:container => @message,:isReply => @isReply} %>
<%= render :partial => 'attachments/form_project', :locals => {:container => topic,:isReply => @isReply} %>
</div>
<% end %>
</li>

View File

@ -1,8 +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_project', :locals => {:f => f} %>
<%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %>
<li>
<%= link_to l(:button_cancel), project_boards_path(@project), :class => 'grey_btn fr ml10' %>
<a href="javascript:void(0)" onclick="show_newtalk();" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
<a href="#" onclick="$('#message-form').submit();" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
<div class="cl"></div>
</li>

View File

@ -1,59 +1,190 @@
<div class="project_r_h">
<h2 class="project_h2">
<div class="project_r_h" xmlns="http://www.w3.org/1999/html">
<h2 class="project_h2 fl">
<% if User.current.language == "zh"%>
<%= h @board.name %>
<% else %>
<%= l(:project_module_boards) %>
<% end %>
</h2>
<a href="javascript:void(0)" class="green_btn fr newtalk " onclick="show_newtalk();"><%= l(:label_message_new) %></a>
<div class="cl"></div>
</div>
<!--display the board-->
<% if !User.current.logged? %>
<div class="c_grey f14">
<%= 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" %>
</div>
<% end %>
<!-- 内容显示部分 -->
<div class="talk_top">
<div class="fl"><span><%= l(:label_project_board_count , :count => @topic_count)%></span></div>
<% if @project.enabled_modules.where("name = 'boards'").count > 0 && User.current.member_of?(@project) %>
<span><%= 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? %></span>
<% end %>
<div class="cl"></div>
</div>
<!-- 帖子内容显示 -->
<!-- 发布新帖部分 -->
<div class="cl"></div>
<div class=" talklist_box" >
<div class="talk_new ml15 mb10" id="about_newtalk" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;">
<ul>
<%= render :partial => 'project_new_topic' %>
</ul>
</div><!--talknew end-->
<!-- 帖子内容显示 -->
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
<% if @topics.any? %>
<% @topics.each do |topic| %>
<div class="problem_main">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"32",:height=>"32"), user_path(topic.author),:class => 'problem_pic talk_pic fl' %>
<div class="talk_txt fl">
<%= link_to h(topic.subject), board_message_path(@board, topic), title:topic.subject.to_s, :class =>"problem_tit fl" %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red"><%= l(:label_board_sticky)%></a>
<% @topics.each do |topic| %>
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
<div class="talkmain_txt fl mt5">
<% author = topic.author.to_s + "" %>
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
<p class="talkmain_tit fl fb break_word">&nbsp;&nbsp;<%= h(topic.subject) %></p>
<% if topic.editable_by?(User.current) %>
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;float: left;
margin-left: 20px;"><%= l(:button_edit) %></a>
<% end %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% 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) %>
<div class="cl"></div>
<p id="contentmessage<%=topic.id %>" class="project_board_content break_word">
<%= topic.content %>
</p>
<% if topic.content.size > 300 %>
<p>
<label id="expend_more_information<%= topic.id%>" onclick="show_more_reply('#contentmessage<%=topic.id %>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</label>
<span class="g-arr-down">
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
</span>
</p>
<% end %>
<%= link_to_attachments_course topic, :author => false %>
<%= l(:label_activity_time)%>&nbsp;&nbsp;<%= format_time topic.created_on %>
</div>
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display: none">
<ul>
<%= render :partial => 'edit',locals: {:topic => topic} %>
</ul>
</div>
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml15 mb10" style="display: none" id="reply<%= topic.id %>">
<%= 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} %>
<a href="#" onclick="$('#message_form<%= topic.id%>').submit();" class="talk_btn fr c_white" style=""><%= l(:label_memo_create)%></a>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<br/>
<%= l(:label_post_by)%><%= link_to topic.author, user_path(topic.author), :class =>"problem_name" %>
&nbsp;<%= l(:label_post_by_time)%><%= format_time topic.created_on %>
</div>
<%= link_to (l(:label_short_reply) + " "+topic.replies_count.to_s), board_message_path(@board, topic), :class => "talk_btn fr c_white" %>
<div class="cl"></div>
</div><!--讨论主类容 end-->
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% 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 %>
<div class="talkWrapMsg">
<ul>
<% replies_show.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= 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) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<div class="talkWrapMsg" id="talkWrapMsg<%= topic.id %>" style="display: none">
<ul>
<% replies_all.each do |message| %>
<li>
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
<div class="Msg_txt">
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
<br/>
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
<br/>
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
<%= 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) %>
</div>
<div class="cl"></div>
</li><!---留言内容-->
<% end %>
</ul>
</div>
<%if replies_all.first %>
<div class="talkWrapMsg"><a class=" c_blue ml258" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a></div>
<% end %>
<% end %>
</div>
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
<ul class="wlist">
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
</ul>
<!--讨论主类容 end-->
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
</ul>
<!--讨论主类容 end-->
<%# 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 %>
@ -61,3 +192,33 @@
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
<% end %>
</div>
<script type="text/javascript">
// var flag = false;
// jQuery(document).ready(function($) {
// transpotUrl('#content');
// });
function submit_message_replay()
{
if(flag)
{
$("#message_form").submit();
}
}
function regexContent()
{
var content = $.trim($("#message_content").val());
if(content.length ==0)
{
$("#message_content_span").text("<%= l(:label_reply_empty) %>");
$("#message_content_span").css('color','#ff0000');
flag = false;
}
else
{
$("#message_content_span").text("<%= l(:label_field_correct) %>");
$("#message_content_span").css('color','#008000');
flag = true;
}
}
</script>

View File

@ -20,20 +20,16 @@
<div class="">
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
<% if User.current.logged? %>
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
<!--私有项目资源部能引用,不能设置公开私有-->
<!--公开项目资源可以应用,管理员和资源上传者拥有设置公开私有权限-->
<% if project.is_public? %>
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
<% if manage_allowed && file.container_id == project.id && file.container_type == "Project" %>
<% if (Member.where(:user_id => User.current.id, :project_id => @project.id).first.roles.to_s.include?("Manager") || file.author_id == User.current.id) && project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project" %>
<span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open",:method => :post %>
</span>
<% else %>
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
<% end %>
<% else %>
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
<% end %>
<% else %>
<% end %>
</div>
<div class="cl"></div>

View File

@ -42,7 +42,7 @@
<div id="tb_" class="tb_">
<ul>
<li id="tb_1" class="hovertab" onclick="switchTab(1);this.blur();return false;" style="width: auto; padding:5px 10px 0;">
修改作
修改作
</li>
<li id="tb_2" class="normaltab" onclick="switchTab(2);this.blur();return false;">
成员

View File

@ -23,7 +23,7 @@
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %>
</div>
<% end%>

View File

@ -12,7 +12,7 @@
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %>
</div>
<% end%>

View File

@ -23,7 +23,7 @@
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a>
<% end %>
<% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), new_board_message_path(@project.boards.first), :layout => 'base_projects', :class => "subnav_green ml105" %>
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
<% end %>
</div>
<% end%>

View File

@ -133,7 +133,7 @@
<div class="subNav">
<%= 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)}", 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_message_new)}",course_boards_path(@course, :flag => true),:class => 'subnav_green ml95 c_white') if User.current.member_of_course?(@course) && @course.boards.first %>
</div>
<div class="subNav">
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02" %>

View File

@ -23,7 +23,7 @@
<% elsif @message.course %>
<%#= course_board_breadcrumb(@message) %>
<div class="talk_new ml15">
<ul>
<ul>0
<%= form_for @message, {
:as => :message,
:url => {:action => 'edit'},

View File

@ -25,11 +25,11 @@
</li>
<li class="ml40" >
<% if is_new %>
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_create), "javascript:void(0)", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>
<% else %>
<%= link_to l(:button_save), "#", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'blue_btn grey_btn fl c_white' %>
<%= link_to l(:button_save), "javascript:void(0)", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => '$("#edit-news").hide(); return false;',:class => 'blue_btn grey_btn fl c_white' %>
<% end %>
<div class="cl"></div>
</li>

View File

@ -23,9 +23,10 @@ function reload(fileSpan) {
}
function addFile(inputEl, file, eagerUpload) {
function addFile_board(inputEl, file, eagerUpload, id) {
if ($('#attachments_fields').children().length < 30) {
var attachments_frame = '#attachments_fields' + id;
if ($(attachments_frame).children().length < 30) {
deleteallfiles = $(inputEl).data('deleteAllFiles');
var attachmentId = addFile.nextAttachmentId++;
@ -48,7 +49,7 @@ function addFile(inputEl, file, eagerUpload) {
}).toggle(!eagerUpload),
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
).appendTo('#attachments_fields');
).appendTo(attachments_frame);
if(eagerUpload) {
ajaxUpload(file, attachmentId, fileSpan, inputEl);
@ -58,7 +59,42 @@ function addFile(inputEl, file, eagerUpload) {
}
return null;
}
function addFile(inputEl, file, eagerUpload) {
var attachments_frame = '#attachments_fields';
if ($(attachments_frame).children().length < 30) {
deleteallfiles = $(inputEl).data('deleteAllFiles');
var attachmentId = addFile.nextAttachmentId++;
var fileSpan = $('<span>', { 'id': 'attachments_' + attachmentId, 'class':'attachment' });
fileSpan.append(
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('descriptionPlaceholder') } ).toggle(!eagerUpload),
$('<span >'+$(inputEl).data('fieldIsPublic')+':</span>').attr({ 'class': 'ispublic-label' }) ,
$('<input>', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload),
$('<a>&nbsp</a>').attr({ 'href': "#", 'class': 'remove-upload' }).click(function(){
if(confirm($(inputEl).data('areYouSure'))){
removeFile();
if(!eagerUpload){
(function(e){
reload(e);
})(fileSpan);
}
}
}).toggle(!eagerUpload),
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
).appendTo('#attachments_fields');
if(eagerUpload) {
ajaxUpload(file, attachmentId, fileSpan, inputEl);
}
return attachmentId;
}
return null;
}
addFile.nextAttachmentId = 1;
function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
@ -202,7 +238,26 @@ function addInputFiles(inputEl) {
//clearedFileInput.insertAfter('#attachments_fields');
}
function addInputFiles_board(inputEl, id) {
// var clearedFileInput = $(inputEl).clone().val('');
if (inputEl.files) {
// upload files using ajax
uploadAndAttachFiles_board(inputEl.files, inputEl, id);
// $(inputEl).remove();
} else {
// browser not supporting the file API, upload on form submission
var attachmentId;
var aFilename = inputEl.value.split(/\/|\\/);
attachmentId = addFile_board(inputEl, { name: aFilename[ aFilename.length - 1 ] }, false, id);
if (attachmentId) {
$(inputEl).attr({ name: 'attachments[' + attachmentId + '][file]'}).hide();
$('#upload_file_count').html("<span id=\"count\">"+count+"</span>"+$(inputEl).data('fileCount'));
}
}
//clearedFileInput.insertAfter('#attachments_fields');
}
function uploadAndAttachFiles(files, inputEl) {
var maxFileSize = $(inputEl).data('max-file-size');
@ -218,7 +273,21 @@ function uploadAndAttachFiles(files, inputEl) {
$.each(files, function() {addFile(inputEl, this, true);});
}
}
function uploadAndAttachFiles_board(files, inputEl, id) {
var maxFileSize = $(inputEl).data('max-file-size');
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
var sizeExceeded = false;
$.each(files, function() {
if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
});
if (sizeExceeded) {
window.alert(maxFileSizeExceeded);
} else {
$.each(files, function() {addFile_board(inputEl, this, true, id);});
}
}
function handleFileDropEvent(e) {
$(this).removeClass('fileover');

View File

@ -83,8 +83,8 @@ a:hover.talk_edit{ color:#ff5722;}
.talkpage_text{ border:1px solid #64bdd9; width:600px; color:#7d7d7d; padding:5px; margin:10px 0 10px 50px; background:#fff;}
/****新建讨论***/
.talk_new{ color:#4c4c4c;}
.talk_input{ border:1px solid #64bdd9; height:16px; width:585px; background:#fff; margin-bottom:10px; padding:5px;}
.talk_text{ border:1px solid #64bdd9; height:100px;width:585px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
.talk_input{ border:1px solid #64bdd9; height:16px; width:550px; background:#fff; margin-bottom:10px; padding:5px;}
.talk_text{ border:1px solid #64bdd9; height:100px;width:550px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
.talk_new ul li{ }
.sb{width:70px; height:26px; color:#606060; cursor:pointer;}
a.blue_btn{ background:#64bdd9; display:block; font-size:14px;color:#fff; font-weight:normal; text-align:center; margin-left:10px; margin-bottom:10px; padding:2px 10px;}
@ -364,6 +364,23 @@ span.add_attachment {font-size: 80%;line-height: 2.5em;}
.reply_btn:hover{ background:#999; color:#fff; }
#attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
.attachments_fields input.description {margin-left:4px; width:100px; }
.attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';}
.attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
a.remove-upload:hover {text-decoration:none !important;}
.attachments_fields input.is_public_checkbox {width:20px;}
.attachments_fields span.ispublic-label {display: inline-block;width: 30px;margin-left: 10px;}
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;}
.attachments_fields input.filename {border: 0;height: 1.8em;width: 150px;color: #555;background-color: inherit;background: url(../images/attachment.png) no-repeat 1px 50%;padding-left: 18px;padding-top: 2px;}
span.add_attachment {font-size: 80%;line-height: 2.5em;}
.attachments_fields span {display: block;white-space: nowrap;}
.file_selector{position: relative;opacity: 0;filter: alpha(opacity:0);}
.attachments_fields .ajax-waiting input.filename {background:url(../images/hourglass.png) no-repeat 0px 50%;}
.attachments_fields .ajax-loading input.filename {background:url(../images/loading.gif) no-repeat 0px 50%;}
.ui-widget {
font-family: Verdana, sans-serif;
font-size: 1.1em;

View File

@ -49,7 +49,7 @@ a:hover.subnav_green{ background:#14ad5a;}
/*简介*/
.project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;}
.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;}
.project_board_content{overflow: hidden;max-height: 50px;word-break: break-all;word-wrap: break-word;}
.project_board_content{overflow: hidden;max-height: 55px;word-break: break-all;word-wrap: break-word;}
.course_description_none{max-height: none;}
.lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;display: none;}
.lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;}

View File

@ -123,8 +123,8 @@ a:hover.talk_edit{ color:#ff5722;}
.recall_con{ float:left;color:#777777; width:520px; margin-left:10px; }
/****新建讨论***/
.talk_new{ color:#4c4c4c;}
.talk_input{ border:1px solid #64bdd9; height:16px; width:585px; background:#fff; margin-bottom:10px; padding:5px;}
.talk_text{ border:1px solid #64bdd9; height:100px;width:585px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
.talk_input{ border:1px solid #64bdd9; height:16px; width:550px; background:#fff; margin-bottom:10px; padding:5px;}
.talk_text{ border:1px solid #64bdd9; height:100px;width:550px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;}
.talk_new ul li{ }
.sb{width:70px; height:26px; color:#606060; cursor:pointer;}
/*a.blue_btn{ background:#64bdd9; display:block; font-size:14px;color:#fff; font-weight:normal; text-align:center; margin-left:10px; margin-bottom:10px; padding:2px 10px;}*/
@ -254,8 +254,22 @@ span.add_attachment {font-size: 80%;line-height: 2.5em;}
.reply_btn{ cursor:pointer; -moz-border-radius:3px; -webkit-border-radius:3px; border:1px solid #ccc; color:#999; border-radius:3px; padding:2px 10px; margin-bottom:10px;display: block;margin-left: 470px;}
.reply_btn:hover{ background:#999; color:#fff; }
.attachments_fields input.description {margin-left:4px; width:100px; }
.attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';}
.attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
a.remove-upload:hover {text-decoration:none !important;}
.attachments_fields input.is_public_checkbox {width:20px;}
.attachments_fields span.ispublic-label {display: inline-block;width: 30px;margin-left: 10px;}
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;}
.attachments_fields input.filename {border: 0;height: 1.8em;width: 150px;color: #555;background-color: inherit;background: url(../images/attachment.png) no-repeat 1px 50%;padding-left: 18px;padding-top: 2px;}
span.add_attachment {font-size: 80%;line-height: 2.5em;}
.attachments_fields span {display: block;white-space: nowrap;}
.file_selector{position: relative;opacity: 0;filter: alpha(opacity:0);}
.attachments_fields .ajax-waiting input.filename {background:url(../images/hourglass.png) no-repeat 0px 50%;}
.attachments_fields .ajax-loading input.filename {background:url(../images/loading.gif) no-repeat 0px 50%;}
.ui-widget {
font-family: Verdana, sans-serif;
font-size: 1.1em;