<commit_before><link rel="import" href="/resources/polymer/polymer/polymer.html">
<link rel="import" href="/resources/polymer/core-toolbar/core-toolbar.html">
<link rel="import" href="/resources/polymer/core-icons/core-icons.html">
<link rel="import" href="/resources/polymer/paper-fab/paper-fab.html">
<link rel="import" href="/resources/components/postal-lib.html">
<link rel="import" href="/resources/views/tg-menu-item-view.html">

<polymer-element name="tg-view" attributes="item autoLoad" vertical layout>
    <template>
        <style>
            core-toolbar {
                height: 100px;
                background-color: #0288D1;
                color: white;
                font-size: 24px;
            }
            core-toolbar::shadow #topBar {
                height: 100px;
            }
            paper-fab {
                position: absolute;
                z-index: 1;
                bottom: -28px;
                right: 20px;
                background-color: #fcfcfc;
                color: #666464;
            }
            .view {
                background-color: white;
            }
        </style>


        <core-toolbar slide-down>
            <div flex>{{item.title}}</div>
            <paper-fab icon="apps" on-tap="{{onShowMenuTap}}" scale-up></paper-fab>
        </core-toolbar>

        <tg-menu-item-view id="menuItemView" slide-up autoLoad?="{{autoLoad}}" item="{{item}}" on-menu-item-view-loaded="{{onMenuItemLoaded}}"></tg-menu-item-view>
    </template>
    <script>
        (function () {
            var statePushed = function (data) {
                postal.publish({
                    channel: "app",
                    topic: "state.pushed",
                    data: data
                });
            };
            Polymer({
                publish: {
                    autoLoad: {
                        reflect: true,
                        value: false
                    }
                },
                ready: function () {
                    var self = this;
                    postal.subscribe({
                        channel: this.item.title,
                        topic: "state.push",
                        callback: function (data, envelope) {
                            history.pushState(data.state);
                            if (!self.$.menuItemView.wasLoaded()) {
                                self.$.menuItemView.load();
                            } else {
                                statePushed(data);
                            }
                        }
                    });
                    postal.subscribe({
                        channel: this.item.title,
                        topic: "state.pop",
                        callback: function (data, envelope) {
                            postal.publish({
                                channel: "app",
                                topic: "state.poped",
                                data: data
                            });
                        }
                    });
                },
                onMenuItemLoaded: function (e, detail, source) {
                    statePushed({
                        state: [detail.title]
                    });
                },
                onShowMenuTap: function () {
                    this.fire("main-menu");
                }
            });
        })();
    </script>
</polymer-element><commit_msg>#134 Added scroll panel to the tg-view.<commit_after><link rel="import" href="/resources/polymer/polymer/polymer.html">
<link rel="import" href="/resources/polymer/core-toolbar/core-toolbar.html">
<link rel="import" href="/resources/polymer/core-icons/core-icons.html">
<link rel="import" href="/resources/polymer/paper-fab/paper-fab.html">
<link rel="import" href="/resources/components/postal-lib.html">
<link rel="import" href="/resources/views/tg-menu-item-view.html">

<polymer-element name="tg-view" attributes="item autoLoad" vertical layout>
    <template>
        <style>
            core-toolbar {
                height: 100px;
                background-color: #0288D1;
                color: white;
                font-size: 24px;
            }
            core-toolbar::shadow #topBar {
                height: 100px;
            }
            paper-fab {
                position: absolute;
                z-index: 1;
                bottom: -28px;
                right: 20px;
                background-color: #fcfcfc;
                color: #666464;
            }
            .view {
                background-color: white;
            }
            .scroll-panel {
                position: absolute;
                top: 100px;
                right: 0;
                bottom: 0;
                left: 0;
                overflow: auto;
            }
        </style>


        <core-toolbar slide-down>
            <div flex>{{item.title}}</div>
            <paper-fab icon="apps" on-tap="{{onShowMenuTap}}" scale-up></paper-fab>
        </core-toolbar>

        <div class="scroll-panel">
            <tg-menu-item-view id="menuItemView" slide-up autoLoad?="{{autoLoad}}" item="{{item}}" on-menu-item-view-loaded="{{onMenuItemLoaded}}"></tg-menu-item-view>
        </div>
    </template>
    <script>
        (function () {
            var statePushed = function (data) {
                postal.publish({
                    channel: "app",
                    topic: "state.pushed",
                    data: data
                });
            };
            Polymer({
                publish: {
                    autoLoad: {
                        reflect: true,
                        value: false
                    }
                },
                ready: function () {
                    var self = this;
                    postal.subscribe({
                        channel: this.item.title,
                        topic: "state.push",
                        callback: function (data, envelope) {
                            history.pushState(data.state);
                            if (!self.$.menuItemView.wasLoaded()) {
                                self.$.menuItemView.load();
                            } else {
                                statePushed(data);
                            }
                        }
                    });
                    postal.subscribe({
                        channel: this.item.title,
                        topic: "state.pop",
                        callback: function (data, envelope) {
                            postal.publish({
                                channel: "app",
                                topic: "state.poped",
                                data: data
                            });
                        }
                    });
                },
                onMenuItemLoaded: function (e, detail, source) {
                    statePushed({
                        state: [detail.title]
                    });
                },
                onShowMenuTap: function () {
                    this.fire("main-menu");
                }
            });
        })();
    </script>
</polymer-element>
{'fraction_non_alphanumeric': 0.1188091263216472, 'fraction_numerical': 0.007929883138564273, 'mean_word_length': 0.9798953456348114, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, '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': '7061825', 'n_tokens_mistral': 1845, 'n_tokens_neox': 1667, 'n_words': 303}