Small fixes

This commit is contained in:
Yuki 2015-04-24 00:51:58 +05:30
parent 4d5d7fdcc1
commit 0bb3895ce8
3 changed files with 7 additions and 5 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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