Merge branch 'cxt_course' into szzh
This commit is contained in:
commit
f0216cf604
|
@ -211,6 +211,8 @@ class MessagesController < ApplicationController
|
|||
end
|
||||
if params[:user_activity_id]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@is_course = params[:is_course]
|
||||
@is_board = params[:is_board]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -241,9 +243,17 @@ class MessagesController < ApplicationController
|
|||
if request.post? && @message.save
|
||||
attachments = Attachment.attach_files(@message, params[:attachments])
|
||||
render_attachment_warning_if_needed(@message)
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
#flash[:notice] = l(:notice_successful_update)
|
||||
@message.reload
|
||||
if params[:is_board]
|
||||
if params[:is_course] && params[:is_course].to_i == 0
|
||||
redirect_to user_activities_path(User.current.id)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
|
||||
if @project
|
||||
redirect_to project_path(@project)
|
||||
elsif @course
|
||||
redirect_to course_activity_path(@course)
|
||||
end
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
||||
if @project
|
||||
redirect_to project_boards_path(@project)
|
||||
elsif @course
|
||||
|
@ -253,26 +263,22 @@ class MessagesController < ApplicationController
|
|||
redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
|
||||
end
|
||||
elsif request.get? || request.post?
|
||||
if params[:is_board]
|
||||
if @project
|
||||
redirect_to project_boards_path(@project)
|
||||
elsif @course
|
||||
redirect_to course_boards_path(@course)
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if @project
|
||||
layout_file = 'base_projects'
|
||||
elsif @course
|
||||
layout_file = 'base_courses'
|
||||
elsif @org_subfield
|
||||
@organization = @org_subfield.organization
|
||||
layout_file = 'base_org'
|
||||
end
|
||||
render :layout => layout_file
|
||||
}
|
||||
end
|
||||
if params[:is_course] && params[:is_board]
|
||||
@is_course = params[:is_course]
|
||||
@is_board = params[:is_board]
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if @project
|
||||
layout_file = 'base_projects'
|
||||
elsif @course
|
||||
layout_file = 'base_courses'
|
||||
elsif @org_subfield
|
||||
@organization = @org_subfield.organization
|
||||
layout_file = 'base_org'
|
||||
end
|
||||
render :layout => layout_file
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -290,25 +296,28 @@ class MessagesController < ApplicationController
|
|||
@message.destroy
|
||||
# modify by nwb
|
||||
if @project
|
||||
if params[:is_board]
|
||||
redirect_to project_boards_url(@project)
|
||||
if params[:is_course] && params[:is_course].to_i == 0
|
||||
redirect_to user_activities_path(User.current.id)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
|
||||
redirect_to project_path(@project)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
||||
redirect_to project_boards_path(@project)
|
||||
elsif @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 project_board_url(@project, @board)
|
||||
end
|
||||
# redirect_to board_message_url(@board, @topic, :r => @reply)
|
||||
redirect_to project_board_url(@project, @board)
|
||||
end
|
||||
elsif @course
|
||||
if params[:is_board]
|
||||
redirect_to course_boards_url(@course)
|
||||
if params[:is_course] && params[:is_course].to_i == 0
|
||||
redirect_to user_activities_path(User.current.id)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
|
||||
redirect_to course_activity_path(@course)
|
||||
elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
|
||||
redirect_to course_boards_path(@course)
|
||||
elsif @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_boards_path(@course)
|
||||
end
|
||||
elsif @org_subfield
|
||||
if params[:is_board]
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %>
|
||||
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
<%= render :partial => 'users/project_message', :locals => {:activity => topic, :user_activity_id => topic.id} %>
|
||||
<%= render :partial => 'users/project_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
<% when 'News' %>
|
||||
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'users/course_message', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<%= render :partial => 'users/course_message', :locals => {:activity => act, :user_activity_id => activity.id,:is_course=>1,:is_board=>0} %>
|
||||
<% when 'Poll' %>
|
||||
<%= render :partial => 'users/course_poll', :locals => {:activity => act, :user_activity_id => activity.id} %>
|
||||
<% when 'JournalsForMessage' %>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% if @message.project %>
|
||||
<%= form_for @message, {:as => :message,
|
||||
:url => {:action => 'edit'},
|
||||
:url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board},
|
||||
:html => {:multipart => true,
|
||||
:id => 'message-form',
|
||||
:method => :post}
|
||||
|
@ -14,7 +14,7 @@
|
|||
<% elsif @message.course %>
|
||||
<%= form_for @message, {
|
||||
:as => :message,
|
||||
:url => {:action => 'edit'},
|
||||
:url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board},
|
||||
:html => {:multipart => true,
|
||||
:id => 'message-form',
|
||||
:method => :post}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%if @project%>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
|
||||
<%elsif @course%>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
|
||||
<% elsif @org_subfield %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
|
||||
<%end%>
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
<!--message -->
|
||||
<% when "Message" %>
|
||||
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id} %>
|
||||
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id,:is_course=>1,:is_board=>0} %>
|
||||
<!--new 新闻-->
|
||||
<% when "News" %>
|
||||
<% if !activity.forge_act.nil? and activity.forge_act.project %>
|
||||
|
|
|
@ -44,33 +44,37 @@
|
|||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= user_activity_id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
|
||||
<div class="homepagePostSetting" id="message_setting_<%= user_activity_id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
edit_board_message_path(activity.id,:board_id=>activity.board_id),
|
||||
edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
|
||||
:class => 'postOptionLink'
|
||||
) if activity.course_editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
delete_board_message_path(activity.id,:board_id=>activity.board_id),
|
||||
delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.course_destroyable_by?(User.current) %>
|
||||
<%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
@ -137,7 +141,7 @@
|
|||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
|
||||
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => is_board,is_course=>is_course},:method => "post", :remote => true) do |f|%>
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="reply[content]"></textarea>
|
||||
|
|
|
@ -44,33 +44,36 @@
|
|||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= user_activity_id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
|
||||
<div class="homepagePostSetting" id="message_setting_<%= user_activity_id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
edit_board_message_path(activity.id,:board_id=>activity.board_id),
|
||||
edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
|
||||
:class => 'postOptionLink'
|
||||
) if activity.editable_by?(User.current) %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
delete_board_message_path(activity.id,:board_id=>activity.board_id),
|
||||
delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if activity.destroyable_by?(User.current) %>
|
||||
<%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
<% when 'News' %>
|
||||
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% when 'Message'%>
|
||||
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
|
||||
<% when 'Poll' %>
|
||||
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
|
||||
<% when 'Course'%>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<% when 'Issue' %>
|
||||
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% when 'Message' %>
|
||||
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
|
||||
<% when 'ProjectCreateInfo'%>
|
||||
<%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue