socialforge/app/views/courses/show_old.html.erb

84 lines
3.7 KiB
Plaintext
Raw Normal View History

2015-09-24 16:30:14 +08:00
<div class="project_r_h">
<h2 class="fl project_h2"><%= l(:label_activity)%></h2>
</div>
<%@course_activities.each do |activity|%>
<div class="problem_main" nhname="container">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(activity.user), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5 upload_img list_style">
<%= link_to_user_header(activity.user,false,:class => 'problem_name c_orange fl') %>
<span class="fl"> &nbsp;</span>
<span class="fl"> <%= activity.course_act_type == "Course" ? "创建了课程" : l(:label_new_activity) %></span>
<%#= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
<%#if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
<!--span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span-->
<%#end%>
<%= link_to course_activity_link activity%>
<div class="cl"></div>
<p class="mt5 break_word">
<%= course_activity_desc activity%>
<br />
<div class="cl"></div>
<%= activity.course_act_type == "Course" ? l(:label_create_time) : l(:label_activity_time) %> <%= format_time(activity.created_at) %>
</p>
<%= link_to_attachments_course(activity.course_act) if activity.course_act_type.to_s == "News" %>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<script type="text/javascript">
$(function(){
function nh_new_notify_count_show(){
var new_notify_count = $("#new_notify_count").html();
if(new_notify_count>0){
$("#new_notify_count").parent('span').show();
}else{
$("#new_notify_count").parent('span').hide();
}
}
$("div[nhname='container']").each(function(){
var container = $(this);
var btn = $("a[nhname='nh_act_link']",container);
if(btn.data('notify-id')>0){
btn.attr('target','_blank');
btn.click(function(){
var flag = $("span[nhname='nh_act_flag']",container);
if(flag!=undefined){
var url = $(this).data('href');
$.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){
flag.remove();
$("#new_notify_count").html($("#new_notify_count").html()-1);
nh_new_notify_count_show();
}
}});
}
return true;
});
}
});
$("label[nhname='nh_act_link_all']").click(function(){
var url = $(this).data('href');
$.ajax({url:url,dataType:'text',success:function(data){
if(data == 'true'){
$("span[nhname='nh_act_flag']").remove();
$("#new_notify_count").html('0');
nh_new_notify_count_show();
}
}});
});
nh_new_notify_count_show();
});
</script>