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

implement server-side on() events #28

Merged
merged 14 commits into from
Jan 6, 2017
Merged

implement server-side on() events #28

merged 14 commits into from
Jan 6, 2017

Conversation

romaninsh
Copy link
Member

This pull requests aims to make this code work:

$b = new Button();
$b->on('click', function($js){ $js->text(rand(1,20)); });

Clicking a button here would execute request to the server that would generate the new label for a button.

@romaninsh
Copy link
Member Author

I am OK with the remaining 4 code-climate issues. I don't want to disable them because we will need to address them at some point.

@romaninsh romaninsh requested a review from DarkSide666 January 3, 2017 10:52
@romaninsh romaninsh added this to the 0.7 jQuery Chains milestone Jan 3, 2017
@romaninsh romaninsh mentioned this pull request Jan 3, 2017
6 tasks

$buttons->on('click', '.button', $b3->js()->hide());
Copy link
Member

Choose a reason for hiding this comment

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

Wrong example!

Copy link
Member Author

Choose a reason for hiding this comment

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

There is major overhaul on js.rst in the next PR.

@@ -478,7 +495,7 @@ public function getHTML()
*
Copy link
Member

Choose a reason for hiding this comment

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

no description what $extra parameter is for

Copy link
Member Author

Choose a reason for hiding this comment

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

it's changed in the next PR, so leaving.

return $r->jsRender();
}, $actions));

echo json_encode(['success'=>true, 'message'=>'Hello World', 'eval'=>$ajaxec]);
Copy link
Member

Choose a reason for hiding this comment

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

Hello world???

Copy link
Member Author

Choose a reason for hiding this comment

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

This is changed in the next PR, so i'll leave it to avoid conflicts.

exit;
});

$thisAction->api(['on'=>'now', 'url'=>$cb->getURL(), 'obj'=>new jsExpression('this')]);
Copy link
Member

Choose a reason for hiding this comment

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

$thisAction->api ? what is that?

Copy link
Member Author

Choose a reason for hiding this comment

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

* Provides replacement for json_encode that will respect jsExpressionable objects
* and call jsRender() for them instead of escaping.
*
* @param mixed @arg anything
Copy link
Member

Choose a reason for hiding this comment

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

should be $arg instead of @arg

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@@ -0,0 +1,19 @@
<?php
Copy link
Member

Choose a reason for hiding this comment

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

what is this class for? where is it used?

Copy link
Member Author

Choose a reason for hiding this comment

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

removing it, it's confusing.

@romaninsh romaninsh merged commit 9e3f557 into develop Jan 6, 2017
@romaninsh romaninsh deleted the feature/callbacks branch January 6, 2017 00:20
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.

2 participants