Add student assignment.
This commit is contained in:
parent
e6cc3b6ac1
commit
ca5cfb6560
|
@ -2,6 +2,7 @@ class Admin::SelectedCoursesController < OrbitMemberController
|
|||
include Admin::SelectedCoursesHelper
|
||||
layout "member_plugin"
|
||||
before_action :set_course, only: [:show, :edit , :update, :destroy]
|
||||
before_action :set_course_assignment, only: [:new_assignment, :edit_assignment , :update_assignment]
|
||||
before_action :set_plugin
|
||||
before_action :get_settings,:only => [:new, :edit, :setting]
|
||||
|
||||
|
@ -11,7 +12,32 @@ class Admin::SelectedCoursesController < OrbitMemberController
|
|||
def index
|
||||
@selected_courses = SelectedCourse.order_by(:created_at=>'desc').page(params[:page]).per(10)
|
||||
end
|
||||
|
||||
def show_assignments
|
||||
@course_assignments = CourseAssignment.where(:course_id=>params[:id]).enabled_for_student.page(params[:page]).per(10)
|
||||
@course = Course.find(params[:id]) rescue nil
|
||||
@member_profile = MemberProfile.where(:uid=>params[:member_profile_uid]).first
|
||||
end
|
||||
def edit_assignment
|
||||
@student_assignment = StudentAssignment.find(params[:id])
|
||||
end
|
||||
def update_assignment
|
||||
@student_assignment = StudentAssignment.find(params[:id])
|
||||
@student_assignment.update_attributes(student_assignment_params)
|
||||
@student_assignment.save
|
||||
redirect_to params[:referer_url]
|
||||
end
|
||||
def new_assignment
|
||||
@student_assignment = StudentAssignment.new
|
||||
end
|
||||
def create_assignment
|
||||
#render :html => params and return
|
||||
student_assignment = StudentAssignment.create(student_assignment_params)
|
||||
redirect_to params[:referer_url]
|
||||
end
|
||||
def destroy_assignment
|
||||
@student_assignment.destroy
|
||||
redirect_to course_assignments_admin_courses_path(:page => params[:page])
|
||||
end
|
||||
def new
|
||||
@member = MemberProfile.find_by(:uid=>params['uid']) rescue nil
|
||||
@selected_course = SelectedCourse.new
|
||||
|
@ -93,13 +119,12 @@ class Admin::SelectedCoursesController < OrbitMemberController
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
def selected_course_params
|
||||
selected_course_params = params.require(:selected_course).permit!
|
||||
if selected_course_params["member_profile_id"].nil?
|
||||
selected_course_params["member_profile_id"] = nil
|
||||
def student_assignment_params
|
||||
student_assignment_params = params.require(:student_assignment).permit!
|
||||
return student_assignment_params
|
||||
end
|
||||
return selected_course_params
|
||||
def selected_course_params
|
||||
params.require(:selected_course).permit!
|
||||
end
|
||||
|
||||
def intro_params
|
||||
|
@ -117,6 +142,7 @@ class Admin::SelectedCoursesController < OrbitMemberController
|
|||
|
||||
def set_course
|
||||
path = request.path.split('/')
|
||||
if params[:uid].nil?
|
||||
if path.last.include? '-'
|
||||
uid = path[-1].split("-").last
|
||||
uid = uid.split("?").first
|
||||
|
@ -124,6 +150,26 @@ class Admin::SelectedCoursesController < OrbitMemberController
|
|||
uid = path[-2].split("-").last
|
||||
uid = uid.split("?").first
|
||||
end
|
||||
else
|
||||
uid = params[:uid]
|
||||
end
|
||||
@selected_course = SelectedCourse.find_by(:uid => uid) rescue SelectedCourse.find(params[:id])
|
||||
end
|
||||
def set_course_assignment
|
||||
path = request.path.split('/')
|
||||
if params[:uid].nil?
|
||||
if path.last.include? '-'
|
||||
uid = path[-1].split("-").last
|
||||
uid = uid.split("?").first
|
||||
else
|
||||
uid = path[-2].split("-").last
|
||||
uid = uid.split("?").first
|
||||
end
|
||||
else
|
||||
uid = params[:uid]
|
||||
end
|
||||
@course_assignment = CourseAssignment.find_by(:uid => uid) rescue CourseAssignment.find(params[:id])
|
||||
@closed = (@course_assignment.deadline < DateTime.now) rescue false
|
||||
@member_profile = MemberProfile.where(:uid=>params[:member_profile_uid]).first
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
class StudentAssignment
|
||||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
include Slug
|
||||
field :assignment_content, as: :slug_title, type: String, localize: true, default: ""
|
||||
has_many :student_assignment_files, :dependent => :destroy, :autosave => true
|
||||
accepts_nested_attributes_for :student_assignment_files, :allow_destroy => true
|
||||
belongs_to :course_assignment
|
||||
belongs_to :member_profile
|
||||
def display_created_at
|
||||
self.created_at.strftime("%Y-%m-%d %H:%M")
|
||||
end
|
||||
def display_updated_at
|
||||
self.updated_at.strftime("%Y-%m-%d %H:%M")
|
||||
end
|
||||
def display_student_assignment_files
|
||||
self.student_assignment_files.map{|f| "<a href=\"#{f.file.url}\" title=\"#{f.title}\">#{f.title}</a>"}.join("<br>").html_safe
|
||||
end
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
class StudentAssignmentFile
|
||||
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 :student_assignment
|
||||
end
|
|
@ -0,0 +1,236 @@
|
|||
<% # 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 %>
|
||||
<% if @student_assignment.new_record? %>
|
||||
<%= f.hidden_field :course_assignment_id,:value=>@course_assignment.id.to_s %>
|
||||
<% end %>
|
||||
<fieldset>
|
||||
<legend><%= @course_assignment.course.title rescue "" %>-<%= @course_assignment.name rescue "" %></legend>
|
||||
<!-- Name -->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_course.name") %></label>
|
||||
<div class="controls">
|
||||
<%= @course_assignment.name %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Detail -->
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_course.detail") %></label>
|
||||
<div class="controls">
|
||||
<%= @course_assignment.detail %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Attachment -->
|
||||
<% ["course_attachment"].each do |file| %>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_course.#{file}") %></label>
|
||||
<div class="controls">
|
||||
<%= @course_assignment.send("display_"+file.pluralize.gsub('course_','')) rescue "" %>
|
||||
</div>
|
||||
</div>
|
||||
<% 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">
|
||||
<%= @course_assignment.display_assign_date %>
|
||||
</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">
|
||||
<%= @course_assignment.display_deadline %>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<!-- 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 %>
|
||||
<% if !@closed %>
|
||||
<li class="pull-right">
|
||||
<%= copy_to_all_language_button(".language-nav", ".language-area") %>
|
||||
</li>
|
||||
<% end %>
|
||||
</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" : '' %>">
|
||||
|
||||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_selected_course.assignment_content") %></label>
|
||||
<div class="controls">
|
||||
<% if !@closed %>
|
||||
<%= f.fields_for :assignment_content_translations do |f| %>
|
||||
<%= f.text_area locale, class: "input-block-level ckeditor", placeholder: t("personal_selected_course.assignment_content"), value: (@student_assignment.assignment_content_translations[locale] rescue nil) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= @student_assignment.assignment_content_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? %>
|
||||
<%= hidden_field_tag :id, params[:id] %>
|
||||
<% end %>
|
||||
<% if @member_profile.present? %>
|
||||
<%= f.hidden_field :member_profile_id, :value=>@member_profile.id %>
|
||||
<% end %>
|
||||
<!-- Attachment -->
|
||||
<%
|
||||
files_hash = {}
|
||||
["student_assignment_file"].each do |file|
|
||||
hash = {}
|
||||
hash["html"] = add_attribute("form_file", f, file.pluralize.to_sym)
|
||||
hash["count"] = @student_assignment.send(file.pluralize).count rescue 0
|
||||
files_hash[file] = hash
|
||||
%>
|
||||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t("personal_selected_course.#{file}") %></label>
|
||||
<div class="controls">
|
||||
<% if !@closed %>
|
||||
<!-- Exist -->
|
||||
<% if !@student_assignment.new_record? && hash["count"] > 0 %>
|
||||
<div class="exist">
|
||||
<% @student_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>
|
||||
<% else %>
|
||||
<%= @student_assignment.send("display_"+file.pluralize) rescue "" %>
|
||||
<% end %>
|
||||
</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 %>">
|
||||
<% if !@closed %>
|
||||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), request.referer, :class=>"btn" %>
|
||||
<% else %>
|
||||
<%= link_to t('personal_selected_course.back'), request.referer, :class=>"btn" %>
|
||||
<% end %>
|
||||
</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>
|
|
@ -2,6 +2,7 @@
|
|||
<% host_url = protocol+(request.host_with_port) %>
|
||||
<% @selected_courses.each do |selected_course| %>
|
||||
<tr id="<%= dom_id selected_course %>" class="with_action">
|
||||
<% member_profile = selected_course.member_profile %>
|
||||
<td class="span1"><%= selected_course.year %></td>
|
||||
<td class="span1">
|
||||
<%= link_to selected_course.course_title, page_for_selected_course(selected_course), target: "blank"%>
|
||||
|
@ -11,6 +12,13 @@
|
|||
<li><%= link_to t(:delete_), admin_selected_course_path(id: selected_course.id, :page => params[:page]), method: :delete, data: { confirm: 'Are you sure?' } %></li>
|
||||
</ul>
|
||||
</div>
|
||||
<td>
|
||||
<% if member_profile.present? %>
|
||||
<%= link_to CourseAssignment.where(:course_id=>selected_course.course_id).enabled_for_student.count,show_assignments_admin_selected_courses_path(:id=> selected_course.course_id,:member_profile_name=> member_profile.name,:member_profile_uid=> member_profile.uid) %>
|
||||
<% else %>
|
||||
0
|
||||
<% end %>
|
||||
</td>
|
||||
</td>
|
||||
<td class="span1"><% course_url = selected_course.course_url %>
|
||||
<% if selected_course.course %>
|
||||
|
@ -22,6 +30,6 @@
|
|||
<a title="<%=selected_course.course_title%>" href="<%=selected_course.other_course_url%>"><%=selected_course.other_course_url%></a>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= selected_course.member_profile.name rescue "" %></td>
|
||||
<td><%= member_profile.name rescue "" %></td>
|
||||
</tr>
|
||||
<% end %>
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @student_assignment, url: update_assignment_admin_selected_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_selected_course.year') %></th>
|
||||
<th class="span7"><%= t('module_name.selected_courses') %></th>
|
||||
<th class="span7"><%= t('personal_selected_course.name') %></th>
|
||||
<th class="span4"><%= t('personal_selected_course.course_assignment') %></th>
|
||||
<th class="span7"><%= t("personal_selected_course.course_url") %></th>
|
||||
<th class="span1"><%= t("personal_selected_course.course_student") %></th>
|
||||
</tr>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<%= form_for @student_assignment, url: create_assignment_admin_selected_courses_path, html: {class: "form-horizontal main-forms previewable"} do |f| %>
|
||||
<fieldset>
|
||||
<%= render partial: 'form_assignment', locals: {f: f} %>
|
||||
</fieldset>
|
||||
<% end %>
|
|
@ -0,0 +1,93 @@
|
|||
<h4><%=t("personal_selected_course.assignment_delivery_area")%>-<%=@course.title rescue "" %></h4>
|
||||
<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>
|
||||
<th class="span2"><%= t("personal_selected_course.status") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tbody_writing_journals" class="sort-holder">
|
||||
<% @course_assignments.each do |course_assignment| %>
|
||||
<% student_assignment = StudentAssignment.where(:course_assignment_id=> course_assignment.id,:member_profile_id=>@member_profile.id).first %>
|
||||
<% closed = (course_assignment.deadline < DateTime.now) rescue false %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= course_assignment.name %>
|
||||
<div class="quick-edit">
|
||||
<% if !closed %>
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if student_assignment.nil? %>
|
||||
<li><%= link_to t('new_'), new_assignment_admin_selected_courses_path(:uid=>course_assignment.uid,:name=>course_assignment.name,:page => params[:page]) %></li>
|
||||
<% else %>
|
||||
<li><%= link_to t('edit'), edit_assignment_admin_selected_courses_path(:uid=>course_assignment.uid,:name=>course_assignment.name,:page => params[:page],:id=>student_assignment.id) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% else %>
|
||||
<span style="color: red;"><%=t('personal_selected_course.closed')%></span>
|
||||
<ul class="nav nav-pills hide">
|
||||
<% if student_assignment.nil? %>
|
||||
<li><%= link_to t('personal_selected_course.view'), new_assignment_admin_selected_courses_path(:uid=>course_assignment.uid,:name=>course_assignment.name,:page => params[:page]) %></li>
|
||||
<% else %>
|
||||
<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) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</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>
|
||||
<td><%= student_assignment.nil? ? "<span style=\"color: red;\">#{t("personal_selected_course.not_yet_deliver")}</span>".html_safe : ("<span style=\"color: green;\">#{t("personal_selected_course.already_deliver")}</span>"+"<br><span style=\"color: #aba8a8\">#{t('personal_selected_course.last_updated_date')}:#{student_assignment.display_updated_at}</span>").html_safe %></td>
|
||||
</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>
|
|
@ -30,6 +30,7 @@
|
|||
<% end -%>
|
||||
<th class="span2"><%= t('personal_selected_course.year') %></th>
|
||||
<th class="span4"><%= t('personal_selected_course.course_title') %></th>
|
||||
<th class="span4"><%= t('personal_selected_course.course_assignment') %></th>
|
||||
<th class="span4"><%= t('personal_selected_course.selected_course_category') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -53,6 +54,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
<td><%= link_to CourseAssignment.where(:course_id=>selected_course.course_id).enabled_for_student.count,show_assignments_admin_selected_courses_path(:id=> selected_course.course_id,:member_profile_name=> params[:name],:member_profile_uid=> params[:uid]) %></td>
|
||||
<td><%= selected_course.course.course_category.title rescue "" %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
|
|
@ -4,6 +4,18 @@ en:
|
|||
selected_courses: Selected Courses
|
||||
selected_course: Selected Course
|
||||
personal_selected_course:
|
||||
name: Selected Courses Name
|
||||
view: View
|
||||
status: Status
|
||||
closed: Closed
|
||||
back: Back
|
||||
already_deliver: Already deliver
|
||||
not_yet_deliver: Not yet deliver
|
||||
last_updated_date: Last updated date
|
||||
assignment_delivery_area: Assignment delivery area
|
||||
course_assignment: Assignments
|
||||
assignment_content: Assignment Content
|
||||
student_assignment_file: Assignment file
|
||||
course_student: Student
|
||||
students: Students
|
||||
year: Year
|
||||
|
|
|
@ -4,6 +4,18 @@ zh_tw:
|
|||
selected_courses: 修習課程
|
||||
selected_course: 修習課程
|
||||
personal_selected_course:
|
||||
name: 修習課程名稱
|
||||
view: 查看
|
||||
status: 狀態
|
||||
closed: 已關閉
|
||||
back: 回上一頁
|
||||
already_deliver: 已繳交
|
||||
not_yet_deliver: 未繳交
|
||||
last_updated_date: 最後更改時間
|
||||
assignment_delivery_area: 作業繳交區
|
||||
course_assignment: 作業
|
||||
assignment_content: 繳交內容
|
||||
student_assignment_file: 繳交檔案
|
||||
course_student: 修課學生
|
||||
students: 學生
|
||||
year: 年度
|
||||
|
|
|
@ -9,6 +9,19 @@ Rails.application.routes.draw do
|
|||
get 'analysis'
|
||||
get 'analysis_report'
|
||||
get "download_excel"
|
||||
scope ':member_profile_name-:member_profile_uid' do
|
||||
get 'show_assignments'
|
||||
end
|
||||
#delete 'destroy_assignment'
|
||||
post 'create_assignment'
|
||||
scope '(:name-:uid)' do
|
||||
scope ':member_profile_name-:member_profile_uid' do
|
||||
get 'new_assignment'
|
||||
get 'edit_assignment'
|
||||
patch 'update_assignment'
|
||||
put 'update_assignment'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<table class="table table-hover table-striped courses-index">
|
||||
<caption><h3>{{widget-title}}</h3></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-md-1">{{th_year}}</th>
|
||||
<th class="col-md-3">{{th_course_title}}</th>
|
||||
<th class="col-md-2">{{th_course_category}}</th>
|
||||
<th class="col-md-2">{{th_course_semester}}</th>
|
||||
<th class="col-md-2">{{th_authors}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-level="0" data-list="courses">
|
||||
<tr>
|
||||
<td>{{year}}</td>
|
||||
<td><a href="{{link_to_show}}">{{course_title}}</a></td>
|
||||
<td>{{category}}</td>
|
||||
<td>{{semester}}</td>
|
||||
<td>{{authors}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{{pagination_goes_here}}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"frontend": [
|
||||
{
|
||||
"filename" : "index",
|
||||
"name" : {
|
||||
"zh_tw" : "1. 列表",
|
||||
"en" : "1. List"
|
||||
},
|
||||
"thumbnail" : "thumb.png"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<table class="table table-striped plugin-show-table">
|
||||
<tbody data-list="plugin_datas" data-level="0">
|
||||
<tr><th class="{{title_class}}">{{title}}</th><td class="{{value_class}}">{{value}}</td></tr>
|
||||
</tbody>
|
||||
</table>
|
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
Loading…
Reference in New Issue