mirror of
https://github.com/dkmstr/openuds.git
synced 2025-03-12 04:58:34 +03:00
More fixes to calendars
This commit is contained in:
parent
3814986e41
commit
1b97e2015d
@ -20,7 +20,7 @@ gui.calendars.link = ->
|
||||
'YEARLY': [gettext('year'), gettext('years'), gettext('Yearly')]
|
||||
'WEEKDAYS': ['', '', gettext('Weekdays')]
|
||||
|
||||
dunitsDct =
|
||||
dunitDct =
|
||||
'MINUTES': gettext('Minutes')
|
||||
'HOURS': gettext('Hours')
|
||||
'DAYS': gettext('Days')
|
||||
@ -45,7 +45,7 @@ gui.calendars.link = ->
|
||||
catch e
|
||||
return e
|
||||
else if fld == "duration"
|
||||
return data + " " + dunitsDct[record.duration_unit]
|
||||
return data + " " + dunitDct[record.duration_unit]
|
||||
return fld
|
||||
|
||||
newEditFnc = (rules, forEdit) ->
|
||||
@ -77,12 +77,13 @@ gui.calendars.link = ->
|
||||
api.templates.get "calendar_rule", (tmpl) ->
|
||||
content = api.templates.evaluate(tmpl,
|
||||
freqs: ( {id: key, value: val[2]} for own key, val of freqDct)
|
||||
dunits: ( {id: key, value: val} for own key, val of dunitsDct)
|
||||
dunits: ( {id: key, value: val} for own key, val of dunitDct)
|
||||
days: days
|
||||
)
|
||||
modalId = gui.launchModal((if value is null then gettext("New rule") else gettext("Edit rule") + ' <b>' + value.name + '</b>' ), content,
|
||||
actionButton: "<button type=\"button\" class=\"btn btn-success button-accept\">" + gettext("Save") + "</button>"
|
||||
)
|
||||
|
||||
$('#div-interval').show()
|
||||
$('#div-weekdays').hide()
|
||||
|
||||
@ -100,6 +101,7 @@ gui.calendars.link = ->
|
||||
|
||||
# If weekdays, set checkboxes
|
||||
$('#id-rule-freq').val(value.frequency)
|
||||
|
||||
if value.frequency == 'WEEKDAYS'
|
||||
$('#div-interval').hide()
|
||||
$('#div-weekdays').show()
|
||||
@ -115,12 +117,17 @@ gui.calendars.link = ->
|
||||
n >>= 1
|
||||
else
|
||||
$('#id-rule-interval-num').val(value.interval)
|
||||
n = if parseInt($('#id-rule-interval-num').val()) != 1 then 1 else 0
|
||||
$("#id-rule-interval-num").attr('data-postfix', freqDct[value.frequency][n])
|
||||
|
||||
|
||||
#
|
||||
# apply styles
|
||||
#
|
||||
gui.tools.applyCustoms modalId
|
||||
|
||||
# And adjust interval spinner
|
||||
|
||||
#
|
||||
# Event handlers
|
||||
#
|
||||
@ -134,8 +141,17 @@ gui.calendars.link = ->
|
||||
else
|
||||
$('#div-interval').show()
|
||||
$('#div-weekdays').hide()
|
||||
|
||||
n = if parseInt($('#id-rule-interval-num').val()) != 1 then 1 else 0
|
||||
$(modalId + ' .bootstrap-touchspin-postfix').html(freqDct[$this.val()][n])
|
||||
return
|
||||
|
||||
$('#id-rule-interval-num').on 'change', () ->
|
||||
n = if parseInt($('#id-rule-interval-num').val()) != 1 then 1 else 0
|
||||
$(modalId + ' .bootstrap-touchspin-postfix').html(freqDct[$('#id-rule-freq').val()][n])
|
||||
return
|
||||
|
||||
|
||||
# Save
|
||||
$(modalId + " .button-accept").click ->
|
||||
|
||||
|
@ -108,12 +108,17 @@
|
||||
# Activate Touchspinner
|
||||
$.each $(selector + " input[type=numeric]:not([readonly])"), (index, tspn) ->
|
||||
$tspn = $(tspn)
|
||||
postfix = $tspn.attr("data-postfix")
|
||||
if postfix is undefined
|
||||
postfix = ''
|
||||
|
||||
minVal = parseInt $tspn.attr("data-minval")
|
||||
maxVal = parseInt $tspn.attr("data-maxval")
|
||||
if minVal == 987654321
|
||||
minVal = -999999
|
||||
if maxVal == 987654321
|
||||
maxVal = 999999
|
||||
|
||||
gui.doLog minVal
|
||||
$tspn.attr("type", "text")
|
||||
$tspn.TouchSpin
|
||||
@ -122,6 +127,7 @@
|
||||
verticaldownclass: 'glyphicon glyphicon-minus'
|
||||
min: minVal
|
||||
max: maxVal
|
||||
postfix: postfix
|
||||
decimals: 0
|
||||
|
||||
# TEST: cooler on mobile devices
|
||||
|
@ -2,103 +2,102 @@
|
||||
{% image_size as size %}
|
||||
<form class="form-horizontal">
|
||||
<fieldset>
|
||||
<legend class="col-sm-offset-3 col-sm-9">{% trans 'Name' %}</legend>
|
||||
<div class="form-group">
|
||||
<label for="id-rule-name" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Name of this rule'%}">{% trans 'Name' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<input id="id-rule-name" name="rule_name" type="text" class="form-control" placeholder="{% trans 'Rule name' %}" autofocus required>
|
||||
<legend class="col-sm-offset-3 col-sm-9">{% trans 'Name' %}</legend>
|
||||
<div class="form-group">
|
||||
<label for="id-rule-name" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Name of this rule'%}">{% trans 'Name' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<input id="id-rule-name" name="rule_name" type="text" class="form-control" placeholder="{% trans 'Rule name' %}" autofocus required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="id-rule-comments" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Comments for this rule'%}">{% trans 'Comments' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<input id="id-rule-comments" name="rule_comments" type="text" class="form-control" placeholder="{% trans 'Rule comments' %}" autofocus required>
|
||||
<div class="form-group">
|
||||
<label for="id-rule-comments" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Comments for this rule'%}">{% trans 'Comments' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<input id="id-rule-comments" name="rule_comments" type="text" class="form-control" placeholder="{% trans 'Rule comments' %}" autofocus required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend class="col-sm-offset-3 col-sm-9">{% trans 'Event' %}</legend>
|
||||
<div class="form-group">
|
||||
<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="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">
|
||||
<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<fieldset>
|
||||
<legend class="col-sm-offset-3 col-sm-9">{% trans 'Event' %}</legend>
|
||||
<div class="form-group">
|
||||
<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="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">
|
||||
<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="id-rule-duration" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Duration for this rule'%}">{% trans 'Duration' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="row">
|
||||
<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>
|
||||
</div>
|
||||
<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>
|
||||
{% verbatim %}{{#each dunits}}
|
||||
<option value="{{ id }}">{{ value }}</option>
|
||||
{{/each}}{% endverbatim %}
|
||||
</select>
|
||||
<div class="form-group">
|
||||
<label for="id-rule-duration" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Duration for this rule'%}">{% trans 'Duration' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="row">
|
||||
<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>
|
||||
</div>
|
||||
<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>
|
||||
{% verbatim %}{{#each dunits}}
|
||||
<option value="{{ id }}">{{ value }}</option>
|
||||
{{/each}}{% endverbatim %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend class="col-sm-offset-3 col-sm-9">{% trans 'Repeat' %}</legend>
|
||||
<div class="form-group">
|
||||
<label for="id-rule-start" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Starting date for repeating'%}">{% trans 'Starts' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group date">
|
||||
<input type="date" required placeholder="starting date for rule" id="id-rule-start" name="rule_start_date" class="form-control modal_field_data " aria-required="true"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
|
||||
<legend class="col-sm-offset-3 col-sm-9">{% trans 'Repeat' %}</legend>
|
||||
<div class="form-group">
|
||||
<label for="id-rule-start" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Starting date for repeating'%}">{% trans 'Starts' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group date">
|
||||
<input type="date" required placeholder="starting date for rule" id="id-rule-start" name="rule_start_date" 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 class="form-group">
|
||||
<label for="id-rule-end" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'End date'%}">{% trans 'Ends' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="id-rule-freq" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Frequency for this rule'%}">{% trans 'Repeats' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="selectpicker show-menu-arrow show-tick" name="rule_frequency" data-style="btn-default" data-width="100%" id="id-rule-freq" required>
|
||||
{% verbatim %}{{#each freqs}}
|
||||
<option value="{{ id }}">{{ value }}</option>
|
||||
{{/each}}{% endverbatim %}
|
||||
</select>
|
||||
<div class="form-group">
|
||||
<label for="id-rule-end" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'End date'%}">{% trans 'Ends' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="div-interval">
|
||||
<label for="id-rule-interval-num" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Repeat interval for this rule'%}">{% trans 'Repeat every' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<input id="id-rule-interval-num" value="1" name="rule_interval" type="numeric" data-minval="0" class="form-control" placeholder="{% trans 'Repeat interval for rule' %}" autofocus required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="div-weekdays">
|
||||
<label class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Weekdays for this rule'%}">{% trans 'Repeat on' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="btn-group" data-toggle="buttons">
|
||||
{% verbatim %}{{#each days}}
|
||||
<label class="btn btn-default">
|
||||
<input type="checkbox" name="wd_{{ this }}" id="rule-wd-{{ this }}" basic="true" autocomplete="off">{{ this }}
|
||||
</label>
|
||||
{{/each}}{% endverbatim %}
|
||||
<div class="form-group">
|
||||
<label for="id-rule-freq" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Frequency for this rule'%}">{% trans 'Repeats' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="selectpicker show-menu-arrow show-tick" name="rule_frequency" data-style="btn-default" data-width="100%" id="id-rule-freq" required>
|
||||
{% verbatim %}{{#each freqs}}
|
||||
<option value="{{ id }}">{{ value }}</option>
|
||||
{{/each}}{% endverbatim %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-group has-feedback" id="div-interval">
|
||||
<label for="id-rule-interval-num" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Repeat interval for this rule'%}">{% trans 'Repeat every' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<input id="id-rule-interval-num" value="1" data-postfix="Days" name="rule_interval" type="numeric" data-minval="0" class="form-control" placeholder="{% trans 'Repeat interval for rule' %}" autofocus required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="div-weekdays">
|
||||
<label class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'Weekdays for this rule'%}">{% trans 'Repeat on' %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="btn-group" data-toggle="buttons">
|
||||
{% verbatim %}{{#each days}}
|
||||
<label class="btn btn-default">
|
||||
<input type="checkbox" name="wd_{{ this }}" id="rule-wd-{{ this }}" basic="true" autocomplete="off">{{ this }}
|
||||
</label>
|
||||
{{/each}}{% endverbatim %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
Loading…
x
Reference in New Issue
Block a user