<commit_before>class GroupGeneralSettingsView extends JView

  constructor:->

    super

    @setClass "general-settings-view group-admin-modal"

    group = @getData()

    unless group?
      group = {}
      isNewGroup = yes
    isPrivateGroup = 'private' is group.privacy

    _updateGroupHandler =(group, formData)=>
      log formData
      formData.avatar = @customUrl if @customUrl
      log formData
      group.modify formData, (err)->
        if err
          new KDNotificationView
            title: err.message
            duration: 1000
        else
          new KDNotificationView
            title: 'Group was updated!'
            duration: 1000

    formOptions =
      title: if isNewGroup then 'Create a group' else 'Edit group'
      callback:(formData)=>
        if isNewGroup
          _createGroupHandler.call @, formData
        else
          _updateGroupHandler group, formData
      buttons:
        Save                :
          style             : "modal-clean-gray"
          type              : "submit"
          loader            :
            color           : "#444444"
            diameter        : 12
        Cancel              :
          style             : "modal-clean-gray"
          loader            :
            color           : "#ffffff"
            diameter        : 16
          callback          : -> modal.destroy()
      fields:
        "Avatar"              :
          label             : "Avatar"
          cssClass        : 'avatar'
          limit           : 1
          preview         : "thumbs"
          extensions      : null
          fileMaxSize     : 2048
          totalMaxSize    : 2048
          fieldName       : "thumbnails"
          convertToBlob   : yes
          title           : ""
          itemClass         : KDImageUploadView
          actions         : {
            big    :
              [
                'scale', {
                  shortest: 400
                }
                'crop', {
                  width   : 400
                  height  : 400
                }
              ]
            medium         :
              [
                'scale', {
                  shortest: 200
                }
                'crop', {
                  width   : 200
                  height  : 200
                }
              ]
            small         :
              [
                'scale', {
                  shortest: 60
                }
                'crop', {
                  width   : 60
                  height  : 60
                }
              ]
          }
        Title               :
          label             : "Group Name"
          itemClass         : KDInputView
          name              : "title"
          keydown           : (pubInst, event)=>
            value = @settingsForm.inputs.Title.getValue()
            setTimeout =>
              slug = @utils.slugify @settingsForm.inputs.Title.getValue()
              @settingsForm.inputs.Slug.setValue slug
            , 1
          defaultValue      : Encoder.htmlDecode group.title ? ""
          placeholder       : 'Please enter a title here'
        Slug :
          itemClass         : KDInputView
          label             : 'Path'
          name              : "slug"
          defaultValue      : group.slug ? ""
          placeholder       : 'This value will be automatically generated'
        Description         :
          label             : "Description"
          type              : "textarea"
          itemClass         : KDInputView
          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, @getData()

    avatarUploadView = @settingsForm.inputs["Avatar"]
    avatarUploadView.on 'FileReadComplete', ({file, progressEvent})->
      log 'read'
      avatarUploadView.$('.kdfileuploadarea').css
        backgroundImage : "url(#{file.data})"
      avatarUploadView.$('span').addClass 'hidden'

    avatarUploadView.on 'FileUploadComplete', (res)=>
      log 'upload',res
      if res.length and res[0].resource
        @customUrl = res[0].resource

    # avatarUploadView.on 'FileUploadComplete', (files)->
    #   for {filename, resource} in files
    #     console.log {filename, resource}



  viewAppended:->
    super

  pistachio:->
    """
    {{> @settingsForm}}
    """<commit_msg>removed avatar from group dashboard settings view<commit_after>class GroupGeneralSettingsView extends JView

  constructor:->

    super

    @setClass "general-settings-view group-admin-modal"

    group = @getData()

    unless group?
      group = {}
      isNewGroup = yes
    isPrivateGroup = 'private' is group.privacy

    _updateGroupHandler =(group, formData)=>
      group.modify formData, (err)->
        if err
          new KDNotificationView
            title: err.message
            duration: 1000
        else
          new KDNotificationView
            title: 'Group was updated!'
            duration: 1000

    formOptions =
      title: if isNewGroup then 'Create a group' else 'Edit group'
      callback:(formData)=>
        if isNewGroup
          _createGroupHandler.call @, formData
        else
          _updateGroupHandler group, formData
      buttons:
        Save                :
          style             : "modal-clean-gray"
          type              : "submit"
          loader            :
            color           : "#444444"
            diameter        : 12
        Cancel              :
          style             : "modal-clean-gray"
          loader            :
            color           : "#ffffff"
            diameter        : 16
          callback          : -> modal.destroy()
      fields:
        Title               :
          label             : "Group Name"
          itemClass         : KDInputView
          name              : "title"
          keydown           : (pubInst, event)=>
            value = @settingsForm.inputs.Title.getValue()
            setTimeout =>
              slug = @utils.slugify @settingsForm.inputs.Title.getValue()
              @settingsForm.inputs.Slug.setValue slug
            , 1
          defaultValue      : Encoder.htmlDecode group.title ? ""
          placeholder       : 'Please enter a title here'
        Slug :
          itemClass         : KDInputView
          label             : 'Path'
          name              : "slug"
          defaultValue      : group.slug ? ""
          placeholder       : 'This value will be automatically generated'
        Description         :
          label             : "Description"
          type              : "textarea"
          itemClass         : KDInputView
          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, @getData()

  viewAppended:->
    super

  pistachio:->
    """
    {{> @settingsForm}}
    """
{'fraction_non_alphanumeric': 0.08264180970785495, 'fraction_numerical': 0.008298283505740594, 'mean_word_length': 1.102772466539197, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, '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': '681958', 'n_tokens_mistral': 2221, 'n_tokens_neox': 2096, 'n_words': 505}