Updated 009 Adding Admin Views to a Component (markdown)

Amigo 2019-06-06 10:07:09 +02:00
parent 9d888191eb
commit d218dcebcd
1 changed files with 24 additions and 13 deletions

@ -4,26 +4,19 @@ Hi,we have looked at setting up admin views and looked at creating fields for ad
**Sermon Component Setting as Example**
To connect admin views to your component you need to go to settings and open this button here(as see in video).. So you have a dropdown (select an option), then make a selection and then click 'next'. Then do the next one. If you have a lot of admin views like I do here you would type in the name of the admin view. [00:01:33](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m33s)
To connect admin views to your component you need to go to settings and open this button here(as see in video). So you have a dropdown (select an option), then make a selection and then click 'next'. Then do the next one. If you have a lot of admin views like I do here you would type in the name of the admin view. [00:01:33](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m33s)
**Adding Views Setting Icons**
Type in the name sermon. Now these icons here(See video) which have been mentioned previously, are the icons from Joomla which is called Joomla Standard Icomoon Fonts. [00:02:02](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m02s) If you select a an icon here(Joomla), it will show you that little icon(1) but only during the selection face. That is the icon that is going to be used for the view here in the right. See this icon there(top right) as we click through [00:02:24](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m24s) component builder it updates that icon.
Type in the name 'Sermon'. Now these icons here(See video) which have been mentioned previously, are the icons from Joomla which is called Joomla Standard Icomoon Fonts. [00:02:02](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m02s) If you select a an icon here 'Joomla', it will show you that little icon(1) but only during the selection face. That is the icon that is going to be used for the view here in the right. Look at the icon (top right) as we click through [00:02:24](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m24s) component builder ,the icon gets updated.
**Settings Switch Admin Menu**
This icon is what is being set here(See video). You can select the icons to reflect to the admin view of your choice. We have a bunch of switches here and we'll look at them one at a time. Admin menu is this menu. [00:02:49](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m49s) Do you want that view to show up next to your main view? That will be the first tick box. Then say, 'yes'.
This icon is what is being set here(See video). You can select the icons to reflect the admin view of your choice. We have a bunch of switches here and we'll look at them one at a time. 'Admin menu' is the menu. [00:02:49](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m49s) Do you want that view to show up next to your main view? That will be the first tick box. Then say, 'yes'.
**Settings Switch Dashboard Items**
Then do you want to have an 'add record' icon for this view? If you go to the dashboard, the 'add record' icon, [00:03:10](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m10s) it is this icon 'Add Admin View'. It is a shortcut to create an admin view from the dashboard. So we will say 'yes'. Then a 'Dashboard (list of records)' icon. Maybe you don't want this 'Admin View' icon, just add 'admin view', then tick that 'Dashboard(add record)' as 'no'. [00:03:35](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m35s) But again here 'Dashboard(list of records)' we would like, 'yes'.
Then do you want to have an 'add record' icon for this view? If you go to the dashboard, the 'add record' icon, [00:03:10](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m10s) it is this icon 'Add Admin View'. It is a shortcut to create an admin view from the dashboard. So we will say 'yes'. Then a 'Dashboard (list of records)' icon will show. Maybe you don't want this 'Admin View' icon, just add 'admin view', then tick that 'Dashboard(add record)' as 'no'. [00:03:35](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m35s) At 'Dashboard(list of records)' click, 'yes'.
**Settings Switch Submenu**
@ -31,11 +24,21 @@ Then a submenu. The submenu if you've opened your view that has a submenu here t
**Settings Switch Auto Check-in**
Then auto check-in [00:03:59](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m59s) is a little tweak that I've added to to my Joomla components and I'm possibly going to make a pull request to add it to Joomla itself. What auto check-in does, it adds a feature to your component. Since I have clients that complaint that some people will open an item and then in the browser click back, instead of clicking close. That will keep the item locked out [00:04:28](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m28s) to that individual and so others cannot access it on less they have admin rights to check it back in. We created an auto check-in. Auto check-in checks whether this item has been checked out longer than a set period and ever it has been it checks it automatically. That set period is something that the administrator sets in the global settings of the component. I'll show you that later. [00:04:57](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m57s) You can add auto check-in to a view by either saying yes or no here.
Then auto check-in [00:03:59](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m59s) is a little tweak that I've added to my Joomla components and I'm possibly going to make a pull request to add it to Joomla. What auto check-in does, it adds a feature to your component. Since I had clients that have complained that some people had opened an item and then clicked back in the browser , instead of clicking close and consequently the item got locked out [00:04:28](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m28s) to that individual and got inaccessible unless they have admin rights to check it back in, therefore we had created an auto check-in. Auto check-in checks whether this item has been checked out longer than a set period and if it happened to be so, checks it automatically. That set period is something that the administrator sets in the global settings of the component. I'll show you that later. [00:04:57](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m57s) You can add auto check-in to a view by either saying 'yes' or 'no'.
**Settings Switch Keep History**
Then keeping history of a back end view. The history component I must tell you is maybe one of them most exciting things that I could integrate. You will see what it does. It keeps track of every change you make in any article or any item in your application. So for example if I was to go [00:05:33](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m33s) to preacher and I would open up a Capella Music you'd see that it has that version button here at the top. If I was going to make a change here(Email), let's say I typed in Info@vdm.io and I set 'Some text here' and I clicked save. Then I click on version, you will see that it is now locked a new version. [00:06:13](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m13s) There are the old ones. I could click on one of the old ones. First let me say I could take the one I'm on currently and I can say keep. That would sort of lock it in because you can also set it how long amount of history should the system keep. The default is 10, 10 changes. so I can click on the previous version and say restore. And this will restore it and you see there. Email address is gone and this description is gone. If I want to go back to the one I have done I could just click there on version again, [00:06:52](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m52s) I then click there and also restore. We would the details are back again. That is the feature of history. History component is actually a Joomla extension which you're able as a component developer integrate into your own components. [00:07:14](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m14s) And it's not that easy in fact it's maybe very difficult.
Keeping history of a back end view. The History Component is one of the most exciting things that I have integrated. It keeps track of every change you make in any article or item in your application.
* **For example**
If I go [00:05:33](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m33s) to preacher and I would open 'A Capella Music' you'd see that it has that 'version' button at the top. If I was going to make a change here(Email), let's say, I typed in Info@vdm.io and I set 'Some text here' and I clicked 'save'. Then I click on 'version', you will see that it is now locked a new version. [00:06:13](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m13s) There are the old ones. I could click on one of the old ones. First let me say I could take the one I'm on currently and I can say keep. That would sort of lock it in because you can also set it how long amount of history should the system keep. The default is 10 changes. I can click on the previous version and say restore and it will be restored it. As you can see, Email address and description is gone. To go back to the one that has been done just click on 'version' [00:06:52](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m52s) and 'restore'again and the details are back again. History Component is actually a Joomla extension which you're able as a component developer to integrate into your own components. [00:07:14](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m14s) <<<<<<<<<<<
If I was to show you the amount of code let me do that, that you need to write. First of all you need to add an asset ID to all your back end view database tables. If we were to go to sermon distributor, and check out it's sql table, we'll click on that(installmysql), you'd see that all of them have asset_ids. That is not as easy as it is. Once you've got the asset_ids, then in table when you start your table you should set up observers. Which check the specific item to add history options to that asset_id. This(see video) is a part of the whole part of the script that is being add. This(see video) is being added on the right place. [00:08:45](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m45s)
@ -47,6 +50,14 @@ We'll look at the tags in the category concept just a little bit later. Content
The update method also takes care of the little lot of discrepancies because as you develop your extension. There are two phases of development. The one phase is, when you're busy building it and no one else in the world has it. That's a very easy phase in fact then you don't really use this nice feature. You just uninstall it and reinstall it every time until you happy with what you see. But then once you put it out in the public you can't just step up your database structure without the needed scripting for others to do a easy upgrade. Because they already got data in the database they can't just uninstall and install. [00:13:13](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m13s) Component builder has a way for you to actually address that. Well obviously because I have to deal with it and I don't want to have my clients complain. I added a feature which will look at inside of component builders component area. I will explain it in detail but just that you know, this part of the update feature, you making use of, you're a specific integration, to keep track of your back end view changes to items is in place already written by component builders telling you here on which line it was done, [00:13:55](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h13m55s) if you have that switch trip. That is just giving you a quick glimpse into the code of a little switch called keep history. This little switch does all that for you for this specific view.
**Settings Switch MetaData**
Then depending on whether you going to use this views information on the front end as your main base for your [00:14:23](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m23s) page. You might want to add Metadata. The metadata isn't that useful anymore, although google and others are maybe ignoring it. It still plays a role to making a page very search engine optimized. Component builder if you do your homework and you do things right [00:14:51](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h14m51s) in relationship to implementation of your metadata, you'd see that it actually adds tremendous good features to do your front end of your site. I would suggest that you add Metadata when you are going to use a specific area to the front and when we start looking at us setting up the site views you'll see this coming up again and the necessity of using it. Obviously you'll be remodeling the data because you can get relationship from many databases. [00:15:26](https://www.youtube.com/watch?v=39vY66X7GGU&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h15m26s) You need the area in the back end to get the data.