diff --git a/src/ColumnSortable/Sortable.php b/src/ColumnSortable/Sortable.php index 69c43fe..0f3a624 100755 --- a/src/ColumnSortable/Sortable.php +++ b/src/ColumnSortable/Sortable.php @@ -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'); } diff --git a/src/config/columnsortable.php b/src/config/columnsortable.php index f0d88fe..528564b 100755 --- a/src/config/columnsortable.php +++ b/src/config/columnsortable.php @@ -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' => '.'