sort fixed and also name and url changed
This commit is contained in:
parent
59e2fef80a
commit
3171868237
|
@ -1,6 +1,5 @@
|
||||||
require 'zip/zip'
|
require 'zip/zip'
|
||||||
class Admin::HpsLearningsController < OrbitAdminController
|
class Admin::OnlineCoursesController < OrbitAdminController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@table_fields = ["hps_learning.course_pic", "hps_learning.title", :category, "hps_learning.runtime"]
|
@table_fields = ["hps_learning.course_pic", "hps_learning.title", :category, "hps_learning.runtime"]
|
||||||
@classes = HpsClass.all.desc(:created_at).page(params[:page]).per(10)
|
@classes = HpsClass.all.desc(:created_at).page(params[:page]).per(10)
|
||||||
|
@ -22,19 +21,19 @@ class Admin::HpsLearningsController < OrbitAdminController
|
||||||
def create
|
def create
|
||||||
hpsclass = HpsClass.new(hps_class_params)
|
hpsclass = HpsClass.new(hps_class_params)
|
||||||
hpsclass.save
|
hpsclass.save
|
||||||
redirect_to admin_hps_learnings_path
|
redirect_to admin_online_courses_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
hpsclass = HpsClass.find(params[:id])
|
hpsclass = HpsClass.find(params[:id])
|
||||||
hpsclass.update_attributes(hps_class_params)
|
hpsclass.update_attributes(hps_class_params)
|
||||||
redirect_to admin_hps_learnings_path
|
redirect_to admin_online_courses_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
hpsclass = HpsClass.find(params[:id])
|
hpsclass = HpsClass.find(params[:id])
|
||||||
hpsclass.destroy
|
hpsclass.destroy
|
||||||
redirect_to admin_hps_learnings_path
|
redirect_to admin_online_courses_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_lecture
|
def add_lecture
|
||||||
|
@ -49,7 +48,7 @@ class Admin::HpsLearningsController < OrbitAdminController
|
||||||
hpslecture = HpsLecture.find(params[:id])
|
hpslecture = HpsLecture.find(params[:id])
|
||||||
clas = hpslecture.hps_class_id
|
clas = hpslecture.hps_class_id
|
||||||
hpslecture.destroy
|
hpslecture.destroy
|
||||||
redirect_to admin_hps_learning_path(clas)
|
redirect_to admin_online_course_path(clas)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_lecture
|
def create_lecture
|
||||||
|
@ -59,7 +58,7 @@ class Admin::HpsLearningsController < OrbitAdminController
|
||||||
hpsfile = HpsLectureFile.find(params[:presentation_temp_id]) rescue nil
|
hpsfile = HpsLectureFile.find(params[:presentation_temp_id]) rescue nil
|
||||||
hpslecture.hps_lecture_file = hpsfile if !hpsfile.nil?
|
hpslecture.hps_lecture_file = hpsfile if !hpsfile.nil?
|
||||||
hpslecture.save
|
hpslecture.save
|
||||||
redirect_to admin_hps_learning_path(hpsclass.id)
|
redirect_to admin_online_course_path(hpsclass.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_lecture
|
def update_lecture
|
||||||
|
@ -68,7 +67,7 @@ class Admin::HpsLearningsController < OrbitAdminController
|
||||||
hpsfile = HpsLectureFile.find(params[:presentation_temp_id]) rescue nil
|
hpsfile = HpsLectureFile.find(params[:presentation_temp_id]) rescue nil
|
||||||
hpslecture.hps_lecture_file = hpsfile if !hpsfile.nil?
|
hpslecture.hps_lecture_file = hpsfile if !hpsfile.nil?
|
||||||
hpslecture.save
|
hpslecture.save
|
||||||
redirect_to admin_hps_learning_path(hpslecture.hps_class_id)
|
redirect_to admin_online_course_path(hpslecture.hps_class_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def upload_temp_file
|
def upload_temp_file
|
||||||
|
@ -132,5 +131,4 @@ class Admin::HpsLearningsController < OrbitAdminController
|
||||||
def hps_lecture_params
|
def hps_lecture_params
|
||||||
params.require(:hps_lecture).permit!
|
params.require(:hps_lecture).permit!
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -54,7 +54,7 @@ class HpsLearningsController < ApplicationController
|
||||||
|
|
||||||
def widget
|
def widget
|
||||||
tags = OrbitHelper.widget_tags
|
tags = OrbitHelper.widget_tags
|
||||||
classes = HpsClass.filter_by_widget_categories.filter_by_tags(tags).collect do |hpsclass|
|
classes = HpsClass.filter_by_widget_categories.filter_by_tags(tags).desc(:created_at).collect do |hpsclass|
|
||||||
thumb = hpsclass.course_pic.thumb.url.nil? ? "http://www.placehold.it/150x150/EFEFEF/AAAAAA" : hpsclass.course_pic.thumb.url
|
thumb = hpsclass.course_pic.thumb.url.nil? ? "http://www.placehold.it/150x150/EFEFEF/AAAAAA" : hpsclass.course_pic.thumb.url
|
||||||
{
|
{
|
||||||
"title" => hpsclass.title,
|
"title" => hpsclass.title,
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
$("#presentation-file").fileupload({
|
$("#presentation-file").fileupload({
|
||||||
autoUpload : false,
|
autoUpload : false,
|
||||||
url : "/admin/hps_learnings/upload_temp_file",
|
url : "/admin/online_courses/upload_temp_file",
|
||||||
maxChunkSize : 8 * 1024 * 1024,
|
maxChunkSize : 8 * 1024 * 1024,
|
||||||
acceptFileTypes: /(\.|\/)(zip)$/i,
|
acceptFileTypes: /(\.|\/)(zip)$/i,
|
||||||
add : function(e, data){
|
add : function(e, data){
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
var uploadData = data;
|
var uploadData = data;
|
||||||
uploadBtn.one("click",function(){
|
uploadBtn.one("click",function(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "/admin/hps_learnings/get_temp_dir_name",
|
url : "/admin/online_courses/get_temp_dir_name",
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
type : "get",
|
type : "get",
|
||||||
data : {"filename" : uploadData.files[0].name}
|
data : {"filename" : uploadData.files[0].name}
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
abortUploadBtn.addClass("hide");
|
abortUploadBtn.addClass("hide");
|
||||||
uploadBtn.removeClass("hide");
|
uploadBtn.removeClass("hide");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "/admin/hps_learnings/clear_temp_dir",
|
url : "/admin/online_courses/clear_temp_dir",
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
type : "post",
|
type : "post",
|
||||||
data : {presentation_id : presentation_path}
|
data : {presentation_id : presentation_path}
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
|
|
||||||
var extract_zip = function(id, path, filename){
|
var extract_zip = function(id, path, filename){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url : "/admin/hps_learnings/extract_zip",
|
url : "/admin/online_courses/extract_zip",
|
||||||
dataType : "json",
|
dataType : "json",
|
||||||
type : "post",
|
type : "post",
|
||||||
data : {"presentation_id" : id, "path" : path}
|
data : {"presentation_id" : id, "path" : path}
|
|
@ -15,13 +15,13 @@
|
||||||
<td><img src="http://www.placehold.it/150x150/EFEFEF/AAAAAA" width="150px"></td>
|
<td><img src="http://www.placehold.it/150x150/EFEFEF/AAAAAA" width="150px"></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td>
|
<td>
|
||||||
<a href="<%= admin_hps_learning_path(clas.id, :page => params[:page]) %>"> <%= clas.title %> </a>
|
<a href="<%= admin_online_course_path(clas.id, :page => params[:page]) %>"> <%= clas.title %> </a>
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<% if can_edit_or_delete?(clas) %>
|
<% if can_edit_or_delete?(clas) %>
|
||||||
<li><a href="<%= admin_hps_learning_path(clas.id, :page => params[:page]) %>"><%= t("hps_learning.lectures") %></a></li>
|
<li><a href="<%= admin_online_course_path(clas.id, :page => params[:page]) %>"><%= t("hps_learning.lectures") %></a></li>
|
||||||
<li><a href="<%= edit_admin_hps_learning_path(clas.id, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
<li><a href="<%= edit_admin_online_course_path(clas.id, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
||||||
<li><a href="<%= admin_hps_learning_path(clas.id,:page => params[:page]) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
<li><a href="<%= admin_online_course_path(clas.id,:page => params[:page]) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
|
@ -19,8 +19,8 @@
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills">
|
<ul class="nav nav-pills">
|
||||||
<% if can_edit_or_delete?(@hpsclass) %>
|
<% if can_edit_or_delete?(@hpsclass) %>
|
||||||
<li><a href="<%= edit_lecture_admin_hps_learning_path(lecture.id, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
<li><a href="<%= edit_lecture_admin_online_course_path(lecture.id, :page => params[:page]) %>"><%= t(:edit) %></a></li>
|
||||||
<li><a href="<%= delete_lecture_admin_hps_learning_path(lecture.id,:page => params[:page]) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
<li><a href="<%= delete_lecture_admin_online_course_path(lecture.id,:page => params[:page]) %>" class="delete text-error" data-method="delete" data-confirm="Are you sure?"><%= t(:delete_) %></a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,8 +45,8 @@
|
||||||
<%=
|
<%=
|
||||||
content_tag :div, class: "bottomnav clearfix" do
|
content_tag :div, class: "bottomnav clearfix" do
|
||||||
content_tag :div, class: "pull-right" do
|
content_tag :div, class: "pull-right" do
|
||||||
link_to(t("hps_learning.add_lecture"), add_lecture_admin_hps_learning_path(@hpsclass.id), :class => "btn btn-primary") + " " +
|
link_to(t("hps_learning.add_lecture"), add_lecture_admin_online_course_path(@hpsclass.id), :class => "btn btn-primary") + " " +
|
||||||
link_to(t("back"), admin_hps_learnings_path, :class => "btn")
|
link_to(t("back"), admin_online_courses_path, :class => "btn")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
%>
|
%>
|
|
@ -1,6 +1,8 @@
|
||||||
en:
|
en:
|
||||||
|
module_name:
|
||||||
|
hps_learning: Online Courses
|
||||||
hps_learning:
|
hps_learning:
|
||||||
hps_learning: E Learning
|
hps_learning: Online Courses
|
||||||
classes: Classes
|
classes: Classes
|
||||||
new_class: Create New Class
|
new_class: Create New Class
|
||||||
course_pic: Course Picture
|
course_pic: Course Picture
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
zh_tw:
|
zh_tw:
|
||||||
|
module_name:
|
||||||
|
hps_learning: 開課系統
|
||||||
hps_learning:
|
hps_learning:
|
||||||
hps_laerning: E Learning
|
hps_learning: 開課系統
|
||||||
classes: Classes
|
classes: Classes
|
||||||
new_class: Create New Class
|
new_class: Create New Class
|
||||||
course_pic: Course Pic
|
course_pic: Course Pic
|
||||||
|
|
|
@ -4,7 +4,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
scope "(:locale)", locale: Regexp.new(locales.join("|")) do
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
resources :hps_learnings do
|
resources :online_courses do
|
||||||
collection do
|
collection do
|
||||||
get "get_temp_dir_name"
|
get "get_temp_dir_name"
|
||||||
post "upload_temp_file"
|
post "upload_temp_file"
|
||||||
|
|
|
@ -15,31 +15,31 @@ module HpsLearning
|
||||||
side_bar do
|
side_bar do
|
||||||
head_label_i18n 'hps_learning.hps_learning', icon_class: "icons-screen"
|
head_label_i18n 'hps_learning.hps_learning', icon_class: "icons-screen"
|
||||||
available_for "users"
|
available_for "users"
|
||||||
active_for_controllers (['admin/hps_learnings'])
|
active_for_controllers (['admin/online_courses'])
|
||||||
head_link_path "admin_hps_learnings_path"
|
head_link_path "admin_online_courses_path"
|
||||||
|
|
||||||
context_link 'hps_learning.classes',
|
context_link 'hps_learning.classes',
|
||||||
:link_path=>"admin_hps_learnings_path" ,
|
:link_path=>"admin_online_courses_path" ,
|
||||||
:priority=>1,
|
:priority=>1,
|
||||||
:active_for_action=>{'admin/hps_learnings'=>'index'},
|
:active_for_action=>{'admin/online_courses'=>'index'},
|
||||||
:available_for => 'users'
|
:available_for => 'users'
|
||||||
context_link 'hps_learning.new_class',
|
context_link 'hps_learning.new_class',
|
||||||
:link_path=>"new_admin_hps_learning_path" ,
|
:link_path=>"new_admin_online_course_path" ,
|
||||||
:priority=>2,
|
:priority=>2,
|
||||||
:active_for_action=>{'admin/hps_learnings'=>'new'},
|
:active_for_action=>{'admin/online_courses'=>'new'},
|
||||||
:available_for => 'sub_managers'
|
:available_for => 'sub_managers'
|
||||||
context_link 'categories',
|
context_link 'categories',
|
||||||
:link_path=>"admin_module_app_categories_path" ,
|
:link_path=>"admin_module_app_categories_path" ,
|
||||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'hps_learning').id}",
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'hps_learning').id}",
|
||||||
:priority=>3,
|
:priority=>3,
|
||||||
:active_for_action=>{'admin/hps_learnings'=>'categories'},
|
:active_for_action=>{'admin/online_courses'=>'categories'},
|
||||||
:active_for_category => 'HpsLearning',
|
:active_for_category => 'HpsLearning',
|
||||||
:available_for => 'managers'
|
:available_for => 'managers'
|
||||||
context_link 'tags',
|
context_link 'tags',
|
||||||
:link_path=>"admin_module_app_tags_path" ,
|
:link_path=>"admin_module_app_tags_path" ,
|
||||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'hps_learning').id}",
|
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'hps_learning').id}",
|
||||||
:priority=>4,
|
:priority=>4,
|
||||||
:active_for_action=>{'admin/hps_learnings'=>'tags'},
|
:active_for_action=>{'admin/online_courses'=>'tags'},
|
||||||
:active_for_tag => 'HpsLearning',
|
:active_for_tag => 'HpsLearning',
|
||||||
:available_for => 'managers'
|
:available_for => 'managers'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue