Merge branch 'staging'

This commit is contained in:
Xavier J 2016-09-22 11:31:48 +02:00
commit 49751fa100
7 changed files with 21 additions and 9 deletions

View file

@ -92,6 +92,8 @@ gem "maruku" # for Markdown support in apipie
gem 'openstack' gem 'openstack'
gem 'browser'
group :test do group :test do
gem 'capybara' gem 'capybara'
gem 'factory_girl' gem 'factory_girl'

View file

@ -84,6 +84,7 @@ GEM
sass (~> 3.0) sass (~> 3.0)
slim (>= 1.3.6, < 4.0) slim (>= 1.3.6, < 4.0)
terminal-table (~> 1.4) terminal-table (~> 1.4)
browser (2.2.0)
builder (3.2.2) builder (3.2.2)
byebug (5.0.0) byebug (5.0.0)
columnize (= 0.9.0) columnize (= 0.9.0)
@ -627,6 +628,7 @@ DEPENDENCIES
bootstrap-sass (~> 3.3.5) bootstrap-sass (~> 3.3.5)
bootstrap-wysihtml5-rails (~> 0.3.3.8) bootstrap-wysihtml5-rails (~> 0.3.3.8)
brakeman brakeman
browser
byebug byebug
capybara capybara
carrierwave carrierwave

View file

@ -111,16 +111,16 @@
@extend .col-lg-2; @extend .col-lg-2;
input[type='date'] { input[type='date'] {
width: 120px; width: 160px;
} }
} }
.type_champ-datetime { .type_champ-datetime {
@extend .col-md-4; @extend .col-md-5;
@extend .col-lg-4; @extend .col-lg-5;
input[type='datetime'] { input[type='datetime'] {
width: 120px; width: 160px;
} }
} }

View file

@ -2,9 +2,14 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception. # Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead. # For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception protect_from_forgery with: :exception
before_filter :check_browser
def default_url_options def default_url_options
return { protocol: 'https' } if Rails.env.staging? || Rails.env.production? return { protocol: 'https' } if Rails.env.staging? || Rails.env.production?
{} {}
end end
def check_browser
BROWSER.value = Browser.new(request.user_agent)
end
end end

View file

@ -9,7 +9,7 @@ class Champ < ActiveRecord::Base
end end
def data_provide def data_provide
return 'datepicker' if type_champ == 'datetime' || type_champ == 'date' return 'datepicker' if (type_champ == 'datetime' || type_champ == 'date') && !BROWSER.value.chrome?
return 'typeahead' if type_champ == 'address' return 'typeahead' if type_champ == 'address'
end end

View file

@ -0,0 +1,3 @@
BROWSER = Hashie::Mash.new ({
value: nil
})