Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Commit

Permalink
small fixes from bug_526468 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocharpineljr committed Aug 15, 2012
1 parent 2eda785 commit 4beef88
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 25 deletions.
7 changes: 4 additions & 3 deletions ispdb/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ def __unicode__(self): return self.url


class EnableURLInst(models.Model):
instruction = models.TextField(
max_length=100,
verbose_name="Instruction")
language = models.CharField(
max_length=10,
verbose_name="Language",
choices=settings.LANGUAGES)
instruction = models.CharField(
max_length=100,
verbose_name="Instruction")
enableurl = models.ForeignKey(EnableURL, related_name="instructions")

def __str__(self): return str(self.instruction)
Expand Down Expand Up @@ -487,6 +487,7 @@ class Meta:
def __init__(self, *args, **kwargs):
http_accept_language = kwargs.pop('http_accept_language', '')
super(EnableURLInstForm, self).__init__(*args, **kwargs)
self.fields['instruction'].widget.attrs.update({'rows': 2, 'cols': 20})
choices = []
# add HTTP_ACCEPTED_LANG first
if http_accept_language:
Expand Down
30 changes: 28 additions & 2 deletions ispdb/fixtures/xml_testdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"pk": 2,
"model": "config.docurldesc",
"fields": {
"docurl": 1,
"docurl": 2,
"description": "test",
"language": "en"
}
Expand All @@ -72,7 +72,7 @@
"pk": 3,
"model": "config.docurldesc",
"fields": {
"docurl": 1,
"docurl": 2,
"description": "test2",
"language": "fr"
}
Expand All @@ -93,5 +93,31 @@
"instruction": "test",
"language": "en"
}
},
{
"pk": 2,
"model": "config.enableurl",
"fields": {
"url": "http://test.com/",
"config": 1
}
},
{
"pk": 2,
"model": "config.enableurlinst",
"fields": {
"enableurl": 2,
"instruction": "test",
"language": "en"
}
},
{
"pk": 3,
"model": "config.enableurlinst",
"fields": {
"enableurl": 2,
"instruction": "test2",
"language": "fr"
}
}
]
3 changes: 1 addition & 2 deletions ispdb/templates/config/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ <h4>Enable Instructions</h4>
{% for inst in enableurl.inst_formset %}
<table class="tab_inst">
<tr>
<td>{{ inst.language.label }}:</td><td>{{ inst.language|data_verbose_field }}</td>
<td>{{ inst.instruction.label }}:</td><td>{{ inst.instruction.value }}</td>
<td>{{ inst.instruction.label }}:</td><td>{{ inst.instruction.value }}</td><td> {{ inst.language|data_verbose_field }}</td>
</tr>
</table>
{% endfor %}
Expand Down
32 changes: 16 additions & 16 deletions ispdb/templates/config/enter_config.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@
var check = $('#id_'+prefix+'-DELETE');
if (check.val() == "True"){
check.val("False");
$('#id_'+prefix+'-instruction').removeAttr("readonly");
$('#id_'+prefix+'-instruction').removeAttr("disabled");
$('#id_'+prefix+'-language').removeAttr("disabled");
$(this).text("Remove");
}else{
} else {
check.val("True");
$('#id_'+prefix+'-instruction').attr("readonly", "readonly");
$('#id_'+prefix+'-instruction').attr("disabled", "disabled");
$('#id_'+prefix+'-language').attr("disabled", "disabled");
$(this).text("Undo");
}
Expand All @@ -118,7 +118,7 @@
$('#id_'+prefix+'-url').removeAttr("readonly");
$(this).closest('tr').next().find('div').show();
$(this).text("Remove");
}else{
} else {
check.val("True");
$('#id_'+prefix+'-url').attr("readonly", "readonly");
$(this).closest('tr').next().find('div').hide();
Expand Down Expand Up @@ -310,7 +310,7 @@
</table></div></td></td></tr>
{% endwith %}
</table>
<textarea style="display:none" id="enableurl_template">
<table style="display:none" id="enableurl_template">
{% with config_form.enableurl_formset.empty_form as form %}
<tr>
<th class="noborder">{{ form.url.label_tag }}:</th>
Expand All @@ -321,37 +321,37 @@
</td>
</tr>
{% endwith %}
</textarea>
<textarea style="display:none" id="inst_template">
</table>
<table style="display:none" id="inst_template">
{% with config_form.enableurl_formset.empty_inst_form as form %}
<tr>
<th>{{ form.instruction.label_tag }}:</th>
<td>{{ form.language }}</td>
<td>{{ form.instruction }}</td>
<td>
{{ form.instruction }}
{{ form.language }}
{{ form.DELETE }}
<a class="link delete inst" value="{1}-{0}">Remove</a>
</td>
</tr>
{% endwith %}
</textarea>
<textarea style="display:none" id="inst_full_template">
</table>
<table style="display:none" id="inst_full_template">
{% with config_form.enableurl_formset.empty_inst_form as form %}
<tr><td class="noborder"><td class="noborder"><div id="{1}"><table class="tab_insts">
<input type="hidden" name="{1}-TOTAL_FORMS" value="1" id="id_{1}-TOTAL_FORMS" /><input type="hidden" name="{1}-INITIAL_FORMS" value="0" id="{1}-INITIAL_FORMS" /><input type="hidden" name="{1}-MAX_NUM_FORMS" id="id_{1}-MAX_NUM_FORMS" />
<tr>
<th>{{ form.instruction.label_tag }}:</th>
<td>{{ form.language }}</td>
<td>{{ form.instruction }}</td>
<td>
{{ form.instruction }}
{{ form.language }}
{{ form.DELETE }}
<a class="link delete inst" value="{1}-{0}">Remove</a>
</td>
</tr>
<tr><td><a class="link add_inst" value="{1}">add another instruction</a></td></tr>
</table></div></td></td></tr>
{% endwith %}
</textarea>
</table>

<form action="{{ callback }}" method="POST">{% csrf_token %}

Expand Down Expand Up @@ -497,9 +497,9 @@ <h3 class="hidden" id="problem">There are missing or incorrect values in the for
{{ inst_form.id }}
<tr>
<th>{{ inst_form.instruction.label_tag }}:</th>
<td>{{ inst_form.language.errors }}{{ inst_form.language }}</td>
<td>{{ inst_form.instruction.errors }}{{ inst_form.instruction }}</td>
<td>
{{ inst_form.instruction.errors }}{{ inst_form.instruction }}
{{ inst_form.language.errors }}{{ inst_form.language }}
{{ inst_form.DELETE }}
{% if inst_form.DELETE.value == "True" %}
<a class="link delete inst" value="{{inst_form.prefix}}">Undo</a>
Expand Down
3 changes: 1 addition & 2 deletions ispdb/templates/config/show_issue.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ <h4>Enable Instructions (only the suggested is shown)</h4>
<table class="tab_inst">
{% for inst in enableurl.inst_formset %}
<tr>
<td>{{ inst.language.label }}:</td><td>{{ inst.language|data_verbose_field }}</td>
<td>{{ inst.instruction.label }}:</td><td>{{ inst.instruction.value }}</td>
<td>{{ inst.instruction.label }}:</td><td>{{ inst.instruction.value }}</td><td> {{ inst.language|data_verbose_field }}</td>
</tr>
{% endfor %}
</table>
Expand Down

0 comments on commit 4beef88

Please sign in to comment.