Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Commit

Permalink
more sensible access to wymeditor settings
Browse files Browse the repository at this point in the history
  • Loading branch information
evildmp committed Nov 12, 2012
1 parent 5760020 commit d0fc75e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 61 deletions.
43 changes: 0 additions & 43 deletions arkestra_utilities/settings.py
Expand Up @@ -123,50 +123,7 @@

EXPAND_ALL_MENU_BRANCHES = getattr(settings, "EXPAND_ALL_MENU_BRANCHES", False)

# -------- Semantic editor ----------------------

# ensure that the highest_page_body_heading_level is made available below

WYM_CONTAINERS = getattr(settings, "WYM_CONTAINERS",
",\n".join([
"{'name': 'P', 'title': 'Paragraph', 'css': 'wym_containers_p'}",
# "{'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'}", # I assume you reserve <h1> for your page templates
"{'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'}",
"{'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'}",
"{'name': 'H4', 'title': 'Heading_4', 'css': 'wym_containers_h4'}",
"{'name': 'H5', 'title': 'Heading_5', 'css': 'wym_containers_h5'}",
"{'name': 'H6', 'title': 'Heading_6', 'css': 'wym_containers_h6'}",
# "{'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'}",
"{'name': 'BLOCKQUOTE', 'title': 'Blockquote', 'css': 'wym_containers_blockquote'}",
# "{'name': 'TH', 'title': 'Table_Header', 'css': 'wym_containers_th'}", # not ready for this yet
])
)


WYM_TOOLS = getattr(settings, "WYM_TOOLS",
",\n".join([
"{'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'}", # and not italic
"{'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'}", # not 'bold'
"{'name': 'InsertUnorderedList', 'title': 'Unordered_List', 'css': 'wym_tools_unordered_list'}",
"{'name': 'InsertOrderedList', 'title': 'Ordered_List', 'css': 'wym_tools_ordered_list'}",
"{'name': 'Indent', 'title': 'Indent', 'css': 'wym_tools_indent'}", # should be 'nest'
"{'name': 'Outdent', 'title': 'Outdent', 'css': 'wym_tools_outdent'}", # should be 'unnest'
# "{'name': 'Superscript', 'title': 'Superscript', 'css': 'wym_tools_superscript'}",
# "{'name': 'Subscript', 'title': 'Subscript', 'css': 'wym_tools_subscript'}",
"{'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'}",
"{'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'}",
# "{'name': 'Paste', 'title': 'Paste_From_Word', 'css': 'wym_tools_paste'}",
"{'name': 'ToggleHtml', 'title': 'HTML', 'css': 'wym_tools_html'}",
#"{'name': 'CreateLink', 'title': 'Link', 'css': 'wym_tools_link'}",
#"{'name': 'Unlink', 'title': 'Unlink', 'css': 'wym_tools_unlink'}",
#"{'name': 'InsertImage', 'title': 'Image', 'css': 'wym_tools_image'}",
# "{'name': 'InsertTable', 'title': 'Table', 'css': 'wym_tools_table'}", # not ready for this yet
#"{'name': 'Preview', 'title': 'Preview', 'css': 'wym_tools_preview'}",
])
)

WYM_CLASSES = ""
WYM_STYLES = ""
# -------- Django ----------------------

LOGIN_REDIRECT_URL = getattr(settings, "LOGIN_REDIRECT_URL", "/admin/") #what happens after login - why is this required?
3 changes: 1 addition & 2 deletions arkestra_utilities/widgets/wym_editor.py
Expand Up @@ -4,8 +4,7 @@
from django.utils.safestring import mark_safe
from django.conf import settings

from arkestra_utilities.settings import WYM_TOOLS, WYM_CONTAINERS, WYM_CLASSES, WYM_STYLES

from cms.plugins.text.settings import WYM_TOOLS, WYM_CONTAINERS, WYM_CLASSES, WYM_STYLES

class WYMEditor(forms.Textarea):
class Media:
Expand Down
16 changes: 0 additions & 16 deletions example_14/example_14/arkestra_settings.py
Expand Up @@ -35,22 +35,6 @@
from settings import STATIC_URL
SEMANTICEDITOR_MEDIA_URL = os.path.join(STATIC_URL, "semanticeditor/")

PAGE_TITLE_HEADING_LEVEL = 2

# ensure that the highest_page_body_heading_level is made available below

WYM_CONTAINERS = ",\n".join([
"{'name': 'P', 'title': 'Paragraph', 'css': 'wym_containers_p'}",
# "{'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'}", # I assume you reserve <h1> for your page templates
"{'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'}",
"{'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'}",
"{'name': 'H4', 'title': 'Heading_4', 'css': 'wym_containers_h4'}",
"{'name': 'H5', 'title': 'Heading_5', 'css': 'wym_containers_h5'}",
"{'name': 'H6', 'title': 'Heading_6', 'css': 'wym_containers_h6'}",
# "{'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'}",
"{'name': 'BLOCKQUOTE', 'title': 'Blockquote', 'css': 'wym_containers_blockquote'}",
# "{'name': 'TH', 'title': 'Table_Header', 'css': 'wym_containers_th'}", # not ready for this yet
])

# ------------------------ Link system

Expand Down
29 changes: 29 additions & 0 deletions example_14/example_14/settings.py
Expand Up @@ -319,4 +319,33 @@
('cy', gettext('Cymraeg')),
)

# ------------------------ WYMeditor/SemanticEditor

# these override the settings in cms.plugins.text.settings

WYM_TOOLS = ",\n".join([
"{'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'}",
"{'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'}",
"{'name': 'InsertOrderedList', 'title': 'Ordered_List', 'css': 'wym_tools_ordered_list'}",
"{'name': 'InsertUnorderedList', 'title': 'Unordered_List', 'css': 'wym_tools_unordered_list'}",
"{'name': 'Indent', 'title': 'Indent', 'css': 'wym_tools_indent'}",
"{'name': 'Outdent', 'title': 'Outdent', 'css': 'wym_tools_outdent'}",
"{'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'}",
"{'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'}",
"{'name': 'ToggleHtml', 'title': 'HTML', 'css': 'wym_tools_html'}",
])

WYM_CONTAINERS = ",\n".join([
"{'name': 'P', 'title': 'Paragraph', 'css': 'wym_containers_p'}",
# "{'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'}", # I assume you reserve <h1> for your page templates
"{'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'}",
"{'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'}",
"{'name': 'H4', 'title': 'Heading_4', 'css': 'wym_containers_h4'}",
"{'name': 'H5', 'title': 'Heading_5', 'css': 'wym_containers_h5'}",
"{'name': 'H6', 'title': 'Heading_6', 'css': 'wym_containers_h6'}",
# "{'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'}",
"{'name': 'BLOCKQUOTE', 'title': 'Blockquote', 'css': 'wym_containers_blockquote'}",
# "{'name': 'TH', 'title': 'Table_Header', 'css': 'wym_containers_th'}", # not ready for this yet
])

from arkestra_settings import *# import pdb; pdb.set_trace()

0 comments on commit d0fc75e

Please sign in to comment.