<commit_before><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-styles/typography.html">
<link rel="import" href="../../bower_components/paper-input/paper-input.html">
<link rel="import" href="../../bower_components/paper-fab/paper-fab.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../../bower_components/paper-listbox/paper-listbox.html">
<link rel="import" href="../../bower_components/paper-input/paper-input.html">
<link rel="import" href="../../bower_components/juicy-html/juicy-html.html">
<link rel="import" href="../behaviors/document-behavior.html">

<link rel="import" href="../yes-no/yes-no.html">
<link rel="import" href="../multiple-choice/multiple-choice.html">
<link rel="import" href="../content-video/content-video.html">
<link rel="import" href="../content-html/content-html.html">
<link rel="import" href="../content-button/content-button.html">

<dom-module id="create-badge">
  <template>
    <style include="shared-styles">
      :host {
        display: block;
      }

      span,
      input {
        @apply(--paper-font-body2);
      }

      .fab {
        position: fixed;
        bottom: 10px;
        right: 10px;
        z-index: 1;
      }
    </style>

    <iron-signals on-iron-signal-create="opened"></iron-signals>
    <iron-ajax id="getBadge"
      handle-as="json" on-response="badgeResponse" last-response="{{response}}" >
    </iron-ajax>

    <iron-ajax id="createBadge" handle-as="json" content-type="application/json"
      url="/api/badges" method="POST"
      on-response="handleCreateResponse">
    </iron-ajax>

    <iron-ajax id="updateBadge" handle-as="json" content-type="application/json"
      method="PUT" on-response="handleUpdateResponse">
    </iron-ajax>

    <h2 class="page-title">[[title]]</h2>

    <paper-input id="titleInput" placeholder="Title" label="Badge" value="{{badgeTitle}}" autofocus required></paper-input>

    <paper-dropdown-menu label="Badge Theme">
      <paper-listbox id="theme" class="dropdown-content" attr-for-selected="value" selected="{{badgeTheme}}" on-iron-select="selectTheme">
        <paper-item value="blue"><span class="swatch bg_blue"></span>Blue</paper-item>
        <paper-item value="green"><span class="swatch bg_green"></span>Green</paper-item>
        <paper-item value="pink"><span class="swatch bg_pink"></span>Pink</paper-item>
        <paper-item value="orange"><span class="swatch bg_orange"></span>Orange</paper-item>
      </paper-listbox>
    </paper-dropdown-menu>

    <paper-button on-tap="saveBadge" raised><iron-icon icon="save"></iron-icon>{{saveTitle}}</paper-button>

    <!-- <paper-button on-tap="_test" raised><iron-icon icon="bug-report"></iron-icon>test</paper-button> -->

    <div class="fab">
      <paper-fab label="y/n" on-tap="createYesNo"></paper-fab><br/>
      <paper-fab label="xyz" on-tap="createMultipleChoice"></paper-fab><br/>
      <paper-fab label="vid" on-tap="createVideo"></paper-fab><br/>
      <paper-fab label="T" on-tap="createHTML"></paper-fab><br/>
      <paper-fab label="B" on-tap="createButton"></paper-fab><br/>
    </div>

    <!-- dynamic elements go inside here -->
    <div id="components"></div>
  </template>



  <script>
    (function() {
      'use strict';

      Polymer({
        is: 'create-badge',
        properties: {
          _node : {
            type: Object,
            value: {<commit_msg>Added icons to the editor fabs<commit_after><!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-styles/typography.html">
<link rel="import" href="../../bower_components/paper-input/paper-input.html">
<link rel="import" href="../../bower_components/paper-fab/paper-fab.html">
<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../../bower_components/paper-listbox/paper-listbox.html">
<link rel="import" href="../../bower_components/paper-input/paper-input.html">
<link rel="import" href="../../bower_components/juicy-html/juicy-html.html">
<link rel="import" href="../../bower_components/iron-icons/av-icons.html">
<link rel="import" href="../behaviors/document-behavior.html">

<link rel="import" href="../yes-no/yes-no.html">
<link rel="import" href="../multiple-choice/multiple-choice.html">
<link rel="import" href="../content-video/content-video.html">
<link rel="import" href="../content-html/content-html.html">
<link rel="import" href="../content-button/content-button.html">

<dom-module id="create-badge">
  <template>
    <style include="shared-styles">
      :host {
        display: block;
      }

      span,
      input {
        @apply(--paper-font-body2);
      }

      .fab {
        position: fixed;
        bottom: 10px;
        right: 10px;
        z-index: 1;
      }
    </style>

    <iron-signals on-iron-signal-create="opened"></iron-signals>
    <iron-ajax id="getBadge"
      handle-as="json" on-response="badgeResponse" last-response="{{response}}" >
    </iron-ajax>

    <iron-ajax id="createBadge" handle-as="json" content-type="application/json"
      url="/api/badges" method="POST"
      on-response="handleCreateResponse">
    </iron-ajax>

    <iron-ajax id="updateBadge" handle-as="json" content-type="application/json"
      method="PUT" on-response="handleUpdateResponse">
    </iron-ajax>

    <h2 class="page-title">[[title]]</h2>

    <paper-input id="titleInput" placeholder="Title" label="Badge" value="{{badgeTitle}}" autofocus required></paper-input>

    <paper-dropdown-menu label="Badge Theme">
      <paper-listbox id="theme" class="dropdown-content" attr-for-selected="value" selected="{{badgeTheme}}" on-iron-select="selectTheme">
        <paper-item value="blue"><span class="swatch bg_blue"></span>Blue</paper-item>
        <paper-item value="green"><span class="swatch bg_green"></span>Green</paper-item>
        <paper-item value="pink"><span class="swatch bg_pink"></span>Pink</paper-item>
        <paper-item value="orange"><span class="swatch bg_orange"></span>Orange</paper-item>
      </paper-listbox>
    </paper-dropdown-menu>

    <paper-button on-tap="saveBadge" raised><iron-icon icon="save"></iron-icon>{{saveTitle}}</paper-button>

    <!-- <paper-button on-tap="_test" raised><iron-icon icon="bug-report"></iron-icon>test</paper-button> -->

    <div class="fab">
      <paper-fab label="y/n" on-tap="createYesNo"></paper-fab><br/>
      <paper-fab icon="icons:radio-button-checked" on-tap="createMultipleChoice"></paper-fab><br/>
      <paper-fab icon="av:videocam" on-tap="createVideo"></paper-fab><br/>
      <paper-fab icon="editor:format-color-text" on-tap="createHTML"></paper-fab><br/>
      <paper-fab icon="icons:link" on-tap="createButton"></paper-fab><br/>
    </div>

    <!-- dynamic elements go inside here -->
    <div id="components"></div>
  </template>



  <script>
    (function() {
      'use strict';

      Polymer({
        is: 'create-badge',
        properties: {
          _node : {
            type: Object,
            value: {
{'fraction_non_alphanumeric': 0.19061793070603644, 'fraction_numerical': 0.0028574830336944874, 'mean_word_length': 3.5751633986928106, 'pattern_counts': {'":': 0, '<': 170, '<?xml version=': 0, '>': 170, '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': '2224004', 'n_tokens_mistral': 2680, 'n_tokens_neox': 2575, 'n_words': 486}