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 dialogName;
|
||||
|
||||
function objectDialog(dlgName, url) {
|
||||
dojo.require('dijit.Dialog');
|
||||
dojo.require('dojo.parser');
|
||||
dojo.require('dijit.form.FilteringSelect');
|
||||
dojo.require('dojox.data.QueryReadStore');
|
||||
if (dialogName == undefined || dialogName != dlgName || dialogName == '') {
|
||||
if (dialog != undefined) {
|
||||
dialog.destroyRecursive();
|
||||
}
|
||||
dialogName = dlgName;
|
||||
dialog = new dijit.Dialog({
|
||||
href: url
|
||||
}, dojo.byId('dialog.' + dlgName));
|
||||
if (dialog != undefined) {
|
||||
dialog.destroyRecursive();
|
||||
}
|
||||
dialog = new dijit.Dialog({
|
||||
href: url
|
||||
}, dojo.byId('dialog.' + dlgName));
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,13 +62,25 @@ class SectionView(Base, ConceptView):
|
|||
if self.editable:
|
||||
return 'index.html'
|
||||
|
||||
@Lazy
|
||||
def documentTypeType(self):
|
||||
return self.conceptManager['documenttype']
|
||||
|
||||
@Lazy
|
||||
def sectionType(self):
|
||||
return self.conceptManager['section']
|
||||
|
||||
def getCssClassForResource(self, r):
|
||||
documentType = self.conceptManager['documenttype']
|
||||
for c in r.context.getConcepts([self.defaultPredicate]):
|
||||
if c.conceptType == documentType:
|
||||
if c.conceptType == self.documentTypeType:
|
||||
return getName(c)
|
||||
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:
|
||||
|
||||
|
|
|
@ -4,29 +4,37 @@
|
|||
<metal:section define-macro="section">
|
||||
<metal:info use-macro="view/concept_macros/concepttitle" />
|
||||
<div tal:repeat="related item/resources">
|
||||
<div class="object-actions" style="padding-top: 0"
|
||||
tal:define="url python:view.getUrlForTarget(related.context)"
|
||||
tal:condition="related/editable">
|
||||
<a i18n:translate="" i18n:attributes="title"
|
||||
title="Edit"
|
||||
tal:define="targetUid python:view.getUidForObject(related.context);
|
||||
url
|
||||
string:$url/edit_object.html?version=this&targetUid=$targetUid"
|
||||
tal:attributes="href url;
|
||||
onclick string:objectDialog('edit', '$url');;
|
||||
return false">
|
||||
<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
|
||||
<div class="span-4">
|
||||
<div tal:attributes="class python:
|
||||
item.getCssClassForResource(related)"
|
||||
tal:content="structure related/render" />
|
||||
</div>
|
||||
<div class="span-2 last" style="padding-top: 0.4em">
|
||||
<div class="object-actions" style="padding-top: 0"
|
||||
tal:define="url python:view.getUrlForTarget(related.context)"
|
||||
tal:condition="related/editable">
|
||||
<a i18n:translate="" i18n:attributes="title"
|
||||
title="Edit"
|
||||
tal:define="targetUid python:view.getUidForObject(related.context);
|
||||
url
|
||||
string:$url/edit_object.html?version=this&targetUid=$targetUid"
|
||||
tal:attributes="href url;
|
||||
onclick string:objectDialog('edit', '$url');;
|
||||
return false">
|
||||
<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>
|
||||
</div>
|
||||
<div tal:attributes="class python:
|
||||
item.getCssClassForResource(related)"
|
||||
tal:content="structure related/render" />
|
||||
<div tal:repeat="parent python:item.getParentsForResource(related)">
|
||||
<a tal:content="parent/title"
|
||||
tal:attributes="href python:view.getUrlForTarget(parent)" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</metal:section>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue