While cleaning up the Javascript includes in the nomcom app, it turns

out nomcom.js is included in the wrong pages, and on the pages it is
actually useful in, it's obsolete, so delete it together with the
obsoleted AJAX view and the other JS left-over cruft in nomcom/, this
fixes an include 404 and removes the remaining dependency on
jquery-1.5.1 apart from the Secretariat tools
 - Legacy-Id: 7097
This commit is contained in:
Ole Laursen 2014-01-10 14:06:36 +00:00
parent b78109ff34
commit ab382a726f
12 changed files with 11 additions and 152 deletions

View file

@ -603,11 +603,6 @@ class FeedbackForm(BaseNomcomForm, forms.ModelForm):
'confirmation',
'comments')
class Media:
js = ("/js/jquery-1.5.1.min.js",
"/js/nomcom.js", )
class FeedbackEmailForm(BaseNomcomForm, forms.Form):
email_text = forms.CharField(label='Email text', widget=forms.Textarea())
@ -621,11 +616,6 @@ class FeedbackEmailForm(BaseNomcomForm, forms.Form):
def save(self, commit=True):
create_feedback_email(self.nomcom, self.cleaned_data['email_text'])
class Media:
js = ("/js/jquery-1.5.1.min.js",
"/js/nomcom.js", )
class QuestionnaireForm(BaseNomcomForm, forms.ModelForm):
comments = forms.CharField(label='Questionnaire response from this candidate',
@ -661,19 +651,6 @@ class QuestionnaireForm(BaseNomcomForm, forms.ModelForm):
fields = ('positions',
'comments')
class Media:
admin_js = ['js/core.js',
"js/jquery.js",
"js/jquery.init.js",
'js/admin/RelatedObjectLookups.js',
"js/getElementsBySelector.js",
'js/SelectBox.js',
'js/SelectFilter2.js',
]
admin_js = ['%sadmin/%s' % (settings.STATIC_URL, url) for url in admin_js]
js = ["/js/jquery-1.5.1.min.js", "/js/nomcom.js"] + admin_js
class NomComTemplateForm(BaseNomcomForm, DBTemplateForm):
content = forms.CharField(label="Text", widget=forms.Textarea(attrs={'cols': '120', 'rows':'40', }))
fieldsets = [('Template content', ('content', )), ]

View file

@ -41,8 +41,6 @@ urlpatterns = patterns('ietf.nomcom.views',
url(r'^(?P<year>\d{4})/feedback/$', 'public_feedback', name='nomcom_public_feedback'),
url(r'^(?P<year>\d{4})/nominate/$', 'public_nominate', name='nomcom_public_nominate'),
url(r'^(?P<year>\d{4})/process-nomination-status/(?P<nominee_position_id>\d+)/(?P<state>[\w]+)/(?P<date>[\d]+)/(?P<hash>[a-f0-9]+)/$', 'process_nomination_status', name='nomcom_process_nomination_status'),
url(r'^ajax/position-text/(?P<position_id>\d+)/$', 'ajax_position_text', name='nomcom_ajax_position_text'),
)
# use the generic view from message

View file

@ -830,15 +830,3 @@ def edit_position(request, year, position_id=None):
'position': position,
'year': year,
'nomcom': nomcom}, RequestContext(request))
def ajax_position_text(request, position_id):
try:
position_text = Position.objects.get(id=position_id).initial_text
except Position.DoesNotExist:
position_text = ""
result = {'text': position_text}
json_result = json.dumps(result)
return HttpResponse(json_result, content_type='application/json')

View file

@ -21,10 +21,6 @@ table.nominees tr td {
{% block subtitle %} - Feedback{% endblock %}
{% block pagehead %}
{{ form.media }}
{% endblock %}
{% block nomcom_content %}
<p>Select a nominee from the list of nominees to provide input about that nominee.
@ -37,15 +33,6 @@ table.nominees tr td {
{% if nomcom|has_publickey %}
<div class="js-info">
Your browser has Javascript disabled. Please enable javascript and reload the page.
<script type="text/javascript">
(function ($) {
$(".js-info").hide();
})(jQuery);
</script>
</div>
<div class="content">
<div class="primary">
{% if form.errors %}<div class="info-message-error">Please correct the following errors</div>{% endif %}
@ -80,4 +67,4 @@ table.nominees tr td {
{% endif %}
{% endblock %}
{% endblock %}

View file

@ -2,11 +2,7 @@
{% load nomcom_tags %}
{% block subtitle %} - Provide feeback email{% endblock %}
{% block pagehead %}
{{ form.media }}
{% endblock %}
{% block subtitle %} - Provide feedback email{% endblock %}
{% block nomcom_content %}
@ -17,15 +13,6 @@
{% if nomcom|has_publickey %}
<div class="js-info">
Your browser has Javascript disabled. Please enable javascript and reload the page.
<script type="text/javascript">
(function ($) {
$(".js-info").hide();
})(jQuery);
</script>
</div>
<div>
{% if form.errors %}<div class="info-message-error">Please correct the following errors</div>{% endif %}
@ -42,4 +29,4 @@
{% endif %}
{% endblock %}
{% endblock %}

View file

@ -4,13 +4,8 @@
{% block subtitle %} - Nominate{% endblock %}
{% block pagehead %}
{{ form.media }}
{% endblock %}
{% block nomcom_content %}
{% if message %}
<div class="info-message-{{ message.0 }}">{{ message.1 }}</div>
{% endif %}
@ -28,4 +23,4 @@
</form>
{% endif %}
{% endblock %}
{% endblock %}

View file

@ -4,10 +4,6 @@
{% block subtitle %} - Quesionnaire Response{% endblock %}
{% block pagehead %}
{{ form.media }}
{% endblock %}
{% block nomcom_content %}
@ -17,15 +13,6 @@
{% if nomcom|has_publickey %}
<div class="js-info">
Your browser has Javascript disabled. Please enable javascript and reload the page.
<script type="text/javascript">
(function ($) {
$(".js-info").hide();
})(jQuery);
</script>
</div>
<div class="content">
{% if questionnaire_response %}
<h3>Questionnaire response:</h3>
@ -46,4 +33,4 @@
</div>
{% endif %}
{% endblock %}
{% endblock %}

View file

@ -22,10 +22,6 @@ table.nominees tr td {
{% block subtitle %} - Feedback{% endblock %}
{% block pagehead %}
{{ form.media }}
{% endblock %}
{% block nomcom_content %}
<p>Select a nominee from the list of nominees to provide input about that nominee.
@ -38,15 +34,6 @@ table.nominees tr td {
{% if nomcom|has_publickey %}
<div class="js-info">
Your browser has Javascript disabled. Please enable javascript and reload the page.
<script type="text/javascript">
(function ($) {
$(".js-info").hide();
})(jQuery);
</script>
</div>
<div class="content">
<div class="primary">
{% if form.errors %}<div class="info-message-error">Please correct the following errors</div>{% endif %}
@ -87,4 +74,4 @@ table.nominees tr td {
{% endif %}
{% endblock %}
{% endblock %}

View file

@ -4,13 +4,8 @@
{% block subtitle %} - Nominate{% endblock %}
{% block pagehead %}
{{ form.media }}
{% endblock %}
{% block nomcom_content %}
{% if message %}
<div class="info-message-{{ message.0 }}">{{ message.1 }}</div>
{% endif %}
@ -28,4 +23,4 @@
</form>
{% endif %}
{% endblock %}
{% endblock %}

View file

@ -395,11 +395,12 @@ span.fieldRequired {
transition-duration: 0.2s;
}
/* js styles */
.js-info {
background-color: #FFDD88;
.js-info { /* Javascript disabled box */
display: block;
background-color: #ffdd88;
border: 1px dashed red;
font-size: 1.2em;
padding: 1em 2em;
margin: 1em 0;
}

View file

@ -89,13 +89,6 @@ span.fieldRequired {
background-color: #ffcc66;
}
.js-info {
border: 1px dashed red;
padding: 1em 2em;
font-size: 1.2em;
background-color: #ffdd88;
}
th.sort a {
text-decoration: none;
color: white;

View file

@ -1,36 +0,0 @@
/*jslint vars: false, browser: true */
/*global jQuery */
(function ($) {
"use strict";
$.fn.nominateForm = function () {
return this.each(function () {
var $position = $("#id_position"),
$comments = $("#id_comments"),
baseurl = "/nomcom/ajax/position-text/";
$comments.change(function () {
$.ajax({
url: baseurl + $position.val() + '/',
type: 'GET',
cache: false,
async: true,
dataType: 'json',
success: function (response) {
$comments.text(response.text);
}
});
});
$position.change(function () {
$comments.trigger("change");
});
});
};
$(document).ready(function () {
$("#nominateform").nominateForm();
});
}(jQuery));