<commit_before>import Ember from 'ember';
import _ from "npm:lodash";
import hbs from 'htmlbars-inline-precompile';
import Fetcher from "../lib/fetcher";

export default Ember.Component.extend({

  authenticate:    Ember.inject.service(),
  session:         Ember.inject.service(),
  isAuthenticated: Ember.computed.alias('session.isAuthenticated'),

  jurisdictions: Ember.computed(function(){
    return Fetcher.find('jurisdiction', 'index')
  }),

  jurisdiction: Ember.computed('jurisdictionId', function(){
    return Fetcher.find('jurisdiction', this.get('jurisdictionId'))
  }),

  standardSet: Ember.computed('standardSetId', function(){
    return Fetcher.find('standardSet', this.get('standardSetId'))
  }),

  paneObserver: Ember.observer('pane', function(){
    $(window).scrollTop(0)
  }),

  scrollOnStart: Ember.on('didInsertElement', function(){
    $(window).scrollTop(0)
  }),



  actions: {
    signIn(){
      this.get('authenticate').showSignin()
    },
    showReset(){
      this.get('authenticate').logout()
    },
    selectJurisdiction(id){
      this.set('jurisdictionId', id)
      this.set('pane', 'jurisdiction')
    },
    selectStandardSet(id){
      this.set('standardSetId', id)
      this.set('pane', 'standard-set')
    },
    goToPane(pane){
      this.set('pane', pane)
    }
  },

  layout: hbs`
  {{partial "navbar"}}

  <div class="standards-edit">
    {{#if isAuthenticated}}
      <div class="standards-editor-panes show-{{pane}}">
        <div class="standards-editor-panes__inner">
          <div class="standards-editor-pane">
            <h1 class="standards-edit-pane__prompt">First, choose/create a State, Organization, or School/District</h1>
            {{#if jurisdictions._status.isFetching}}
              Loading...
            {{else}}
              {{jurisdiction-lists
                jurisdictions=jurisdictions
                newOrganization=newOrganization
                selectJurisdiction=(action 'selectJurisdiction') }}
            {{/if}}
          </div>

          <div class="standards-editor-pane">
            <h1 class="standards-edit-pane__prompt">
              <div class="standards-edit-pane__back" {{action "goToPane" "jurisdictions"}}>&larr; Back</div>
              Now, choose a set of standards</h1>
            {{#if jurisdiction._status.isFetching}}
              Loading...
            {{else}}
            {{standard-sets-list
              standardSets=jurisdiction.standardSets
              jurisdictionId=jurisdictionId
              selectStandardSet=(action 'selectStandardSet')
            }}
            {{/if}}
          </div>


          <div class="standards-editor-pane">
            <h1 class="standards-edit-pane__prompt">
              <div class="standards-edit-pane__back" {{action "goToPane" "jurisdiction"}}>&larr; Back</div>
              Standards Editor</h1>
          {{#if standardSet._status.isFetching}}
              Loading...
            {{else}}
            {{standard-set-editor
              standardSet=standardSet
              jurisdiction=jurisdiction
            }}
            {{/if}}
          </div>
          <div class="standards-editor-pane">
            <h1>Versions</h1>
            - list of versions
              with info about each version
          </div>
          <div class="standards-editor-pane">
            <h1>Version</h1>
            <h1>Approved?</h1>
          </div>

        </div>
      </div>
    {{else}}
      <div class="standards-edit-description">
        <h1 class="standards-edit-h1">
          Standards Creator & Editor
        </h1>
        <h2 class="standards-edit-h2">
          Are we missing standards you rely on? Has your school, district or charter network created their own custom standards? Add them to the database and make them searchable!<commit_msg>Edit copy for standards edit<commit_after>import Ember from 'ember';
import _ from "npm:lodash";
import hbs from 'htmlbars-inline-precompile';
import Fetcher from "../lib/fetcher";

export default Ember.Component.extend({

  authenticate:    Ember.inject.service(),
  session:         Ember.inject.service(),
  isAuthenticated: Ember.computed.alias('session.isAuthenticated'),

  jurisdictions: Ember.computed(function(){
    return Fetcher.find('jurisdiction', 'index')
  }),

  jurisdiction: Ember.computed('jurisdictionId', function(){
    return Fetcher.find('jurisdiction', this.get('jurisdictionId'))
  }),

  standardSet: Ember.computed('standardSetId', function(){
    return Fetcher.find('standardSet', this.get('standardSetId'))
  }),

  paneObserver: Ember.observer('pane', function(){
    $(window).scrollTop(0)
  }),

  scrollOnStart: Ember.on('didInsertElement', function(){
    $(window).scrollTop(0)
  }),



  actions: {
    signIn(){
      this.get('authenticate').showSignin()
    },
    showReset(){
      this.get('authenticate').logout()
    },
    selectJurisdiction(id){
      this.set('jurisdictionId', id)
      this.set('pane', 'jurisdiction')
    },
    selectStandardSet(id){
      this.set('standardSetId', id)
      this.set('pane', 'standard-set')
    },
    goToPane(pane){
      this.set('pane', pane)
    }
  },

  layout: hbs`
  {{partial "navbar"}}

  <div class="standards-edit">
    {{#if isAuthenticated}}
      <div class="standards-editor-panes show-{{pane}}">
        <div class="standards-editor-panes__inner">
          <div class="standards-editor-pane">
            <h1 class="standards-edit-pane__prompt">First, choose/create a State, Organization, or School/District</h1>
            {{#if jurisdictions._status.isFetching}}
              Loading...
            {{else}}
              {{jurisdiction-lists
                jurisdictions=jurisdictions
                newOrganization=newOrganization
                selectJurisdiction=(action 'selectJurisdiction') }}
            {{/if}}
          </div>

          <div class="standards-editor-pane">
            <h1 class="standards-edit-pane__prompt">
              <div class="standards-edit-pane__back" {{action "goToPane" "jurisdictions"}}>&larr; Back</div>
              Now, choose a set of standards</h1>
            {{#if jurisdiction._status.isFetching}}
              Loading...
            {{else}}
            {{standard-sets-list
              standardSets=jurisdiction.standardSets
              jurisdictionId=jurisdictionId
              selectStandardSet=(action 'selectStandardSet')
            }}
            {{/if}}
          </div>


          <div class="standards-editor-pane">
            <h1 class="standards-edit-pane__prompt">
              <div class="standards-edit-pane__back" {{action "goToPane" "jurisdiction"}}>&larr; Back</div>
              Standards Editor</h1>
          {{#if standardSet._status.isFetching}}
              Loading...
            {{else}}
            {{standard-set-editor
              standardSet=standardSet
              jurisdiction=jurisdiction
            }}
            {{/if}}
          </div>
          <div class="standards-editor-pane">
            <h1>Versions</h1>
            - list of versions
              with info about each version
          </div>
          <div class="standards-editor-pane">
            <h1>Version</h1>
            <h1>Approved?</h1>
          </div>

        </div>
      </div>
    {{else}}
      <div class="standards-edit-description">
        <h1 class="standards-edit-h1">
          Standards Creator & Editor
        </h1>
        <h2 class="standards-edit-h2">
          Are we missing standards you rely on? Found a typo? Has your school, district or charter network created their own custom standards? Add them to the database and make them searchable!
{'fraction_non_alphanumeric': 0.13962264150943396, 'fraction_numerical': 0.00494469746258946, 'mean_word_length': 2.2762148337595907, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 73, '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': '4531485', 'n_tokens_mistral': 2352, 'n_tokens_neox': 2217, 'n_words': 420}