cirandas.net

ref: master

plugins/networks/public/javascripts/networks.js


 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
networks = {

  orders_forward: {
    orders_managers: null,
    network: null,

    toggle_representatives: function() {
      var checked = networks.orders_forward.orders_managers.get(0).checked;
      jQuery('#orders-managers').toggle(checked);
    },

    load: function() {
      this.orders_managers = jQuery('#orders_forward_orders_managers');
      this.orders_network = jQuery('#orders_forward_network');

      this.orders_managers.change(this.toggle_representatives);
      this.orders_network.change(this.toggle_representatives);
      this.toggle_representatives();
    },
  },

  structure: {

  },

  join: {
    url: '',

    confirm: function(form) {
      jQuery(form).ajaxSubmit({dataType: 'script'})
      return false
    },

    choose: function(item) {
      item = jQuery(item)
      jQuery('#network-join').load(this.url, {enterprise_id: item.attr('data-id')})
    },

  },

  participation: {
    disassociate: function(context, url, confirm_message) {
      if (confirm(confirm_message)) {
        loading_overlay.show('#networks-participation')
        jQuery.getScript(url)
        loading_overlay.hide('#networks-participation')
      }
    }
  },
};