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

Feature/js enhance #189

Merged
merged 14 commits into from
Jul 4, 2017
Merged

Feature/js enhance #189

merged 14 commits into from
Jul 4, 2017

Conversation

ibelar
Copy link
Contributor

@ibelar ibelar commented Jun 29, 2017

Here are the changes:

View::renderJSON()

Create a new method in View::renderJSON() that will handle js output in json format.

  • basically use it as $this->app->terminate($view->renderJSON())
    • update method in Table/Column/Delete, jsReload and VirtualPage classes to use the new renderJSON in app->terminate.
    • in regards to virtual page, since cb->triggered 'cut' is use for normal rendering and js rendering, I had to put a test using a query param to differentiate between both. May be in future you could have a new triggered value, say 'cutjs' for example for js rendering.
  • renderJSON() will also send Exception in json format.

jsModal

Change jsModal and delegate creation of the modal dialog to a new js plugin createModal.js

  • the main advantage is that you can now easily pass semantic-ui modal option;
  • when more than one modal is need on the page, you are not duplicating html code as before within the script tag.

reloadView.js

Change was made to this plugin and now use the semantic api method. The main advantage is that all the json response are sent via the api and catch by api.settings.succesTest function. Also allow to eval script code without duplicating it in DOM.

Lib Atk4JS.js

  • Refactor addParam to its own file;
  • add createModal.js plugin;
  • refactor jquery var declaration so it does not get include in final bundle. I really add trouble with webpack configuration for this.

html.html

Refactor $.fn.api.successTest function to handle new json format.

Testing

I have test this new code against all the demos file and did not find any issue.

ibelar added 13 commits June 22, 2017 13:39
Add function renderJSON when json response is need for ajax request.
Create a new plugin that will create modal window. Also enhance error
display on ajax request.
Now properly close modal. Problem was coming from jquery that was
include in final atk4js bundle. Need to change import $ from ‘jquery’
to const $ = require(‘jquery’) for it no to be include in bundle.
modal semantic is still include however. Even if set as external in
webpack config. need to find out why but does not seem to cause problem.
update webpack configuration and js plugin file so it does not include
semantic-ui-modal in final bundle.
@romaninsh
Copy link
Member

Great PR.

@romaninsh
Copy link
Member

Merge devel again and Travis will pass.

@ibelar
Copy link
Contributor Author

ibelar commented Jul 1, 2017

Merge is done. Thanks!

@romaninsh romaninsh merged commit 5580b97 into atk4:develop Jul 4, 2017
This was referenced Jul 4, 2017
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