Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adou600/4328016 to your computer and use it in GitHub Desktop.
Save adou600/4328016 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Midgard Create example</title>
<script src="../deps/jquery-1.7.1.min.js"></script>
<script src="../deps/jquery-ui-1.8.18.custom.min.js"></script>
<script src="../deps/underscore-min.js"></script>
<script src="../deps/backbone-min.js"></script>
<script src="../deps/vie-min.js"></script>
<!-- Tags input is needed for the Tag widget -->
<script src="../deps/jquery.tagsinput.min.js"></script>
<!-- rdfQuery and annotate are only needed for the Hallo
annotations plugin -->
<script src="../deps/jquery.rdfquery.min.js"></script>
<script src="../deps/annotate-min.js"></script>
<script src="../deps/rangy-core-1.2.3.js"></script>
<script src="../deps/hallo-min.js"></script>
<script src="./create.js"></script>
<script>
jQuery(document).ready(function () {
jQuery('body').midgardCreate({
url: function () {
return 'javascript:false;';
},
metadata: {
midgardTags: {}
},
collectionWidgets: {
'default': 'midgardCollectionAdd',
'skos:related': null
},
stanbolUrl: 'http://dev.iks-project.eu:8081'/*,
language: 'pt_BR'*/
});
// Set a simpler editor for title fields
jQuery('body').midgardCreate('configureEditor', 'title', 'halloWidget', {
plugins: {
halloformat: {},
halloblacklist: {
tags: ['br']
}
}
});
jQuery('body').midgardCreate('setEditorForProperty', 'dcterms:title', 'title');
// Disable editing of author fields
jQuery('body').midgardCreate('setEditorForProperty', 'dcterms:author', null);
});
// Fake Backbone.sync since there is no server to communicate with
Backbone.sync = function(method, model, options) {
if (console && console.log) {
console.log('Model contents', model.toJSONLD());
}
options.success(model);
};
</script>
<link rel="stylesheet" href="./font-awesome/css/font-awesome.css"
/>
<link rel="stylesheet" href="../themes/create-ui/css/create-ui.css"
/>
<link rel="stylesheet" href="../themes/midgard-notifications/midgardnotif.css"
/>
<link rel="stylesheet" href="demo.css" />
</head>
<body>
<div xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:sc="http://schema.org/"
xmlns:cw="http://schema.org/CreativeWork/"
xmlns:ar="http://schema.org/Article/"
typeof="sc:CollectionPage"
about="/cms/content/news">
<h2 property="cw:headline">News</h2>
<p property="ar:articleBody">
The latest news about the CMF Sandbox.
</p>
<ul rel="dcterms:hasPart"
rev="dcterms:partOf"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:sc="http://schema.org/"
xmlns:cw="http://schema.org/CreativeWork/"
xmlns:ar="http://schema.org/Article/"
about="/cms/content/news">
<li xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:sc="http://schema.org/"
xmlns:cw="http://schema.org/CreativeWork/"
xmlns:ar="http://schema.org/Article/"
typeof="sc:NewsArticle"
about="/cms/content/news/news-1">
<a href="/app_dev.php/fr/news/news-1" property="cw:headline">
News 1 title
</a> (2012-12-12)
<div class="newscontent" property="ar:articleBody">
News 1 content
</div>
</li>
<li xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:sc="http://schema.org/"
xmlns:cw="http://schema.org/CreativeWork/"
xmlns:ar="http://schema.org/Article/"
typeof="sc:NewsArticle"
about="/cms/content/news/news-2">
<a href="/app_dev.php/fr/news/news-2" property="cw:headline">
News 2 title
</a> (2012-11-11)
<div class="newscontent" property="ar:articleBody">
News 2 content
</div>
</li>
</ul>
</div>
</body>
</html>
{% createphp cmfMainContent as="rdf" %}
<div class="newsoverview" {{ createphp_attributes(rdf) }}>
<h2 {{ createphp_attributes( rdf.title ) }}>{{ createphp_content( rdf.title ) }}</h2>
<p {{ createphp_attributes( rdf.body ) }}>{{ createphp_content( rdf.body|raw ) }}</p>
<ul {{ createphp_attributes( rdf.children ) }}>
{% for news in cmf_children(cmfMainContent) %}
{% createphp news %}
<li {{ createphp_attributes(news_rdf) }}>
<a href="{{ path(news) }}" {{ createphp_attributes(news_rdf.title) }}>{{ createphp_content(news_rdf.title) }}</a> ({{ news.publishStartDate | date('Y-m-d') }})
<div class="newscontent" {{ createphp_attributes(news_rdf.body) }}>{{ createphp_content(news_rdf.body) }}</div>
</li>
{% endcreatephp %}
{% endfor %}
</ul>
</div>
{% endcreatephp %}
<type
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:sc="http://schema.org/"
xmlns:cw="http://schema.org/CreativeWork/"
xmlns:ar="http://schema.org/Article/"
typeof="sc:CollectionPage"
itemtype="http://schema.org/CollectionPage"
>
<children>
<property property="cw:headline" identifier="title" tag-name="h1"/>
<property property="ar:articleBody" identifier="body" />
<collection rel="dcterms:hasPart" rev="dcterms:partOf" identifier="children" />
</children>
</type>
<type
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:sc="http://schema.org/"
xmlns:cw="http://schema.org/CreativeWork/"
xmlns:ar="http://schema.org/Article/"
typeof="sc:NewsArticle"
itemtype="http://schema.org/NewsArticle"
>
<rev>dcterms:partOf</rev>
<children>
<property property="cw:headline" identifier="title" tag-name="h1"/>
<property property="ar:articleBody" identifier="body" />
</children>
</type>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment