示例#1
0
def admin_settings():
    available_themes = [
        x.identifier for x in get_themes_list() if x.identifier != 'admin']
    settings = Setting.all()
    for setting in settings:
        if setting.name == 'blog-theme':
            setting.allowed = json.dumps(available_themes)
    return render_admin('settings.html', settings=settings)
示例#2
0
def get_available_themes():
    """Returns a list that contains all available themes. The items in the
    list are tuples where the first item of the tuple is the identifier and
    the second one the name of the theme.
    For example::

        [('aurora_mod', 'Aurora Mod')]
    """
    return [(theme.identifier, theme.name) for theme in get_themes_list()]
示例#3
0
文件: helpers.py 项目: eirnym/flaskbb
def get_available_themes():
    """Returns a list that contains all available themes. The items in the
    list are tuples where the first item of the tuple is the identifier and
    the second one the name of the theme.
    For example::

        [('aurora_mod', 'Aurora Mod')]
    """
    return [(theme.identifier, theme.name) for theme in get_themes_list()]
示例#4
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)
示例#5
0
 def test_151_load_themes(self):
     app = self.app
     themes = get_themes_list()
     themes_names = [ t.name for t in themes ]
     print "themes_names %s" % themes_names
     self.assertTrue('Admin' in themes_names)
     self.assertTrue('Bootstrap3' in themes_names)
     self.assertTrue('Bootstrap2' in themes_names)
     themes_identifiers = [ t.identifier for t in themes ]
     self.assertTrue('admin' in themes_identifiers)
     self.assertTrue('bootstrap3' in themes_identifiers)
     self.assertTrue('bootstrap2' in themes_identifiers)
示例#6
0
def admin_pages_add():
    content = Content()
    content.published_on = datetime.now()
    content.body = ''
    content.title = ''
    content.tags = ''
    content.parser = 'markdown'
    content.theme = g.theme
    content.type = 'page'
    content.user = g.user
    content.user_id = g.user.id
    themes = [t.identifier for t in get_themes_list() if t.identifier != 'admin']
    print(themes)
    return render_admin('content.html', user=g.user, content_type="Page",
                        action="Add", content=content, themes=themes)
示例#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)
示例#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
        )
示例#9
0
文件: views.py 项目: marvinwu/flaskbb
def settings():
    form = GeneralSettingsForm()

    form.theme.choices = [(theme.identifier, theme.name)
                          for theme in get_themes_list()]

    form.language.choices = [(locale.language, locale.display_name)
                             for locale in babel.list_translations()]

    if form.validate_on_submit():
        current_user.theme = form.theme.data
        current_user.language = form.language.data
        current_user.save()

        flash(_("Settings updated."), "success")
    else:
        form.theme.data = current_user.theme
        form.theme.data = current_user.language

    return render_template("user/general_settings.html", form=form)
示例#10
0
文件: views.py 项目: PPPython/flaskbb
def settings():
    form = GeneralSettingsForm()

    form.theme.choices = [(theme.identifier, theme.name)
                          for theme in get_themes_list()]

    form.language.choices = [(locale.language, locale.display_name)
                             for locale in babel.list_translations()]

    if form.validate_on_submit():
        current_user.theme = form.theme.data
        current_user.language = form.language.data
        current_user.save()

        flash(_("Settings updated."), "success")
    else:
        form.theme.data = current_user.theme
        form.language.data = current_user.language

    return render_template("user/general_settings.html", form=form)
示例#11
0
def available_themes():
    return [(theme.identifier, theme.name) for theme in get_themes_list()]
示例#12
0
def available_themes():
    return [(theme.identifier, theme.name) for theme in get_themes_list()]
示例#13
0
def admin_pages_edit(content_id):
    content = Content.get(content_id)
    themes = [t.identifier for t in get_themes_list() if t.identifier != 'admin']
    return render_admin('content.html', user=g.user, content_type=content.type,
                        action="Edit", content=content, themes=themes)