Created
January 25, 2019 18:26
-
-
Save majames/3fb4aab9fd97ac6a84f3a03dc33bac13 to your computer and use it in GitHub Desktop.
[GREENDOC] Razor Templating
This file contains hidden or 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
<!-- File located in Kaggle.Web project under Views/Datasets/Listing --> | |
<!-- Template extends default layout which has basic HTML scaffold --> | |
@model DatasetListingDto | |
@{ PageTitle = "Kaggle | Datasets Listing" } | |
@section HeadTags { | |
<meta name="twitter:card" content="summary" /> | |
... | |
} | |
<script> | |
@{ var dto = JsonDto.Encode(Model) } | |
window.__INIT_STATE__ = @dto; | |
</script> | |
@{ var scriptSrc = KaggleComponents.CreateScriptSrc(/* team */ "datasets", /* page */ "listing") } | |
<script src="@scriptSrc"></script> |
This file contains hidden or 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
[Route("datasets")] | |
public async Task<ActionResult> ViewDatasetListing() { | |
if (/*user is auth'd*/) { | |
var dto = DatasetsClient.GetListingDto(); | |
return View("DatasetsListing", dto); | |
} else { | |
return PageNotFound(); | |
} | |
} |
This file contains hidden or 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
// File located in @kaggle/web package under src/datasets/pages/listing | |
import { render } from 'react-dom'; | |
import { PageScaffold } from '../../../design/components/PageScaffold'; | |
import { ListingApp } from '../../components/ListingApp'; | |
ReactDOM.render( | |
<ListingApp {...window.__INIT_STATE__} /> | |
document.getElementById("root") | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment