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

Allow for changing an tag when clicking on it #13

Merged
merged 2 commits into from Feb 19, 2012

Conversation

Projects
None yet
2 participants
@sstok
Contributor

sstok commented Jan 23, 2012

I have add an new tagClick event which allows for changing the value of an tag by clicking on it.

The event will receive the data as Item and must return it as an Item.
Writing an automated test-case was not possible since I don''t have the software for running them.

The usage is actually self explanatory.

// Data is the data as it was added
textarea.bind('tagClick', function (e, Data){
    // Normally you would use something more fancy, like jQuery UI dialog.
    var newLabel = window.prompt('New value', Data);

    if (newLabel)
        Data = newLabel;
});
Added new event tagClick, for changing the tags current value
The event will receive the data as Item and must return it as an Item.
An actual test-case is currently missing but will be added shortly.

__Apparently I also removed some trailing whitespace.__
@alexgorbatchev

This comment has been minimized.

Show comment
Hide comment
@alexgorbatchev

alexgorbatchev Jan 23, 2012

Owner

Thank you for the patch, I'll check it out shortly!

Owner

alexgorbatchev commented Jan 23, 2012

Thank you for the patch, I'll check it out shortly!

@sstok

This comment has been minimized.

Show comment
Hide comment
@sstok

sstok Jan 25, 2012

Contributor

There still some issues, the trigger expects an return. But that is not possible with dialogs that works with callbacks like most of them do.

So there must be a second method that will actually trigger the update.
Now I need to find a way to make a reference to that 'trigger' function possible from inside the callback.
And that where I'm stuck right now... My best shot is registering an internal callback that gets fired from inside the callback of the dialog.

Contributor

sstok commented Jan 25, 2012

There still some issues, the trigger expects an return. But that is not possible with dialogs that works with callbacks like most of them do.

So there must be a second method that will actually trigger the update.
Now I need to find a way to make a reference to that 'trigger' function possible from inside the callback.
And that where I'm stuck right now... My best shot is registering an internal callback that gets fired from inside the callback of the dialog.

Changed the 'tagClick' event, the event must now call tagUpdate() exp…
…licitly to perform an update.

This fixes the previous issue of not being able to update the tag when using an dialog that uses callbacks.

Example:
	textarea.bind('tagClick', function(e, data, tag, self) {
		var newLabel = window.prompt('New value', data.name);

		if (newLabel)
		{
			data.name = newLabel;

                        // Perform the update now
			self.tagUpdate(true);
		}
	});
@sstok

This comment has been minimized.

Show comment
Hide comment
@sstok

sstok Feb 16, 2012

Contributor

The issue has been resolved, any change on seeing this getting merged soon?

Contributor

sstok commented Feb 16, 2012

The issue has been resolved, any change on seeing this getting merged soon?

@alexgorbatchev alexgorbatchev merged commit 8b3fbcb into alexgorbatchev:master Feb 19, 2012

@alexgorbatchev

This comment has been minimized.

Show comment
Hide comment
@alexgorbatchev

alexgorbatchev Feb 19, 2012

Owner

@sstok Thanks for the path and idea. I've reimplemented it slightly to be more consistent with the rest of the code base. Please have a look 22edd91#L2R131

Owner

alexgorbatchev commented Feb 19, 2012

@sstok Thanks for the path and idea. I've reimplemented it slightly to be more consistent with the rest of the code base. Please have a look 22edd91#L2R131

@sstok

This comment has been minimized.

Show comment
Hide comment
@sstok

sstok Feb 20, 2012

Contributor

Great! Thanks.

Contributor

sstok commented Feb 20, 2012

Great! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment