MDriven Movie Theatre Part 2
No edit summary
(Automatically adding template at the end of the page.)
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<html>
<html>
<h4> Part 2 of building an AngularJS app with MDriven Turnkey with the movie ticket example. At this point we could select and reserve tickets, but what we want to
<h4> This is Part 2 of building an AngularJS app with MDriven Turnkey. Using the movie ticket example, we can select
do now is to add view override, making UI more user-friendly and efficient. </h4>
  and reserve tickets. What we want to do now is add view override, making UI more user-friendly and efficient. </h4>


<p>
<p class="warn">
<em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now you can pick any topic to be instructed without watching the whole video.</em>
  <em>To make your experience smooth, we set the main tags mentioned in the video to the right bar menu of this mini-player. Choose an interesting subtitle on the list and immediately get to the exact theme navigation item place in the video. Now you can pick any topic to be instructed on without watching the whole video.</em>
<style type="text/css">
p {
opacity: 0.7;
text-align: justify;
width: 90%
}
</style>
</p>
</p>
 
<br>
<style>
<div class="video">
#video12 {
   <div class="video__wrapper">
  position: relative;
    <iframe src="https://www.youtube.com/embed/i-DWohMetqg?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe>
  height: 500px;
   </div>
  width:560px;
  <div class="video__navigation">
  padding-bottom: 10px;
     <span class="navigation-item" data-video="i-DWohMetqg" data-start="55" tabindex="0"> Adding a view override </span>
}
     <span class="navigation-item" data-video="i-DWohMetqg" data-start="152" tabindex="0"> Development Page </span>
#video12 iframe {
     <span class="navigation-item" data-video="i-DWohMetqg" data-start="225" tabindex="0"> Setting the external JavaScript and CSS</span>
  position: absolute;
     <span class="navigation-item" data-video="i-DWohMetqg" data-start="520" tabindex="0"> AngularJS </span>
  min-height: auto;
     <span class="navigation-item" data-video="i-DWohMetqg" data-start="695" tabindex="0"> ToggleSeat action (jsToggleSeat)</span>
  min-width: auto;
     <span class="navigation-item" data-video="i-DWohMetqg" data-start="815" tabindex="0"> Background in UI </span>
}
     <span class="navigation-item" data-video="i-DWohMetqg" data-start="886" tabindex="0"> Adding an animation (Busy Animation) </span>
#video12 div {
  </div>
  position: absolute;
  top: 0;
  left:760px;
  width: 260px;
  height: 100%;
  padding-left: 10px;
  overflow-y: auto;
}
span {
    font-size: 18;
    display:block;
  padding: 2px 10px 0.5px 10px;
    padding-bottom: 0.5;
    padding-top: 0.5;
  opacity: 0.7;
}
span:hover {
  color: #0000FF;
  cursor: pointer;
}
span:focus {
   color: blue;
</style>
 
<div id="video12">
<iframe width="740" height="500" src="https://www.youtube.com/embed/IYcLWYI1YGI?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe>
   <div>
     <span data-video="IYcLWYI1YGI" data-start="50" tabindex="0"> Adding a view override </span>
     <span data-video="IYcLWYI1YGI" data-start="147" tabindex="0"> Development Page </span>
     <span data-video="IYcLWYI1YGI" data-start="220" tabindex="0"> Setting the external JavaScript and CSS</span>  
     <span data-video="IYcLWYI1YGI" data-start="515" tabindex="0"> AngularJS </span>
     <span data-video="IYcLWYI1YGI" data-start="690" tabindex="0"> ToggleSeat action (jsToggleSeat)</span>
     <span data-video="IYcLWYI1YGI" data-start="810" tabindex="0"> Background in UI </span>
     <span data-video="IYcLWYI1YGI" data-start="881" tabindex="0"> Adding an animation (Busy Animation) </span>  
</div>
</div>
</div>


<script>
var IMG = document.querySelectorAll('#video12 span'),
    IFRAME = document.querySelector('#video12 iframe');
for (var i = 0; i < IMG.length; i++) {
  IMG[i].onclick = function() {
    IFRAME.src = 'http://www.youtube.com/embed/' + this.dataset.video + '?rel=0&autoplay=1';
    if(this.dataset.end) IFRAME.src = IFRAME.src.replace(/([\s\S]*)/g, '$1&end=' + this.dataset.end);
    if(this.dataset.start) IFRAME.src = IFRAME.src.replace(/([\s\S]*)/g, '$1&start=' + this.dataset.start);
    this.style.backgroundColor='rgba(0,0,0,.2)';
  }
}
</script>
</html>
</html>


'''Adding a view override'''  
=== '''Adding a View Override''' ===
 
We can simply add a new text file in the external override pages folder with the same name as our ViewModel.
We can simply add a new text file in the external override pages folder with the same name as our view model
  ''buy tickets.cshtml''  
  ''buy tickets.cshtml''  
in the external override pages this will be empty and can just write anything here. To get back to the original content just delete this override file and the system will revert to default. Although we are able to  copy the content from the angular page dynamic template. The system will generate the data, however there is also development page where we can look at each view model and see in details all the usable angular widgets. Picking one of these and override it anyway we want. Likewise, we use the widget for the image, the data in grid for show ticket and seat list as well.
In the external override pages, this will be empty and we can write anything here. To get back to the original content, delete this override file and the system will revert to default. Although we are able to copy the content from the angular page dynamic template, the system will generate the data. However, there is also a development page where we can look at each ViewModel and see in detail all the usable angular widgets. Pick one of these and override it any way you want. Likewise, we use the widget for the image, and the data in the grid to show the ticket and seat list as well.  


Also there is another way to display the picked seats. Let's Google for any seat reservation JavaScript template. Download that, check what it contains (CSS and JavaScript), check the license. Lastly, save that to the web application content folder.
There is another way to display the picked seats. Let's Google for any seat reservation JavaScript template. Download the template, look through what it contains (CSS and JavaScript), and check the license. Lastly, save the template to the web application content folder.


Now we are able to use the script and CSS as the sample in our application - it's injected the seat map div found in the document ready and it's created a lot of data.
Now we are able to use the script and CSS as the sample in our application. It has injected the seat map div found in the document ready and created a lot of data.


It's important to remember that the sample script doesn't know anything of our data and that's usually the case with not data aware enough scripts. There is a lot of javascript pieces trying to keep UI widgets in place, still we're not really interested in them.
It is important to remember that the sample script doesn't know anything about our data as is usually the case with non-data-aware scripts. There are numerous javascript pieces trying to keep UI widgets in place - however, we're not interested in them.


Looking at this CSS component, there is divs for each seat and styles to display, each row is also a CSS class to display. But we don't really need any of that complex UI logic in part of the control. It's much better to trust our data, if we were to add a little data to our view model defining the rows  
Looking at this CSS component, there are divs for each seat and styles to display; each row is also a CSS class to display. We don't need any complex UI logic in part of the control. It is much better to trust our data; if we were to add a little data to our view model defining the rows,
  Rows:  ''self.ShowSeat ->(ss|ss.Seat.SeatInRow=1)''
  Rows:  ''self.ShowSeat ->(ss|ss.Seat.SeatInRow=1)''
and select every first seat in row equals one - that would mean that we have all the rows. And this kind of information is important for us.  
and select (every first seat in each row equals one), that would mean that we have all the rows. This kind of information is important t us.  


From the seat to the shows we have the link object ShowSeat. Following that to the column for each row  that has a specific seats.
From the seat to the shows, we have the link object ShowSeat. Follow that to the column for each row that has a specific seat.


Let's add some states which we’ve got from the CSS., that the CSS wanted for different states, if it's selected unavailable or available, so we have pretty much based data rendering on what the CSS in this component expects. Having done that in a different copy of the old one, need to use our new data transformation.  
Let's add some states which we have from the CSS, which the CSS wanted for different states. If it is selected available or unavailable, we have more or less based data rendering on what the CSS in this component expects. Having done that in a different copy of the old one, we need to use our new data transformation.  


'''Using Angular''' we are going to do our own thing with the seats.
Using Angular''',''' we are going to do our own thing with the seats.


Get a div to display the things in and div to angular repeat over "row in root.Rows", so each row in rows will be called row.  We just a copy the things that I saw when I inspected the element of the other component. And for each row I want to iterate over the columns and repeat, "col in row.Cols". We just sort of steel mark up from the downloaded component. Also here we can inject some of our own things like “jsstate” that comes from our data and identity.  
Get a div to display the things in and div to angular repeat over "row in root.Rows", so each row in rows will be called row.  We copy the things that I saw when I inspected the element of the other component. And for each row, I want to iterate over the columns and repeat, "col in row.Cols". We sort of steel mark up from the downloaded component. Also. we can inject some of our own things like “jsstate” that comes from our data and identity.  
  ''<div style=”display:inline-block”  
  ''<div style=”display:inline-block” ''
       <nowiki><div ng-repeat="row in root.Rows" class=”seatCharts-row></nowiki>''
       <nowiki><div ng-repeat="row in root.Rows" class=”seatCharts-row></nowiki>
       ''<nowiki><div ng-repeat="col in row.Cols" tabindex=”-1” class=” seatCharts-seat seatCharts-cell front-   seat  seat{{col.jsstate}}” id ={{col.Id}}></nowiki>''  
       ''<nowiki><div ng-repeat="col in row.Cols" tabindex=”-1” class=” seatCharts-seat seatCharts-cell front-   seat  seat{{col.jsstate}}” id ={{col.Id}}></nowiki>''  
       ''<nowiki></div></nowiki>''
       ''<nowiki></div></nowiki>''
  ''<nowiki></div></nowiki>''
  ''<nowiki></div></nowiki>''
We mimic how the component expects the HTML,  but we don't really care about the component, because this CSS will render as if it was the component that did it.
We mimic what the component expects from the HTML,  but don't pay attention to the component, because this CSS will render as if it was the component that did it.


There are few things to display something in the seat, the role as checkbox - we copy this as well and the data from our site. So having done that, refresh the page and check it up.
There are a few things to display something in the seat, the role as checkbox - we copy this as well and the data from our site. Having done that, refresh the page and check it out.


Now if we click the seats - they are dead, let's fix that by '''setting click toggle seat'''.
Now, if we click the seats, they are dead; let's fix that by '''setting click toggle seat'''.


We are going to do small script here in the page
We are going to do a small script here, on the page:
  ''<script> function ToggleSeat(theelement)''  
  ''<script> function ToggleSeat(theelement)''  
  ''{''  
  ''{''  
Line 122: Line 67:
  ''}''  
  ''}''  
  ''</script>''
  ''</script>''
In the toggle seat we first need to hold of the angular scope, getting it from the element.
In the toggle seat, we first need to hold off the angular scope, getting it from the element.


Once we have that we get full access to our data, under the root tag.  
Once we have done that, we get full access to our data, under the root tag.  


jsClickedSeat assigned the element.id - a piece of data we added in the ViewModel, it sets a variable vClickedSeat and then we have a js toggle action that uses the value of the variable.
jsClickedSeat assigned the element.id - a piece of data we added in the ViewModel. It sets a variable vClickedSeat and then we have a js toggle action that uses the value of the variable.


So we are going to call an action as well jsToggleSeat, this one will happen every time we push any buttons.
So we are going to call an action as well jsToggleSeat - this will happen every time we push any buttons.


Continue on improving UI, we can add some kind of '''"busy" animation'''.  
To continue improving our UI, we can add some kind of '''"busy" animation'''.  


→ Google and download some examples
→ Google and download some examples


get that one in our content folder  
Get it in our content folder  
 
→ add a div with new image, which source one folder up / content / filename.


But this shouldn't show all the time, it should show when we use angular show, we are in the scope, so we just
→ Add a div with a new image, which sources one folder up/content/filename.


"root.ShowBusyAnimation"
This shouldn't show all the time; it should show when we use angular show, we are in the scope, so we just "root.ShowBusyAnimation".


We need to define that in our data, adding column name ShowBusyAnimation. Finally, we should show the busy animation when current seat request has state equals to request process.
We need to define that in our data, adding the column name ShowBusyAnimation. Finally, we should show the busy animation when the current seat request has a state equals to request process.
   ''vThisSeatRequest.State=’RequestProcess’''
   ''vThisSeatRequest.State=’RequestProcess’''
Upload the model to the cloud and check the page.
Upload the model to the cloud and check the page.


So that's just about how easy it is to do pretty much anything you want with your data. Of course the web is full of CSS and JavaScript you can use together with an MDriven turnkey while having full access to your data from any web page you need. This is a very good thing, if you want to do systems that going to live for a long time. Even if you can afford to be a little bit sloppy in the UI, the data is still very strict and ordered.
That's how easy it is to do relatively anything you want with your data. Of course, the web is full of CSS and JavaScript you can use together with an MDriven Turnkey while having full access to your data from any web page you need. This is very advantageous, especially if you want to create systems that last a long time. Even if you can afford to be a little bit sloppy in the UI, the data is still very strict and ordered.
[[Category:MDriven Designer]]
[[Category:MDriven Turnkey]]
[[Category:AngularJS]]
[[Category:UI]]
[[Category:Example]]
{{Edited|July|12|2024}}

Latest revision as of 15:36, 10 February 2024

This is Part 2 of building an AngularJS app with MDriven Turnkey. Using the movie ticket example, we can select and reserve tickets. What we want to do now is add view override, making UI more user-friendly and efficient.

To make your experience smooth, we set the main tags mentioned in the video to the right bar menu of this mini-player. Choose an interesting subtitle on the list and immediately get to the exact theme navigation item place in the video. Now you can pick any topic to be instructed on without watching the whole video.


Adding a view override Development Page Setting the external JavaScript and CSS AngularJS ToggleSeat action (jsToggleSeat) Background in UI Adding an animation (Busy Animation)

Adding a View Override

We can simply add a new text file in the external override pages folder with the same name as our ViewModel.

buy tickets.cshtml 

In the external override pages, this will be empty and we can write anything here. To get back to the original content, delete this override file and the system will revert to default. Although we are able to copy the content from the angular page dynamic template, the system will generate the data. However, there is also a development page where we can look at each ViewModel and see in detail all the usable angular widgets. Pick one of these and override it any way you want. Likewise, we use the widget for the image, and the data in the grid to show the ticket and seat list as well.

There is another way to display the picked seats. Let's Google for any seat reservation JavaScript template. Download the template, look through what it contains (CSS and JavaScript), and check the license. Lastly, save the template to the web application content folder.

Now we are able to use the script and CSS as the sample in our application. It has injected the seat map div found in the document ready and created a lot of data.

It is important to remember that the sample script doesn't know anything about our data as is usually the case with non-data-aware scripts. There are numerous javascript pieces trying to keep UI widgets in place - however, we're not interested in them.

Looking at this CSS component, there are divs for each seat and styles to display; each row is also a CSS class to display. We don't need any complex UI logic in part of the control. It is much better to trust our data; if we were to add a little data to our view model defining the rows,

Rows:  self.ShowSeat ->(ss|ss.Seat.SeatInRow=1)

and select (every first seat in each row equals one), that would mean that we have all the rows. This kind of information is important t us.

From the seat to the shows, we have the link object ShowSeat. Follow that to the column for each row that has a specific seat.

Let's add some states which we have from the CSS, which the CSS wanted for different states. If it is selected available or unavailable, we have more or less based data rendering on what the CSS in this component expects. Having done that in a different copy of the old one, we need to use our new data transformation.

Using Angular, we are going to do our own thing with the seats.

Get a div to display the things in and div to angular repeat over "row in root.Rows", so each row in rows will be called row.  We copy the things that I saw when I inspected the element of the other component. And for each row, I want to iterate over the columns and repeat, "col in row.Cols". We sort of steel mark up from the downloaded component. Also. we can inject some of our own things like “jsstate” that comes from our data and identity.

<div style=”display:inline-block” 
      <div ng-repeat="row in root.Rows" class=”seatCharts-row>
      <div ng-repeat="col in row.Cols" tabindex=”-1” class=” seatCharts-seat seatCharts-cell front-   seat  seat{{col.jsstate}}” id ={{col.Id}}> 
      </div>
</div>

We mimic what the component expects from the HTML,  but don't pay attention to the component, because this CSS will render as if it was the component that did it.

There are a few things to display something in the seat, the role as checkbox - we copy this as well and the data from our site. Having done that, refresh the page and check it out.

Now, if we click the seats, they are dead; let's fix that by setting click toggle seat.

We are going to do a small script here, on the page:

<script> function ToggleSeat(theelement) 
{ 
    var the scope = angular.element(theelement).scope(); 
    thescope.root.jsClickSeat = theelement.id; 
    thescope.$apply(function () { 
             thescope.root.VM.Execute_Post(‘BuyTickets2’, ‘jsToggleSeat”);  
             }) 
} 
</script>

In the toggle seat, we first need to hold off the angular scope, getting it from the element.

Once we have done that, we get full access to our data, under the root tag.

jsClickedSeat assigned the element.id - a piece of data we added in the ViewModel. It sets a variable vClickedSeat and then we have a js toggle action that uses the value of the variable.

So we are going to call an action as well jsToggleSeat - this will happen every time we push any buttons.

To continue improving our UI, we can add some kind of "busy" animation.

→ Google and download some examples

→ Get it in our content folder

→ Add a div with a new image, which sources one folder up/content/filename.

This shouldn't show all the time; it should show when we use angular show, we are in the scope, so we just "root.ShowBusyAnimation".

We need to define that in our data, adding the column name ShowBusyAnimation. Finally, we should show the busy animation when the current seat request has a state equals to request process.

 vThisSeatRequest.State=’RequestProcess’

Upload the model to the cloud and check the page.

That's how easy it is to do relatively anything you want with your data. Of course, the web is full of CSS and JavaScript you can use together with an MDriven Turnkey while having full access to your data from any web page you need. This is very advantageous, especially if you want to create systems that last a long time. Even if you can afford to be a little bit sloppy in the UI, the data is still very strict and ordered.

This page was edited 91 days ago on 02/10/2024. What links here