creecros / MetaMagik

Custom Fields for Kanboard - Plugin MetaMagik
MIT License
99 stars 16 forks source link

extend the types of data available #56

Closed alaner2k closed 4 years ago

alaner2k commented 4 years ago

Hi creecros! Tks for your super plugin / it allows to tune the kanboard just for me. However I wonder why the plugin doesn't allow to use not just a DATE but DATE+TIME field (like a "due date" for a task)? I tried to modify the field type in the DB directly but in this case I can's see the modified field in the task view at all :-(

If by chance you can add this feature to your plugin it would extend our practice :-)

Thanks anyway for your time & knowledge!

creecros commented 4 years ago

Should be very easy. Change the input type, from "date" to "datetime-local" in the MetaHelper.

alaner2k commented 4 years ago

Tks a lot for the direction / frankly I'm not a programmer thus I attempted to change the field "data_type" @ table "metadata_types" from DATE to DATETIME or DATETIME-LOCAL by PHPMyAdmin in the DB, but with no success... Well hope the MetaHelper will help :-)

creecros commented 4 years ago

This line, specifically https://github.com/creecros/MetaMagik/blob/90a5d8152659af5827140099adf7189212880fad/Helper/MetaHelper.php#L30

alaner2k commented 4 years ago

Lovely!!! I managed to re-define the date to date&time :-) same time I tried not just re-define but ADD the new format by copying the function renderDateField, unfortunately with no further success yet :-) Anyway you assisted my a lot!!! Thank you again!

creecros commented 4 years ago

If you want to add it, you would have to add the type as well, and add the option in the template. It wouldn't be hard, but there is more to it than meets the eye.

I could add it, but don't have a working server anymore, haven't played with kanboard in a while. So...i wouldn't be able to test it.

Try this:

Add the option here https://github.com/creecros/MetaMagik/blob/90a5d8152659af5827140099adf7189212880fad/Template/config/metadata_types.php#L33 By just adding a line for 'datetime' => 'Date Time'

Then copy the renderDateField function in the helper, but call it renderDateTimeField. Change to datetime-local like before.

Then in the renderMetaFields function of the helper, add an else if for the new datetime type, just copy the else if for date, and change date to datetime, and have it point to the new renderDateTimeField function, instead of renderDateField https://github.com/creecros/MetaMagik/blob/90a5d8152659af5827140099adf7189212880fad/Helper/MetaHelper.php#L140-L141

I think that should do it, unless I'm forgetting something

alaner2k commented 4 years ago

IT WORKS PERFECTLY ! Thanks for your efforts!