App.SelectMinuteOfDayComponent = Ember.Component.extend
  layoutName: "form/select_minute_of_day"
  classNameBindings: ['rounded:round']
  hours_list: [0..24].map (n) -> "0#{n}".substr(-2,2)
  minutes_list: [0..60].map (n) -> "0#{n}".substr(-2,2)
  hour: Ember.computed 'value',
    set: (key, value)->
      minute = if @get('minute') then parseInt(@get('minute')) else 0
      @set 'value', 60*parseInt(value) + minute
      value
    get: ->
      number = Math.floor (@get('value') || 0)/60
      "0#{number}".substr(-2,2)
  minute: Ember.computed 'value',
    set: (key, value)->
      hour = if @get('hour') then parseInt(@get('hour')) else 0
      @set 'value', 60*hour + parseInt(value)
      value
    get: ->
      return "00" unless value = @get('value')
      number = Math.floor value%60
      "0#{number}".substr(-2,2)
