From 4d5d7fdcc101a7c67191dd13d52a5af395536e57 Mon Sep 17 00:00:00 2001 From: Yuki Date: Fri, 24 Apr 2015 00:37:39 +0530 Subject: [PATCH] Bootstrap-datetimepicker --- Gemfile | 3 ++- Gemfile.lock | 6 ++++++ app/assets/javascripts/moderation.js.erb.coffee | 2 ++ app/assets/javascripts/moderation/ban.coffee | 12 ++++++++++++ app/assets/stylesheets/application.css.scss | 7 +++++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 9c48ce5a..f966887f 100644 --- a/Gemfile +++ b/Gemfile @@ -33,6 +33,8 @@ gem 'font-awesome-rails', '~> 4.3.0.0' gem 'rails-assets-growl' gem "paperclip", "~> 4.2" gem 'delayed_paperclip' +gem 'momentjs-rails', '>= 2.9.0' +gem 'bootstrap3-datetimepicker-rails', '~> 4.7.14' gem 'ruby-progressbar' @@ -78,4 +80,3 @@ group :development, :test do gem 'simplecov-rcov', require: false gem 'database_cleaner' end - diff --git a/Gemfile.lock b/Gemfile.lock index e5e5c83a..b94af2ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -48,6 +48,8 @@ GEM bcrypt (3.1.10) bootstrap-sass (3.2.0.2) sass (~> 3.2) + bootstrap3-datetimepicker-rails (4.7.14) + momentjs-rails (>= 2.8.1) bootstrap_form (2.3.0) bootswatch-rails (3.2.4) railties (>= 3.1) @@ -149,6 +151,8 @@ GEM mime-types (2.4.3) mini_portile (0.6.2) minitest (5.6.0) + momentjs-rails (2.9.0) + railties (>= 3.1) multi_json (1.11.0) multipart-post (2.0.0) mysql2 (0.3.18) @@ -362,6 +366,7 @@ PLATFORMS DEPENDENCIES bcrypt (~> 3.1.7) bootstrap-sass (~> 3.2.0.1) + bootstrap3-datetimepicker-rails (~> 4.7.14) bootstrap_form bootswatch-rails capybara @@ -380,6 +385,7 @@ DEPENDENCIES jbuilder (~> 2.2.4) jquery-rails jquery-turbolinks + momentjs-rails (>= 2.9.0) mysql2 nprogress-rails omniauth diff --git a/app/assets/javascripts/moderation.js.erb.coffee b/app/assets/javascripts/moderation.js.erb.coffee index dd1af163..60eefeaf 100644 --- a/app/assets/javascripts/moderation.js.erb.coffee +++ b/app/assets/javascripts/moderation.js.erb.coffee @@ -1 +1,3 @@ +#= require moment +#= require bootstrap-datetimepicker #= require_tree ./moderation diff --git a/app/assets/javascripts/moderation/ban.coffee b/app/assets/javascripts/moderation/ban.coffee index 30e0cd61..4e90d5b8 100644 --- a/app/assets/javascripts/moderation/ban.coffee +++ b/app/assets/javascripts/moderation/ban.coffee @@ -13,6 +13,18 @@ $(document).on "DOMContentLoaded", -> else $("#ban-controls-time").show() + $("#until").addClass("remove-native-picker").datetimepicker + icons: + time: "fa fa-clock-o" + date: "fa fa-calendar" + up: "fa fa-chevron-up" + down: "fa fa-chevron-down" + previous: "fa fa-chevron-left" + next: "fa fa-chevron-right" + today: "fa fa-home" + clear: "fa fa-trash-o" + close: "fa fa-times" + parent.parent()[0].addEventListener "submit", (event) -> event.preventDefault(); diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 1f1549fd..dff05d54 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -45,7 +45,14 @@ $navbar-inverse-toggle-border-color: #512da8; @import "bootswatch/cosmo/variables"; @import "bootstrap"; + body { padding-top: $navbar-height; } + +@import 'bootstrap-datetimepicker'; +.remove-native-picker::-webkit-calendar-picker-indicator{ + display: none +} + @import "bootswatch/cosmo/bootswatch"; @import "base";