Add course assignment.
This commit is contained in:
parent
fc9785034d
commit
11876a777c
|
@ -2,6 +2,7 @@ class Admin::CoursesController < OrbitMemberController
|
|||
include Admin::CoursesHelper
|
||||
layout "member_plugin"
|
||||
before_action :set_course, only: [:show, :edit , :update, :destroy]
|
||||
before_action :set_course_assignment, only: [ :edit_assignment , :update_assignment, :destroy_assignment]
|
||||
before_action :set_plugin
|
||||
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||
|
||||
|
@ -24,7 +25,17 @@ class Admin::CoursesController < OrbitMemberController
|
|||
|
||||
def show
|
||||
end
|
||||
|
||||
def show_assignments
|
||||
@course_assignment = CourseAssignment.where(:uid=>params[:uid]).first
|
||||
@course = @course_assignment.course
|
||||
@student_ids = @course.student_ids
|
||||
@student_assignments = StudentAssignment.where(:course_assignment=>@course_assignment,:member_profile_id.in=>@student_ids).page(params[:page]).per(10) rescue Kaminari.paginate_array([])
|
||||
@not_yet_deliver_student_ids = []
|
||||
if @student_assignments.to_a.count < 10
|
||||
@deliver_student_ids = StudentAssignment.where(:course_assignment=>@course_assignment,:member_profile_id.in=>@student_ids).pluck(:member_profile_id)
|
||||
@not_yet_deliver_student_ids = @student_ids - @deliver_student_ids
|
||||
end
|
||||
end
|
||||
def analysis_report
|
||||
role = params[:role_id]
|
||||
year_start = params[:year_start].to_i
|
||||
|
@ -61,6 +72,17 @@ class Admin::CoursesController < OrbitMemberController
|
|||
redirect_to params[:referer_url]
|
||||
end
|
||||
|
||||
def destroy_assignment
|
||||
@course_assignment.destroy
|
||||
redirect_to course_assignments_admin_courses_path(:page => params[:page])
|
||||
end
|
||||
|
||||
def update_assignment
|
||||
@course_assignment.update_attributes(course_assignment_params)
|
||||
@course_assignment.save
|
||||
redirect_to params[:referer_url]
|
||||
end
|
||||
|
||||
def setting
|
||||
end
|
||||
|
||||
|
@ -91,13 +113,34 @@ class Admin::CoursesController < OrbitMemberController
|
|||
|
||||
render json: {"success"=>true}
|
||||
end
|
||||
def course_assignments
|
||||
@course = Course.find(params[:id]) rescue nil
|
||||
@course_assignments = CourseAssignment.where(:course_id=>params[:id]).page(params[:page]).per(10)
|
||||
end
|
||||
def new_assignment
|
||||
@course_assignment = CourseAssignment.new
|
||||
end
|
||||
def edit_assignment
|
||||
end
|
||||
|
||||
def create_assignment
|
||||
#render :html => params and return
|
||||
course_assignment = CourseAssignment.create(course_assignment_params)
|
||||
redirect_to params[:referer_url]
|
||||
end
|
||||
private
|
||||
|
||||
def course_params
|
||||
params.require(:course).permit!
|
||||
course_params = params.require(:course).permit!
|
||||
if course_params['student_ids'].nil?
|
||||
course_params['student_ids'] = []
|
||||
end
|
||||
return course_params
|
||||
end
|
||||
def course_assignment_params
|
||||
course_assignment_params = params.require(:course_assignment).permit!
|
||||
return course_assignment_params
|
||||
end
|
||||
|
||||
def intro_params
|
||||
params.require(:course_intro).permit! rescue nil
|
||||
end
|
||||
|
@ -122,4 +165,15 @@ class Admin::CoursesController < OrbitMemberController
|
|||
end
|
||||
@course = Course.find_by(:uid => uid) rescue Course.find(params[:id])
|
||||
end
|
||||
def set_course_assignment
|
||||
path = request.path.split('/')
|
||||
if path.last.include? '-'
|
||||
uid = path[-1].split("-").last
|
||||
uid = uid.split("?").first
|
||||
else
|
||||
uid = path[-2].split("-").last
|
||||
uid = uid.split("?").first
|
||||
end
|
||||
@course_assignment = CourseAssignment.find_by(:uid => uid) rescue CourseAssignment.find(params[:id])
|
||||
end
|
||||
end
|
|
@ -16,6 +16,7 @@ class Course
|
|||
has_many :course_material_files, :dependent => :destroy, :autosave => true
|
||||
has_many :course_supplement_files, :dependent => :destroy, :autosave => true
|
||||
has_many :course_evaluation_files, :dependent => :destroy, :autosave => true
|
||||
has_many :course_assignments, :dependent => :destroy, :autosave => true
|
||||
|
||||
belongs_to :course_semester
|
||||
belongs_to :course_category
|
||||
|
@ -32,18 +33,26 @@ class Course
|
|||
|
||||
scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:year=>'desc') }
|
||||
before_save do |record|
|
||||
if !record.student_ids.empty?
|
||||
selected_course = SelectedCourse rescue nil
|
||||
if selected_course
|
||||
record.student_ids.each do |student_id|
|
||||
selected_course = SelectedCourse.where(:member_profile_id => student_id,:course_id=>self.id).first
|
||||
if selected_course.nil?
|
||||
SelectedCourse.create(:member_profile => MemberProfile.find(student_id) , :course_id=>self.id , :year=>self.year,:course_title_translations=>self.title_translations,:course_objective_translations=>self.objective_translations) rescue nil
|
||||
else
|
||||
selected_course.update(:year=>self.year,:course_title_translations=>self.title_translations,:course_objective_translations=>self.objective_translations)
|
||||
end
|
||||
selected_course = SelectedCourse rescue nil
|
||||
if selected_course
|
||||
student_ids_remove = record.student_ids_was.to_a - record.student_ids
|
||||
record.student_ids.each do |student_id|
|
||||
selected_course = SelectedCourse.where(:member_profile_id => student_id,:course_id=>record.id).first
|
||||
if selected_course.nil?
|
||||
SelectedCourse.create(:member_profile => MemberProfile.find(student_id) , :course_id=>record.id , :year=>record.year,:course_title_translations=>record.title_translations,:course_objective_translations=>record.objective_translations)
|
||||
else
|
||||
selected_course.update(:year=>record.year,:course_title_translations=>record.title_translations,:course_objective_translations=>record.objective_translations)
|
||||
end
|
||||
end
|
||||
student_ids_remove.each do |student_id|
|
||||
SelectedCourse.where(:member_profile_id => student_id,:course_id=>record.id).destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
before_destroy do |record|
|
||||
selected_course = SelectedCourse rescue nil
|
||||
if selected_course
|
||||
SelectedCourse.where(:course_id=>record.id).destroy
|
||||
end
|
||||
end
|
||||
def students
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
class CourseAssignment
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Slug
|
||||
field :name, as: :slug_title, type: String, localize: true, default: ""
|
||||
field :deadline, type: DateTime, default: DateTime.now
|
||||
field :assign_date, type: DateTime, default: DateTime.now
|
||||
field :detail, type: String, localize: true, default: ""
|
||||
has_many :course_attachments, :dependent => :destroy, :autosave => true
|
||||
accepts_nested_attributes_for :course_attachments, :allow_destroy => true
|
||||
belongs_to :course
|
||||
scope :enabled_for_student, ->{where(:assign_date.lte=>DateTime.now)}
|
||||
def display_attachments
|
||||
self.course_attachments.map{|f|
|
||||
next if f.file.file.nil?
|
||||
title = (f.title.blank? ? f.file.file.original_filename : f.title)
|
||||
"<a href=\"#{f.file.url}\" title=\"#{title}\">#{title}</a>"
|
||||
}.join("<br>").html_safe
|
||||
end
|
||||
def display_deadline
|
||||
self.deadline.strftime("%Y-%m-%d %H:%M")
|
||||
end
|
||||
def display_assign_date
|
||||
self.assign_date.strftime("%Y-%m-%d %H:%M")
|
||||
end
|
||||
def deliver_count
|
||||
StudentAssignment.where(:course_assignment_id => self.id,:member_profile_id.ne=>nil).count rescue 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
class CourseAttachment
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :title, localize: true
|
||||
field :description, localize: true
|
||||
field :should_destroy, :type => Boolean
|
||||
|
||||
mount_uploader :file, AssetUploader
|
||||
|
||||
belongs_to :course_assignment
|
||||
end
|
|
@ -10,6 +10,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= link_to course.course_assignments.count,course_assignments_admin_courses_path(:id=> course.id) %></td>
|
||||
<td><%= course.member_profile.name rescue "" %></td>
|
||||
<td><%= course.display_students rescue "" %></td>
|
||||
</tr>
|
||||
|
|
|
@ -0,0 +1,203 @@
|
|||
<% # encoding: utf-8 %>
|
||||
<% content_for :page_specific_css do %>
|
||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||
<%= stylesheet_link_tag "lib/fileupload" %>
|
||||
<%= stylesheet_link_tag "lib/main-list" %>
|
||||
<%= stylesheet_link_tag "lib/main-form-col2" %>
|
||||
<style type="text/css">
|
||||
.ui-helper-hidden-accessible{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<% end %>
|
||||
<% content_for :page_specific_javascript do %>
|
||||
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
|
||||
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
|
||||
<%= javascript_include_tag "lib/bootstrap-fileupload" %>
|
||||
<%= javascript_include_tag "lib/file-type" %>
|
||||
<%= javascript_include_tag "lib/module-area" %>
|
||||
<% end %>
|
||||
|
||||
<!-- Input Area -->
|
||||
<div class="input-area">
|
||||
|
||||
<!-- Language Tabs -->
|
||||
<div class="nav-name"><strong><%= t(:language) %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
<li class="<%= 'active' if i == 0 %>">
|
||||
<a data-toggle="tab" href=".<%= locale %>"><%= t(locale) %></a>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="pull-right">
|
||||
<%= copy_to_all_language_button(".language-nav", ".language-area") %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Language -->
|
||||
<div class="tab-content language-area">
|
||||
|
||||
<% @site_in_use_locales.each_with_index do |locale, i| %>
|
||||
|
||||
<div class="<%= locale %> tab-pane fade <%= ( i == 0 ) ? "in active" : '' %>">
|
||||
|
||||
<!-- Assignment title -->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_course.name") %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :name_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_course.name"), value: (@course_assignment.name_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Detail -->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_course.detail") %></label>
|
||||
<div class="controls">
|
||||
<%= f.fields_for :detail_translations do |f| %>
|
||||
<%= f.text_field locale, class: "input-block-level", placeholder: t("personal_course.detail"), value: (@course_assignment.detail_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="nav-name"><strong><%= t(:module) %></strong></div>
|
||||
<ul class="nav nav-pills module-nav">
|
||||
<li></li>
|
||||
<li class="active">
|
||||
<a href="#basic" data-toggle="tab"><%= t(:basic) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Module -->
|
||||
<div class="tab-content module-area">
|
||||
|
||||
<!-- Basic Module -->
|
||||
<div class="tab-pane fade in active" id="basic">
|
||||
<% if params[:id].present? %>
|
||||
<%= f.hidden_field :course_id, :value => params[:id] %>
|
||||
<% end %>
|
||||
<!-- assign_date -->
|
||||
<div class="control-group big-group">
|
||||
<label class="control-label muted">
|
||||
<%= t("personal_course.assign_date") %>
|
||||
<button tabindex="0" class="help_btn" data-target="#show_assign_date_modal" style="cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 1em;margin-left: 0.5em;background-color: #666666;border-color: #666666;color: white;" onclick="$('#show_assign_date_modal').modal('show')" type="button"><i aria-hidden="true" class="fa fa-info"></i></button>
|
||||
|
||||
</label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :assign_date, :no_label => true, :new_record => @course_assignment.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- deadline -->
|
||||
<div class="control-group big-group">
|
||||
<label class="control-label muted">
|
||||
<%= t("personal_course.deadline") %>
|
||||
<button tabindex="0" class="help_btn" data-target="#show_deadline_modal" style="cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 1em;margin-left: 0.5em;background-color: #666666;border-color: #666666;color: white;" onclick="$('#show_deadline_modal').modal('show')" type="button"><i aria-hidden="true" class="fa fa-info"></i></button>
|
||||
</label>
|
||||
<div class="controls">
|
||||
<%= f.datetime_picker :deadline, :no_label => true, :new_record => @course_assignment.new_record?, :data=>{"picker-type" => "range", "range" => "start"} %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Attachment -->
|
||||
<%
|
||||
files_hash = {}
|
||||
["course_attachment"].each do |file|
|
||||
hash = {}
|
||||
hash["html"] = add_attribute("form_file", f, file.pluralize.to_sym)
|
||||
hash["count"] = @course_assignment.send(file.pluralize).count rescue 0
|
||||
files_hash[file] = hash
|
||||
%>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_course.#{file}") %></label>
|
||||
<div class="controls">
|
||||
|
||||
<!-- Exist -->
|
||||
<% if !@course_assignment.new_record? && hash["count"] > 0 %>
|
||||
<div class="exist">
|
||||
<% @course_assignment.send(file.pluralize).each_with_index do |obj, i| %>
|
||||
<% if !obj.new_record? %>
|
||||
<%= f.fields_for file.pluralize.to_sym, obj do |f| %>
|
||||
<%= render :partial => "form_file", :object => obj, :locals => {:f => f, :i => i} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<hr>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- Add -->
|
||||
<div class="add-target" for="<%= file %>">
|
||||
</div>
|
||||
<p class="add-btn">
|
||||
<a class="add_file trigger btn btn-small btn-primary" for="<%= file %>"><i class="icons-plus"></i> <%= t(:add) %></a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="show_deadline_modal" class="modal fade" style="color: #333;">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" aria-hidden="true" class="close" data-target="show_deadline_modal">×</button>
|
||||
<h4 class="modal-title"><%= t("personal_course.deadline") %></h4>
|
||||
</div>
|
||||
<div class="modal-body"><%= t("personal_course.deadline_hint") %></div>
|
||||
<div class="modal-footer"><button type="button" class="btn btn-default close" data-target="show_deadline_modal">Close</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="show_assign_date_modal" class="modal fade" style="color: #333;">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" aria-hidden="true" class="close" data-target="show_assign_date_modal">×</button>
|
||||
<h4 class="modal-title"><%= t("personal_course.assign_date") %></h4>
|
||||
</div>
|
||||
<div class="modal-body"><%= t("personal_course.assign_date_hint") %></div>
|
||||
<div class="modal-footer"><button type="button" class="btn btn-default close" data-target="show_assign_date_modal">Close</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Status Module -->
|
||||
<div class="tab-pane fade" id="status">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- Form Actions -->
|
||||
<div class="form-actions">
|
||||
<%= f.hidden_field :user_id, :value => params[:user_id] if !params[:user_id].blank? %>
|
||||
<input type="hidden" name="referer_url" value="<%= request.referer %>">
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), request.referer, :class=>"btn" %>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var files = <%= files_hash.to_json.html_safe %>;
|
||||
$("a.add_file").on("click",function(){
|
||||
var type = $(this).attr("for"),
|
||||
html = files[type].html,
|
||||
count = parseInt(files[type].count),
|
||||
replaceReg = new RegExp("new_" + type + "s","g");
|
||||
html = html.replace(replaceReg,count);
|
||||
$(".add-target[for=" + type + "]").append(html);
|
||||
count++;
|
||||
files[type].count = count;
|
||||
return false;
|
||||
})
|
||||
$(document).on('click', '.delete_file', function(){
|
||||
$(this).parents('.input-prepend').remove();
|
||||
});
|
||||
|
||||
$(document).on('click', '.remove_existing_record', function(){
|
||||
if(confirm("<%= I18n.t(:sure?)%>")){
|
||||
$(this).children('.should_destroy').attr('value', 1);
|
||||
$(this).parents('.start-line').hide();
|
||||
}
|
||||
});
|
||||
$('.modal .close').click(function(){
|
||||
$("#"+$(this).attr("data-target")).modal('hide');
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,82 @@
|
|||
<h4><%=t("personal_course.assignment_management")%>-<%=@course.title rescue "" %></h4>
|
||||
<% student_assignment = (StudentAssignment rescue nil) %>
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span2"><%= t("personal_course.name") %></th>
|
||||
<th class="span2"><%= t("personal_course.detail") %></th>
|
||||
<th class="span2"><%= t("personal_course.course_attachment") %></th>
|
||||
<th class="span2">
|
||||
<%= t("personal_course.assign_date") %>
|
||||
<button tabindex="0" class="help_btn" data-target="#show_assign_date_modal" style="cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 1em;margin-left: 0.5em;background-color: #666666;border-color: #666666;color: white;" onclick="$('#show_assign_date_modal').modal('show')" type="button"><i aria-hidden="true" class="fa fa-info"></i></button>
|
||||
<div id="show_assign_date_modal" class="modal fade" style="color: #333;">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" aria-hidden="true" class="close" data-target="show_assign_date_modal">×</button>
|
||||
<h4 class="modal-title"><%= t("personal_course.assign_date") %></h4>
|
||||
</div>
|
||||
<div class="modal-body"><%= t("personal_course.assign_date_hint") %></div>
|
||||
<div class="modal-footer"><button type="button" class="btn btn-default close" data-target="show_assign_date_modal">Close</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
<th class="span2">
|
||||
<%= t("personal_course.deadline") %>
|
||||
<button tabindex="0" class="help_btn" data-target="#show_deadline_modal" style="cursor: pointer;padding: 0em 0.475em;font-size: 1.25em;border-radius: 1em;margin-left: 0.5em;background-color: #666666;border-color: #666666;color: white;" onclick="$('#show_deadline_modal').modal('show')" type="button"><i aria-hidden="true" class="fa fa-info"></i></button>
|
||||
<div id="show_deadline_modal" class="modal fade" style="color: #333;">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" aria-hidden="true" class="close" data-target="show_deadline_modal">×</button>
|
||||
<h4 class="modal-title"><%= t("personal_course.deadline") %></h4>
|
||||
</div>
|
||||
<div class="modal-body"><%= t("personal_course.deadline_hint") %></div>
|
||||
<div class="modal-footer"><button type="button" class="btn btn-default close" data-target="show_deadline_modal">Close</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
<% if !student_assignment.nil? %>
|
||||
<th class="span2"><%=t("personal_course.already_deliver")%></th>
|
||||
<% end %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_writing_journals" class="sort-holder">
|
||||
<% @course_assignments.each do |course_assignment| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= course_assignment.name %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('edit'), edit_assignment_admin_courses_path(:uid=>course_assignment.uid,:name=>course_assignment.name,:page => params[:page]) %></li>
|
||||
<li><%= link_to t(:delete_), destroy_assignment_admin_courses_path(id: course_assignment.id, :page => params[:page]), method: :delete, data: { confirm: t('personal_course.delete_assignment_message') } %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= course_assignment.detail %></td>
|
||||
<td><%= course_assignment.display_attachments %></td>
|
||||
<td><%= course_assignment.display_assign_date %></td>
|
||||
<td><%= course_assignment.display_deadline %></td>
|
||||
<% if !student_assignment.nil? %>
|
||||
<td><%= link_to course_assignment.deliver_count, show_assignments_admin_courses_path(:name=>course_assignment.name, :uid => course_assignment.uid ) %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_assignment_admin_courses_path(:id=>params[:id]), :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= content_tag :div, paginate(@course_assignments), class: "pagination pagination-centered" %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$('.modal .close').click(function(){
|
||||
$("#"+$(this).attr("data-target")).modal('hide');
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @course_assignment, url: update_assignment_admin_courses_path(:name=>@course_assignment.name,:uid=>@course_assignment.uid), html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form_assignment', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -2,7 +2,8 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th class="span1"><%= t('personal_course.year') %></th>
|
||||
<th class="span7"><%= t('module_name.courses') %></th>
|
||||
<th class="span7"><%= t('personal_course.title') %></th>
|
||||
<th class="span2"><%= t('personal_course.course_assignment') %></th>
|
||||
<th class="span1"><%= t("personal_plugins.author") %></th>
|
||||
<th class="span2"><%= t("personal_course.students") %></th>
|
||||
</tr>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @course_assignment, url: create_assignment_admin_courses_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form_assignment', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -0,0 +1,52 @@
|
|||
<h4><%=t("personal_selected_course.assignment_delivery_area")%>-<%=@course.title rescue "" %>-<%=@course_assignment.name rescue "" %></h4>
|
||||
<!-- <h4><%=t("personal_course.name")%>:<%=@course_assignment.name rescue "" %></h4> -->
|
||||
<fieldset>
|
||||
<legend style="color: green;"><%= t("personal_selected_course.already_deliver") %></legend>
|
||||
<table class="table main-list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="span2"><%= t("personal_course.students") %></th>
|
||||
<th class="span2"><%= t("personal_selected_course.assignment_content") %></th>
|
||||
<th class="span2"><%= t("personal_selected_course.student_assignment_file") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_writing_journals" class="sort-holder">
|
||||
<% @student_assignments.each do |student_assignment| %>
|
||||
<% member_profile = student_assignment.member_profile %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= member_profile.name %>
|
||||
<div class="quick-edit">
|
||||
<ul class="nav nav-pills hide">
|
||||
<li><%= link_to t('personal_selected_course.view'), edit_assignment_admin_selected_courses_path(:uid=>@course_assignment.uid,:name=>@course_assignment.name,:page => params[:page],:id=>student_assignment.id,:type=>"view",:member_profile_name=>member_profile.name, :member_profile_uid=>member_profile.uid) %></li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= student_assignment.assignment_content %></td>
|
||||
<td><%= student_assignment.display_student_assignment_files %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
<% if @student_assignments.to_a.count < 10 %>
|
||||
<fieldset>
|
||||
<legend style="color: red;"><%= t("personal_selected_course.not_yet_deliver") %></legend>
|
||||
<div style="font-size: 1.3em;">
|
||||
<%= MemberProfile.where(:id.in=>@not_yet_deliver_student_ids).map{|m| link_to( m.name,admin_member_path(m))}.join(",").html_safe %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%#= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t(:new_), new_assignment_admin_courses_path(:id=>params[:id]), :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= content_tag :div, paginate(@student_assignments), class: "pagination pagination-centered" %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$('.modal .close').click(function(){
|
||||
$("#"+$(this).attr("data-target")).modal('hide');
|
||||
})
|
||||
</script>
|
|
@ -30,6 +30,7 @@
|
|||
<% end -%>
|
||||
<th class="span2"><%= t('personal_course.year') %></th>
|
||||
<th class="span4"><%= t('personal_course.title') %></th>
|
||||
<th class="span4"><%= t('personal_course.course_assignment') %></th>
|
||||
<th class="span4"><%= t('personal_course.course_category') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -53,6 +54,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= link_to course.course_assignments.count,course_assignments_admin_courses_path(:id=> course.id) %></td>
|
||||
<td><%= course.course_category.title rescue "" %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -4,10 +4,21 @@ en:
|
|||
courses: Courses
|
||||
course: Course
|
||||
personal_course:
|
||||
already_deliver: Already deliver
|
||||
assignment_management: Assignments management
|
||||
assign_date_hint: Student can only see this assignment after assign date.
|
||||
deadline_hint: Student can not modify the his assignment content after deadline.
|
||||
assign_date: Assgin date
|
||||
deadline: Deadline
|
||||
name: Assignment title
|
||||
detail: Detail
|
||||
course_attachment: Attachment
|
||||
delete_assignment_message: Are you sure to delte this assignment?
|
||||
students: Students
|
||||
year: Year
|
||||
title: Course Title
|
||||
objective: Objective
|
||||
course_assignment: Assignments
|
||||
course_semester: Semester
|
||||
course_category: Category
|
||||
course_syllabus_file: Syllabus Files
|
||||
|
|
|
@ -4,10 +4,21 @@ zh_tw:
|
|||
courses: 教學資料
|
||||
course: 教學資料
|
||||
personal_course:
|
||||
already_deliver: 已繳交
|
||||
assignment_management: 作業管理
|
||||
assign_date_hint: 學生使用介面將在指派日期才會出現此筆作業。
|
||||
deadline_hint: 截止日期後學生將不能再針對此作業任何變動。
|
||||
assign_date: 指派日期
|
||||
deadline: 截止日期
|
||||
name: 作業名稱
|
||||
detail: 說明
|
||||
course_attachment: 附件
|
||||
delete_assignment_message: 你確定要刪除此則作業?
|
||||
students: 學生
|
||||
year: 年度
|
||||
title: 課程名稱
|
||||
objective: 課程目標
|
||||
course_assignment: 作業
|
||||
course_category: 課程類別
|
||||
course_semester: 學期
|
||||
course_syllabus_file: 教學大綱
|
||||
|
|
|
@ -9,6 +9,16 @@ Rails.application.routes.draw do
|
|||
get 'analysis'
|
||||
get 'analysis_report'
|
||||
get "download_excel"
|
||||
get 'course_assignments'
|
||||
post 'create_assignment'
|
||||
get 'new_assignment'
|
||||
delete 'destroy_assignment'
|
||||
scope '(:name-:uid)' do
|
||||
get 'edit_assignment'
|
||||
patch 'update_assignment'
|
||||
put 'update_assignment'
|
||||
get 'show_assignments'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue