开源检索功能

This commit is contained in:
daiao 2017-01-20 09:52:10 +08:00
parent a2aea42868
commit 6619ee9c20
6 changed files with 18 additions and 5 deletions

View File

@ -278,6 +278,15 @@ class CoursesController < ApplicationController
@members = paginateHelper @members, @limit
end
# 显示/隐藏课程"开源检索"的入口
def open_or_close_os_interface
os_status = @course.os_allow == 0 ? 1 : 0
@course.update_attribute(:os_allow, os_status)
respond_to do |format|
format.js
end
end
def valid_ajax
req = Hash.new(false)
req[:message] = ''

View File

@ -79,7 +79,7 @@
<td class="center">
<%= format_date(course.created_at) %>
</td>
<td style="text-align: center;"><a><%= course.try(:os_allow) == 0 ? 不允许 : 允许 %></a></td>
<td style="text-align: center;"><a href="<%= open_or_close_os_interface_course_path(course.id) %>" id="os_allow_<%= course.id %>" data-remote="true"><%= course.try(:os_allow) == 0 ? "允许" : "不允许" %></a></td>
</tr>
<% end %>
<% end %>

View File

@ -0,0 +1 @@
$("#os_allow_<%= @course.id %>").html("<%= @course.try(:os_allow) == 0 ? "允许" : "不允许" %>");

View File

@ -147,9 +147,11 @@
<%# 课程英雄榜 %>
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
<div class="sy_class_leftbox" >
<h3 class="fontGrey7"><span>推荐</span>
<a class="c_white db creatPostIcon2 bGreen fr" href="http://ossean.trustie.net?user_id=<%= User.current.id %>" target="_blank">开源检索</a>
</h3>
<% if @course.try(:os_allow) == 1 %>
<h3 class="fontGrey7"><span>推荐</span>
<a class="c_white db creatPostIcon2 bGreen fr" href="http://ossean.trustie.net?user_id=<%= User.current.id %>" target="_blank">开源检索</a>
</h3>
<% end %>
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
</div>
<%# 更新访问数,刷新的时候更新访问次数 %>

View File

@ -1360,6 +1360,7 @@ RedmineApp::Application.routes.draw do
get 'delete_member'
get 'archive_course'
get 'set_invite_code_halt'
get 'open_or_close_os_interface'
end
collection do
match 'join_private_courses', :via => [:get, :post]

View File

@ -415,7 +415,7 @@ a.sortArrowActiveD {background:url(../images/post_image_list.png) -0px -20px no-
a.sortArrowActiveU {background:url(../images/post_image_list.png) -17px -20px no-repeat; width:7px; height:9px; float:left; margin-left:5px; margin-top:5px;}
.creatPost {width:80px; height:25px; border-radius:3px; color:#ffffff; text-align:center; float:right; line-height:25px; vertical-align:middle; margin-top:2px;}
.creatPostIcon {background:url(../images/post_image_list.png) -40px -54px no-repeat; width:70px; height:25px; padding-left:10px; border-radius:3px;}
.creatPostIcon2 {width:60px; height:20px; padding-left:10px; border-radius:3px;}
.creatPostIcon2 {width:60px; height:30px; padding-left:3px; border-radius:3px;}
.postRow {width:970px; border-bottom:1px solid #efefef; padding:15px 0;}
.postPortrait {width:75px; height:75px; float:left; margin-right:15px;}
.postWrap {width:690px; float:left; margin-right:95px;}