Skip to content

Commit 064af6e

Browse files
committed
Merge remote-tracking branch 'origin/master' into development
2 parents 9596086 + f6c280e commit 064af6e

File tree

80 files changed

+983
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+983
-308
lines changed

README.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ You will need the following things properly installed on your computer.
2121
* [Yarn](https://yarnpkg.com/)
2222
* [Ember CLI](https://ember-cli.com/)
2323
* [Google Chrome](https://google.com/chrome/)
24+
* [CodingBlocks Online Server](https://github.com/coding-blocks/codingblocks.online.server)
2425

2526
## Installation
2627

28+
* Make sure [CodingBlocks Online Server](https://github.com/coding-blocks/codingblocks.online.server) is installed and running
2729
* `git clone https://github.com/coding-blocks/codingblocks.online.projectx` this repository
2830
* `cd codingblocks.online.projectx`
2931
* `yarn install`
3032

31-
## Running / Development
33+
## Running for Development
3234

3335
* `export oss=true && ember serve`
3436
* Visit your app at [http://localhost:4200](http://localhost:4200).
@@ -38,18 +40,13 @@ You will need the following things properly installed on your computer.
3840

3941
Make use of the many generators for code, try `ember help generate` for more details
4042

41-
### Running Tests
42-
43-
* `ember test`
44-
* `ember test --server`
45-
4643
### Linting
4744

4845
* `npm run lint:hbs`
4946
* `npm run lint:js`
5047
* `npm run lint:js -- --fix`
5148

52-
### Building
49+
### Building (for production)
5350

5451
* `ember build` (development)
5552
* `ember build --environment production` (production)

app/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
.push([f])},catch:function(){return k&&new k()},c:l}};})(window,document,[]);
9797
</script>
9898

99-
<script src="https://hack.codingblocks.com/index.js"></script>
99+
<script src="https://unpkg.com/@coding-blocks/[email protected]/dist/index.js" async></script>
100100

101101
{{content-for "body-footer"}}
102102
</body>

app/models/comment.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ export default DS.Model.extend({
66
name: DS.attr(),
77
avatarTemplate: DS.attr(),
88
username: DS.attr(),
9-
updatedAt: DS.attr(),
9+
createdAt: DS.attr('date'),
10+
updatedAt: DS.attr('date'),
1011
doubt: DS.belongsTo('doubt'),
1112
discourseTopicId: DS.attr()
1213
})

app/models/course.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export default DS.Model.extend({
4040
backgroundImage: DS.attr(),
4141
rating: DS.attr('number'),
4242
seoMeta: DS.attr(),
43+
code: DS.attr(),
4344
topRun: computed('activeRuns', 'runs', function () {
4445
let runs = this.activeRuns
4546

@@ -60,10 +61,6 @@ export default DS.Model.extend({
6061
feedback: computed('feedbacks', function () {
6162
return this.feedbacks.objectAt(0);
6263
}),
63-
canHazDoubtsLink: and('categoryId', 'doubtSubCategoryId'),
64-
doubtsLink: computed('categoryId', 'doubtSubCategoryId', function () {
65-
return `${env.discussBaseUrl}/c/${this.categoryId}/${this.doubtSubCategoryId}`;
66-
}),
6764
difficultyName: computed('difficulty', function () {
6865
switch(+this.difficulty) {
6966
case 0: return 'beginner' ; break;

app/models/doubt.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ export default DS.Model.extend({
1111
firebaseRef: DS.attr(),
1212
comments: DS.hasMany('comment'),
1313
feedbacks: DS.hasMany('doubt-feedback'),
14-
resolvedById: DS.attr()
14+
resolvedById: DS.attr(),
15+
createdAt: DS.attr('date')
1516
})

app/models/run-attempt.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default DS.Model.extend({
99
revoked: DS.attr(),
1010
certificateApproved: DS.attr(),
1111
rating: DS.attr(),
12+
runTier: DS.attr(),
1213
completedContents: DS.attr('number'),
1314
approvalRequested: DS.attr('boolean'),
1415
doubtSupport: DS.attr('date'),

app/models/run.js

+2
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ export default DS.Model.extend({
2424
description: DS.attr(),
2525
productId: DS.attr(),
2626
totalContents: DS.attr("number"),
27+
tier: DS.attr(),
2728
course: DS.belongsTo("course", { inverse: "runs" }),
2829
sections: DS.hasMany("sections"),
2930
user: DS.belongsTo("user"),
3031
runAttempts: DS.hasMany("run-attempt"),
3132
announcements: DS.hasMany("announcement"),
3233
ta: DS.hasMany("ta"),
3334
runRequests: DS.hasMany("run-request"),
35+
shift: DS.attr(),
3436
topRunAttempt: computed("runAttempts", function() {
3537
return this.runAttempts.objectAt(0);
3638
}),

app/pods/application-loading/route.js

-4
This file was deleted.

app/pods/application-loading/template.hbs

-1
This file was deleted.

app/pods/application/route.js

+12
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ import ApplicationRouteMixin from "ember-simple-auth/mixins/application-route-mi
33
import UtmCookieRouteMixin from "../../mixins/utm-cookie-route"
44
import { inject as service } from "@ember/service";
55
import { isNone } from "@ember/utils";
6+
import { get } from '@ember/object';
67

78
export default Route.extend(ApplicationRouteMixin, UtmCookieRouteMixin, {
89
session: service(),
910
currentUser: service(),
1011
store: service(),
1112
headData: service(),
13+
pageProgress: service(),
1214
onesignal: service(),
1315
metrics: service(), // !important: keep this here to init trackers for all routes
1416
// routeAfterAuthentication: 'dashboard',
@@ -72,5 +74,15 @@ export default Route.extend(ApplicationRouteMixin, UtmCookieRouteMixin, {
7274
setupController(controller, model) {
7375
this._super(controller, model);
7476
controller.set("model", model);
77+
},
78+
actions: {
79+
loading(transition) {
80+
const pageProgress = get(this, 'pageProgress');
81+
pageProgress.start(transition.targetName);
82+
transition.promise.finally(() => {
83+
pageProgress.done();
84+
});
85+
return true
86+
}
7587
}
7688
});

app/pods/application/template.hbs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<PageProgress />
12
{{head-layout}}
23
{{#if hideNav}}
34
{{outlet}}
@@ -10,6 +11,7 @@
1011
</div>
1112

1213
<div class="offset-md-1 mb-5">
14+
<promotion-banner />
1315
<div id="outside-container" {{did-insert (action "setOutsideContainer")}} ></div>
1416
<div class="container">
1517
<div class="row justify-content-center mx-0">
@@ -24,6 +26,7 @@
2426
<div class="col-12">
2527
<NavBarPublic class="ml-0 w-100" />
2628
<cb-navbar topalign="right" />
29+
<promotion-banner />
2730
<div class="">
2831
{{outlet}}
2932
</div>

app/pods/attempt/content/code-challenge/controller.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import Controller from '@ember/controller';
22
import { computed } from '@ember/object';
33
import { alias } from '@ember/object/computed';
4+
import { inject as service } from '@ember/service';
45

56
export default class CodeChallenge extends Controller {
7+
@service player
8+
69
tabs = [
710
{
811
name: 'Problem',
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,36 @@
11
{{#if problem.id}}
2-
<div class="p-md-5 p-4 mb-5 border-card white border-none bg-grey-darker">
3-
<WTabNav
4-
@inactiveClass="white"
5-
@tabs={{tabs}}
6-
@activeTab={{activeTab}}
7-
@onTabChange={{action (mut activeTab)}}>
8-
<div class="py-4">
9-
{{component activeTab.component codeChallenge=codeChallenge problem=problem}}
10-
</div>
11-
</WTabNav>
2+
<div class="bg-modal-grey-darker py-2 t-align-c" style="border-radius: 15px 15px 0 0;">
3+
{{#if player.isFullscreen}}
4+
<span>Press Esc to exit fullscreen mode.</span>
5+
{{else}}
6+
<a class="white pointer hoverable-underline" {{action player.goFullScreen}} >
7+
Try Fullscreen mode <i class="fas fa-expand"></i> <sup>Beta</sup> </a>
8+
{{/if}}
9+
</div>
10+
<div class="c-code-challenge">
11+
<div class="p-md-5 p-4 white border-none bg-grey-darker mb-5 border-card problem-panel">
12+
<WTabNav
13+
@inactiveClass="white"
14+
@tabs={{tabs}}
15+
@activeTab={{activeTab}}
16+
@onTabChange={{action (mut activeTab)}}>
17+
<div class="py-4">
18+
{{component activeTab.component codeChallenge=codeChallenge problem=problem}}
19+
</div>
20+
</WTabNav>
21+
</div>
22+
23+
{{#if player.isFullscreen}}
24+
<div class="splitter"></div>
25+
{{/if}}
26+
27+
<CodeChallenge::CodeChallengeCodeEditor
28+
class="flex-1"
29+
@ref={{relatedPendingDoubt.firebaseRef}}
30+
@content={{content}}
31+
@codeChallenge={{codeChallenge}}
32+
@problem={{problem}} />
1233
</div>
13-
<CodeChallenge::CodeChallengeCodeEditor
14-
@ref={{relatedPendingDoubt.firebaseRef}}
15-
@content={{content}}
16-
@codeChallenge={{codeChallenge}}
17-
@problem={{problem}} />
1834
{{else}}
1935
<div class="p-md-5 p-4 mb-5 border-card white border-none bg-grey-darker">
2036
<div class="t-align-c">
@@ -36,4 +52,6 @@
3652
Run Attempt ID: {{runAttempt.id}}
3753
</div>
3854
</div>
39-
{{/if}}
55+
{{/if}}
56+
57+
<div id="fullscreen-code-challenge-result"></div>
+16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
import Controller from '@ember/controller';
22
import { inject as service } from '@ember/service';
3+
import { computed } from '@ember/object';
4+
import { alias } from '@ember/object/computed';
35

46
export default class AttemptController extends Controller {
57
@service currentUser
8+
9+
@alias('currentUser.user') user
10+
11+
@computed('user.{verifiedemail,verifiedmobile}')
12+
get isMobileOrEmailVerified() {
13+
const { verifiedemail, verifiedmobile } = this.user
14+
return verifiedemail || verifiedmobile
15+
}
16+
17+
@computed('user.{firstname,lastname}')
18+
get hasEmptyName() {
19+
const { firstname, lastname } = this.user
20+
return !(firstname || lastname)
21+
}
622
}

app/pods/attempt/content/template.hbs

+19-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
{{#if (not (or currentUser.user.verifiedemail currentUser.user.verifiedmobile))}}
2-
<VerifyEmail />
3-
{{else if model.payload}}
4-
{{!-- render content outlet and doubts and notes --}}
5-
<div>
1+
<div id="player-content-fullscreen-container" class="col-lg-9 timeline__main-area__video-area no-scrollbar order-lg-12 order-1">
2+
{{#if (not isMobileOrEmailVerified)}}
3+
<Blockers::VerifyEmail />
4+
{{else if hasEmptyName}}
5+
<Blockers::FillupName />
6+
{{else if model.payload}}
7+
{{!-- render content outlet and doubts and notes --}}
68
<div>
7-
{{outlet}}
9+
<div>
10+
{{outlet}}
11+
</div>
12+
<div class="d-lg-block d-none">
13+
<Player::PlayerTabs />
14+
</div>
815
</div>
9-
<div class="d-lg-block d-none">
10-
<Player::PlayerTabs />
11-
</div>
12-
</div>
13-
{{else if (not run.isStarted)}}
14-
<UnstartedContent @run={{run}} />
15-
{{else}}
16-
<LockedContent @course={{run.course}} />
17-
{{/if}}
16+
{{else if (not run.isStarted)}}
17+
<UnstartedContent @run={{run}} />
18+
{{else}}
19+
<LockedContent @course={{run.course}} />
20+
{{/if}}
21+
</div>

app/pods/attempt/template.hbs

-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939
</div>
4040
</div>
4141

42-
<div class="col-lg-9 timeline__main-area__video-area no-scrollbar order-lg-12 order-1">
4342
{{outlet}}
44-
</div>
4543
</div>
4644
<div class="d-lg-none d-block px-4">
4745
{{#if player.isActive}}

app/pods/classroom/index/template.hbs

+7-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
@loaderComponent={{component 'my-courses-list/placeholder-row'}}
1414
as |result|>
1515
{{#if result.length}}
16-
{{#if (eq activeTab.name 'Wishlisted')}}
17-
{{component activeTab.component wishlist=result class="border-bottom-list"}}
18-
{{else}}
19-
{{component activeTab.component runs=result class="border-bottom-list"}}
20-
{{/if}}
16+
<div class="border-bottom-list">
17+
{{#if (eq activeTab.name 'Wishlisted')}}
18+
{{component activeTab.component wishlist=result}}
19+
{{else}}
20+
{{component activeTab.component runs=result}}
21+
{{/if}}
22+
</div>
2123
{{else}}
2224
<div class="t-align-c my-5">
2325
<img src="/app/images/camera-orange.svg" alt="Courses">

app/pods/classroom/timeline/index/controller.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ export default class Overview extends Controller {
1717
discussBaseUrl = config.discussBaseUrl
1818
visible = true
1919

20+
@computed('runAttempt.{end,premium}', 'runAttempt.run.price')
21+
get showCertificateRequest() {
22+
return this.runAttempt.premium && this.runAttempt.get('run.certificateTemplate')
23+
}
24+
2025
@computed('runAttempt.{end,premium}', 'runAttempt.run.price')
2126
get showGoodieRequest() {
22-
return this.runAttempt.premium && this.runAttempt.get('run.price')
27+
const {premium, runTier} = this.runAttempt
28+
return premium && this.runAttempt.get('run.price') && runTier != 'LITE'
2329
}
2430

2531
@computed('runAttempt.{isExpired,end,premium}')
@@ -44,6 +50,17 @@ export default class Overview extends Controller {
4450
return 0.84 * this.runAttempt.get('run.goodiesThreshold')
4551
}
4652

53+
@computed('course.topRun')
54+
get totalContents() {
55+
return this.course.get('topRun').totalContents
56+
}
57+
58+
@computed('course.topRun')
59+
get doneContents() {
60+
return this.runAttempt.completedContents
61+
}
62+
63+
4764
@alias('runAttempt.progressPercent')
4865
progressPercent
4966

app/pods/classroom/timeline/index/route.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default Route.extend({
1313
setupController (controller, model) {
1414
controller.set('course', model.get('run.course'))
1515
controller.set('runAttempt', model)
16+
controller.set('run', model.get('run'))
1617
controller.set('userRating', model.get('rating'))
1718
},
1819
async afterModel(model) {

0 commit comments

Comments
 (0)