Merge remote-tracking branch 'origin/develop' into weixin_guange

This commit is contained in:
guange 2016-07-26 18:28:28 +08:00
commit c5dd2eaf41
18 changed files with 93 additions and 55 deletions

View File

@ -10,7 +10,7 @@ class AtController < ApplicationController
@users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users
#加上all
if @users.size > 0
if @user && @users.size > 0
allUser = Struct.new(:id, :name).new
allUser.id = @users.map{|u| u.id}.join(",")
allUser.name = "all"

View File

@ -440,7 +440,7 @@ class IssuesController < ApplicationController
jour.save
update_user_activity(@issue.class,@issue.id)
update_forge_activity(@issue.class,@issue.id)
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
@user_activity_id = params[:user_activity_id]
if params[:issue_id]
@issue_id = params[:issue_id]
@ -483,12 +483,21 @@ class IssuesController < ApplicationController
if User.current.logged?
jour = Journal.find(params[:journal_id])
@issue = Issue.find params[:id]
new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id)
@project = @issue.project
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
@priorities = IssuePriority.active
new_jour = Journal.new
new_jour.user_id = User.current.id
new_jour.reply_id = params[:journal_id]
new_jour.parent_id = jour.id
new_jour.notes = params[:content]
new_jour.journalized = @issue
new_jour.save_attachments(params[:attachments])
# new_jour = @issue.journals.build(:user_id => User.current.id, :reply_id => params[:journal_id], :notes => params[:content], :parent_id => jour.id)
@user_activity_id = params[:user_activity_id]
if new_jour.save
update_user_activity(@issue.class,@issue.id)
update_forge_activity(@issue.class,@issue.id)
respond_to do |format|
format.js
end
@ -496,13 +505,28 @@ class IssuesController < ApplicationController
end
end
#
# 需要刷新详情页面,代码同步一致
# 获取project和issue状态是为了刷新页面
# 值所以用delete是因为issue和journal在act_as_attachment中是同一个类型
# 非动态页面直接刷新,动态页面手动刷新
def delete_journal
@issue = Issue.find(params[:id])
Journal.destroy(params[:journal_id])
begin
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id]).first
forge_acts.destroy unless forge_acts.nil?
at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id]).first
at_message.destroy unless at_message.nil?
Journal.delete(params[:journal_id])
rescue Exception => e
puts e
end
@user_activity_id = params[:user_activity_id]
respond_to do |format|
format.js
if @user_activity_id
format.js
else
format.html{ redirect_to issue_url(@issue)}
end
end
end

View File

@ -381,6 +381,7 @@ class StudentWorkController < ApplicationController
@is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
@show_all = false
# 0表示没有分组的学生-1表示所有分组的学生
if @group
if @group == "0"
none_group_students = @course.members.select{ |member| member.course_group_id == 0 }
@ -389,6 +390,13 @@ class StudentWorkController < ApplicationController
else
student_in_group = '(' + none_group_students.map{ |member| member.user_id }.join(',') + ')'
end
elsif @group == "-1"
all_group_students = @course.members.select{ |member| member.course_group_id }
if all_group_students.empty?
student_in_group = '(0)'
else
student_in_group = '(' + all_group_students.map{ |member| member.user_id }.join(',') + ')'
end
else
course_group = CourseGroup.find_by_id(@group)
group_students = course_group.users

View File

@ -88,7 +88,7 @@ class SyllabusesController < ApplicationController
end
def destroy
if @syllabus && @syllabus.courses.empty?
if @syllabus && @syllabus.courses.not_deleted.empty?
@syllabus.destroy
redirect_to user_courselist_user_path(User.current.id)
end

View File

@ -33,7 +33,6 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
# def user_blogs_path(resource,parameters={})
# super
# end

View File

@ -595,19 +595,19 @@ module CoursesHelper
def get_acts_list_type type
case type
when "homework"
">" + l(:label_homework_acts)
l(:label_homework_acts)
when "news"
">" + l(:label_news_acts)
l(:label_news_acts)
when "attachment"
">" + l(:label_attachment_acts)
l(:label_attachment_acts)
when "message"
">" + l(:label_message_acts)
l(:label_message_acts)
when "journalsForMessage"
">" + l(:label_journalsForMessage_acts)
l(:label_journalsForMessage_acts)
when "poll"
">" + l(:label_poll_acts)
l(:label_poll_acts)
else
">" + l(:label_all_cats)
l(:label_all_cats)
end
end

View File

@ -55,7 +55,7 @@ class Journal < ActiveRecord::Base
before_create :split_private_notes, :add_journals_count
# fq
after_save :act_as_activity,:be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id)
after_save :be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id)
# end
#after_destroy :down_user_score
#before_save :be_user_score

View File

@ -132,12 +132,12 @@
<div id="topic_editor" style="display: none;">
<%if User.current.member_of_course?(course) %>
<div class="mt10">
<% if User.current.admin? %>
<% if User.current.id == course.tea_id %>
<%= f.check_box :sticky, :value => topic.sticky %>
<%= label_tag 'message_sticky', l(:label_board_sticky) %>
<% end %>
<%= f.check_box :locked, :value => topic.locked %>
<%= label_tag 'message_locked', l(:label_board_locked) %>
<% end %>
<div class="cl"></div>
</div>
<% end %>

View File

@ -9,7 +9,7 @@
<input type="hidden" value="<%= @type%>" name="type" id="user_activities_type">
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">班级动态
<div class="NewsBannerName">
<%= get_acts_list_type @type %></div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>

View File

@ -40,7 +40,6 @@
l(:button_delete),
{:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>comment.id},
:method => :get,
:remote=>true,
:class => 'fr mr20',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
@ -73,7 +72,7 @@
<div class="mt5 fl">
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
</div>
<span nhname='contentmsg_<%= @issue.id %>' class="fl"></span>
<span nhname='contentmsg_<%= @issue.id %>' class="fl mt5"></span>
<a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr mt5" style="display:none;">发送</a>
<div class="cl"></div>
<% end %>

View File

@ -0,0 +1,21 @@
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
$("#issue_detail_show").html('<%= escape_javascript(render :partial => 'issues/detail') %>')
$("#issue_edit_show").html('<%= escape_javascript(render :partial => 'issues/edit') %>')
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @issue}) %>");
sd_create_editor_from_data(<%= @issue.id %>, null, "100%", "<%= @issue.class.name %>");
issue_desc_editor = KindEditor.create('#issue_description',
{"width":"85%",
"resizeType":0,
"no_label":true,
"at_id":<%= @issue.project_id%>,
"at_type":"Project",
"autoHeightMode":true,
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%=@issue.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})",
"emotionsBasePath":'<%= Setting.host_name%>',
"height":300,
"allowFileManager":true,
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"});
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>');
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%= @issue.class.name %>");

View File

@ -1,25 +1,5 @@
<% if @issue_id %> //issue详情中回复
$("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>");
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>");
$("#issue_detail_show").html('<%= escape_javascript(render :partial => 'issues/detail') %>')
$("#issue_edit_show").html('<%= escape_javascript(render :partial => 'issues/edit') %>')
sd_create_editor_from_data(<%= @issue.id %>, null, "100%", "<%= @issue.class.name %>");
issue_desc_editor = KindEditor.create('#issue_description',
{"width":"85%",
"resizeType":0,
"no_label":true,
"at_id":<%= @issue.project_id%>,
"at_type":"Project",
"autoHeightMode":true,
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%=@issue.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})",
"emotionsBasePath":'<%= Setting.host_name%>',
"height":300,
"allowFileManager":true,
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"});
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)')
sd_create_editor_from_data(<%= @issue.id %>, null, "100%","<%=@issue.class.name%>");
<%= render "jounal_refresh" %>
<%else%>
$("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity");

View File

@ -1,8 +1,8 @@
<% if @user_activity_id %>
<%# 动态中 %>
$("#div_user_issue_reply_<%=@user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>, null, "100%","<%=@issue.class.name%>");
<% else %>
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>');
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
<%# issue详情 %>
<%= render "jounal_refresh" %>
<% end %>

View File

@ -2,7 +2,5 @@
$("#div_user_issue_reply_<%=@user_activity_id%>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
sd_create_editor_from_data(<%= @user_activity_id%>, null, "100%","<%=@issue.class.name%>");
<% else %>
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)')
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
<%= render "jounal_refresh" %>
<% end %>

View File

@ -3,8 +3,10 @@
<% student_num = studentCount(@course) %>
<% course_file_num = visable_attachemnts_incourse(@course).count %>
<p class="sy_cgrey mb10">
<%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %>
&nbsp;&gt;&nbsp;
<% if @course.syllabus %>
<%=link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class => 'sy_cgrey' %>
&nbsp;&gt;&nbsp;
<% end %>
<%=link_to @course.name, course_path(@course), :class => 'sy_cgrey' %>
</p>
@ -16,7 +18,9 @@
<li><%= link_to "班级配置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "postOptionLink" %></li>
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "postOptionLink" %></li>
<li><%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "postOptionLink" %></li>
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "postOptionLink", :target => "_blank" %></li>
<% if @course.syllabus %>
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "postOptionLink", :target => "_blank" %></li>
<% end %>
</ul>
</li>
</ul>

View File

@ -1,6 +1,6 @@
<br>
<div style='width:470px;text-align:center;font-family: "微软雅黑","宋体"' class="f14">
<% if @syllabus.courses.empty? || @syllabus.courses.not_deleted.empty? %>
<% if @syllabus.courses.not_deleted.empty? %>
确认删除该课程吗?
<% else %>
该课程下已经存在班级,不能删除。
@ -8,7 +8,7 @@
</div>
</br>
<div style='width:164px; margin:0 auto; text-align:center; font-family: "微软雅黑","宋体"'>
<% if @syllabus.courses.empty?|| @syllabus.courses.not_deleted.empty? %>
<% if @syllabus.courses.not_deleted.empty? %>
<%=link_to '确认', syllabus_path(@syllabus), :class => 'Blue-btn fl', :method => 'delete'%>
<a href='javascript:void(0);' class='Blue-btn fl' onclick='hideModal()'>关闭</a>
<% else %>

View File

@ -37,7 +37,7 @@ zh:
label_message_acts: 论坛动态
label_journalsForMessage_acts: 留言动态
label_poll_acts: 问卷动态
label_all_cats: 全部动态
label_all_cats: 班级动态
#
# 课程托管平台主页

View File

@ -0,0 +1,5 @@
class AddStudentIdToApplyAddSchool < ActiveRecord::Migration
def change
add_column :apply_add_schools, :user_id, :integer
end
end