<commit_before><link rel="import" href="journal-entry.html">

<dom-module id="journal-list">
    <style>
        .journals {
            overflow: auto;
            width: 40%;
            height: 400px;
        }
        ul {
            list-style: none;
            padding-left: 15px;
            padding-right: 15px;
        }

        li + li {
            border-top: solid 1px #666;
        }

        .new-journal {
            padding: 0px 15px 15px 15px;
        }

    </style>

    <template>
        <iron-signals
            on-iron-signal-fbupdate="_updateJournals">
        </iron-signals>

        <div style="padding:20px">
        <paper-material elevation=5 class="journals">
            <ul>
                <template id="jList" is="dom-repeat" items="{{journals}}" as="item">
                    <li>
                        <journal-entry
                            name="{{item.name}}"
                            text="{{item.text}}"
                            key="{{item.__firebaseKey__}}">
                        </journal-entry>
                    </li>
                </template>
            </ul>
            <div class="new-journal">
                <form is="iron-form" id="jform">
                    <paper-input id="name_field" name="name" label="New Title" required></paper-input>
                    <paper-textarea id="text_field" name="text" label="New Journal Entry" required></paper-textarea>
                    <paper-button id="sub_but" raised on-tap="_handleSubmit">Save</paper-button>
                    <div class="output"></div>
                </form>
                </div>
        </paper-material>
    </div>
    </template>

</dom-module>



<script>
    Polymer({
        is: "journal-list",

        _redraw: function() {
            this.$.jList.render();
        },

        properties: {
            scroll: "true",
            journals: {
                type: Array,
                notify: true
            }
        },

        _updateJournals: function(e) {
            this.journals = app.$.journal.fbData;
            this._redraw();
        },

        _handleSubmit: function(e) {
            var entry = this.$.jform.serialize();
            var appjournal = app.$.journal.$.ref;
            appjournal.add(entry);

            this.$.text_field.value = "";
            this.$.name_field.value = "";
        }

    });
</script><commit_msg>Fixed form submitting when empty<commit_after><link rel="import" href="journal-entry.html">

<dom-module id="journal-list">
    <style>
        .journals {
            overflow: auto;
            width: 40%;
            height: 400px;
        }
        ul {
            list-style: none;
            padding-left: 15px;
            padding-right: 15px;
        }

        li + li {
            border-top: solid 1px #666;
        }

        .new-journal {
            padding: 0px 15px 15px 15px;
        }

    </style>

    <template>
        <iron-signals
            on-iron-signal-fbupdate="_updateJournals">
        </iron-signals>

        <div style="padding:20px">
        <paper-material elevation=5 class="journals">
            <ul>
                <template id="jList" is="dom-repeat" items="{{journals}}" as="item">
                    <li>
                        <journal-entry
                            name="{{item.name}}"
                            text="{{item.text}}"
                            key="{{item.__firebaseKey__}}">
                        </journal-entry>
                    </li>
                </template>
            </ul>
            <div class="new-journal">
                <form is="iron-form" id="jform">
                    <paper-input id="name_field" name="name" label="New Title" required></paper-input>
                    <paper-textarea id="text_field" name="text" label="New Journal Entry" required></paper-textarea>
                    <paper-button id="sub_but" raised on-tap="_handleSubmit">Save</paper-button>
                    <div class="output"></div>
                </form>
                </div>
        </paper-material>
    </div>
    </template>

</dom-module>



<script>
    Polymer({
        is: "journal-list",

        _redraw: function() {
            this.$.jList.render();
        },

        properties: {
            scroll: "true",
            journals: {
                type: Array,
                notify: true
            }
        },

        _updateJournals: function(e) {
            this.journals = app.$.journal.fbData;
            this._redraw();
        },

        _handleSubmit: function(e) {
            if(!this.$.jform.validate()) return;
            var entry = this.$.jform.serialize();
            var appjournal = app.$.journal.$.ref;
            appjournal.add(entry);

            this.$.text_field.value = "";
            this.$.name_field.value = "";
        }

    });
</script>
{'fraction_non_alphanumeric': 0.1404081632653061, 'fraction_numerical': 0.009387755102040816, 'mean_word_length': 1.248165137614679, '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': '2350092', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1307, 'n_words': 243}