From b2056a2ad59f3cc98de17e48c0152014c07ac76c Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Wed, 1 Jul 2015 15:13:28 +0800 Subject: [PATCH] some test mods for feeds --- app/controllers/store_api_controller.rb | 18 ++++++++++++++++++ app/models/module_app.rb | 2 ++ config/routes.rb | 1 + lib/orbit_app/module/registration.rb | 11 ++++++++++- public/411.html | 4 ++-- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/app/controllers/store_api_controller.rb b/app/controllers/store_api_controller.rb index 4bd74e8..946ed02 100644 --- a/app/controllers/store_api_controller.rb +++ b/app/controllers/store_api_controller.rb @@ -50,6 +50,24 @@ class StoreApiController < ApplicationController render :layout => "back_end" end + + # this is for feed module. + def get_channel_lists + apps = ModuleApp.where(:feeds_url.ne => nil) + channels = [] + if apps.count > 0 + apps.each do |app| + channel = {} + channel["title"] = app.title + channel["key"] = app.key + channel["url"] = app.feeds_url + channel["app_icon"] = app.get_registration.get_side_bar.get_icon_class + channels << channel + end + end + render :json => {"channels" => channels}.to_json + end + private def bundle_install Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update && bundle` } diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 40d8ac0..f6cfd0a 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -16,6 +16,7 @@ class ModuleApp field :widget_settings field :store_permission_granted, type: Boolean, default: false field :cache_models, type: Array, default: [] + field :feeds_url has_many :categories, dependent: :destroy, :autosave => true has_and_belongs_to_many :tags, dependent: :destroy, :autosave => true @@ -36,6 +37,7 @@ class ModuleApp self[:widget_settings] = reg.get_widget_settings self[:desktop_enabled] = reg.is_desktop_enabled self[:cache_models] = reg.get_models_to_cache + self[:feeds_url] = reg.get_feeds_url end def sub_managers diff --git a/config/routes.rb b/config/routes.rb index 09c305b..0d36bbe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -39,6 +39,7 @@ Orbit::Application.routes.draw do post "/store/install_module" => "store_api#install_module" post "/store/uninstall_module" => "store_api#uninstall_module" post "/store/restart_srever_after_install" => "store_api#restart_server_after_install" + get "/feeds/channel_lists" => 'store_api#get_channel_lists' # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". diff --git a/lib/orbit_app/module/registration.rb b/lib/orbit_app/module/registration.rb index ae8b9fd..f3f3455 100644 --- a/lib/orbit_app/module/registration.rb +++ b/lib/orbit_app/module/registration.rb @@ -40,12 +40,13 @@ module OrbitApp end class RegisteredModule - attr_reader :name,:key,:base_path, :module_label,:widget_methods,:authorizable_models,:is_authorizable, :data_count, :widget_settings, :icon_class_no_sidebar,:desktop_enabled, :models_to_cache + attr_reader :name,:key,:base_path, :module_label,:widget_methods,:authorizable_models,:is_authorizable, :data_count, :widget_settings, :icon_class_no_sidebar,:desktop_enabled, :models_to_cache, :feeds_url def initialize(name,&block) @name = name @key = @name.underscore.singularize @side_bar = nil + @feeds_url = nil @module_label = @name @widget_methods = [] @models_to_cache = [] @@ -82,6 +83,14 @@ module OrbitApp @module_label = name end + def feeds_url(url) + @feeds_url = url + end + + def get_feeds_url + @feeds_url + end + def widget_methods(widgets) @widget_methods = widgets end diff --git a/public/411.html b/public/411.html index 384d0da..d7798c5 100644 --- a/public/411.html +++ b/public/411.html @@ -57,8 +57,8 @@

OOPS!

-

Page not available

-

Sorry, This page is not available for this language
You can go back to home or previous page.

+

Page not available.

+

Sorry, this page is not available for this language.
You can go back to home or previous page.