Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let user overwrite all calendar options #777

Merged
merged 8 commits into from
Jul 24, 2019
Merged

Conversation

FabulousGee
Copy link
Contributor

User will be able to overwrite all options mentioned here ( https://github.com/mdehoog/Semantic-UI-Calendar ) in an easier, more intuitive way by extending UI persistence like that:

class UI extends \atk4\ui\Persistence\UI
{
    public $date_format = 'd.m.Y';

    public $time_format = 'H:i';

    public $datetime_format = 'd.m.Y H:i:s';
    // 'D, d M Y H:i:s O';

    /**
     * Calendar input first day of week.
     *  0 = sunday;.
     *
     * @var int
     */
    public $firstDayOfWeek = 1;

    public $currency = '€';

	public $yes = 'Ja';
	public $no = 'Nein';

	public $options = array('today' => true,
							'monthFirst' => false,
							'touchReadonly' => true,
							'startMode' => year,
							'ampm' => false,
							'formatInput' => true,
							'multiMonth' => 1,

							'text' => array(
								'days' => ['S', 'M', 'D', 'M', 'D', 'F', 'S'],
								'months' => ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
								'monthsShort' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
								'today' => 'Heute',
								'now' => 'Jetzt',
								'am' => 'AM',
								'pm' => 'PM')
						);
}

User will be able to overwrite all options mentioned here ( https://github.com/mdehoog/Semantic-UI-Calendar ) in an easier, more intuitive way by extending UI persistence like that:

class UI extends \atk4\ui\Persistence\UI
{
    public $date_format = 'd.m.Y';

    public $time_format = 'H:i';

    public $datetime_format = 'd.m.Y H:i:s';
    // 'D, d M Y H:i:s O';

    /**
     * Calendar input first day of week.
     *  0 = sunday;.
     *
     * @var int
     */
    public $firstDayOfWeek = 1;

    public $currency = '€';

	public $yes = 'Ja';
	public $no = 'Nein';

	public $options = array('today' => true,
							'monthFirst' => false,
							'touchReadonly' => true,
							'startMode' => year,
							'ampm' => false,
							'formatInput' => true,
							'multiMonth' => 1,

							'text' => array(
								'days' => ['S', 'M', 'D', 'M', 'D', 'F', 'S'],
								'months' => ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
								'monthsShort' => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
								'today' => 'Heute',
								'now' => 'Jetzt',
								'am' => 'AM',
								'pm' => 'PM')
						);
}
@PhilippGrashoff
Copy link
Collaborator

Does Calendar FormField still rely on https://github.com/mdehoog/Semantic-UI-Calendar ? Fomantic-UI did great improvements to that calendar and, if not so already, we should use it.

@FabulousGee
Copy link
Contributor Author

FabulousGee commented Jul 16, 2019

I think so. I am not 100% sure though since I use the latest stable version only.

Anyway, if the new Fomantic-UI uses a similiar way to customize various things it may be even better to have it implemented for easier (future) usage with more backwards-compatibility imho. One would just need to change the options-array then as soon as Fomantic-UI is being used.

Edit:
It's mentioned in line 28 here: https://github.com/atk4/ui/blob/develop/src/FormField/Calendar.php

@ibelar
Copy link
Contributor

ibelar commented Jul 16, 2019

Edit:
It's mentioned in line 28 here: https://github.com/atk4/ui/blob/develop/src/FormField/Calendar.php

@FabulousGee - UI is now using Fomantic Calendar module. So the right options can be found here: https://fomantic-ui.com/modules/calendar.html#/settings.
Link indicated in line 28 above should be update to redirect to Fomantic url.

src/Persistence/UI.php Outdated Show resolved Hide resolved
src/FormField/Calendar.php Outdated Show resolved Hide resolved
@FabulousGee
Copy link
Contributor Author

Link indicated in line 28 above should be update to redirect to Fomantic url.

Changed it according to your suggestion.

@codecov
Copy link

codecov bot commented Jul 24, 2019

Codecov Report

❗ No coverage uploaded for pull request base (develop@308786b). Click here to learn what that means.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop     #777   +/-   ##
==========================================
  Coverage           ?   71.18%           
  Complexity         ?     2246           
==========================================
  Files              ?      119           
  Lines              ?     5328           
  Branches           ?        0           
==========================================
  Hits               ?     3793           
  Misses             ?     1535           
  Partials           ?        0
Impacted Files Coverage Δ Complexity Δ
src/Persistence/UI.php 56.79% <ø> (ø) 43 <0> (?)
src/FormField/Calendar.php 73.33% <33.33%> (ø) 13 <0> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 308786b...196a6ea. Read the comment docs.

Copy link
Member

@romaninsh romaninsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good now, thanks for PR!

@romaninsh romaninsh merged commit 0ed93f2 into atk4:develop Jul 24, 2019
@FabulousGee FabulousGee deleted the patch-5 branch July 24, 2019 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants