lib/avo/app.rb in avo-2.0.0 vs lib/avo/app.rb in avo-2.1.0
- old
+ new
@@ -8,10 +8,12 @@
class_attribute :context, default: nil
class_attribute :license, default: nil
class_attribute :current_user, default: nil
class_attribute :root_path, default: nil
class_attribute :view_context, default: nil
+ class_attribute :params, default: {}
+ class_attribute :translation_enabled, default: false
class << self
def boot
init_fields
@@ -22,18 +24,20 @@
else
self.cache_store = Rails.cache
end
end
- def init(request:, context:, current_user:, root_path:, view_context:)
+ def init(request:, context:, current_user:, root_path:, view_context:, params:)
self.request = request
self.context = context
self.current_user = current_user
self.root_path = root_path
self.view_context = view_context
+ self.params = params
self.license = Licensing::LicenseManager.new(Licensing::HQ.new(request).response).license
+ self.translation_enabled = license.has(:localization)
# Set the current host for ActiveStorage
begin
if Rails::VERSION::MAJOR === 6
ActiveStorage::Current.host = request.base_url
@@ -86,9 +90,12 @@
def init_dashboards
self.dashboards = Dashboards::BaseDashboard.descendants
.select do |dashboard|
dashboard != Dashboards::BaseDashboard
+ end
+ .uniq do |dashboard|
+ dashboard.id
end
end
# Returns the Avo dashboard by id
def get_dashboard_by_id(id)