Updated Sidebar, Application Controllers

This commit is contained in:
saurabhbhatia 2013-11-01 16:41:25 +08:00
parent 8a4242aae9
commit d636248073
6 changed files with 16 additions and 26 deletions

View File

@ -146,17 +146,18 @@ class ApplicationController < ActionController::Base
if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s) if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s)
condition = VALID_LOCALES.include?(session[:locale]) condition = VALID_LOCALES.include?(session[:locale])
#check if the default locale is present or not #check if the default locale is present or not
elsif @site.default_locale.present? elsif session[:locale]
default_locale = @site.default_locale condition = @site.in_use_locales.include?(session[:locale])
condition = @site.in_use_locales.include?(default_locale) elsif @site.enable_language_detection
elsif !@site.enable_language_detection
#check enable langauge detection #check enable langauge detection
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
condition = @site.in_use_locales.include?(browser_locale) condition = @site.in_use_locales.include?(browser_locale)
elsif session[:locale] elsif @site.default_locale.present?
condition = @site.in_use_locales.include?(session[:locale]) default_locale = @site.default_locale
condition = @site.in_use_locales.include?(default_locale)
end end
session[:locale] = condition ? (default_locale || browser_locale || session[:locale]) : I18n.default_locale.to_s
session[:locale] = condition ? (browser_locale || session[:locale] || default_locale) : I18n.default_locale.to_s
I18n.locale = session[:locale].to_sym I18n.locale = session[:locale].to_sym
@site_in_use_locales = @site.in_use_locales @site_in_use_locales = @site.in_use_locales
@site_valid_locales = site_locales_default_head(@site.valid_locales) @site_valid_locales = site_locales_default_head(@site.valid_locales)

View File

@ -1,14 +1,3 @@
<!-- <nav id="sidebar">
<h2 class="position"><a href="#"><i class="icons-flow-tree"></i></a></h2>
<div id="sidebar-menu">
<div class="scroller">
</div>
</div>
<div class="sub-nav-block-list">
</div>
<div class="sub-nav-arrow"></div>
</nav> -->
<nav id="sidebar"> <nav id="sidebar">
<h2 class="position"><a href="#"><i class="icons-cog"></i></a></h2> <h2 class="position"><a href="#"><i class="icons-cog"></i></a></h2>
<div id="sidebar-menu"> <div id="sidebar-menu">
@ -32,6 +21,6 @@
<!-- <li title="System Info"><a href="/orbit_4.0.1/admin/system_info/index.shtml?sidebarNavList=8&amp;subNavBlockList=0"><span><i class="icons-info-2"></i></span></a></li> <!-- <li title="System Info"><a href="/orbit_4.0.1/admin/system_info/index.shtml?sidebarNavList=8&amp;subNavBlockList=0"><span><i class="icons-info-2"></i></span></a></li>
--> </ul> --> </ul>
</div> </div>
</div>
<div class="sub-nav-arrow"></div> <div class="sub-nav-arrow"></div>
</div>
</nav> </nav>

View File

@ -21,6 +21,6 @@
<!-- <li title="System Info"><a href="/orbit_4.0.1/admin/system_info/index.shtml?sidebarNavList=8&amp;subNavBlockList=0"><span><i class="icons-info-2"></i></span></a></li> <!-- <li title="System Info"><a href="/orbit_4.0.1/admin/system_info/index.shtml?sidebarNavList=8&amp;subNavBlockList=0"><span><i class="icons-info-2"></i></span></a></li>
--> </ul> --> </ul>
</div> </div>
</div>
<div class="sub-nav-arrow"></div> <div class="sub-nav-arrow"></div>
</div>
</nav> </nav>

View File

@ -164,7 +164,7 @@
<label class="control-label muted">Default Language</label> <label class="control-label muted">Default Language</label>
<div class="controls"> <div class="controls">
<% @site_in_use_locales.each do |locale| %> <% @site_in_use_locales.each do |locale| %>
<%= radio_button_tag "site[default_locale]", locale, @locale == locale ,:class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(locale)}", disabled: true } %> <%= radio_button_tag "site[default_locale]", locale, @locale == locale , @site.in_use_locales.include?(locale),:class=>"toggle-check in_use_locales", :data => { :title => "#{I18nVariable.from_locale(locale)}", disabled: true } %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@ -20,6 +20,7 @@
<% end -%> <% end -%>
<% end -%> <% end -%>
</div> </div>
<div class="sub-nav-arrow"></div>
</div> </div>
<div class="sub-nav-block-list"> <div class="sub-nav-block-list">
<div class="sub-nav-block" data-icons="&#xe00d;"> <div class="sub-nav-block" data-icons="&#xe00d;">
@ -50,6 +51,5 @@
<% end -%> <% end -%>
</div> </div>
</div> </div>
<div class="sub-nav-arrow"></div>
</nav> </nav>

View File

@ -8,7 +8,7 @@ defaults: &defaults
development: development:
<<: *defaults <<: *defaults
database: test_site_new database: test_site
@ -24,4 +24,4 @@ production:
# password: <%= ENV['MONGOID_PASSWORD'] %> # password: <%= ENV['MONGOID_PASSWORD'] %>
# database: <%= ENV['MONGOID_DATABASE'] %> # database: <%= ENV['MONGOID_DATABASE'] %>
<<: *defaults <<: *defaults
database: test_site_new database: test_site