Completed
Push — master ( 8a2447...e2760f )
by Paolo
06:42
created

django-data/image/static/import_export/action_formats.js   A

Complexity

Total Complexity 5
Complexity/F 1.67

Size

Lines of Code 22
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 16
mnd 2
bc 2
fnc 3
dl 0
loc 22
rs 10
bpm 0.6666
cpm 1.6666
noi 1
c 0
b 0
f 0
1
(function($) {
2
  $(document).on('ready', function() {
3
    var $actionsSelect, $formatsElement;
4
    if ($('body').hasClass('grp-change-list')) {
5
        // using grappelli
6
        $actionsSelect = $('#grp-changelist-form select[name="action"]');
7
        $formatsElement = $('#grp-changelist-form select[name="file_format"]');
8
    } else {
9
        // using default admin
10
        $actionsSelect = $('#changelist-form select[name="action"]');
11
        $formatsElement = $('#changelist-form select[name="file_format"]').parent();
12
    }
13
    $actionsSelect.on('change', function() {
14
      if ($(this).val() === 'export_admin_action') {
15
        $formatsElement.show();
16
      } else {
17
        $formatsElement.hide();
18
      }
19
    });
20
    $actionsSelect.change();
21
  });
22
})(django.jQuery);
0 ignored issues
show
Bug introduced by
The variable django seems to be never declared. If this is a global, consider adding a /** global: django */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
23