Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
huang 2016-11-11 10:38:10 +08:00
commit b633200ab6
9 changed files with 80 additions and 26 deletions

View File

@ -34,11 +34,11 @@ class HomeworkCommonController < ApplicationController
@homeworks = paginateHelper @homework_commons,10
#设置at已读
@homeworks.each do |homework|
homework.journals_for_messages.each do |j|
User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
# homework.journals_for_messages.each do |j|
# User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
# end
homework.delay.set_jour_viewed
end
end
@left_nav_type = 3
respond_to do |format|
format.js

View File

@ -73,20 +73,50 @@ class HomeworkCommon < ActiveRecord::Base
if self.homework_detail_manual.comment_status == 0
self.course_messages.destroy_all
else
# self.course.members.each do |m|
# # if m.user_id != self.user_id
# #self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
# rolesids = []
# m.roles.each do |role|
# rolesids << role.id
# end
# if rolesids.include?(10)
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
# if count == 0
# ws = WechatService.new
# name = self.course.syllabus.nil? ? self.course.name : self.course.syllabus.title+" • "+self.course.name
# ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name}#{l(:label_new_homework_template)}", name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
# end
# end
# # end
# end
self.delay.send_homework_wechat_message_delay
end
end
end
#作业微信通知delay
def send_homework_wechat_message_delay
self.course.members.each do |m|
# if m.user_id != self.user_id
#self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
rolesids = []
m.roles.each do |role|
rolesids << role.id
end
if rolesids.include?(10)
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
name = self.course.syllabus.nil? ? self.course.name : self.course.syllabus.title+""+self.course.name
ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name}#{l(:label_new_homework_template)}", name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
end
end
# end
end
end
end
end
#动态的更新
def update_activity
update_course_activity(self.class, self.id)
@ -135,6 +165,12 @@ class HomeworkCommon < ActiveRecord::Base
# end
# end
def set_jour_viewed
self.journals_for_messages.each do |j|
User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
end
end
delegate :language_name, :language, :to => :homework_detail_programing
end

View File

@ -1,5 +1,5 @@
<p ondblclick=show_edit_file_description('<%= file.id %>')>
<span style="white-space:nowrap;">资源描述:</span><% if file.description.blank? %><span style="color:#C5C5BE; cursor:pointer;" title="双击可编辑">双击添加描述</span><% else %><span style="cursor:pointer;" title="双击可编辑" class="break_word"><%= file.description %></span><% end %>
<span style="white-space:nowrap;">资源描述:</span><% if file.description.blank? %><span style="color:#C5C5BE; cursor:pointer;" title="双击可编辑">双击添加描述</span><% else %><span id="file_description_tip_<%= file.id %>" style="cursor:pointer;" title="双击可编辑" class="break_word"><%= file.description %></span><% end %>
<%#= file.description.blank? ? "该资源暂无描述" : file.description %>
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);", :onclick => "show_edit_file_description("+file.id.to_s+");"%>
</p>

View File

@ -45,7 +45,7 @@
</div>
<%= form_tag(edit_file_description_org_subfield_file_path(file, :org_subfield_id => org_subfield.id ),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
onblur="commit_files_description('#files_query_form_<%= file.id %>','#file_description_edit_<%= file.id %>','#file_description_show_<%= file.id %>','#file_description_tip_<%= file.id %>');"><%= file.description %></textarea>
<% end %>
</div>
<% else %>
@ -117,7 +117,13 @@
<% end%>
<script>
function commit_files_description(id) {
function commit_files_description(id,des_id,show_id,tip_id) {
if($(tip_id).text() == $(des_id).val()){
$(des_id).hide();
$(show_id).show();
return;
}
$(id).submit();
}
</script>

View File

@ -42,7 +42,7 @@
</div>
<%= form_tag(edit_file_description_project_file_path(file, :project_id => project.id),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
onblur="commit_files_description('#files_query_form_<%= file.id %>','#file_description_edit_<%= file.id %>','#file_description_show_<%= file.id %>','#file_description_tip_<%= file.id %>');"><%= file.description %></textarea>
<% end %>
</div>
<% else %>
@ -73,7 +73,13 @@
</ul>
<script>
function commit_files_description(id) {
function commit_files_description(id,des_id,show_id,tip_id) {
if($(tip_id).text() == $(des_id).val()){
$(des_id).hide();
$(show_id).show();
return;
}
$(id).submit();
}
</script>

View File

@ -44,7 +44,7 @@
</div>
<%= form_tag(edit_file_description_course_file_path(file, :course_id => @course.id),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
onblur="commit_files_description('#files_query_form_<%= file.id %>','#file_description_edit_<%= file.id %>','#file_description_show_<%= file.id %>','#file_description_tip_<%= file.id %>');"><%= file.description %></textarea>
<% end %>
</div>
<% else %>
@ -105,7 +105,13 @@
</div>
<div class="cl"></div>
<script>
function commit_files_description(id) {
function commit_files_description(id,des_id,show_id,tip_id) {
if($(tip_id).text() == $(des_id).val()){
$(des_id).hide();
$(show_id).show();
return;
}
$(id).submit();
}
</script>

View File

@ -7,7 +7,7 @@
<div class="side_list">
<div style="background-color:#fff; padding:10px 0; border:1px solid #aaa; border-bottom:none;">
<span class="fontGrey3 f14 ml40" style="vertical-align:top;">问题和建议</span>
<span class="hide-side-bar side-bar-circle fr mt3 mr10" title="关闭"><span class="side-bar-content" style="font-family:'微软雅黑, 宋体'">×</span></span>
<!--<span class="hide-side-bar side-bar-circle fr mt3 mr10" title="关闭"><span class="side-bar-content" style="font-family:'微软雅黑, 宋体'">×</span></span>-->
<span class="close_btn side-bar-circle fr mt3 mr10" title="隐藏"><span class="side-bar-content" style="left:4px; font-family:'微软雅黑, 宋体'"></span></span>
</div>
<div style="background-color:#fff; border-left:1px solid #aaa; border-right:1px solid #aaa;">

View File

@ -6,7 +6,7 @@
<div class="side_list">
<div style="background-color:#fff; padding:10px 0; border:1px solid #aaa; border-bottom:none;">
<span class="fontGrey3 f14 ml40" style="vertical-align:top;">问题和建议</span>
<span class="hide-side-bar side-bar-circle fr mt3 mr10" title="关闭"><span class="side-bar-content">×</span></span>
<!--<span class="hide-side-bar side-bar-circle fr mt3 mr10" title="关闭"><span class="side-bar-content">×</span></span>-->
<span class="close_btn side-bar-circle fr mt3 mr10" title="隐藏"><span class="side-bar-content" style="left:4px;"></span></span>
</div>
<div style="background-color:#fff; border-left:1px solid #aaa; border-right:1px solid #aaa;">