about summary refs log tree commit diff
path: root/app/helpers
diff options
context:
space:
mode:
authorNaouak <tardiel@gmail.com>2017-04-15 22:47:48 +0200
committerEugen <eugen@zeonfederated.com>2017-04-15 22:47:48 +0200
commit3d3e32befb369f8c6a9f3ac1ee48bce3d266f4b8 (patch)
tree8c0e2cee6e27904802ef764b190a5f0e7db7e49f /app/helpers
parentfa08b5079d7f85c098ee9c6a0dd73bde0a20989f (diff)
Check for a custom css file to help customization of instances (#1368)
* User can create a custom.scss to customize their instance without modifying gitted files.

* Add documentation for customization.

* Forgot the helper file

* Fix Style to pass codeclimate

* Requests from maintainer.
Diffstat (limited to 'app/helpers')
-rwxr-xr-xapp/helpers/style_helper.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/helpers/style_helper.rb b/app/helpers/style_helper.rb
new file mode 100755
index 000000000..774407b7f
--- /dev/null
+++ b/app/helpers/style_helper.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module StyleHelper
+  def stylesheet_for_layout
+    if asset_exist? 'custom.css'
+      'custom'
+    else
+      'application'
+    end
+  end
+
+  def asset_exist?(path)
+    if Rails.configuration.assets.compile
+      Rails.application.precompiled_assets.include? path
+    else
+      Rails.application.assets_manifest.assets[path].present?
+    end
+  end
+end