mirror of
https://github.com/chylex/Nextcloud-News.git
synced 2025-04-09 19:15:42 +02:00
add client side plugins
This commit is contained in:
parent
af95556560
commit
63255263b4
@ -2300,7 +2300,8 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL)
|
||||
});
|
||||
|
||||
}(window, document, $));
|
||||
var News = News || {};
|
||||
window.News = News || {};
|
||||
|
||||
|
||||
(function (window, document, $, exports, undefined) {
|
||||
'use strict';
|
||||
|
2
js/build/app.min.js
vendored
2
js/build/app.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,5 @@
|
||||
var News = News || {};
|
||||
window.News = News || {};
|
||||
|
||||
|
||||
(function (window, document, $, exports, undefined) {
|
||||
'use strict';
|
||||
|
44
plugin/client/plugin.php
Normal file
44
plugin/client/plugin.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud - News
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*
|
||||
* @author Alessandro Cosentino <cosenal@gmail.com>
|
||||
* @author Bernhard Posselt <dev@bernhard-posselt.com>
|
||||
* @copyright Alessandro Cosentino 2012
|
||||
* @copyright Bernhard Posselt 2012, 2014
|
||||
*/
|
||||
|
||||
namespace OCA\News\Plugin\Client;
|
||||
|
||||
/**
|
||||
* We actually really want to avoid this global list of plugins. A way would be
|
||||
* for News plugin apps to register themselves in a special database table
|
||||
* and the News app would just pull out the scripts that should be attached
|
||||
* but atm there is no really good way since there is no uninstall hook which
|
||||
* would remove the plugin from the apps so fk it :)
|
||||
*/
|
||||
class Plugin {
|
||||
|
||||
private static $scripts = [];
|
||||
private static $styles = [];
|
||||
|
||||
public static function registerStyle($appName, $styleName) {
|
||||
self::$styles[$appName] = $styleName;
|
||||
}
|
||||
|
||||
public static function registerScript($appName, $scriptName) {
|
||||
self::$scripts[$appName] = $scriptName;
|
||||
}
|
||||
|
||||
public static function getStyles() {
|
||||
return self::$styles;
|
||||
}
|
||||
|
||||
public static function getScripts() {
|
||||
return self::$scripts;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
use OCA\News\Plugin\Client\Plugin;
|
||||
|
||||
script('news', [
|
||||
'vendor/es6-shim/es6-shim.min',
|
||||
'vendor/angular/angular.min',
|
||||
@ -35,6 +37,14 @@ if (defined('DEBUG') && DEBUG === true) {
|
||||
|
||||
script('news', 'build/app.min');
|
||||
}
|
||||
|
||||
// load plugin scripts and styles
|
||||
foreach (Plugin::getStyles() as $appName => $fileName) {
|
||||
style($appName, $fileName);
|
||||
}
|
||||
foreach (Plugin::getScripts() as $appName => $fileName) {
|
||||
script($appName, $fileName);
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="app" ng-app="News" ng-cloak ng-strict-di
|
||||
|
Loading…
Reference in New Issue
Block a user