book: layout section, with links to concepts and edit icons
This commit is contained in:
parent
96850f110c
commit
8fafa41809
3 changed files with 48 additions and 32 deletions
|
@ -125,22 +125,18 @@ function setConceptTypeForComboBox(typeId, cbId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var dialog;
|
var dialog;
|
||||||
var dialogName;
|
|
||||||
|
|
||||||
function objectDialog(dlgName, url) {
|
function objectDialog(dlgName, url) {
|
||||||
dojo.require('dijit.Dialog');
|
dojo.require('dijit.Dialog');
|
||||||
dojo.require('dojo.parser');
|
dojo.require('dojo.parser');
|
||||||
dojo.require('dijit.form.FilteringSelect');
|
dojo.require('dijit.form.FilteringSelect');
|
||||||
dojo.require('dojox.data.QueryReadStore');
|
dojo.require('dojox.data.QueryReadStore');
|
||||||
if (dialogName == undefined || dialogName != dlgName || dialogName == '') {
|
if (dialog != undefined) {
|
||||||
if (dialog != undefined) {
|
dialog.destroyRecursive();
|
||||||
dialog.destroyRecursive();
|
|
||||||
}
|
|
||||||
dialogName = dlgName;
|
|
||||||
dialog = new dijit.Dialog({
|
|
||||||
href: url
|
|
||||||
}, dojo.byId('dialog.' + dlgName));
|
|
||||||
}
|
}
|
||||||
|
dialog = new dijit.Dialog({
|
||||||
|
href: url
|
||||||
|
}, dojo.byId('dialog.' + dlgName));
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,13 +62,25 @@ class SectionView(Base, ConceptView):
|
||||||
if self.editable:
|
if self.editable:
|
||||||
return 'index.html'
|
return 'index.html'
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def documentTypeType(self):
|
||||||
|
return self.conceptManager['documenttype']
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def sectionType(self):
|
||||||
|
return self.conceptManager['section']
|
||||||
|
|
||||||
def getCssClassForResource(self, r):
|
def getCssClassForResource(self, r):
|
||||||
documentType = self.conceptManager['documenttype']
|
|
||||||
for c in r.context.getConcepts([self.defaultPredicate]):
|
for c in r.context.getConcepts([self.defaultPredicate]):
|
||||||
if c.conceptType == documentType:
|
if c.conceptType == self.documentTypeType:
|
||||||
return getName(c)
|
return getName(c)
|
||||||
return 'textelement'
|
return 'textelement'
|
||||||
|
|
||||||
|
def getParentsForResource(self, r):
|
||||||
|
for c in r.context.getConcepts([self.defaultPredicate]):
|
||||||
|
if c.conceptType not in (self.documentTypeType, self.sectionType):
|
||||||
|
yield c
|
||||||
|
|
||||||
|
|
||||||
# layout parts - probably obsolete:
|
# layout parts - probably obsolete:
|
||||||
|
|
||||||
|
|
|
@ -4,29 +4,37 @@
|
||||||
<metal:section define-macro="section">
|
<metal:section define-macro="section">
|
||||||
<metal:info use-macro="view/concept_macros/concepttitle" />
|
<metal:info use-macro="view/concept_macros/concepttitle" />
|
||||||
<div tal:repeat="related item/resources">
|
<div tal:repeat="related item/resources">
|
||||||
<div class="object-actions" style="padding-top: 0"
|
<div class="span-4">
|
||||||
tal:define="url python:view.getUrlForTarget(related.context)"
|
<div tal:attributes="class python:
|
||||||
tal:condition="related/editable">
|
item.getCssClassForResource(related)"
|
||||||
<a i18n:translate="" i18n:attributes="title"
|
tal:content="structure related/render" />
|
||||||
title="Edit"
|
</div>
|
||||||
tal:define="targetUid python:view.getUidForObject(related.context);
|
<div class="span-2 last" style="padding-top: 0.4em">
|
||||||
url
|
<div class="object-actions" style="padding-top: 0"
|
||||||
string:$url/edit_object.html?version=this&targetUid=$targetUid"
|
tal:define="url python:view.getUrlForTarget(related.context)"
|
||||||
tal:attributes="href url;
|
tal:condition="related/editable">
|
||||||
onclick string:objectDialog('edit', '$url');;
|
<a i18n:translate="" i18n:attributes="title"
|
||||||
return false">
|
title="Edit"
|
||||||
<img tal:attributes="src
|
tal:define="targetUid python:view.getUidForObject(related.context);
|
||||||
string:$resourceBase/cybertools.icons/vcard_edit.png" /></a>
|
url
|
||||||
<a i18n:translate="" i18n:attributes="title"
|
string:$url/edit_object.html?version=this&targetUid=$targetUid"
|
||||||
title="Edit with external editor."
|
tal:attributes="href url;
|
||||||
tal:condition="related/xeditable"
|
onclick string:objectDialog('edit', '$url');;
|
||||||
tal:attributes="href string:$url/external_edit?version=this">
|
return false">
|
||||||
<img tal:attributes="src
|
<img tal:attributes="src
|
||||||
|
string:$resourceBase/cybertools.icons/vcard_edit.png" /></a>
|
||||||
|
<a i18n:translate="" i18n:attributes="title"
|
||||||
|
title="Edit with external editor."
|
||||||
|
tal:condition="related/xeditable"
|
||||||
|
tal:attributes="href string:$url/external_edit?version=this">
|
||||||
|
<img tal:attributes="src
|
||||||
string:$resourceBase/cybertools.icons/application_edit.png" /></a>
|
string:$resourceBase/cybertools.icons/application_edit.png" /></a>
|
||||||
</div>
|
</div>
|
||||||
<div tal:attributes="class python:
|
<div tal:repeat="parent python:item.getParentsForResource(related)">
|
||||||
item.getCssClassForResource(related)"
|
<a tal:content="parent/title"
|
||||||
tal:content="structure related/render" />
|
tal:attributes="href python:view.getUrlForTarget(parent)" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</metal:section>
|
</metal:section>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue