Skip to content

Commit

Permalink
issue (feature) #17 fixed (added), config file modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyslik committed Feb 15, 2016
1 parent cd68e32 commit fa9d9ee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
5 changes: 4 additions & 1 deletion src/ColumnSortable/Sortable.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ public static function link(array $parameters) //Extending Blade; Blade sends ar
}

if (Input::get('sort') == $sortOriginal && in_array(Input::get('order'), ['asc', 'desc'])) {
$icon = $icon . '-' . Input::get('order');
$asc_suffix = Config::get('columnsortable.asc_suffix', '-asc');
$desc_suffix = Config::get('columnsortable.desc_suffix', '-desc');

$icon = $icon . (Input::get('order') === 'asc' ? $asc_suffix : $desc_suffix);
} else {
$icon = Config::get('columnsortable.sortable_icon');
}
Expand Down
26 changes: 18 additions & 8 deletions src/config/columnsortable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,50 @@
return [

/*
Spec columns.
spec columns
*/
'columns' => [
'alpha_columns' => [
'alpha' => [
'rows' => ['description', 'email', 'name', 'slug'],
'class' => 'fa fa-sort-alpha',
],
'amount_columns' => [
'amount' => [
'rows' => ['amount', 'price'],
'class' => 'fa fa-sort-amount'
],
'numeric_columns' => [
'numeric' => [
'rows' => ['created_at', 'updated_at', 'level', 'id', 'phone_number'],
'class' => 'fa fa-sort-numeric'
],
],

/*
Defines icon set to use when sorted data is none above.
defines icon set to use when sorted data is none above (alpha nor amount nor numeric)
*/
'default_icon_set' => 'fa fa-sort',

/*
Icon that shows when generating sortable link while column is not sorted.
icon that shows when generating sortable link while column is not sorted
*/
'sortable_icon' => 'fa fa-sort',

/*
Default anchor class, if value is null none is added. (must be type of null)
suffix class that is appended when ascending order is applied
*/
'asc_suffix' => '-asc',

/*
suffix class that is appended when descending order is applied
*/
'desc_suffix' => '-desc',

/*
default anchor class, if value is null none is added
*/
'anchor_class' => null,

/*
Relation - column separator. ex: detail.phone_number means relation "detail" and column "phone_number".
relation - column separator. ex: detail.phone_number means relation "detail" and column "phone_number"
*/
'uri_relation_column_separator' => '.'

Expand Down

0 comments on commit fa9d9ee

Please sign in to comment.