add a few more tests, use more url_for, don't be web2.0 with selects
This commit is contained in:
parent
46db573e3c
commit
3a2ba35e63
@ -76,7 +76,6 @@ class PasteController(object):
|
||||
code = parent.code
|
||||
language = parent.language
|
||||
private = parent.private
|
||||
|
||||
return render_to_response('new_paste.html',
|
||||
languages=list_languages(),
|
||||
parent=parent,
|
||||
|
@ -186,26 +186,5 @@ $(document).ready(function() {
|
||||
var ids = [];
|
||||
|
||||
var multiFileInfo = $('#multi-file-information').hide();
|
||||
|
||||
$('form.submitform select[name="language"] option').each(function() {
|
||||
ids.push($(this).val());
|
||||
languages.push($(this).text());
|
||||
});
|
||||
|
||||
var new_input = $('<input type="text" name="language" value="Text only">')
|
||||
.autocomplete(languages)
|
||||
.result(function(event, data) {
|
||||
if (data[0].toLowerCase().startsWith('multi'))
|
||||
multiFileInfo.fadeIn();
|
||||
else
|
||||
multiFileInfo.fadeOut('fast');
|
||||
})
|
||||
.click(function() { $(this).val(''); });
|
||||
$('form.submitform select[name="language"]').replaceWith($(new_input));
|
||||
|
||||
/* Bind a processable value to the input field on submitting */
|
||||
$('form.submitform').submit(function() {
|
||||
new_input.val(ids[$.inArray(new_input.val(), languages)]);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -5,7 +5,7 @@
|
||||
<ul id="help-navigation">
|
||||
{%- for topic, title in help_topics %}
|
||||
<li{% if current_topic == topic %} class="active"{% endif
|
||||
%}><a href="/help/{{ topic|e }}/">{{ title|e }}</a></li>
|
||||
%}><a href="{{ url_for('static/help', topic=topic) }}/">{{ title|e }}</a></li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
<div class="text">
|
||||
|
@ -26,6 +26,7 @@
|
||||
If you use the reply feature a link to the parent paste is created
|
||||
automatically. This allows you to compare those two pastes with one
|
||||
click to find changes easily. For information about the diff view
|
||||
head over to the <a href="/help/advanced/">advanced features</a> page.{% endtrans %}
|
||||
head over to the {% endtrans %}
|
||||
<a href="{{ url_for('static/help', topic='advanced') }}">{% trans %}advanced features{% endtrans %}</a> {% trans %}page.{% endtrans %}
|
||||
</p>
|
||||
{% endblock %}
|
||||
|
@ -61,10 +61,13 @@
|
||||
Welcome to the LodgeIt pastebin. In order to use the notification feature
|
||||
a 31 day cookie with an unique ID was created for you. The lodgeit database
|
||||
does not store any information about you, it's just used for an advanced
|
||||
pastebin experience :-). Read more on the <a href="/about/#privacy">about
|
||||
lodgeit</a> page. Have fun :-){%- endtrans -%}
|
||||
pastebin experience :-). Read more on the {% endtrans -%}
|
||||
<a href="{{ url_for('static/about') }}#privacy">{% trans %}about lodgeit{% endtrans %}</a>
|
||||
{%- trans %} page. Have fun :-){%- endtrans -%}
|
||||
</p>
|
||||
<p>
|
||||
<a href="javascript:LodgeIt.hideNotification()">{% trans %}hide this notification{% endtrans %}</a>
|
||||
</p>
|
||||
<p><a href="javascript:LodgeIt.hideNotification()">{% trans %}hide this notification{% endtrans %}</a></p>
|
||||
</div>
|
||||
{% endif -%}
|
||||
{% block body %}{% endblock -%}
|
||||
|
@ -3,42 +3,39 @@
|
||||
{% set active_page = 'new' %}
|
||||
{% block body %}
|
||||
<form action="{{url_for('pastes/new_paste')}}" method="post" class="submitform">
|
||||
{%- if error %}
|
||||
{% if error %}
|
||||
<div class="notification">
|
||||
<h3>{% trans %}Error While Pasting{% endtrans %}</h3>
|
||||
<p>{% trans error=error|e %}Could not submit your paste because {{ error }}.{% endtrans %}</p>
|
||||
{%- if show_captcha %}
|
||||
{% if show_captcha %}
|
||||
<div class="captcha">
|
||||
<p>{% trans %}Please fill out the CAPTCHA to proceed:{% endtrans %}</p>
|
||||
<img src="/_captcha.png" alt="{% trans %}a captcha you can't see. Sorry :({% endtrans %}">
|
||||
<input type="text" name="captcha" size="20">
|
||||
<input type="text" name="captcha" size="20" />
|
||||
</div>
|
||||
{%- else %}
|
||||
<p><a href="javascript:LodgeIt.hideNotification()">{% trans %}hide this message{% endtrans %}</a></p>
|
||||
{%- endif %}
|
||||
</div>
|
||||
{%- endif %}
|
||||
{%- if parent %}
|
||||
<input type="hidden" name="parent" value="{{ parent.identifier }}">
|
||||
{%- endif %}
|
||||
{% endif %}
|
||||
{% if parent %}
|
||||
<input type="hidden" name="parent" value="{{ parent.identifier }}" />
|
||||
{% endif %}
|
||||
<textarea name="code" rows="10" cols="80">{{ code|e }}</textarea>
|
||||
<select name="language">
|
||||
{%- for key, caption in languages %}
|
||||
<option value="{{ key }}"{% if language == key
|
||||
%} selected="selected"{% endif %}>{{ caption|e }}</option>
|
||||
{%- endfor %}
|
||||
{% for key, caption in languages %}
|
||||
<option value="{{ key }}"{% if language == key %} selected="selected"{% endif %}>{{ caption|e }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<input type="text" value="" name="webpage" id="webpage">
|
||||
<input type="submit" value="{% trans %}Paste!{% endtrans %}">
|
||||
<input type="button" value="▲" onclick="LodgeIt.resizeTextarea(-100)">
|
||||
<input type="button" value="▼" onclick="LodgeIt.resizeTextarea(100)">
|
||||
<input type="checkbox" name="private" id="private"{% if private
|
||||
%} checked{% endif %}> <label for="private">{% trans
|
||||
%}Paste private{% endtrans %}</label>
|
||||
<input type="checkbox" name="private" id="private"{% if private %} checked{% endif %}>
|
||||
<label for="private">{% trans %}Paste private{% endtrans %}</label>
|
||||
<span id="insert_tabs">
|
||||
<input type="checkbox" id="insert_tabs_input">
|
||||
<label for="insert_tabs_input">{% trans
|
||||
%}Tab-key inserts tabstops{% endtrans %}</label>
|
||||
<input type="checkbox" id="insert_tabs_input" />
|
||||
<label for="insert_tabs_input">{% trans %}Tab-key inserts tabstops{% endtrans %}</label>
|
||||
</span>
|
||||
<div id="multi-file-information">{% trans %}
|
||||
You have selected the multi-file highlighter. This highlighter allows
|
||||
|
@ -8,10 +8,9 @@
|
||||
</p>
|
||||
<ul class="paste_tree">
|
||||
{%- for paste in [paste] recursive %}
|
||||
<li{% if paste.identifier == current
|
||||
%} class="highlighted"{% endif %}><a href="{{ paste.url|e
|
||||
}}">Paste #{{ paste.identifier }}</a> — {{
|
||||
paste.pub_date|datetimeformat }}
|
||||
<li {% if paste.identifier == current %}
|
||||
class="highlighted"{% endif %}>
|
||||
<a href="{{ paste.url|e}}">Paste #{{ paste.identifier }}</a> — {{paste.pub_date|datetimeformat }}
|
||||
{%- if paste.children -%}
|
||||
<ul>{{ loop(paste.children) }}</ul>
|
||||
{%- endif -%}
|
||||
|
@ -2,3 +2,4 @@ from alfajor import APIClient
|
||||
|
||||
client = APIClient()
|
||||
client.configure_in_scope('default')
|
||||
|
||||
|
@ -1,17 +1,27 @@
|
||||
from tests import client
|
||||
|
||||
|
||||
def test_load_most_urls():
|
||||
rules = ['/',
|
||||
'/compare/',
|
||||
'/all/',
|
||||
'/all/1/',
|
||||
'/xmlrpc/',
|
||||
'/json/',
|
||||
'/about/',
|
||||
'/help/',
|
||||
'/help/json/',
|
||||
'/colorscheme/',
|
||||
'/language/es/']
|
||||
for rule in rules:
|
||||
client.get(rule)
|
||||
def test_get_urls():
|
||||
rules = [
|
||||
('/', 200),
|
||||
('/all/', 200),
|
||||
('/all/1/', 200),
|
||||
('/xmlrpc/', 200),
|
||||
('/json/', 200),
|
||||
('/about/', 200),
|
||||
('/help/', 200),
|
||||
('/help/advanced/', 200),
|
||||
('/help/api/', 200),
|
||||
('/help/integration/', 200),
|
||||
('/help/pasting/', 200),
|
||||
('/language/de/', 302),
|
||||
('/language/en/', 302),
|
||||
]
|
||||
for rule, code in rules:
|
||||
resp = client.get(rule)
|
||||
assert code == resp.status_code
|
||||
|
||||
|
||||
def test_post_url():
|
||||
resp = client.post('/')
|
||||
assert 200 == resp.status_code
|
||||
|
@ -3,7 +3,3 @@ from lodgeit.application import make_app
|
||||
|
||||
|
||||
foo = make_app('sqlite://', 'NONE', False, True)
|
||||
|
||||
|
||||
def setup():
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user