diff --git a/.gitmodules b/.gitmodules index 3c1f5aa420..66b7eadf20 100644 --- a/.gitmodules +++ b/.gitmodules @@ -37,3 +37,6 @@ [submodule "public/vendor/flatpickr"] path = public/vendor/flatpickr url = https://github.com/chmln/flatpickr +[submodule "public/vendor/bar-rating"] + path = public/vendor/bar-rating + url = https://github.com/antennaio/jquery-bar-rating diff --git a/app/controllers/Coach.scala b/app/controllers/Coach.scala index 7383244ecb..08fa019bb2 100644 --- a/app/controllers/Coach.scala +++ b/app/controllers/Coach.scala @@ -22,8 +22,10 @@ object Coach extends LilaController { if (c.coach.isFullyEnabled || ctx.me.??(c.coach.is) || isGranted(_.PreviewCoach)) Env.study.api.byIds { c.coach.profile.studyIds.map(_.value) - } flatMap Env.study.pager.withChaptersAndLiking(ctx.me) map { studies => - Ok(html.coach.show(c, studies)) + } flatMap Env.study.pager.withChaptersAndLiking(ctx.me) flatMap { studies => + api.reviews.approvedByCoach(c.coach) map { reviews => + Ok(html.coach.show(c, studies, reviews)) + } } else notFound } diff --git a/app/views/coach/reviewForm.scala.html b/app/views/coach/reviewForm.scala.html new file mode 100644 index 0000000000..93e191d1f9 --- /dev/null +++ b/app/views/coach/reviewForm.scala.html @@ -0,0 +1,3 @@ +@(c: lila.coach.Coach.WithUser, me: User)(implicit ctx: Context) + +Review form. diff --git a/app/views/coach/reviews.scala.html b/app/views/coach/reviews.scala.html new file mode 100644 index 0000000000..61790401f9 --- /dev/null +++ b/app/views/coach/reviews.scala.html @@ -0,0 +1,3 @@ +@(c: lila.coach.Coach.WithUser, coachReviews: lila.coach.CoachReview.Reviews)(implicit ctx: Context) + +Reviews list. diff --git a/app/views/coach/show.scala.html b/app/views/coach/show.scala.html index a48e3d3117..28b1fac79d 100644 --- a/app/views/coach/show.scala.html +++ b/app/views/coach/show.scala.html @@ -1,10 +1,25 @@ -@(c: lila.coach.Coach.WithUser, studies: Seq[lila.study.Study.WithChaptersAndLiked])(implicit ctx: Context) +@(c: lila.coach.Coach.WithUser, coachReviews: lila.coach.CoachReview.Reviews, studies: Seq[lila.study.Study.WithChaptersAndLiked])(implicit ctx: Context) @moreCss = { @if(studies.nonEmpty) { @cssTag("studyList.css") } +@cssAt("vendor/bar-rating/dist/themes/fontawesome-stars.css") } -@layout(title = c.user.titleUsername, evenMoreCss = moreCss) { +@moreJs = { +@jsAt("vendor/bar-rating/dist/jquery.barrating.min.js") +@jsTag("coach.js") +} + +@side = { +@ctx.me.map { me => +@reviewForm(c, me) +} +@reviews(c, coachReviews) +} + +@layout(title = c.user.titleUsername, +side = side.some, +evenMoreCss = moreCss) {