Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 3b9c246

Browse files
Plugins use a loader to include supporting files
1 parent bb44bb4 commit 3b9c246

File tree

6 files changed

+32
-22
lines changed

6 files changed

+32
-22
lines changed

PublishInfo/PublishInfo.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* PublishInfo
3-
* See PublishInfo.md for documentation
3+
* See readme.md for documentation
44
*/
55

66
var Plugins = Plugins || {};
@@ -12,6 +12,11 @@ Plugins.PublishInfo = function(params) {
1212

1313
this.isActive = false;
1414

15+
this.init = function(params) {
16+
// Add required CSS-file. Set fourth argument to true to load the file in the main window (where the GUI is displayed)
17+
params.loader.addCss('/view-resources/lib/edit/plugins/PublishInfo/PublishInfo.css', null, null, true);
18+
};
19+
1520
this.start = function() {
1621
this.isActive = true;
1722
};
@@ -126,6 +131,8 @@ Plugins.PublishInfo = function(params) {
126131
);
127132
};
128133

134+
this.init(params);
135+
129136
var self = this;
130137

131138
return {

PublishInfo/readme.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@ Config-example for article-structure:
1616

1717
The structure-model will create an instance of the plugin "Plugins.PublishInfo" when needed ("autoStart" = false).
1818

19-
This plugin ships with a css-file. This is included in the front-pages that needs it like this (f.eks: /view/page/front/default/edit_properties.json):
20-
```json
21-
"filesForMainWindow": {
22-
"css": [
23-
"/view-resources/lib/edit/plugins/PublishInfo/PublishInfo.css"
24-
]
25-
},
26-
```
19+
This plugin ships with a css-file. This is included on the pages that needs it using the supplied loader-instance in the init-method.
2720

2821
Config-example for menu-item triggering the plugin:
2922
```json

YouTubeEditor/YouTubeEditor.css

+12-10
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
width: 860px;
1414
min-height: 560px;
1515
margin: 2em auto;
16-
padding: 2em;
17-
/*overflow: hidden;*/
16+
padding: 30px;
1817
-webkit-user-select: none;
1918
user-select: none;
2019
}
@@ -187,7 +186,7 @@
187186
}
188187

189188
.YouTubeEditor .yte-btn:hover {
190-
border-color: #000;
189+
border-color: #676767;
191190
}
192191

193192
.YouTubeEditor .yte-btn:active {
@@ -198,14 +197,13 @@
198197
font-size: 1.7em;
199198
}
200199

201-
.YouTubeEditor .yte-btn.lab-icon-play.playing:before {
202-
content: "";
203-
border-left: 3px solid #000;
204-
border-right: 3px solid #000;
205-
width: 0.5em;
200+
.YouTubeEditor .yte-btn:before {
206201
display: inline-block;
207-
height: 0.8em;
208-
margin-left: 0em;
202+
margin-top: 0.35em;
203+
}
204+
205+
.YouTubeEditor .yte-btn.lab-icon-play.playing:before {
206+
content: "\e924";
209207
}
210208

211209
.YouTubeEditor .yte-btn.lab-icon-backward:before {
@@ -218,6 +216,10 @@
218216
margin-left: 0.2em;
219217
}
220218

219+
.YouTubeEditor .yte-btn.lab-icon-play.playing:before {
220+
margin-left:0;
221+
}
222+
221223
.YouTubeEditor .yte-btn.lab-icon-end_point:before {
222224
margin-left: 0.3em;
223225
}

YouTubeEditor/YouTubeEditor.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ Plugins.YouTubeEditor = function(params) {
2525
this.btn_play = null;
2626
this.version = "1.0";
2727

28+
this.init = function(params) {
29+
// Add required CSS-file.
30+
params.loader.addCss('/view-resources/lib/edit/plugins/YouTubeEditor/YouTubeEditor.css', null, null);
31+
};
32+
2833
this.start = function() {
2934
this.isActive = true;
3035
this.getData();
@@ -395,7 +400,7 @@ Plugins.YouTubeEditor = function(params) {
395400

396401
var scrollTop = $lab(parent.window).scrollTop() + 30;
397402
this.editorGui = $lab('<div>').addClass("YouTubeEditor").css("margin-top", scrollTop + "px");
398-
this.editorGui.append('<div id="YouTubeEditorContainer"></div>');
403+
this.editorGui.append('<div id="YouTubeEditorContainer" style="width:800px;"></div>');
399404
this.editorGui.click(function(e) {
400405
e.stopPropagation();
401406
});
@@ -430,6 +435,8 @@ Plugins.YouTubeEditor = function(params) {
430435
}
431436
};
432437

438+
this.init(params);
439+
433440
var self = this;
434441

435442
return {

YouTubeEditor/readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ Config-example to display a button to start the plugin `/view/menu_settings/stru
5050
The button `video_edit` is added to all article-boxes that contains a child of type `youtube`.
5151
When clicking the button the method `displayEditor` is run on the plugin. If it is not already started it will start now.
5252

53-
This plugin is shipped with a CSS file that should be included in the page-template in edit-mode:
54-
`<link rel="stylesheet" href="/view-resources/lib/edit/plugins/YouTubeEditor/YouTubeEditor.css" />`
53+
This plugin is shipped with a CSS file that should be included in the page-template in edit-mode.
54+
This is done when initializing the plugin.
5555

5656
@category Labrador
5757
@package Labrador 3

readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ When an instance of the plugin is created the plugin reseives one argument: An o
9494
- `userId` (int) ID of current user
9595
- `viewport` (string) Name of current viewport
9696
- `viewports` (array) List of all viewports
97+
- `loader` (object) Helper to load js and css-files required by the plugin.
9798

9899
Labrador require these public methods for any plugin:
99100
- `start` (void) Start the plugin

0 commit comments

Comments
 (0)