Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Conversation

@simo9000
Copy link
Contributor

@simo9000 simo9000 commented Nov 8, 2016

This is a continuation of #2256. I have implemented a sub-option to timeline.editable called overrrideItems which provides a means to switch between two precedence conventions, 1. item.editable and 2. timeline.editable.

  1. item.editable; (current behavior*) - this convention allows the item.editable option to override the values of timeline.editable.

  2. timeline.editable - this convention allows the timeline options to override the item options when 'overrideItems' is set to true. This is useful when switching an entire timeline between "editing" and "read-only" modes while still enforcing individual item.editable options during "editing" mode.

To preserve backward capability timeline.editable.overrideItems defaults to false which enables convention 1. This PR includes documentation updates and a new example page where timeline.editable options can be toggled to easily test different configurations. A test matrix was created and used to confirm the behavior. Bugs fixed in 8ae5d2a and d2899c1 were found as a result of this exhaustive testing.

*currently the setting item.editable = true overrides timeline.editable.remove and timeline.editable.updateTime but does not override timeline.editable.updateGroup which is inconsistent with the documentation. The bugs found in matrix testing were split into two commits to separate fixes that do not impact this behavior (8ae5d2a) and an update to make item.editable = true override all behaviors (d2899c1). This makes it easy to revert d2899c1 if needed as this commit has the potential to impact backward compatibility.

Copy link
Member

@yotamberk yotamberk left a comment

Choose a reason for hiding this comment

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

Very nice work! Thank you for this addition!

@mojoaxel mojoaxel added this to the Minor Release v4.18 milestone Nov 8, 2016
Copy link
Member

@mojoaxel mojoaxel left a comment

Choose a reason for hiding this comment

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

Almost perfect! Very nice! Thanks!
@simo9000 Maybe you change the comments I added and update your branch!?

<td class="ident">editable.overrideItems</td>
<td>boolean</td>
<td><code>false</code></td>
<td>If true, item specific editable properties are overridden</td>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe more precise: "If true, item specific editable properties are overridden by timeline settings" or something similar!?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good

<td>If true, items can be dragged to another moment in time. See section <a href="#Editing_Items">Editing Items</a> for a detailed explanation.</td>
</tr>
<tr parent="editable" class="hidden">
<td class="ident">editable.overrideItems</td>
Copy link
Member

Choose a reason for hiding this comment

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

must be class="indent"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch

updateGroup: true, // drag items from one group to another
remove: true // delete an item by tapping the delete button top right
}
};</pre>
Copy link
Member

Choose a reason for hiding this comment

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

Here in this code example the new option overrideItems is missing. Should be added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another good catch.


<p>
Editing can be enabled/disabled for specific items. Setting the property <code>editable</code> to <code>true</code> or <code>false</code> on a data item will override the timeline option.
Editing can be enabled/disabled for specific items. Setting the property <code>editable</code> to <code>true</code> or <code>false</code> on a data item will override the timeline option depending on the value of <code>timeline.editable.overrideItems</code>.
Copy link
Member

Choose a reason for hiding this comment

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

...will override the timeline option depending on the value of timeline.editable.overrideItems.

I would propose:
...will override the timeline option except timeline.editable.overrideItems is set to true.

<p>Specify individual items to be editable or readonly. Toggle edit options and override behavior from timeline.editable</p>

<div id="visualization"></div>
<form>
Copy link
Member

Choose a reason for hiding this comment

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

maybe wrap the form in a <p> to get some space between the form and the timeline!?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no problem

{id: 6, content: 'Read-only', editable: false, start: '2010-08-29', group: 2},
{id: 7, content: 'Editable', editable: true, start: '2010-08-31', end: '2010-09-03', group: 1},
{id: 8, content: 'Read-only', editable: false, start: '2010-09-04T12:00:00', group: 2},
{id: 9, content: 'Null', start: '2010-09-04', group: 1},
Copy link
Member

Choose a reason for hiding this comment

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

For me, Null looks too much like undefined. What about something generic like foo and bar or default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Default works


if ('editable' in options) {
if (typeof options.editable === 'boolean') {
this.options.editable.updateTime = options.editable;
Copy link
Member

Choose a reason for hiding this comment

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

😠 That's why I don't like these code-indent-formatting-thinks. (I hope we get rid of them in the future).
@simo9000 No problem here, just a comment...

@simo9000
Copy link
Contributor Author

simo9000 commented Nov 8, 2016

Thanks for the feedback. I updated the branch as you suggested.

@mojoaxel mojoaxel merged commit a83ef01 into visjs:develop Nov 8, 2016
@mojoaxel
Copy link
Member

mojoaxel commented Nov 8, 2016

@simo9000 Thanks again! Feel free to contribute more! We always need good developers that help keeping this project alive.

@simo9000 simo9000 deleted the timeline-OverrideItems branch November 10, 2016 22:26
simo9000 added a commit to simo9000/vis that referenced this pull request Nov 12, 2016
* Fixed bug introduced in visjs#2284 where overrideItems is set to true when boolean is provided
* Added the option of supplying object to item.editable with updateTime, updateGroup, and remove functioning similarly to timeline.editable but only on a single item
* Updated Documentation to reflect the new feature
* Updated the individualEditableItems example page to show feature usage.
simo9000 added a commit to simo9000/vis that referenced this pull request Nov 13, 2016
* Fixed bug introduced in visjs#2284 where overrideItems is set to true when boolean is provided
* Added the option of supplying object to item.editable with updateTime, updateGroup, and remove functioning similarly to timeline.editable but only on a single item
* Updated Documentation to reflect the new feature
* Updated the individualEditableItems example page to show feature usage.
simo9000 added a commit to simo9000/vis that referenced this pull request Nov 17, 2016
* Fixed bug introduced in visjs#2284 where overrideItems is set to true when boolean is provided
* Added the option of supplying object to item.editable with updateTime, updateGroup, and remove functioning similarly to timeline.editable but only on a single item
* Updated Documentation to reflect the new feature
* Updated the individualEditableItems example page to show feature usage.
mojoaxel pushed a commit that referenced this pull request Nov 20, 2016
* Fixed bug introduced in #2284 where overrideItems is set to true when boolean is provided
* Added the option of supplying object to item.editable with updateTime, updateGroup, and remove functioning similarly to timeline.editable but only on a single item
* Updated Documentation to reflect the new feature
* Updated the individualEditableItems example page to show feature usage.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants