changeset 8f3cb498a49e in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=8f3cb498a49e
description:
        Add icon of type URL

        issue10140
        review355171002
diffstat:

 CHANGELOG                  |   1 +
 doc/topics/views/index.rst |  22 ++++++++++++++++++----
 trytond/ir/ui/form.rnc     |   2 ++
 trytond/ir/ui/form.rng     |  17 +++++++++++++++++
 trytond/ir/ui/tree.rnc     |   2 ++
 trytond/ir/ui/tree.rng     |  19 +++++++++++++++++++
 6 files changed, 59 insertions(+), 4 deletions(-)

diffs (132 lines):

diff -r 3618ad48af99 -r 8f3cb498a49e CHANGELOG
--- a/CHANGELOG Sat Mar 20 12:33:09 2021 +0100
+++ b/CHANGELOG Sat Mar 20 12:38:16 2021 +0100
@@ -1,3 +1,4 @@
+* Add URL type to icon
 * Use instance method to get next sequence value
 * Store the sequence type directly on sequence
 * Allow sending email with record's attachments
diff -r 3618ad48af99 -r 8f3cb498a49e doc/topics/views/index.rst
--- a/doc/topics/views/index.rst        Sat Mar 20 12:33:09 2021 +0100
+++ b/doc/topics/views/index.rst        Sat Mar 20 12:38:16 2021 +0100
@@ -296,13 +296,21 @@
 
     * ``help_field``: see in common-attributes-help_field_.
 
+.. _form-image:
+
 image
 ^^^^^
 
 Display an image.
 
-    * ``name``: the image name or the field name which contains the image name.
-      The image name must be the name of a record of ``ir.ui.icon``.
+    * ``type``: the type of image source. Available values are ``icon`` or
+      ``url``. The default value is ``icon``.
+
+    * ``name``: The image name or the field name which contains the image name.
+      For the ``icon`` type it must be the name of a record of ``ir.ui.icon``.
+      For the ``url`` type it must be the URL. It can be relative to the 
server.
+
+    * ``url_size``: the name of the size parameter to add to the URL.
 
     * ``yexpand``: see in common-attributes-yexpand_.
 
@@ -628,8 +636,14 @@
 
     * ``name``: The name of the field whose value will be displayed.
 
-    * ``icon``: The name of the field that contains the name of the icon to
-      display or the name of the icon.
+    * ``icon``: The image name or the field name which contains the image name.
+      For the ``icon`` type it must be the name of a record of ``ir.ui.icon``.
+      For the ``url`` type it must be the URL. It can be relative to the 
server.
+
+    * ``icon_type``: the type of icon source. Available values are ``icon`` or
+      ``url``. The default value is ``icon``.
+
+    * ``url_size``: the name of the size parameter to add to the URL.
 
 button
 ^^^^^^
diff -r 3618ad48af99 -r 8f3cb498a49e trytond/ir/ui/form.rnc
--- a/trytond/ir/ui/form.rnc    Sat Mar 20 12:33:09 2021 +0100
+++ b/trytond/ir/ui/form.rnc    Sat Mar 20 12:38:16 2021 +0100
@@ -111,6 +111,8 @@
 attlist.field &= attribute symbol { text }?
 image = element image { attlist.image, empty }
 attlist.image &= attribute name { text }
+attlist.image &= [a:defaultValue = "icon"] attribute type { "icon" | "url" }
+attlist.affix &= attribute url_size { text }?
 attlist.image &= [ a:defaultValue = "1" ] attribute colspan { text }?
 attlist.image &=
   [ a:defaultValue = "0" ] attribute yexpand { "0" | "1" }?
diff -r 3618ad48af99 -r 8f3cb498a49e trytond/ir/ui/form.rng
--- a/trytond/ir/ui/form.rng    Sat Mar 20 12:33:09 2021 +0100
+++ b/trytond/ir/ui/form.rng    Sat Mar 20 12:38:16 2021 +0100
@@ -506,6 +506,23 @@
     </attribute>
   </define>
   <define name="attlist.image" combine="interleave">
+    <attribute a:defaultValue="icon">
+      <name ns="">type</name>
+      <choice>
+        <value>icon</value>
+        <value>url</value>
+      </choice>
+    </attribute>
+  </define>
+  <define name="attlist.affix" combine="interleave">
+    <optional>
+      <attribute>
+        <name ns="">url_size</name>
+        <text/>
+      </attribute>
+    </optional>
+  </define>
+  <define name="attlist.image" combine="interleave">
     <optional>
       <attribute a:defaultValue="1">
         <name ns="">colspan</name>
diff -r 3618ad48af99 -r 8f3cb498a49e trytond/ir/ui/tree.rnc
--- a/trytond/ir/ui/tree.rnc    Sat Mar 20 12:33:09 2021 +0100
+++ b/trytond/ir/ui/tree.rnc    Sat Mar 20 12:38:16 2021 +0100
@@ -71,6 +71,8 @@
 attlist.affix &= attribute string { text }?
 attlist.affix &= ( attribute name { text } | attribute id { text } )
 attlist.affix &= attribute icon { text }?
+attlist.affix &= [a:defaultValue = "icon"] attribute icon_type { "icon" | 
"url" }?
+attlist.affix &= attribute url_size { text }?
 button = element button { attlist.button, empty }
 attlist.button &= attribute help { text }?
 attlist.button &= attribute string { text }?
diff -r 3618ad48af99 -r 8f3cb498a49e trytond/ir/ui/tree.rng
--- a/trytond/ir/ui/tree.rng    Sat Mar 20 12:33:09 2021 +0100
+++ b/trytond/ir/ui/tree.rng    Sat Mar 20 12:38:16 2021 +0100
@@ -314,6 +314,25 @@
       </attribute>
     </optional>
   </define>
+  <define name="attlist.affix" combine="interleave">
+    <optional>
+      <attribute a:defaultValue="icon">
+        <name ns="">icon_type</name>
+        <choice>
+          <value>icon</value>
+          <value>url</value>
+        </choice>
+      </attribute>
+    </optional>
+  </define>
+  <define name="attlist.affix" combine="interleave">
+    <optional>
+      <attribute>
+        <name ns="">url_size</name>
+        <text/>
+      </attribute>
+    </optional>
+  </define>
   <define name="button">
     <element>
       <name ns="">button</name>

Reply via email to