aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/dashboard.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/dashboard.rb')
-rw-r--r--app/models/dashboard.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/models/dashboard.rb b/app/models/dashboard.rb
new file mode 100644
index 000000000..a53267db5
--- /dev/null
+++ b/app/models/dashboard.rb
@@ -0,0 +1,27 @@
+#
+# The default Dashboard implementation can be customized in an initializer :
+#
+# Rails.application.config.to_prepare do
+# Dashboard.default_class = Custom::Dashboard
+# end
+#
+class Dashboard
+ include ActiveModel::Conversion
+
+ @@default_class = self
+ mattr_accessor :default_class
+
+ attr_reader :context
+
+ def initialize(context)
+ @context = context
+ end
+
+ def self.create(context)
+ default_class.new context
+ end
+
+ def current_organisation
+ context.send(:current_organisation)
+ end
+end