From: Andrey Kutejko Date: Thu, 11 Apr 2013 16:47:08 +0000 (+0300) Subject: admin: customisable titles X-Git-Tag: 0.5~303 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=27e4b042694a23ceafe8a29a714e7221c63e4e58;p=ipf.git admin: customisable titles --- diff --git a/ipf/admin/model.php b/ipf/admin/model.php index d9b4712..842a965 100644 --- a/ipf/admin/model.php +++ b/ipf/admin/model.php @@ -313,6 +313,11 @@ class IPF_Admin_Model{ return IPF_Utils::humanTitle($this->modelName); } + public function titleList() { return $this->verbose_name().' List'; } + public function titleAdd() { return 'Add ' . $this->verbose_name(); } + public function titleEdit() { return 'Edit ' . $this->verbose_name(); } + public function titleDelete() { return 'Delete ' . $this->verbose_name(); } + public function setUp(){ $this->model = new $this->modelName; } @@ -517,7 +522,7 @@ class IPF_Admin_Model{ $context = array( 'mode'=>'add', - 'page_title'=>'Add '.$this->verbose_name(), + 'page_title'=>$this->titleAdd(), 'classname'=>$this->verbose_name(), 'form'=>$form, 'inlineInstances'=>$this->inlineInstances, @@ -547,7 +552,7 @@ class IPF_Admin_Model{ return new IPF_HTTP_Response_Redirect($url); } $context = array( - 'page_title'=>'Delete '.$this->modelName, + 'page_title'=>$this->titleDelete(), 'classname'=>$this->verbose_name(), 'object'=>$o, 'lapp'=>$lapp, @@ -613,7 +618,7 @@ class IPF_Admin_Model{ $context = array( 'mode'=>'change', - 'page_title'=>'Edit '.$this->verbose_name(), + 'page_title'=>$this->titleEdit(), 'classname'=>$this->verbose_name(), 'object'=>$o, 'form'=>$form, @@ -668,11 +673,12 @@ class IPF_Admin_Model{ $context = array( 'orderable'=>$this->_orderable(), - 'page_title'=>$this->page_title(), + 'page_title'=>$this->titleList(), 'header'=>$this->header, 'objects'=>$objects, 'pager'=>$pager, 'classname'=>$this->verbose_name(), + 'title_add'=>$this->titleAdd(), 'perms'=>$perms, 'filters'=>$this->filters, 'admin_title' => IPF::get('admin_title'), @@ -755,8 +761,5 @@ class IPF_Admin_Model{ protected function _orderable(){ return method_exists($this, 'list_order'); } - - function page_title(){ - return $this->verbose_name().' List'; - } } + diff --git a/ipf/admin/templates/admin/items.html b/ipf/admin/templates/admin/items.html index ca0e99f..24d1787 100644 --- a/ipf/admin/templates/admin/items.html +++ b/ipf/admin/templates/admin/items.html @@ -32,7 +32,7 @@ $(document).ready(function()

{$page_title}

- +
    {block objecttools}{if array_search('add',$perms)!==false}
  • {$title_add}
  • {/if}
  • Print
  • {/block}
{if $is_search}