summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/account/ProfileView.js
blob: 83ab0cdc3d423b6e08a6c9551398532844025724 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var ProfileView = FormView.extend({
  
  el: "#profile",
  
  events: {
  },
  
  initialize: function(){
    this.$form = this.$("form")
    this.$msg = this.$(".msg")
    this.scroller = new IScroll('#profile', app.iscroll_options)
  },

  show: function(){
    app.footer.show("SAVE", "CANCEL")
    document.body.className = "profile"
  },

  validate_presence: {
    "Name": "Please enter your first name.",
    "Surname": "Please enter your last name.",
    "Email": "Please enter a valid email address.",
  },
  
  validate_fields: function(data, errors){
    if (! data.CurrentPassword && data.NewPassword) { errors.push([ "CurrentPassword", "Please enter your current password." ]) }
    if (data.CurrentPassword && ! data.NewPassword) { errors.push([ "NewPassword", "Please enter your new password." ]) }
    if (data.NewPassword && data.NewPassword.length < 7) { errors.push([ "CurrentPassword", "New password must be 7 characters or more." ]) }
  },
  
  success: function(data){
  },
  
  error: function(data){
  },

})