班级列表、课程大纲的编辑、回复、课程列表
This commit is contained in:
parent
e066445036
commit
ebb697a49f
|
@ -131,6 +131,8 @@ class PraiseTreadController < ApplicationController
|
|||
@obj = Bid.find_by_id(id)
|
||||
when 'Contest'
|
||||
@obj = Contest.find_by_id(id)
|
||||
when 'Syllabus'
|
||||
@obj = Syllabus.find_by_id(id)
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
class SyllabusesController < ApplicationController
|
||||
include ApplicationHelper
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
include CoursesHelper
|
||||
|
||||
before_filter :is_logged, :only => [:index, :show, :edit, :new, :update]
|
||||
before_filter :find_syllabus, :only => [:show, :edit, :update]
|
||||
before_filter :is_logged, :only => [:index, :show, :edit, :new, :update, :destroy]
|
||||
before_filter :find_syllabus, :only => [:show, :edit, :update, :destroy, :syllabus_courselist]
|
||||
def index
|
||||
user = User.current
|
||||
@syllabuses = user.syllabuses
|
||||
|
@ -27,6 +31,7 @@ class SyllabusesController < ApplicationController
|
|||
@syllabus.title = params[:title]
|
||||
@syllabus.eng_name = params[:eng_name]
|
||||
@syllabus.user_id = User.current.id
|
||||
@syllabus.description = Message.where("id = 17848").first.nil? ? '' : Message.where("id = 17848").first.content
|
||||
if @syllabus && @syllabus.save
|
||||
respond_to do |format|
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
|
@ -51,14 +56,72 @@ class SyllabusesController < ApplicationController
|
|||
|
||||
def update
|
||||
@syllabus.description = params[:syllabus][:description]
|
||||
@syllabus.des_status = 1
|
||||
@syllabus.save_attachments(params[:attachments])
|
||||
if @syllabus.save
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@syllabus.id,OwnerTypeHelper::SYLLABUS
|
||||
end
|
||||
redirect_to syllabus_path(@syllabus)
|
||||
else
|
||||
redirect_to syllabus_path(@syllabus)
|
||||
end
|
||||
end
|
||||
|
||||
#删除课程大纲的描述
|
||||
def destroy
|
||||
if @syllabus and @syllabus.courses.empty?
|
||||
@syllabus.destroy
|
||||
redirect_to user_path(User.current.id)
|
||||
end
|
||||
end
|
||||
|
||||
#班级列表
|
||||
def syllabus_courselist
|
||||
@order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
|
||||
|
||||
#确定 sort_type
|
||||
if @order.to_i == @type.to_i
|
||||
@c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序
|
||||
else
|
||||
@c_sort = 2
|
||||
end
|
||||
|
||||
sort_name = "updated_on"
|
||||
sort_type = @c_sort == 1 ? "asc" : "desc"
|
||||
|
||||
@courses = User.current.courses.visible.where("is_delete =? and syllabus_id =?", 0, @syllabus.id).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
|
||||
|
||||
#根据 作业+资源数排序
|
||||
if @order.to_i == 2
|
||||
@type = 2
|
||||
@courses.each do |course|
|
||||
course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count)
|
||||
if course[:infocount] < 0
|
||||
course[:infocount] = 0
|
||||
end
|
||||
end
|
||||
@c_sort == 1 ? (@courses = @courses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@courses = @courses.sort{|x,y| y[:infocount] <=> x[:infocount]})
|
||||
@courses = sortby_time_countcommon_nosticky @courses,sort_name
|
||||
else
|
||||
@type = 1
|
||||
end
|
||||
|
||||
#分页
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@atta_count = @courses.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
@courses = paginateHelper @courses,@limit
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{render :layout => 'base_syllabus'}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def find_syllabus
|
||||
@syllabus = Syllabus.find params[:id]
|
||||
|
|
|
@ -3184,23 +3184,34 @@ class UsersController < ApplicationController
|
|||
@c_sort = 2
|
||||
end
|
||||
|
||||
sort_name = "updated_on"
|
||||
sort_name = "updated_at"
|
||||
sort_type = @c_sort == 1 ? "asc" : "desc"
|
||||
|
||||
# @courses = @user.courses.visible.where("is_delete =?", 0).order("#{sort_name} #{sort_type}")
|
||||
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
|
||||
#@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS #{sort_name}").order("#{sort_name} #{sort_type}")
|
||||
|
||||
courses = @user.courses.visible.where("is_delete =?", 0)
|
||||
syllabus_ids = courses.empty? ? '(-1)' : "(" + courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
|
||||
@syllabus = Syllabus.where("id in #{syllabus_ids} or user_id = #{User.current.id}").order("#{sort_name} #{sort_type}")
|
||||
|
||||
#根据 作业+资源数排序
|
||||
if @order.to_i == 2
|
||||
@type = 2
|
||||
@courses.each do |course|
|
||||
course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count)
|
||||
if course[:infocount] < 0
|
||||
course[:infocount] = 0
|
||||
# @courses.each do |course|
|
||||
# course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count)
|
||||
# if course[:infocount] < 0
|
||||
# course[:infocount] = 0
|
||||
# end
|
||||
# end
|
||||
@syllabus.each do |syllabus|
|
||||
syllabus[:infocount] = 0
|
||||
courses = courses.select("syllabus_id = #{syllabus.id}")
|
||||
courses.each do |c|
|
||||
syllabus[:infocount] += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count)
|
||||
end
|
||||
end
|
||||
@c_sort == 1 ? (@courses = @courses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@courses = @courses.sort{|x,y| y[:infocount] <=> x[:infocount]})
|
||||
@courses = sortby_time_countcommon_nosticky @courses,sort_name
|
||||
@c_sort == 1 ? (@syllabus = @syllabus.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@syllabus = @syllabus.sort{|x,y| y[:infocount] <=> x[:infocount]})
|
||||
@syllabus = sortby_time_countcommon_nosticky @syllabus,sort_name
|
||||
else
|
||||
@type = 1
|
||||
end
|
||||
|
@ -3208,10 +3219,10 @@ class UsersController < ApplicationController
|
|||
#分页
|
||||
@limit = 10
|
||||
@is_remote = true
|
||||
@atta_count = @courses.count
|
||||
@atta_count = @syllabus.count
|
||||
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
||||
@offset ||= @atta_pages.offset
|
||||
@courses = paginateHelper @courses,@limit
|
||||
@syllabus = paginateHelper @syllabus,@limit
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -3276,6 +3287,9 @@ class UsersController < ApplicationController
|
|||
when 'News'
|
||||
obj = News.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.comments.reorder("created_on desc")
|
||||
when 'Syllabus'
|
||||
obj = Syllabus.where('id = ?', params[:id].to_i).first
|
||||
@journals = obj.comments.reorder("created_on desc")
|
||||
when 'JournalsForMessage'
|
||||
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
|
||||
journals = []
|
||||
|
|
|
@ -264,6 +264,28 @@ class WordsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#课程大纲的回复
|
||||
def leave_syllabus_message
|
||||
if User.current.logged?
|
||||
@user = User.current
|
||||
@syllabus = Syllabus.find(params[:id]);
|
||||
if params[:comment].size>0 && User.current.logged? && @user
|
||||
feedback = Syllabus.add_syllabus_jour(@user, params[:comment], params[:id])
|
||||
if (feedback.errors.empty?)
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
|
||||
end
|
||||
redirect_to syllabus_path(@syllabus)
|
||||
else
|
||||
flash[:error] = feedback.errors.full_messages[0]
|
||||
end
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
#作业的回复
|
||||
def leave_homework_message
|
||||
if User.current.logged?
|
||||
|
|
|
@ -2,4 +2,37 @@ module SyllabusesHelper
|
|||
def get_syllabuses_by_tag(tag_name)
|
||||
Syllabus.tagged_with(tag_name).order('updated_at desc')
|
||||
end
|
||||
|
||||
def teacher_count syllabus
|
||||
count = 0
|
||||
courses = syllabus.courses
|
||||
unless courses.empty?
|
||||
courses.each do |c|
|
||||
count += TeacherAndAssistantCount c
|
||||
end
|
||||
end
|
||||
count
|
||||
end
|
||||
|
||||
def student_count syllabus
|
||||
count = 0
|
||||
courses = syllabus.courses
|
||||
unless courses.empty?
|
||||
courses.each do |c|
|
||||
count += studentCount c
|
||||
end
|
||||
end
|
||||
count
|
||||
end
|
||||
|
||||
def file_count syllabus
|
||||
count = 0
|
||||
courses = syllabus.courses
|
||||
unless courses.empty?
|
||||
courses.each do |c|
|
||||
count += visable_attachemnts_incourse(c).count
|
||||
end
|
||||
end
|
||||
count
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,10 +7,23 @@ class Syllabus < ActiveRecord::Base
|
|||
|
||||
belongs_to :user
|
||||
has_many :courses
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
attr_accessible :description, :title, :eng_name, :type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course
|
||||
safe_attributes 'title', 'description', 'eng_name', 'type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course'
|
||||
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::SYLLABUS
|
||||
end
|
||||
|
||||
###添加回复
|
||||
def self.add_syllabus_jour(user, notes, id , options = {})
|
||||
syllabus = Syllabus.find(id)
|
||||
if options.count == 0
|
||||
jfm = syllabus.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
|
||||
else
|
||||
jfm = syllabus.journals_for_messages.build(options)
|
||||
end
|
||||
jfm.save
|
||||
jfm
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
<% teachers_num = teacher_count @syllabus%>
|
||||
<% students_num = student_count @syllabus%>
|
||||
<% files_num = file_count @syllabus%>
|
||||
<div class="pr_info_logo fl mb5">
|
||||
<%= image_tag("../images/syllabus.jpg",width:"60px", height: "60px") %>
|
||||
</div>
|
||||
|
@ -19,7 +22,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="pr_info_foot ">
|
||||
教师(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank">10</a>)<span>|</span>
|
||||
学生(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank">10</a>)<span>|</span>
|
||||
资源(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank">100</a>)</div>
|
||||
教师(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default"><%=teachers_num %></a>)<span>|</span>
|
||||
学生(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default"><%=students_num %></a>)<span>|</span>
|
||||
资源(<a class="info_foot_num c_blue" href="javascript:void(0);" target="_blank" style="cursor: default"><%=files_num %></a>)</div>
|
||||
<div class="cl"></div>
|
|
@ -45,6 +45,7 @@
|
|||
<div class="homepagePortraitContainer mt15">
|
||||
<%=render :partial => 'layouts/syllabus_info' %>
|
||||
</div>
|
||||
<% update_visiti_count @syllabus %>
|
||||
|
||||
<div class="homepageLeftMenuContainer">
|
||||
<ul class="syllabus_leftinfo">
|
||||
|
@ -73,7 +74,7 @@
|
|||
|
||||
<div class="homepageLeftMenuContainer">
|
||||
<div class="homepageLeftMenuBlock">
|
||||
<a href="javascript:void(0);" class="homepageMenuText" >班级</a>
|
||||
<%=link_to '班级', {:controller => "syllabuses", :action => "syllabus_courselist", :id => @syllabus.id}, :class => 'homepageMenuText' %>
|
||||
<% if is_current_user%>
|
||||
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
||||
<div class="courseMenu" id="courseMenu">
|
||||
|
@ -81,7 +82,7 @@
|
|||
<li class="courseMenuIcon fr" style="margin-right:10px;" id="courseMenuIcon">
|
||||
<ul class="topnav_course_menu" id="topnav_course_menu">
|
||||
<li>
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "menuGrey"%>
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "menuGrey", :target => '_blank'%>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "menuGrey",:method => "post"%>
|
||||
|
@ -124,7 +125,7 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="fontGrey2 mt10 ml20">访问计数 343 (自2016年5月)</div>
|
||||
<div class="fontGrey2 mt10 ml20">访问计数 <%=@syllabus.visits %> (自2016年7月)</div>
|
||||
|
||||
</div><!--left end -->
|
||||
<div class="homepageRight">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'share','new_user', 'user_leftside','prettify','users',:media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'share','new_user', 'user_leftside','prettify','users','syllabus',:media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
<div class="listbox" id="course-list">
|
||||
<h2 class="list-h2">班级列表</h2>
|
||||
<div class="list_title">
|
||||
<div class="category2 fl">
|
||||
<span class="grayTxt ">排序:</span>
|
||||
<%= link_to "时间", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
|
||||
<% if @type.to_i == 1 %>
|
||||
<%= link_to "", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
|
||||
<% end %>
|
||||
<%= link_to "人气", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
|
||||
<% if @type.to_i == 2 %>
|
||||
<%= link_to "", {:controller => 'syllabuses', :action => 'syllabus_courselist', :id =>@syllabus, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
|
||||
<% end %>
|
||||
</div>
|
||||
<p class="fr grayTxt">创建老师:<%=@syllabus.user.show_name %><span class="mr10 "></span> 创建时间:<%=format_date @syllabus.created_at %></p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="bloglistbox">
|
||||
<% if @courses.any? %>
|
||||
<% @courses.each do |course|%>
|
||||
<ul class="list-file">
|
||||
<li>
|
||||
<span class="item_list fl"></span>
|
||||
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "list-title fl #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
|
||||
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
<% teacher = User.where("id=?",course.tea_id).first%>
|
||||
<span class="fr grayTxt">
|
||||
<%='主讲老师:'+(teacher.try(:realname) != " " ? teacher.lastname + teacher.firstname : teacher.try(:login)) %>
|
||||
</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml15">
|
||||
<!--<span class="grayTxt">创建:<%#= format_time(course.created_at) %></span>-->
|
||||
<span class="grayTxt">更新:<%= format_time(course.updated_on) %></span>
|
||||
<span class="grayTxt">
|
||||
学期: <span><%= current_time_and_term course %></span>
|
||||
</span>
|
||||
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,@course) %>
|
||||
<% homework_num = course.homework_commons.count %>
|
||||
<% else %>
|
||||
<% homework_num = course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
|
||||
<% end %>
|
||||
<p class="list-info fr grayTxt"><span><%= homework_num %></span><span>作业</span><span>|</span><span> <%= visable_attachemnts_incourse(course).count %></span><span>资源</span></p>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
<div>
|
||||
<ul class="wlist" id="pages" >
|
||||
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
$(function() {
|
||||
var leftHeight = $("#LSide").height() - $(".fontGrey5").height() - 20;
|
||||
var rightHeight = $(".homepageRight").height();
|
||||
if (rightHeight < leftHeight) {
|
||||
var diffHeight = leftHeight - rightHeight;
|
||||
var tmpHeight = $(".listbox").height() + diffHeight;
|
||||
$(".listbox").css("height", tmpHeight);
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -7,42 +7,6 @@
|
|||
<div class="HomeWork">
|
||||
<p class="f16 mb10">课程信息</p>
|
||||
<div class="HomeWorkCon">
|
||||
<!--<div class="">
|
||||
<textarea class="InputBox W700 h400" >
|
||||
<h2 class="syllabuscon_title">《设计管理》课程大纲</h2>
|
||||
<div class="syllabuscon_txt">
|
||||
<p class="syllabuscon_txt_title">一 . 课程目的</p>
|
||||
<p >1. 综合各门专业基础课程知识,运用前修课程获得的技术技能进行项目策划、设计、实施、运作方法研究;<br/>
|
||||
2. 初步学会运用现代科学的设计理念;实施规范;系统管理观念运作;<br/>
|
||||
3. 确立现代设计管理意识及培育实施务实思想。
|
||||
</p>
|
||||
<p class="syllabuscon_txt_title">二 . 主要目标</p>
|
||||
<p >1. 培养学生具备设计管理的理念;<br/>
|
||||
2. 培养学生了解和掌握项目策划、设计、实事、运作方法;<br/>
|
||||
3. 培养学生运用现代科学的设计理念;实施规范;系统管理观念。确立现代设计管理意识及培育实施务实思想。
|
||||
</p>
|
||||
<p class="syllabuscon_txt_title">三 . 详细内容与学时安排</p>
|
||||
<p >1. 详细内容<br/>
|
||||
第一章 概论<br/>
|
||||
(1) 设计管理基本概念<br/>
|
||||
(2) 设计管理构成内容<br/>
|
||||
(3) 设计管理社会意义理论<br/>
|
||||
第二章 设计管理的文化内涵<br/>
|
||||
(1) 人类文化与设计文化<br/>
|
||||
(2) 设计文化与文化设计基本概念<br/>
|
||||
2. 安排学时<br/>
|
||||
第一章 理论学时:6 实践学时:2 上级学时:0<br/>
|
||||
第二章 理论学时:6 实践学时:2 上级学时:0<br/>
|
||||
</p>
|
||||
<p class="syllabuscon_txt_title">四 . 讲授方法</p>
|
||||
<p >1. 理论讲授;<br/>
|
||||
2. 案例分析;<br/>
|
||||
3. 作业项目;<br/>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</textarea>
|
||||
</div>-->
|
||||
<%= labelled_form_for @syllabus, :url =>syllabus_path(@syllabus),
|
||||
:html => {:nhname=>'form',:multipart => true, :id => 'syllabus-form'} do |f| %>
|
||||
<div>
|
||||
|
@ -64,19 +28,20 @@
|
|||
<div class="cl"></div>
|
||||
<p id="description_notice_span"></p>
|
||||
</div>
|
||||
|
||||
<div class="mt5">
|
||||
<div class="fl" id="syllabus_attachments">
|
||||
<%= render :partial => 'attachments/form_course', :locals => {:container => @syllabus, :isReply => false} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt5">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_syllabus();">发送</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="window.location.href = '<%=syllabus_path(@syllabus)%>';">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
|
||||
<div class="mt5">
|
||||
<div class="fl" id="syllabus_attachments">
|
||||
<%= render :partial => 'attachments/form_course', :locals => {:container => @syllabus, :isReply => false} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_syllabus();">发送</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="window.location.href = '<%=syllabus_path(@syllabus)%>';">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
</div>
|
||||
</div><!--HomeWork end-->
|
|
@ -1,42 +1,89 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
sd_create_editor_from_data(<%= @syllabus.id %>, null, "100%", "<%= @syllabus.class.to_s %>");
|
||||
});
|
||||
</script>
|
||||
<div class="RightBanner" >
|
||||
<p >课程信息</p>
|
||||
</div>
|
||||
<div class="<%=@syllabus.description.nil? ? 'HomeWork' : 'syllabusbox'%>">
|
||||
<% if @syllabus.description.nil?%>
|
||||
<% if @syllabus.des_status == 1 && @syllabus.courses.empty? %>
|
||||
<div class="syllabusbox_tishi">
|
||||
<% if User.current == @syllabus.user %>
|
||||
<p class="syllabus_info_tishi">您建立的课程尚未填写课程大纲,请完善您的<%=link_to '课程大纲', edit_syllabus_path(@syllabus) %>!</p>
|
||||
<p >您建立的课程还未创建班级,请
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "syllabusbox_a_blue", :target => '_blank'%>。
|
||||
</p>
|
||||
<% elsif User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
||||
<p >本课程下还未创建班级,请
|
||||
<%= link_to "新建班级", new_course_path(:host=> Setting.host_course, :syllabus_id => @syllabus.id), :class => "syllabusbox_a_blue", :target => '_blank'%>。
|
||||
</p>
|
||||
<% else %>
|
||||
<p >本课程下还未创建班级,敬请期待。
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="<%=@syllabus.des_status == 0 ? 'HomeWork' : 'syllabusbox'%>">
|
||||
<% if @syllabus.des_status == 0%>
|
||||
<% if User.current == @syllabus.user %>
|
||||
<p class="syllabus_info_tishi">您建立的课程尚未填写课程大纲,请完善您的<%=link_to '课程大纲', edit_syllabus_path(@syllabus), :class => 'syllabusbox_a_blue' %>!</p>
|
||||
<% else %>
|
||||
<p class="syllabus_info_tishi"><%=@syllabus.user.show_name %>老师尚未完成课程大纲的编写,敬请期待。</p>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="syllabuscon">
|
||||
<%=@syllabus.description %>
|
||||
<%=@syllabus.description.html_safe %>
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @syllabus} %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="homepagePostSetting" style="margin:10px;">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%=link_to '编辑', edit_syllabus_path(@syllabus),:class=>'postOptionLink' %></li>
|
||||
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
|
||||
<% if User.current.logged? && User.current == @syllabus.user%>
|
||||
<div class="homepagePostSetting" style="margin:10px;">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%=link_to '编辑', edit_syllabus_path(@syllabus), :class => 'postOptionLink'%></li>
|
||||
<% if @syllabus.courses.empty? %>
|
||||
<li><%=link_to '删除', syllabus_path(@syllabus), :class => 'postOptionLink', :method => 'delete', :data => {:confirm => l(:text_are_you_sure)}%></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="homepagePostReply">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount"><a href="javascript:void(0);" class="mr5">回复(2)</a>▪<a href="javascript:void(0);" class="ml5"> 赞(10)</a></div>
|
||||
</div>
|
||||
<div class="homepagePostReplyContainer">
|
||||
<div class="homepagePostReplyPortrait mr15"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="33" height="33" alt="用户头像" /></a></div>
|
||||
<div class="homepagePostReplyInputContainer">
|
||||
<input class="homepagePostReplyInput fl mr15" placeholder="请输入回复">
|
||||
<a href="javascript:void(0);" class="homepagePostReplyEmotion mt5"></a> <a href="javascript:void(0);" class="homepagePostReplySubmit postReplySubmit fl mt5">发送</a> </div>
|
||||
<% count=@syllabus.journals_for_messages.count %>
|
||||
<div class="homepagePostReply">
|
||||
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => @syllabus, :user_activity_id => @syllabus.id} %>
|
||||
|
||||
<% comments = @syllabus.journals_for_messages.reorder("created_on desc").limit(3) %>
|
||||
<% if count > 0 %>
|
||||
<div class="" id="reply_div_<%= @syllabus.id %>">
|
||||
<%= render :partial => 'users/all_replies', :locals => {:comments => comments}%>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= @syllabus.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= @syllabus.id%>' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_syllabus_message', :id => @syllabus.id},:method => "post") do |f|%>
|
||||
<div nhname='toolbar_container_<%= @syllabus.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @syllabus.id%>' name="comment"></textarea>
|
||||
<a id="new_message_submit_btn_<%= @syllabus.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= @syllabus.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => "users/show_unlogged" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<%= render :partial => 'syllabus_course_list'%>
|
|
@ -0,0 +1 @@
|
|||
$("#course-list").replaceWith('<%= escape_javascript( render :partial => 'syllabus_course_list') %>');
|
|
@ -74,7 +74,7 @@
|
|||
<% end %>
|
||||
|
||||
<div class="homepagePostReplyContainer borderBottomNone minHeight48">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="homepagePostReplyInputContainer mb10">
|
||||
<% if User.current.logged? %>
|
||||
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
<div class="syllabus_box" id="course-list">
|
||||
<h2 class="syllabus_h2_top"><span class="icon_course fl mt7 mr5"></span>课程列表</h2>
|
||||
<div class="syllabus_category">
|
||||
<span class="grayTxt fl">排序:</span>
|
||||
<%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fl", :remote => true %>
|
||||
<% if @type.to_i == 1 %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fl", :remote => true %>
|
||||
<% end %>
|
||||
<%= link_to "人气", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fl", :remote => true %>
|
||||
<% if @type.to_i == 2 %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fl", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fl", :remote => true %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="syllabus_courses_box">
|
||||
<% if @syllabus.any? %>
|
||||
<% @syllabus.each do |syllabus|%>
|
||||
<div class="syllabus_courses_list ">
|
||||
<div class="sy_courses_open">
|
||||
<span class="icons_sy_open fl mr5"></span>
|
||||
<h3 class="syllabus_courses_title fl"><%=syllabus.title %></h3>
|
||||
</div>
|
||||
<%=link_to '管理课程', syllabus_path(syllabus.id), :class => 'icons_sy_setting fr' %>
|
||||
<p class="fl sy_p_grey">更新时间:2016-05-05<span class="mr10"></span>创建老师:豆蔻</p>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<div>
|
||||
<ul class="wlist" id="pages" >
|
||||
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//如果右边的列表比左边的高度低则将右边的高度设为与左边对齐
|
||||
$(function() {
|
||||
var leftHeight = $("#LSide").height() - $(".fontGrey5").height() - 20;
|
||||
var rightHeight = $(".homepageRight").height();
|
||||
if (rightHeight < leftHeight) {
|
||||
var diffHeight = leftHeight - rightHeight;
|
||||
var tmpHeight = $(".listbox").height() + diffHeight;
|
||||
$(".listbox").css("height", tmpHeight);
|
||||
}
|
||||
});
|
||||
$(".sy_courses_open").toggle(function(){
|
||||
//$(this).hide();
|
||||
$(this).parent().next().hide();
|
||||
$(this).addClass("sy_courses_close").removeClass("sy_courses_open");
|
||||
//$(this).parent().next().show();
|
||||
},function(){
|
||||
$(this).parent().next().show();
|
||||
$(this).addClass("sy_courses_open").removeClass("sy_courses_close");
|
||||
});
|
||||
$(".sy_courses_close").toggle(function(){
|
||||
//$(this).hide();
|
||||
$(this).parent().next().show();
|
||||
$(this).addClass("sy_courses_open").removeClass("sy_courses_close");
|
||||
//$(this).parent().next().show();
|
||||
},function(){
|
||||
$(this).parent().next().hide();
|
||||
$(this).addClass("sy_courses_close").removeClass("sy_courses_open");
|
||||
});
|
||||
</script>
|
|
@ -1 +1 @@
|
|||
<%= render :partial => 'users/user_course_list'%>
|
||||
<%= render :partial => 'users/user_syllabus_list'%>
|
||||
|
|
|
@ -1 +1 @@
|
|||
$("#course-list").replaceWith('<%= escape_javascript( render :partial => 'users/user_course_list') %>');
|
||||
$("#course-list").replaceWith('<%= escape_javascript( render :partial => 'users/user_syllabus_list') %>');
|
|
@ -1075,7 +1075,7 @@ RedmineApp::Application.routes.draw do
|
|||
#课程大纲路由设置
|
||||
resources :syllabuses do
|
||||
member do
|
||||
|
||||
match 'syllabus_courselist', :to => 'syllabuses#syllabus_courselist', :via => :get, :as => 'syllabus_courselist'
|
||||
end
|
||||
|
||||
collection do
|
||||
|
@ -1201,6 +1201,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback'
|
||||
match 'project/:id/share', :to => 'projects#share', :as => 'share_show' #share
|
||||
post 'words/:id/leave_user_message', :to => 'words#leave_user_message', :as => "leave_user_message"
|
||||
post 'words/:id/leave_syllabus_message', :to => 'words#leave_syllabus_message', :as => "leave_syllabus_message"
|
||||
post 'words/:id/leave_homework_message', :to => 'words#leave_homework_message', :as => "leave_homework_message"
|
||||
post 'words/:id/reply_to_homework', :to => 'words#reply_to_homework', :as => "reply_to_homework"
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddVisitsToSyllabus < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :syllabuses, :visits, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddDesStatusToSyllabus < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :syllabuses, :des_status, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20160627074232) do
|
||||
ActiveRecord::Schema.define(:version => 20160629094716) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -1865,8 +1865,8 @@ ActiveRecord::Schema.define(:version => 20160627074232) do
|
|||
t.string "title"
|
||||
t.text "description"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "eng_name"
|
||||
t.integer "type"
|
||||
t.integer "credit"
|
||||
|
@ -1875,6 +1875,8 @@ ActiveRecord::Schema.define(:version => 20160627074232) do
|
|||
t.integer "practice_hours"
|
||||
t.string "applicable_major"
|
||||
t.string "pre_course"
|
||||
t.integer "visits", :default => 0
|
||||
t.integer "des_status", :default => 0
|
||||
end
|
||||
|
||||
add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id"
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
|
@ -79,7 +79,7 @@ input.syllabus_input_min{
|
|||
height:34px;
|
||||
}
|
||||
a.syllabusbox_a_blue{
|
||||
color:#3b94d6;
|
||||
color:#3b94d6 !important;
|
||||
}
|
||||
.syllabus_leftinfo p{
|
||||
line-height:25px;
|
||||
|
@ -110,7 +110,7 @@ a.syllabusbox_a_blue{
|
|||
.syllabus_box{ width:750px; border:1px solid #e7e7e7; background-color:#fff;}
|
||||
.syllabus_courses_list{ padding:15px; border-bottom:1px solid #e7e7e7; cursor:pointer;}
|
||||
.syllabus_courses_list:hover{ background:#f6fafd;}
|
||||
.syllabus_courses_title{ font-size:16px; color:#333; width:650px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||
a.syllabus_courses_title{ font-size:16px; color:#333; width:650px; font-weight:normal;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||
.sy_p_grey{ margin-left:25px; color:#888; margin-top:5px; font-size:12px;}
|
||||
.syllabus_class_box{ padding-left:30px; background:#f6f6f6;}
|
||||
.syllabus_class_list{ padding:12px 0 12px 15px; height:44px;border-left:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7; position:relative;}
|
||||
|
@ -127,9 +127,9 @@ a.syllabusbox_a_blue{
|
|||
.listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; }
|
||||
.bloglistbox{ min-height:690px;}
|
||||
.list-h2{ font-size:16px; font-weight:bold; color:#000; padding-bottom:5px;}
|
||||
.category{ }
|
||||
.category2{ }
|
||||
.list_title{padding:10px 0; border-bottom:1px solid #ddd;}
|
||||
.category a,.category span{ float:left; margin-right:5px;}
|
||||
.category2 a,.category2 span{ float:left; margin-right:5px;}
|
||||
.grayTxt{ color:#9093a6;}
|
||||
.sortTxt{ color:#000;}
|
||||
.sortTxt:hover{ color:#28be6c;}
|
||||
|
|
Loading…
Reference in New Issue