summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/project_new.js.coffee
blob: e48343a19b543e25df38e940c18c6797c1b64452 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class @ProjectNew
  constructor: ->
    $('.project-edit-container').on 'ajax:before', =>
      $('.project-edit-container').hide()
      $('.save-project-loader').show()
    @toggleSettings()
    @toggleSettingsOnclick()


  toggleSettings: =>
    @_showOrHide('#project_builds_enabled', '.builds-feature')
    @_showOrHide('#project_merge_requests_enabled', '.merge-requests-feature')

  toggleSettingsOnclick: ->
    $('#project_builds_enabled, #project_merge_requests_enabled').on 'click', @toggleSettings

  _showOrHide: (checkElement, container) ->
    $container = $(container)

    if $(checkElement).prop('checked')
      $container.show()
    else
      $container.hide()