Advertisement
eduardomelendezjr

Untitled

Aug 26th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. var CertificacionRenovarAviso = BaseView.extend({
  2. events: {
  3. "click .btn-renovar": "renovar",
  4. },
  5. initialize: function () {
  6. CertificacionRenovarAviso.__super__.initialize.apply(this, arguments)
  7. this.workingEl = '.btn-renovar'
  8. this.template = Handlebars.compile($("#certificacionRenovarAviso").html())
  9. this.model = new MisCertificacionesModel()
  10. $(this.$el)
  11. .html(this.template(this.model.toJSON()))
  12. .addClass("certificacion-renovar-aviso-block modal fade")
  13. _.bindAll(this, "render")
  14. },
  15. ID: '',
  16. renovar: function () {
  17. if (this.model.isValid(true)) {
  18. this.save()
  19. }
  20. },
  21. setModel: function (attrs) {
  22. this.model.attributes = attrs
  23. ID = this.model.get("ID")
  24. this.applyBindings()
  25. },
  26. save: function () {
  27. if (this.isWorking)
  28. return
  29. var self = this
  30. this.startWorking()
  31. this.model.set("ID", ID)
  32. this.model.customUrl = "/api/certificacion/renovarAviso/" + ID
  33. alert(this.model.customUrl)
  34. this.model.save({},
  35. {
  36. //*
  37. success: function (err, response)
  38. {
  39. self.stopWorking({ showPopover: true })
  40. setTimeout(function ()
  41. {
  42. $(self.$el).modal("hide")
  43. window.location.assign('#')
  44. }, 3000)
  45. },
  46. error: self.xhrError,
  47. beforeSend: self.beforeSend
  48. //*/
  49. })
  50. },
  51. render: function () {
  52. return this
  53. }
  54. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement