-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: Rename the Link "via" fields to "source"
- Loading branch information
1 parent
7b5cb20
commit e390268
Showing
26 changed files
with
212 additions
and
185 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
margin-bottom: var(--space-small); | ||
} | ||
|
||
.news__via { | ||
.news__source { | ||
font-style: italic; | ||
} | ||
|
||
|
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
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
30 changes: 30 additions & 0 deletions
30
src/migrations/Migration202404010001RenameLinksViaToSource.php
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,30 @@ | ||
<?php | ||
|
||
namespace flusio\migrations; | ||
|
||
class Migration202404010001RenameLinksViaToSource | ||
{ | ||
public function migrate(): bool | ||
{ | ||
$database = \Minz\Database::get(); | ||
|
||
$database->exec(<<<'SQL' | ||
ALTER TABLE links RENAME COLUMN via_type TO source_type; | ||
ALTER TABLE links RENAME COLUMN via_resource_id TO source_resource_id; | ||
SQL); | ||
|
||
return true; | ||
} | ||
|
||
public function rollback(): bool | ||
{ | ||
$database = \Minz\Database::get(); | ||
|
||
$database->exec(<<<'SQL' | ||
ALTER TABLE links RENAME COLUMN source_type TO via_type; | ||
ALTER TABLE links RENAME COLUMN source_resource_id TO via_resource_id; | ||
SQL); | ||
|
||
return true; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -8,22 +8,22 @@ | |
* @author Marien Fressinaud <[email protected]> | ||
* @license http://www.gnu.org/licenses/agpl-3.0.en.html AGPL | ||
*/ | ||
class ViaHelper | ||
class SourceHelper | ||
{ | ||
/** | ||
* Set the via_* properties of a link if possible. | ||
* Set the source_* properties of a link if possible. | ||
*/ | ||
public static function setLinkVia(models\Link $link, string $from): void | ||
public static function setLinkSource(models\Link $link, string $from): void | ||
{ | ||
list($via_type, $via_resource_id) = self::extractFromPath($from); | ||
if ($via_type) { | ||
$link->via_type = $via_type; | ||
$link->via_resource_id = $via_resource_id; | ||
list($source_type, $source_resource_id) = self::extractFromPath($from); | ||
if ($source_type) { | ||
$link->source_type = $source_type; | ||
$link->source_resource_id = $source_resource_id; | ||
} | ||
} | ||
|
||
/** | ||
* Return the via type and resource id from a path. | ||
* Return the source type and resource id from a path. | ||
* | ||
* For instance: | ||
* | ||
|
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
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
Oops, something went wrong.