Esempio n. 1
0
    def odm_ui_browser_setup(self, browser: _odm_ui.Browser):
        """Hook.
        """
        super().odm_ui_browser_setup(browser)

        browser.default_sort_field = 'weight'
        browser.default_sort_order = _odm.I_DESC
Esempio n. 2
0
    def odm_ui_browser_setup(self, browser: odm_ui.Browser):
        super().odm_ui_browser_setup(browser)

        browser.default_sort_field = 'title'
        browser.insert_data_field('district', 'geo@district')
        browser.insert_data_field('city', 'geo@city')
        browser.insert_data_field('province', 'geo@province')
        browser.insert_data_field('country', 'geo@country')
Esempio n. 3
0
    def odm_ui_browser_setup(self, browser: odm_ui.Browser):
        """Hook
        """
        super().odm_ui_browser_setup(browser)

        # Section
        if self.has_field('section'):
            browser.insert_data_field('section', 'article@section')

        # Starred
        if self.has_field('starred') and auth.get_current_user().has_permission('article@set_starred.' + browser.model):
            browser.insert_data_field('starred', 'article@starred')
Esempio n. 4
0
    def odm_ui_browser_setup(self, browser: odm_ui.Browser):
        """Hook
        """
        data_fields = [
            ('title', 'taxonomy@title'),
        ]

        if self.has_field('alias'):
            data_fields.append(('alias', 'taxonomy@alias'))

        if self.has_field('weight'):
            data_fields.append(('weight', 'taxonomy@weight'))

        browser.data_fields = data_fields
        browser.default_sort_order = odm.I_ASC

        if self.has_field('order'):
            browser.default_sort_field = 'order'
        elif self.has_field('weight'):
            browser.default_sort_field = 'weight'
        else:
            browser.default_sort_field = 'title'
Esempio n. 5
0
    def odm_ui_browser_setup(self, browser: odm_ui.Browser):
        super().odm_ui_browser_setup(browser)

        browser.insert_data_field('path', 'menu@path')
        browser.insert_data_field('enabled', 'menu@enabled')
Esempio n. 6
0
    def odm_ui_browser_setup(self, browser: odm_ui.Browser):
        super().odm_ui_browser_setup(browser)

        browser.default_sort_field = 'title'
        browser.insert_data_field('country', 'geo@country')
Esempio n. 7
0
    def odm_ui_browser_setup(self, browser: odm_ui.Browser):
        """Hook
        """
        browser.default_sort_field = '_modified'

        # Sort field
        if self.has_field('publish_time'):
            browser.default_sort_field = 'publish_time'
            browser.default_sort_order = 'desc'

        # Title
        if self.has_field('title'):
            browser.insert_data_field('title', 'content@title')

        # Status
        if self.has_field('status'):
            browser.insert_data_field('status', 'content@status')

        # Images
        if self.has_field('images'):
            browser.insert_data_field('images', 'content@images')

        # Author (visible only if current user has permission to modify any entity)
        if self.has_field('author') and self.odm_auth_check_model_permissions(self.model, PERM_MODIFY):
            browser.insert_data_field('author', 'content@author')

        # Publish time
        if self.has_field('publish_time'):
            browser.insert_data_field('publish_time', 'content@publish_time')