jquery - bootstrap datepicker rails gem is not working -
i don't understand why datepicker gem not working. here code of app:
here gemfile:
source 'https://rubygems.org' git_source(:github) |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end # bundle edge rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.3' # use sqlite3 database active record gem 'devise' gem 'milia', github: 'jekuno/milia', ref: '05b72dd' gem 'aws-sdk' gem 'stripe' # use puma app server gem 'puma', '~> 3.7' # use scss stylesheets gem 'sass-rails', '~> 5.0' # use uglifier compressor javascript assets gem 'uglifier', '>= 1.3.0' # see https://github.com/rails/execjs#readme more supported runtimes # gem 'therubyracer', platforms: :ruby # use coffeescript .coffee assets , views gem 'coffee-rails', '~> 4.2' # turbolinks makes navigating web application faster. read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # build json apis ease. read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' gem 'jquery-rails' gem 'twitter-bootstrap-rails' gem 'devise-bootstrap-views' gem 'bootstrap-datepicker-rails' gem 'certified' # use redis adapter run action cable in production # gem 'redis', '~> 3.0' # use activemodel has_secure_password # gem 'bcrypt', '~> 3.1.7' # use capistrano deployment # gem 'capistrano-rails', group: :development group :development, :test gem 'sqlite3' # call 'byebug' anywhere in code stop execution , debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] # adds support capybara system testing , selenium driver gem 'capybara', '~> 2.13' gem 'selenium-webdriver' end group :development # access irb console on exception pages or using <%= console %> anywhere in code. gem 'web-console', '>= 3.3.0' end # windows not include zoneinfo files, bundle tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] gem 'activerecord-session_store', github: 'rails/activerecord-session_store'
here application.css file:
/* * manifest file that'll compiled application.css, include files * listed below. * * css , scss file within directory, lib/assets/stylesheets, or plugin's * vendor/assets/stylesheets directory can referenced here using relative path. * * you're free add application-wide styles file , they'll appear @ bottom of * compiled file styles add here take precedence on styles defined in other css/scss * files in directory. styles in file should added after last require_* statement. * better create new file per style scope. * *= require devise_bootstrap_views *= require bootstrap-datepicker3 *= require_tree . *= require_self */
here application.js file:
// manifest file that'll compiled application.js, include files // listed below. // // javascript/coffee file within directory, lib/assets/javascripts, or plugin's // vendor/assets/javascripts directory can referenced here using relative path. // // it's not advisable add code directly here, if do, it'll appear @ bottom of // compiled file. javascript code in file should added after last require_* statement. // // read sprockets readme (https://github.com/rails/sprockets#sprockets-directives) details // supported directives. // //= require rails-ujs //= require jquery //= require jquery_ujs //= require twitter/bootstrap //= require bootstrap-datepicker //= require turbolinks //= require_tree .
here datepicker.js file:
$(document).ready(function(){ $(function() { $('.datepicker').datepicker({format: 'yyyy-mm-dd'}); }); });
here snippet of _form.html.erb file:
</div> <div class="form-group"> <%= f.label :expected_completion_date, :class => 'control-label col-lg-2' %> <div class="col-lg-10"> <%= f.text_field :expected_completion_date, :class => 'form-control datepicker' %> </div>
i did everything, don't know why datepicker gem not working.. there mistake made there.. if plz correct me , help..
Comments
Post a Comment