Skip to content

Commit d140dfe

Browse files
committed
Merge remote-tracking branch 'origin/master' into braden/units-api
2 parents 9320592 + 77fe61c commit d140dfe

File tree

26 files changed

+334
-358
lines changed

26 files changed

+334
-358
lines changed

cms/djangoapps/contentstore/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,7 @@ def duplicate_block(
12081208
store.update_item(parent, user.id)
12091209

12101210
# .. event_implemented_name: XBLOCK_DUPLICATED
1211+
# .. event_type: org.openedx.content_authoring.xblock.duplicated.v1
12111212
XBLOCK_DUPLICATED.send_event(
12121213
time=datetime.now(timezone.utc),
12131214
xblock_info=DuplicatedXBlockData(

cms/static/cms/js/require-config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@
355355
}
356356
},
357357
config: {
358-
text: {
359-
useXhr: () => true
360-
}
358+
text: {
359+
useXhr: () => true
360+
}
361361
}
362362
});
363363
}).call(this, require, define);

cms/static/js/models/xblock_info.js

+86-128
Original file line numberDiff line numberDiff line change
@@ -15,180 +15,138 @@ define(
1515
category: null,
1616
data: null,
1717
metadata: null,
18-
/**
19-
* The Studio URL for this xblock, or null if it doesn't have one.
20-
*/
18+
/** The Studio URL for this xblock, or null if it doesn't have one. */
2119
studio_url: null,
2220
/**
23-
* An optional object with information about the children as well as about
24-
* the primary xblock type that is supported as a child.
25-
*/
21+
* An optional object with information about the children as well as about
22+
* the primary xblock type that is supported as a child.
23+
*/
2624
child_info: null,
27-
/**
28-
* An optional object with information about each of the ancestors.
29-
*/
25+
/** An optional object with information about each of the ancestors. */
3026
ancestor_info: null,
31-
/**
32-
* Date of the last edit to this xblock or any of its descendants.
33-
*/
27+
/** Date of the last edit to this xblock or any of its descendants. */
3428
edited_on: null,
3529
/**
36-
* User who last edited the xblock or any of its descendants. Will only be present if
37-
* publishing info was explicitly requested.
38-
*/
30+
* User who last edited the xblock or any of its descendants. Will only be present if
31+
* publishing info was explicitly requested.
32+
*/
3933
edited_by: null,
40-
/**
41-
* True iff a published version of the xblock exists.
42-
*/
34+
/** True iff a published version of the xblock exists. */
4335
published: null,
44-
/**
45-
* Date of the last publish of this xblock, or null if never published.
46-
*/
36+
/** Date of the last publish of this xblock, or null if never published. */
4737
published_on: null,
4838
/**
49-
* User who last published the xblock, or null if never published. Will only be present if
50-
* publishing info was explicitly requested.
51-
*/
39+
* User who last published the xblock, or null if never published. Will only be present if
40+
* publishing info was explicitly requested.
41+
*/
5242
published_by: null,
53-
/**
54-
* True if the xblock is a parentable xblock.
55-
*/
43+
/** True if the xblock is a parentable xblock. */
5644
has_children: null,
5745
/**
58-
* True if the xblock has changes.
59-
* Note: this is not always provided as a performance optimization. It is only provided for
60-
* verticals functioning as units.
61-
*/
46+
* True if the xblock has changes.
47+
* Note: this is not always provided as a performance optimization. It is only provided for
48+
* verticals functioning as units.
49+
*/
6250
has_changes: null,
6351
/**
64-
* Represents the possible publish states for an xblock. See the documentation
65-
* for XBlockVisibility to see a comprehensive enumeration of the states.
66-
*/
52+
* Represents the possible publish states for an xblock. See the documentation
53+
* for XBlockVisibility to see a comprehensive enumeration of the states.
54+
*/
6755
visibility_state: null,
6856
/**
69-
* True if the release date of the xblock is in the past.
70-
*/
57+
* True if the release date of the xblock is in the past.
58+
*/
7159
released_to_students: null,
7260
/**
73-
* If the xblock is published, the date on which it will be released to students.
74-
* This can be null if the release date is unscheduled.
75-
*/
61+
* If the xblock is published, the date on which it will be released to students.
62+
* This can be null if the release date is unscheduled.
63+
*/
7664
release_date: null,
7765
/**
78-
* The xblock which is determining the release date. For instance, for a unit,
79-
* this will either be the parent subsection or the grandparent section.
80-
* This can be null if the release date is unscheduled. Will only be present if
81-
* publishing info was explicitly requested.
82-
*/
66+
* The xblock which is determining the release date. For instance, for a unit,
67+
* this will either be the parent subsection or the grandparent section.
68+
* This can be null if the release date is unscheduled. Will only be present if
69+
* publishing info was explicitly requested.
70+
*/
8371
release_date_from: null,
8472
/**
85-
* True if this xblock is currently visible to students. This is computed server-side
86-
* so that the logic isn't duplicated on the client. Will only be present if
87-
* publishing info was explicitly requested.
88-
*/
73+
* True if this xblock is currently visible to students. This is computed server-side
74+
* so that the logic isn't duplicated on the client. Will only be present if
75+
* publishing info was explicitly requested.
76+
*/
8977
currently_visible_to_students: null,
9078
/**
91-
* If xblock is graded, the date after which student assessment will be evaluated.
92-
* It has same format as release date, for example: 'Jan 02, 2015 at 00:00 UTC'.
93-
*/
79+
* If xblock is graded, the date after which student assessment will be evaluated.
80+
* It has same format as release date, for example: 'Jan 02, 2015 at 00:00 UTC'.
81+
*/
9482
due_date: null,
95-
/**
96-
* Grading policy for xblock.
97-
*/
83+
/** Grading policy for xblock. */
9884
format: null,
99-
/**
100-
* List of course graders names.
101-
*/
85+
/** List of course graders names. */
10286
course_graders: null,
103-
/**
104-
* True if this xblock contributes to the final course grade.
105-
*/
87+
/** True if this xblock contributes to the final course grade. */
10688
graded: null,
107-
/**
108-
* The same as `release_date` but as an ISO-formatted date string.
109-
*/
89+
/** The same as `release_date` but as an ISO-formatted date string. */
11090
start: null,
111-
/**
112-
* The same as `due_date` but as an ISO-formatted date string.
113-
*/
91+
/** The same as `due_date` but as an ISO-formatted date string. */
11492
due: null,
115-
/**
116-
* True iff this xblock is explicitly staff locked.
117-
*/
93+
/** True iff this xblock is explicitly staff locked. */
11894
has_explicit_staff_lock: null,
119-
/**
120-
* True iff this any of this xblock's ancestors are staff locked.
121-
*/
95+
/** True iff this any of this xblock's ancestors are staff locked. */
12296
ancestor_has_staff_lock: null,
12397
/**
124-
* The xblock which is determining the staff lock value. For instance, for a unit,
125-
* this will either be the parent subsection or the grandparent section.
126-
* This can be null if the xblock has no inherited staff lock. Will only be present if
127-
* publishing info was explicitly requested.
128-
*/
98+
* The xblock which is determining the staff lock value. For instance, for a unit,
99+
* this will either be the parent subsection or the grandparent section.
100+
* This can be null if the xblock has no inherited staff lock. Will only be present if
101+
* publishing info was explicitly requested.
102+
*/
129103
staff_lock_from: null,
130-
/**
131-
* True iff this xblock should display a "Contains staff only content" message.
132-
*/
104+
/** True iff this xblock should display a "Contains staff only content" message. */
133105
staff_only_message: null,
134106
/**
135-
* True iff this xblock is a unit, and it has children that are only visible to certain
136-
* user partition groups. Note that this is not a recursive property. Will only be present if
137-
* publishing info was explicitly requested.
138-
*/
107+
* True iff this xblock is a unit, and it has children that are only visible to certain
108+
* user partition groups. Note that this is not a recursive property. Will only be present if
109+
* publishing info was explicitly requested.
110+
*/
139111
has_partition_group_components: null,
140112
/**
141-
* actions defines the state of delete, drag and child add functionality for a xblock.
142-
* currently, each xblock has default value of 'True' for keys: deletable, draggable and childAddable.
143-
*/
113+
* actions defines the state of delete, drag and child add functionality for a xblock.
114+
* currently, each xblock has default value of 'True' for keys: deletable, draggable and childAddable.
115+
*/
144116
actions: null,
145-
/**
146-
* Header visible to UI.
147-
*/
117+
/** Header visible to UI. */
148118
is_header_visible: null,
149-
/**
150-
* Optional explanatory message about the xblock.
151-
*/
119+
/** Optional explanatory message about the xblock. */
152120
explanatory_message: null,
153121
/**
154-
* The XBlock's group access rules. This is a dictionary keyed to user partition IDs,
155-
* where the values are lists of group IDs.
156-
*/
122+
* The XBlock's group access rules. This is a dictionary keyed to user partition IDs,
123+
* where the values are lists of group IDs.
124+
*/
157125
group_access: null,
158126
/**
159-
* User partition dictionary. This is pre-processed by Studio, so it contains
160-
* some additional fields that are not stored in the course descriptor
161-
* (for example, which groups are selected for this particular XBlock).
162-
*/
127+
* User partition dictionary. This is pre-processed by Studio, so it contains
128+
* some additional fields that are not stored in the course descriptor
129+
* (for example, which groups are selected for this particular XBlock).
130+
*/
163131
user_partitions: null,
164-
/**
165-
* This xBlock's Highlights to message to learners.
166-
*/
132+
/** This xBlock's Highlights to message to learners. */
167133
highlights: [],
168134
highlights_enabled: false,
169135
highlights_enabled_for_messaging: false,
170136
highlights_preview_only: true,
171137
highlights_doc_url: '',
172-
/**
173-
* True if summary configuration is enabled.
174-
*/
138+
/** True if summary configuration is enabled. */
175139
summary_configuration_enabled: null,
176-
/**
177-
* List of tags of the unit. This list is managed by the content_tagging module.
178-
*/
179-
tags: null,
180-
/**
181-
* True if the xblock is not visible to students only via links.
182-
*/
183-
hide_from_toc: null,
184-
/**
185-
* True iff this xblock should display a "Contains staff only content" message.
186-
*/
187-
hide_from_toc_message: null,
140+
/** List of tags of the unit. This list is managed by the content_tagging module. */
141+
tags: null,
142+
/** True if the xblock is not visible to students only via links. */
143+
hide_from_toc: null,
144+
/** True iff this xblock should display a "Contains staff only content" message. */
145+
hide_from_toc_message: null,
188146
},
189147

190148
initialize: function() {
191-
// Extend our Model by helper methods.
149+
// Extend our Model by helper methods.
192150
_.extend(this, this.getCategoryHelpers());
193151
},
194152

@@ -245,9 +203,9 @@ define(
245203
},
246204

247205
/**
248-
* Return true if action is required e.g. delete, drag, add new child etc or if given key is not present.
249-
* @return {boolean}
250-
*/
206+
* Return true if action is required e.g. delete, drag, add new child etc or if given key is not present.
207+
* @return {boolean}
208+
*/
251209
isActionRequired: function(actionName) {
252210
var actions = this.get('actions');
253211
if (actions !== null) {
@@ -259,9 +217,9 @@ define(
259217
},
260218

261219
/**
262-
* Return a list of convenience methods to check affiliation to the category.
263-
* @return {Array}
264-
*/
220+
* Return a list of convenience methods to check affiliation to the category.
221+
* @return {Array}
222+
*/
265223
getCategoryHelpers: function() {
266224
var categories = ['course', 'chapter', 'sequential', 'vertical'],
267225
helpers = {};
@@ -276,9 +234,9 @@ define(
276234
},
277235

278236
/**
279-
* Check if we can edit current XBlock or not on Course Outline page.
280-
* @return {Boolean}
281-
*/
237+
* Check if we can edit current XBlock or not on Course Outline page.
238+
* @return {Boolean}
239+
*/
282240
isEditableOnCourseOutline: function() {
283241
return this.isSequential() || this.isChapter() || this.isVertical();
284242
}

cms/static/js/spec/views/pages/container_subviews_spec.js

-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ describe('Container Subviews', function() {
581581
});
582582
});
583583

584-
585584
describe('Message Area', function() {
586585
var messageSelector = '.container-message .warning',
587586
warningMessage = 'Caution: The last published version of this unit is live. '

cms/static/js/spec/views/pages/course_outline_spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2540,7 +2540,7 @@ describe('CourseOutlinePage', function() {
25402540
hide_from_toc: null
25412541
}
25422542
});
2543-
})
2543+
});
25442544
});
25452545

25462546
verifyTypePublishable('unit', function(options) {
+27-26
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1-
define(["jquery"], function ($) {
2-
"use strict";
3-
function copyToClipboard(id, textToCopy) {
4-
if (navigator.clipboard) {
5-
navigator.clipboard.writeText(textToCopy);
6-
changeButtonText(id);
7-
return;
1+
define(['jquery'], function($) {
2+
'use strict';
3+
4+
function copyToClipboard(id, textToCopy) {
5+
if (navigator.clipboard) {
6+
navigator.clipboard.writeText(textToCopy);
7+
changeButtonText(id);
8+
return;
9+
}
10+
const textArea = document.createElement('textarea');
11+
textArea.value = textToCopy;
12+
document.body.appendChild(textArea);
13+
textArea.select();
14+
document.execCommand('copy');
15+
document.body.removeChild(textArea);
16+
changeButtonText(id);
817
}
9-
const textArea = document.createElement("textarea");
10-
textArea.value = textToCopy;
11-
document.body.appendChild(textArea);
12-
textArea.select();
13-
document.execCommand("copy");
14-
document.body.removeChild(textArea);
15-
changeButtonText(id);
16-
}
1718

18-
function changeButtonText(id, delay = 2000) {
19-
const buttonId = `#${id}`;
20-
const textClass = ".copy-link-button-text";
19+
function changeButtonText(id, delay = 2000) {
20+
const buttonId = `#${id}`;
21+
const textClass = '.copy-link-button-text';
2122

22-
const previewShareLinkText = $(buttonId).find(textClass).html();
23-
const shareLinkCopiedText = gettext("Copied");
24-
$(buttonId).find(textClass).text(shareLinkCopiedText);
23+
const previewShareLinkText = $(buttonId).find(textClass).html();
24+
const shareLinkCopiedText = gettext('Copied');
25+
$(buttonId).find(textClass).text(shareLinkCopiedText);
2526

26-
setTimeout(() => {
27-
$(buttonId).find(textClass).text(previewShareLinkText);
28-
}, delay);
29-
}
30-
return { copyToClipboard };
27+
setTimeout(() => {
28+
$(buttonId).find(textClass).text(previewShareLinkText);
29+
}, delay);
30+
}
31+
return {copyToClipboard};
3132
});

0 commit comments

Comments
 (0)