Skip to content

Commit

Permalink
pick database accordingly to domain [#11 state:resolved]
Browse files Browse the repository at this point in the history
i18n for title and header and some gif's
  • Loading branch information
kfl62 committed Jan 29, 2009
1 parent 25bb7e0 commit 60af427
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 8 deletions.
31 changes: 30 additions & 1 deletion app/controllers/application.rb
Expand Up @@ -4,8 +4,10 @@
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time

before_filter :current_database

filter_parameter_logging :password, :password_confirmation
helper_method :current_trst_user_session, :current_trst_user
helper_method :current_trst_user_session, :current_trst_user, :current_title, :current_logo


private
Expand Down Expand Up @@ -46,4 +48,31 @@ def redirect_back_or_default(default)
session[:return_to] = nil
end

def current_location
case request.domain
when "localhost"
return Rails.env
when "trst.ro"
return request.subdomains.first + '.' + Rails.env
else
subdomain_first = request.subdomains.first
return request.domain.split('.')[0] + '.' + Rails.env if subdomain_first == 'srv' || subdomain_first == 'trst'
end
end

def current_database
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => Rails.root + '/db/' + current_location + '.sqlite3'
)
end

def current_title
t('layout.title_' + current_location.split(".")[0])
end

def current_logo
"sigla_#{current_location.split('.')[0]}.gif"
end

end
4 changes: 3 additions & 1 deletion config/locales/ro.yml
Expand Up @@ -2,8 +2,10 @@
ro:
layout:
title: "Firma Dvs."
title_development: "Firma Dvs."
title_klclean: "klClean"
title_diren: "Diren/Continent"
header:
company: "Firma Dvs."
authenticated_as: "Autentificat ca şi:"
menu:
submenu_show: "Arată submeniul"
Expand Down
Binary file added public/images/sigla_development.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/sigla_diren.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/sigla_klclean.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions public/stylesheets/screen/basemod.css
Expand Up @@ -38,20 +38,24 @@ body {
}
/* Design of the Main Layout Elements | Gestaltung der Hauptelemente des Layouts */
#header {
background: #3e3e3e url("/images/sigla.gif") no-repeat center left;
height: 90px;
}

div.header_title {
color: #f5f5f5;
padding-top: 15px;
text-indent: 200px;
text-align: center;
position: absolute;
top: 20px;
left: 200px;
width: 360px;
}

span.header_title {
float: right;
padding-right: 10px;
div.header_current_trst_user {
color: #f5f5f5;
text-align: right;
position: absolute;
top: 50px;
left: 655px;
}

#topnav {
Expand Down

0 comments on commit 60af427

Please sign in to comment.