5102 Posts in 1520 Topics by 1116 members
| Go to End | Next > | |
| Author | Topic: | 2382 Views |
-
Re: New Admin Module

22 September 2010 at 3:17pm
Here's the CategoryAdmin class using the Panel Model Admin
class CategoryAdmin extends PanelModelAdmin {
public static $managed_models = array(
'Category',
'Article',
);
static $menu_title = 'Category Admin';
static $url_segment = 'cat_admin';function init() {
parent::init();Requirements::block('sapphire/thirdparty/jquery-ui-themes/base/jquery-ui-1.8rc3.custom.css');
Requirements::css('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css');
Requirements::javascript('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js');$this->addPanel('CategoryPanel', new CategoryMenuPanel('Category', 'open', array('Category' => array('Article'))));
}
} -
Re: New Admin Module

23 September 2010 at 6:25am
Yes no I remember
At this moment you have to add CategoryID to the searchable fields as well...
I'm trying to fix this within PanelModelAdmin, but this is not easy...
add this as well to Article.php
static $searchable_fields = array(
'Title',
'CategoryID'
); -
Re: New Admin Module

24 September 2010 at 5:44am
Requirements isn't working for getCMSFields =(
class Product:public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->removeByName('Content');
$fields->addFieldToTab('Root.Main', new MyCustomField('Content'));return $fields;
}
But if u add them to ProductsAdmin::init() works fine. -
Re: New Admin Module

24 September 2010 at 7:33am
Can you post your code with the Requirements?
This does work for me:
function getCMSFields(){
$f = parent::getCMSFields();
Requirements::javascript('articles/javascript/articles.js');
return $f;
} -
Re: New Admin Module

24 September 2010 at 8:59am
class CkEditField extends HtmlEditorField {
public static function include_js($name) {
Requirements::block('sapphire/thirdparty/tinymce/tiny_mce_src.js'); // <-- don't work
Requirements::javascript('mysite/ckeditor/ckeditor.js'); // <-- don't work
}
function Field() {
...
Requirements::customScript($CKEditor->generateJS(), 'CkEditorConfig'); // <-- don't work
return $CKEditor->editor($this->name, $value->getContent()); // <-- that's string returned and included
}
public function __construct($name, $title = null, $rows = 30, $cols = 20, $value = '', $form = null) {
parent::__construct($name, $title, $rows, $cols, $value, $form);
$this->include_js($name);
}
...
} -
Re: New Admin Module

24 September 2010 at 10:59am
It works in Content and popup window, but in PanelAdmin u have to add it manually and of course i have changed JS to replace tinymce.
Also that thing isn't working http://www.silverstripe.org/general-questions/show/292626?showPost=292632
So i think something wrong with PanelAdmin's parsing fields functions
| 2382 Views | ||
| Go to Top | Next > |



