Improve the new plugin system
parent
d1af25a596
commit
f6cf6d227c
|
@ -1,4 +1,5 @@
|
|||
window._version = "___VERSION___"
|
||||
|
||||
window.taigaConfig = {
|
||||
"api": "http://localhost:8000/api/v1/",
|
||||
"eventsUrl": null,
|
||||
|
@ -15,7 +16,10 @@ window.taigaConfig = {
|
|||
"maxUploadFileSize": null,
|
||||
"contribPlugins": []
|
||||
}
|
||||
window._decorators= []
|
||||
|
||||
window.taigaContribPlugins = []
|
||||
|
||||
window._decorators = []
|
||||
|
||||
window.addDecorator = (provider, decorator) ->
|
||||
window._decorators.push({provider: provider, decorator: decorator})
|
||||
|
@ -29,6 +33,8 @@ loadStylesheet = (path) ->
|
|||
loadPlugin = (pluginPath) ->
|
||||
return new Promise (resolve, reject) ->
|
||||
$.getJSON(pluginPath).then (plugin) ->
|
||||
window.taigaContribPlugins.push(plugin)
|
||||
|
||||
if plugin.css
|
||||
loadStylesheet(plugin.css)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
###
|
||||
|
||||
@taiga = taiga = {}
|
||||
@.taigaContribPlugins = @.taigaContribPlugins or []
|
||||
@.taigaContribPlugins = @.taigaContribPlugins or window.taigaContribPlugins or []
|
||||
|
||||
# Generic function for generate hash from a arbitrary length
|
||||
# collection of parameters.
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
# File: modules/base/contrib.coffee
|
||||
###
|
||||
|
||||
taigaContribPlugins = @.taigaContribPlugins = @.taigaContribPlugins or []
|
||||
module = angular.module("taigaBase")
|
||||
|
||||
|
||||
class ContribController extends taiga.Controller
|
||||
@.$inject = [
|
||||
|
@ -32,9 +33,7 @@ class ContribController extends taiga.Controller
|
|||
]
|
||||
|
||||
constructor: (@rootScope, @scope, @params, @repo, @rs, @confirm) ->
|
||||
@scope.adminPlugins = _.where(@rootScope.contribPlugins, {"type": "admin"})
|
||||
@scope.currentPlugin = _.first(_.where(@scope.adminPlugins, {"slug": @params.plugin}))
|
||||
@scope.pluginTemplate = "contrib/#{@scope.currentPlugin.slug}"
|
||||
@scope.currentPlugin = _.first(_.where(@rootScope.adminPlugins, {"slug": @params.plugin}))
|
||||
@scope.projectSlug = @params.pslug
|
||||
|
||||
promise = @.loadInitialData()
|
||||
|
@ -53,5 +52,4 @@ class ContribController extends taiga.Controller
|
|||
loadInitialData: ->
|
||||
return @.loadProject()
|
||||
|
||||
module = angular.module("taigaBase")
|
||||
module.controller("ContribController", ContribController)
|
||||
|
|
|
@ -9,4 +9,4 @@ div.wrapper.roles(ng-init="section='admin'", ng-controller="ContribController as
|
|||
sidebar.menu-tertiary.sidebar
|
||||
include ../includes/modules/admin/admin-submenu-contrib
|
||||
|
||||
section.main.admin-common.admin-contrib(ng-include="pluginTemplate")
|
||||
section.main.admin-common.admin-contrib(ng-include="currentPlugin.template")
|
||||
|
|
|
@ -2,5 +2,9 @@ section.admin-submenu
|
|||
nav
|
||||
ul
|
||||
li#adminmenu-contrib(ng-repeat="plugin in adminPlugins")
|
||||
a(href="", tg-nav="project-admin-contrib:project=projectSlug,plugin=plugin.slug" ng-class="{active: plugin.slug == currentPlugin.slug}")
|
||||
a(
|
||||
href=""
|
||||
tg-nav="project-admin-contrib:project=projectSlug,plugin=plugin.slug"
|
||||
ng-class="{active: plugin.slug == currentPlugin.slug}"
|
||||
)
|
||||
span.title {{ plugin.name }}
|
||||
|
|
|
@ -3,7 +3,7 @@ div.login-form-container(tg-login)
|
|||
fieldset
|
||||
input(
|
||||
type="text"
|
||||
autocorrect="off"
|
||||
autocorrect="off"
|
||||
autocapitalize="none"
|
||||
name="username"
|
||||
data-required="true"
|
||||
|
|
Loading…
Reference in New Issue