<commit_before>[[ define "createDiscussionPage" ]]
<!doctype html>
<html ng-app="DBHub" ng-controller="createDiscussionView">
[[ template "head" . ]]
<body>
[[ template "header" . ]]
<div style="margin-left: 2%; margin-right: 2%; padding-left: 2%; padding-right: 2%;">
    [[ template "headerdatabase" . ]]
    <div class="row">
        <div class="col-md-1" style="padding: 0;">&nbsp;</div>
        <div class="col-md-10" style="text-align: center;">
            <h2 style="text-align: center;">Create a new discussion</h2>
            <form action="/x/creatediscuss" method="post">
                <table class="table table-striped table-responsive settingsTable">
                    <tr>
                        <th style="vertical-align: middle;" width="25%">Title:</th>
                        <td>
                            <input id="title" name="title" size="50" maxlength="80"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="vertical-align: top;">
                            <b>Description</b><br /><br />
                            <i>Markdown (<a href="http://commonmark.org" target="_blank">CommonMark</a> format) is supported</i></td>
                        <td>
                            <div>
                                <uib-tabset active="active">
                                    <uib-tab index="0">
                                        <uib-tab-heading><span style="color: #555;">Edit</span></uib-tab-heading>
                                        <textarea id="disctxt" name="disctxt" rows="10" ng-attr-placeholder="Type in the discussion details then click the 'Create it' button"></textarea>
                                    </uib-tab>
                                    <uib-tab index="1" select="getMarkdown()">
                                        <uib-tab-heading><span style="color: #555;">Preview</span></uib-tab-heading>
                                        <div class="rendered minHeight" ng-bind-html="markDownPreview"></div>
                                    </uib-tab>
                                </uib-tabset>
                            </div>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
        <div class="row">
            <div class="col-md-12" style="text-align: center; padding-top: 10px; padding-bottom: 15px;">
                <input type="hidden" name="dbname" value="[[ .Meta.Database ]]">
                <input type="hidden" name="folder" value="/">
                <input type="hidden" name="username" value="[[ .Meta.Owner ]]">
                <input type="button" class="btn btn-default" value="Cancel" ng-click="cancelCreate()">
                <input type="submit" class="btn btn-primary" value="Create">
            </div>
        </div>
    </div>
</div>
[[ template "footer" . ]]
<script>
    var app = angular.module('DBHub', ['ui.bootstrap', 'ngSanitize']);
    app.controller('createDiscussionView', function($scope, $http, $httpParamSerializerJQLike) {
        $scope.meta = {
            [[ if .Meta.LoggedInUser ]]
                Loggedin: "true",
            [[ else ]]
                Loggedin: "false",
            [[ end ]]
        };

        // Handler for the cancel button.  Just bounces back to the commits page
        $scope.cancelCreate = function() {
            window.location = "/discuss/[[ .Meta.Owner ]]/[[ .Meta.Database ]]";
        };

        // Render markdown preview
        $scope.markDownPreview = "";
        $scope.getMarkdown = function() {
            // Retrieve latest markdown text from the text area
            var txt = document.getElementById("disctxt").value;

            // Call the server, asking for a rendered version of the markdown
            $http({
                method: "POST",
                url: "/x/markdownpreview/",
                data: $httpParamSerializerJQLike({"mkdown": encodeURIComponent(txt)}),
                headers: { "Content-Type" : "application/x-www-form-urlencoded" }
            }).then(function (response) { $scope.markDownPreview = response.data; });
        };

        // Auth0
        var lock = new Auth0Lock("[[ .Auth0.ClientID ]]", "[[ .Auth0.Domain ]]", { auth: {
            redirectUrl: "[[ .Auth0.CallbackURL]]"
        }});
        $scope.showLock = function() {
            lock.show();
        };

        [[ template "script_headerdatabase" . ]]
    });
</script>
</body>
</html>
[[ end ]]
<commit_msg>webui: Fix starting new discussions<commit_after>[[ define "createDiscussionPage" ]]
<!doctype html>
<html ng-app="DBHub" ng-controller="createDiscussionView">
[[ template "head" . ]]
<body>
[[ template "header" . ]]
<div style="margin-left: 2%; margin-right: 2%; padding-left: 2%; padding-right: 2%;">
    [[ template "headerdatabase" . ]]
    <div class="row">
        <div class="col-md-1" style="padding: 0;">&nbsp;</div>
        <div class="col-md-10" style="text-align: center;">
            <h2 style="text-align: center;">Create a new discussion</h2>
            <form action="/x/creatediscuss" method="post">
                <table class="table table-striped table-responsive settingsTable">
                    <tr>
                        <th style="vertical-align: middle;" width="25%">Title:</th>
                        <td>
                            <input id="title" name="title" size="50" maxlength="80"/>
                        </td>
                    </tr>
                    <tr>
                        <td style="vertical-align: top;">
                            <b>Description</b><br /><br />
                            <i>Markdown (<a href="http://commonmark.org" target="_blank">CommonMark</a> format) is supported</i></td>
                        <td>
                            <div>
                                <uib-tabset active="active">
                                    <uib-tab index="0">
                                        <uib-tab-heading><span style="color: #555;">Edit</span></uib-tab-heading>
                                        <textarea id="disctxt" name="disctxt" rows="10" ng-attr-placeholder="Type in the discussion details then click the 'Create it' button"></textarea>
                                    </uib-tab>
                                    <uib-tab index="1" select="getMarkdown()">
                                        <uib-tab-heading><span style="color: #555;">Preview</span></uib-tab-heading>
                                        <div class="rendered minHeight" ng-bind-html="markDownPreview"></div>
                                    </uib-tab>
                                </uib-tabset>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div style="text-align: center;">
                                <input type="hidden" name="dbname" value="[[ .Meta.Database ]]">
                                <input type="hidden" name="folder" value="/">
                                <input type="hidden" name="username" value="[[ .Meta.Owner ]]">
                                <input type="button" class="btn btn-default" value="Cancel" ng-click="cancelCreate()">
                                <input type="submit" class="btn btn-primary" value="Create">
                            </div>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>
[[ template "footer" . ]]
<script>
    var app = angular.module('DBHub', ['ui.bootstrap', 'ngSanitize']);
    app.controller('createDiscussionView', function($scope, $http, $httpParamSerializerJQLike) {
        $scope.meta = {
            [[ if .Meta.LoggedInUser ]]
                Loggedin: "true",
            [[ else ]]
                Loggedin: "false",
            [[ end ]]
        };

        // Handler for the cancel button.  Just bounces back to the commits page
        $scope.cancelCreate = function() {
            window.location = "/discuss/[[ .Meta.Owner ]]/[[ .Meta.Database ]]";
        };

        // Render markdown preview
        $scope.markDownPreview = "";
        $scope.getMarkdown = function() {
            // Retrieve latest markdown text from the text area
            var txt = document.getElementById("disctxt").value;

            // Call the server, asking for a rendered version of the markdown
            $http({
                method: "POST",
                url: "/x/markdownpreview/",
                data: $httpParamSerializerJQLike({"mkdown": encodeURIComponent(txt)}),
                headers: { "Content-Type" : "application/x-www-form-urlencoded" }
            }).then(function (response) { $scope.markDownPreview = response.data; });
        };

        // Auth0
        var lock = new Auth0Lock("[[ .Auth0.ClientID ]]", "[[ .Auth0.Domain ]]", { auth: {
            redirectUrl: "[[ .Auth0.CallbackURL]]"
        }});
        $scope.showLock = function() {
            lock.show();
        };

        [[ template "script_headerdatabase" . ]]
    });
</script>
</body>
</html>
[[ end ]]

{'fraction_non_alphanumeric': 0.15383781439722463, 'fraction_numerical': 0.007480485689505638, 'mean_word_length': 1.4567243675099868, 'pattern_counts': {'":': 2, '<': 147, '<?xml version=': 0, '>': 147, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7039864', 'n_tokens_mistral': 2522, 'n_tokens_neox': 2379, 'n_words': 515}