Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan-Hendrik Willms
Stud.IP
Commits
c65f571c
Commit
c65f571c
authored
Apr 21, 2022
by
Jan-Hendrik Willms
Browse files
Options
Downloads
Patches
Plain Diff
small adjustments to icon tag generation
parent
f65081a8
No related branches found
No related tags found
1 merge request
!1
Draft: Adjust icon handling
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/classes/Icon.class.php
+13
-14
13 additions, 14 deletions
lib/classes/Icon.class.php
resources/assets/stylesheets/studip.less
+2
-1
2 additions, 1 deletion
resources/assets/stylesheets/studip.less
with
15 additions
and
15 deletions
lib/classes/Icon.class.php
+
13
−
14
View file @
c65f571c
...
@@ -36,16 +36,10 @@ class Icon
...
@@ -36,16 +36,10 @@ class Icon
const
ROLE_SORT
=
'sort'
;
const
ROLE_SORT
=
'sort'
;
const
ROLE_STATUS_YELLOW
=
'status-yellow'
;
const
ROLE_STATUS_YELLOW
=
'status-yellow'
;
protected
$shape
;
protected
$role
;
protected
$attributes
=
[];
/**
/**
* This is the magical Role to Color mapping.
* This is the magical Role to Color mapping.
*/
*/
private
static
$roles_to_colors
=
[
const
ROLES_TO_COLORS
=
[
self::ROLE_INFO
=>
'black'
,
self::ROLE_INFO
=>
'black'
,
self::ROLE_CLICKABLE
=>
'blue'
,
self::ROLE_CLICKABLE
=>
'blue'
,
self::ROLE_ACCEPT
=>
'green'
,
self::ROLE_ACCEPT
=>
'green'
,
...
@@ -60,13 +54,18 @@ class Icon
...
@@ -60,13 +54,18 @@ class Icon
self::ROLE_STATUS_YELLOW
=>
'yellow'
self::ROLE_STATUS_YELLOW
=>
'yellow'
];
];
protected
$shape
;
protected
$role
;
protected
$attributes
=
[];
// return the color associated to a role
// return the color associated to a role
p
rivate
static
function
roleToColor
(
$role
)
p
ublic
static
function
roleToColor
(
$role
)
{
{
if
(!isset(self::
$roles_to_colors
[
$role
]))
{
if
(!isset(self::
ROLES_TO_COLORS
[
$role
]))
{
throw
new
\InvalidArgumentException
(
'Unknown role: "'
.
$role
.
'"'
);
throw
new
\InvalidArgumentException
(
'Unknown role: "'
.
$role
.
'"'
);
}
}
return
self::
$roles_to_colors
[
$role
];
return
self::
ROLES_TO_COLORS
[
$role
];
}
}
// return the roles! associated to a color
// return the roles! associated to a color
...
@@ -75,7 +74,7 @@ class Icon
...
@@ -75,7 +74,7 @@ class Icon
static
$colors_to_roles
;
static
$colors_to_roles
;
if
(!
$colors_to_roles
)
{
if
(!
$colors_to_roles
)
{
foreach
(self::
$roles_to_colors
as
$r
=>
$c
)
{
foreach
(self::
ROLES_TO_COLORS
as
$r
=>
$c
)
{
$colors_to_roles
[
$c
][]
=
$r
;
$colors_to_roles
[
$c
][]
=
$r
;
}
}
}
}
...
@@ -169,7 +168,7 @@ class Icon
...
@@ -169,7 +168,7 @@ class Icon
{
{
// only defined roles
// only defined roles
if
(!isset(self::
$roles_to_colors
[
$role
]))
{
if
(!isset(self::
ROLES_TO_COLORS
[
$role
]))
{
throw
new
\InvalidArgumentException
(
'Creating an Icon without proper role: "'
.
$role
.
'"'
);
throw
new
\InvalidArgumentException
(
'Creating an Icon without proper role: "'
.
$role
.
'"'
);
}
}
...
@@ -227,7 +226,7 @@ class Icon
...
@@ -227,7 +226,7 @@ class Icon
*/
*/
public
function
signalsAttention
()
public
function
signalsAttention
()
{
{
return
$this
->
roleToColor(
$this
->role)
===
'red'
;
return
self::
roleToColor(
$this
->role)
===
'red'
;
}
}
/**
/**
...
@@ -436,7 +435,7 @@ class Icon
...
@@ -436,7 +435,7 @@ class Icon
$result
[
'alt'
]
=
''
;
$result
[
'alt'
]
=
''
;
}
}
$classNames
=
'icon-role-'
.
$this
->role;
$classNames
=
'icon-role-'
.
str_replace(
'_'
,
'-'
,
$this
->role
)
;
if
(!self::isStatic(
$this
->shape))
{
if
(!self::isStatic(
$this
->shape))
{
$classNames
.
=
' icon-shape-'
.
$this
->shape;
$classNames
.
=
' icon-shape-'
.
$this
->shape;
...
...
This diff is collapsed.
Click to expand it.
resources/assets/stylesheets/studip.less
+
2
−
1
View file @
c65f571c
...
@@ -299,7 +299,8 @@ div.overdiv {
...
@@ -299,7 +299,8 @@ div.overdiv {
p { color: #000; }
p { color: #000; }
}
}
}
}
img {
img,
svg {
height: calc(100% - 20px);
height: calc(100% - 20px);
position: absolute;
position: absolute;
top: 10px;
top: 10px;
...
...
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