Skip to content

Commit

Permalink
[EDGE] Feature/invest comparison improvements (#567)
Browse files Browse the repository at this point in the history
* Add numeric id to projects

* Add descriptive text to num id in dashboard

* Add cat translation to dashboard-menu-project-nid

---------

Co-authored-by: Daniel Subiabre <[email protected]>
  • Loading branch information
davidbeig and subiabre authored Oct 25, 2023
1 parent 46175a2 commit 08b6bb6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<div class="inner-container">
<h1><?= $this->text('dashboard-menu-activity-summary') ?></h1>
<h5><?= $this->ee($this->project->name) ?></h5>
<h6><?= $this->text('dashboard-menu-project-nid') ?>: <?= $this->project->getNumericId() ?></h6>

<div class="panel section-content">
<div class="panel-body">
Expand Down
10 changes: 10 additions & 0 deletions src/Goteo/Model/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,16 @@ public function getImage() {
return $this->imageInstance;
}

/**
* Convert the alfanumeric string ID into a numeric string ID
* @param int $surface Collission chance = 10**$surface
* @return string number-only string ID
*/
public function getNumericId(int $surface = 10): string
{
return substr(base_convert(hash('sha256', $this->id), 16, 10), 0, $surface);
}

/**
* Handy method to know if project can be edited (not in campaing or finished)
*/
Expand Down
1 change: 1 addition & 0 deletions translations/ca/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ dashboard-menu-profile-personal: 'Dades personals'
dashboard-menu-profile-preferences: 'Preferències'
dashboard-menu-profile-profile: 'Edita el Perfil'
dashboard-menu-profile-public: 'Perfil públic'
dashboard-menu-project-nid: 'Identificador numèric de projecte'
dashboard-menu-projects: 'Projectes'
dashboard-menu-projects-analytics: Analítica
dashboard-menu-projects-commons: Retorns
Expand Down
1 change: 1 addition & 0 deletions translations/en/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ dashboard-menu-profile-personal: 'Personal information'
dashboard-menu-profile-preferences: 'Preferences'
dashboard-menu-profile-profile: 'Edit profile'
dashboard-menu-profile-public: 'Public profile'
dashboard-menu-project-nid: 'Numeric project identifier'
dashboard-menu-projects: 'My projects'
dashboard-menu-projects-analytics: Analytics
dashboard-menu-projects-commons: Rewards
Expand Down
1 change: 1 addition & 0 deletions translations/es/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ dashboard-menu-profile-personal: 'Datos personales'
dashboard-menu-profile-preferences: 'Mis preferencias'
dashboard-menu-profile-profile: 'Editar perfil'
dashboard-menu-profile-public: 'Perfil público'
dashboard-menu-project-nid: 'Identificador numérico de proyecto'
dashboard-menu-projects: 'Mis proyectos'
dashboard-menu-projects-analytics: Analítica
dashboard-menu-projects-commons: Retornos
Expand Down

0 comments on commit 08b6bb6

Please sign in to comment.