Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » ModelAdmin

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1 2 3
Go to End
Author Topic: 3861 Views
  • UncleCheese
    Avatar
    4085 Posts

    ModelAdmin Link to this post

    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?

  • UncleCheese
    Avatar
    4085 Posts

    Re: ModelAdmin Link to this post

    Seriously? No one knows how to use this thing?

  • jam13
    Avatar
    121 Posts

    Re: ModelAdmin Link to this post

    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.

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: ModelAdmin Link to this post

    I have three working, and will be updating the docs shortly. Assuming that the code is in MyModelAdmin.php, have you tried adding ?flush=1?

    jam13, that has been fixed in r65843 and r65851

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: ModelAdmin Link to this post

    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 !

  • jam13
    Avatar
    121 Posts

    Re: ModelAdmin Link to this post

    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.

    http://svn.silverstripe.com/open/phpinstaller/branches/2.3/

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: ModelAdmin Link to this post

    Hi Jam,

    Thanks for the tip, that helped !

    Love what I'm seeing so far !

  • UncleCheese
    Avatar
    4085 Posts

    Re: ModelAdmin Link to this post

    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'
       );
       
    }

    ?>

    3861 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.