now we can set two colors gradient for orbit bar

This commit is contained in:
Harry Bomrah 2013-12-09 20:00:22 +08:00 committed by saurabhbhatia
parent 513a8e3c20
commit 51f170589f
5 changed files with 41 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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' %>
</head>
@ -64,6 +65,16 @@
</div>
</div>
<div class="control-group">
<label class="control-label muted">Select Orbit Bar Color</label>
<div class="controls">
<input type="text" value="<%= (@site.mobile_bar_color.empty? ? '#FFFFF' : @site.mobile_bar_color[0]) %>" class="color-picker" name="site[mobile_bar_color][]" <%= (@site.mobile_bar_color.empty? ? "disabled='disabled'" : "") %> />
<input type="text" value="<%= (@site.mobile_bar_color.empty? ? '#FFFFF' : @site.mobile_bar_color[1]) %>" class="color-picker" name="site[mobile_bar_color][]" <%= (@site.mobile_bar_color.empty? ? "disabled='disabled'" : "") %> />
OR
<input type="checkbox" <%= (@site.mobile_bar_color.empty? ? "checked='checked'" : "") %> name="site[default_bar_color]" id="default_bar_color" style="margin:0 0 3px 10px;" /> Default Color
</div>
</div>
<div class="control-group">
<label class="control-label muted">Phone Number</label>
<div class="controls">
@ -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');
}
})
});
</script>
<% end %>

View File

@ -1,4 +1,8 @@
<header class="header" data-role="header" style="background-image: -webkit-linear-gradient(top, <%= @site.mobile_bar_color.first if @site.mobile_bar_color%>, <%= @site.mobile_bar_color.second if @site.mobile_bar_color%>);">
<header class="header" data-role="header" style="
background-image: -webkit-linear-gradient(top, <%= @site.mobile_bar_color.first if @site.mobile_bar_color%>, <%= @site.mobile_bar_color.second if @site.mobile_bar_color%>);
background-image: -moz-linear-gradient(top, <%= @site.mobile_bar_color.first if @site.mobile_bar_color%>, <%= @site.mobile_bar_color.second if @site.mobile_bar_color%>);
background-image: -o-linear-gradient(top, <%= @site.mobile_bar_color.first if @site.mobile_bar_color%>, <%= @site.mobile_bar_color.second if @site.mobile_bar_color%>);
">
<h1 class="openmenu">
<% if @site.mobile_icon.present?%>
<%= image_tag( @site.mobile_icon, :size=>"120x120") rescue '' %>