New plugin system
parent
519197c037
commit
d2d429e211
|
@ -3,6 +3,7 @@
|
|||
|
||||
## 1.9.1 Taiga Tribe (unreleased)
|
||||
- [118n] Now taiga plugins can be translatable.
|
||||
- New Taiga plugins system.
|
||||
|
||||
### Misc
|
||||
- Statics folder hash to prevent cache problems when a new version is released.
|
||||
|
@ -10,7 +11,7 @@
|
|||
- Lots of small and not so small bugfixes.
|
||||
|
||||
|
||||
## 1.9.0 Abies Siberica (2015-11-XX)
|
||||
## 1.9.0 Abies Siberica (2015-11-02)
|
||||
|
||||
### Features
|
||||
- Ability to create single-line or multi-line custom fields. (thanks to [@artlepool](https://github.com/artlepool)).
|
||||
|
|
|
@ -16,14 +16,35 @@ window.taigaConfig = {
|
|||
"contribPlugins": []
|
||||
}
|
||||
|
||||
loadStylesheet = (path) ->
|
||||
$('head').append('<link rel="stylesheet" href="' + path + '" type="stylesheet" />')
|
||||
|
||||
loadPlugin = (pluginPath) ->
|
||||
return new Promise (resolve, reject) ->
|
||||
$.getJSON(pluginPath).then (plugin) ->
|
||||
if plugin.css
|
||||
loadStylesheet(plugin.css)
|
||||
|
||||
#dont' wait for css
|
||||
if plugin.js
|
||||
ljs.load(plugin.js, resolve)
|
||||
else
|
||||
resolve()
|
||||
|
||||
loadPlugins = (plugins) ->
|
||||
promises = []
|
||||
_.map plugins, (pluginPath) ->
|
||||
promises.push(loadPlugin(pluginPath))
|
||||
|
||||
return Promise.all(promises)
|
||||
|
||||
promise = $.getJSON "/conf.json"
|
||||
promise.done (data) ->
|
||||
window.taigaConfig = _.extend({}, window.taigaConfig, data)
|
||||
|
||||
promise.always ->
|
||||
if window.taigaConfig.contribPlugins.length > 0
|
||||
plugins = _.map(window.taigaConfig.contribPlugins, (plugin) -> "#{plugin}")
|
||||
ljs.load plugins, ->
|
||||
loadPlugins(window.taigaConfig.contribPlugins).then () ->
|
||||
ljs.load "/#{window._version}/js/app.js", ->
|
||||
angular.bootstrap(document, ['taiga'])
|
||||
else
|
||||
|
|
|
@ -22,7 +22,7 @@ taiga = @.taiga
|
|||
|
||||
class ThemeService extends taiga.Service = ->
|
||||
use: (themeName) ->
|
||||
stylesheetEl = $("link[rel='stylesheet']")
|
||||
stylesheetEl = $("link[rel='stylesheet']:first")
|
||||
|
||||
if stylesheetEl.length == 0
|
||||
stylesheetEl = $("<link rel='stylesheet' href='' type='text/css'>")
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
*
|
||||
!.gitignore
|
||||
!main.coffee
|
15
gulpfile.js
15
gulpfile.js
|
@ -56,7 +56,6 @@ paths.jade = [
|
|||
paths.htmlPartials = [
|
||||
paths.tmp + "partials/**/*.html",
|
||||
paths.tmp + "modules/**/*.html",
|
||||
paths.tmp + "plugins/**/*.html",
|
||||
"!" + paths.tmp + "partials/includes/**/*.html",
|
||||
"!" + paths.tmp + "/modules/**/includes/**/*.html"
|
||||
];
|
||||
|
@ -86,8 +85,7 @@ paths.styles_dependencies = [
|
|||
|
||||
paths.css = [
|
||||
paths.tmp + "styles/**/*.css",
|
||||
paths.tmp + "modules/**/*.css",
|
||||
paths.tmp + "plugins/**/*.css"
|
||||
paths.tmp + "modules/**/*.css"
|
||||
];
|
||||
|
||||
paths.css_order = [
|
||||
|
@ -103,7 +101,6 @@ paths.css_order = [
|
|||
paths.tmp + "styles/modules/**/*.css",
|
||||
paths.tmp + "modules/**/*.css",
|
||||
paths.tmp + "styles/shame/*.css",
|
||||
paths.tmp + "plugins/**/*.css",
|
||||
paths.tmp + "themes/**/*.css"
|
||||
];
|
||||
|
||||
|
@ -135,9 +132,7 @@ paths.coffee_order = [
|
|||
paths.app + "coffee/modules/user-settings/*.coffee",
|
||||
paths.app + "coffee/modules/integrations/*.coffee",
|
||||
paths.app + "modules/**/*.module.coffee",
|
||||
paths.app + "modules/**/*.coffee",
|
||||
paths.app + "plugins/*.coffee",
|
||||
paths.app + "plugins/**/*.coffee"
|
||||
paths.app + "modules/**/*.coffee"
|
||||
];
|
||||
|
||||
paths.libs = [
|
||||
|
@ -495,11 +490,6 @@ gulp.task("copy-theme-images", function() {
|
|||
.pipe(gulp.dest(paths.distVersion + "/images/" + themes.current.name));
|
||||
});
|
||||
|
||||
gulp.task("copy-plugins", function() {
|
||||
return gulp.src(paths.app + "/plugins/**")
|
||||
.pipe(gulp.dest(paths.dist + "/plugins/"));
|
||||
});
|
||||
|
||||
gulp.task("copy-extras", function() {
|
||||
return gulp.src(paths.extras + "/*")
|
||||
.pipe(gulp.dest(paths.dist + "/"));
|
||||
|
@ -510,7 +500,6 @@ gulp.task("copy", [
|
|||
"copy-theme-fonts",
|
||||
"copy-images",
|
||||
"copy-theme-images",
|
||||
"copy-plugins",
|
||||
"copy-svg",
|
||||
"copy-theme-svg",
|
||||
"copy-extras"
|
||||
|
|
Loading…
Reference in New Issue