Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AdminLTE renderer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
AdminLTE renderer
Commits
e21d95a9
Commit
e21d95a9
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
Card: add windowstate and toolbox buttons
parent
0baf167e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
public_html/classes/render-adminlte.class.php
+39
-2
39 additions, 2 deletions
public_html/classes/render-adminlte.class.php
public_html/pages/components/card.php
+6
-0
6 additions, 0 deletions
public_html/pages/components/card.php
with
45 additions
and
2 deletions
public_html/classes/render-adminlte.class.php
+
39
−
2
View file @
e21d95a9
...
...
@@ -517,6 +517,7 @@ class renderadminlte {
/**
* get a card
* https://adminlte.io/docs/3.2/components/cards.html
* https://adminlte.io/docs/3.2/javascript/card-widget.html
*
* @param type $aOptions hash with keys for all options
* >> styling
...
...
@@ -526,6 +527,14 @@ class renderadminlte {
* "gradient" - whole card is colored with a gradient
* - type - one of [none]|danger|dark|info|primary|secondary|success|warning
* - class - any css class for customizing, eg. "disabled"
* - state - one of [none]|collapsed|maximized
*
* >> toolbar icons - set to true to show it; default: none of it is visible
* - tb-collaps
* - tb-expand it is added automatically if you set 'state'=>'collapsed'
* - tb-maximize
* - tb-minimize it is added automatically if you set 'state'=>'maximized'
* - tb-remove
*
* >> texts/ html content
* - title - text: title of the card
...
...
@@ -535,7 +544,7 @@ class renderadminlte {
* @return string
*/
public
function
getCard
(
$aOptions
){
$aOptions
=
$this
->
_ensureOptions
(
$aOptions
,
[
'variant'
,
'type'
,
'class'
,
'title'
,
'tools'
,
'text'
,
'footer'
]);
$aOptions
=
$this
->
_ensureOptions
(
$aOptions
,
[
'variant'
,
'type'
,
'class'
,
'collapsable'
,
'title'
,
'tools'
,
'text'
,
'footer'
]);
// css class prefixes based on "variant" value
$aVariants
=
[
'default'
=>
'card-'
,
...
...
@@ -544,13 +553,41 @@ class renderadminlte {
'gradient'
=>
'bg-gradient-'
,
];
// window states: css class and toolbar buttons to add
$aStates
=
[
'collapsed'
=>
[
'class'
=>
'collapsed-card'
,
'tool'
=>
'tb-expand'
],
'maximized'
=>
[
'class'
=>
'maximized-card'
,
'tool'
=>
'tb-minimize'
],
];
$aTools
=
[
'tb-collaps'
=>
'<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-minus"></i></button>'
,
'tb-expand'
=>
'<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fas fa-plus"></i></button>'
,
'tb-maximize'
=>
'<button type="button" class="btn btn-tool" data-card-widget="maximize"><i class="fas fa-expand"></i></button>'
,
'tb-minimize'
=>
'<button type="button" class="btn btn-tool" data-card-widget="maximize"><i class="fas fa-compress"></i></button>'
,
'tb-remove'
=>
'<button type="button" class="btn btn-tool" data-card-widget="remove"><i class="fas fa-times"></i></button>'
,
];
// print_r($aOptions);
$sVariantPrefix
=
$aVariants
[
$aOptions
[
'variant'
]]
?
$aVariants
[
$aOptions
[
'variant'
]]
:
$aVariants
[
'default'
];
$sClass
=
'card'
.
(
$aOptions
[
'class'
]
?
' '
.
$aOptions
[
'class'
]
:
''
)
.
(
$aOptions
[
'type'
]
?
' '
.
$sVariantPrefix
.
$aOptions
[
'type'
]
:
''
)
;
// check window state
foreach
(
$aStates
as
$sStatus
=>
$aStatus
){
if
(
$aOptions
[
'state'
]
===
$sStatus
){
$sClass
.
=
' '
.
$aStatus
[
'class'
];
$aOptions
[
$aStatus
[
'tool'
]]
=
1
;
}
}
// add toolbar buttons - from given options or by window state
foreach
(
$aTools
as
$sTool
=>
$sHtml
){
$aOptions
[
'tools'
]
.
=
(
$aOptions
[
$sTool
]
?
$sHtml
:
''
);
}
// build parts of the card
$sCardHeader
=
$this
->
addWrapper
(
'div'
,
[
'class'
=>
'card-header'
],
$this
->
_tag
(
'h3'
,
[
'class'
=>
'card-title'
,
'label'
=>
$aOptions
[
'title'
]])
...
...
This diff is collapsed.
Click to expand it.
public_html/pages/components/card.php
+
6
−
0
View file @
e21d95a9
...
...
@@ -3,6 +3,12 @@
$aOptions
=
[
'type'
=>
'primary'
,
'variant'
=>
'solid'
,
'tb-remove'
=>
1
,
'tb-collapse'
=>
1
,
// 'state'=>'collapsed',
'title'
=>
'I am a card'
,
'tools'
=>
'123'
,
'text'
=>
'Hello everybody out there!'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment