[PATCH 2 of 2 saem_ref] Use JQTree to display Concepts in ConceptScheme tab view

Frank Bessou frank.bessou at logilab.fr
Thu Sep 27 16:08:03 CEST 2018


# HG changeset patch
# User Frank Bessou <frank.bessou at logilab.fr>
# Date 1538042688 -7200
#      Thu Sep 27 12:04:48 2018 +0200
# Node ID 4390eb3ac1b6cbfeb47a68a0ca54df37f53c4553
# Parent  b474ec8a076ba4e20beaf571cd9da26165ec17c5
# Available At http://hg.logilab.org/review/cubes/saem_ref
#              hg pull http://hg.logilab.org/review/cubes/saem_ref -r 4390eb3ac1b6
Use JQTree to display Concepts in ConceptScheme tab view

We extend the ConceptSchemeConceptsTab to use the jqtree.tree view and
we disable the base class.

diff --git a/cubicweb_saem_ref/views/__init__.py b/cubicweb_saem_ref/views/__init__.py
--- a/cubicweb_saem_ref/views/__init__.py
+++ b/cubicweb_saem_ref/views/__init__.py
@@ -41,6 +41,7 @@ from cubicweb.web.views import (
 
 from cubes.squareui.views.basetemplates import basetemplates
 from cubicweb_seda.views import dropdown_button, has_rel_perm, widgets as sedawidgets
+import cubicweb_skos.views as skos_views
 
 from .. import cwuri_url
 
@@ -475,6 +476,16 @@ class RestPathEvaluator(urlpublishing.Re
         return super(RestPathEvaluator, self).set_vid_for_rset(req, cls, rset)
 
 
+class ConceptSchemeConceptsTab(skos_views.ConceptSchemeConceptsTab):
+    """display a SKOS concept scheme tree"""
+    __regid__ = 'skos_top_concepts_tab'  # don't use '.' in tab's regid
+    __select__ = is_instance('ConceptScheme')
+
+    def render_tree(self, entity, children_rset):
+        self._cw.add_js('cubes.saem_ref.js')
+        entity.view('jqtree.treeview', w=self.w)
+
+
 def registration_callback(vreg):
     from cubicweb.web.views import actions, cwuser, tableview, undohistory
     vreg.register_all(globals().values(), __name__, (
@@ -482,11 +493,13 @@ def registration_callback(vreg):
         SAEMHTMLPageFooter,
         SAEMNoResultView,
         URLAttributeView,
+        ConceptSchemeConceptsTab,
     ))
     vreg.register_and_replace(RestPathEvaluator, urlpublishing.RestPathEvaluator)
     vreg.register_and_replace(URLAttributeView, primary.URLAttributeView)
     vreg.register_and_replace(SAEMHTMLPageFooter, basetemplates.HTMLPageFooter)
     vreg.register_and_replace(SAEMNoResultView, baseviews.NoResultView)
+    vreg.register_and_replace(ConceptSchemeConceptsTab, skos_views.ConceptSchemeConceptsTab)
     vreg.unregister(tableview.TableView)
     vreg.unregister(undohistory.UndoHistoryView)
     vreg.unregister(basecomponents.ApplicationName)



More information about the saem-devel mailing list