page can use default widget
This commit is contained in:
1 parent
9630d0a841
commit
0cc616f988
28 files changed
+305
-154
No files matched your search
@@ -1,7 +1,12 @@
|
||||
class DefaultWidgetController< OrbitWidgetController
|
||||
|
||||
def front_end_available(var)
|
||||
@page_part = PagePart.find params[:part_id]
|
||||
@page_part = case params[:item_type]
|
||||
when "page"
|
||||
Page.find params[:page_id]
|
||||
when "page_part"
|
||||
PagePart.find params[:part_id]
|
||||
end
|
||||
@page_part.module_app.enable_frontend?
|
||||
end
|
||||
|
||||
@@ -9,10 +14,17 @@ class DefaultWidgetController< OrbitWidgetController
|
||||
@tag_class = nil
|
||||
|
||||
@default_widget = @page_part.module_app.get_default_widget
|
||||
@widget_image_field = @default_widget[:image]
|
||||
data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
||||
@widget_image_field = @default_widget["image"] || @default_widget[:image]
|
||||
data_limit = case @page_part
|
||||
when Page
|
||||
@fields = @page_part.frontend_field
|
||||
@page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
|
||||
when PagePart
|
||||
@fields = @page_part.widget_field
|
||||
@page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
||||
end
|
||||
@data = eval(@default_widget["query"]).limit(data_limit).includes(@widget_image_field)
|
||||
@fields = @page_part.widget_field
|
||||
|
||||
|
||||
case params[:type]
|
||||
when "typeA"
|
||||
|
||||
Reference in new issue
Block a user