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 @@ <% end %> - <%= clas.title %> + <%= clas.title %>
diff --git a/app/views/admin/hps_learnings/new.html.erb b/app/views/admin/online_courses/new.html.erb similarity index 100% rename from app/views/admin/hps_learnings/new.html.erb rename to app/views/admin/online_courses/new.html.erb diff --git a/app/views/admin/hps_learnings/show.html.erb b/app/views/admin/online_courses/show.html.erb similarity index 74% rename from app/views/admin/hps_learnings/show.html.erb rename to app/views/admin/online_courses/show.html.erb index d61b74f..ba990f6 100644 --- a/app/views/admin/hps_learnings/show.html.erb +++ b/app/views/admin/online_courses/show.html.erb @@ -19,8 +19,8 @@
@@ -45,8 +45,8 @@ <%= content_tag :div, class: "bottomnav clearfix" 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("back"), admin_hps_learnings_path, :class => "btn") + link_to(t("hps_learning.add_lecture"), add_lecture_admin_online_course_path(@hpsclass.id), :class => "btn btn-primary") + " " + + link_to(t("back"), admin_online_courses_path, :class => "btn") end end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 1d54a3d..d290ab2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,6 +1,8 @@ en: + module_name: + hps_learning: Online Courses hps_learning: - hps_learning: E Learning + hps_learning: Online Courses classes: Classes new_class: Create New Class course_pic: Course Picture diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index e6d27b0..4df1113 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -1,6 +1,8 @@ zh_tw: + module_name: + hps_learning: 開課系統 hps_learning: - hps_laerning: E Learning + hps_learning: 開課系統 classes: Classes new_class: Create New Class course_pic: Course Pic diff --git a/config/routes.rb b/config/routes.rb index ba6487a..3a9cd4c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,7 @@ Rails.application.routes.draw do scope "(:locale)", locale: Regexp.new(locales.join("|")) do namespace :admin do - resources :hps_learnings do + resources :online_courses do collection do get "get_temp_dir_name" post "upload_temp_file" diff --git a/lib/hps_learning/engine.rb b/lib/hps_learning/engine.rb index a5f9991..ab72573 100644 --- a/lib/hps_learning/engine.rb +++ b/lib/hps_learning/engine.rb @@ -15,31 +15,31 @@ module HpsLearning side_bar do head_label_i18n 'hps_learning.hps_learning', icon_class: "icons-screen" available_for "users" - active_for_controllers (['admin/hps_learnings']) - head_link_path "admin_hps_learnings_path" + active_for_controllers (['admin/online_courses']) + head_link_path "admin_online_courses_path" context_link 'hps_learning.classes', - :link_path=>"admin_hps_learnings_path" , + :link_path=>"admin_online_courses_path" , :priority=>1, - :active_for_action=>{'admin/hps_learnings'=>'index'}, + :active_for_action=>{'admin/online_courses'=>'index'}, :available_for => 'users' context_link 'hps_learning.new_class', - :link_path=>"new_admin_hps_learning_path" , + :link_path=>"new_admin_online_course_path" , :priority=>2, - :active_for_action=>{'admin/hps_learnings'=>'new'}, + :active_for_action=>{'admin/online_courses'=>'new'}, :available_for => 'sub_managers' context_link 'categories', :link_path=>"admin_module_app_categories_path" , :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'hps_learning').id}", :priority=>3, - :active_for_action=>{'admin/hps_learnings'=>'categories'}, + :active_for_action=>{'admin/online_courses'=>'categories'}, :active_for_category => 'HpsLearning', :available_for => 'managers' context_link 'tags', :link_path=>"admin_module_app_tags_path" , :link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'hps_learning').id}", :priority=>4, - :active_for_action=>{'admin/hps_learnings'=>'tags'}, + :active_for_action=>{'admin/online_courses'=>'tags'}, :active_for_tag => 'HpsLearning', :available_for => 'managers' end