Skip to content

Commit

Permalink
Merge pull request #969 from ubyssey/DropCapFunction
Browse files Browse the repository at this point in the history
Drop cap function
  • Loading branch information
keeganland authored Jun 11, 2020
2 parents faf9180 + a86d200 commit 6352cbd
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dispatch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '1.0.3'
__version__ = '1.1.0'


10 changes: 10 additions & 0 deletions dispatch/modules/content/embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ def prepare_data(self, data):

class PageBreakEmbed(AbstractTemplateEmbed):
TEMPLATE = 'embeds/pagebreak.html'

class DropCapEmbed(AbstractTemplateEmbed):
TEMPLATE = 'embeds/dropcap.html'

@classmethod
def prepare_data(self, data):
return {
'paragraph': data.get('paragraph', None)
}

class GalleryEmbed(AbstractTemplateEmbed):
TEMPLATE = 'embeds/gallery.html'
Expand Down Expand Up @@ -165,3 +174,4 @@ def prepare_data(self, data):
embeds.register('image', ImageEmbed)
embeds.register('gallery', GalleryEmbed)
embeds.register('pagebreak', PageBreakEmbed)
embeds.register('dropcap', DropCapEmbed)
2 changes: 1 addition & 1 deletion dispatch/static/manager/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dispatch",
"version": "1.0.3",
"version": "1.1.0",
"description": "The frontend framework for the Dispatch publishing platform.",
"author": "Peter Siemens <[email protected]>",
"homepage": "https://www.ubyssey.ca",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {
PollEmbed,
PodcastEmbed,
InteractiveMapEmbed,
PageBreakEmbed
PageBreakEmbed,
DropCapEmbed
} from '../../vendor/dispatch-editor'

const embeds = [
Expand All @@ -26,7 +27,8 @@ const embeds = [
PollEmbed,
PodcastEmbed,
InteractiveMapEmbed,
PageBreakEmbed
PageBreakEmbed,
DropCapEmbed
]

export default class ArticleContentEditor extends React.Component {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react'
import { TextInput } from '../../../components/inputs'

import * as Form from '../../../components/Form'

function DropCapEmbedComponent(props) {
return (
<div className='drop-cap'>
<Form.Container>
<Form.Input label='Dropcap paragraph'>
<TextInput
fill={true}
value={props.data.paragraph}
onChange={e => props.updateField('paragraph', e.target.value)} />
</Form.Input>
</Form.Container>
</div>
)
}


export default {
type: 'dropcap',
component: DropCapEmbedComponent,
defaultData: {
paragraph: ''
}
}

Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react'
import { TextInput } from '../../../components/inputs'

import * as Form from '../../../components/Form'

function PageBreakEmbedComponent(props) {
function PageBreakEmbedComponent() {
return (
<div className='page-break'>
<Form.Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import PollEmbed from './PollEmbed'
import PodcastEmbed from './PodcastEmbed'
import InteractiveMapEmbed from './InteractiveMapEmbed'
import PageBreakEmbed from './PageBreakEmbed'
import DropCapEmbed from './DropCapEmbed'

export {
ImageEmbed,
Expand All @@ -19,5 +20,6 @@ export {
PollEmbed,
PodcastEmbed,
InteractiveMapEmbed,
PageBreakEmbed
PageBreakEmbed,
DropCapEmbed
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
PollEmbed,
PodcastEmbed,
InteractiveMapEmbed,
PageBreakEmbed
PageBreakEmbed,
DropCapEmbed
} from './embeds'

import {
Expand All @@ -36,5 +37,6 @@ export {
PollEmbed,
PodcastEmbed,
InteractiveMapEmbed,
PageBreakEmbed
PageBreakEmbed,
DropCapEmbed
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

setup(name='dispatch',
version='1.0.3',
version='1.1.0',
description='A publishing platform for modern newspapers',
url='https://github.com/ubyssey/dispatch',
author='Peter Siemens',
Expand Down

0 comments on commit 6352cbd

Please sign in to comment.