Source

ekkli-maps / templates / add_story_dialog.html

Full commit
{% load i18n %}
{% load filetransfers %}
{% block content %}
<script type="text/javascript">
    $(document).ready(function() {
        function clean_html_in_content() {
            var content = $("#id_content").val();
            while (content.indexOf("<br/>") >= 0) {
                content = content.replace("<br/>", "\n");
            }
            $("#id_content").val(content);
        }

        var DEFAULT_STORY_TYPE = "General";
        var date = $( "#id_schedule_date" ).val();
        $( "#id_schedule_date" ).datepicker({ "dateFormat": 'yy-mm-dd' }).datepicker('setDate', new Date(date));
    });

    function indicate_upload() {
        $("#preview").attr("src", "/static/img/indicator.gif");
        return true;
    }


    function handle_image_upload(image_url) {
        $("#id_image_url").val(image_url);
        $("#preview").attr("src", image_url);
    }

</script>
    <table width="80%" border="0" cellpadding="5">
        <tr>
            <td>
                {% trans "Title" %}:<br/>
                {{ form.title }}
            </td>
            <td>&nbsp;</td><td>&nbsp;</td>
            <td>
                {% trans "Type" %}:<br/>
                {{ form.story_type }}
            </td>
        </tr>
        <tr>
            <td>
                {% trans "Image" %}:<br/>
                {{ form.image_url }}<br/>

                <form action="{{ upload_url}}" onsubmit="return indicate_upload()" method="POST" enctype="multipart/form-data" target="upload_iframe">
                     {% csrf_token %}
                     {% render_upload_data upload_data %}
                     {{ upload_form.as_p }}<input type="submit" value="{% trans "Upload" %}">
                </form>

                <iframe name="upload_iframe" src="" style="display: none; height: 0px; width:0px"></iframe>
            </td>
            <td>&nbsp;</td><td>&nbsp;</td>
            <td>
                {% trans "Due date" %}:<br/>
                {{ form.schedule_date }}
            </td>
        </tr>
        <tr>
            <td>
                {% trans "Image preview" %}:<br/>
                <img id="preview" width="280px" height="190px"/>
            </td>
            <td style="border-right: 1px solid">&nbsp;</td><td>&nbsp;</td>
            <td>
                {% trans "Content" %}:<br/>
                {{ form.content }}
            </td>
        </tr>
    </table>

{% endblock  %}