Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arikaim
committed
Nov 8, 2023
1 parent
88fa13d
commit 528dc00
Showing
6 changed files
with
99 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{% set selected = selected|default(getViewType(namespace)) %} | ||
{% set size = size|default('h-6 w-6') %} | ||
{% set color = color|default('text-gray-800 dark:text-gray-100') %} | ||
{% set icons = { | ||
table: 'icons~list', | ||
grid: 'icons~template' | ||
} | ||
%} | ||
<div class="tooltip" data-tip="{{ tooltip }}"> | ||
<label | ||
class="swap swap-rotate {{ class }}"> | ||
<input | ||
id="{{ component_id|default('view-type') }}" | ||
namespace="{{ namespace }}" | ||
view-type="{{ items[selected].value }}" | ||
{{ (selected == 'table') ? 'checked' : '' }} | ||
type="checkbox" /> | ||
|
||
{{ component(icons.table,{ | ||
color: color, | ||
size: size, | ||
class: 'swap-on' | ||
},'svg') | ||
}} | ||
|
||
{{ component(icons.grid,{ | ||
color: color, | ||
size: size, | ||
class: 'swap-off' | ||
},'svg') | ||
}} | ||
</label> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Arikaim | ||
* @copyright Copyright (c) Intersoft <info@arikaim.com> | ||
* @license http://www.arikaim.com/license | ||
* http://www.arikaim.com | ||
*/ | ||
'use strict'; | ||
|
||
arikaim.component.onLoaded(function(component) { | ||
|
||
component.setViewType = function(viewType, onSuccess, onError) { | ||
return arikaim.put('/core/api/ui/paginator/view/type',{ | ||
view: viewType, | ||
namespace: component.get('namespace','') | ||
},onSuccess,onError); | ||
}; | ||
|
||
component.init = function() { | ||
|
||
arikaim.ui.button($(component.getElement()),function(element) { | ||
var checked = $(element).prop('checked'); | ||
var viewType = (checked == true) ? 'table' : 'grid'; | ||
|
||
component.setViewType(viewType,function(result) { | ||
component.set('view-type',result.view); | ||
}); | ||
}); | ||
|
||
}; | ||
|
||
component.init(); | ||
|
||
return component; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"tooltip": "View Type", | ||
"items": { | ||
"table": { | ||
"value": "table", | ||
"title": "Table", | ||
"icon": "list" | ||
}, | ||
"grid": { | ||
"value": "grid", | ||
"title": "Grid", | ||
"icon": "th" | ||
} | ||
} | ||
} |