mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix datetime picker translations on Order cycles screen
So the thing is we initialize jQuery plugin on `admin/util.js.erb` but then we override those defaults on order_cycles.js.erb.coffe. Now both plugin initializations use the same defaults. Also added 3 missing translations for `Done`, `Now` and `Time` copies on that timepicker popover
This commit is contained in:
@@ -9,22 +9,19 @@ angular.module('admin.orderCycles', ['ngTagsInput', 'admin.indexUtils', 'admin.e
|
||||
$timeout ->
|
||||
# using $parse instead of scope[attrs.datetimepicker] for cases
|
||||
# where attrs.datetimepicker is 'foo.bar.lol'
|
||||
$(element).datetimepicker
|
||||
dateFormat: 'yy-mm-dd'
|
||||
timeFormat: 'HH:mm'
|
||||
showOn: 'button'
|
||||
controlType: 'select'
|
||||
oneLine: true
|
||||
buttonImage: "<%= asset_path 'datepicker/cal.gif' %>"
|
||||
buttonImageOnly: true
|
||||
stepMinute: 15
|
||||
onSelect: (dateText, inst) ->
|
||||
scope.$apply(->
|
||||
element.val(dateText)
|
||||
parsed = $parse(attrs.datetimepicker)
|
||||
parsed.assign(scope, dateText)
|
||||
)
|
||||
|
||||
$(element).datetimepicker(
|
||||
Object.assign(
|
||||
window.JQUERY_UI_DATETIME_PICKER_DEFAULTS,
|
||||
{
|
||||
onSelect: (dateText, inst) ->
|
||||
scope.$apply(->
|
||||
element.val(dateText)
|
||||
parsed = $parse(attrs.datetimepicker)
|
||||
parsed.assign(scope, dateText)
|
||||
)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
.directive 'ofnOnChange', ->
|
||||
(scope, element, attrs) ->
|
||||
|
||||
@@ -1,22 +1,30 @@
|
||||
$(document).ready(function() {
|
||||
$('.datetimepicker').datetimepicker({
|
||||
dateFormat: 'yy-mm-dd',
|
||||
timeFormat: 'HH:mm',
|
||||
$(document).ready(function(){
|
||||
window.JQUERY_UI_DATE_PICKER_DEFAULTS = {
|
||||
dateFormat: Spree.translations.date_picker,
|
||||
dayNames: Spree.translations.abbr_day_names,
|
||||
dayNamesMin: Spree.translations.abbr_day_names,
|
||||
monthNames: Spree.translations.month_names,
|
||||
prevText: Spree.translations.previous,
|
||||
nextText: Spree.translations.next,
|
||||
showOn: 'button',
|
||||
controlType: 'select',
|
||||
oneLine: true,
|
||||
showOn: 'button',
|
||||
buttonImage: "<%= asset_path 'datepicker/cal.gif' %>",
|
||||
buttonImageOnly: true,
|
||||
stepMinute: 15
|
||||
});
|
||||
});
|
||||
buttonImageOnly: true
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
window.JQUERY_UI_DATETIME_PICKER_DEFAULTS = Object.assign(
|
||||
{},
|
||||
window.JQUERY_UI_DATE_PICKER_DEFAULTS,
|
||||
{
|
||||
currentText: Spree.translations.datetime_ui_current_text,
|
||||
closeText: Spree.translations.datetime_ui_close_text,
|
||||
timeText: Spree.translations.datetime_ui_time_text,
|
||||
timeFormat: 'HH:mm',
|
||||
controlType: 'select',
|
||||
stepMinute: 15
|
||||
}
|
||||
);
|
||||
$('.datetimepicker').datetimepicker(window.JQUERY_UI_DATETIME_PICKER_DEFAULTS);
|
||||
$('a.close').click(function(event){
|
||||
event.preventDefault();
|
||||
$(this).parent().slideUp(250);
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
:loading => Spree.t(:loading),
|
||||
:month_names => I18n.t(:month_names, :scope => :date).reject(&:blank?),
|
||||
:more => Spree.t(:more),
|
||||
:datetime_ui_current_text => I18n.t('datetime_picker_ui.current_text'),
|
||||
:datetime_ui_close_text => I18n.t('datetime_picker_ui.close_text'),
|
||||
:datetime_ui_time_text => I18n.t('datetime_picker_ui.time_text'),
|
||||
:name => Spree.t(:name),
|
||||
:next => Spree.t(:next),
|
||||
:no_results => Spree.t(:no_results),
|
||||
|
||||
@@ -145,6 +145,10 @@ en:
|
||||
not_array_error: "must be an array"
|
||||
invalid_element_error: "must contain only valid integers"
|
||||
|
||||
datetime_picker_ui:
|
||||
current_text: Now
|
||||
close_text: Done
|
||||
time_text: Time
|
||||
enterprise_mailer:
|
||||
confirmation_instructions:
|
||||
subject: "Please confirm the email address for %{enterprise}"
|
||||
|
||||
Reference in New Issue
Block a user