
define([
  'jquery',
  'underscore',
  'backbone',
  'helpers/conf',
  'text!templates/basic_nav.html',
  'text!templates/conf.html'
], function($, _, Backbone, ConfHelper, BasicNavTemplate, ConfTemplate){


  var ConfView = Backbone.View.extend ({
    el: '#main',

    initialize: function () {

      // unbind previous events
      // FIXME: need better solution for this
      $(this.el).unbind ('scroll');
      $(this.el).unbind ('click');

      // clear page content
      $(this.el).html ('');

    },

    render: function () {

      $('#right-navbar').html (_.template (BasicNavTemplate,
                                           { title: 'Ayarlar' }));
      $(this.el).append (_.template (ConfTemplate,
                                     { options: ConfHelper.options }));

    },


    events: {
      'click ul.theme a': 'changeTheme'
    },


    changeTheme: function (ev) {
      var theme = $(ev.currentTarget).attr ('href').replace (/^#/, '');

      ConfHelper.options.theme = theme;
      ConfHelper.switchTheme ();
      ConfHelper.saveConf ();

      return false;
    },

  });


  return ConfView;

});

@@ -848,16 +848,54 @@
 geTheme'
+,%0A      'change input': 'changeOption'
 %0A    %7D,%0A
@@ -1134,16 +1134,209 @@
     %7D,%0A%0A
+%0A    changeOption: function (ev) %7B%0A      var option = $(ev.currentTarget).attr ('value');%0A      var val = $(ev.currentTarget).is (':checked');%0A%0A      ConfHelper.setOption (option, val);%0A    %7D%0A%0A
   %7D);%0A%0A%0A

add change input event