From 0bb3895ce8151c93c81f5f7f5b1d26ce1f90bfda Mon Sep 17 00:00:00 2001 From: Yuki Date: Fri, 24 Apr 2015 00:51:58 +0530 Subject: [PATCH] Small fixes --- app/assets/javascripts/moderation/ban.coffee | 8 +++++--- app/controllers/ajax/moderation_controller.rb | 2 +- app/views/user/_modal_ban.html.haml | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/moderation/ban.coffee b/app/assets/javascripts/moderation/ban.coffee index 4e90d5b8..87ec6555 100644 --- a/app/assets/javascripts/moderation/ban.coffee +++ b/app/assets/javascripts/moderation/ban.coffee @@ -13,7 +13,9 @@ $(document).on "DOMContentLoaded", -> else $("#ban-controls-time").show() - $("#until").addClass("remove-native-picker").datetimepicker + parent.find("#until").datetimepicker + defaultDate: parent.find("#until").val() + sideBySide: true icons: time: "fa fa-clock-o" date: "fa fa-calendar" @@ -39,8 +41,8 @@ $(document).on "DOMContentLoaded", -> data = { ban: checktostr "#_ban" permaban: checktostr "#_permaban" - until: $("#until")[0].value - reason: $("#reason")[0].value + until: $("#until")[0].value.trim() + reason: $("#reason")[0].value.trim() user: $("#_user")[0].value } diff --git a/app/controllers/ajax/moderation_controller.rb b/app/controllers/ajax/moderation_controller.rb index 9d149ead..82b438af 100644 --- a/app/controllers/ajax/moderation_controller.rb +++ b/app/controllers/ajax/moderation_controller.rb @@ -119,7 +119,7 @@ class Ajax::ModerationController < ApplicationController unban = params[:ban] == "0" perma = params[:permaban] == "1" - buntil = DateTime.strptime params[:until], "%Y-%m-%dT%H:%M" unless unban or perma + buntil = DateTime.strptime params[:until], "%m/%d/%Y %I:%M %p" unless unban or perma if not unban and target.admin? @status = :nopriv diff --git a/app/views/user/_modal_ban.html.haml b/app/views/user/_modal_ban.html.haml index 2794baf9..cdfb1fb8 100644 --- a/app/views/user/_modal_ban.html.haml +++ b/app/views/user/_modal_ban.html.haml @@ -14,7 +14,7 @@ #ban-controls{style: "#{"display: none" unless @user.banned?}"} = f.check_box :permaban, label: "Permanently?", checked: @user.permanently_banned? #ban-controls-time{style: "#{"display: none" unless not @user.permanently_banned?}"} - = f.datetime_local_field :until, label: "", required: true, value: (@user.banned_until || DateTime.current).strftime("%Y-%m-%dT%H:%M") + = f.text_field :until, label: "", required: true, value: (@user.banned_until || DateTime.current).strftime("%m/%d/%Y %I:%M %p") = f.text_field :reason, placeholder: "Reason", value: @user.ban_reason .modal-footer %button.btn.btn-default{name: 'stop-time', type: :button, data: { dismiss: :modal }} Close