Skip to content

Commit

Permalink
Merge pull request #156 from ccnmtl/html5-validation
Browse files Browse the repository at this point in the history
Html5 validation
  • Loading branch information
nikolas committed Mar 22, 2017
2 parents 1bed764 + cc1e55d commit 1df8c78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pagetree/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,13 @@ class EditSectionForm(forms.Form):
slug = forms.CharField(initial=self.slug)
show_toc = forms.BooleanField(
initial=self.show_toc,
required=False,
label="Show Table of Contents",
help_text=("list table of contents of "
"immediate child sections (if applicable)"))
deep_toc = forms.BooleanField(
initial=self.deep_toc,
required=False,
label="Show Deep Table of Contents",
help_text=(
"include children of children (etc) in TOC. "
Expand Down
9 changes: 7 additions & 2 deletions pagetree/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ def edit_section(request, section_id, success_url=None):
section.save_version(request.user, activity="edit section")
section.label = request.POST.get('label', '')
section.slug = slugify(request.POST.get('slug', section.label))[:50]
section.show_toc = request.POST.get('show_toc', False)
section.deep_toc = request.POST.get('deep_toc', False)

value = request.POST.get('show_toc', False)
section.show_toc = value in ('True', True, 'on')

value = request.POST.get('deep_toc', False)
section.deep_toc = value in ('True', True, 'on')

section.save()
section.enforce_slug()
section.save()
Expand Down

0 comments on commit 1df8c78

Please sign in to comment.