<commit_before>{% extends "appstore/appstore_base.html" %}
{% load hq_shared_tags %}
{% load hqstyle_tags %}
{% load i18n %}


{% block sidebar %}
{% endblock %}

{% block breadcrumb %}
<li>{{ project.title }}</li>
{% endblock %}

{% block main_column %}

<div class="container-fluid">
<div class="page-header row-fluid" style="border-bottom: 0; margin-bottom: 0;">
<div class="span2" style="text-align: center;">
    {% if project.image_path %}
        <img class="app-pic" src="{% url appstore_project_image project.name %}" />
    {% else %}
        <img class="app-pic opacity65" src="{% static 'hqstyle/img/no-image-available.png' %}" />
    {% endif %}
</div>
    <div class="span7">
        <h1>
            {{ project.title }}
            <small>by
                {% if project.organization %}
                <a href="{% url orgs_landing project.organization %}">{{ project.organization_doc.title }}</a>
                {% else %}
                    {{ project.author }}
                {% endif %}
            </small>
        </h1>
        <h4 style="color: #808080;">{{ project.short_description }}</h4>
        <h3>
            Ratings: <span class="badge badge-info">{{ num_ratings }}</span>
        </h3>
            {% if average_rating %}
                {% include "partials/five_stars.html" with rating_name=average_rating rating=average_rating %}
            {% endif %}
    <br/>
    </div>
</div>
</div>
<dl class="dl-horizontal">
    <dt>{% trans 'Description' %}</dt>
    <dd>
        {% if project.description %}
            {{ project.description }}
        {% else %}
            <h6>None</h6>
        {% endif %}
    </dd>
    <dt>Category</dt>
    <dd>
        {% if project.project_type %}
            {{ project.project_type }}
        {% else %}
            <h6>None</h6>
        {% endif %}
    </dd>
    <dt> {% trans 'Published on' %}</dt>
    <dd>
        {{ project.snapshot_time|date:"N j, Y" }}
    </dd>
    {% if project.city %}
    <dt>City</dt>
    <dd>{{ project.city }}</dd>
    {% endif %}
    {% if project.country %}
    <dt>Country</dt>
    <dd>{{ project.country }}</dd>
    {% endif %}
    {% if project.region %}
    <dt>Region</dt>
    <dd>{{ project.region }}</dd>
    {% endif %}
    <dt>{% trans 'Languages' %}</dt>
    <dd>
        {% if project.languages %}
        {{ project.readable_languages }}
        {% else %}
        None
        {% endif %}
    </dd>
    <dt>License</dt>
    <dd>{{ project.get_license_display }}</dd>
    <dt>{% trans 'Downloads' %}</dt>
    <dd>
{#        This version: {{ project.copies|length }};#}
        <!-- All versions: -->{{ project.copies_of_parent|length }}
    </dd>
</dl>
<hr />
    <div id="application-accordion">
        {% for app in project.full_applications %}
            <div id="application-{{ app.id }}">
                <dl class="dl-horizontal">
                    <dd><h4>{{ app.name }}</h4></dd>
                    <dt>Media</dt>
                    <dd>
                        {{ app.has_media|yesno:"Yes,No" }}
                    </dd>
                    <dt>CommCare</dt>
                    <dd>
                        Version {{ app.application_version }}
                    </dd>
                    {% if app.user_type %}
                        <dt>User type</dt>
                        <dd>{{ app.user_type }}</dd>
                    {% endif %}
                    {% if app.phone_model %}
                        <dt>Phone model</dt>
                        <dd>{{ app.phone_model }}</dd>
                    {% endif %}
                    {% if app.short_description %}
                        <dt>{% trans 'Short Description' %}</dt>
                        <dd>
                            {{ app.short_description }}
                        </dd>
                    {% endif %}
                    {% if app.description %}
                        <dt>{% trans 'Long Description' %}</dt>
                        <dd>
                            {{ app.description }}
                        </dd>
                    {% endif %}
                    <dd><a class="btn" style="margin: .4em 0" href="{% url exchange_app_summary project app.id %}">Application summary</a></dd>
                </dl>
            </div>
        {% endfor %}
    </div>
    <div>
        <form method="post" class="form-inline" action="{% url domain_copy_snapshot project %}">
            <fieldset>
                <legend>Download project</legend>
                {% if project.attribution_notes %}
                    <dl>
                        <dt>Attribution notes</dt>
                        <dd>{{ project.attribution_notes }}</dd>
                    </dl>
                {% endif %}
                <div{% if error_message %} class="error"{% endif %}>
                    <input type="text" class="span3" id="new_project_name"
                           name="new_project_name" value="{{ new_project_name }}" placeholder="{% trans 'New project name' %}">
                    {% if error_message %}
                        <span class="help-inline">{{ error_message }}</span>
                    {% endif %}
                    <button type="submit" class="btn btn-primary">Create New Project</button>
                </div>

            </fieldset>
        </form>
    </div><commit_msg>implement client side functionality for letting users import apps into their own project<commit_after>{% extends "appstore/appstore_base.html" %}
{% load hq_shared_tags %}
{% load hqstyle_tags %}
{% load i18n %}

{% block js %}{{ block.super }}
    <script>
        function update_import_into_button() {
            var project = $('#project_select option:selected').text();
            $("#import-into-button").text("Import into " + project);
        }
        $(function () {
            update_import_into_button();

            $("#import-app-button").click(function() {
                $('#import-app').show(500);
            });

            $('#project_select').change(update_import_into_button);
        });
    </script>
{% endblock %}

{% block sidebar %}
{% endblock %}

{% block breadcrumb %}
<li>{{ project.title }}</li>
{% endblock %}

{% block main_column %}

<div class="container-fluid">
<div class="page-header row-fluid" style="border-bottom: 0; margin-bottom: 0;">
<div class="span2" style="text-align: center;">
    {% if project.image_path %}
        <img class="app-pic" src="{% url appstore_project_image project.name %}" />
    {% else %}
        <img class="app-pic opacity65" src="{% static 'hqstyle/img/no-image-available.png' %}" />
    {% endif %}
</div>
    <div class="span7">
        <h1>
            {{ project.title }}
            <small>by
                {% if project.organization %}
                <a href="{% url orgs_landing project.organization %}">{{ project.organization_doc.title }}</a>
                {% else %}
                    {{ project.author }}
                {% endif %}
            </small>
        </h1>
        <h4 style="color: #808080;">{{ project.short_description }}</h4>
        <h3>
            Ratings: <span class="badge badge-info">{{ num_ratings }}</span>
        </h3>
            {% if average_rating %}
                {% include "partials/five_stars.html" with rating_name=average_rating rating=average_rating %}
            {% endif %}
    <br/>
    </div>
</div>
</div>
<dl class="dl-horizontal">
    <dt>{% trans 'Description' %}</dt>
    <dd>
        {% if project.description %}
            {{ project.description }}
        {% else %}
            <h6>None</h6>
        {% endif %}
    </dd>
    <dt>Category</dt>
    <dd>
        {% if project.project_type %}
            {{ project.project_type }}
        {% else %}
            <h6>None</h6>
        {% endif %}
    </dd>
    <dt> {% trans 'Published on' %}</dt>
    <dd>
        {{ project.snapshot_time|date:"N j, Y" }}
    </dd>
    {% if project.city %}
    <dt>City</dt>
    <dd>{{ project.city }}</dd>
    {% endif %}
    {% if project.country %}
    <dt>Country</dt>
    <dd>{{ project.country }}</dd>
    {% endif %}
    {% if project.region %}
    <dt>Region</dt>
    <dd>{{ project.region }}</dd>
    {% endif %}
    <dt>{% trans 'Languages' %}</dt>
    <dd>
        {% if project.languages %}
        {{ project.readable_languages }}
        {% else %}
        None
        {% endif %}
    </dd>
    <dt>License</dt>
    <dd>{{ project.get_license_display }}</dd>
    <dt>{% trans 'Downloads' %}</dt>
    <dd>
{#        This version: {{ project.copies|length }};#}
        <!-- All versions: -->{{ project.copies_of_parent|length }}
    </dd>
</dl>
<hr />
    <div id="application-accordion">
        {% for app in project.full_applications %}
            <div id="application-{{ app.id }}">
                <dl class="dl-horizontal">
                    <dd><h4>{{ app.name }}</h4></dd>
                    <dt>Media</dt>
                    <dd>
                        {{ app.has_media|yesno:"Yes,No" }}
                    </dd>
                    <dt>CommCare</dt>
                    <dd>
                        Version {{ app.application_version }}
                    </dd>
                    {% if app.user_type %}
                        <dt>User type</dt>
                        <dd>{{ app.user_type }}</dd>
                    {% endif %}
                    {% if app.phone_model %}
                        <dt>Phone model</dt>
                        <dd>{{ app.phone_model }}</dd>
                    {% endif %}
                    {% if app.short_description %}
                        <dt>{% trans 'Short Description' %}</dt>
                        <dd>
                            {{ app.short_description }}
                        </dd>
                    {% endif %}
                    {% if app.description %}
                        <dt>{% trans 'Long Description' %}</dt>
                        <dd>
                            {{ app.description }}
                        </dd>
                    {% endif %}
                    <dd><a class="btn" style="margin: .4em 0" href="{% url exchange_app_summary project app.id %}">Application summary</a></dd>
                </dl>
            </div>
        {% endfor %}
    </div>
    <div>
        <form method="post" class="form-inline" action="{% url domain_copy_snapshot project %}">
            <fieldset>
                <legend>Download project</legend>
                {% if project.attribution_notes %}
                    <dl>
                        <dt>Attribution notes</dt>
                        <dd>{{ project.attribution_notes }}</dd>
                    </dl>
                {% endif %}
                <div{% if error_message %} class="error"{% endif %}>
                    <input type="text" class="span3" id="new_project_name"
                           name="new_project_name" value="{{ new_project_name }}" placeholder="{% trans 'New project name' %}">
                    {% if error_message %}
                        <span class="help-inline">{{ error_message }}</span>
                    {% endif %}
                    <button type="submit" class="btn btn-primary">Create New Project</button> or
                    <a class="btn" id="import-app-button">Import to Existing Project</a>
                    <div class="hide" style="margin-top: 1em" id="import-app">
                        <select name="project" id="project_select">
                            {% for p in request.couch_user.projects %}
                                <option value="{{ p.name }}">{{ p.display_name }}</option>
                            {% endfor %}
                        </select>
                        <button type="submit" id="import-into-button" class="btn btn-primary">Import into</button>
                    </div>
                </div>

            </fieldset>
        </form>
    </div>
{'fraction_non_alphanumeric': 0.1672006745362563, 'fraction_numerical': 0.005227655986509275, 'mean_word_length': 1.4365242399342646, 'pattern_counts': {'":': 0, '<': 271, '<?xml version=': 0, '>': 271, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2139313', 'n_tokens_mistral': 3692, 'n_tokens_neox': 3251, 'n_words': 684}