feat(apps): lots of work making apps easier to develop, module paths are handled automatically

This commit is contained in:
Torkel Ödegaard
2016-02-09 22:10:36 +01:00
parent fe2e6b8a80
commit baff9b0267
6 changed files with 41 additions and 18 deletions
+11 -8
View File
@@ -57,18 +57,24 @@ func (app *AppPlugin) Load(decoder *json.Decoder, pluginDir string) error {
return err
}
app.PluginDir = pluginDir
Apps[app.Id] = app
return nil
}
func (app *AppPlugin) initApp() {
app.initFrontendPlugin()
if app.Css != nil {
app.Css.Dark = evalRelativePluginUrlPath(app.Css.Dark, app.Id)
app.Css.Light = evalRelativePluginUrlPath(app.Css.Light, app.Id)
}
app.PluginDir = pluginDir
app.initFrontendPlugin()
// check if we have child panels
for _, panel := range Panels {
if strings.HasPrefix(panel.PluginDir, app.PluginDir) {
panel.IncludedInAppId = app.Id
panel.setPathsBasedOnApp(app)
app.Includes = append(app.Includes, &AppIncludeInfo{
Name: panel.Name,
Id: panel.Id,
@@ -80,7 +86,7 @@ func (app *AppPlugin) Load(decoder *json.Decoder, pluginDir string) error {
// check if we have child datasources
for _, ds := range DataSources {
if strings.HasPrefix(ds.PluginDir, app.PluginDir) {
ds.IncludedInAppId = app.Id
ds.setPathsBasedOnApp(app)
app.Includes = append(app.Includes, &AppIncludeInfo{
Name: ds.Name,
Id: ds.Id,
@@ -95,7 +101,4 @@ func (app *AppPlugin) Load(decoder *json.Decoder, pluginDir string) error {
page.Slug = slug.Make(page.Name)
}
}
Apps[app.Id] = app
return nil
}