Projet

Général

Profil

0001-workflow-better-target-mode-id-display-51245.patch

Lauréline Guérin, 26 février 2021 11:27

Télécharger (3,33 ko)

Voir les différences:

Subject: [PATCH] workflow: better target mode/id display (#51245)

 wcs/wf/edit_carddata.py     |  4 +++-
 wcs/wf/external_workflow.py | 15 ++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)
wcs/wf/edit_carddata.py
14 14
# You should have received a copy of the GNU General Public License
15 15
# along with this program; if not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from ..qommon import _
17
from wcs.qommon import _, N_
18 18
from quixote import get_publisher
19 19

  
20 20
from wcs.workflows import register_item_class
......
28 28
    key = 'edit_carddata'
29 29
    mappings_label = _('Mappings to card fields')
30 30
    accept_empty_value = True
31
    automatic_targetting = N_('Action on linked cards')
32
    manual_targetting = N_('Specify the identifier of the card on which the action will be applied')
31 33

  
32 34
    @classmethod
33 35
    def is_available(cls, workflow=None):
wcs/wf/external_workflow.py
16 16

  
17 17
from quixote import get_publisher
18 18

  
19
from wcs.qommon import _
20
from wcs.qommon.form import Form, SingleSelectWidget, ComputedExpressionWidget
19
from wcs.qommon import _, N_
20
from wcs.qommon.form import Form, SingleSelectWidget, ComputedExpressionWidget, RadiobuttonsWidget
21 21

  
22 22
from wcs.workflows import WorkflowStatusItem, perform_items, register_item_class
23 23
from wcs.workflows import WorkflowGlobalActionWebserviceTrigger, Workflow
......
30 30
    description = _('External workflow')
31 31
    key = 'external_workflow_global_action'
32 32
    category = 'formdata-action'
33
    automatic_targetting = N_('Action on linked cards/forms')
34
    manual_targetting = N_('Specify the identifier of the card/form on which the action will be applied')
33 35

  
34 36
    slug = None
35 37
    target_mode = None
......
94 96
            )
95 97

  
96 98
        if 'target_mode' in parameters:
97
            target_modes = [('all', _('Automatic'), 'all'), ('manual', _('Manual'), 'manual')]
99
            target_modes = [
100
                ('all', _(self.automatic_targetting), 'all'),
101
                ('manual', _(self.manual_targetting), 'manual'),
102
            ]
98 103
            form.add(
99
                SingleSelectWidget,
104
                RadiobuttonsWidget,
100 105
                '%starget_mode' % prefix,
101 106
                title=_('Targeting'),
102 107
                value=self.target_mode or 'all',
......
184 189
        yield from formdata.iter_target_datas(objectdef=objectdef, object_type=self.slug, status_item=self)
185 190

  
186 191
    def get_parameters(self):
187
        return ('slug', 'target_mode', 'target_id', 'trigger_id', 'condition')
192
        return ('slug', 'trigger_id', 'target_mode', 'target_id', 'condition')
188 193

  
189 194
    def perform(self, formdata):
190 195
        objectdef = self.get_object_def()
191
-