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

84 lines
3.7 KiB
Plaintext
Raw Normal View History

<div class="project_r_h">
2015-06-04 15:55:41 +08:00
<h2 class="fl project_h2"><%= l(:label_activity)%></h2>
2014-07-03 16:16:21 +08:00
</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">
<%= 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>
2015-08-14 09:38:24 +08:00
<%= 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>
2015-05-13 16:44:12 +08:00
<div class="cl"></div>
2015-06-04 15:55:41 +08:00
<script type="text/javascript">
$(function(){
2015-06-05 16:20:26 +08:00
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();
}
}
2015-06-04 15:55:41 +08:00
$("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();
2015-06-05 16:20:26 +08:00
$("#new_notify_count").html($("#new_notify_count").html()-1);
nh_new_notify_count_show();
2015-06-04 15:55:41 +08:00
}
}});
}
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();
2015-06-05 16:20:26 +08:00
$("#new_notify_count").html('0');
nh_new_notify_count_show();
2015-06-04 15:55:41 +08:00
}
}});
});
2015-06-05 16:20:26 +08:00
nh_new_notify_count_show();
2015-06-04 15:55:41 +08:00
});
</script>