课程添加允许学生发布资源的配置
This commit is contained in:
parent
94831443a5
commit
0eff2bcb74
|
@ -243,6 +243,7 @@ class CoursesService
|
|||
#params[:term]:学期(秋季学期或春季学期)
|
||||
#params[:time]: 年份(例:2014)
|
||||
#params[:class_period]:学时总数
|
||||
#params[:publish_resource] 允许学生上传资源 0 不允许 1 允许
|
||||
def edit_course(params,course,current_user)
|
||||
course.send(:safe_attributes=, params[:course], current_user)
|
||||
#course.safe_attributes = params[:course]
|
||||
|
@ -251,6 +252,7 @@ class CoursesService
|
|||
course.class_period = params[:class_period].to_i
|
||||
params[:course][:is_public] ? course.is_public = 1 : course.is_public = 0
|
||||
params[:course][:open_student] ? course.open_student = 1 : course.open_student = 0
|
||||
params[:course][:publish_resource] ? course.publish_resource = 1 : course.publish_resource = 0
|
||||
if course.save
|
||||
if params[:course][:is_public] == '0'
|
||||
course_status = CourseStatus.find_by_course_id(course.id)
|
||||
|
|
|
@ -65,6 +65,12 @@
|
|||
<span class="c_grey">(打钩为"学生列表公开",不打钩为不公开,若不公开,则课程外部人员看不到学生列表)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" mb5 ml30">
|
||||
<label >学生上传资源 :</label>
|
||||
<input <%= @course.publish_resource == 1 ? 'checked' : ''%> id="course_publish_resource" name="course[publish_resource]" type="checkbox" style="margin-left: 1px;"/>
|
||||
<span class="c_grey">(打钩为"允许学生上传资源",不打钩为"不允许学生上传资源")</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" ml90" >
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_edit_course(<%= @course.id%>);" >提交</a>
|
||||
<%= link_to l(:button_cancel), course_path(@course), :class => "blue_btn grey_btn fl c_white" %>
|
||||
|
|
|
@ -22,8 +22,11 @@
|
|||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
<!-- MathJax的配置 -->
|
||||
<!--<script type="text/javascript"-->
|
||||
<!--src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">-->
|
||||
<!--</script>-->
|
||||
<script type="text/javascript"
|
||||
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
|
||||
</script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
|
@ -150,7 +153,7 @@
|
|||
<div class="subNav">
|
||||
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02" %>
|
||||
<%= link_to "(#{course_file_num})", course_files_path(@course), :class => "subnav_num c_orange",:id=>'courses_files_count_nav' %>
|
||||
<% if is_teacher %>
|
||||
<% if is_teacher || @course.publish_resource == 1 %>
|
||||
<!--link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white')-->
|
||||
<a class="subnav_green ml95 c_white" href="javascript:void(0);" onclick="course_files_upload();">+上传资源 </a>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddColumnPublistResourceToCourse < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :courses,:publish_resource,:integer ,:default => 0
|
||||
end
|
||||
end
|
61
db/schema.rb
61
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20151102090519) do
|
||||
ActiveRecord::Schema.define(:version => 20151117075939) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -425,8 +425,8 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
|
|||
t.string "code"
|
||||
t.integer "time"
|
||||
t.string "extra"
|
||||
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 "location"
|
||||
t.string "term"
|
||||
t.string "string"
|
||||
|
@ -436,14 +436,15 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
|
|||
t.string "class_period"
|
||||
t.integer "school_id"
|
||||
t.text "description"
|
||||
t.integer "status", :default => 1
|
||||
t.integer "attachmenttype", :default => 2
|
||||
t.integer "status", :default => 1
|
||||
t.integer "attachmenttype", :default => 2
|
||||
t.integer "lft"
|
||||
t.integer "rgt"
|
||||
t.integer "is_public", :limit => 1, :default => 1
|
||||
t.integer "inherit_members", :limit => 1, :default => 1
|
||||
t.integer "open_student", :default => 0
|
||||
t.integer "outline", :default => 0
|
||||
t.integer "is_public", :limit => 1, :default => 1
|
||||
t.integer "inherit_members", :limit => 1, :default => 1
|
||||
t.integer "open_student", :default => 0
|
||||
t.integer "outline", :default => 0
|
||||
t.integer "publish_resource", :default => 0
|
||||
end
|
||||
|
||||
create_table "custom_fields", :force => true do |t|
|
||||
|
@ -960,6 +961,7 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
|
|||
t.datetime "created_on"
|
||||
t.integer "comments_count", :default => 0, :null => false
|
||||
t.integer "course_id"
|
||||
t.integer "sticky", :default => 0
|
||||
end
|
||||
|
||||
add_index "news", ["author_id"], :name => "index_news_on_author_id"
|
||||
|
@ -1045,10 +1047,45 @@ ActiveRecord::Schema.define(:version => 20151102090519) do
|
|||
t.integer "project_id"
|
||||
end
|
||||
|
||||
create_table "org_activities", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "org_act_id"
|
||||
t.string "org_act_type"
|
||||
t.integer "container_id"
|
||||
t.string "container_type"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "org_document_comments", :force => true do |t|
|
||||
t.string "title"
|
||||
t.text "content"
|
||||
t.integer "organization_id"
|
||||
t.integer "creator_id"
|
||||
t.integer "parent_id"
|
||||
t.integer "reply_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.boolean "locked", :default => false
|
||||
t.integer "sticky", :default => 0
|
||||
end
|
||||
|
||||
create_table "org_member_roles", :force => true do |t|
|
||||
t.integer "org_member_id"
|
||||
t.integer "role_id"
|
||||
end
|
||||
|
||||
create_table "org_members", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "organization_id"
|
||||
t.string "role"
|
||||
t.integer "user_id"
|
||||
t.integer "organization_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "org_projects", :force => true do |t|
|
||||
t.integer "organization_id"
|
||||
t.integer "project_id"
|
||||
t.datetime "created_at"
|
||||
end
|
||||
|
||||
create_table "organizations", :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue