diff --git a/app/controllers/admin/hps_learnings_controller.rb b/app/controllers/admin/online_courses_controller.rb similarity index 90% rename from app/controllers/admin/hps_learnings_controller.rb rename to app/controllers/admin/online_courses_controller.rb index 223dc7d..b12bef3 100644 --- a/app/controllers/admin/hps_learnings_controller.rb +++ b/app/controllers/admin/online_courses_controller.rb @@ -1,6 +1,5 @@ require 'zip/zip' -class Admin::HpsLearningsController < OrbitAdminController - +class Admin::OnlineCoursesController < OrbitAdminController def index @table_fields = ["hps_learning.course_pic", "hps_learning.title", :category, "hps_learning.runtime"] @classes = HpsClass.all.desc(:created_at).page(params[:page]).per(10) @@ -22,19 +21,19 @@ class Admin::HpsLearningsController < OrbitAdminController def create hpsclass = HpsClass.new(hps_class_params) hpsclass.save - redirect_to admin_hps_learnings_path + redirect_to admin_online_courses_path end def update hpsclass = HpsClass.find(params[:id]) hpsclass.update_attributes(hps_class_params) - redirect_to admin_hps_learnings_path + redirect_to admin_online_courses_path end def destroy hpsclass = HpsClass.find(params[:id]) hpsclass.destroy - redirect_to admin_hps_learnings_path + redirect_to admin_online_courses_path end def add_lecture @@ -49,7 +48,7 @@ class Admin::HpsLearningsController < OrbitAdminController hpslecture = HpsLecture.find(params[:id]) clas = hpslecture.hps_class_id hpslecture.destroy - redirect_to admin_hps_learning_path(clas) + redirect_to admin_online_course_path(clas) end def create_lecture @@ -59,7 +58,7 @@ class Admin::HpsLearningsController < OrbitAdminController hpsfile = HpsLectureFile.find(params[:presentation_temp_id]) rescue nil hpslecture.hps_lecture_file = hpsfile if !hpsfile.nil? hpslecture.save - redirect_to admin_hps_learning_path(hpsclass.id) + redirect_to admin_online_course_path(hpsclass.id) end def update_lecture @@ -68,7 +67,7 @@ class Admin::HpsLearningsController < OrbitAdminController hpsfile = HpsLectureFile.find(params[:presentation_temp_id]) rescue nil hpslecture.hps_lecture_file = hpsfile if !hpsfile.nil? hpslecture.save - redirect_to admin_hps_learning_path(hpslecture.hps_class_id) + redirect_to admin_online_course_path(hpslecture.hps_class_id) end def upload_temp_file @@ -132,5 +131,4 @@ class Admin::HpsLearningsController < OrbitAdminController def hps_lecture_params params.require(:hps_lecture).permit! end - end \ No newline at end of file diff --git a/app/controllers/hps_learnings_controller.rb b/app/controllers/hps_learnings_controller.rb index 63cf396..2779120 100644 --- a/app/controllers/hps_learnings_controller.rb +++ b/app/controllers/hps_learnings_controller.rb @@ -54,7 +54,7 @@ class HpsLearningsController < ApplicationController def widget 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 { "title" => hpsclass.title, diff --git a/app/views/admin/hps_learnings/_file_uploader.html.erb b/app/views/admin/online_courses/_file_uploader.html.erb similarity index 96% rename from app/views/admin/hps_learnings/_file_uploader.html.erb rename to app/views/admin/online_courses/_file_uploader.html.erb index 3792c8b..4ae2596 100644 --- a/app/views/admin/hps_learnings/_file_uploader.html.erb +++ b/app/views/admin/online_courses/_file_uploader.html.erb @@ -70,7 +70,7 @@ $("#presentation-file").fileupload({ autoUpload : false, - url : "/admin/hps_learnings/upload_temp_file", + url : "/admin/online_courses/upload_temp_file", maxChunkSize : 8 * 1024 * 1024, acceptFileTypes: /(\.|\/)(zip)$/i, add : function(e, data){ @@ -79,7 +79,7 @@ var uploadData = data; uploadBtn.one("click",function(){ $.ajax({ - url : "/admin/hps_learnings/get_temp_dir_name", + url : "/admin/online_courses/get_temp_dir_name", dataType : "json", type : "get", data : {"filename" : uploadData.files[0].name} @@ -95,7 +95,7 @@ abortUploadBtn.addClass("hide"); uploadBtn.removeClass("hide"); $.ajax({ - url : "/admin/hps_learnings/clear_temp_dir", + url : "/admin/online_courses/clear_temp_dir", dataType : "json", type : "post", data : {presentation_id : presentation_path} @@ -140,7 +140,7 @@ var extract_zip = function(id, path, filename){ $.ajax({ - url : "/admin/hps_learnings/extract_zip", + url : "/admin/online_courses/extract_zip", dataType : "json", type : "post", data : {"presentation_id" : id, "path" : path} diff --git a/app/views/admin/hps_learnings/_form.html.erb b/app/views/admin/online_courses/_form.html.erb similarity index 100% rename from app/views/admin/hps_learnings/_form.html.erb rename to app/views/admin/online_courses/_form.html.erb diff --git a/app/views/admin/hps_learnings/_lecture_form.html.erb b/app/views/admin/online_courses/_lecture_form.html.erb similarity index 100% rename from app/views/admin/hps_learnings/_lecture_form.html.erb rename to app/views/admin/online_courses/_lecture_form.html.erb diff --git a/app/views/admin/hps_learnings/add_lecture.html.erb b/app/views/admin/online_courses/add_lecture.html.erb similarity index 100% rename from app/views/admin/hps_learnings/add_lecture.html.erb rename to app/views/admin/online_courses/add_lecture.html.erb diff --git a/app/views/admin/hps_learnings/edit.html.erb b/app/views/admin/online_courses/edit.html.erb similarity index 100% rename from app/views/admin/hps_learnings/edit.html.erb rename to app/views/admin/online_courses/edit.html.erb diff --git a/app/views/admin/hps_learnings/edit_lecture.html.erb b/app/views/admin/online_courses/edit_lecture.html.erb similarity index 100% rename from app/views/admin/hps_learnings/edit_lecture.html.erb rename to app/views/admin/online_courses/edit_lecture.html.erb diff --git a/app/views/admin/hps_learnings/index.html.erb b/app/views/admin/online_courses/index.html.erb similarity index 63% rename from app/views/admin/hps_learnings/index.html.erb rename to app/views/admin/online_courses/index.html.erb index 1a0477b..58cc54e 100644 --- a/app/views/admin/hps_learnings/index.html.erb +++ b/app/views/admin/online_courses/index.html.erb @@ -15,13 +15,13 @@