Example #1
0
 def _process(self):
     plugin = self.plugin
     form = None
     with plugin.plugin_context():
         if plugin.settings_form:
             defaults = FormDefaults(**plugin.settings.get_all())
             form = plugin.settings_form(obj=defaults)
             if form.validate_on_submit():
                 plugin.settings.set_multi(form.data)
                 flash(_('Settings saved ({0})').format(plugin.title), 'success')
                 return redirect_or_jsonify(request.url)
         return WPPlugins.render_template('details.html', plugin=plugin, form=form,
                                          back_url=url_for(self.back_button_endpoint))
Example #2
0
 def _process(self):
     plugin = self.plugin
     form = None
     with plugin.plugin_context():
         if plugin.settings_form:
             defaults = FormDefaults(**plugin.settings.get_all())
             form = plugin.settings_form(obj=defaults)
             if form.validate_on_submit():
                 plugin.settings.set_multi(form.data)
                 flash(_('Settings saved ({0})').format(plugin.title), 'success')
                 return redirect_or_jsonify(request.url)
         return WPPlugins.render_template('details.html', plugin=plugin, form=form,
                                          back_url=url_for(self.back_button_endpoint))
Example #3
0
    def _process(self):
        plugins = [p for p in plugin_engine.get_active_plugins().viewvalues()]
        categories = defaultdict(list)
        other = []
        for plugin in plugins:
            if plugin.category:
                categories[plugin.category].append(plugin)
            else:
                other.append(plugin)

        # Sort the plugins of each category in alphabetic order and in a way that the internal plugins are always
        # listed in the front
        for category in categories:
            categories[category].sort(key=attrgetter("configurable", "title"))
        ordered_categories = OrderedDict(sorted(categories.items()))
        if other:
            ordered_categories[PluginCategory.other] = other
        return WPPlugins.render_template("index.html", categorized_plugins=ordered_categories)
Example #4
0
    def _process(self):
        plugins = [p for p in plugin_engine.get_active_plugins().values()]
        categories = defaultdict(list)
        other = []
        for plugin in plugins:
            if plugin.category:
                categories[plugin.category].append(plugin)
            else:
                other.append(plugin)

        # Sort the plugins of each category in alphabetic order and in a way that the internal plugins are always
        # listed in the front
        for category in categories:
            categories[category].sort(key=attrgetter('configurable', 'title'))
        ordered_categories = dict(sorted(categories.items()))
        if other:
            ordered_categories[PluginCategory.other] = sorted(other, key=attrgetter('configurable', 'title'))
        return WPPlugins.render_template('index.html', categorized_plugins=ordered_categories)