How to configure locale for all Fields and Inputs globally? - admin-on-rest

If I need to change the locale of a DateField or a DateInput I have to do it like that:
<DateField locales="el-GR"/>
and
<DateInput options={{locale: 'el'}}/>
Is it possible to configure all DateField/DateInput locales globally in a single place. I tried through
and it just translates labels and doesn't change how dates for example appear. Also I want how dates are shown to be independent of the translation language.
Thanks!

A custom DateInput which would just reexport the default one with your own default props should the trick. Same for DateField

Related

Remove header/filter-button columns from Telerik UI RadDataGrid

Much what the title says. When creating a RadDataGrid using TelerikUI in Xamarin.Forms, we get a "header column".
I know the style of can be set via the HeaderStyle property, and the text itself can be hidden by setting HeaderText to an empty string, but how do we actually remove the row of columns itself? Is this possible, with or without custom renderers?
We've tried setting the HeaderStyle to different attributes in hope that it'll fix it (hidden, collapsed etc), we've also tried emptying different properties/tags to try to achieve something similar to CSS's display: none but nothing has given us results as of yet. Any and all help appreciated!
Thanks.
If you want to hide the dots, you can set the Header Style:
<telerikDataGrid:DataGridTextColumn PropertyName="Country">
<telerikDataGrid:DataGridTextColumn.HeaderStyle>
<telerikDataGrid:DataGridColumnHeaderStyle OptionsButtonTextColor="Transparent"
BorderColor="#D9D9D9"
BorderThickness="1"/>
</telerikDataGrid:DataGridTextColumn.HeaderStyle>
</telerikDataGrid:DataGridTextColumn>
In addition, if you don't use any sorting or filtering, you can disable it through these properties
UserGroupMode="Disabled"
UserFilterMode="Disabled"
UserSortMode="None"

How to change field value font styles in ServiceNow?

Is it possible to change field value font styles on OnLoad in servicenow ? I was able to change field label styles using below code.
// Custom field label colors
var stateLabel = g_form.getLabel('short_description');
stateLabel.style.color= 'red';
stateLabel.style.fontWeight='bold';
I tried to change field value font styles in similar way but no luck.
var stateValue = g_form.getValue('short_description');
stateValue.style.color= 'red';
stateValue.style.fontWeight='bold';
above code does not do any good , any thoughts on getting this to work?
Thanks in advance
The API call you're using g_form.getValue(...) is just going to return the string value of whatever field you're asking for.
To get access to the Element (like with getLabel) you can use g_form.getControl(...)
Example:
var el = g_form.getControl('short_description');
el.style.color = 'red';
el.style.fontWeight = 'bold';
However, I'd advise that instead of doing direct DOM manipulation with client-side javascript, that you use Field Styles instead:
Field styles allow administrators to declare individual CSS styles for
a field in a list or form. The CSS can:
Change the color.
Change the font attributes (bold, italics, underline).
Change the padding and alignment of text.
Field Styles allow you to specify a particular field, and apply arbitrary CSS.
To take it a step further, it even allows you to specify javascript to conditionally apply the Style based on something like the state of the record.
I would advise you to look at the VIP Callers on the Incident form, the field value color is sat to Red when the Caller.VIP = True
if this is your requirement, I would be happy to look it up for you.

How can I change the title ckeditor sets for inline instances?

Right now it sets it to Rich text editor, element_id. Is there any way to change that?
In ckeditor.js search for the following string:
a.changeAttr("title",c)
And justs set it to an empty string if you want:
a.changeAttr("title",'');
Keep In mind, you'll lose this during an update, but this is the only way until they add it to their editable configurations. Only use this if you don't mind losing some a11y.
This title is set in CKEDITOR.editable. You can change it by:
modifying this code,
changing translation in lang/<your lang>.js (e.g. https://github.com/ckeditor/ckeditor-dev/blob/master/lang/en-gb.js#L30)
But when you'll modify it, remember that this title is there to provide a11y.

Django modelform and CSS styling

I'm using modelforms to generate forms.
wiek = models.PositiveIntegerField(verbose_name="Wiek")
Is there a way to assign CSS style to it? I don't want to create html for forms because it is too much work (complex forms). I want to generate them from models, but I want to style it too. How to create seperate CSS for each form?
Thanks for answer in advance
Well,
option 1:
probably you have code like this:
<form action=.......
{{form.as_something}}
</form>
If so, you can assign some special class to each <form> tag and than style it as you want.
option2:
if you need to style each field independently you can use fact that Django by default uses id_name_of_field conevention to name fields ids. So you can use #id_name_of_field in your css to style particular field.
option3:
in model form you can assign some attributes to each field's widget like:
self.fields['wiek'].widget.attrs['class'] = 'some-class'

Can the behaviour of new HTML5 form types be overridden?

I was wondering if anyone knew if it were possible to override the default behaviour of browsers that support the new HTML input types such as type="email" and type="date"?
I appreciate that I could test if a browser supports an input type and provide a fallback for those browsers that don't, but what I want to know is is there any way to prevent that default behaviour from happening in browsers that do support it?
For instance, if in Opera I want to use the date input type, but I don't want Opera to display the native datepicker (i.e. I want to replace it with my own custom one) is that possible? Are there any DOM events triggered like onDatePickerShow that one can hook into?
I don't believe that this is possible, but if anyone knows for sure one way or the other I would love to hear from you.
input type=date without datepicker is almost the same as input type=text. If you want to keep validation, then you might use pattern attribute instead.
There's no way to customize look'n'feel of the standard date picker. There are no events for the picker. Spec doesn't define any UI for pickers. Consider how wildly different pickers can be – compare one you get on desktop with picker on the iPhone.
In the future CSS might get pseudo-classes for some customizations of date picker (and file picker), but currently it's all-or-nothing.
Disable validation of HTML5 form elements
If you add a novalidate attribute, then for example you can enter an email without an #
This only seems to disable the client side HTML5 validation.

Resources