[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/feedback/amd/src/ -> edit.js (source)

   1  // This file is part of Moodle - http://moodle.org/
   2  //
   3  // Moodle is free software: you can redistribute it and/or modify
   4  // it under the terms of the GNU General Public License as published by
   5  // the Free Software Foundation, either version 3 of the License, or
   6  // (at your option) any later version.
   7  //
   8  // Moodle is distributed in the hope that it will be useful,
   9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11  // GNU General Public License for more details.
  12  //
  13  // You should have received a copy of the GNU General Public License
  14  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  15  
  16  /**
  17   * Edit items in feedback module
  18   *
  19   * @module     mod_feedback/edit
  20   * @package    mod_feedback
  21   * @copyright  2016 Marina Glancy
  22   */
  23  define(['jquery', 'core/ajax', 'core/str', 'core/notification'],
  24  function($, ajax, str, notification) {
  25      var manager = {
  26          deleteItem: function(e) {
  27              e.preventDefault();
  28  
  29              str.get_strings([
  30                  {
  31                      key:        'confirmation',
  32                      component:  'admin'
  33                  },
  34                  {
  35                      key:        'confirmdeleteitem',
  36                      component:  'mod_feedback'
  37                  },
  38                  {
  39                      key:        'yes',
  40                      component:  'moodle'
  41                  },
  42                  {
  43                      key:        'no',
  44                      component:  'moodle'
  45                  }
  46              ]).done(function(s) {
  47                  notification.confirm(s[0], s[1], s[2], s[3], $.proxy(function() {
  48                      window.location = $(this).attr('href');
  49                  }, e.currentTarget));
  50              });
  51          },
  52  
  53          setup: function() {
  54              $('body').delegate('[data-action="delete"]', 'click', manager.deleteItem);
  55          }
  56      };
  57  
  58      return {
  59          setup: manager.setup
  60      };
  61  });


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1