/*jslint indent: 2, maxerr: 3, maxlen: 80 */
/*global window, rJS, RSVP */
(function (window, rJS, RSVP) {
  "use strict";

  rJS(window)
    .declareAcquiredMethod("getTranslationDict", "getTranslationDict")
    .declareMethod('triggerSubmit', function () {
      var argument_list = arguments;
      return this.getDeclaredGadget('access')
        .push(function (access_gadget) {
          return access_gadget.triggerSubmit.call(access_gadget, argument_list);
        });
    })
    .declareMethod('render', function (options) {
      return new RSVP.Queue(RSVP.hash({
        access_gadget: this.getDeclaredGadget('access'),
        translation_dict: this.getTranslationDict([
          'Projects',
          'Instance Trees',
          'Servers'
        ])
      }))
        .push(function (result_dict) {
          return result_dict.access_gadget.render(options, [{
            title: result_dict.translation_dict.Projects,
            jio_key: 'project_module',
            erp5_action: 'view'
          }, {
            title: result_dict.translation_dict['Instance Trees'],
            jio_key: 'instance_tree_module',
            erp5_action: 'view'
          }, {
            title: result_dict.translation_dict.Servers,
            jio_key: 'compute_node_module',
            erp5_action: 'view'
          }]);
        });
    });

}(window, rJS, RSVP));
