17488 Posts in 4473 Topics by 1978 members
| Go to End | Next > | |
| Author | Topic: | 3540 Views |
-
ModelAdmin

15 November 2008 at 6:25am
Okay, I love the idea, but I have no idea how to use it. I put this in my mysite/code/ folder:
<?php
class MyModelAdmin extends ModelAdmin
{
protected static $managed_models = array (
'StaffMember'
);
public function Link()
{
return 'admin/mymodeladmin/';
}
}?>
Not noticing anything new in the CMS. Did I do this right?
-
Re: ModelAdmin

18 November 2008 at 4:59am
There's precious little documentation on this that I can find. I've got as far as getting a new tab to appear in the admin panel, and it seems to have all the right controls, however clicking on "Create" just throws a js error:
processOnDemandHeaders is not defined
which seems to be jQuery related. I'm planning on debugging this further when I get the time, but I'd like to hear if anyone has actually got this to work.
-
Re: ModelAdmin

18 November 2008 at 9:20pm
We can't get this thing going as well. It does display the interface (the left bar) , but nothing happens when you want to use it.
Love the idea though !
-
Re: ModelAdmin

18 November 2008 at 11:33pm
Try checking out the lastest 2.3 branch code (not nightly builds which apparently are not being updated). I finally got this working last night after being told by simon_w that there had been a number of fixes for modeladmin in the last few days.
-
Re: ModelAdmin

19 November 2008 at 2:07am
Hi Jam,
Thanks for the tip, that helped !
Love what I'm seeing so far !
-
Re: ModelAdmin

25 November 2008 at 8:24am
I have no idea how you guys are getting this to work. I don't see any new tab in the CMS, and when I try to manually enter the url /admin/crm, I get a Fatal Error: Disallowed action "crm" on controller CMSMain.
Here's my code:
<?php
class MyModelAdmin extends ModelAdmin
{
protected static $managed_models = array (
'StaffMember'
);
static $url_segment = 'crm';
static $menu_title = 'My CRM';
}
class StaffMember extends SortableDataObject
{
static $db = array (
'Name' => 'Varchar(50)',
'Title' => 'Varchar(50)',
'Description' => 'Text'
);
static $has_one = array (
'Photo' => 'Image',
'AboutPage' => 'AboutPage'
);
static $searchable_fields = array (
'Name', 'Title'
);
}?>
| 3540 Views | ||
| Go to Top | Next > |


