Updated 007 Admin Views (markdown)
parent
89fc90d9c2
commit
dd646f0b9f
@ -1,25 +1,25 @@
|
||||
# ADMIN VIEWS
|
||||
|
||||
Hi, we are looking at admin views which is the next thing to be setting up in developing your component. First we started with field types. Looking at how to setup field types or improve on them. Then we looked at how to use those field types to build basic common fields. Now we going to look at how to take those fields and add them to admin views. [00:00:34](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m34s)
|
||||
In this tutorial we are looking at admin views, the next step of developing your component. First we started with field types and how to set up and improve on them. Then we learned to use those field types to build basic common fields. Now we are going to take those fields and add them to admin views. [00:00:34](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m34s)
|
||||
|
||||
**Admin Views/Naming Convention**
|
||||
**Naming Convention**
|
||||
|
||||
Admin views like I explained in our initial General Planning video. It basically forms the bedrock, the basis of your components database structure so your admin views is where your database structure is being developed. [00:00:56](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m56s)
|
||||
All your admin views which have their own table. Now as we explained admin views have a single name and has a list record or a plural name. Then there is a system name and the reason why there they actually have three, is that let's say you want to reuse this specific admin view in another component [00:01:21](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m21s) with the same name but obviously adapting it to that component. The idea would be that you would then have two preachers showing up in your selection list. When you added to the component and so that might be difficult to discern which is which and so you can add the name of that specific component as part of just differentiating between [00:01:47](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m47s) the same names. That means you can have admin views with the same names, but with different implementation. In fact that is how you can do different version control concepts on components using the same admin view. [00:02:03](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m03s)
|
||||
Admin views, like I explained in our initial General Planning tutorial, forms the basis of your component's database structure. Admin views is where your database structure is being developed. [00:00:56](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h00m56s)
|
||||
All admin views have their own table. They have a single name, a list record or a plural name. Then there is a system name. The reason why there are three is that when you want to reuse a specific admin view in another component with the same name, but adapting it to that component, you would then have two of the same names showing up in your selection list when you add it to the component. [00:01:21](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m21s) It might then be difficult to discern which is which, hence you can add the name of that specific component as part of differentiating between the same names. [00:01:47](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h01m47s) That means you can have admin views with the same names, but with different implementations. That is how you can do different version control concepts on components, using the same admin view, making a few changes inside of it, and then saving it. [00:02:03](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m03s) You can open the name, type free version, and save as copy. You can then change some of the fields that are linked. You can change some of the linked views, your CSS, or whatever other things you have done regarding this admin view. [00:02:25](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m25s) Now go to the free version of that component and link that specific view instead of the other.
|
||||
|
||||
**Example View Preacher**
|
||||
**Creating an Admin View**
|
||||
|
||||
Just inside of it making a few changes and in saving it so you could do that open preacher for example and in here you could say free version. This is the free version and then save as copy and then you can change the field that is linked. You can change some of the linked views. [00:02:25](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m25s) You can change some of your CSS, whatever other things you have done regarding this admin view, and then go to the free version of that component and link that specific one that specific view instead of the other. Anyway maybe I'm getting ahead of myself I usually do. So let's focus on admin views. Now to create a admin view. You just click new. [00:02:54](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m54s) I'm going to open preacher again because this is the one we are using as our illustration and you would see that there should be a name for a single record. Again that is where you would edit this records so that is in this case I said preacher and then there is a list of records and that's preachers. [00:03:14](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m14s) Then a short description and a normal description depending on what you would like to say. Then there is a type, now the read write, and the read only, changes the components editing view. If you say read only, then it will basically limit [00:03:36](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m36s) the fields to not be able to edit them. If you remember the modified by field cannot be edited because it's done automatically and when it was modified is also updated as every time you click save. So this area can not be edited and that's how all the fields are going to look. [00:04:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m02s) If you select read only if you leave it on read write, it will look like this and you will be able to edit it. So that is looking at these fields.
|
||||
Click new to create an admin view. [00:02:54](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h02m54s) I'm going to open preacher, because it's the one we are using as our illustration. You'd see that there should be a name for a single record. That is where you would edit these records. (In this case, it is preacher.) Below it is a list of records that are preachers. [00:03:14](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m14s) There is a short description and a normal description, depending on what you would like to say. There is a type; 'read/write' and 'readonly' which changes the component's editing view. If you say 'readonly,' the fields wouldn't be editable. [00:03:36](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h03m36s) The 'Modified By' field cannot be edited because it's done automatically, and when it was modified, it updates every time you click save. [00:04:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m02s) If you leave it on 'read/write,' you will be able to edit it.
|
||||
|
||||
**View Icons - Add Icon, Normal Icon**
|
||||
**View Icons**
|
||||
|
||||
Now there is a place for an icon if you hoover over the icon it gives you the dimensions that is needed. This basically is the icon. Then when you look [00:04:24](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m24s) at the dashboard, these icons are the one selected there. So you can see that the icon has two of them, one is the add icon, and one is a normal icon so if you hoover here you should see the image if it is set in [00:04:46](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m46s) your images folder. So if you open this it goes to your image folder you select the icon. When you hoover here those images are not in this image folder, so it does not show up. And then if you going to add preachers if you going to add a field just a field called category that is of the category type, [00:05:14](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m14s) then you should add a category icon. Since then the system will automatically know there need to be a category setup. And it will look for category icon to use for that category and if you select a category field that is a general category for the whole component which isn't directly linked to this [00:05:37](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m37s) view, then it will take the first view the system will look at which view when it processes it which view is the first one and usually that would be the first one you've created and it will use the icon in that but to be on the safe side if you using one category for them all just set the same icon on them all.
|
||||
There is a place for an icon. (If you hoover over the icon it gives you the dimensions that is needed.) When you look at the dashboard, those icons there are the ones selected. [00:04:24](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m24s) The icon has two options: 'Add Icon' and 'Icon.' If you hoover over 'Icon,' you should see the images if they are set in your images folder. [00:04:46](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h04m46s) If you open this, it goes to your image folder where you select the icon. If you are going to add a field called category that is of the category type, then you should add a category icon. [00:05:14](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m14s) Since the system will then automatically know that there has to be a category setup, and will look for a category icon to use for that category. If you select a category field that is a general category for the whole component, which isn't directly linked to this view, it will take the first view (the system, when processing, will see which view is first, which would usually be the first one you've created) and use the icon in that view. To be on the safe side, if you are using one category for them all, set the same icon on them all. [00:05:37](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h05m37s) If you are going to use a category which is primarily focused on the preachers, and you are going to put preachers in a category, you need to add a category icon for categories. [00:06:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m02s)
|
||||
|
||||
**Permission Implementation**
|
||||
|
||||
If you are going to use a category [00:06:02](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m02s) which is primarily focused on the preachers, and you just going to put preachers and a category then you need to add a category icon here four categories now permissional switch it got to do with your accessing and updating of data. So like you can see here we have [00:06:24](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m24s) view edit, view edit state, view edit own, views create, admin views delete, admin view access, admin view edit version. Now this edit if it is set if you are in this managing group and it set to allowed then you can edit it. If you are a guest and it is set to deny, [00:06:49](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m49s) and no matter where you are in the front or the back of the site, you won't be able to edit this information even if you have a direct link. It won't allow you to edit it. Now it also has view access so somebody who might be not allowed to edit it may be allowed to view [00:07:08](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m08s) this content in the back end in the list view. Then it will show in the list view and they can see that it is there. Now you might think to yourself why would I ever want to do that and you see because of your custom admin views and the way that you can connect them to your admin views, which we will look at later. You might want to display the record and [00:07:32](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m32s) just leave an custom admin link to the data.
|
||||
The permission switch is related to accessing and updating of data. Here we have admin views edit, admin views edit state, admin views edit own, admin views create, admin views delete, admin views access, and admin views edit version. [00:06:24](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m24s) If you are in the managing group and the particular edit is set to allowed, you can edit it. If you are a guest and it is set to deny, no matter where you are in the front or back of the site, (even if you have a direct link,) you won't be able to edit this information. [00:06:49](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h06m49s) It does has view access so that somebody who might be not allowed to edit, can still view the content in the back end in the list view. [00:07:08](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m08s) It will show in the list view, and they can see that it is there. You might want to display the record and leave a custom admin link to the data. [00:07:32](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m32s)
|
||||
|
||||
Let me show you an example of a component that you see here, there is a button underneath the company name. So it displays the record but [00:07:53](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m53s) if it was like (Arandis Town Council) whose profile is set to being locked. If I was to click on this it will tell me that I do not have the permission to edit it, but if I was to click on this icon it actually loads the information that I looking for and [00:08:12](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m12s) that is the difference. The differences sometimes you want to use a custom, see this is a custom admin view and you might want to do something that is not a editing view, but a custom view and then you would like to see the record but not edited so that's really what [00:08:36](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m36s) that is all about.
|
||||
Here is an example of a component that does that. There is a button underneath the company name. The record is being displayed, but if the profile is set to being locked and I was to click on this, it will tell me that I do not have the permission to edit it. [00:07:53](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h07m53s) But if I click on the icon below the company name, it loads the information that I am looking for. [00:08:12](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m12s) Sometimes you want to use a custom or to do something that is not an editing view; or you would like to see the record, but not edit it. [00:08:36](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h08m36s)
|
||||
|
||||
We are back here and we are looking at permissions. So opening this permission tab, you would see that there is view edit, view edit own, view edit state, and all these have been created usually when you open this. It might [00:09:00](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m00s) look like that so you would set the first one and that you would see there are two options. One is core edit and one is view edit. The core edit means that you want to do a global switch. Now [00:09:27](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m27s) let me try and explain that by opening Component Builders options. We haven't actually looked at this yet, but it is quite important you would see that all components in Joomla you have what is called the create edit, delete edit state, edit own, it is this list of options which means that if you select this [00:09:56](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h09m56s) you know that they can't create something then it is applicable to everything in this component because it's a global setting so everything that doesn't have a view name behind it. Like this is a view name and it says access. This is a view name and it says batch use. [00:10:18](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m18s) But this says only batch use. So that's the global for batch use, and this is only related to this view. So you can say I am allowing them to do a batch function, but in this admin view I don't want to allow them to do a batch function. Or you could say [00:10:39](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h10m39s) you know what, I want to use inheritance. So that means I'm going to do that I want them to be able to do batch functions here and in this view. Now the reason why you can do it in two places is that you have a global switch to stop them from doing it. But you can also locally to the view tweak whether they are able to to edit do some of these features. [00:11:08](https://www.youtube.com/watch?v=CdSKSCTzmRA&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&t=00h11m08s)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user