Skip to content

Commit

Permalink
Added pivotGlyphicon for customizing backend UI
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiclord committed Aug 28, 2017
1 parent 326f0ea commit c681275
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/Charcoal/Relation/Interfaces/PivotableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@ public function belongsTo();
* @return string
*/
public function pivotHeading();

/**
* Retrieve the pivot's target object glyphicon identifier.
*
* @return string
*/
public function pivotGlyphicon();
}
22 changes: 22 additions & 0 deletions src/Charcoal/Relation/Traits/PivotableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,28 @@ protected function defaultPivotHeading()
]);
}

/**
* Retrieve the pivot's target object glyphicon identifier.
*
* To be extended on objects that use PivotableTrait.
*
* @return string
*/
public function pivotGlyphicon()
{
return $this->defaultPivotGlyphicon();
}

/**
* Retrieve the default pivot target object Glyphicon template.
*
* @return string
*/
protected function defaultPivotGlyphicon()
{
return 'modal-window';
}

/**
* Remove all pivots linked to a specific object.
*
Expand Down
2 changes: 1 addition & 1 deletion templates/charcoal/admin/widget/relation/header.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{# objectTypes }}
<li>
<a href="{{ baseUrl }}admin/object/edit?obj_type={{ val }}{{# id }}&obj_id={{ . }}{{/ id }}" data-type="{{ val }}" data-title="{{ label }}" class="js-add-relation" target="_blank">
<span class="glyphicon {{ glyphicon }}"></span>
<span class="glyphicon"></span>
<span class="glyphicon-class">{{ label }}</span>
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion templates/charcoal/admin/widget/relation/object.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
data-type="{{ objType }}">
<header draggable="true" id="{{ widgetId }}_heading_{{ id }}" class="panel-heading">
<h4 class="panel-title">
<span class="panel-title-icon glyphicon glyphicon-modal-window"></span>
<span class="panel-title-icon glyphicon glyphicon-{{ pivotGlyphicon }}"></span>
<a href="object/edit?main_menu={{ main_menu }}&obj_type={{ objType }}&obj_id={{ id }}">{{& pivotHeading }}{{^ active }}&mdash; <span class="small">{{# _t }}Disabled{{/ _t }}</span>{{/ active }}</a>
</h4>
</header>
Expand Down

0 comments on commit c681275

Please sign in to comment.