<commit_before>class GroupGeneralSettingsView extends JView

  constructor:(options = {}, data)->
    super options,data
    @setClass "general-settings-view group-admin-modal"
    group = @getData()
    delegate = @getDelegate()

    formOptions =
      callback:(formData)=>
        {readme}   = formData
        saveButton = @settingsForm.buttons.Save
        appManager = KD.getSingleton('appManager')
        delete formData.readme
        # fix me:  make this a single call
        group.modify formData, (err)=>
          if err
            saveButton.hideLoader()
            return new KDNotificationView { title: err.message, duration: 1000 }

          group.setReadme readme, (err)=>
            saveButton.hideLoader()
            return new KDNotificationView { title: err.message, duration: 1000 }  if err

            new KDNotificationView
              title: 'Group was updated!'
              duration: 1000

            delegate.emit "groupSettingsUpdated", group

      buttons:
        Save                :
          style             : "modal-clean-green"
          type              : "submit"
          loader            :
            color           : "#444444"
            diameter        : 12
        Remove              :
          cssClass   : "modal-clean-red fr"
          title      : "Remove this Group"
          callback   : =>
            modal = new GroupsDangerModalView
              action     : 'Remove Group'
              title      : "Remove '#{data.slug}'"
              longAction : "remove the '#{data.slug}' group"
              callback   : (callback)=>
                data.remove (err)=>
                  callback()
                  return KD.showError err  if err
                  new KDNotificationView title:'Successfully removed!'
                  modal.destroy()
                  location.replace('/')
            , data
      fields:
        Title               :
          label             : "Group Name"
          name              : "title"
          defaultValue      : Encoder.htmlDecode group.title ? ""
          placeholder       : 'Please enter a title here'
        Description         :
          label             : "Description"
          type              : "textarea"
          name              : "body"
          defaultValue      : Encoder.htmlDecode group.body ? ""
          placeholder       : 'Please enter a description here.'
          autogrow          : yes
        Readme              :
          label             : "Readme"
          name              : "readme"
          itemClass         : GroupReadmeView
          defaultValue      : Encoder.htmlDecode group.readme ? ""
          data              : group
        "Privacy settings"  :
          itemClass         : KDSelectBox
          label             : "Privacy"
          type              : "select"
          name              : "privacy"
          defaultValue      : group.privacy ? "public"
          selectOptions     : [
            { title : "Public",    value : "public" }
            { title : "Private",   value : "private" }
          ]
        "Visibility settings"  :
          itemClass         : KDSelectBox
          label             : "Visibility"
          type              : "select"
          name              : "visibility"
          defaultValue      : group.visibility ? "visible"
          selectOptions     : [
            { title : "Visible",    value : "visible" }
            { title : "Hidden",     value : "hidden" }
          ]

    @settingsForm = new KDFormViewWithFields formOptions, group

    
    unless KD.config.roles? and 'owner' in KD.config.roles
      @settingsForm.buttons.Remove.hide()

    if data.slug is 'koding'
      @settingsForm.buttons.Remove.hide()

  pistachio:-> "{{> @settingsForm}}"
<commit_msg>remove readme input from group settings<commit_after>class GroupGeneralSettingsView extends JView

  constructor:(options = {}, data)->
    super options,data
    @setClass "general-settings-view group-admin-modal"
    group = @getData()
    delegate = @getDelegate()

    formOptions =
      callback:(formData)=>
        saveButton = @settingsForm.buttons.Save
        appManager = KD.getSingleton('appManager')

        # fix me:  make this a single call
        group.modify formData, (err)=>
          if err
            saveButton.hideLoader()
            return new KDNotificationView { title: err.message, duration: 1000 }

          new KDNotificationView
            title: 'Group was updated!'
            duration: 1000

          delegate.emit "groupSettingsUpdated", group

      buttons:
        Save                :
          style             : "modal-clean-green"
          type              : "submit"
          loader            :
            color           : "#444444"
            diameter        : 12
        Remove              :
          cssClass   : "modal-clean-red fr"
          title      : "Remove this Group"
          callback   : =>
            modal = new GroupsDangerModalView
              action     : 'Remove Group'
              title      : "Remove '#{data.slug}'"
              longAction : "remove the '#{data.slug}' group"
              callback   : (callback)=>
                data.remove (err)=>
                  callback()
                  return KD.showError err  if err
                  new KDNotificationView title:'Successfully removed!'
                  modal.destroy()
                  location.replace('/')
            , data
      fields:
        Title               :
          label             : "Group Name"
          name              : "title"
          defaultValue      : Encoder.htmlDecode group.title ? ""
          placeholder       : 'Please enter a title here'
        Description         :
          label             : "Description"
          type              : "textarea"
          name              : "body"
          defaultValue      : Encoder.htmlDecode group.body ? ""
          placeholder       : 'Please enter a description here.'
          autogrow          : yes
        "Privacy settings"  :
          itemClass         : KDSelectBox
          label             : "Privacy"
          type              : "select"
          name              : "privacy"
          defaultValue      : group.privacy ? "public"
          selectOptions     : [
            { title : "Public",    value : "public" }
            { title : "Private",   value : "private" }
          ]
        "Visibility settings"  :
          itemClass         : KDSelectBox
          label             : "Visibility"
          type              : "select"
          name              : "visibility"
          defaultValue      : group.visibility ? "visible"
          selectOptions     : [
            { title : "Visible",    value : "visible" }
            { title : "Hidden",     value : "hidden" }
          ]

    @settingsForm = new KDFormViewWithFields formOptions, group

    unless KD.config.roles? and 'owner' in KD.config.roles
      @settingsForm.buttons.Remove.hide()

    if data.slug is 'koding'
      @settingsForm.buttons.Remove.hide()

  pistachio:-> "{{> @settingsForm}}"

{'fraction_non_alphanumeric': 0.08831749580771381, 'fraction_numerical': 0.005030743432084964, 'mean_word_length': 1.267743979721166, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2897029', 'n_tokens_mistral': 1790, 'n_tokens_neox': 1704, 'n_words': 434}