remove the option of widget method and auto send to the correct method
This commit is contained in:
parent
43f92c9bd6
commit
6836aaf6cd
|
@ -99,7 +99,21 @@ class EPapersController < ApplicationController
|
||||||
"extras" => {}
|
"extras" => {}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
def widget
|
||||||
|
subpart = OrbitHelper.get_current_widget
|
||||||
|
case subpart.widget_type
|
||||||
|
when /criteria_list.*/
|
||||||
|
criteria_list
|
||||||
|
when /category_wise_articles.*/
|
||||||
|
category_wise_articles
|
||||||
|
when /latest_criteria.*/
|
||||||
|
latest_criteria
|
||||||
|
when /latest_slider.*/
|
||||||
|
latest_slider
|
||||||
|
else
|
||||||
|
subscribe
|
||||||
|
end
|
||||||
|
end
|
||||||
def criteria_list
|
def criteria_list
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
criterias = PaperCriteria.all.desc(:start_date).limit(OrbitHelper.widget_data_count)
|
criterias = PaperCriteria.all.desc(:start_date).limit(OrbitHelper.widget_data_count)
|
||||||
|
|
|
@ -1,10 +1,23 @@
|
||||||
module EPaper
|
module EPaper
|
||||||
class Engine < ::Rails::Engine
|
class Engine < ::Rails::Engine
|
||||||
initializer "e_paper" do
|
initializer "e_paper" do
|
||||||
|
env_pwd = ENV['PWD']
|
||||||
|
begin
|
||||||
|
require File.expand_path('app/models/sub_part.rb', env_pwd)
|
||||||
|
if defined? SubPart
|
||||||
|
SubPart.where(:module => 'e_paper',:widget_method.ne => 'widget').each do |sub_part|
|
||||||
|
sub_part.widget_method = 'widget'
|
||||||
|
sub_part.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
rescue => e
|
||||||
|
puts ["can't find subpart",e]
|
||||||
|
end
|
||||||
OrbitApp.registration "EPaper", :type => "ModuleApp" do
|
OrbitApp.registration "EPaper", :type => "ModuleApp" do
|
||||||
module_label "e_paper.e_paper"
|
module_label "e_paper.e_paper"
|
||||||
base_url File.expand_path File.dirname(__FILE__)
|
base_url File.expand_path File.dirname(__FILE__)
|
||||||
widget_methods ["criteria_list","category_wise_articles","latest_criteria", "latest_slider", "subscribe"]
|
#widget_methods ["criteria_list","category_wise_articles","latest_criteria", "latest_slider", "subscribe"]
|
||||||
|
widget_methods ["widget"]
|
||||||
widget_settings [{"data_count"=>30}]
|
widget_settings [{"data_count"=>30}]
|
||||||
taggable "EPaperCriteria"
|
taggable "EPaperCriteria"
|
||||||
categorizable
|
categorizable
|
||||||
|
|
Loading…
Reference in New Issue