コード例 #1
0
        def derive_formax_sections(self, formax, context):
            def add_section(name, url, icon):
                formax.add_section(name,
                                   reverse(url),
                                   icon=icon,
                                   action='redirect',
                                   button=_('Create Trigger'))

            org_schemes = self.org.get_schemes(RECEIVE)
            add_section('trigger-keyword', 'triggers.trigger_keyword',
                        'icon-tree')
            add_section('trigger-register', 'triggers.trigger_register',
                        'icon-users-2')
            add_section('trigger-schedule', 'triggers.trigger_schedule',
                        'icon-clock')

            # if we can answer calls, show the inbound trigger option
            if self.org.get_schemes(ANSWER):
                add_section('trigger-inboundcall',
                            'triggers.trigger_inbound_call', 'icon-phone2')

            add_section('trigger-missedcall', 'triggers.trigger_missed_call',
                        'icon-phone')
            add_section('trigger-catchall', 'triggers.trigger_catchall',
                        'icon-bubble')

            if URN_SCHEMES_SUPPORTING_FOLLOW.intersection(org_schemes):
                add_section('trigger-follow', 'triggers.trigger_follow',
                            'icon-user-restore')
コード例 #2
0
ファイル: views.py プロジェクト: daffyfeng/rapidpro
        def derive_formax_sections(self, formax, context):
            def add_section(name, url, icon):
                formax.add_section(name, reverse(url), icon=icon, action='redirect', button=_('Create Trigger'))

            org_schemes = self.org.get_schemes(RECEIVE)
            add_section('trigger-keyword', 'triggers.trigger_keyword', 'icon-tree')
            add_section('trigger-register', 'triggers.trigger_register', 'icon-users-2')
            add_section('trigger-schedule', 'triggers.trigger_schedule', 'icon-clock')

            # if we can answer calls, show the inbound trigger option
            if self.org.get_schemes(ANSWER):
                add_section('trigger-inboundcall', 'triggers.trigger_inbound_call', 'icon-phone2')

            add_section('trigger-missedcall', 'triggers.trigger_missed_call', 'icon-phone')
            add_section('trigger-catchall', 'triggers.trigger_catchall', 'icon-bubble')

            if URN_SCHEMES_SUPPORTING_FOLLOW.intersection(org_schemes):
                add_section('trigger-follow', 'triggers.trigger_follow', 'icon-user-restore')