Beispiel #1
0
def _slide_preview(slug):
    """
    Preview a slide outside of the stack.
    """
    from models import SlideSequence

    context = make_context()

    sequence = SlideSequence.select()

    for slide in sequence:
        if slide.slide.slug == slug:
            context['in_sequence'] = True
            previous_slide_order = slide.order - 1
            next_slide_order = slide.order + 1
            break
    try:
        context['previous_slide'] = SlideSequence.get(SlideSequence.order == previous_slide_order).slide.slug
    except:
        pass

    try:
        context['next_slide'] = SlideSequence.get(SlideSequence.order == next_slide_order).slide.slug
    except:
        pass

    context['body'] = _slide(slug).data.decode('utf-8')
    context['slug'] = slug

    return render_template('slide_preview.html', **context)
Beispiel #2
0
def _stack():
    """
    Administer a stack of slides.
    """
    context = make_context(asset_depth=1)

    sequence = SlideSequence.select()
    sequence_dicts = sequence.dicts()

    time = 0

    for slide in sequence:
        time += slide.slide.time_on_screen

    for slide_dict in sequence_dicts:
        for slide in sequence:
            if slide.slide.slug == slide_dict['slide']:
                slide_dict['name'] = slide.slide.name
                slide_dict['time_on_screen'] = slide.slide.time_on_screen

                if slide_dict['slide'].startswith('tumblr'):
                    slide_dict['news_item'] = True

    context.update({
        'sequence': sequence_dicts,
        'slides': Slide.select().dicts(),
        'graphics': Slide.select().where(fn.Lower(fn.Substr(Slide.slug, 1, 6)) != 'tumblr').order_by(Slide.slug).dicts(),
        'news':  Slide.select().where(fn.Lower(fn.Substr(Slide.slug, 1, 6)) == 'tumblr').order_by(Slide.slug.desc()).dicts(),
        'time': time,
    })

    return render_template('admin/stack.html', **context)
Beispiel #3
0
def _slide_preview(slug):
    """
    Preview a slide outside of the stack.
    """
    from models import SlideSequence

    context = make_context()

    sequence = SlideSequence.select()

    for slide in sequence:
        if slide.slide.slug == slug:
            context['in_sequence'] = True
            previous_slide_order = slide.order - 1
            next_slide_order = slide.order + 1
            break
    try:
        context['previous_slide'] = SlideSequence.get(
            SlideSequence.order == previous_slide_order).slide.slug
    except:
        pass

    try:
        context['next_slide'] = SlideSequence.get(
            SlideSequence.order == next_slide_order).slide.slug
    except:
        pass

    context['body'] = _slide(slug).data.decode('utf-8')
    context['slug'] = slug

    return render_template('slide_preview.html', **context)
Beispiel #4
0
def _stack():
    """
    Administer a stack of slides.
    """
    context = make_context(asset_depth=1)

    sequence = SlideSequence.select()
    sequence_dicts = sequence.dicts()

    time = 0

    for slide in sequence:
        time += slide.slide.time_on_screen

    for slide_dict in sequence_dicts:
        for slide in sequence:
            if slide.slide.slug == slide_dict['slide']:
                slide_dict['name'] = slide.slide.name
                slide_dict['time_on_screen'] = slide.slide.time_on_screen

                if slide_dict['slide'].startswith('tumblr'):
                    slide_dict['news_item'] = True

    context.update({
        'sequence':
        sequence_dicts,
        'slides':
        Slide.select().dicts(),
        'graphics':
        Slide.select().where(
            fn.Lower(fn.Substr(Slide.slug, 1, 6)) != 'tumblr').order_by(
                Slide.slug).dicts(),
        'news':
        Slide.select().where(
            fn.Lower(fn.Substr(Slide.slug, 1, 6)) == 'tumblr').order_by(
                Slide.slug.desc()).dicts(),
        'time':
        time,
    })

    return render_template('admin/stack.html', **context)