member plugin init edit
This commit is contained in:
commit
680d7908b9
234 files changed
+2085
-3308
No files matched your search
@@ -88,7 +88,7 @@ class Admin::AssetsController < OrbitBackendController
|
||||
|
||||
def delete
|
||||
if params[:ids]
|
||||
asset = Asset.any_in(:_id => params[:ids]).delete_all
|
||||
asset = Asset.any_in(:_id => params[:ids]).destroy_all
|
||||
end
|
||||
redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
@@ -114,7 +114,7 @@ class Admin::DesignsController < OrbitBackendController
|
||||
|
||||
def delete
|
||||
if params[:ids]
|
||||
designs = Design.any_in(:_id => params[:ids]).delete_all
|
||||
designs = Design.any_in(:_id => params[:ids]).destroy_all
|
||||
end
|
||||
redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options])
|
||||
end
|
||||
|
||||
@@ -36,12 +36,11 @@ helper Admin::PagePartsHelper
|
||||
|
||||
if @item.module_app
|
||||
@module_app = @item.module_app
|
||||
|
||||
@frontend_path = @item.app_frontend_url ? @item.app_frontend_url : @module_app.widgets.keys[0]
|
||||
@frontend_path = @item.app_frontend_url
|
||||
|
||||
if @module_app && @module_app.widgets && @module_app.widgets.any?{|b| b.class == Array}
|
||||
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
|
||||
end
|
||||
if @module_app && @module_app.widgets && @module_app.widgets.any?{|b| b.class == Array}
|
||||
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
|
||||
end
|
||||
|
||||
case @item.module_app.key
|
||||
when 'announcement'
|
||||
@@ -59,7 +58,7 @@ helper Admin::PagePartsHelper
|
||||
end
|
||||
else
|
||||
@categories = nil
|
||||
@module_app = @module_apps[0]
|
||||
@module_app = @module_apps[0]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Admin::SubRolesController < RolesController
|
||||
class Admin::SubRolesController < Admin::RolesController
|
||||
|
||||
|
||||
end
|
||||
@@ -11,31 +11,40 @@ class DefaultWidgetController< OrbitWidgetController
|
||||
end
|
||||
|
||||
def default_widget
|
||||
@tag_class = nil
|
||||
if !params[:id].blank?
|
||||
redirect_to eval("#{@page_part.module_app.widget_fields_link_method['title']['method']}('#{params[:id]}', {inner: #{params[:inner] || true}})")
|
||||
else
|
||||
@tag_class = nil
|
||||
|
||||
@default_widget = @page_part.module_app.get_default_widget
|
||||
@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)
|
||||
@default_widget = @page_part.module_app.get_default_widget
|
||||
@widget_image_field = @default_widget["image"] || @default_widget[:image]
|
||||
case @page_part
|
||||
when Page
|
||||
@fields = @page_part.frontend_field
|
||||
@data_limit = @page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
|
||||
@paginate = true
|
||||
@page_id = @page_part.id
|
||||
when PagePart
|
||||
@fields = @page_part.widget_field
|
||||
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
|
||||
end
|
||||
if @paginate
|
||||
@data = eval(@default_widget["query"]).includes(@widget_image_field).page(params[:page_main]).per(@data_limit).desc(:created_at)
|
||||
else
|
||||
@data = eval(@default_widget["query"]).limit(@data_limit).includes(@widget_image_field).desc(:created_at)
|
||||
end
|
||||
case params[:type]
|
||||
when "typeA"
|
||||
@tag_class = 'default_widget_typeA'
|
||||
@partial = "typeA"
|
||||
when /typeB_/
|
||||
@tag_class = "default_widget_#{params[:type]}"
|
||||
@partial = "typeB"
|
||||
when "typeC"
|
||||
@tag_class = 'default_widget_typeC'
|
||||
@partial = "typeC"
|
||||
end
|
||||
end
|
||||
@data = eval(@default_widget["query"]).limit(data_limit).includes(@widget_image_field).desc(:created_at)
|
||||
case params[:type]
|
||||
when "typeA"
|
||||
@tag_class = 'default_widget_typeA'
|
||||
render "typeA"
|
||||
when /typeB_/
|
||||
@tag_class = "default_widget_#{params[:type]}"
|
||||
render "typeB"
|
||||
when "typeC"
|
||||
@tag_class = 'default_widget_typeC'
|
||||
render "typeC"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -2,6 +2,11 @@ class FrontController < ApplicationController
|
||||
|
||||
layout false
|
||||
|
||||
def show_breadcrumb
|
||||
@ancestors = Page.find(params[:id]).ancestors_and_self
|
||||
@ancestors = nil if @ancestors.size == 1
|
||||
end
|
||||
|
||||
def show_banner
|
||||
@ad_banner = AdBanner.find(params[:id]) rescue nil
|
||||
end
|
||||
|
||||
@@ -64,17 +64,23 @@ class PagesController < ApplicationController
|
||||
protected
|
||||
|
||||
def get_item
|
||||
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]})
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) unless @item
|
||||
elsif !params[:category_id].blank?
|
||||
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action],category: params[:category_id]).any_in(tag: [nil,'']).first
|
||||
elsif !params[:tag_id].blank?
|
||||
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action],tag: params[:tag_id]).any_in(category: [nil,'']).first
|
||||
if params[:same_page_id]
|
||||
@item = Item.find(params[:same_page_id])
|
||||
else
|
||||
module_app = ModuleApp.first(:conditions => {:key => params[:app_name]})
|
||||
if !params[:category_id].blank? && !params[:tag_id].blank?
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]})
|
||||
@item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) unless @item
|
||||
elsif !params[:category_id].blank?
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], category: params[:category_id]).any_in(tag: [nil,'']).first
|
||||
elsif !params[:tag_id].blank?
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action], tag: params[:tag_id]).any_in(category: [nil,'']).first
|
||||
end
|
||||
@item = Item.find(params[:orig_page]) unless @item || params[:orig_page].blank?
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first unless @item
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: 'default_widget').first unless @item
|
||||
@item = Item.where(module_app_id: module_app.id, app_frontend_url: params[:app_action]).first unless @item
|
||||
end
|
||||
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action]).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first unless @item
|
||||
@item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action]).first unless @item
|
||||
raise PageError,'Missing Frontend Page' if @item.nil?
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user