Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Galya Fedorenko committed Jan 26, 2018
1 parent 9912bed commit f8b5678
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Expand Up @@ -5,8 +5,9 @@ class ApplicationController < ActionController::Base
before_action :domain_stylesheet

def domain_stylesheet
return unless @stylesheet_url.nil?
website = Website.find_by_domain(request.domain)
@styles = website.nil? || website.stylesheet.empty? ? nil : website.stylesheet
@stylesheet_url = website.nil? || website.stylesheet.empty? ? :default : website.stylesheet
end

def doorkeeper_unauthorized_render_options(error: nil)
Expand Down
3 changes: 3 additions & 0 deletions app/helpers/application_helper.rb
@@ -1,4 +1,7 @@
# frozen_string_literal: true

module ApplicationHelper
def domain_stylesheet_tag(url)
return stylesheet_link_tag(url) unless url.nil?
end
end
2 changes: 1 addition & 1 deletion app/views/layouts/admin.html.erb
Expand Up @@ -5,7 +5,7 @@
<title>Barong Admin</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'admin', media: 'all' %>
<%= stylesheet_link_tag @styles unless @styles.nil? %>
<%= domain_stylesheet_tag(@stylesheet_url) %>
<%= javascript_include_tag 'admin' %>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/devise.html.erb
Expand Up @@ -5,7 +5,7 @@
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'web', media: 'all' %>
<%= stylesheet_link_tag @styles unless @styles.nil? %>
<%= domain_stylesheet_tag(@stylesheet_url) %>
<%= javascript_include_tag 'web' %>
</head>
<body class="devise">
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/documents.html.erb
Expand Up @@ -5,7 +5,7 @@
<title>Barong</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'web', media: 'all' %>
<%= stylesheet_link_tag @styles unless @styles.nil? %>
<%= domain_stylesheet_tag(@stylesheet_url) %>
<%= javascript_include_tag 'web' %>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/profiles.html.erb
Expand Up @@ -5,7 +5,7 @@
<title>Barong</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'web', media: 'all' %>
<%= stylesheet_link_tag @styles unless @styles.nil? %>
<%= domain_stylesheet_tag(@stylesheet_url) %>
<%= javascript_include_tag 'web' %>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/web.html.erb
Expand Up @@ -5,7 +5,7 @@
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'web', media: 'all' %>
<%= stylesheet_link_tag @styles unless @styles.nil? %>
<%= domain_stylesheet_tag(@stylesheet_url) %>
<%= javascript_include_tag 'web' %>
</head>
<body class="devise">
Expand Down

0 comments on commit f8b5678

Please sign in to comment.