Skip to content

Instantly share code, notes, and snippets.

@jeffharnois
Created January 21, 2014 09:10
Show Gist options
  • Save jeffharnois/8536775 to your computer and use it in GitHub Desktop.
Save jeffharnois/8536775 to your computer and use it in GitHub Desktop.
saveTargeting = (model) =>
start = @$('.js-fcap-start').val() if @$('.js-fcap-start').val() isnt ""
newAttr =
frequencyCapping: @$('.o-targeting-form--fcap-select').find('.js-frequency-cap').val()
start: start
end: if @options.targeting.options.isCPM
@$('.js-fcap-end').val() unless @$('.js-fcap-end').val() is ""
else
start
if /^LI-/.test model.id
model.set newAttr
model.set targetingUids: model.getTargetingUidsFromIds(@$('.js-geo-targeting-selector .m-tag--container').find('.m-tag')), {silent: true}
else
model.save newAttr
return model.save targetingUids: model.getTargetingUidsFromIds(@$('.js-geo-targeting-selector .m-tag--container').find('.m-tag')), {silent: true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment