Created
November 8, 2017 01:03
-
-
Save pYr0x/db3c2e684a63cdca19527df3965bec41 to your computer and use it in GitHub Desktop.
HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div type='text/stache' can-autorender> | |
<x-entnahmestelle-details> | |
<div class="card-header"> | |
<x-test vm:bar:from="bar"></x-test> | |
</div> | |
<div class="card-body"> | |
<x-entnahmestelle-tab-content entnahmestelle-id="1" vm:entnahmestelleId:to="bar"></x-entnahmestelle-tab-content> | |
</div> | |
</x-entnahmestelle-details> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "can-stache-bindings"; | |
import Component from "can-component"; | |
import DefineMap from "can-define/map/"; | |
import view from "./test.stache"; | |
const ViewModel = DefineMap.extend("Entnahmestelle-Tab-VM", { | |
detailPromise: { | |
type: "*" | |
}, | |
bar: { | |
type: "string" | |
} | |
}); | |
Component.extend({ | |
tag: "x-test", | |
ViewModel, | |
view, | |
events: {} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{bar}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "can-stache-bindings"; | |
import Component from "can-component"; | |
import DefineMap from "can-define/map/"; | |
import stache from "can-stache"; | |
import view from "./entnahmestelle-details.stache"; | |
const ViewModel = DefineMap.extend("Entnahmestelle-Tab-VM", { | |
bar: { | |
type: "string" | |
} | |
}); | |
Component.extend({ | |
tag: "x-entnahmestelle-details", | |
ViewModel, | |
view: stache("<content>"), | |
events: {} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "can-stache-bindings"; | |
import $ from "jquery"; | |
import Component from "can-component"; | |
import DefineMap from "can-define/map/"; | |
import view from "./entnahmestelle-tab-content.stache"; | |
import EntnahmestelleDetail from "~/models/entnahmestelle/detail"; | |
const ViewModel = DefineMap.extend("Entnahmestelle-Tab-VM", { | |
entnahmestelleId: { | |
set: (newVal) => { | |
if(!isNaN(parseInt(newVal, 10))) { | |
console.log(newVal); | |
return newVal; | |
} | |
} | |
}, | |
detailPromise: { | |
get: function() { | |
if(!isNaN(parseInt(this.entnahmestelleId, 10))) { | |
return EntnahmestelleDetail.get({"wwentnahmestelle_id": this.entnahmestelleId}); | |
} | |
} | |
} | |
}); | |
Component.extend({ | |
tag: "x-entnahmestelle-tab-content", | |
ViewModel, | |
view, | |
events: { | |
"inserted": () => { | |
$("#entnahmestelle-tab a").on("click", function (e) { | |
e.preventDefault(); | |
$(this).tab("show"); | |
}); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment