From f00b3d1c24121500dc4ff8009518be06388dc692 Mon Sep 17 00:00:00 2001 From: Vibhu Dujari Date: Tue, 14 May 2024 17:59:58 +0530 Subject: [PATCH] open contest in popup window --- .../intermediate-contest-view/component.js | 5 +++++ .../intermediate-contest-view/template.hbs | 14 ++++++++------ app/pods/contests/contest/index/controller.js | 4 ++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/pods/components/intermediate-contest-view/component.js b/app/pods/components/intermediate-contest-view/component.js index 71bb4ac..72f3a8b 100644 --- a/app/pods/components/intermediate-contest-view/component.js +++ b/app/pods/components/intermediate-contest-view/component.js @@ -5,6 +5,7 @@ import { restartableTask, dropTask } from 'ember-concurrency-decorators'; import { timeout } from 'ember-concurrency'; import { inject as service } from '@ember/service'; import moment from 'moment'; +import ENV from 'hackerblocks/config/environment'; export default class IntermediateContestComponent extends Component { @service store @@ -114,4 +115,8 @@ export default class IntermediateContestComponent extends Component { console.log(err) }) } + + @action async openTestInNewWindow() { + window.open(`${ENV.publicUrl}contests/${this.contest.id}/attempt/`, 'popup') + } } diff --git a/app/pods/components/intermediate-contest-view/template.hbs b/app/pods/components/intermediate-contest-view/template.hbs index 90aac82..9206669 100644 --- a/app/pods/components/intermediate-contest-view/template.hbs +++ b/app/pods/components/intermediate-contest-view/template.hbs @@ -60,19 +60,21 @@
{{#if contest_attempt}} {{#if nextRoute.route}} - Resume Challenge - + {{else}} - {{#link-to + {{!-- {{#link-to nextRoute class="button-solid button-orange font-sm extra-bold my-3" }} Resume Challenge - {{/link-to}} + {{/link-to}} --}} + {{/if}} {{else}} {{#if (or (not contest.acceptRegistrations) contestRegistration)}} diff --git a/app/pods/contests/contest/index/controller.js b/app/pods/contests/contest/index/controller.js index 6346dde..714e09d 100644 --- a/app/pods/contests/contest/index/controller.js +++ b/app/pods/contests/contest/index/controller.js @@ -1,7 +1,7 @@ import Controller from '@ember/controller'; import { action, computed } from '@ember/object'; import { inject as service } from '@ember/service'; -import { restartableTask } from 'ember-concurrency-decorators'; +import ENV from 'hackerblocks/config/environment'; export default class IndexController extends Controller { @service store @@ -62,6 +62,6 @@ export default class IndexController extends Controller { } @action onAfterCreate() { - this.transitionToRoute('contests.contest.attempt') + window.open(`${ENV.publicUrl}contests/${this.contest.id}/attempt/`, 'popup') } }