app/assets/javascripts/delete.js   A
last analyzed

Complexity

Total Complexity 8
Complexity/F 2

Size

Lines of Code 41
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 8
eloc 26
mnd 4
bc 4
fnc 4
bpm 1
cpm 2
noi 1
1
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
2
//
3
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
4
//
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU Lesser General Public License as published by the Free Software
7
// Foundation; either version 3.0 of the License, or (at your option) any later
8
// version.
9
//
10
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
13
//
14
// You should have received a copy of the GNU Lesser General Public License along
15
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
16
17
$(document).on('turbolinks:load', function(){
18
  var controller = $("body").data('controller');
19
  var action = $("body").data('action');
20
21
  // Only run on the admins page.
22
  if (controller == "admins" && action == "index") {
23
    // show the modal with the correct form action url
24
    $(".delete-user").click(function(){
25
      $("#delete-confirm").parent().attr("action", $(this).data("path"))
26
27
      if ($(this).data("delete") == "temp-delete") {
28
        $("#perm-delete").hide()
29
        $("#delete-warning").show()
30
      } else {
31
        $("#perm-delete").show()
32
        $("#delete-warning").hide()
33
      }
34
    })
35
  }
36
37
  $(".delete-user").click(function(data){
38
    document.getElementById("delete-checkbox").checked = false
39
    $("#delete-confirm").prop("disabled", "disabled")
40
41
    if ($(data.target).data("delete") == "temp-delete") {
42
      $("#perm-delete").hide()
43
      $("#delete-warning").show()
44
    } else {
45
      $("#perm-delete").show()
46
      $("#delete-warning").hide()
47
    }
48
  })
49
50
  $("#delete-checkbox").click(function(data){
0 ignored issues
show
Unused Code introduced by
The parameter data is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
51
    if (document.getElementById("delete-checkbox").checked) {
52
      $("#delete-confirm").removeAttr("disabled")
53
    } else {
54
      $("#delete-confirm").prop("disabled", "disabled")
55
    }
56
  })
57
})
58