From 155039ac16a8ed9511d31b7efc64ad2d5e729ee4 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Wed, 16 Oct 2013 18:33:57 +0800 Subject: [PATCH] Updated fixes for site info - desktop openess, title always displayed --- app/controllers/admin/sites_controller.rb | 2 +- app/controllers/application_controller.rb | 4 +++- app/controllers/desktop_controller.rb | 5 ++-- app/helpers/application_helper.rb | 2 +- app/models/site.rb | 2 +- app/views/admin/designs/_design.html.erb | 1 + app/views/admin/sites/_sitemap_block.html.erb | 2 +- app/views/admin/sites/preference.html.erb | 23 +++++++------------ app/views/admin/sites/site_info.html.erb | 20 ++++++++-------- app/views/admin/sites/sitemap.html.erb | 2 -- 10 files changed, 28 insertions(+), 35 deletions(-) diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb index f9ce3081..dccee7cf 100644 --- a/app/controllers/admin/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -60,7 +60,7 @@ class Admin::SitesController < OrbitBackendController end def preference - + end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b75edc75..778a7927 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -140,7 +140,9 @@ class ApplicationController < ActionController::Base # update session if passed session[:locale] = params[:locale] if params[:locale] browser_locale = condition = nil + default_locale = @site.default_locale if @site.default_locale.present? # check if locale is valid for non site pages + if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s) condition = VALID_LOCALES.include?(session[:locale]) elsif session[:locale] @@ -152,7 +154,7 @@ class ApplicationController < ActionController::Base browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil condition = @site.in_use_locales.include?(browser_locale) 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 @site_in_use_locales = site_locales_default_head(@site.in_use_locales) @site_valid_locales = site_locales_default_head(@site.valid_locales) diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index 21c131f9..bacfcdc9 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -340,10 +340,11 @@ class DesktopController< ApplicationController render :json=>b.to_json end - private + protected def check_desktop_open - if Me.desktop_closed && current_user.nil? #Need to be change + @site = Site.first + if @site.desktop_closed #Need to be change redirect_to '/admin/dashboards' end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2963e6eb..f28f15a6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -180,7 +180,7 @@ module ApplicationHelper page_title = page.page_title ? page.page_title : page.title if page.root? && @site.title res << @site.title - elsif @site.title && @site.title_always_on + elsif @site.title && !@site.title_always_on res << @site.title + ' - ' + page_title else res << page_title diff --git a/app/models/site.rb b/app/models/site.rb index d12eca33..5304a9d4 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -21,7 +21,6 @@ class Site field :title_always_on, :type => Boolean, :default => false field :dashbroad_allow_visitor, :type => Boolean, :default => false field :mail_settings, :type => Hash - field :enabled_for, :type => Array, :default => nil field :disk_space, :type => String field :system_package_info, :type => Hash,:default=>{} @@ -30,6 +29,7 @@ class Site field :department mount_uploader :default_image, ImageUploader + mount_uploader :favicon, ImageUploader field :search,:type => Hash field :resque_namespace,:type => String, :default=>APP_CONFIG['orbit'] diff --git a/app/views/admin/designs/_design.html.erb b/app/views/admin/designs/_design.html.erb index 24c99b41..3b557d5e 100644 --- a/app/views/admin/designs/_design.html.erb +++ b/app/views/admin/designs/_design.html.erb @@ -1,3 +1,4 @@ +<%= Rails.logger.info"@@@@@@@@@@@@@@@@"+design.inspect%> <%= check_box_tag 'to_delete[]', design.id, false, :class => "checkbox_in_list" %> diff --git a/app/views/admin/sites/_sitemap_block.html.erb b/app/views/admin/sites/_sitemap_block.html.erb index cfb15def..7e76a737 100644 --- a/app/views/admin/sites/_sitemap_block.html.erb +++ b/app/views/admin/sites/_sitemap_block.html.erb @@ -5,7 +5,7 @@