Skip to content

Commit

Permalink
Merge pull request #27 from webability-go/late-night
Browse files Browse the repository at this point in the history
patch v2021.02.16
  • Loading branch information
metalwolf authored Feb 16, 2021
2 parents e8a5a5b + 11c5d46 commit 8c17201
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions usda/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ package usda
import (
"golang.org/x/text/language"

serverassets "github.com/webability-go/xamboo/assets"
"github.com/webability-go/xamboo/applications"
"github.com/webability-go/xamboo/cms/context"

"github.com/webability-go/xmodules/base"
"github.com/webability-go/xmodules/translation"
Expand Down Expand Up @@ -35,7 +36,7 @@ func init() {

// InitModule is called during the init phase to link the module with the system
// adds tables and caches to sitecontext::database
func Setup(ds serverassets.Datasource, prefix string) ([]string, error) {
func Setup(ds applications.Datasource, prefix string) ([]string, error) {

ctx := ds.(*base.Datasource)
buildTables(ctx)
Expand All @@ -47,7 +48,7 @@ func Setup(ds serverassets.Datasource, prefix string) ([]string, error) {
return []string{}, nil
}

func Synchronize(ds serverassets.Datasource, prefix string) ([]string, error) {
func Synchronize(ds applications.Datasource, prefix string) ([]string, error) {

ctx := ds.(*base.Datasource)
translation.AddTheme(ctx, TRANSLATIONTHEME, "USDA nutrients", translation.SOURCETABLE, "", "name,tag")
Expand All @@ -69,6 +70,6 @@ func Synchronize(ds serverassets.Datasource, prefix string) ([]string, error) {
return messages, nil
}

func StartContext(ds serverassets.Datasource, ctx *serverassets.Context) error {
func StartContext(ds applications.Datasource, ctx *context.Context) error {
return nil
}
10 changes: 5 additions & 5 deletions usda/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/webability-go/xmodules/base"
"github.com/webability-go/xmodules/translation"

serverassets "github.com/webability-go/xamboo/assets"
"github.com/webability-go/xamboo/applications"
)

type StructureNutrient struct {
Expand All @@ -16,15 +16,15 @@ type StructureNutrient struct {
Data *xdominion.XRecord
}

func CreateStructureNutrientByKey(sitecontext serverassets.Datasource, key string, lang language.Tag) base.Structure {
func CreateStructureNutrientByKey(sitecontext applications.Datasource, key string, lang language.Tag) base.Structure {
data, _ := sitecontext.GetTable("usda_nutrient").SelectOne(key)
if data == nil {
return nil
}
return CreateStructureNutrientByData(sitecontext, data, lang)
}

func CreateStructureNutrientByData(sitecontext serverassets.Datasource, data xdominion.XRecordDef, lang language.Tag) base.Structure {
func CreateStructureNutrientByData(sitecontext applications.Datasource, data xdominion.XRecordDef, lang language.Tag) base.Structure {

key, _ := data.GetString("key")

Expand All @@ -38,12 +38,12 @@ func CreateStructureNutrientByData(sitecontext serverassets.Datasource, data xdo
}

// ComplementData adds all the needed data from other objects /duplicable in the thread since the object will be destroyed at the end
func (sm *StructureNutrient) ComplementData(sitecontext serverassets.Datasource) {
func (sm *StructureNutrient) ComplementData(sitecontext applications.Datasource) {

}

// IsAuthorized returns true if the structure can be used on this site/language/device
func (sm *StructureNutrient) IsAuthorized(sitecontext serverassets.Datasource, site string, language string, device string) bool {
func (sm *StructureNutrient) IsAuthorized(sitecontext applications.Datasource, site string, language string, device string) bool {
return true
}

Expand Down

0 comments on commit 8c17201

Please sign in to comment.