邮件问题一

This commit is contained in:
yanxd 2014-03-07 11:28:52 +08:00
parent 3b7e8483e3
commit 8963cc3a3c
9 changed files with 59 additions and 18 deletions

View File

@ -182,9 +182,9 @@ class ProjectsController < ApplicationController
@s_type = 2
end
else
@projects = sort_project_demo 1, "course_ac_para desc", @project_pages.offset, @limit
@s_type = 1
# @projects = Project.visible.where("project_type = ?", 1).order("created_on desc").offset(@project_pages.offset).limit(@limit).all
# @projects = sort_project_demo 1, "course_ac_para desc", @project_pages.offset, @limit
@s_type = 0
@projects = Project.visible.where("project_type = ?", 1).order("created_on desc").offset(@project_pages.offset).limit(@limit).all
# @s_type = 0
end
respond_to do |format|

View File

@ -66,18 +66,18 @@ module ProjectsHelper
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
when 1
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
when 2
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
end
@ -243,7 +243,7 @@ module ProjectsHelper
end
end
def eventToLanguageCourse event_type, project
def eventToLanguageCourse event_type, project
case event_type
when "issue-note"
l :label_issue
@ -286,7 +286,17 @@ module ProjectsHelper
WHERE project_type = 0 ORDER BY grade DESC LIMIT #{limit} ) AS t ON p.id = t.project_id ")
end
def method_name
# 判断课程是否结束
def course_timeout? project
return true if (project.nil? && project.course_extra.nil?)
courses_year = project.course_extra.time
current_year = Time.now.year
if(courses_year >= current_year)
return false
elsif( (courses_year < current_year) && (Time.now.month < 3) )
return false
else
return true
end
end
end

View File

@ -21,6 +21,10 @@ module WelcomeHelper
include CoursesHelper
def find_new_course limit=15
Project.visible.joins(:course_extra).where("#{Project.table_name}.project_type = ? ", 1).order("courses.time DESC, #{Project.table_name}.created_on DESC").limit(limit).all
end
def find_all_hot_project limit=15
sort_project_by_hot limit
end

View File

@ -34,7 +34,7 @@
<tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/courses", :controller => 'projects', :action => 'course'%></a></td>
<td><p class="top-content-list-homework"><%=link_to "主页", home_path %> > <%=link_to l(:label_course_practice), :controller => 'projects', :action => 'course' %> >
<span><%= link_to(@bid.courses.first.name, homework_project_path(@bid.courses.first)) %></span> >
<span><%= link_to(@bid.courses.first.name.to_s, homework_project_path(@bid.courses.first)) if @bid.courses.first%></span> >
<%=link_to(@bid.name, respond_path(@bid)) %></p></td>
</tr>
</table>
@ -49,7 +49,7 @@
<tr valign="top">
<td style="width: 70px" >课程名:</td>
<td>
<span style=" word-wrap: break-word; word-break: break-all"><strong> <%= link_to @bid.courses.first.name, homework_project_path(@bid.courses.first) %></strong></span>
<span style=" word-wrap: break-word; word-break: break-all"><strong> <%= link_to @bid.courses.first.name.to_s, homework_project_path(@bid.courses.first) if @bid.courses.first %></strong></span>
</td>
</tr>
<tr style="">
@ -149,7 +149,7 @@
<%= link_to l(:label_question_student), {:controller => 'bids', :action => 'show' },:class => link_class(:respond)%>
</li>
<li>
<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %>
<% if User.current.logged? && @bid.courses.first && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %>
<%= link_to l(:label_homework_commit), {:controller => 'bids', :action => 'show_project' },:class => link_class(:project)%>
<% else %>
<%= link_to l(:label_homework_info), {:controller => 'bids', :action => 'show_project' },:class => link_class(:project)%>

View File

@ -47,7 +47,13 @@
</p>
<div class="buttons_for_course" style="margin-top:30px;margin-left:144px">
<span class="info"></span>
<% if(!course_timeout? @project) %>
<%= join_in_course_for_list(@project, User.current,['regular'])%>
<% else %>
<span class="font_lighter">
课程学期已结束
</span>
<% end -%>
</div>
</div>
</div>

View File

@ -249,3 +249,8 @@
<% end %>
<script type="text/javascript" language="javascript">
$(document).ready(function($) {
$("#content .pagination:first~ div").find("a").attr("target", "_blank");
});
</script>

View File

@ -3,3 +3,12 @@
<% else %> <!--for student-->
<%= render :partial => 'my_joinedcourse' %>
<% end %>
<script type="text/javascript" language="javascript">
$(document).ready(function($) {
$("#content .content_frame").find("a").attr("target", "_blank");
$("content-title-top p:first").find("a").attr("target", "_blank");
$("#content .content_frame [color=#666666]").find("a").removeAttr("target");
$('#content .content-title-top table[width=580] td:first span:eq(1)').find("a:first").removeAttr("target");
});
</script>

View File

@ -48,3 +48,9 @@
<% end %>
<%= call_hook :view_account_left_bottom, :user => @user %>
</div>
<script type="text/javascript" language="javascript">
$(document).ready(function($) {
$("#content .tabs_new~").find("a").attr("target", "_blank");
$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
});
</script>

View File

@ -106,11 +106,11 @@
<%= stylesheet_link_tag 'welcome' %>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
<h3 style="margin-left: 5px; color: #e8770d;"><strong>热门课程</strong></h3>
<h3 style="margin-left: 5px; color: #e8770d;"><strong>新开课程</strong></h3>
<span style="margin-top: -20px;float: right; display: block;"><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :project_sort_type => 1}, :target => "_blank" %></span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
<% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %>
<% find_new_course(10).map do |project| %>
<li style="background-image:none;">
<div style="float: left;">
<% if get_avatar?(project)%>
@ -125,7 +125,8 @@
<span style="cursor: pointer; display: inline-block; float: right; color: #ec6300; white-space: nowrap;">学生人数:<%= link_to "#{studentCount(project)}", project_member_path(project, :role => 2) ,:course =>'1', :target => "_blank" %></span>
</p>
<p class="layout-1" >
<%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %>
<%= content_tag "div", "&nbsp;".html_safe<<project.course_extra.time.to_s<<project.course_extra.term.to_s, :class => "d-p-project-intro", :style => 'display:inline-block; position:relative;float:right;color:#ff4800;' %>
<%= content_tag "span", "&nbsp;".html_safe+project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description.to_s %>
</p>
</div>
</li>
@ -160,7 +161,7 @@
</div>
</div>
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="margin-top: 20px; float: right;">
<h3 style="margin-left: 5px; color: #e8770d;">
<h3 style="padding-bottom:5px ;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" }%>
@ -168,8 +169,8 @@
<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(4).each do |topic|%>
<li class="message-brief-intro" style="min-height: 20px;padding-bottom:3px; line-height:1.23em; ">
<% find_new_forum_topics(11).each do |topic|%>
<li class="message-brief-intro" style="min-height: 20px;padding-bottom:3px; line-height:1.27em; ">
<div style="display: inline-block; width: 100%;">
<span 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.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>