Skip to content

Commit

Permalink
comments, cleanup, address feedback from CR
Browse files Browse the repository at this point in the history
  • Loading branch information
Skylar Brown committed Jun 30, 2016
1 parent 38bcf7c commit 080dc1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/assets/javascripts/comfy/admin/cms/base.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ window.CMS.page_blocks = ->
CMS.timepicker()
CMS.codemirror()
CMS.page_file_popovers()
document.dispatchEvent(new CustomEvent('cms_page_blocks'))


window.CMS.page_file_popovers = ->
Expand Down
12 changes: 9 additions & 3 deletions app/models/comfy/cms/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ def validate_target_page

def validate_format_of_unescaped_slug
return unless slug.present?
#unescaped_slug = CGI::unescape(self.slug)
#errors.add(:slug, :invalid) unless unescaped_slug =~ /^\p{Alnum}[\.\p{Alnum}\p{Mark}_-]*$/i
# We are disabling this validation so we can define more than one level of hierarchy
# in a page slug, for example a page`baz` with path /foo/bar/baz, without
# needing a page to exist at foo and bar.

# unescaped_slug = CGI::unescape(self.slug)
# errors.add(:slug, :invalid) unless unescaped_slug =~ /^\p{Alnum}[\.\p{Alnum}\p{Mark}_-]*$/i
end

# Forcing re-saves for child pages so they can update full_paths
Expand All @@ -163,12 +167,14 @@ def sync_child_full_paths!

# Escape slug unless it's nonexistent (root)
def escape_slug
# commented out as for our purposes we dont want to escape slugs
# see block comment above in validate_format_of_unescaped_slug

# self.slug = CGI::escape(self.slug) unless self.slug.nil?
end

# Unescape the slug and full path back into their original forms unless they're nonexistent
def unescape_slug_and_path
self.slug = CGI::unescape(self.slug) unless self.slug.nil?
self.slug = CGI::unescape(self.slug) unless self.slug.nil?
self.full_path = CGI::unescape(self.full_path) unless self.full_path.nil?
end
Expand Down

0 comments on commit 080dc1e

Please sign in to comment.