Exemple #1
0
    def get(self,layout_name=None):
        self._args = request.args.get('layout',False)
        #if self._args:
        #    self._template = Template(main(self._args))
        #else:
        #    self._template = Template(main())
        self._layouts = {
            'one_col_empty':(col(12),),
            'one_col_leftbar':(col(2),col(10)),
            'one_col_rightbar':(col(10),col(2)),
            'one_col_both':(col(2),col(8),col(2)),
            'two_col_empty':(col(6),col(6)),
            'two_col_leftbar':(col(2),col(5),col(5)),
            'two_col_rightbar':(col(5),col(5),col(2)),
            'two_col_both':(col(2),col(4),col(4),col(2)),
            'three_col_empty':(col(4),col(4),col(4)),
            'three_col_leftbar':(col(2),col(3),col(3),col(4)),
            'three_col_rightbar':(col(4),col(3),col(3),col(2)),
        }
        from admin.forms import CreateGridForm
        self._form = CreateGridForm
        self._context['form_id'] = 'myForm'

        content = (row('660',cols=(col(2),col(8),col(2))),)
        footer = (row('140',cols=(col(3),col(6),col(3))),)
        
        #if layout_name is not None:
        #    self._context['rows'] = (row('660',cols=list(self._layouts[layout_name.replace('-','_')])),) + footer
        #else:
        #    self._context['rows'] = content + footer

        self._context['layouts'] = self._layouts.keys()
        x = self.render()
        return x
Exemple #2
0
    def get(self, layout_name=None):
        self._args = request.args.get('layout', False)
        #if self._args:
        #    self._template = Template(main(self._args))
        #else:
        #    self._template = Template(main())
        self._layouts = {
            'one_col_empty': (col(12), ),
            'one_col_leftbar': (col(2), col(10)),
            'one_col_rightbar': (col(10), col(2)),
            'one_col_both': (col(2), col(8), col(2)),
            'two_col_empty': (col(6), col(6)),
            'two_col_leftbar': (col(2), col(5), col(5)),
            'two_col_rightbar': (col(5), col(5), col(2)),
            'two_col_both': (col(2), col(4), col(4), col(2)),
            'three_col_empty': (col(4), col(4), col(4)),
            'three_col_leftbar': (col(2), col(3), col(3), col(4)),
            'three_col_rightbar': (col(4), col(3), col(3), col(2)),
        }
        from admin.forms import CreateGridForm
        self._form = CreateGridForm
        self._context['form_id'] = 'myForm'

        content = (row('660', cols=(col(2), col(8), col(2))), )
        footer = (row('140', cols=(col(3), col(6), col(3))), )

        #if layout_name is not None:
        #    self._context['rows'] = (row('660',cols=list(self._layouts[layout_name.replace('-','_')])),) + footer
        #else:
        #    self._context['rows'] = content + footer

        self._context['layouts'] = self._layouts.keys()
        x = self.render()
        return x
Exemple #3
0
class IndexView(BaseView):
    _template = '1_col_left.html'  #'test_grid.html'#'new22.html'#'blog3.html'#'layouts/1col_leftsidebar.html'
    _context = {
        'add_buttons': True,
        'count': 0,
        'l_count': 0,
        'body_style': 'padding-top:75px;',
    }
    _row = (row('660', cols=[col(2), col(8), col(2)]), ),

    _form = ColumnForm

    def get(self, layout_name=None):
        self._args = request.args.get('layout', False)
        #if self._args:
        #    self._template = Template(main(self._args))
        #else:
        #    self._template = Template(main())
        self._layouts = {
            'one_col_empty': (col(12), ),
            'one_col_leftbar': (col(2), col(10)),
            'one_col_rightbar': (col(10), col(2)),
            'one_col_both': (col(2), col(8), col(2)),
            'two_col_empty': (col(6), col(6)),
            'two_col_leftbar': (col(2), col(5), col(5)),
            'two_col_rightbar': (col(5), col(5), col(2)),
            'two_col_both': (col(2), col(4), col(4), col(2)),
            'three_col_empty': (col(4), col(4), col(4)),
            'three_col_leftbar': (col(2), col(3), col(3), col(4)),
            'three_col_rightbar': (col(4), col(3), col(3), col(2)),
        }
        #from admin.forms import CreateGridForm
        #self._form = CreateGridForm
        #self._context['form_id'] = 'myForm'

        #content = (row('660',cols=(col(2),col(8),col(2))),)
        #footer = (row('140',cols=(col(3),col(6),col(3))),)

        #if layout_name is not None:
        #    self._context['rows'] = (row('660',cols=list(self._layouts[layout_name.replace('-','_')])),) + footer
        #else:
        #    self._context['rows'] = content + footer

        #self._context['layouts'] = self._layouts.keys()
        x = self.render()
        return x

    def post(self):
        self._context['f'] = request.files.copy()
        if ColumnForm(request.form).validate():
            self._context['offset'] = request.form.get('offset', None)
            self._context['push'] = request.form.get('push', None)
            self._context['pull'] = request.form.get('pull', None)
            self._context['width'] = request.form.get('col_width', None)
        #self._context['layout_mode'] = True
        return self.render()