Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added styling to status and links in MA

Signed-off-by: Aram <aram@aabweb.co.uk>
  • Loading branch information...
commit 632fb251559a9f5da45c1e8e9dd5e63158c0f51c 1 parent d3157c4
Aram authored
View
13 code/DataObjects/DataObjectAsPage.php
@@ -127,13 +127,13 @@ public function getCMSFields()
if($this->ID)
{
$color = '#E88F31';
- $links = '<a target="_blank" href="' . $this->Link('?stage=Stage') . '">View Draft</a>';
+ $links = '<a target="_blank" href="' . $this->Link('?stage=Stage') . '">Draft</a>';
$status = $this->Status;
if($this->Status == 'Published')
{
$color = '#000';
- $links .= ' | <a target="_blank" href="' . $this->Link('?stage=Live') . '">View Published</a>';
+ $links .= ' | <a target="_blank" href="' . $this->Link('?stage=Live') . '">Published</a>';
if($this->hasChangesOnStage())
{
@@ -143,8 +143,13 @@ public function getCMSFields()
}
$fields->insertFirst(new LiteralField('',
- '<h3 style=" Padding: 5px; border: 1px solid #ccc;background:#fff;margin-bottom: 10px;">
- <strong style="font-size: 16px;color: '.$color.';">'. $status . '</strong> - ' . $links .'</h3>'
+ '<div class="doapToolbar">
+ <h3 class="doapTitle" style="background: '.$color.';">'. $status . '</h3>
+ <p class="doapViewLinks">
+ Page View:' . $links . '
+ </p>
+ </div>
+ '
));
}
View
1  code/ModelAdmin/DataObjectAsPageAdmin.php
@@ -10,6 +10,7 @@ public function init()
// Remove all the junk that will break ModelAdmin
Requirements::javascript(MOD_DOAP_DIR . '/javascript/jquery.dataobjectaspageadmin.js');
+ Requirements::CSS(MOD_DOAP_DIR . '/css/dataobjectaspageadmin.css');
}
}
View
5 code/Pages/DataObjectAsPageHolder.php
@@ -145,6 +145,7 @@ class DataObjectAsPageHolder_Controller extends Page_Controller
{
//Class Of Object Listied on this page
static $item_class = 'DataObjectAsPage';
+ static $item_sort = 'Created DESC';
public static $allowed_actions = array(
'show'
@@ -156,7 +157,7 @@ class DataObjectAsPageHolder_Controller extends Page_Controller
function Items($Limit = null)
{
//Set Pagination if no limit set
- if(!$Limit)
+ if(!$Limit && $this->Paginate)
{
//Pagination
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1){
@@ -172,7 +173,7 @@ function Items($Limit = null)
$Where = ($this->hasMethod('getItemsWhere')) ? $this->getItemsWhere() : Null;
//Set custom sort
- $Sort = ($this->hasMethod('getItemsSort')) ? $this->getItemsSort() : Null;
+ $Sort = ($this->hasMethod('getItemsSort')) ? $this->getItemsSort() : $this->stat('item_sort');
//Set custom join
$Join = ($this->hasMethod('getItemsJoin')) ? $this->getItemsJoin() : Null;
View
42 css/dataobjectaspageadmin.css
@@ -0,0 +1,42 @@
+.doapToolbar{
+ border: 1px solid #ccc;
+ background: #fff;
+ margin-bottom: 15px;
+ height: 25px;
+ padding: 5px;
+}
+
+.doapToolbar h3.doapTitle{
+ padding: 5px;
+ border: 1px solid #ccc;
+ background:#fff;
+ margin-bottom: 10px;
+ font-size: 12px;
+ float: left;
+ padding: 5px 10px;
+ border: #ccc;
+ background: #aaa;
+ color: #fff;
+ border-radius: 4px;
+ font-weight: normal;
+ margin: 0;
+}
+ #right .doapToolbar p.doapViewLinks{
+ float: right;
+ padding: 0;
+ margin: 0;
+ }
+ .doapToolbar p.doapViewLinks a{
+ display: inline-block;
+ border-radius: 4px;
+ border: 1px solid #555;
+ background: #999;
+ color: #fff;
+ padding: 3px 10px;
+ margin: 0 5px;
+ text-decoration: none;
+ font-size: 14px;
+ }
+ .doapToolbar p.doapViewLinks a:hover{
+ background: #aaa;
+ }
Please sign in to comment.
Something went wrong with that request. Please try again.