Skip to content

Instantly share code, notes, and snippets.

@pketh
Last active July 14, 2016 14:22
Show Gist options
  • Save pketh/065d67d023230dd2763c6a5c2e63b64d to your computer and use it in GitHub Desktop.
Save pketh/065d67d023230dd2763c6a5c2e63b64d to your computer and use it in GitHub Desktop.
fogbugz pricing logic sketch

Here's some jade html

section.packages
  ul
    li.package.tracker.active(data-package="tracker" data-cost="12")
      // fb tracker is ...
    li.package.helpdesk(data-package="helpdesk" data-cost="13")
      // ...
    li.package.agile(data-package="agile" data-cost="14")
      // ...
    li.package.buildhub(data-package="buildhub" data-cost="15")
      // ...

section.hosting-options
  ul
    li.hosting.on-demand.active(data-hosting="on-demand" data-cost="10")
      // on demand is ...
    li.hosting.on-site(data-hosting="on-site" data-cost="12")
      // ...

section.users
  progress(value="5" max="100")

button.submit

logic in coffee

updatePrice = ->
  packagePrice = $('.package.active')[0].data('cost')
  hostingPrice = $('.hosting.active')[0].data('cost')
  numberOfUsers = $('progress').prop('value')
  monthlyPrice = some math with the above
  yearlyPrice = (monthlyPrice * .10) + monthlyPrice
  # then update the prices on the dom

# click a package to highlight it
$('.package').click (event) ->
  $('.package').removeClass('active')
  $(event.target).addClass('active')
  updatePrice()

# click a hosting option to highlight it
$('.hosting').click (event) ->
  $('.hosting').removeClass('active')
  $(event.target).addClass('active')
  updatePrice()

$('.progress').change ->
  updatePrice()

$('.submit').click ->
  # send the user to a url
  # on submit you might want to pass the data tags (costs, packages, users selected) on to fb somehow -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment