some test mods for feeds

This commit is contained in:
Harry Bomrah 2015-07-01 15:13:28 +08:00
parent 251133748d
commit b2056a2ad5
5 changed files with 33 additions and 3 deletions

View File

@ -50,6 +50,24 @@ class StoreApiController < ApplicationController
render :layout => "back_end" render :layout => "back_end"
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 private
def bundle_install def bundle_install
Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update && bundle` } Bundler.with_clean_env { `cd #{Rails.root} && BUNDLE_GEMFILE=downloaded_extensions.rb bundle update && bundle` }

View File

@ -16,6 +16,7 @@ class ModuleApp
field :widget_settings field :widget_settings
field :store_permission_granted, type: Boolean, default: false field :store_permission_granted, type: Boolean, default: false
field :cache_models, type: Array, default: [] field :cache_models, type: Array, default: []
field :feeds_url
has_many :categories, dependent: :destroy, :autosave => true has_many :categories, dependent: :destroy, :autosave => true
has_and_belongs_to_many :tags, 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[:widget_settings] = reg.get_widget_settings
self[:desktop_enabled] = reg.is_desktop_enabled self[:desktop_enabled] = reg.is_desktop_enabled
self[:cache_models] = reg.get_models_to_cache self[:cache_models] = reg.get_models_to_cache
self[:feeds_url] = reg.get_feeds_url
end end
def sub_managers def sub_managers

View File

@ -39,6 +39,7 @@ Orbit::Application.routes.draw do
post "/store/install_module" => "store_api#install_module" post "/store/install_module" => "store_api#install_module"
post "/store/uninstall_module" => "store_api#uninstall_module" post "/store/uninstall_module" => "store_api#uninstall_module"
post "/store/restart_srever_after_install" => "store_api#restart_server_after_install" 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. # The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes". # See how all your routes lay out with "rake routes".

View File

@ -40,12 +40,13 @@ module OrbitApp
end end
class RegisteredModule 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) def initialize(name,&block)
@name = name @name = name
@key = @name.underscore.singularize @key = @name.underscore.singularize
@side_bar = nil @side_bar = nil
@feeds_url = nil
@module_label = @name @module_label = @name
@widget_methods = [] @widget_methods = []
@models_to_cache = [] @models_to_cache = []
@ -82,6 +83,14 @@ module OrbitApp
@module_label = name @module_label = name
end end
def feeds_url(url)
@feeds_url = url
end
def get_feeds_url
@feeds_url
end
def widget_methods(widgets) def widget_methods(widgets)
@widget_methods = widgets @widget_methods = widgets
end end

View File

@ -57,8 +57,8 @@
<div id="page-not-avai-in-this-lang"> <div id="page-not-avai-in-this-lang">
<section class="message"> <section class="message">
<h1>OOPS!</h1> <h1>OOPS!</h1>
<h2>Page not available</h2> <h2>Page not available.</h2>
<p>Sorry, This page is not available for this language<br> You can go back to <a class="home" href="/">home</a> or <a class="prev-page" href="#" onclick="window.history.back();return false;">previous</a> page.</p> <p>Sorry, this page is not available for this language.<br> You can go back to <a class="home" href="/">home</a> or <a class="prev-page" href="#" onclick="window.history.back();return false;">previous</a> page.</p>
</section> </section>
</div> </div>