Beispiel #1
0
    def group_wikis_in_accordion(wikis, wikis_category, wiki_category_descp):

        wikis_options = [{
            'label': wiki['name'],
            'value': wiki['url']
        } for wiki in wikis]

        return gdc.Accordion(
            id=generate_wikis_accordion_id(wikis_category) + '-accordion',
            className='aside-category',
            label=wikis_category,
            itemClassName='metric-category-label',
            childrenClassName='metric-category-list',
            accordionFixedWidth='300',
            defaultCollapsed=False if wikis else True,
            children=[
                html.Strong(wiki_category_descp, style={'fontSize': '14px'}),
                dcc.Checklist(id=generate_wikis_accordion_id(wikis_category),
                              className='aside-checklist-category',
                              options=wikis_options,
                              values=[],
                              labelClassName='aside-checklist-option',
                              labelStyle={'display': 'block'})
            ],
            style={'display': 'flex'})
Beispiel #2
0
    def group_wikis_in_accordion(wikis, wikis_category, wiki_category_descp,
                                 selected_wikis_value):

        wikis_options = [{
            'label': wiki['name'],
            'value': wiki['url']
        } for wiki in wikis]

        # add pre-selected wikis (likely, from url query string),
        # if any, to the accordion which is going to be created.
        if selected_wikis_value:
            wikis_values_checklist = list(
                set(selected_wikis_value) & set(map(lambda w: w['url'], wikis))
            )  # take values (url) of pre-selected wikis for this wiki category
        else:
            wikis_values_checklist = []

        return gdc.Accordion(
            id=generate_wikis_accordion_id(wikis_category) + '-accordion',
            className='aside-category',
            label=wikis_category,
            itemClassName='metric-category-label',
            childrenClassName='metric-category-list',
            accordionFixedWidth='300',
            defaultCollapsed=False if wikis else True,
            children=[
                html.Strong(wiki_category_descp, style={'fontSize': '14px'}),
                dcc.Checklist(id=generate_wikis_accordion_id(wikis_category),
                              className='aside-checklist-category',
                              options=wikis_options,
                              values=wikis_values_checklist,
                              labelClassName='aside-checklist-option',
                              labelStyle={'display': 'block'})
            ],
            style={'display': 'flex'})
Beispiel #3
0
    def group_metrics_in_accordion(metrics, metric_category,
                                   selected_metrics_value):
        metrics_options = [{
            'label': metric.text,
            'value': metric.code
        } for metric in metrics]

        # add pre-selected metrics (likely, from url query string),
        # if any, to the accordion which is going to be created.
        if selected_metrics_value:
            metrics_values_checklist = list(
                set(selected_metrics_value)
                & set(map(lambda m: m.code, metrics))
            )  # take values of pre-selected wikis for this wiki category
        else:
            metrics_values_checklist = []

        metrics_help = [
            html.Div(
                children=html.I(className="fa fa-info-circle checklist-info"),
                className='one column aside-checklist-option',
                style={'marginLeft': 'auto'},
                title=metric.descp) for metric in metrics
        ]

        metrics_help_div = html.Div(
            children=metrics_help,
            className='one-column aside-checklist-category')

        return gdc.Accordion(
            id=generate_metrics_accordion_id(metric_category.name) +
            '-accordion',
            className='aside-category',
            label=metric_category.value,
            itemClassName='metric-category-label',
            childrenClassName='metric-category-list',
            accordionFixedWidth='300',
            defaultCollapsed=False if metrics_values_checklist else True,
            children=html.Div([
                dcc.Checklist(
                    id=generate_metrics_accordion_id(metric_category.name),
                    className='aside-checklist-category eleven columns',
                    options=metrics_options,
                    values=metrics_values_checklist,
                    labelClassName='aside-checklist-option',
                    labelStyle={'display': 'block'}), metrics_help_div
            ],
                              className='row'),
            style={'display': 'flex'})
Beispiel #4
0
    def group_metrics_in_accordion(metrics, metric_category):

        metrics_options = [{
            'label': metric.text,
            'value': metric.code
        } for metric in metrics]
        metrics_help = [
            html.Div(
                children=html.I(className="fa fa-info-circle checklist-info"),
                className='one column aside-checklist-option',
                style={'marginLeft': 'auto'},
                title=metric.descp) for metric in metrics
        ]

        metrics_help_div = html.Div(
            children=metrics_help,
            className='one-column aside-checklist-category')

        return gdc.Accordion(
            id=generate_metrics_accordion_id(metric_category.name) +
            '-accordion',
            className='aside-category',
            label=metric_category.value,
            itemClassName='metric-category-label',
            childrenClassName='metric-category-list',
            accordionFixedWidth='300',
            defaultCollapsed=True,
            children=html.Div([
                dcc.Checklist(
                    id=generate_metrics_accordion_id(metric_category.name),
                    className='aside-checklist-category eleven columns',
                    options=metrics_options,
                    values=[],
                    labelClassName='aside-checklist-option',
                    labelStyle={'display': 'block'}), metrics_help_div
            ],
                              className='row'),
            style={'display': 'flex'})