diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb index ebd16d14..13d64421 100644 --- a/app/controllers/admin/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -21,11 +21,16 @@ class Admin::SitesController < OrbitBackendController end def update + if params[:site][:default_locale] && @site.enable_language_detection.eql?(true) Site.update_all({:enable_language_detection => false}) elsif params[:site][:enable_language_detection] && @site.default_locale.present? Site.update_all({:default_locale => nil}) end + + if params[:site][:default_bar_color] + params[:site][:mobile_bar_color] = [] + end # if params[:site][:enable_language_detection] # Site.update_all({:default_locale => nil}) # end diff --git a/app/controllers/mobile_controller.rb b/app/controllers/mobile_controller.rb index 39aeab10..57597386 100644 --- a/app/controllers/mobile_controller.rb +++ b/app/controllers/mobile_controller.rb @@ -10,6 +10,7 @@ class MobileController < ApplicationController category = @site.announcement_category @bulletins = Bulletin.where(:category_id.in => category).available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page(params[:page_main]).per(15) @ad_banner = AdBanner.find(:all, :conditions => {:title => /Home/i})[0] + end def announcement diff --git a/app/models/site.rb b/app/models/site.rb index 20ec0e0c..a1b043c4 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -45,7 +45,8 @@ class Site field :google_analytics field :address field :phone_number, :type => Hash,:default=>{} - field :mobile_bar_color, :type => Array + field :mobile_bar_color, :type => Array, :default=>[] + field :mobile_on, :type => Boolean, :default => false diff --git a/app/views/admin/sites/responsive_setting.html.erb b/app/views/admin/sites/responsive_setting.html.erb index 007b5caa..7a39089a 100644 --- a/app/views/admin/sites/responsive_setting.html.erb +++ b/app/views/admin/sites/responsive_setting.html.erb @@ -7,7 +7,8 @@ <%= stylesheet_link_tag "lib/main-forms"%> <%= stylesheet_link_tag "lib/fileupload"%> <%= stylesheet_link_tag "lib/togglebox"%> - + <%= stylesheet_link_tag "jquery.miniColors" %> + <%= javascript_include_tag "jquery.miniColors.min" %> <%= javascript_include_tag 'lib/bootstrap-fileupload' %> <%= javascript_include_tag 'lib/site_set' %> @@ -64,6 +65,16 @@ +
+ +
+ /> + /> + OR + name="site[default_bar_color]" id="default_bar_color" style="margin:0 0 3px 10px;" /> Default Color +
+
+
@@ -125,6 +136,22 @@ $("#site_enable_language_detection").parent().addClass('disable'); }); }); + + if($('.color-picker').length > 0){ + $('.color-picker').miniColors(); // just in category view + } + + $("#default_bar_color").bind(clickEvent,function(){ + var colorboxes = $( this ).parent().find( "input[type=text]" ); + + if( $( this ).is(":checked") ){ + colorboxes.attr("disabled","disabled"); + }else{ + colorboxes.removeAttr('disabled'); + } + + }) + }); <% end %> \ No newline at end of file diff --git a/app/views/mobile/_header.mobile.erb b/app/views/mobile/_header.mobile.erb index f68ff8d8..369b13a5 100644 --- a/app/views/mobile/_header.mobile.erb +++ b/app/views/mobile/_header.mobile.erb @@ -1,4 +1,8 @@ -
+

<% if @site.mobile_icon.present?%> <%= image_tag( @site.mobile_icon, :size=>"120x120") rescue '' %>