]> git.agnieray.net Git - galette.git/commitdiff
Fix translation domain, fix icons display
authorJohan Cwiklinski <jcwiklinski@teclib.com>
Sat, 9 Nov 2019 07:08:45 +0000 (08:08 +0100)
committerJohan Cwiklinski <jcwiklinski@teclib.com>
Sat, 9 Nov 2019 07:08:45 +0000 (08:08 +0100)
Rework the tooltip content guess

galette/templates/default/ajouter_contribution.tpl
galette/webroot/js/common.js

index 90594ccd12717395fbb4ba6fb587133cc3abd59e..3f5b82e9dfe36830dd3d67bcd245a2ff8c1716c7 100644 (file)
             <p>{_T string="NB : The mandatory fields are in"} <span class="required">{_T string="red"}</span></p>
             <fieldset class="cssform">
                 <legend class="ui-state-active ui-corner-top">
-    {if $type eq {_T string="fee" domain="routes"}}
+    {if $type eq "fee"}
                     {_T string="Select contributor and membership fee type"}
-                    <a href="{path_for name="contribution" data=["type" => {_T string="fee" domain="routes"}, "action" => {_T string="add" domain="routes"}]}?trans_id={$transaction->id}" class="button notext fright" id="btnadd" title="{_T string="Create a new fee that will be attached to the current transaction"}">{_T string="New attached fee"}</a>
     {else}
-        {_T string="Select contributor and donation type"}
-
-                    <a href="{path_for name="contribution" data=["type" => {_T string="donation" domain="routes"}, "action" => {_T string="add" domain="routes"}]}?trans_id={$transaction->id}" class="button notext fright" id="btnadddon" title="{_T string="Create a new donation that will be attached to the current transaction"}">{_T string="New attached donation"}</a>
+                    {_T string="Select contributor and donation type"}
+    {/if}
+    {if $contribution->id && $contribution->transaction->getMissingAmount() > 0}
+                    <a
+                        href="{path_for name="contribution" data=["type" => "fee", "action" => "add"]}?trans_id={$contribution->transaction->id}"
+                        class="button fright tooltip"
+                        title="{_T string="Create a new fee that will be attached to the current transaction"}">
+                        <i class="fas fa-user-check"></i>
+                        <span class="sr-only">{_T string="New attached fee"}</span>
+                    </a>
+                    <a
+                        href="{path_for name="contribution" data=["type" => "donation", "action" => "add"]}?trans_id={$contribution->transaction->id}"
+                        class="button fright tooltip"
+                        title="{_T string="Create a new donation that will be attached to the current transaction"}">
+                        <i class="fas fa-gift"></i>
+                        <span class="sr-only">{_T string="New attached donation"}</span>
+                    </a>
     {/if}
 </legend>
                 <p>
index 8666015cc21799c52268a9045baf921974c8ef1e..c93d2ae4dae49cbcc7641d15f0d8076d979c61a2 100644 (file)
@@ -157,17 +157,32 @@ var _initTooltips = function(selector) {
         items: selector + ".tooltip, a[title]",
         content: function(event, ui) {
             var _this = $(this);
+            var _content;
 
+            //first, value from @class=tip element
             var _next = _this.nextAll('.tip');
-            if (_next.length == 0) {
-                _next = _this.find('.sr-only');
+            if (_next.length > 0) {
+                _content = _next.html();
             }
 
-            if (_next.length == 0) {
-                return _this.attr('title');
-            } else {
-                return _next.html();
+            //second, value from @title
+            if (typeof _content == 'undefined') {
+                var _title = _this.attr('title');
+                if (typeof _title != 'undefined') {
+                    _content = _title;
+                }
+            }
+
+            //and finally, value from @class=sr-only element
+            if (typeof _content == 'undefined') {
+                var _sronly = _this.find('.sr-only');
+                console.log(_sronly);
+                if (_sronly.length > 0) {
+                    _content = _sronly.html();
+                }
             }
+
+            return _content;
         }
     });
 }