Files
Syed Ali Abbas Zaidi f1fb38ed83 fix: multi lines and spaces issues (#31885)
* fix: multi lines and spaces issues

* fix: eslint operator-linebreak issue

* fix: eslint quotes issue

* fix: remaining quotes issues

* fix: eslint object curly newline issue

* fix: eslint object curly spacing issue

* fix: eslint brace-style issues

* fix: react jsx indent and props issues

* fix: eslint trailing spaces issues

* fix: eslint linbreak style issue

* fix: eslint space unary operator issue

* fix: eslint line around directives issue

* fix: void and typeof space unary ops issue
2023-05-03 12:22:46 +05:00

62 lines
1.8 KiB
JavaScript

(function(define) {
'use strict';
define(['backbone', 'js/edxnotes/utils/utils', 'underscore.string'], function(Backbone, Utils, str) {
var NoteModel = Backbone.Model.extend({
defaults: {
id: null,
created: '',
updated: '',
user: '',
usage_id: '',
course_id: '',
text: '',
quote: '',
ranges: [],
tags: [],
unit: {
display_name: '',
url: '',
location: ''
},
section: {
display_name: '',
location: '',
children: []
},
chapter: {
display_name: '',
location: '',
index: 0,
children: []
},
// Flag indicating current state of the note: expanded or collapsed.
is_expanded: false,
// Flag indicating whether `More` link should be shown.
show_link: false
},
textSize: 300,
initialize: function() {
if (this.get('quote').length > this.textSize) {
this.set('show_link', true);
}
},
getQuote: function() {
var message = this.get('quote');
if (!this.get('is_expanded') && this.get('show_link')) {
message = str.prune(message, this.textSize);
}
return message;
}
});
return NoteModel;
});
}).call(this, define || RequireJS.define);