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

Create New Video Request using XHR without touching the server side #2

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

saidbakr
Copy link

Another approach using XMLHttpRequest instead of fetch without any change to the server side server/index.js

@saidbakr
Copy link
Author

Implementing listing of videos and appending the latest created video after success message.
Using template approach to clone each video the the video list.

 On branch master
 Your branch is up to date with 'origin/master'.

 Changes to be committed:
	new file:   client.js
	modified:   index.html
	new file:   template.js

    Changes not staged for commit:
	modified:   server/data/video-requests.data.js
	modified:   server/models/mongo.config.js

 Change the `tpl_inst` object design to be global object defined independently to the `render_tpl()` so `render_tpl()` becomes usable
The benefits of the template variables and filters made this task more easier, but some conflicts with the dynamically created elements of the videos list solved by placing functions that handles them in the correct place.
Adding sub template defination and it takes the follwing syntax:
```
{{TPL,tplName,varName,processFunName}}
```
 1. TPL, is a must keyword to define sub template inside the main one
 2. tplName, is the variable that handles the sub template HTML and its variable
 3. varName, the variable name that shoud be passed to the sub template which it must be defined previosuly in template instructions `tpl_inst`
 4. processFunName, the name of a function that should process the sub template. Initially, we started with notEmpty which will negelect the render of the sub template if the value of the varName is empty.
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.

1 participant