Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
242
Issues
242
List
Boards
Labels
Service Desk
Milestones
Merge Requests
31
Merge Requests
31
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Compare Revisions
e45b8753ca60352c0d78ee75b1c40a07483e17fb...549189d11c83cfc3fb0b65810a326e932b123f82
Source
549189d11c83cfc3fb0b65810a326e932b123f82
Select Git revision
...
Target
e45b8753ca60352c0d78ee75b1c40a07483e17fb
Select Git revision
Compare
Commits (2)
(feat): Tile ratio settings
· 99049227
Emiliano Balbuena
authored
1 hour ago
99049227
(chore): Trim settings; (feat): Export single-line headline
· 549189d1
Emiliano Balbuena
authored
34 minutes ago
549189d1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
5 deletions
+39
-5
Manager.php
Core/Pro/Manager.php
+12
-5
Repository.php
Core/Pro/Repository.php
+2
-0
Settings.php
Core/Pro/Settings.php
+25
-0
No files found.
Core/Pro/Manager.php
View file @
549189d1
...
...
@@ -157,21 +157,21 @@ class Manager
// TODO: Validate!
$settings
->
setDomain
(
$values
[
'domain'
]
);
->
setDomain
(
trim
(
$values
[
'domain'
])
);
}
if
(
isset
(
$values
[
'title'
]))
{
// TODO: Validate!
$settings
->
setTitle
(
$values
[
'title'
]
);
->
setTitle
(
trim
(
$values
[
'title'
])
);
}
if
(
isset
(
$values
[
'headline'
]))
{
// TODO: Validate!
$settings
->
setHeadline
(
$values
[
'headline'
]
);
->
setHeadline
(
trim
(
$values
[
'headline'
])
);
}
if
(
isset
(
$values
[
'text_color'
]))
{
...
...
@@ -195,18 +195,25 @@ class Manager
->
setPlainBackgroundColor
(
$values
[
'plain_background_color'
]);
}
if
(
isset
(
$values
[
'tile_ratio'
]))
{
// TODO: Validate!
$settings
->
setTileRatio
(
$values
[
'tile_ratio'
]);
}
if
(
isset
(
$values
[
'logo_guid'
]))
{
// TODO: Validate!
$settings
->
setLogoGuid
(
$values
[
'logo_guid'
]
);
->
setLogoGuid
(
trim
(
$values
[
'logo_guid'
])
);
}
if
(
isset
(
$values
[
'footer_text'
]))
{
// TODO: Validate!
$settings
->
setFooterText
(
$values
[
'footer_text'
]
);
->
setFooterText
(
trim
(
$values
[
'footer_text'
])
);
}
if
(
isset
(
$values
[
'footer_links'
])
&&
is_array
(
$values
[
'footer_links'
]))
{
...
...
This diff is collapsed.
Click to expand it.
Core/Pro/Repository.php
View file @
549189d1
...
...
@@ -93,6 +93,7 @@ class Repository
->
setPrimaryColor
(
$data
[
'primary_color'
]
??
''
)
->
setPlainBackgroundColor
(
$data
[
'plain_background_color'
]
??
''
)
->
setLogoGuid
(
$data
[
'logo_guid'
]
??
''
)
->
setTileRatio
(
$data
[
'tile_ratio'
]
??
''
)
->
setFooterText
(
$data
[
'footer_text'
]
??
''
)
->
setFooterLinks
(
$data
[
'footer_links'
]
??
[])
->
setTagList
(
$data
[
'tag_list'
]
??
[])
...
...
@@ -137,6 +138,7 @@ class Repository
'text_color'
=>
$settings
->
getTextColor
(),
'primary_color'
=>
$settings
->
getPrimaryColor
(),
'plain_background_color'
=>
$settings
->
getPlainBackgroundColor
(),
'tile_ratio'
=>
$settings
->
getTileRatio
(),
'logo_guid'
=>
$settings
->
getLogoGuid
(),
'footer_text'
=>
$settings
->
getFooterText
(),
'footer_links'
=>
$settings
->
getFooterLinks
(),
...
...
This diff is collapsed.
Click to expand it.
Core/Pro/Settings.php
View file @
549189d1
...
...
@@ -26,6 +26,8 @@ use Minds\Traits\MagicAttributes;
* @method Settings setPrimaryColor(string $primaryColor)
* @method string getPlainBackgroundColor()
* @method Settings setPlainBackgroundColor(string $plainBackgroundColor)
* @method string getTileRatio()
* @method Settings setTileRatio(string $tileRatio)
* @method int|string getLogoGuid()
* @method Settings setLogoGuid(int|string $logoGuid)
* @method string getFooterText()
...
...
@@ -80,6 +82,9 @@ class Settings implements JsonSerializable
/** @var string */
protected
$backgroundImage
;
/** @var string */
protected
$tileRatio
;
/** @var string */
protected
$logoImage
;
...
...
@@ -107,14 +112,18 @@ class Settings implements JsonSerializable
$primaryColor
=
$this
->
primaryColor
?:
static
::
DEFAULT_PRIMARY_COLOR
;
$plainBackgroundColor
=
$this
->
plainBackgroundColor
?:
static
::
DEFAULT_PLAIN_BACKGROUND_COLOR
;
$oneLineHeadline
=
preg_replace
(
"/
\\
r?
\\
n+/"
,
' '
,
$this
->
headline
);
return
[
'user_guid'
=>
(
string
)
$this
->
userGuid
,
'domain'
=>
$this
->
domain
,
'title'
=>
$this
->
title
,
'headline'
=>
$this
->
headline
,
'one_line_headline'
=>
$oneLineHeadline
,
'text_color'
=>
$textColor
,
'primary_color'
=>
$primaryColor
,
'plain_background_color'
=>
$plainBackgroundColor
,
'tile_ratio'
=>
$this
->
tileRatio
,
'footer_text'
=>
$this
->
footerText
,
'footer_links'
=>
$this
->
footerLinks
,
'tag_list'
=>
$this
->
tagList
,
...
...
@@ -127,20 +136,36 @@ class Settings implements JsonSerializable
];
}
/**
* @return array
*/
public
function
buildStyles
()
{
$textColor
=
$this
->
textColor
?:
static
::
DEFAULT_TEXT_COLOR
;
$primaryColor
=
$this
->
primaryColor
?:
static
::
DEFAULT_PRIMARY_COLOR
;
$plainBackgroundColor
=
$this
->
plainBackgroundColor
?:
static
::
DEFAULT_PLAIN_BACKGROUND_COLOR
;
$tileRatioPercentage
=
$this
->
calcTileRatioPercentage
();
return
[
'text_color'
=>
$textColor
,
'primary_color'
=>
$primaryColor
,
'plain_background_color'
=>
$plainBackgroundColor
,
'transparent_background_color'
=>
sprintf
(
"%sa0"
,
$plainBackgroundColor
),
'tile_ratio'
=>
sprintf
(
"%s%%"
,
$tileRatioPercentage
),
];
}
/**
* @return float
*/
public
function
calcTileRatioPercentage
()
{
$ratioFragments
=
explode
(
':'
,
$this
->
tileRatio
?:
'16:9'
);
$percentage
=
$ratioFragments
[
1
]
/
$ratioFragments
[
0
]
*
100
;
return
round
(
$percentage
,
3
);
}
/**
* Specify data which should be serialized to JSON
* @link https://php.net/manual/en/jsonserializable.jsonserialize.php
...
...
This diff is collapsed.
Click to expand it.