Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ID for Goals so that they can be used in a custom template on Doc… #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion goal-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ H5P.GoalsPage.GoalInstance = (function () {
* @param {String} goalTypeDescription String describing the goal type, that will be displayed in its' footer
* @returns {Object} GoalInstance GoalInstance instance
*/
function GoalInstance(defineGoalPlaceholder, uniqueId, goalInstanceType, goalTypeDescription) {
function GoalInstance(defineGoalPlaceholder, uniqueId, goalInstanceType, goalTypeDescription, goalListId) {
this.uniqueId = uniqueId;
this.answer = -1;
this.textualAnswer = '';
this.text = defineGoalPlaceholder;
this.goalInstanceType = goalInstanceType;
this.specificationChildren = [];
this.goalTypeDescription = goalTypeDescription;
this.goalListId = goalListId;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions goals-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ H5P.GoalsPage = (function ($) {
editGoalText: 'Edit',
removeGoalText: 'Remove',
helpTextLabel: 'Read more',
helpText: 'Help text'
helpText: 'Help text',
goalListId: ''
}, params);
}

Expand Down Expand Up @@ -125,6 +126,7 @@ H5P.GoalsPage = (function ($) {
var goalText = self.params.defineGoalPlaceholder;
var goalType = GOAL_USER_CREATED;
var goalTypeDescription = self.params.definedGoalLabel;
var goalListId = self.params.goalListId;

// Use predefined goal
if (competenceAim !== undefined) {
Expand All @@ -133,7 +135,7 @@ H5P.GoalsPage = (function ($) {
goalTypeDescription = competenceAim.description;
}

var newGoal = new H5P.GoalsPage.GoalInstance(goalText, self.goalId, goalType, goalTypeDescription);
var newGoal = new H5P.GoalsPage.GoalInstance(goalText, self.goalId, goalType, goalTypeDescription, goalListId);
self.goalList.push(newGoal);
self.goalId += 1;

Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A page where you can make a list of goals.",
"majorVersion": 1,
"minorVersion": 2,
"patchVersion": 5,
"patchVersion": 7,
"runnable": 0,
"author": "Joubel",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions semantics.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,12 @@
"h3",
"hr"
]
},
{
"name": "goalListId",
"label": "Goal list ID",
"importance": "medium",
"type": "text",
"optional": true
}
]