示例#1
0
 def _process_conference(self):
     form = ConferenceLayoutForm(obj=self._get_form_defaults(), event=self.event)
     css_form = CSSForm()
     logo_form = LogoForm()
     tt_theme_settings_form = _make_theme_settings_form(self.event, form.timetable_theme.data)
     tt_form_valid = tt_theme_settings_form.validate_on_submit() if tt_theme_settings_form else True
     if form.validate_on_submit() and tt_form_valid:
         if tt_theme_settings_form:
             layout_settings.set(self.event, 'timetable_theme_settings', tt_theme_settings_form.data)
         else:
             layout_settings.delete(self.event, 'timetable_theme_settings')
         data = {unicode(key): value for key, value in form.data.iteritems() if key in layout_settings.defaults}
         layout_settings.set_multi(self.event, data)
         if form.theme.data == '_custom':
             layout_settings.set(self.event, 'use_custom_css', True)
         flash(_('Settings saved'), 'success')
         return redirect(url_for('.index', self.event))
     else:
         if self.event.logo_metadata:
             logo_form.logo.data = self.event
         if self.event.has_stylesheet:
             css_form.css_file.data = self.event
     return WPLayoutEdit.render_template('layout_conference.html', self.event, form=form,
                                         logo_form=logo_form, css_form=css_form,
                                         timetable_theme_settings_form=tt_theme_settings_form)
示例#2
0
    def _process_conference(self):
        form = ConferenceLayoutForm(obj=self._get_form_defaults(),
                                    event=self.event_new)
        css_form = CSSForm()
        logo_form = LogoForm()

        if form.validate_on_submit():
            data = {
                unicode(key): value
                for key, value in form.data.iteritems()
                if key in layout_settings.defaults
            }
            layout_settings.set_multi(self.event_new, data)
            if form.theme.data == '_custom':
                layout_settings.set(self.event_new, 'use_custom_css', True)
            flash(_('Settings saved'), 'success')
            return redirect(url_for('.index', self.event_new))
        else:
            if self.event_new.logo_metadata:
                logo_form.logo.data = self.event_new
            if self.event_new.has_stylesheet:
                css_form.css_file.data = self.event_new
        return WPLayoutEdit.render_template('layout_conference.html',
                                            self._conf,
                                            form=form,
                                            event=self.event_new,
                                            logo_form=logo_form,
                                            css_form=css_form)
示例#3
0
    def _process(self):
        defaults = FormDefaults(**layout_settings.get_all(self._conf))
        form = LayoutForm(obj=defaults, event=self.event)
        css_form = CSSForm()
        logo_form = LogoForm()

        if form.validate_on_submit():
            data = {
                unicode(key): value
                for key, value in form.data.iteritems()
                if key in layout_settings.defaults
            }
            layout_settings.set_multi(self._conf, data)
            if form.theme.data == '_custom':
                layout_settings.set(self._conf, 'use_custom_css', True)
            flash(_('Settings saved'), 'success')
            return redirect(url_for('event_layout.index', self._conf))
        else:
            if self.event.logo_metadata:
                logo_form.logo.data = _logo_data(self.event)
            if self.event.has_stylesheet:
                css_form.css_file.data = _css_file_data(self.event)
        return WPLayoutEdit.render_template('layout.html',
                                            self._conf,
                                            form=form,
                                            event=self._conf,
                                            logo_form=logo_form,
                                            css_form=css_form)