2014-07-18 16:39:39 +08:00
|
|
|
|
<% @nav_dispaly_course_all_label = 1
|
|
|
|
|
@nav_dispaly_forum_label = 1
|
|
|
|
|
@nav_dispaly_course_label = nil
|
|
|
|
|
@nav_dispaly_store_all_label = 1 %>
|
2014-04-23 21:20:03 +08:00
|
|
|
|
<%= stylesheet_link_tag 'welcome' %>
|
2014-04-26 09:03:25 +08:00
|
|
|
|
<%= javascript_include_tag 'welcome' %>
|
2014-05-12 16:01:13 +08:00
|
|
|
|
<script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html"
|
2014-05-13 10:30:15 +08:00
|
|
|
|
xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
|
|
|
|
|
|
2014-07-04 09:10:17 +08:00
|
|
|
|
$(function () {
|
2014-05-13 10:30:15 +08:00
|
|
|
|
$("#main").find("a").attr("target", "_blank");
|
2014-05-17 15:15:33 +08:00
|
|
|
|
setCss();
|
2014-05-13 10:30:15 +08:00
|
|
|
|
});
|
|
|
|
|
|
2014-05-17 15:15:33 +08:00
|
|
|
|
//设置div居中
|
2014-07-04 09:10:17 +08:00
|
|
|
|
function setCss() {
|
2014-05-17 15:15:33 +08:00
|
|
|
|
var mainBar = $('#main-content-bar')[0];
|
|
|
|
|
var topHeight = mainBar.offsetHeight;
|
|
|
|
|
var welcomeLeft = $('#welcome_left')[0];
|
2014-07-04 09:10:17 +08:00
|
|
|
|
var leftHeight = welcomeLeft.offsetHeight;
|
2014-05-17 15:15:33 +08:00
|
|
|
|
var searchbar = $('#search-bar')[0];
|
|
|
|
|
var searchHeight = searchbar.offsetHeight;
|
2014-07-04 09:10:17 +08:00
|
|
|
|
welcomeLeft.style.marginTop = (topHeight - leftHeight) / 2 + "px";
|
|
|
|
|
searchbar.style.marginTop = (topHeight - searchHeight) / 2 + "px";
|
2014-05-17 15:15:33 +08:00
|
|
|
|
//alert((topHeight - leftHeight)/2 );
|
|
|
|
|
}
|
2014-05-13 10:30:15 +08:00
|
|
|
|
// 给主页用户弹新页面
|
2014-07-04 09:10:17 +08:00
|
|
|
|
$(document).ready(function ($) {
|
2014-05-13 10:30:15 +08:00
|
|
|
|
$("#loggedas").find("a").attr("target", "_blank");
|
|
|
|
|
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
|
2014-04-23 21:20:03 +08:00
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<div class='top_bar'>
|
2014-09-16 09:54:55 +08:00
|
|
|
|
<%#= render partial: 'wei_xin' %>
|
2014-05-17 15:15:33 +08:00
|
|
|
|
<div class="main-content-bar" id="main-content-bar">
|
2014-07-25 16:05:33 +08:00
|
|
|
|
<div style="float: left;padding-left:15px">
|
|
|
|
|
<%= image_tag(@logoLink, width:@course_page.image_width,height: @course_page.image_height) %>
|
2014-04-25 09:29:18 +08:00
|
|
|
|
|
2014-05-13 10:30:15 +08:00
|
|
|
|
</div>
|
2014-07-04 09:10:17 +08:00
|
|
|
|
<div class="course welcome_left" id="welcome_left">
|
2014-10-10 09:21:10 +08:00
|
|
|
|
<span class="font_welcome_school">
|
|
|
|
|
<% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %>
|
2014-09-17 17:07:18 +08:00
|
|
|
|
<% else %>
|
2014-10-10 09:21:10 +08:00
|
|
|
|
<% 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/>
|
2014-09-17 17:07:18 +08:00
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
2014-10-10 09:21:10 +08:00
|
|
|
|
<% end %>
|
2014-09-17 17:07:18 +08:00
|
|
|
|
</span>
|
2014-07-11 11:41:54 +08:00
|
|
|
|
<% unless @course_page.nil? %>
|
2014-12-29 10:42:48 +08:00
|
|
|
|
<span class="font_welcome_trustie">
|
|
|
|
|
<%= @course_page.title %>
|
|
|
|
|
</span>
|
2014-07-11 11:41:54 +08:00
|
|
|
|
|
2014-09-17 17:07:18 +08:00
|
|
|
|
<% if @school_id.nil? and (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?) %>
|
2014-12-29 10:42:48 +08:00
|
|
|
|
<span class="font_welcome_tdescription">,
|
|
|
|
|
<%= @course_page.description %>
|
|
|
|
|
</span>
|
2014-09-17 17:07:18 +08:00
|
|
|
|
<% else %>
|
|
|
|
|
<% if @school_id == "0" %>
|
2014-12-29 10:42:48 +08:00
|
|
|
|
<span class="font_welcome_tdescription">,
|
|
|
|
|
<%= @course_page.description %>
|
|
|
|
|
</span>
|
2014-09-17 17:07:18 +08:00
|
|
|
|
<% end %>
|
2014-05-13 10:30:15 +08:00
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
2014-05-17 15:15:33 +08:00
|
|
|
|
<div class="search-bar" id="search-bar">
|
2014-12-30 10:57:39 +08:00
|
|
|
|
<%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course} %>
|
2014-05-13 10:30:15 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div style="clear: both;"></div>
|
|
|
|
|
</div>
|
2014-04-23 21:20:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
2014-05-13 10:30:15 +08:00
|
|
|
|
<div style="clear:both"></div>
|
2014-04-23 21:20:03 +08:00
|
|
|
|
|
|
|
|
|
|
2014-10-23 14:36:10 +08:00
|
|
|
|
<div id="J_Slide" class="d-p-index-box d-p-index-hot">
|
2014-12-29 10:42:48 +08:00
|
|
|
|
<h3>
|
|
|
|
|
<strong>
|
|
|
|
|
<%= l(:lable_hot_course)%>
|
|
|
|
|
</strong>
|
|
|
|
|
</h3>
|
2014-07-04 09:10:17 +08:00
|
|
|
|
|
2014-10-14 10:32:59 +08:00
|
|
|
|
<% month_now = Time.now.strftime("%m").to_i %>
|
2015-01-04 13:28:33 +08:00
|
|
|
|
<% year_now = Time.new.strftime("%Y").to_i %>
|
2014-10-14 10:32:59 +08:00
|
|
|
|
<!-- 3-8月份为查找春季课程,9-2月份为查找秋季课程 -->
|
2015-01-04 15:06:26 +08:00
|
|
|
|
<% if month_now < 3
|
|
|
|
|
year_now -= 1
|
|
|
|
|
course_term = "秋季学期"
|
|
|
|
|
elsif month_now < 9
|
2015-03-02 17:31:04 +08:00
|
|
|
|
course_term = "春季学期"
|
2015-01-04 15:06:26 +08:00
|
|
|
|
end
|
|
|
|
|
%>
|
|
|
|
|
<%# (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %>
|
2015-03-02 17:31:04 +08:00
|
|
|
|
<% cur_school_course = @school_id.nil? ? [] : find_miracle_course(10,7,@school_id, year_now, course_term) %>
|
2014-10-14 10:32:59 +08:00
|
|
|
|
|
|
|
|
|
<% if cur_school_course.count == 0 %>
|
2014-12-29 10:42:48 +08:00
|
|
|
|
<span>
|
|
|
|
|
<%= render :partial => 'more_course', :locals => {:school_id => nil}%>
|
|
|
|
|
</span>
|
2014-05-13 10:30:15 +08:00
|
|
|
|
<div class="d-p-projectlist-box">
|
|
|
|
|
<ul class="d-p-projectlist">
|
2015-03-03 17:35:46 +08:00
|
|
|
|
<%# if User.current.logged? %>
|
2014-08-11 14:49:58 +08:00
|
|
|
|
<li>
|
2014-09-04 09:46:24 +08:00
|
|
|
|
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_no_course)} %>
|
2014-08-11 14:49:58 +08:00
|
|
|
|
</li>
|
2015-03-03 17:35:46 +08:00
|
|
|
|
<%# end %>
|
|
|
|
|
<%# User.current.logged? ? course_count = 9 : course_count = 10 %>
|
|
|
|
|
<% course_count = 9 %>
|
2015-01-04 13:28:33 +08:00
|
|
|
|
<% all_new_hot_course = find_all_new_hot_course(course_count, @school_id, year_now, course_term)%>
|
|
|
|
|
<% while all_new_hot_course.count < course_count%>
|
|
|
|
|
<% if course_term == "春季学期"
|
|
|
|
|
year_now -= 1
|
|
|
|
|
course_term = "秋季学期"
|
|
|
|
|
else
|
|
|
|
|
course_term = "春季学期"
|
|
|
|
|
end%>
|
2015-01-21 09:18:29 +08:00
|
|
|
|
<%break if Time.new.strftime("%Y").to_i - year_now >= 2%>
|
2015-01-04 13:28:33 +08:00
|
|
|
|
<% all_new_hot_course += find_all_new_hot_course(course_count-all_new_hot_course.count, @school_id, year_now, course_term)%>
|
|
|
|
|
<% end%>
|
|
|
|
|
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
|
2014-05-13 10:30:15 +08:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<% else %>
|
2014-10-14 10:32:59 +08:00
|
|
|
|
<% if cur_school_course.count < 9 %>
|
2014-05-19 10:00:24 +08:00
|
|
|
|
<span>
|
2014-09-11 14:55:40 +08:00
|
|
|
|
<%= render :partial => 'more_course', :locals => {:school_id => nil}%>
|
2014-05-19 10:00:24 +08:00
|
|
|
|
</span>
|
|
|
|
|
<% else %>
|
|
|
|
|
<span>
|
2014-09-11 14:55:40 +08:00
|
|
|
|
<%= render :partial => 'more_course', :locals => {:school_id => @school_id}%>
|
2014-05-19 10:00:24 +08:00
|
|
|
|
</span>
|
|
|
|
|
<% end %>
|
2014-05-13 10:30:15 +08:00
|
|
|
|
<div class="d-p-projectlist-box">
|
|
|
|
|
<ul class="d-p-projectlist">
|
2014-10-14 10:32:59 +08:00
|
|
|
|
<%= render :partial => 'course_list', :locals => {:course_list => cur_school_course} %>
|
|
|
|
|
<% if cur_school_course.count < 9 %>
|
2014-07-04 09:10:17 +08:00
|
|
|
|
<li>
|
2014-09-04 09:46:24 +08:00
|
|
|
|
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_less_course)} %>
|
2014-07-04 09:10:17 +08:00
|
|
|
|
</li>
|
2015-01-04 13:28:33 +08:00
|
|
|
|
<% all_new_hot_course = find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)%>
|
|
|
|
|
<% while (all_new_hot_course.count + cur_school_course.count) < 9%>
|
|
|
|
|
<% if course_term == "春季学期"
|
|
|
|
|
year_now -= 1
|
|
|
|
|
course_term = "秋季学期"
|
|
|
|
|
else
|
|
|
|
|
course_term = "春季学期"
|
|
|
|
|
end%>
|
2015-01-21 09:18:29 +08:00
|
|
|
|
<%break if Time.new.strftime("%Y").to_i - year_now >= 2%>
|
2015-01-04 13:28:33 +08:00
|
|
|
|
<% all_new_hot_course += find_all_new_hot_course(9-(all_new_hot_course.count + cur_school_course.count), @school_id, year_now, course_term)%>
|
|
|
|
|
<% end%>
|
|
|
|
|
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
|
2014-05-19 10:00:24 +08:00
|
|
|
|
<% end %>
|
2014-05-13 10:30:15 +08:00
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
2014-04-23 21:20:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
2014-10-23 14:36:10 +08:00
|
|
|
|
<div id="J_Slide" class="d-p-index-box d-p-index-hot" style="float: right;">
|
2014-05-13 10:30:15 +08:00
|
|
|
|
<h3 style="padding-bottom:0px ;margin-left: 5px; color: #e8770d;">
|
2014-09-17 17:07:18 +08:00
|
|
|
|
<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"} %>
|
2014-10-16 10:56:13 +08:00
|
|
|
|
<!-- 加入课程按钮 -->
|
2014-10-16 11:33:11 +08:00
|
|
|
|
|
2014-05-13 10:30:15 +08:00
|
|
|
|
</h3>
|
|
|
|
|
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", forums_path %></span>
|
2014-07-04 09:10:17 +08:00
|
|
|
|
|
2014-05-13 10:30:15 +08:00
|
|
|
|
<div class="d-p-projectlist-box">
|
|
|
|
|
<ul class="d-p-projectlist">
|
2014-07-04 09:10:17 +08:00
|
|
|
|
<% find_new_forum_topics(10).each do |topic| %>
|
2014-10-30 10:31:09 +08:00
|
|
|
|
<li class="message-brief-intro" style="min-height: 65px; line-height:2em; border-bottom: 1px dashed; padding-bottom: 3px">
|
2014-07-04 09:10:17 +08:00
|
|
|
|
<div style="display: inline-block; width: 100%;">
|
2014-10-14 10:32:59 +08:00
|
|
|
|
<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;">
|
|
|
|
|
|
|
|
|
|
<%= 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;" %>
|
2014-04-23 21:20:03 +08:00
|
|
|
|
</span>
|
2014-07-04 09:10:17 +08:00
|
|
|
|
|
2014-05-21 18:52:15 +08:00
|
|
|
|
<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>
|
2014-10-14 10:32:59 +08:00
|
|
|
|
<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 %>
|
2014-05-21 18:52:15 +08:00
|
|
|
|
</span>
|
2014-10-14 10:32:59 +08:00
|
|
|
|
<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?) %>
|
2014-12-12 14:45:49 +08:00
|
|
|
|
<%= l(:label_final_reply)%>:
|
2014-10-14 10:32:59 +08:00
|
|
|
|
<%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
|
|
|
|
|
<% end %>
|
2014-05-21 18:52:15 +08:00
|
|
|
|
</span>
|
|
|
|
|
<span class="memo_reply">
|
2014-09-17 17:07:18 +08:00
|
|
|
|
<%= l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>)
|
2014-05-21 18:52:15 +08:00
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2014-05-13 10:30:15 +08:00
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
2014-04-23 21:20:03 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
|
|
2014-05-19 16:12:06 +08:00
|
|
|
|
<%= render partial: 'link_to_another' %>
|