From ffc825089b925ca94e2c0c194aa9883170587ca6 Mon Sep 17 00:00:00 2001 From: echarp Date: Wed, 16 Jul 2014 22:29:07 +0200 Subject: [PATCH] La gestion des datetime_local redevient simple et logiqu, avant ajout de shims javascript --- Gemfile.lock | 6 +++--- app/controllers/events_controller.rb | 2 ++ app/views/events/_form.html.haml | 8 ++------ config/locales/fr.yml | 1 - 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7b2a690a..4fa45f26 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/gregbell/active_admin.git - revision: 168d72e7f5d705cd25373775db2c9efd910b7a95 + revision: 9cfc45330e5ad31977b3ac7b2ccc1f8d6146c73f specs: activeadmin (1.0.0.pre) arbre (~> 1.0) @@ -149,7 +149,7 @@ GEM inherited_resources (1.4.1) has_scope (~> 0.6.0.rc) responders (~> 1.0.0.rc) - jbuilder (2.1.2) + jbuilder (2.1.3) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) jquery-rails (3.1.1) @@ -268,7 +268,7 @@ GEM thread_safe (0.3.4) tilt (1.4.1) timers (1.1.0) - tinymce-rails (4.1.0) + tinymce-rails (4.1.2) railties (>= 3.1.1) tinymce-rails-langs (4.20140129) tinymce-rails (~> 4.0) diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 99317be2..5b6090d7 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -39,6 +39,8 @@ class EventsController < ApplicationController # GET /users/new def new @event = Event.new + @event.start_time ||= Time.now.change(min: 0) + 1.day + 1.hour + @event.end_time ||= Time.now.change(min: 0) + 1.day + 2.hour end # POST /events diff --git a/app/views/events/_form.html.haml b/app/views/events/_form.html.haml index 0f9ac0e9..be4cdcd4 100644 --- a/app/views/events/_form.html.haml +++ b/app/views/events/_form.html.haml @@ -24,14 +24,10 @@ = f.text_field :title, required: true, size: 70 .field = f.label :start_time - = f.datetime_local_field :start_time, required: true, size: 14, - value: l(@event.start_time || Time.now + 1.day + 1.hour - Time.now.min.minutes, format: :manual), - placeholder: t('time.formats.manual') + = f.datetime_local_field :start_time, required: true .field = f.label :end_time - = f.datetime_local_field :end_time, required: true, size: 14, - value: l(@event.end_time || Time.now + 1.day + 2.hour - Time.now.min.minutes, format: :manual), - placeholder: t('time.formats.manual') + = f.datetime_local_field :end_time, required: true .field .helper :markdown diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 28a6121b..dd3421d6 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -91,7 +91,6 @@ fr: formats: at: "%A %d %B %Y à %Hh%M" hours: "%Hh%M" - manual: "%d/%m/%Y %H:%M" # Traductions des écrans layouts: