课程实训页面调整
This commit is contained in:
parent
0ebf73860e
commit
eed8f4845f
|
|
@ -1,4 +1,10 @@
|
|||
class SubjectsController < ApplicationController
|
||||
layout 'base_subject'
|
||||
before_filter :require_login
|
||||
before_filter :check_authentication
|
||||
before_filter :find_subject, :except => [:index, :create_subject, :new_subject, :index, :search, :shixun_courses]
|
||||
|
||||
include ApplicationHelper
|
||||
|
||||
def index
|
||||
@order = params[:order] || "created_at"
|
||||
|
|
@ -15,20 +21,38 @@ class SubjectsController < ApplicationController
|
|||
render :layout => "base_edu"
|
||||
end
|
||||
|
||||
def create_subject
|
||||
def show
|
||||
|
||||
end
|
||||
|
||||
def new_subject
|
||||
if Shixun.where(:user_id => User.current.id).count > 0
|
||||
@status = 1
|
||||
@course_lists = CourseList.where(:id => ShixunMajorCourse.where(:shixun_id => Shixun.where(:user_id => User.current.id).map(&:id)).map(&:course_list_id))
|
||||
else
|
||||
@status = 0
|
||||
end
|
||||
end
|
||||
|
||||
def new_subject
|
||||
if params[:course_list_id]
|
||||
course = CourseList.find params[:course_list_id]
|
||||
|
||||
#Subject.create(:name => )
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def create_subject
|
||||
if params[:course_list_id]
|
||||
course = CourseList.find params[:course_list_id]
|
||||
if course
|
||||
subject = Subject.create(:name => course.name, :user_id => User.current.id, :visits => 0, :status => 0, :course_list_id => course.id)
|
||||
end
|
||||
end
|
||||
redirect_to subject_path(subject)
|
||||
end
|
||||
|
||||
private
|
||||
# Find subject of id params[:id]
|
||||
def find_subject
|
||||
@subject = Subject.find_by_id(params[:id])
|
||||
render_404 if @subject.nil?
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1925,6 +1925,10 @@ module ApplicationHelper
|
|||
title << ("我的实训")
|
||||
elsif params[:controller] == "shixuns" && params[:action] == "index"
|
||||
title << ("项目实训")
|
||||
elsif @subject
|
||||
title << (@subject.name.nil? ? "课程实训" : @subject.name)
|
||||
elsif params[:controller] == "subjects" && params[:action] == "index"
|
||||
title << ("课程实训")
|
||||
elsif @organization
|
||||
title << (@organization.name.nil? ? "创新源于实践" : @organization.name)
|
||||
elsif @forum || params[:controller] == "forums"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="task-index-head mt20 mb20">
|
||||
<div class="task-index-head-top">
|
||||
<h2 class="fl task-inde-head-title">项目实训</h2>
|
||||
<%= link_to "创建", create_subject_subjects_path(), :remote => true, :class => "task-btn task-btn-green fr mt6" %>
|
||||
<%= link_to "创建", new_shixun_path, :class => "task-btn task-btn-green fr mt6" %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<ul class="task-index-head-info clearfix">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="task-popup" style="width:820px;">
|
||||
<div class="task-popup" style="width:500px;">
|
||||
<div class="task-popup-title clearfix">
|
||||
<h3 class="fl color-grey">选择课程</h3>
|
||||
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
||||
|
|
@ -10,13 +10,13 @@
|
|||
<% @course_lists.each do |course| %>
|
||||
<li>
|
||||
<input type="radio" class="none" id="course_list_<%= course.id %>" name="course_list_id" value="<%= course.id %>">
|
||||
<label for="course_list_<%= course.id %>">离散数学</label>
|
||||
<label for="course_list_<%= course.id %>"><%= course.name %></label>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<p id="lessong_nonechecked_tip" class="color-red none f12">请至少选择一个课程</p>
|
||||
<li class="clearfix mt10">
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-blue fr mr60" onclick="submit_choose_shixun()">确定</a>
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" onclick="submit_choose_shixun()">确定</a>
|
||||
<a href="javascript:void(0);" class="task-btn fr mr10" onclick="hideModal()">取消</a>
|
||||
</li>
|
||||
</div>
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
$("#lessong_nonechecked_tip").show();
|
||||
} else{
|
||||
$.ajax({
|
||||
url: '<%= new_subject_subjects_path() %>',
|
||||
url: '<%= create_subject_subjects_path() %>',
|
||||
data: {course_list_id: $("input[name='course_list_id']:checked").val()},
|
||||
remote: true,
|
||||
success: function(data){
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="task-index-head mt20 mb20">
|
||||
<div class="header-color">
|
||||
<h2 class="fl task-inde-head-title">课程实训</h2>
|
||||
<%= link_to "新建", new_course_path, :class => "task-btn task-btn-green fr mt6" %>
|
||||
<%= link_to "新建", new_subject_subjects_path, :remote => true, :class => "task-btn task-btn-green fr mt6" %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<ul class="task-index-head-info clearfix">
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
notice_sure_box("您还没有创建项目实训,无法组建课程实训");
|
||||
<% else %>
|
||||
var htmlvalue = "<%= j(render :partial => 'choose_shixun') %>";
|
||||
pop_box_new(htmlvalue, 400, 300);
|
||||
pop_box_new(htmlvalue, 500, 300);
|
||||
<% end %>
|
||||
|
|
@ -17,4 +17,9 @@
|
|||
.college{height: 45px;line-height: 70px;}
|
||||
.bot_li{text-align: right;}
|
||||
.bot_li li{float: left;margin: 8px 6px;border: 2px solid #e8e8e8; color: #888;float: left;border-radius: 50%;text-align: center;line-height:31px;width:31px;height:31px;}
|
||||
/*------课程实训首页---------*/
|
||||
/*------课程实训首页---------*/
|
||||
|
||||
.course_tip_box{width: 460px;padding: 10px;background-color: #FFFFFF;}
|
||||
.course_tip_box_Item{margin: 10px 0px;}
|
||||
.course_tip_box_Item li{cursor: pointer;float: left;width: auto;padding: 5px 10px;border-radius: 4px;border: 1px solid #2292e7;margin:0px 10px 10px 0px;}
|
||||
.tip_acitve{color: #FFFFFF;background-color: #2292e7;}
|
||||
Loading…
Reference in New Issue