← Back to team overview

team4alfanous team mailing list archive

[Branch ~team4alfanous/alfanous/alfanous-git] Rev 484: choose page default options on server-side instead of client-side

 

------------------------------------------------------------
revno: 484
committer: Assem Chelli <assem.ch@xxxxxxxxx>
timestamp: Sat 2013-01-05 15:01:59 +0100
message:
  choose page default options on server-side instead of client-side
modified:
  src/alfanous-django/templates/base.html
  src/alfanous-django/templates/results.html
  src/alfanous-django/templates/wui.html
  src/alfanous-django/wui/static/js/hash.js


--
lp:alfanous
https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git

Your team Alfanous team is subscribed to branch lp:alfanous.
To unsubscribe from this branch go to https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git/+edit-subscription
=== modified file 'src/alfanous-django/templates/base.html'
--- src/alfanous-django/templates/base.html	2013-01-05 11:45:16 +0000
+++ src/alfanous-django/templates/base.html	2013-01-05 14:01:59 +0000
@@ -222,7 +222,7 @@
 	<tr>
 		<td style="background:url(/static/images/main_table_02.png) no-repeat;width:50px;height:26px"> </td>
 		<td style="background:url(/static/images/main_table_03.png) no-repeat;width:259px;height:26px">
-			<input id="search_box" name="query" class="enter keyboardInput" type="text" value="" />
+			<input id="search_box" name="query" class="enter keyboardInput" type="text" value="{{ params.query }}" />
 			</td>
 		<td style="background:url(/static/images/main_table_04.png) repeat scroll 0 0 transparent;width:62;height:26;text-align:right;">
 			<a class="button" href="" onclick="$('#form').submit(); return false;">{{ _("search") }}</a>
@@ -237,11 +237,11 @@
 
  
 
-<input type="checkbox"  name="fuzzy" value="True" {{ params.fuzzy|yesno:"checked,," }} /> 
+<input type="checkbox"  name="fuzzy" value="True" {{ params.fuzzy|yesno:"checked," }} /> 
 	<span class="xtitle">{{ _("Fuzzy search") }} </span> 
-<input type="checkbox" name="vocalized" value="False" {{ params.vocalized|yesno:"checked,," }} /> 
+<input type="checkbox" name="vocalized" value="False" {{ params.vocalized|yesno:"checked," }} /> 
 	<span class="xtitle">{{ _("Unvocalized text") }} </span>
-<input type="checkbox" name="script" value="uthmani" {{ params.script|yesno:"checked,," }} /> 
+<input type="checkbox" name="script" value="uthmani" {{ params.script|yesno:"checked," }} /> 
 	<span class="xtitle">{{ _("Uthmani script") }} </span>
 <br/>
 
@@ -271,24 +271,19 @@
 <br />
 <div class="xdrops_continer" style="direction:{{ bidi }}; text-align:right; width: 342px;">
 	<span class="xtitle">{{ _("View") }} :</span>
-	<select id="view" class="styled" name="view">
-		<option value="default">{{ _("Default") }}</option>
-		<option value="minimal">{{ _("Minimal") }}</option>
-		<option value="normal">{{ _("Normal") }}</option>
-		<option value="full">{{ _("Full") }}</option>
-		<option value="statistic">{{ _("Statitic") }}</option>
-		<option value="lingistic">{{ _("Linguistic") }}</option>
-		<option value="recitation">{{ _("Recitation") }}</option>
-	</select><br /><!--[if lte IE 8]><![endif]-->
-
-	<span class="xtitle">{{ _("Sorted by") }} :</span>
-	<select id="sortedby" class="styled" name="sortedby">
-		<option value="score">{{ _("Default") }}</option>
-		<option value="score">{{ _("Relevance") }}</option>
-		<option value="mushaf">{{ _("Mus'haf") }}</option>
-		<option value="tanzil">{{ _("Tanzil") }}</option>
-		<option value="subject">{{ _("Topics") }}</option>
-	</select><br /><!--[if lte IE 8]><![endif]-->
+	<select id="view" class="styled" name="view" >
+		<option value="default" {% ifequal params.view "default" %}selected{% endifequal %}>{{ _("Default") }}</option>
+		<option value="minimal" {% ifequal params.view "minimal" %}selected{% endifequal %}>{{ _("Minimal") }}</option>
+		<option value="normal" {% ifequal params.view "normal" %}selected{% endifequal %}>{{ _("Normal") }}</option>
+		<option value="full"{% ifequal params.view "full" %}selected{% endifequal %}>{{ _("Full") }}</option>
+		<option value="statistic"{% ifequal params.view "statistic" %}selected{% endifequal %}>{{ _("Statitic") }}</option>
+		<option value="linguistic"{% ifequal params.view "linguistic" %}selected{% endifequal %}>{{ _("Linguistic") }}</option>
+		<option value="recitation"{% ifequal params.view "recitation" %}selected{% endifequal %}>{{ _("Recitation") }}</option>
+	</select><br /><!--[if lte IE 8]><![endif]-->
+
+{% block sortedby_panel %}
+
+{% endblock %}
 
 {% block translations_panel %}
 

=== modified file 'src/alfanous-django/templates/results.html'
--- src/alfanous-django/templates/results.html	2013-01-05 00:20:31 +0000
+++ src/alfanous-django/templates/results.html	2013-01-05 14:01:59 +0000
@@ -4,7 +4,7 @@
 
 
 
-{% block title %} {{ _("Alfanous - Results to Query:") }}  {% endblock %}  
+{% block title %} {{ _("Alfanous - Results to Query:") }}  {{ params.query }} {% endblock %}  
 
 
 {% block results %}
@@ -215,7 +215,6 @@
 						{% for aya_word in ayaresult_content.aya.text|space_split %}
 							{% spaceless %}
 								{% autoescape off %}
-									
 								  		{# TODO optimize this condition, any "in" operation? #}
 										{% if aya_word|first in "<ct> "|make_list  %}
 												{{ aya_word }} 
@@ -277,7 +276,9 @@
 					  {% if ayaresult_content.aya.translation %}
 					  		<p dir='ltr' align='center' >
 					  		<span class="quran_translation">
+					  		{% autoescape off %}
 					  		  {{ ayaresult_content.aya.translation }} 
+					  		{% endautoescape %}
 					  		</span></p>
 					  		<br />
 					  {% endif %}

=== modified file 'src/alfanous-django/templates/wui.html'
--- src/alfanous-django/templates/wui.html	2013-01-04 20:03:59 +0000
+++ src/alfanous-django/templates/wui.html	2013-01-05 14:01:59 +0000
@@ -62,13 +62,24 @@
 	</div>
 {% endblock %}
 
+{% block sortedby_panel %}
+	<span class="xtitle">{{ _("Sorted by") }} :</span>
+	<select id="sortedby" class="styled" name="sortedby">
+		<option value="score" {% ifequal params.sortedby "score" %}selected{% endifequal %}>{{ _("Relevance") }}</option>
+		<option value="mushaf" {% ifequal params.sortedby "mushaf" %}selected{% endifequal %}>{{ _("Mus'haf") }}</option>
+		<option value="tanzil" {% ifequal params.sortedby "tanzil" %}selected{% endifequal %}>{{ _("Tanzil") }}</option>
+		<option value="subject" {% ifequal params.sortedby "subject" %}selected{% endifequal %}>{{ _("Topics") }}</option>
+		<option value="ayalength" {% ifequal params.sortedby "ayalength" %}selected{% endifequal %}>{{ _("Ayah length") }}</option>
+	</select><br /><!--[if lte IE 8]><![endif]-->
+{% endblock %}
+
 {% block translations_panel %}
 	<span class="xtitle">&nbsp;&nbsp;&nbsp; {{ _("Translation:") }} :</span>
 	<select id="translation" class="styled" name="translation">
-					<option value="en.shakir">{{ _("Default") }}</option>
-					<option value="None">{{ _("No translation") }}</option>
+					<option value="en.transliteration">{{ _("Default") }}</option>
+					<option value="None" {% ifequal params.translation "None" %}selected{% endifequal %}>{{ _("No translation") }}</option>
 					{% for translation_id, translation_name in info.show.translations.items %}
-					<option value="{{ translation_id }}">{{ translation_name }}</option>
+					<option value="{{ translation_id }}" {% ifequal params.translation translation_id %}selected{% endifequal %}>{{ translation_name }}</option>
 					{% endfor %}
 	</select><br /><!--[if lte IE 8]><![endif]-->
 {% endblock %}
@@ -77,10 +88,10 @@
 	<span class="xtitle">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {{ _("Recitation:") }}</span>
 	<select id="recitation" class="styled" name="recitation">
 		<option value="14">{{ _("Default") }}</option>
-		<option value="0">{{ _("No recitation") }}</option>
+		<option value="0" {% ifequal params.recitation "0" %}selected{% endifequal %}>{{ _("No recitation") }}</option>
 		{% for recitation_id, recitation_details in info.show.recitations.items %}
 			{% if recitation_id != "ayahCount" %}
-					<option value="{{ recitation_id }}">{{ recitation_details.name }} - {{ recitation_details.bitrate }} </option>
+					<option value="{{ recitation_id }}" {% ifequal params.recitation recitation_id %}selected{% endifequal %}>{{ recitation_details.name }} - {{ recitation_details.bitrate }} </option>
 			{% endif %}
 		{% endfor %}
 	</select><br /><!--[if lte IE 8]><![endif]-->

=== modified file 'src/alfanous-django/wui/static/js/hash.js'
--- src/alfanous-django/wui/static/js/hash.js	2013-01-01 10:02:08 +0000
+++ src/alfanous-django/wui/static/js/hash.js	2013-01-05 14:01:59 +0000
@@ -5,7 +5,7 @@
 hash_sep = ',';
 hash_kv_sep = ':';
 // hash_encode = [ ' ',  '#',   ',',   ':',   ];
-// hash_decode = [ '+',  '%23', '%2C', '%3A', ];
+// hash_decode = [ '%20',  '%23', '%2C', '%3A', ];
 
 defaultParams = {
 		  action:"search",
@@ -120,12 +120,12 @@
 function set_search_params ( params ) {
 	// parent.location.hash = build_hash ( params );
 	// window.location = get_url_without_params () + "?" + build_params ( params );
-	$("#search_box").val( params.query );
-	$("#recitation").val( params.recitation ); 
-	$("#translation").val( params.translation );
-	$("#sortedby").val( params.sortedby );
-	$("#view").val( params.view );
-	document.title = "الفانوس | نتائج البحث عن: " + params.query;
+	//$("#search_box").val( params.query );
+	//$("#recitation").val( params.recitation ); 
+	//$("#translation").val( params.translation );
+	//$("#sortedby").val( params.sortedby );
+	//$("#view").val( params.view );
+	
 }
 
 function redirect_to_params ( params ) {