Skip to content

Commit

Permalink
Merge pull request #664 from Chanputhi/migrate/privacy-policy-new
Browse files Browse the repository at this point in the history
Migrate: Privacy Policy component
  • Loading branch information
macite authored Nov 5, 2024
2 parents beb8d28 + 1de217c commit e438c29
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 27 deletions.
1 change: 0 additions & 1 deletion src/app/config/config.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ angular.module('doubtfire.config', [
'doubtfire.config.runtime'
'doubtfire.config.root-controller'
'doubtfire.config.debug'
'doubtfire.config.privacy-policy'
])
17 changes: 0 additions & 17 deletions src/app/config/privacy-policy/privacy-policy.coffee

This file was deleted.

16 changes: 16 additions & 0 deletions src/app/config/privacy-policy/privacy-policy.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';

import {PrivacyPolicy } from './privacy-policy';

describe('PrivacyPolicy', () => {
let service: PrivacyPolicy;

beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(PrivacyPolicy);
});

it('should be created', () => {
expect(service).toBeTruthy();
});
});
32 changes: 32 additions & 0 deletions src/app/config/privacy-policy/privacy-policy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import API_URL from 'src/app/config/constants/apiURL';

interface Response {
privacy: string;
plagiarism: string;
}

@Injectable({
providedIn: 'root'
})
export class PrivacyPolicy {
privacy = '';
plagiarism = '';
loaded = false;

public API_URL: string = API_URL;

constructor(private http: HttpClient) {

const url: string = `${this.API_URL}/settings/privacy`;

this.http.get<Response>(url)
.subscribe(response => {
this.privacy = response.privacy;
this.plagiarism = response.plagiarism;
this.loaded = true;
}
);
}
}
4 changes: 3 additions & 1 deletion src/app/doubtfire-angular.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ import {ScormExtensionCommentComponent} from './tasks/task-comments-viewer/scorm
import {ScormExtensionModalComponent} from './common/modals/scorm-extension-modal/scorm-extension-modal.component';
import { GradeIconComponent } from './common/grade-icon/grade-icon.component';
import { GradeTaskModalComponent } from './tasks/modals/grade-task-modal/grade-task-modal.component';
import { PrivacyPolicy } from './config/privacy-policy/privacy-policy';

// See https://stackoverflow.com/questions/55721254/how-to-change-mat-datepicker-date-format-to-dd-mm-yyyy-in-simplest-way/58189036#58189036
const MY_DATE_FORMAT = {
Expand Down Expand Up @@ -463,6 +464,7 @@ import { UnitStudentEnrolmentModalComponent } from './units/modals/unit-student-
CreateNewUnitModal,
ScormAdapterService,
TestAttemptService,
PrivacyPolicy,
provideLottieOptions({
player: () => player,
}),
Expand Down Expand Up @@ -528,7 +530,7 @@ import { UnitStudentEnrolmentModalComponent } from './units/modals/unit-student-
MatDatepickerModule,
MatNativeDateModule,
MatDialogModuleNew,
NgxChartsModule
NgxChartsModule,
],
})

Expand Down
5 changes: 2 additions & 3 deletions src/app/doubtfire-angularjs.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ import 'build/src/app/tasks/task-ilo-alignment/modals/task-ilo-alignment.js';
import 'build/src/app/tasks/task-ilo-alignment/modals/task-ilo-alignment-modal/task-ilo-alignment-modal.js';
import 'build/src/app/tasks/task-ilo-alignment/task-ilo-alignment-editor/task-ilo-alignment-editor.js';
import 'build/src/app/tasks/task-ilo-alignment/task-ilo-alignment-viewer/task-ilo-alignment-viewer.js';
import 'build/src/app/config/privacy-policy/privacy-policy.js';
import 'build/src/app/config/runtime/runtime.js';
import 'build/src/app/config/config.js';
import 'build/src/app/config/root-controller/root-controller.js';
Expand Down Expand Up @@ -219,12 +218,12 @@ import { ProgressBurndownChartComponent } from './visualisations/progress-burndo
import { TaskVisualisationComponent } from './visualisations/task-visualisation/taskvisualisation.component';

import {FUnitsComponent} from './admin/states/units/units.component';
import {MarkedPipe} from './common/pipes/marked.pipe';
import {AlertService} from './common/services/alert.service';

import {GradeService} from './common/services/grade.service';
import {TaskScormCardComponent} from './projects/states/dashboard/directives/task-dashboard/directives/task-scorm-card/task-scorm-card.component';
import { UnitStudentEnrolmentModalService } from './units/modals/unit-student-enrolment-modal/unit-student-enrolment-modal.service';
import { PrivacyPolicy } from './config/privacy-policy/privacy-policy';

export const DoubtfireAngularJSModule = angular.module('doubtfire', [
'doubtfire.config',
Expand All @@ -243,7 +242,6 @@ export const DoubtfireAngularJSModule = angular.module('doubtfire', [
DoubtfireAngularJSModule.factory('AboutDoubtfireModal', downgradeInjectable(AboutDoubtfireModal));
DoubtfireAngularJSModule.factory('DoubtfireConstants', downgradeInjectable(DoubtfireConstants));
DoubtfireAngularJSModule.factory('ExtensionModal', downgradeInjectable(ExtensionModalService));
DoubtfireAngularJSModule.factory('Marked', downgradeInjectable(MarkedPipe));
DoubtfireAngularJSModule.factory('CalendarModal', downgradeInjectable(CalendarModalService));
DoubtfireAngularJSModule.factory('TaskCommentService', downgradeInjectable(TaskCommentService));
DoubtfireAngularJSModule.factory('alertService', downgradeInjectable(AlertService));
Expand Down Expand Up @@ -305,6 +303,7 @@ DoubtfireAngularJSModule.factory(
DoubtfireAngularJSModule.factory('CreateNewUnitModal', downgradeInjectable(CreateNewUnitModal));
DoubtfireAngularJSModule.factory('GradeTaskModal', downgradeInjectable(GradeTaskModalService));
DoubtfireAngularJSModule.factory('UnitStudentEnrolmentModal', downgradeInjectable(UnitStudentEnrolmentModalService));
DoubtfireAngularJSModule.factory('PrivacyPolicy', downgradeInjectable(PrivacyPolicy));

// directive -> component
DoubtfireAngularJSModule.directive(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ <h4>
</h4>
</div><!--/card-heading-->
<div class="card-body">
<span>
<p>
{{privacyPolicy.privacy}}
</span>
</p>
<a href="#" ng-click="showPlagiarism = !showPlagiarism">Plagiarism and collusion</a>
<div ng-show="showPlagiarism">
<h4>Plagiarism and Collusion</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h3>
<label class="text-muted" ng-show="alignment.description != null">
Provided Rationale
</label>
<div ng-bind-html="(alignment.description || 'No rationale provided') | markdown | to_trusted"></div>
<div ng-bind-html="(alignment.description || 'No rationale provided')"></div>
<div class="small" ng-hide="alignment.description">Click to add one</div>
</div>
<div ng-if="editingRationale" class="clearfix">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h3 class="list-group-item-heading outcome-heading col-sm-12" style="padding: 0;
<div class="list-group-item-text alignment-content col-sm-8" ng-show="align.expanded">
<div ng-show="ilo.description">
<h5>Description</h5>
<div class="markdown-to-html" ng-bind-html="ilo.description | markdown | to_trusted"></div>
<div>{{ilo.description}}</div>
</div>
<div ng-if="ilo && classStats &&!hideVisualisation">
<h5>Visualisation</h5>
Expand All @@ -50,7 +50,7 @@ <h5>Visualisation</h5>
</div>
<div ng-show="!summaryOnly && align.description">
<h5>Rationale</h5>
<div class="markdown-to-html" ng-bind-html="align.description | markdown | to_trusted"></div>
<div class="markdown-to-html" ng-bind-html="align.description"></div>
</div>
<div ng-show="summaryOnly">
<h5>Related Tasks</h5>
Expand Down

0 comments on commit e438c29

Please sign in to comment.