blob: a00c0dd07f5eda837a626466196214fcf9bfc8f1 [file] [log] [blame]
{#-
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-#}
{% extends 'forgeimporters:templates/project_base.html' %}
{% block extra_js %}
{{super()}}
<script type="text/javascript">
function suggest_name() { // overrides base suggest_names
var $project_shortname = $('#project_shortname');
if (!manual) {
var name_or_url = $('#project_name').val().replace(/\s/g, '').toLowerCase();
name_or_url = name_or_url.replace(/\/$/, ''); // strip any trailing slash
var a = $('<a>', {href: name_or_url})[0]; // leverage DOM to parse URL
var project_name;
var old_style = a.hostname.match(/^(.*)\.googlecode\.com$/);
if (old_style) {
project_name = old_style[1];
} else {
var parts = a.pathname.split('/');
project_name = parts.pop();
}
$project_shortname.val(project_name);
}
$project_shortname.trigger('change');
}
</script>
{% endblock %}
{% block project_fields %}
<div class="grid-7">
<label>Google Project Name or URL</label>
</div>
<div class="grid-10">
<input id="project_name" name="project_name" value="{{c.form_values['project_name']}}" autofocus/>
<div id="project_name_error" class="error{% if not c.form_errors['project_name'] %} hidden{% endif %}">
{{c.form_errors['project_name']}}
</div>
</div>
<div class="grid-7" style="clear:left">
<label>{{config.site_name}} URL Name</label>
</div>
<div class="grid-10">
<input id="project_shortname" name="project_shortname" value="{{c.form_values['project_shortname']}}"/>
<div id="project_shortname_error" class="error{% if not c.form_errors['project_shortname'] %} hidden{% endif %}">
{{c.form_errors['project_shortname']}}
</div>
<div id="project-url">
http://{{request.environ['HTTP_HOST']}}{{importer.neighborhood.url()}}<span id="url-fragment">{{c.form_values['project_shortname']}}</span>
</div>
</div>
{% endblock %}