parent
42a602a9bc
commit
d001b4416a
|
@ -32,7 +32,7 @@ class WelcomeController < ApplicationController
|
|||
def course
|
||||
if params[:school_id]
|
||||
@school_id = params[:school_id]
|
||||
else
|
||||
elsif User.current.logged? && User.current.user_extensions.school
|
||||
@school_id = User.current.user_extensions.school.id
|
||||
end
|
||||
@logoLink ||= logolink()
|
||||
|
|
|
@ -233,8 +233,13 @@ module WelcomeHelper
|
|||
def find_all_new_hot_course limit = 9 ,school_id = 0
|
||||
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
|
||||
time_now = Time.new.strftime("%Y");
|
||||
if school_id
|
||||
courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <>
|
||||
?", school_id).order("course_ac_para DESC").limit(limit).all
|
||||
else
|
||||
courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL
|
||||
").order("course_ac_para DESC").limit(limit).all
|
||||
end
|
||||
courses
|
||||
end
|
||||
|
||||
|
|
|
@ -3,26 +3,25 @@
|
|||
<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(){
|
||||
$(function () {
|
||||
$("#main").find("a").attr("target", "_blank");
|
||||
setCss();
|
||||
});
|
||||
|
||||
//设置div居中
|
||||
function setCss()
|
||||
{
|
||||
function setCss() {
|
||||
var mainBar = $('#main-content-bar')[0];
|
||||
var topHeight = mainBar.offsetHeight;
|
||||
var welcomeLeft = $('#welcome_left')[0];
|
||||
var leftHeight = welcomeLeft.offsetHeight;
|
||||
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";
|
||||
welcomeLeft.style.marginTop = (topHeight - leftHeight) / 2 + "px";
|
||||
searchbar.style.marginTop = (topHeight - searchHeight) / 2 + "px";
|
||||
//alert((topHeight - leftHeight)/2 );
|
||||
}
|
||||
// 给主页用户弹新页面
|
||||
$(document).ready(function($) {
|
||||
$(document).ready(function ($) {
|
||||
$("#loggedas").find("a").attr("target", "_blank");
|
||||
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
|
||||
});
|
||||
|
@ -35,20 +34,20 @@
|
|||
</div>
|
||||
<div class="main-content-bar" id="main-content-bar">
|
||||
<div style="float: left">
|
||||
<%= image_tag(@logoLink, size:'75x75') %>
|
||||
<%= image_tag(@logoLink, size: '75x75') %>
|
||||
|
||||
</div>
|
||||
<div class="course welcome_left" id="welcome_left" >
|
||||
<div class="course welcome_left" id="welcome_left">
|
||||
<span class="font_welcome_school"> <% if @school_id.nil? and User.current.user_extensions.school.nil? %>
|
||||
<% else%>
|
||||
<% 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 />
|
||||
<%= 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 />
|
||||
<%= 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>
|
||||
|
@ -62,7 +61,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="search-bar" id="search-bar">
|
||||
<%= render :partial => "search_course", :locals => {:project_type => Project::ProjectType_course}%>
|
||||
<%= render :partial => "search_course", :locals => {:project_type => Project::ProjectType_course} %>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
|
@ -73,32 +72,38 @@
|
|||
|
||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
||||
<h3><strong>新开课程</strong></h3>
|
||||
<% school_course = find_miracle_course(10, 7,@school_id) %>
|
||||
<% if(school_course.count == 0) %>
|
||||
<% if @school_id %>
|
||||
<% school_course = find_miracle_course(10, 7, @school_id) %>
|
||||
<% else %>
|
||||
<%school_course=[]%>
|
||||
<% end %>
|
||||
<% if (school_course.count == 0) %>
|
||||
<span><%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => nil} %></span>
|
||||
|
||||
<div class="d-p-projectlist-box">
|
||||
<ul class="d-p-projectlist">
|
||||
|
||||
</ul>
|
||||
<ul class="d-p-projectlist">
|
||||
<h1></h1>
|
||||
|
||||
<p id="errorExplanation">
|
||||
该学校未开设任何课程,您可以查看其他学校课程
|
||||
</p>
|
||||
|
||||
<h1></h1>
|
||||
<% find_all_new_hot_course(9,@school_id).map do |project| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||
<% find_all_new_hot_course(9, @school_id).map do |course| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item' >
|
||||
<div class='desc_item'>
|
||||
<span class=''>
|
||||
<% course = Course.find_by_extra(project.extra)%>
|
||||
<% if(course.school == nil) %>
|
||||
<% if (course.school == nil) %>
|
||||
|
||||
<% else %>
|
||||
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course',:school_id => course.school.id}, html_options={:method => 'get'}%>
|
||||
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
|
||||
<% end %>
|
||||
</span>
|
||||
<span class='font_bolder'>
|
||||
|
@ -107,15 +112,12 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
[<%= get_course_term project %>]
|
||||
<%= link_to( project.name, course_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
||||
(<%= "#{studentCount(project)}人" %>)
|
||||
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
|
||||
(<%=link_to "#{files_count}份", course_files_path(project) %>资料)
|
||||
[<%= get_course_term course %>]
|
||||
<%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
(<%= "#{studentCount(course)}人" %>)
|
||||
<% files_count = course.attachments.count.to_s %>
|
||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||
</div>
|
||||
<!-- <div class='desc_item' style="">
|
||||
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
|
||||
</div> -->
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
@ -135,74 +137,73 @@
|
|||
|
||||
</ul>
|
||||
<ul class="d-p-projectlist">
|
||||
<% school_course.map do |project| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||
<% school_course.map do |course| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item' >
|
||||
<div class='desc_item'>
|
||||
<span class=''>
|
||||
<% course = project %>
|
||||
<%=link_to course.school.name.try(:gsub, /(.+)$/, '\1:'),options={:action => 'course',:school_id => course.school.id}, html_options={:method => 'get'} %>
|
||||
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
|
||||
</span>
|
||||
<span class='font_bolder'>
|
||||
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
|
||||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
[<%= get_course_term project %>]
|
||||
<%= link_to( project.name, course_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
||||
(<%= "#{studentCount(project)}人" %>)
|
||||
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
|
||||
(<%=link_to "#{files_count}份", course_files_path(project) %>资料)
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
[<%= get_course_term course %>]
|
||||
<%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
(<%= "#{studentCount(course)}人" %>)
|
||||
<% files_count = course.attachments.count.to_s %>
|
||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||
</div>
|
||||
|
||||
<div class='join_course_link'>
|
||||
<% if !course_endTime_timeout?(project)%>
|
||||
<div >
|
||||
<%= join_in_course(project, User.current)%>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<div>
|
||||
<%= join_in_course(course, User.current) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</li>
|
||||
<% end; reset_cycle %>
|
||||
<% end; reset_cycle %>
|
||||
<% if school_course.count < 9 %>
|
||||
<li>
|
||||
<h1></h1>
|
||||
<p id="errorExplanation">
|
||||
该学校开设课程较少,您可以查看其他学校课程
|
||||
</p>
|
||||
</li>
|
||||
<% find_all_new_hot_course(9 - school_course.count,@school_id).map do |project| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item' >
|
||||
<li>
|
||||
<h1></h1>
|
||||
|
||||
<p id="errorExplanation">
|
||||
该学校开设课程较少,您可以查看其他学校课程
|
||||
</p>
|
||||
</li>
|
||||
<% find_all_new_hot_course(9 - school_course.count, @school_id).map do |course| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s %>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item'>
|
||||
<span class=''>
|
||||
<% course = project%>
|
||||
<% if(course.school == nil) %>
|
||||
<% if (course.school == nil) %>
|
||||
|
||||
<% else %>
|
||||
<!-- modified by zjc 添加超链接 -->
|
||||
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course',:school_id => course.school.id}, html_options={:method => 'get'}%>
|
||||
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1:'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
|
||||
<% end %>
|
||||
</span>
|
||||
<span class='font_bolder'>
|
||||
<%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
|
||||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
[<%= get_course_term project %>]
|
||||
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
||||
<%= "#{studentCount(project)}人" %> )
|
||||
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
|
||||
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||
[<%= get_course_term course %>]
|
||||
<%= link_to(course.name, course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
<%= "#{studentCount(course)}人" %> )
|
||||
<% files_count = course.attachments.count.to_i.to_s %>
|
||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -212,18 +213,20 @@
|
|||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
||||
<h3 style="padding-bottom:0px ;margin-left: 5px; color: #e8770d;">
|
||||
<strong>问题和反馈动态</strong>
|
||||
<%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
|
||||
<%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
|
||||
<%= link_to "我要提问", newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE"} %>
|
||||
<%= link_to "我要反馈", 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|%>
|
||||
<% find_new_forum_topics(10).each do |topic| %>
|
||||
<li class="message-brief-intro" style="min-height: 65px; line-height:2em; ">
|
||||
<div style="display: inline-block; width: 100%;">
|
||||
<div style="display: inline-block; width: 100%;">
|
||||
<span class="memo_activity text_nowrap" 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.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
|
||||
<%= link_to '['+topic.forum.name + ']', forum_path(topic.forum), :class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), 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 %>
|
||||
|
@ -232,7 +235,7 @@
|
|||
楼主: <%= link_to_user(topic.author) %>
|
||||
</span>
|
||||
<span class="memo_last_person">
|
||||
最后回复:<%=link_to_user topic.last_reply.try(:author) %>
|
||||
最后回复:<%= link_to_user topic.last_reply.try(:author) %>
|
||||
</span>
|
||||
<span class="memo_reply">
|
||||
回复(<%= link_to topic.try(:replies_count), topic.event_url %>)
|
||||
|
|
Loading…
Reference in New Issue