diff --git a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb index 3d1156a6..d96eaa0d 100644 --- a/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb +++ b/vendor/built_in_modules/archive/app/controllers/panel/archive/back_end/archive_file_categorys_controller.rb @@ -1,14 +1,18 @@ -class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendController - before_filter :for_app_manager,:except => [:index] - include OrbitControllerLib::DivisionForDisable +class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendController + include OrbitControllerLib::DivisionForDisable + before_filter :for_app_manager,:except => [:index,:get_categorys_json,:get_archive_files_json] + + before_filter :force_order_for_visitor,:only=>[:index,:get_categorys_json,:get_archive_files_json] + before_filter :force_order_for_user,:except => [:index,:get_categorys_json,:get_archive_files_json] + before_filter :for_app_sub_manager,:except => [:index,:get_categorys_json,:get_archive_files_json] def index @archive_file_categorys = get_categories_for_index("ArchiveFileCategory") # @archive_file_categorys = ArchiveFileCategory.all @archive_file_category = ArchiveFileCategory.new(:display => 'List') - @url = panel_archive_back_end_archive_file_categorys_path + @url = panel_archive_back_end_archive_file_categorys_path respond_to do |format| format.html # index.html.erb @@ -16,6 +20,42 @@ class Panel::Archive::BackEnd::ArchiveFileCategorysController < OrbitBackendCont end end + def get_categorys_json + categorys = ArchiveFileCategory.all + data = Array.new + + categorys.each do |c| + data << { + category: c.title, + link: "#{url_for( :action => "index", + :controller => "panel/archive/front_end/archive_files", + :format => :rss, + :only_path => false, + :inner=>true, + :category_id => c )}" + } + end + + render :json => JSON.pretty_generate(data) + end + + def get_archive_files_json + archive_file = ArchiveFileCategory.find(params[:archive_file_category_id]).archive_files + p archive_file + data = Array.new + + archive_file.each do |b| + + data << { + title: b.title, + link: "http://#{request.host_with_port}#{panel_archive_front_end_archive_file_path(b, :category_id => b.archive_file_category.id)}", + tag: b.sorted_tags.to_a, + } + end + + render :json => JSON.pretty_generate(data) + end + # GET /archive_files/1 # GET /archive_files/1.xml def show diff --git a/vendor/built_in_modules/archive/app/helpers/panel/archive/back_end/archive_file_categorys_helper.rb b/vendor/built_in_modules/archive/app/helpers/panel/archive/back_end/archive_file_categorys_helper.rb new file mode 100644 index 00000000..d5185ff9 --- /dev/null +++ b/vendor/built_in_modules/archive/app/helpers/panel/archive/back_end/archive_file_categorys_helper.rb @@ -0,0 +1,15 @@ +module Panel::Archive::BackEnd::ArchiveFileCategorysHelper +include ActionView::Helpers::UrlHelper + + + def show_anc_cate_permission_link(archive_file_category) + type = 'submit' + oa = archive_file_category.get_object_auth_by_title(type) + if oa.nil? + archive_file_category.object_auths.new(title: type ).save + oa = archive_file_category.get_object_auth_by_title(type) + end + link_to t(:category_auth),admin_object_auth_ob_auth_path(oa) + end + +end \ No newline at end of file diff --git a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb index 48d26f6c..6bb831a2 100644 --- a/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb +++ b/vendor/built_in_modules/archive/app/views/panel/archive/back_end/archive_file_categorys/_archive_file_category.html.erb @@ -1,13 +1,16 @@ -