Skip to content

Instantly share code, notes, and snippets.

@lincolndbryant
Created February 28, 2014 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lincolndbryant/9273889 to your computer and use it in GitHub Desktop.
Save lincolndbryant/9273889 to your computer and use it in GitHub Desktop.
sketch of expiry changes
//a JS template that gets added to the end of the options tab
<div data-hubfield="create_page">
<div class="show-if-create_page">
<div data-hubfield="html_title" />
<div data-hubfield="replacement_page" />
<div data-hubfield="replacement_page" />
<div data-hubfield="replacement_page" />
<input name="expiry" value="none" /> Do not unpublish
<input name="expiry" value="date" /> Unpublish at a specific data & time
<div data-hubfield="expiry_unpublish_date">
<input name="expiry" value="redirect" /> Redirect to a landing page at a specific date & time
<div data-hubfield="expiry_redirect_date" />
<div data-hubfield="replacement_page" />
</div>
//in edit-email.js, add attributes that hubfields are not in charge of saving
init ->
//jquery to toggle hiding and showing based on radio checking
app.on 'form:serialize', (data) ->
expiry = $('input[name="expiry"]').val()
if expiry.value is 'none'
data.use_page_expiry = false
data.replace_page = false
else if expiry.value is 'data'
data.use_page_expiry = true
data.replace_page = false
else if expiry.value is 'redirect'
data.use_page_expiry = true
data.replace_page = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment