Advertisement
eduardomelendezjr

Untitled

Aug 26th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 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. this.model.save({},
  34. {
  35. //*
  36. success: function (err, response)
  37. {
  38. self.stopWorking({ showPopover: true })
  39. setTimeout(function ()
  40. {
  41. $(self.$el).modal("hide")
  42. window.location.assign('#')
  43. }, 3000)
  44. },
  45. error: self.xhrError,
  46. beforeSend: self.beforeSend
  47. //*/
  48. })
  49. },
  50. render: function () {
  51. return this
  52. }
  53. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement