Skip to content

Commit

Permalink
Load css for domain
Browse files Browse the repository at this point in the history
  • Loading branch information
Galya Fedorenko committed Jan 26, 2018
1 parent 0397fa4 commit ce72120
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/application_controller.rb
Expand Up @@ -2,6 +2,12 @@

class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :domain_stylesheet

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

def doorkeeper_unauthorized_render_options(error: nil)
{ json: { error: 'Not authorized' } }
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/admin.html.erb
Expand Up @@ -5,6 +5,7 @@
<title>Barong Admin</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'admin', media: 'all' %>
<%= stylesheet_link_tag @styles unless @styles.nil? %>
<%= javascript_include_tag 'admin' %>
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/devise.html.erb
Expand Up @@ -5,6 +5,7 @@
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'web', media: 'all' %>
<%= stylesheet_link_tag @styles unless @styles.nil? %>
<%= javascript_include_tag 'web' %>
</head>
<body class="devise">
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/documents.html.erb
Expand Up @@ -5,6 +5,7 @@
<title>Barong</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'web', media: 'all' %>
<%= stylesheet_link_tag @styles unless @styles.nil? %>
<%= javascript_include_tag 'web' %>
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/profiles.html.erb
Expand Up @@ -5,6 +5,7 @@
<title>Barong</title>
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'web', media: 'all' %>
<%= stylesheet_link_tag @styles unless @styles.nil? %>
<%= javascript_include_tag 'web' %>
</head>
<body>
Expand Down
1 change: 1 addition & 0 deletions app/views/layouts/web.html.erb
Expand Up @@ -5,6 +5,7 @@
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'web', media: 'all' %>
<%= stylesheet_link_tag @styles unless @styles.nil? %>
<%= javascript_include_tag 'web' %>
</head>
<body class="devise">
Expand Down

0 comments on commit ce72120

Please sign in to comment.