Beispiel #1
0
    def _build_query_prompts(self):
        prompts = []
        for prop in self.module.search_config.properties:
            text = Text(locale_id=id_strings.search_property_locale(
                self.module, prop.name))
            if prop.hint:
                display = Display(
                    text=text,
                    hint=Hint(text=Text(
                        locale_id=id_strings.search_property_hint_locale(
                            self.module, prop.name))))
            else:
                display = Display(text=text)

            kwargs = {'key': prop.name, 'display': display}
            if not prop.appearance or prop.itemset.nodeset:
                kwargs['receive'] = prop.receiver_expression
            if prop.appearance and self.app.enable_search_prompt_appearance:
                if prop.appearance == 'address':
                    kwargs['input_'] = prop.appearance
                else:
                    kwargs['appearance'] = prop.appearance
            if prop.input_:
                kwargs['input_'] = prop.input_
            if prop.default_value and self.app.enable_default_value_expression:
                kwargs['default_value'] = prop.default_value
            if prop.itemset.nodeset:
                kwargs['itemset'] = Itemset(
                    nodeset=prop.itemset.nodeset,
                    label_ref=prop.itemset.label,
                    value_ref=prop.itemset.value,
                    sort_ref=prop.itemset.sort,
                )
            prompts.append(QueryPrompt(**kwargs))
        return prompts
Beispiel #2
0
 def _build_query_prompts(self):
     prompts = []
     for prop in self.module.search_config.properties:
         kwargs = {
             'key': prop.name,
             'display': Display(text=Text(locale_id=id_strings.search_property_locale(self.module, prop.name))),
         }
         if prop.appearance and self.app.enable_search_prompt_appearance:
             kwargs['appearance'] = prop.appearance
         if prop.input_:
             kwargs['input_'] = prop.input_
         if prop.itemset.nodeset:
             kwargs['itemset'] = Itemset(
                 nodeset=prop.itemset.nodeset,
                 label_ref=prop.itemset.label,
                 value_ref=prop.itemset.value,
                 sort_ref=prop.itemset.sort,
             )
         prompts.append(QueryPrompt(**kwargs))
     return prompts