~jan0sch/smederee
Showing details for patch 6aea260657b4c5da5376f48047d18befd16ea353.
diff -rN -u old-smederee/modules/hub/src/main/resources/messages.properties new-smederee/modules/hub/src/main/resources/messages.properties --- old-smederee/modules/hub/src/main/resources/messages.properties 2025-01-12 15:34:45.648089692 +0000 +++ new-smederee/modules/hub/src/main/resources/messages.properties 2025-01-12 15:34:45.648089692 +0000 @@ -349,6 +349,8 @@ milestone.due-date=Due date +organisation.menu.edit=Edit organisation settings + project.label.edit.link=Edit project.label.edit.title=Edit label ''{0}''. project.labels.add.title=Add a new label. diff -rN -u old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala --- old-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala 2025-01-12 15:34:45.648089692 +0000 +++ new-smederee/modules/hub/src/main/scala/de/smederee/hub/VcsRepositoryRoutes.scala 2025-01-12 15:34:45.648089692 +0000 @@ -312,20 +312,22 @@ .findByName(repositoriesOwnerName) .map(_.filter(o => o.isPrivate === false || user.exists(_.uid === o.owner))) language <- Sync[F].delay(user.flatMap(_.language).getOrElse(LanguageCode("en"))) - repos <- owner.traverse(owner => vcsMetadataRepo.listRepositories(user)(owner).compile.toList) + loadRepos = vcsMetadataRepo.listRepositories(user) actionBaseUri <- Sync[F].delay( linkConfig.createFullUri(Uri(path = Uri.Path.unsafeFromString(s"~$repositoriesOwnerName"))) ) resp <- (owner, organisation) match { - case (Some(owner), _) => - Ok( - views.html.showRepositories(lang = language)( - actionBaseUri, - csrf, - s"Smederee/~$repositoriesOwnerName".some, - user - )(repos.getOrElse(List.empty), repositoriesOwnerName) - ) + case (Some(owner), organisation) => + loadRepos(owner).compile.toList.flatMap { repos => + Ok( + views.html.showRepositories(lang = language)( + actionBaseUri, + csrf, + s"Smederee/~$repositoriesOwnerName".some, + user + )(repos, repositoriesOwnerName, organisation) + ) + } case (None, Some(organisation)) => Ok( views.html.showRepositories(lang = language)( @@ -333,7 +335,7 @@ csrf, s"Smederee/~$repositoriesOwnerName".some, user - )(repos.getOrElse(List.empty), repositoriesOwnerName) + )(Nil, repositoriesOwnerName, organisation.some) ) case _ => NotFound( diff -rN -u old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositories.scala.html new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositories.scala.html --- old-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositories.scala.html 2025-01-12 15:34:45.648089692 +0000 +++ new-smederee/modules/hub/src/main/twirl/de/smederee/hub/views/showRepositories.scala.html 2025-01-12 15:34:45.652089699 +0000 @@ -1,16 +1,24 @@ -@import de.smederee.hub._ +@import de.smederee.hub.* @import de.smederee.security.Username -@(baseUri: Uri = Uri(path = Uri.Path.Root), lang: LanguageCode = LanguageCode("en"))(actionBaseUri: Uri, csrf: Option[CsrfToken] = None, title: Option[String] = None, user: Option[Account])(listing: List[VcsRepository], repositoriesOwner: Username) +@(baseUri: Uri = Uri(path = Uri.Path.Root), lang: LanguageCode = LanguageCode("en"))(actionBaseUri: Uri, csrf: Option[CsrfToken] = None, title: Option[String] = None, user: Option[Account])(listing: List[VcsRepository], repositoriesOwner: Username, organisation: Option[Organisation]) @main(baseUri, lang)()(csrf, title, user) { @defining(lang.toLocale) { implicit locale => <div class="content"> <div class="pure-g"> - <div class="pure-u-1-1 pure-u-md-1-1"> + <div class="pure-u-4-5 pure-u-md-4-5"> <div class="l-box-left-right"> <h2>~@repositoriesOwner</h2> </div> </div> + <div class="pure-u-1-5 pure-u-md-1-5"> + @if(user.exists(user => organisation.exists(_.owner === user.uid))) { + <div class="l-box"> + <a href="@actionBaseUri.addSegment("edit")">@Messages("organisation.menu.edit")</a> + </div> + } else { + } + </div> </div> <div class="pure-g"> <div class="pure-u-4-5 pure-u-md-4-5"> @@ -35,7 +43,11 @@ </tbody> </table> } else { - <div class="alert alert-secondary">@Messages("repositories.yours.none-found")</div> + @if(user.exists(_.name === repositoriesOwner)) { + <div class="alert alert-secondary">@Messages("repositories.yours.none-found")</div> + } else { + <div class="alert alert-secondary">@Messages("repositories.all.none-found")</div> + } } </div> </div>