コード例 #1
0
ファイル: forms.py プロジェクト: taylordowns2000/commcare-hq
 def section_general(self):
     fields = [
         hqcrispy.B3MultiField(
             _("Default SMS Response"),
             crispy.Div(InlineField(
                 "use_default_sms_response",
                 data_bind="value: use_default_sms_response",
             ),
                        css_class='col-sm-4'),
             crispy.Div(InlineField(
                 "default_sms_response",
                 css_class="input-xxlarge",
                 placeholder=_("Enter Default Response"),
                 data_bind="visible: showDefaultSMSResponse",
             ),
                        css_class='col-sm-8'),
             help_bubble_text=_(
                 "Enable this option to provide a "
                 "default response when a user's incoming SMS does not "
                 "answer an open survey or match a known keyword."),
             css_id="default-sms-response-group",
             field_class='col-sm-6 col-md-9 col-lg-9'),
         hqcrispy.FieldWithHelpBubble(
             "use_restricted_sms_times",
             data_bind="value: use_restricted_sms_times",
             help_bubble_text=_(
                 "Use this option to limit the times "
                 "that SMS messages can be sent to users. Messages that "
                 "are sent outside these windows will remained queued "
                 "and will go out as soon as another window opens up."),
         ),
         hqcrispy.B3MultiField(
             "",
             hqcrispy.HiddenFieldWithErrors(
                 "restricted_sms_times_json",
                 data_bind="value: restricted_sms_times_json"),
             crispy.Div(data_bind="template: {"
                        " name: 'ko-template-restricted-sms-times', "
                        " data: $data"
                        "}", ),
             data_bind="visible: showRestrictedSMSTimes",
             field_class='col-md-10 col-lg-10'),
         hqcrispy.FieldWithHelpBubble(
             "send_to_duplicated_case_numbers",
             help_bubble_text=_(
                 "Enabling this option will send "
                 "outgoing-only messages to phone numbers registered "
                 "with more than one mobile worker or case. SMS surveys "
                 "and keywords will still only work for unique phone "
                 "numbers in your project."),
         ),
         hqcrispy.FieldWithHelpBubble(
             'sms_survey_date_format',
             help_bubble_text=_("Choose the format in which date questions "
                                "should be answered in SMS surveys."),
         ),
     ]
     return crispy.Fieldset(_("General Settings"), *fields)
コード例 #2
0
 def section_chat(self):
     fields = [
         hqcrispy.B3MultiField(
             _("Case Name Display"),
             crispy.Div(InlineField(
                 "use_custom_case_username",
                 data_bind="value: use_custom_case_username",
             ),
                        css_class='col-sm-4'),
             crispy.Div(InlineField(
                 "custom_case_username",
                 css_class="input-large",
                 data_bind="visible: showCustomCaseUsername",
             ),
                        css_class='col-sm-8'),
             help_bubble_text=_(
                 "By default, when chatting with a case, "
                 "the chat window will use the case's \"name\" case "
                 "property when displaying the case's name. To use a "
                 "different case property, specify it here."),
             css_id="custom-case-username-group",
             field_class='col-sm-6 col-md-9 col-lg-9'),
         hqcrispy.B3MultiField(
             _("Message Counter"),
             crispy.Div(InlineField(
                 "use_custom_message_count_threshold",
                 data_bind="value: use_custom_message_count_threshold",
             ),
                        css_class='col-sm-4'),
             crispy.Div(InlineField(
                 "custom_message_count_threshold",
                 css_class="input-large",
                 data_bind="visible: showCustomMessageCountThreshold",
             ),
                        css_class='col-sm-8'),
             help_bubble_text=_(
                 "The chat window can use a counter to keep "
                 "track of how many messages are being sent and received "
                 "and highlight that number after a certain threshold is "
                 "reached. By default, the counter is disabled. To enable "
                 "it, enter the desired threshold here."),
             css_id="custom-message-count-threshold-group",
             field_class='col-sm-6 col-md-9 col-lg-9'),
         hqcrispy.FieldWithHelpBubble(
             "use_sms_conversation_times",
             help_bubble_text=_(
                 "When this option is enabled, the system "
                 "will not send automated SMS to chat recipients when "
                 "those recipients are in the middle of a conversation."),
         ),
         hqcrispy.B3MultiField(
             "",
             hqcrispy.HiddenFieldWithErrors(
                 "sms_conversation_times_json",
                 data_bind="value: sms_conversation_times_json"),
             crispy.Div(data_bind="template: {"
                        " name: 'ko-template-sms-conversation-times', "
                        " data: $data"
                        "}", ),
             data_bind="visible: showSMSConversationTimes",
             label_class='hide',
             field_class='col-md-12 col-lg-10'),
         crispy.Div(
             hqcrispy.FieldWithHelpBubble(
                 "sms_conversation_length",
                 help_bubble_text=_(
                     "The number of minutes to wait "
                     "after receiving an incoming SMS from a chat "
                     "recipient before resuming automated SMS to that "
                     "recipient."),
             ),
             data_bind="visible: showSMSConversationTimes",
         ),
         hqcrispy.FieldWithHelpBubble(
             "survey_traffic_option",
             help_bubble_text=_(
                 "This option allows you to hide a chat "
                 "recipient's survey questions and responses from chat "
                 "windows. There is also the option to show only invalid "
                 "responses to questions in the chat window, which could "
                 "be attempts to converse."),
         ),
         hqcrispy.FieldWithHelpBubble(
             "count_messages_as_read_by_anyone",
             help_bubble_text=_(
                 "The chat window will mark unread "
                 "messages to the user viewing them. Use this option to "
                 "control whether a message counts as being read if it "
                 "is read by anyone, or if it counts as being read only "
                 "to the user who reads it."),
         ),
     ]
     return crispy.Fieldset(_("Chat Settings"), *fields)