开源检索功能
This commit is contained in:
parent
a2aea42868
commit
6619ee9c20
|
@ -278,6 +278,15 @@ class CoursesController < ApplicationController
|
||||||
@members = paginateHelper @members, @limit
|
@members = paginateHelper @members, @limit
|
||||||
end
|
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
|
def valid_ajax
|
||||||
req = Hash.new(false)
|
req = Hash.new(false)
|
||||||
req[:message] = ''
|
req[:message] = ''
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
<td class="center">
|
<td class="center">
|
||||||
<%= format_date(course.created_at) %>
|
<%= format_date(course.created_at) %>
|
||||||
</td>
|
</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>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
$("#os_allow_<%= @course.id %>").html("<%= @course.try(:os_allow) == 0 ? "允许" : "不允许" %>");
|
|
@ -147,9 +147,11 @@
|
||||||
<%# 课程英雄榜 %>
|
<%# 课程英雄榜 %>
|
||||||
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
|
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
|
||||||
<div class="sy_class_leftbox" >
|
<div class="sy_class_leftbox" >
|
||||||
<h3 class="fontGrey7"><span>推荐</span>
|
<% if @course.try(:os_allow) == 1 %>
|
||||||
<a class="c_white db creatPostIcon2 bGreen fr" href="http://ossean.trustie.net?user_id=<%= User.current.id %>" target="_blank">开源检索</a>
|
<h3 class="fontGrey7"><span>推荐</span>
|
||||||
</h3>
|
<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} %>
|
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
|
||||||
</div>
|
</div>
|
||||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||||
|
|
|
@ -1360,6 +1360,7 @@ RedmineApp::Application.routes.draw do
|
||||||
get 'delete_member'
|
get 'delete_member'
|
||||||
get 'archive_course'
|
get 'archive_course'
|
||||||
get 'set_invite_code_halt'
|
get 'set_invite_code_halt'
|
||||||
|
get 'open_or_close_os_interface'
|
||||||
end
|
end
|
||||||
collection do
|
collection do
|
||||||
match 'join_private_courses', :via => [:get, :post]
|
match 'join_private_courses', :via => [:get, :post]
|
||||||
|
|
|
@ -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;}
|
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;}
|
.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;}
|
.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;}
|
.postRow {width:970px; border-bottom:1px solid #efefef; padding:15px 0;}
|
||||||
.postPortrait {width:75px; height:75px; float:left; margin-right:15px;}
|
.postPortrait {width:75px; height:75px; float:left; margin-right:15px;}
|
||||||
.postWrap {width:690px; float:left; margin-right:95px;}
|
.postWrap {width:690px; float:left; margin-right:95px;}
|
||||||
|
|
Loading…
Reference in New Issue