Updated fixes for site info - desktop openess, title always displayed

This commit is contained in:
saurabhbhatia 2013-10-16 18:33:57 +08:00
parent 2bcecc322e
commit 155039ac16
10 changed files with 28 additions and 35 deletions

View File

@ -140,7 +140,9 @@ class ApplicationController < ActionController::Base
# update session if passed # update session if passed
session[:locale] = params[:locale] if params[:locale] session[:locale] = params[:locale] if params[:locale]
browser_locale = condition = nil browser_locale = condition = nil
default_locale = @site.default_locale if @site.default_locale.present?
# check if locale is valid for non site pages # check if locale is valid for non site pages
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])
elsif 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 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)
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_locales_default_head(@site.in_use_locales) @site_in_use_locales = site_locales_default_head(@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

@ -340,10 +340,11 @@ class DesktopController< ApplicationController
render :json=>b.to_json render :json=>b.to_json
end end
private protected
def check_desktop_open 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' redirect_to '/admin/dashboards'
end end
end end

View File

@ -180,7 +180,7 @@ module ApplicationHelper
page_title = page.page_title ? page.page_title : page.title page_title = page.page_title ? page.page_title : page.title
if page.root? && @site.title if page.root? && @site.title
res << @site.title res << @site.title
elsif @site.title && @site.title_always_on elsif @site.title && !@site.title_always_on
res << @site.title + ' - ' + page_title res << @site.title + ' - ' + page_title
else else
res << page_title res << page_title

View File

@ -21,7 +21,6 @@ class Site
field :title_always_on, :type => Boolean, :default => false field :title_always_on, :type => Boolean, :default => false
field :dashbroad_allow_visitor, :type => Boolean, :default => false field :dashbroad_allow_visitor, :type => Boolean, :default => false
field :mail_settings, :type => Hash field :mail_settings, :type => Hash
field :enabled_for, :type => Array, :default => nil
field :disk_space, :type => String field :disk_space, :type => String
field :system_package_info, :type => Hash,:default=>{} field :system_package_info, :type => Hash,:default=>{}
@ -30,6 +29,7 @@ class Site
field :department field :department
mount_uploader :default_image, ImageUploader mount_uploader :default_image, ImageUploader
mount_uploader :favicon, ImageUploader
field :search,:type => Hash field :search,:type => Hash
field :resque_namespace,:type => String, :default=>APP_CONFIG['orbit'] field :resque_namespace,:type => String, :default=>APP_CONFIG['orbit']

View File

@ -1,3 +1,4 @@
<%= Rails.logger.info"@@@@@@@@@@@@@@@@"+design.inspect%>
<tr class="with_action"> <tr class="with_action">
<td class="span1"><%= check_box_tag 'to_delete[]', design.id, false, :class => "checkbox_in_list" %></td> <td class="span1"><%= check_box_tag 'to_delete[]', design.id, false, :class => "checkbox_in_list" %></td>
<td class="span2"> <td class="span2">

View File

@ -5,7 +5,7 @@
</h6> </h6>
<ul> <ul>
<% sitemap_block.children.each_with_index do |child, i| %> <% sitemap_block.children.each_with_index do |child, i| %>
<li "clear <%= 'disabled' if !child.show_in_sitemap_for(temp_locale) %>"> <li class="<%= 'disabled' if !child.show_in_sitemap_for(temp_locale) %>">
<h6> <h6>
<input type="checkbox" id="<%= child.id %>" class="toggle-check onoff" temp_locale="<%= temp_locale %>" data-deploy="right"> <input type="checkbox" id="<%= child.id %>" class="toggle-check onoff" temp_locale="<%= temp_locale %>" data-deploy="right">
<span><%= "#{sitemap_block_counter + 1}-#{i + 1}" %> <%= child.title_translations[temp_locale] %></span> <span><%= "#{sitemap_block_counter + 1}-#{i + 1}" %> <%= child.title_translations[temp_locale] %></span>

View File

@ -146,6 +146,8 @@
<div class="control-group"> <div class="control-group">
<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 %>
<% @site_in_use_locales.each do |locale| %> <% @site_in_use_locales.each do |locale| %>
<%= check_box_tag :default_locale, locale, (@site.enabled_for.nil?), :class=>"toggle-check" %> <%= check_box_tag :default_locale, locale, (@site.enabled_for.nil?), :class=>"toggle-check" %>
<%= I18nVariable.from_locale(locale) %> <%= I18nVariable.from_locale(locale) %>
@ -156,10 +158,9 @@
<label class="control-label muted">Enable Language</label> <label class="control-label muted">Enable Language</label>
<div class="controls"> <div class="controls">
<% @site_valid_locales.each do |valid_locale| %> <% @site_valid_locales.each do |valid_locale| %>
<%= check_box_tag 'site[enabled_for][]', valid_locale, (@site.enabled_for.nil?), :class=>"toggle-check" %> <%= check_box_tag "site[in_use_locales][]", locale, @site.valid_locales.include?(locale), :class=>"toggle-check" %>
<%= I18nVariable.from_locale(valid_locale) %> <%= I18nVariable.from_locale(valid_locale) %>
<% end %> <% end %>
<%= hidden_field_tag 'site[enabled_for][]', '' %>
</div> </div>
</div> </div>
@ -173,7 +174,7 @@
<!-- if this page editing please add class "fileupload-edit" --> <!-- if this page editing please add class "fileupload-edit" -->
<div class="fileupload fileupload-new clearfix" data-provides="fileupload"> <div class="fileupload fileupload-new clearfix" data-provides="fileupload">
<div class="fileupload-new thumbnail pull-left"> <div class="fileupload-new thumbnail pull-left">
<% if @site.default_image %> <% if @site.default_image %>
<%= image_tag( @site.default_image, :size=>"120x120") rescue ''%> <%= image_tag( @site.default_image, :size=>"120x120") rescue ''%>
<% else %> <% else %>
<img class="pull-left upload-picture" src="/assets/default-img.png" /> <img class="pull-left upload-picture" src="/assets/default-img.png" />
@ -188,16 +189,7 @@
<%end%> <%end%>
</span> </span>
<a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Cancel</a> <a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Cancel</a>
<div class="controls" data-toggle="buttons-checkbox">
<label class="checkbox inline btn btn-danger fileupload-remove">
<% if @site.default_image.file.present? %>
<label class="checkbox">
<%= check_box_tag 'site[remove_default_image]' %>
<%= t(:delete_) %>
</label>
<% end %>
</label>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -205,6 +197,7 @@
</div> </div>
</div> </div>
</div> </div>
<!-- Form Actions --> <!-- Form Actions -->
<div class="form-actions"> <div class="form-actions">

View File

@ -55,7 +55,6 @@
</div> </div>
<hr> <hr>
<!-- CKeditor Site Header --> <!-- CKeditor Site Header -->
<% @site_valid_locales.each do |locale|%> <% @site_valid_locales.each do |locale|%>
<%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %> <%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %>
@ -70,6 +69,15 @@
<%end%> <%end%>
<%end%> <%end%>
<!-- Sitemap menu in Header -->
<div class="control-group">
<label class="control-label muted">Sitemap menu in header
</label>
<div class="controls">
<%= f.check_box :sitemap_menu_in_header, :class => "toggle-check" %>
</div>
</div>
<hr> <hr>
<!-- CKeditor Site Footer --> <!-- CKeditor Site Footer -->
@ -85,16 +93,6 @@
</div> </div>
<%end%> <%end%>
<%end%> <%end%>
<!-- Sitemap menu in Header -->
<div class="control-group">
<label class="control-label muted">Sitemap menu in header
</label>
<div class="controls">
<%= f.check_box :sitemap_menu_in_header, :class => "toggle-check" %>
</div>
</div>
<hr> <hr>
<!-- Terms of Use --> <!-- Terms of Use -->

View File

@ -12,8 +12,6 @@
<% content_for :side_bar do %> <% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %> <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
<% end %> <% end %>
<h3>Sitemap</h3>
<div id="sitemap"> <div id="sitemap">
<ul id="map-tree-language" class="nav nav-pills"> <ul id="map-tree-language" class="nav nav-pills">
<% @site_valid_locales.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>