web/test/unittest_reledit.py
author Alain Leufroy <alain.leufroy@logilab.fr>
Wed, 20 May 2015 16:13:07 +0200
changeset 10434 8e04ab5582d9
parent 9894 9461d1bd70bb
permissions -rw-r--r--
[web/views/formrenderer] do not use `cubicweb:target` attribute on form (closes #5534074) The `cubicweb:target` is a flag indicating that the form data (with file input) shall be posted inside an iframe - this is a well known "ajax-like" workaround to post files with browsers that do not support `FormData` (a.k.a IE<10). The `cubicweb:target` was introduced when CW used the "xhtml strict" doctype. Now that CW uses the "html5" doctype, this namespaced attribute is no longer necessary and the iframe can be generated directly. Before this patch, CW inserts the `cubicweb:target` attribute in the form DOM element (server side) and `setFormsTarget()` updates the DOM with a new `<iframe>` element (client side). Now, CW inserts the `<iframe>` DOM element directly (server side), making `setFormsTarget` useless.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9871
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
     1
# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     2
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     3
#
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     4
# This file is part of CubicWeb.
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     5
#
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     6
# CubicWeb is free software: you can redistribute it and/or modify it under the
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     7
# terms of the GNU Lesser General Public License as published by the Free
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     8
# Software Foundation, either version 2.1 of the License, or (at your option)
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     9
# any later version.
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    10
#
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    11
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    13
# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    14
# details.
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    15
#
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    16
# You should have received a copy of the GNU Lesser General Public License along
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    17
# with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    18
"""
7161
e3f69df8dac7 fix failing tests before 3.12 release
Alexandre Fayolle <alexandre.fayolle@logilab.fr>
parents: 7128
diff changeset
    19
mainly regression-preventing tests for reledit views
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    20
"""
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    21
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    22
from cubicweb.devtools.testlib import CubicWebTC
8665
e65af61bde7d [uicfg] uicfg.py moves from web/ to web/views/ (prepares #2406609)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 8483
diff changeset
    23
from cubicweb.web.views.uicfg import reledit_ctrl
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    24
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    25
class ReleditMixinTC(object):
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    26
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    27
    def setup_database(self):
9652
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    28
        with self.admin_access.client_cnx() as cnx:
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    29
            self.proj = cnx.create_entity('Project', title=u'cubicweb-world-domination').eid
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    30
            self.tick = cnx.create_entity('Ticket', title=u'write the code').eid
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    31
            self.toto = cnx.create_entity('Personne', nom=u'Toto').eid
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    32
            cnx.commit()
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    33
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    34
class ClickAndEditFormTC(ReleditMixinTC, CubicWebTC):
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    35
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    36
    def test_default_config(self):
9871
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
    37
        reledit = {'title': '''<div id="title-subject-%(eid)s-reledit" onmouseout="jQuery('#title-subject-%(eid)s').addClass('invisible')" onmouseover="jQuery('#title-subject-%(eid)s').removeClass('invisible')" class="releditField"><div id="title-subject-%(eid)s-value" class="editableFieldValue">cubicweb-world-domination</div><div id="title-subject-%(eid)s" class="editableField invisible"><div id="title-subject-%(eid)s-update" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;base&#39;, %(eid)s, &#39;title&#39;, &#39;subject&#39;, &#39;title-subject-%(eid)s&#39;, false, &#39;&#39;, &#39;edit_rtype&#39;);" title="click to edit this field"><img title="click to edit this field" src="http://testing.fr/cubicweb/data/pen_icon.png" alt="click to edit this field"/></div></div></div>''',
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
    38
                   'long_desc': '''<div id="long_desc-subject-%(eid)s-reledit" onmouseout="jQuery('#long_desc-subject-%(eid)s').addClass('invisible')" onmouseover="jQuery('#long_desc-subject-%(eid)s').removeClass('invisible')" class="releditField"><div id="long_desc-subject-%(eid)s-value" class="editableFieldValue">&lt;not specified&gt;</div><div id="long_desc-subject-%(eid)s" class="editableField invisible"><div id="long_desc-subject-%(eid)s-add" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;edition&#39;, %(eid)s, &#39;long_desc&#39;, &#39;subject&#39;, &#39;long_desc-subject-%(eid)s&#39;, false, &#39;autolimited&#39;, &#39;add&#39;);" title="click to add a value"><img title="click to add a value" src="http://testing.fr/cubicweb/data/plus.png" alt="click to add a value"/></div></div></div>''',
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
    39
                   'manager': '''<div id="manager-subject-%(eid)s-reledit" onmouseout="jQuery('#manager-subject-%(eid)s').addClass('invisible')" onmouseover="jQuery('#manager-subject-%(eid)s').removeClass('invisible')" class="releditField"><div id="manager-subject-%(eid)s-value" class="editableFieldValue">&lt;not specified&gt;</div><div id="manager-subject-%(eid)s" class="editableField invisible"><div id="manager-subject-%(eid)s-update" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;base&#39;, %(eid)s, &#39;manager&#39;, &#39;subject&#39;, &#39;manager-subject-%(eid)s&#39;, false, &#39;autolimited&#39;, &#39;edit_rtype&#39;);" title="click to edit this field"><img title="click to edit this field" src="http://testing.fr/cubicweb/data/pen_icon.png" alt="click to edit this field"/></div></div></div>''',
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    40
                   'composite_card11_2ttypes': """&lt;not specified&gt;""",
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    41
                   'concerns': """&lt;not specified&gt;"""}
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    42
9652
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    43
        with self.admin_access.web_request() as req:
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    44
            proj = req.entity_from_eid(self.proj)
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    45
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    46
            for rschema, ttypes, role in proj.e_schema.relation_definitions(includefinal=True):
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    47
                if rschema not in reledit:
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    48
                    continue
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    49
                rtype = rschema.type
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    50
                self.assertMultiLineEqual(reledit[rtype] % {'eid': self.proj},
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    51
                                          proj.view('reledit', rtype=rtype, role=role),
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
    52
                                          rtype)
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    53
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    54
    def test_default_forms(self):
7585
8bad94040b1b drop unittest deprecation warning
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7161
diff changeset
    55
        self.skipTest('Need to check if this test should still run post reledit/doreledit merge')
10434
8e04ab5582d9 [web/views/formrenderer] do not use `cubicweb:target` attribute on form (closes #5534074)
Alain Leufroy <alain.leufroy@logilab.fr>
parents: 9894
diff changeset
    56
        doreledit = {'title': """<div id="title-subject-%(eid)s-reledit" onmouseout="jQuery('#title-subject-%(eid)s').addClass('invisible')" onmouseover="jQuery('#title-subject-%(eid)s').removeClass('invisible')" class="releditField"><div id="title-subject-%(eid)s-value" class="editableFieldValue">cubicweb-world-domination</div><form action="http://testing.fr/cubicweb/validateform?__onsuccess=window.parent.cw.reledit.onSuccess" method="post" enctype="application/x-www-form-urlencoded" id="title-subject-%(eid)s-form" onsubmit="return freezeFormButtons(&#39;title-subject-%(eid)s-form&#39;);" class="releditForm" target="eformframe">
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    57
<fieldset>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    58
<input name="__form_id" type="hidden" value="base" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    59
<input name="__errorurl" type="hidden" value="http://testing.fr/cubicweb/view?rql=Blop&amp;vid=blop#title-subject-%(eid)s-form" />
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    60
<input name="__domid" type="hidden" value="title-subject-%(eid)s-form" />
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    61
<input name="__type:%(eid)s" type="hidden" value="Project" />
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    62
<input name="eid" type="hidden" value="%(eid)s" />
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    63
<input name="__maineid" type="hidden" value="%(eid)s" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    64
<input name="__reledit|vid" type="hidden" value="" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    65
<input name="__reledit|rtype" type="hidden" value="title" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    66
<input name="__reledit|divid" type="hidden" value="title-subject-%(eid)s" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    67
<input name="__reledit|formid" type="hidden" value="base" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    68
<input name="__reledit|reload" type="hidden" value="false" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    69
<input name="__reledit|role" type="hidden" value="subject" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    70
<input name="__reledit|eid" type="hidden" value="%(eid)s" />
7584
e1881933f366 [form, controller] closes #1787233: form should provide a method to process posted content
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7161
diff changeset
    71
<input name="_cw_entity_fields:%(eid)s" type="hidden" value="title-subject,__type" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    72
<fieldset class="default">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    73
<table class="">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    74
<tr class="title_subject_row">
6597
ba9fb496ad87 [test/renderer] fix html form/field generation & adapt a bit one test
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 6433
diff changeset
    75
<td>
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    76
<input id="title-subject:%(eid)s" maxlength="32" name="title-subject:%(eid)s" size="32" tabindex="1" type="text" value="cubicweb-world-domination" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    77
</td></tr>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    78
</table></fieldset>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    79
<table class="buttonbar">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    80
<tr>
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    81
<td><button class="validateButton" tabindex="2" type="submit" value="button_ok"><img alt="OK_ICON" src="http://testing.fr/cubicweb/data/ok.png" />button_ok</button></td>
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    82
<td><button class="validateButton" onclick="cw.reledit.cleanupAfterCancel(&#39;title-subject-%(eid)s&#39;)" tabindex="3" type="button" value="button_cancel"><img alt="CANCEL_ICON" src="http://testing.fr/cubicweb/data/cancel.png" />button_cancel</button></td>
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    83
</tr></table>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    84
</fieldset>
10434
8e04ab5582d9 [web/views/formrenderer] do not use `cubicweb:target` attribute on form (closes #5534074)
Alain Leufroy <alain.leufroy@logilab.fr>
parents: 9894
diff changeset
    85
<iframe width="0px" height="0px" src="javascript: void(0);" name="eformframe" id="eformframe"></iframe>
9871
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
    86
</form><div id="title-subject-%(eid)s" class="editableField invisible"><div id="title-subject-%(eid)s-update" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;base&#39;, %(eid)s, &#39;title&#39;, &#39;subject&#39;, &#39;title-subject-%(eid)s&#39;, false, &#39;&#39;);" title="click to edit this field"><img title="click to edit this field" src="http://testing.fr/cubicweb/data/pen_icon.png" alt="click to edit this field"/></div></div></div>""",
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    87
10434
8e04ab5582d9 [web/views/formrenderer] do not use `cubicweb:target` attribute on form (closes #5534074)
Alain Leufroy <alain.leufroy@logilab.fr>
parents: 9894
diff changeset
    88
                     'long_desc': """<div id="long_desc-subject-%(eid)s-reledit" onmouseout="jQuery('#long_desc-subject-%(eid)s').addClass('invisible')" onmouseover="jQuery('#long_desc-subject-%(eid)s').removeClass('invisible')" class="releditField"><div id="long_desc-subject-%(eid)s-value" class="editableFieldValue">&lt;not specified&gt;</div><form action="http://testing.fr/cubicweb/validateform?__onsuccess=window.parent.cw.reledit.onSuccess" method="post" enctype="application/x-www-form-urlencoded" id="long_desc-subject-%(eid)s-form" onsubmit="return freezeFormButtons(&#39;long_desc-subject-%(eid)s-form&#39;);" class="releditForm" target="eformframe">
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    89
<fieldset>
9871
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
    90
<input name="__form_id" type="invisible" value="edition" />
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
    91
<input name="__errorurl" type="invisible" value="http://testing.fr/cubicweb/view?rql=Blop&amp;vid=blop#long_desc-subject-%(eid)s-form" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    92
<input name="__domid" type="hidden" value="long_desc-subject-%(eid)s-form" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    93
<input name="__type:A" type="hidden" value="Blog" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    94
<input name="eid" type="hidden" value="A" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    95
<input name="__maineid" type="hidden" value="A" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    96
<input name="__linkto" type="hidden" value="long_desc:%(eid)s:object" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    97
<input name="__message" type="hidden" value="entity linked" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
    98
<input name="__reledit|vid" type="hidden" value="autolimited" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
    99
<input name="__reledit|rtype" type="hidden" value="long_desc" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   100
<input name="__reledit|divid" type="hidden" value="long_desc-subject-%(eid)s" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   101
<input name="__reledit|formid" type="hidden" value="edition" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   102
<input name="__reledit|reload" type="hidden" value="false" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   103
<input name="__reledit|role" type="hidden" value="subject" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   104
<input name="__reledit|eid" type="hidden" value="%(eid)s" />
7584
e1881933f366 [form, controller] closes #1787233: form should provide a method to process posted content
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7161
diff changeset
   105
<input name="_cw_entity_fields:A" type="hidden" value="title-subject,rss_url-subject,__type,description-subject" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   106
<fieldset class="default">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   107
<table class="attributeForm">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   108
<tr class="title_subject_row">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   109
<th class="labelCol"><label class="required" for="title-subject:A">title</label></th>
6597
ba9fb496ad87 [test/renderer] fix html form/field generation & adapt a bit one test
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 6433
diff changeset
   110
<td>
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   111
<input id="title-subject:A" maxlength="50" name="title-subject:A" size="45" tabindex="4" type="text" value="" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   112
</td></tr>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   113
<tr class="description_subject_row">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   114
<th class="labelCol"><label for="description-subject:A">description</label></th>
6597
ba9fb496ad87 [test/renderer] fix html form/field generation & adapt a bit one test
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 6433
diff changeset
   115
<td>
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   116
<input name="description_format-subject:A" type="hidden" value="text/html" /><textarea cols="80" cubicweb:type="wysiwyg" id="description-subject:A" name="description-subject:A" onkeyup="autogrow(this)" rows="2" tabindex="5"></textarea>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   117
</td></tr>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   118
<tr class="rss_url_subject_row">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   119
<th class="labelCol"><label for="rss_url-subject:A">rss_url</label></th>
6597
ba9fb496ad87 [test/renderer] fix html form/field generation & adapt a bit one test
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 6433
diff changeset
   120
<td>
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   121
<input id="rss_url-subject:A" maxlength="128" name="rss_url-subject:A" size="45" tabindex="6" type="text" value="" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   122
</td></tr>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   123
</table></fieldset>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   124
<table class="buttonbar">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   125
<tr>
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   126
<td><button class="validateButton" tabindex="7" type="submit" value="button_ok"><img alt="OK_ICON" src="http://testing.fr/cubicweb/data/ok.png" />button_ok</button></td>
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   127
<td><button class="validateButton" onclick="cw.reledit.cleanupAfterCancel(&#39;long_desc-subject-%(eid)s&#39;)" tabindex="8" type="button" value="button_cancel"><img alt="CANCEL_ICON" src="http://testing.fr/cubicweb/data/cancel.png" />button_cancel</button></td>
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   128
</tr></table>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   129
</fieldset>
10434
8e04ab5582d9 [web/views/formrenderer] do not use `cubicweb:target` attribute on form (closes #5534074)
Alain Leufroy <alain.leufroy@logilab.fr>
parents: 9894
diff changeset
   130
<iframe width="0px" height="0px" src="javascript: void(0);" name="eformframe" id="eformframe"></iframe>
9871
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
   131
</form><div id="long_desc-subject-%(eid)s" class="editableField invisible"><div id="long_desc-subject-%(eid)s-add" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;edition&#39;, %(eid)s, &#39;long_desc&#39;, &#39;subject&#39;, &#39;long_desc-subject-%(eid)s&#39;, false, &#39;autolimited&#39;);" title="click to add a value"><img title="click to add a value" src="http://testing.fr/cubicweb/data/plus.png" alt="click to add a value"/></div></div></div>""",
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   132
10434
8e04ab5582d9 [web/views/formrenderer] do not use `cubicweb:target` attribute on form (closes #5534074)
Alain Leufroy <alain.leufroy@logilab.fr>
parents: 9894
diff changeset
   133
                     'manager': """<div id="manager-subject-%(eid)s-reledit" onmouseout="jQuery('#manager-subject-%(eid)s').addClass('invisible')" onmouseover="jQuery('#manager-subject-%(eid)s').removeClass('invisible')" class="releditField"><div id="manager-subject-%(eid)s-value" class="editableFieldValue">&lt;not specified&gt;</div><form action="http://testing.fr/cubicweb/validateform?__onsuccess=window.parent.cw.reledit.onSuccess" method="post" enctype="application/x-www-form-urlencoded" id="manager-subject-%(eid)s-form" onsubmit="return freezeFormButtons(&#39;manager-subject-%(eid)s-form&#39;);" class="releditForm" target="eformframe">
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   134
<fieldset>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   135
<input name="__form_id" type="hidden" value="base" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   136
<input name="__errorurl" type="hidden" value="http://testing.fr/cubicweb/view?rql=Blop&amp;vid=blop#manager-subject-%(eid)s-form" />
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   137
<input name="__domid" type="hidden" value="manager-subject-%(eid)s-form" />
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   138
<input name="__type:%(eid)s" type="hidden" value="Project" />
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   139
<input name="eid" type="hidden" value="%(eid)s" />
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   140
<input name="__maineid" type="hidden" value="%(eid)s" />
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   141
<input name="__linkto" type="hidden" value="long_desc:%(eid)s:object" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   142
<input name="__message" type="hidden" value="entity linked" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   143
<input name="__reledit|vid" type="hidden" value="autolimited" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   144
<input name="__reledit|rtype" type="hidden" value="manager" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   145
<input name="__reledit|divid" type="hidden" value="manager-subject-%(eid)s" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   146
<input name="__reledit|formid" type="hidden" value="base" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   147
<input name="__reledit|reload" type="hidden" value="false" />
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   148
<input name="__reledit|role" type="hidden" value="subject" />
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   149
<input name="__reledit|eid" type="hidden" value="%(eid)s" />
7584
e1881933f366 [form, controller] closes #1787233: form should provide a method to process posted content
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7161
diff changeset
   150
<input name="_cw_entity_fields:%(eid)s" type="hidden" value="manager-subject,__type" />
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   151
<fieldset class="default">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   152
<table class="">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   153
<tr class="manager_subject_row">
6597
ba9fb496ad87 [test/renderer] fix html form/field generation & adapt a bit one test
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 6433
diff changeset
   154
<td>
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   155
<select id="manager-subject:%(eid)s" name="manager-subject:%(eid)s" size="1" tabindex="9">
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   156
<option value="__cubicweb_internal_field__"></option>
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   157
<option value="%(toto)s">Toto</option>
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   158
</select>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   159
</td></tr>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   160
</table></fieldset>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   161
<table class="buttonbar">
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   162
<tr>
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   163
<td><button class="validateButton" tabindex="10" type="submit" value="button_ok"><img alt="OK_ICON" src="http://testing.fr/cubicweb/data/ok.png" />button_ok</button></td>
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   164
<td><button class="validateButton" onclick="cw.reledit.cleanupAfterCancel(&#39;manager-subject-%(eid)s&#39;)" tabindex="11" type="button" value="button_cancel"><img alt="CANCEL_ICON" src="http://testing.fr/cubicweb/data/cancel.png" />button_cancel</button></td>
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   165
</tr></table>
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   166
</fieldset>
10434
8e04ab5582d9 [web/views/formrenderer] do not use `cubicweb:target` attribute on form (closes #5534074)
Alain Leufroy <alain.leufroy@logilab.fr>
parents: 9894
diff changeset
   167
<iframe width="0px" height="0px" src="javascript: void(0);" name="eformframe" id="eformframe"></iframe>
9871
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
   168
</form><div id="manager-subject-%(eid)s" class="editableField invisible"><div id="manager-subject-%(eid)s-update" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;base&#39;, %(eid)s, &#39;manager&#39;, &#39;subject&#39;, &#39;manager-subject-%(eid)s&#39;, false, &#39;autolimited&#39;);" title="click to edit this field"><img title="click to edit this field" src="http://testing.fr/cubicweb/data/pen_icon.png" alt="click to edit this field"/></div></div></div>""",
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   169
                     'composite_card11_2ttypes': """&lt;not specified&gt;""",
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   170
                     'concerns': """&lt;not specified&gt;"""
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   171
            }
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   172
        for rschema, ttypes, role in self.proj.e_schema.relation_definitions(includefinal=True):
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   173
            if rschema not in doreledit:
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   174
                continue
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   175
            rtype = rschema.type
6340
470d8e828fda [test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6283
diff changeset
   176
            self.assertMultiLineEqual(doreledit[rtype] % {'eid': self.proj.eid, 'toto': self.toto.eid},
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   177
                                  self.proj.view('doreledit', rtype=rtype, role=role,
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   178
                                                 formid='edition' if rtype == 'long_desc' else 'base'),
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   179
                                  rtype)
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   180
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   181
class ClickAndEditFormUICFGTC(ReleditMixinTC, CubicWebTC):
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   182
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   183
    def setup_database(self):
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   184
        super(ClickAndEditFormUICFGTC, self).setup_database()
9652
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   185
        with self.admin_access.client_cnx() as cnx:
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   186
            cnx.execute('SET T concerns P WHERE T eid %(t)s, P eid %(p)s', {'t': self.tick, 'p': self.proj})
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   187
            cnx.execute('SET P manager T WHERE P eid %(p)s, T eid %(t)s', {'p': self.proj, 't': self.toto})
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   188
            cnx.commit()
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   189
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   190
    def test_with_uicfg(self):
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   191
        old_rctl = reledit_ctrl._tagdefs.copy()
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   192
        reledit_ctrl.tag_attribute(('Project', 'title'),
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   193
                                   {'novalue_label': '<title is required>', 'reload': True})
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   194
        reledit_ctrl.tag_subject_of(('Project', 'long_desc', '*'),
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   195
                                    {'reload': True, 'edit_target': 'rtype',
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   196
                                     'novalue_label': u'<long_desc is required>'})
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   197
        reledit_ctrl.tag_subject_of(('Project', 'manager', '*'),
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   198
                                   {'edit_target': 'related'})
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   199
        reledit_ctrl.tag_subject_of(('Project', 'composite_card11_2ttypes', '*'),
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   200
                                   {'edit_target': 'related'})
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   201
        reledit_ctrl.tag_object_of(('Ticket', 'concerns', 'Project'),
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   202
                                   {'edit_target': 'rtype'})
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   203
        reledit = {
9871
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
   204
            'title': """<div id="title-subject-%(eid)s-reledit" onmouseout="jQuery('#title-subject-%(eid)s').addClass('invisible')" onmouseover="jQuery('#title-subject-%(eid)s').removeClass('invisible')" class="releditField"><div id="title-subject-%(eid)s-value" class="editableFieldValue">cubicweb-world-domination</div><div id="title-subject-%(eid)s" class="editableField invisible"><div id="title-subject-%(eid)s-update" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;base&#39;, %(eid)s, &#39;title&#39;, &#39;subject&#39;, &#39;title-subject-%(eid)s&#39;, true, &#39;&#39;, &#39;edit_rtype&#39;);" title="click to edit this field"><img title="click to edit this field" src="http://testing.fr/cubicweb/data/pen_icon.png" alt="click to edit this field"/></div></div></div>""",
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
   205
            'long_desc': """<div id="long_desc-subject-%(eid)s-reledit" onmouseout="jQuery('#long_desc-subject-%(eid)s').addClass('invisible')" onmouseover="jQuery('#long_desc-subject-%(eid)s').removeClass('invisible')" class="releditField"><div id="long_desc-subject-%(eid)s-value" class="editableFieldValue">&lt;long_desc is required&gt;</div><div id="long_desc-subject-%(eid)s" class="editableField invisible"><div id="long_desc-subject-%(eid)s-update" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;base&#39;, %(eid)s, &#39;long_desc&#39;, &#39;subject&#39;, &#39;long_desc-subject-%(eid)s&#39;, true, &#39;autolimited&#39;, &#39;edit_rtype&#39;);" title="click to edit this field"><img title="click to edit this field" src="http://testing.fr/cubicweb/data/pen_icon.png" alt="click to edit this field"/></div></div></div>""",
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
   206
            'manager': """<div id="manager-subject-%(eid)s-reledit" onmouseout="jQuery('#manager-subject-%(eid)s').addClass('invisible')" onmouseover="jQuery('#manager-subject-%(eid)s').removeClass('invisible')" class="releditField"><div id="manager-subject-%(eid)s-value" class="editableFieldValue"><a href="http://testing.fr/cubicweb/personne/%(toto)s" title="">Toto</a></div><div id="manager-subject-%(eid)s" class="editableField invisible"><div id="manager-subject-%(eid)s-update" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;edition&#39;, %(eid)s, &#39;manager&#39;, &#39;subject&#39;, &#39;manager-subject-%(eid)s&#39;, false, &#39;autolimited&#39;, &#39;edit_related&#39;);" title="click to edit this field"><img title="click to edit this field" src="http://testing.fr/cubicweb/data/pen_icon.png" alt="click to edit this field"/></div><div id="manager-subject-%(eid)s-delete" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;deleteconf&#39;, %(eid)s, &#39;manager&#39;, &#39;subject&#39;, &#39;manager-subject-%(eid)s&#39;, false, &#39;autolimited&#39;, &#39;delete&#39;);" title="click to delete this value"><img title="click to delete this value" src="http://testing.fr/cubicweb/data/cancel.png" alt="click to delete this value"/></div></div></div>""",
6283
c827fa795a6b [reledit] more api cleanup
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6246
diff changeset
   207
            'composite_card11_2ttypes': """&lt;not specified&gt;""",
9871
3d3aa4dd6a32 [reledit] Fix reledit icons jumpiness (closes #4106867)
Rémi Cardona <remi.cardona@logilab.fr>
parents: 8665
diff changeset
   208
            'concerns': """<div id="concerns-object-%(eid)s-reledit" onmouseout="jQuery('#concerns-object-%(eid)s').addClass('invisible')" onmouseover="jQuery('#concerns-object-%(eid)s').removeClass('invisible')" class="releditField"><div id="concerns-object-%(eid)s-value" class="editableFieldValue"><a href="http://testing.fr/cubicweb/ticket/%(tick)s" title="">write the code</a></div><div id="concerns-object-%(eid)s" class="editableField invisible"><div id="concerns-object-%(eid)s-update" class="editableField" onclick="cw.reledit.loadInlineEditionForm(&#39;base&#39;, %(eid)s, &#39;concerns&#39;, &#39;object&#39;, &#39;concerns-object-%(eid)s&#39;, false, &#39;autolimited&#39;, &#39;edit_rtype&#39;);" title="click to edit this field"><img title="click to edit this field" src="http://testing.fr/cubicweb/data/pen_icon.png" alt="click to edit this field"/></div></div></div>"""
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   209
            }
9652
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   210
        with self.admin_access.web_request() as req:
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   211
            proj = req.entity_from_eid(self.proj)
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   212
            for rschema, ttypes, role in proj.e_schema.relation_definitions(includefinal=True):
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   213
                if rschema not in reledit:
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   214
                    continue
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   215
                rtype = rschema.type
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   216
                self.assertMultiLineEqual(reledit[rtype] % {'eid': self.proj, 'toto': self.toto, 'tick': self.tick},
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   217
                                      proj.view('reledit', rtype=rtype, role=role),
59626567eade [web/test] port unittest_reledit to RepoAccess API
Julien Cristau <julien.cristau@logilab.fr>
parents: 8665
diff changeset
   218
                                      rtype)
6246
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   219
        reledit_ctrl.clear()
62e25fac41cd [views/reledit] refactor composite handling
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
   220
        reledit_ctrl._tagdefs.update(old_rctl)
6433
95c40961df21 [test] missing main
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6340
diff changeset
   221
95c40961df21 [test] missing main
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6340
diff changeset
   222
95c40961df21 [test] missing main
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6340
diff changeset
   223
if __name__ == '__main__':
95c40961df21 [test] missing main
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6340
diff changeset
   224
    from logilab.common.testlib import unittest_main
95c40961df21 [test] missing main
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 6340
diff changeset
   225
    unittest_main()