* Fixed time picker not working on chrome

* Added warn on service being replaced by new publication
This commit is contained in:
Adolfo Gómez García 2016-05-20 09:37:12 +02:00
parent ba4eeffc77
commit 2d14884454
6 changed files with 31 additions and 27 deletions

View File

@ -61,7 +61,7 @@ from datetime import datetime, timedelta
import logging import logging
import pickle import pickle
__updated__ = '2016-05-19' __updated__ = '2016-05-20'
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -195,8 +195,8 @@ class DeployedService(UUIDModel, TaggingMixin):
def toBeReplaced(self): def toBeReplaced(self):
# return datetime.now() # return datetime.now()
activePub = self.activePublication() activePub = self.activePublication()
if activePub is None or activePub.revision == self.current_pub_revision - 1: # if activePub is None or activePub.revision == self.current_pub_revision - 1:
return None # return None
# Return the date # Return the date
ret = self.recoverValue('toBeReplacedIn') ret = self.recoverValue('toBeReplacedIn')

View File

@ -1,7 +1,7 @@
/*! /*!
* Timepicker Component for Twitter Bootstrap * Timepicker Component for Twitter Bootstrap
* *
* Copyright 2013 Joris de Wit * Copyright 2013 Joris de Wit and bootstrap-timepicker contributors
* *
* Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors * Contributors https://github.com/jdewit/bootstrap-timepicker/graphs/contributors
* *
@ -174,10 +174,12 @@
case 9: //tab case 9: //tab
if (e.shiftKey) { if (e.shiftKey) {
if (this.highlightedUnit === 'hour') { if (this.highlightedUnit === 'hour') {
this.hideWidget();
break; break;
} }
this.highlightPrevUnit(); this.highlightPrevUnit();
} else if ((this.showMeridian && this.highlightedUnit === 'meridian') || (this.showSeconds && this.highlightedUnit === 'second') || (!this.showMeridian && !this.showSeconds && this.highlightedUnit ==='minute')) { } else if ((this.showMeridian && this.highlightedUnit === 'meridian') || (this.showSeconds && this.highlightedUnit === 'second') || (!this.showMeridian && !this.showSeconds && this.highlightedUnit ==='minute')) {
this.hideWidget();
break; break;
} else { } else {
this.highlightNextUnit(); this.highlightNextUnit();
@ -887,7 +889,7 @@
} else { } else {
if (hour >= this.maxHours) { if (hour >= this.maxHours) {
hour = this.maxHours - 1; hour = this.maxHours - 1;
} else if (hour < 0) { } else if ((hour < 0) || (hour === 12 && timeMode === 1)){
hour = 0; hour = 0;
} }
} }

View File

@ -18,11 +18,11 @@
selector = selector or "" selector = selector or ""
selector += " .btn3d" selector += " .btn3d"
$.each $(selector), (index, value) -> $.each $(selector), (index, value) ->
# If no events associated, return # If no events associated, return
$this = $(@) $this = $(@)
clkEvents = [] clkEvents = []
# Store old click events, so we can reconstruct click chain later # Store old click events, so we can reconstruct click chain later
try try
$.each $._data(value, "events").click, (index, fnc) -> $.each $._data(value, "events").click, (index, fnc) ->
@ -32,20 +32,20 @@
return return
$this.unbind "click" $this.unbind "click"
# If Mousedown registers a temporal mouseUp event on parent, to lauch button click # If Mousedown registers a temporal mouseUp event on parent, to lauch button click
$this.mousedown (event) -> $this.mousedown (event) ->
$("body").mouseup (e) -> $("body").mouseup (e) ->
# Remove temporal mouseup handler # Remove temporal mouseup handler
$(this).unbind "mouseup" $(this).unbind "mouseup"
# If movement of mouse is not too far... (16 px maybe well for 3d buttons?) # If movement of mouse is not too far... (16 px maybe well for 3d buttons?)
x = event.pageX - e.pageX x = event.pageX - e.pageX
y = event.pageY - e.pageY y = event.pageY - e.pageY
dist_square = x * x + y * y dist_square = x * x + y * y
if dist_square < 16 * 16 if dist_square < 16 * 16
# Register again old event handlers # Register again old event handlers
$.each clkEvents, (index, fnc) -> $.each clkEvents, (index, fnc) ->
$this.click fnc.handler $this.click fnc.handler
@ -62,7 +62,7 @@
return return
applyCustoms: (selector) -> applyCustoms: (selector) ->
# Activate "custom" styles # Activate "custom" styles
$.each $(selector + " input:checkbox"), (index, tspn) -> $.each $(selector + " input:checkbox"), (index, tspn) ->
$tspn = $(tspn) $tspn = $(tspn)
@ -89,12 +89,14 @@
$tspn.parent().datepicker options $tspn.parent().datepicker options
# timepicker # timepicker
$.each $(selector + " input[type=time]:not([readonly])"), (index, tspn) -> $.each $(selector + " input[type=udstime]:not([readonly])"), (index, tspn) ->
$tspn = $(tspn) $tspn = $(tspn)
opts = opts =
showMeridian: false showMeridian: false
defaultTime: false defaultTime: false
$tspn.attr("type", "text")
$tspn.timepicker opts $tspn.timepicker opts
# Activate "cool" selects # Activate "cool" selects
@ -129,10 +131,10 @@
max: maxVal max: maxVal
postfix: postfix postfix: postfix
decimals: 0 decimals: 0
# TEST: cooler on mobile devices # TEST: cooler on mobile devices
$(selector + " .selectpicker").selectpicker "mobile" if /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) $(selector + " .selectpicker").selectpicker "mobile" if /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)
# Activate tooltips # Activate tooltips
$(selector + " [data-toggle=\"tooltip\"]").tooltip $(selector + " [data-toggle=\"tooltip\"]").tooltip
delay: delay:
@ -141,12 +143,12 @@
placement: "auto right" placement: "auto right"
# Fix 3d buttons # Fix 3d buttons
gui.tools.fix3dButtons selector gui.tools.fix3dButtons selector
return return
# Datetime renderer (with specified format) # Datetime renderer (with specified format)
renderDate: (format) -> renderDate: (format) ->
(data, type, full) -> (data, type, full) ->
@ -157,7 +159,7 @@
val = api.tools.strftime(format, new Date(data * 1000)) val = api.tools.strftime(format, new Date(data * 1000))
return "<span data-date=\"" + data + "\">" + val + "</span>" return "<span data-date=\"" + data + "\">" + val + "</span>"
# Log level rendererer # Log level rendererer
renderLogLovel: -> renderLogLovel: ->
levels = levels =

View File

@ -24,10 +24,10 @@
<label for="id-rule-start-time" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Starting hour'%}">{% trans 'Starting hour' %}</label> <label for="id-rule-start-time" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Starting hour'%}">{% trans 'Starting hour' %}</label>
<div class="col-sm-9"> <div class="col-sm-9">
<div class="input-group bootstrap-timepicker timepicker"> <div class="input-group bootstrap-timepicker timepicker">
<input type="time" value="00:00" id="id-rule-start-time" name="rule_start_time" class="form-control input-small"> <input type="udstime" value="00:00" id="id-rule-start-time" name="rule_start_time" class="form-control input-small">
<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span> <span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -35,7 +35,7 @@
<div class="col-sm-9"> <div class="col-sm-9">
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<input id="id-rule-duration" name="rule_duration" type="numeric" value="0" data-minval="0" class="form-control" autofocus required> <input id="id-rule-duration" name="rule_duration" type="numeric" value="0" data-minval="0" class="form-control" autofocus required>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<select class="selectpicker show-menu-arrow show-tick" name="rule_duration_unit" data-style="btn-default" data-width="100%" id="id-rule-duration-unit" required> <select class="selectpicker show-menu-arrow show-tick" name="rule_duration_unit" data-style="btn-default" data-width="100%" id="id-rule-duration-unit" required>
@ -66,7 +66,7 @@
<div class="input-group date"> <div class="input-group date">
<input type="date" required placeholder="Never" id="id-rule-end" name="rule_end_date" clear="true" class="form-control modal_field_data " aria-required="true"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span> <input type="date" required placeholder="Never" id="id-rule-end" name="rule_end_date" clear="true" class="form-control modal_field_data " aria-required="true"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">

View File

@ -44,7 +44,7 @@ from uds.services.OVirt.OVirtProvider import Provider as oVirtProvider
import logging import logging
import os import os
__updated__ = '2016-04-18' __updated__ = '2016-05-19'
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -52,7 +52,7 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
__updated__ = '2016-05-19' __updated__ = '2016-05-20'
def about(request): def about(request):
@ -174,7 +174,7 @@ def index(request):
tbr = svr.toBeReplaced() tbr = svr.toBeReplaced()
if tbr is not None: if tbr is not None:
tbr = formats.date_format(tbr, "SHORT_DATETIME_FORMAT") tbr = formats.date_format(tbr, "SHORT_DATETIME_FORMAT")
tbrt = ugettext('This service is about to be replaced by a new version. Please, close the session & save all your work to avoid loosing it.<br>This action will be executed at {}').format(tbr) tbrt = ugettext('This service is about to be replaced by a new version. Please, close the session before {} and save all your work to avoid loosing it.').format(tbr)
else: else:
tbrt = '' tbrt = ''