socialforge/app/views/layouts/_course_base_info.html.erb

99 lines
5.1 KiB
Plaintext

<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% teacher_num = TeacherAndAssistantCount(@course) %>
<% student_num = studentCount(@course) %>
<% course_file_num = visable_attachemnts_incourse(@course).count %>
<p class="sy_cgrey mb10 mr20">
<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :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>
<% if is_teacher %>
<div class="sy_class_setting" >
<ul>
<li class="sy_class_setting_icon">
<ul class="sy_class_setting_text">
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "sy_class_option" %></li>
<!--<li><%#= link_to "复制班级", copy_course_course_path(@course.id),:remote=>true, :class => "sy_class_option" %></li>-->
<% if @course.syllabus %>
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "sy_class_option", :target => "_blank" %></li>
<% end %>
</ul>
</li>
</ul>
</div>
<% end %>
<div class="cl"></div>
<div class="sy_class_logo fl">
<div class="pr" style="width: 96px; height:96px;">
<% if is_teacher%>
<%=link_to image_tag(url_to_avatar(@course),width:"96", height: "96", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path(:course => @course.id), :remote => true%>
<div class="homepageEditProfile undis">
<%=link_to '', my_clear_user_avatar_temp_path(:course => @course.id), :class => 'homepageEditProfileIcon', :title => '点击编辑头像', :remote => true %>
</div>
<% else %>
<%= image_tag(url_to_avatar(@course), :width => "96", :height => "96", :alt => "班级logo") %>
<% end %>
</div>
</div>
<div class="sy_class_id fl">
<p>邀 请 码<br />
<span class="sy_corange">
<% if User.current.admin? || User.current.member_of_course?(@course) %>
<%=@course.generate_invite_code %>
<% else %>
<span class="f12">请询问老师</span>
<% end %>
</span>
</p>
</div>
<div class="sy_class_info fl ml15">
<div class="sy_class_titbox">
<h3 class="fl sy_class_title">
<%= link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class =>'c_dark', :target => '_blank'%>
&nbsp;<font class="fb">·</font>&nbsp;
<%=@course.name %>
</h3>
<span class="<%= @course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span>
<p class="sy_cgrey fl mt3">
<span class=" mr15">教师:<%= course_teacher_link teacher_num %></span>
<span class=" mr15">学生:<%= course_student_link student_num %></span>
<span class=" mr15">资源:<%= link_to course_file_num, course_files_path(@course), :class => 'sy_cblue',:id=>'courses_files_count_info' %></span>
</p>
<div class="cl"></div>
</div>
<p class="sy_cgrey mb5">
<span class=" mr15">主讲老师:<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cblue') %></span>
<span class=" mr15">学时:<span class="sy_cblack"><%= @course.class_period %>学时</span></span>
<span class=" mr15">学期:<span class="sy_cblack"><%= current_time_and_term @course %></span></span>
<span class=" mr15">单位:<span class="sy_cblack"><%= get_occupation_from_user(@course.teacher).blank? ? '无' : get_occupation_from_user(@course.teacher) %></span></span>
</p>
<% if is_teacher %>
<%= link_to "班级设置", {:controller => 'courses', :action => 'settings', :id => @course}, :class => "sy_btn_grey mr10 fl" %>
<% end %>
<% is_TA = get_user_member_roles_course @course, User.current, 7 %>
<% is_TE = get_user_member_roles_course @course, User.current, 9 %>
<% is_ST = get_user_member_roles_course @course, User.current, 10 %>
<% if !is_teacher && (is_TA || is_TE) %>
<%= link_to '教师身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TA ? 7 : 9)), :class => "sy_btn_orange mr10 fl", :title => "由学生身份切换至教师身份" %>
<% elsif is_teacher && is_ST %>
<%= link_to '学生身份', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : 9), :tar_role => 10), :class => "sy_btn_orange mr10 fl", :title => "由教师身份切换至学生身份" %>
<% end %>
<% unless (is_teacher || is_TA || is_TE) %>
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<% end %>
</div>
<div class="cl"></div>
<% if is_teacher %>
<div class="invite_code_tip_box fontGrey2">
<em></em>
<span></span>
<p class="mt10 mb5">请将邀请码告诉学生和教辅</p>
<p class="mb10">他们可以主动加入班级</p>
</div>
<% end %>