Skip to content

Commit

Permalink
open contest in popup window
Browse files Browse the repository at this point in the history
  • Loading branch information
vdvibhu20 committed May 14, 2024
1 parent 28ab2e9 commit f00b3d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions app/pods/components/intermediate-contest-view/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
}
}
14 changes: 8 additions & 6 deletions app/pods/components/intermediate-contest-view/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,21 @@
<div>
{{#if contest_attempt}}
{{#if nextRoute.route}}
<LinkTo
@route={{nextRoute.route}}
@model={{nextRoute.model}}
<button {{action 'openTestInNewWindow'}}
class="button-solid button-orange font-sm extra-bold my-3">
Resume Challenge
</LinkTo>
</button>
{{else}}
{{#link-to
{{!-- {{#link-to
nextRoute
class="button-solid button-orange font-sm extra-bold my-3"
}}
Resume Challenge
{{/link-to}}
{{/link-to}} --}}
<button {{action 'openTestInNewWindow'}}
class="button-solid button-orange font-sm extra-bold my-3">
Resume Challenge
</button>
{{/if}}
{{else}}
{{#if (or (not contest.acceptRegistrations) contestRegistration)}}
Expand Down
4 changes: 2 additions & 2 deletions app/pods/contests/contest/index/controller.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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')
}
}

0 comments on commit f00b3d1

Please sign in to comment.