socialforge/app/views/welcome/course.html.erb

185 lines
8.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<% @nav_dispaly_course_all_label = 1
@nav_dispaly_forum_label = 1
@nav_dispaly_course_label = nil
@nav_dispaly_store_all_label = 1 %>
<%= stylesheet_link_tag 'welcome' %>
<%= javascript_include_tag 'welcome' %>
<script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html"
xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
$(function () {
$("#main").find("a").attr("target", "_blank");
setCss();
});
//设置div居中
function setCss() {
var mainBar = $('#main-content-bar')[0];
var topHeight = mainBar.offsetHeight;
var welcomeLeft = $('#welcome_left')[0];
var leftHeight = welcomeLeft.offsetHeight;
var searchbar = $('#search-bar')[0];
var searchHeight = searchbar.offsetHeight;
welcomeLeft.style.marginTop = (topHeight - leftHeight) / 2 + "px";
searchbar.style.marginTop = (topHeight - searchHeight) / 2 + "px";
//alert((topHeight - leftHeight)/2 );
}
// 给主页用户弹新页面
$(document).ready(function ($) {
$("#loggedas").find("a").attr("target", "_blank");
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
});
</script>
<div class='top_bar'>
<%#= render partial: 'wei_xin' %>
<div class="main-content-bar" id="main-content-bar">
<div style="float: left;padding-left:15px">
<%= image_tag(@logoLink, width:@course_page.image_width,height: @course_page.image_height) %>
</div>
<div class="course welcome_left" id="welcome_left">
<span class="font_welcome_school">
<% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %>
<% else %>
<% if @school_id == "0" %>
<% else %>
<% if @school_id.nil? %>
<%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course', :school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
<br/>
<% else %>
<%= link_to School.find(@school_id).name, options={:action => 'course', :school_id => @school_id}, html_options={:class => 'font_welcome_school', :method => 'get'} %>
<br/>
<% end %>
<% end %>
<% end %>
</span>
<% unless @course_page.nil? %>
<span class="font_welcome_trustie">
<%= @course_page.title %>
</span>
<% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %>
<span class="font_welcome_tdescription">,
<%= @course_page.description %>
</span>
<% else %>
<% if @school_id == "0" %>
<span class="font_welcome_tdescription">,
<%= @course_page.description %>
</span>
<% end %>
<% end %>
<% end %>
</div>
<div class="search-bar" id="search-bar">
<%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course} %>
</div>
<div style="clear: both;"></div>
</div>
</div>
<div style="clear:both"></div>
<div id="J_Slide" class="d-p-index-box d-p-index-hot">
<h3>
<strong>
<%= l(:lable_hot_course)%>
</strong>
</h3>
<% month_now = Time.now.strftime("%m").to_i %>
<% year_now = 2014 %>
<!-- 3-8月份为查找春季课程9-2月份为查找秋季课程 -->
<% (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %>
<% @school_id.nil? ? cur_school_course = [] : cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term) %>
<% if cur_school_course.count == 0 %>
<span>
<%= render :partial => 'more_course', :locals => {:school_id => nil}%>
</span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% if User.current.logged? %>
<li>
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_no_course)} %>
</li>
<% end %>
<% User.current.logged? ? course_count = 9 : course_count = 10 %>
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(course_count, @school_id, year_now, course_term)} %>
</ul>
</div>
<% else %>
<% if cur_school_course.count < 9 %>
<span>
<%= render :partial => 'more_course', :locals => {:school_id => nil}%>
</span>
<% else %>
<span>
<%= render :partial => 'more_course', :locals => {:school_id => @school_id}%>
</span>
<% end %>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<%= render :partial => 'course_list', :locals => {:course_list => cur_school_course} %>
<% if cur_school_course.count < 9 %>
<li>
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_less_course)} %>
</li>
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)} %>
<% end %>
</ul>
</div>
<% end %>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hot" style="float: right;">
<h3 style="padding-bottom:0px ;margin-left: 5px; color: #e8770d;">
<strong><%= l(:label_issue_feedback_activities)%></strong>
<%= link_to l(:label_my_question), newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
<%= link_to l(:label_my_feedback), suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
<!-- 加入课程按钮 -->
</h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% find_new_forum_topics(10).each do |topic| %>
<li class="message-brief-intro" style="min-height: 65px; line-height:2em; border-bottom: 1px dashed; padding-bottom: 3px">
<div style="display: inline-block; width: 100%;">
<span class="memo_activity text_nowrap" title="<%= topic.subject%>"
style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to '['+topic.forum.name + ']', forum_path(topic.forum), :class => 'memo_Bar_title' %>
<%= link_to topic.subject, topic.event_url, :class => "gray", :style => "font-size: 10pt !important;" %>
</span>
<div class='memo_activity memo_attr'>
<span class='memo_timestamp'>
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
</span>
<span class="memo_author" title="<%= topic.author.login%>">
<%= l(:label_question_sponsor)%>
<%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
</span>
<span class="memo_last_person" title="<%= topic.last_reply.author.login unless (topic.last_reply.nil? || topic.last_reply.author.nil?)%>">
<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %>
<%= l(:label_final_reply)%>
<%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
<% end %>
</span>
<span class="memo_reply">
<%= l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>)
</span>
</div>
</div>
</li>
<% end %>
</ul>
</div>
</div>
<div class="clearfix"></div>
<%= render partial: 'link_to_another' %>