Ejemplo n.º 1
0
def render_admin(template, **context):
    context['bootstrap_theme'] = context.get('bootstrap_theme', get_setting('bootstrap-theme', 'yeti'))
    context['syntax_highlighting_theme'] = context.get('syntax_highlighting_theme', get_setting('syntax-highlighting-theme', 'monokai.css'))
    context['blog_title'] = context.get('blog_title', get_setting('blog-title', 'Blog Title'))
    context['blog_copyright'] = context.get('blog_copyright', get_setting('blog-copyright', 'Blog Copyright'))
    context['freeze'] = context.get('freeze')
    return render_theme_template(get_theme('admin'), template, **context)
Ejemplo n.º 2
0
def render(template, **context):
    '''
    Render a template with uData frontend specifics

        * Theme
    '''
    theme = current_app.config['THEME']
    return render_theme_template(get_theme(theme), template, **context)
Ejemplo n.º 3
0
def render(template, **context):
    '''
    Render a template with uData frontend specifics

        * Theme
    '''
    theme = current_app.config['THEME']
    return render_theme_template(get_theme(theme), template, **context)
Ejemplo n.º 4
0
def remove_theme(theme_identifier, force):
    """Removes a theme from the filesystem."""
    validate_theme(theme_identifier)
    if not force and not \
            click.confirm(click.style("Are you sure?", fg="magenta")):
        sys.exit(0)

    theme = get_theme(theme_identifier)
    click.secho("[+] Removing theme from filesystem...", fg="cyan")
    shutil.rmtree(theme.path, ignore_errors=False, onerror=None)
Ejemplo n.º 5
0
def remove_theme(theme_identifier, force):
    """Removes a theme from the filesystem."""
    validate_theme(theme_identifier)
    if not force and not \
            click.confirm(click.style("Are you sure?", fg="magenta")):
        sys.exit(0)

    theme = get_theme(theme_identifier)
    click.secho("[+] Removing theme from filesystem...", fg="cyan")
    shutil.rmtree(theme.path, ignore_errors=False, onerror=None)
Ejemplo n.º 6
0
def get_current_theme():
    # if g.user is not None:
    # 	ident = g.user.theme
    # else:
    # 	ident = current_app.config.get('DEFAULT_THEME', 'plain')
    themes = get_themes_list()
    print 'here'
    print themes
    theme = app.config['HOMEPAGE_THEME']
    return get_theme(theme)
Ejemplo n.º 7
0
def list_themes():
    """Lists all installed themes."""
    click.secho("[+] Listing all installed themes...", fg="cyan")

    active_theme = get_theme(flaskbb_config['DEFAULT_THEME'])
    available_themes = set(get_themes_list()) - set([active_theme])

    click.secho("[+] Active Theme:", fg="blue", bold=True)
    click.secho("    - {} (version {})".format(active_theme.name,
                                               active_theme.version),
                bold=True)

    click.secho("[+] Available Themes:", fg="yellow", bold=True)
    for theme in available_themes:
        click.secho("    - {} (version {})".format(theme.name, theme.version),
                    bold=True)
Ejemplo n.º 8
0
def list_themes():
    """Lists all installed themes."""
    click.secho("[+] Listing all installed themes...", fg="cyan")

    active_theme = get_theme(flaskbb_config['DEFAULT_THEME'])
    available_themes = set(get_themes_list()) - set([active_theme])

    click.secho("[+] Active Theme:", fg="blue", bold=True)
    click.secho("    - {} (version {})".format(
        active_theme.name, active_theme.version), bold=True
    )

    click.secho("[+] Available Themes:", fg="yellow", bold=True)
    for theme in available_themes:
        click.secho("    - {} (version {})".format(
            theme.name, theme.version), bold=True
        )
Ejemplo n.º 9
0
def validate_theme(theme):
    """Checks if a theme is installed."""
    try:
        get_theme(theme)
    except KeyError:
        raise FlaskBBCLIError("Theme {} not found.".format(theme), fg="red")
Ejemplo n.º 10
0
def get_current_theme():
    theme = current_app.config['THEME']
    return get_theme(theme)
Ejemplo n.º 11
0
def validate_theme(theme):
    """Checks if a theme is installed."""
    try:
        get_theme(theme)
    except KeyError:
        raise FlaskBBCLIError("Theme {} not found.".format(theme), fg="red")
Ejemplo n.º 12
0
def get_current_theme():
    ident = get_setting('blog-theme', 'impression')
    return get_theme(ident)