8 |
8 |
9 IriSP.Widgets.CreateAnnotation.prototype.defaults = { |
9 IriSP.Widgets.CreateAnnotation.prototype.defaults = { |
10 show_title_field : false, /* For the moment, titles can't be sent to ldtplatform */ |
10 show_title_field : false, /* For the moment, titles can't be sent to ldtplatform */ |
11 show_creator_field : true, |
11 show_creator_field : true, |
12 start_visible : true, |
12 start_visible : true, |
13 always_visible : true, |
13 always_visible : false, |
14 sync_on_slice_widget : true, /* If false, syncs on current timecode */ |
14 sync_on_slice_widget : true, /* If false, syncs on current timecode */ |
15 takeover_arrow : false, |
15 takeover_arrow : false, |
16 minimize_annotation_widget : false, |
16 minimize_annotation_widget : true, |
17 creator_name : "", |
17 creator_name : "", |
18 creator_avatar : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", |
18 creator_avatar : "", |
19 tags : false, |
19 tags : false, |
|
20 tag_titles : false, |
20 pause_on_write : true, |
21 pause_on_write : true, |
21 max_tags : 8, |
22 max_tags : 8, |
22 polemics : [{ |
23 polemics : [{ |
23 keyword: "++", |
24 keyword: "++", |
24 background_color: "#00a000", |
25 background_color: "#00a000", |
89 } |
90 } |
90 |
91 |
91 IriSP.Widgets.CreateAnnotation.prototype.template = |
92 IriSP.Widgets.CreateAnnotation.prototype.template = |
92 '<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">' |
93 '<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">' |
93 + '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">' |
94 + '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">' |
94 + '<h3>{{#show_title_field}}<input class="Ldt-CreateAnnotation-Title" placeholder="{{l10n.type_title}}" />{{/show_title_field}}' |
95 + '<h3><span class="Ldt-CreateAnnotation-h3Left">{{#show_title_field}}<input class="Ldt-CreateAnnotation-Title" placeholder="{{l10n.type_title}}" />{{/show_title_field}}' |
95 + '{{^show_title_field}}<span class="Ldt-CreateAnnotation-NoTitle">{{l10n.no_title}} </span>{{/show_title_field}}' |
96 + '{{^show_title_field}}<span class="Ldt-CreateAnnotation-NoTitle">{{l10n.no_title}} </span>{{/show_title_field}}' |
96 + ' <span class="Ldt-CreateAnnotation-Times">{{#sync_on_slice_widget}}{{l10n.from_time}} {{/sync_on_slice_widget}}{{^sync_on_slice_widget}}{{l10n.at_time}} {{/sync_on_slice_widget}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>' |
97 + ' <span class="Ldt-CreateAnnotation-Times">{{#sync_on_slice_widget}}{{l10n.from_time}} {{/sync_on_slice_widget}}{{^sync_on_slice_widget}}{{l10n.at_time}} {{/sync_on_slice_widget}} <span class="Ldt-CreateAnnotation-Begin">00:00</span>' |
97 + '{{#sync_on_slice_widget}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">00:00</span>{{/sync_on_slice_widget}}</span></h3>' |
98 + '{{#sync_on_slice_widget}} {{l10n.to_time}} <span class="Ldt-CreateAnnotation-End">00:00</span>{{/sync_on_slice_widget}}</span></span>' |
98 + '{{#show_creator_field}}<h3>{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator" value="{{creator_name}}" /></h3>{{/show_creator_field}}' |
99 + '{{#show_creator_field}}{{l10n.your_name_}} <input class="Ldt-CreateAnnotation-Creator" value="{{creator_name}}" /></h3>{{/show_creator_field}}' |
99 + '<textarea class="Ldt-CreateAnnotation-Description" placeholder="{{l10n.type_description}}"></textarea>' |
100 + '<textarea class="Ldt-CreateAnnotation-Description" placeholder="{{l10n.type_description}}"></textarea>' |
100 + '<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>' |
101 + '<div class="Ldt-CreateAnnotation-Avatar"><img src="{{creator_avatar}}" title="{{creator_name}}"></img></div>' |
101 + '<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{l10n.submit}}" />' |
102 + '<input type="submit" class="Ldt-CreateAnnotation-Submit" value="{{l10n.submit}}" />' |
102 + '{{#tags.length}}<div class="Ldt-CreateAnnotation-Tags"><div class="Ldt-CreateAnnotation-TagTitle">{{l10n.add_keywords_}}</div><ul class="Ldt-CreateAnnotation-TagList">' |
103 + '{{#tags.length}}<div class="Ldt-CreateAnnotation-Tags"><div class="Ldt-CreateAnnotation-TagTitle">{{l10n.add_keywords_}}</div><ul class="Ldt-CreateAnnotation-TagList">' |
103 + '{{#tags}}<li class="Ldt-CreateAnnotation-TagLi" tag-id="{{id}}"><span class="Ldt-CreateAnnotation-TagButton">{{title}}</span></li>{{/tags}}</ul></div>{{/tags.length}}' |
104 + '{{#tags}}<li class="Ldt-CreateAnnotation-TagLi" tag-id="{{id}}"><span class="Ldt-CreateAnnotation-TagButton">{{title}}</span></li>{{/tags}}</ul></div>{{/tags.length}}' |
108 + '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Error">{{^always_visible}}<a title="{{l10n.close_widget}}" class="Ldt-CreateAnnotation-Close" href="#"></a>{{/always_visible}}<div class="Ldt-CreateAnnotation-InnerBox">{{l10n.error_while_contacting}}</div></div>' |
109 + '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Error">{{^always_visible}}<a title="{{l10n.close_widget}}" class="Ldt-CreateAnnotation-Close" href="#"></a>{{/always_visible}}<div class="Ldt-CreateAnnotation-InnerBox">{{l10n.error_while_contacting}}</div></div>' |
109 + '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Saved">{{^always_visible}}<a title="{{l10n.close_widget}}" class="Ldt-CreateAnnotation-Close" href="#"></a>{{/always_visible}}<div class="Ldt-CreateAnnotation-InnerBox">{{l10n.annotation_saved}}</div></div>' |
110 + '<div class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Saved">{{^always_visible}}<a title="{{l10n.close_widget}}" class="Ldt-CreateAnnotation-Close" href="#"></a>{{/always_visible}}<div class="Ldt-CreateAnnotation-InnerBox">{{l10n.annotation_saved}}</div></div>' |
110 + '</div></div>'; |
111 + '</div></div>'; |
111 |
112 |
112 IriSP.Widgets.CreateAnnotation.prototype.draw = function() { |
113 IriSP.Widgets.CreateAnnotation.prototype.draw = function() { |
|
114 var _this = this; |
|
115 if (this.tag_titles && !this.tags) { |
|
116 this.tags = IriSP._(this.tag_titles).map(function(_tag_title) { |
|
117 var _tag, |
|
118 _tags = _this.source.getTags().searchByTitle(_tag_title); |
|
119 if (_tags.length) { |
|
120 _tag = _tags[0]; |
|
121 } else { |
|
122 _tag = new IriSP.Model.Tag(false, _this.source); |
|
123 _tag.title = _tag_title; |
|
124 } |
|
125 return _tag; |
|
126 }); |
|
127 } |
113 if (!this.tags) { |
128 if (!this.tags) { |
114 this.tags = this.source.getTags() |
129 this.tags = this.source.getTags() |
115 .sortBy(function (_tag) { |
130 .sortBy(function (_tag) { |
116 return -_tag.getAnnotations().length; |
131 return -_tag.getAnnotations().length; |
117 }) |
132 }) |