Add checkbox to select/deselect project
authorverrierj
Wed, 31 Aug 2011 17:52:47 +0200
changeset 164 e6cd648f4f16
parent 163 ed5e74f89be0
child 165 a71757b03e89
Add checkbox to select/deselect project
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html
src/ldt/ldt/locale/fr/LC_MESSAGES/django.po
src/ldt/ldt/static/ldt/css/ldtform.css
src/ldt/ldt/static/ldt/js/projectscontents.js
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html	Wed Aug 31 16:33:03 2011 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/create_ldt.html	Wed Aug 31 17:52:47 2011 +0200
@@ -26,14 +26,14 @@
 			parent.$.nmTop().close();
 		});
 		
-		$("#check_all").click(function () {
-			$(".cellcheckbox input").attr('checked', true)
+		$("#check_projects").change(function () {
+			if ($("#check_projects").is(":checked")) {
+				$(".cellcheckbox input").attr('checked', 'true');
+			} else {
+				$(".cellcheckbox input").removeAttr('checked');
+			}
 		});
-		
-		$("#uncheck_all").click(function () {
-			$(".cellcheckbox input").attr('checked', false)
-		});	
-		
+				
 	});
 	</script>
 {% endblock %}
@@ -46,8 +46,7 @@
 	<input type="hidden" name="form_status" value="{{form_status}}" id="project_form_status" />
 	<label for="title">{% trans "Title" %}:</label>
 	{{form.title}}
-	<label>{% trans "List of contents" %}</label>
-	<a href="#" id="check_all">{% trans "Check all" %}</a> / <a href="#" id="uncheck_all">{% trans "Uncheck all" %}</a>
+	<label>{% trans "List of contents" %}</label>	
 	<div class="span-12 last projectscontentsdiv" id="ldtcreatecontentslistcontainer">
 		<div class="projectscontentsheader span-12 last" id="contentslistheader">{% trans "name" %}</div>
 		<div class="span-12 last projectscontentstablediv" id="ldtcreatecontentstablediv">
@@ -60,9 +59,14 @@
 				</tr>
 			{% endfor %}
 				</tbody>
-			</table>
+			</table>			
 		</div>
+		{% if not ldt_id %}
+			<input class="selectallprojects" style="width: 35px; text-align: center;" id="check_projects" type="checkbox" checked="true"/>	 
+		{% endif %}
+		
 	</div>
+	
 	<div id="submitcontent-buttons" class="span-12 last">
 		<button type="button" id="close_button"  value="close">{% trans 'close_cancel' %}</button>
 		{% if ldt_id %}
--- a/src/ldt/ldt/locale/fr/LC_MESSAGES/django.po	Wed Aug 31 16:33:03 2011 +0200
+++ b/src/ldt/ldt/locale/fr/LC_MESSAGES/django.po	Wed Aug 31 17:52:47 2011 +0200
@@ -7,7 +7,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-08-31 16:29+0200\n"
+"POT-Creation-Date: 2011-08-31 17:46+0200\n"
 "PO-Revision-Date: 2010-03-09 15:52+0100\n"
 "Last-Translator: Yves-Marie Haussonne <ymh.work@gmail.com>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -337,7 +337,7 @@
 msgstr "Le fichier média est en cours de traitement. Veuillez patienter."
 
 #: .\ldt_utils\templates\ldt\ldt_utils\create_content.html.py:124
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:67
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:71
 #: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:49
 msgid "close_cancel"
 msgstr "Fermer"
@@ -362,15 +362,7 @@
 msgid "List of contents"
 msgstr "Liste de contenus"
 
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:50
-msgid "Check all"
-msgstr "Cocher tout"
-
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:50
-msgid "Uncheck all"
-msgstr "Décocher tout"
-
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:52
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:51
 #: .\ldt_utils\templates\ldt\ldt_utils\partial\contentslist.html.py:3
 #: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:3
 #: .\ldt_utils\templates\ldt\ldt_utils\partial\publishedprojectslist.html.py:3
@@ -378,15 +370,15 @@
 msgid "name"
 msgstr "nom"
 
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:69
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:73
 msgid "delete_project"
 msgstr "Effacer"
 
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:70
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:74
 msgid "update_project"
 msgstr "Mettre à jour"
 
-#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:72
+#: .\ldt_utils\templates\ldt\ldt_utils\create_ldt.html.py:76
 msgid "create_project"
 msgstr "Créer un nouveau projet Ligne de Temps"
 
@@ -1204,6 +1196,12 @@
 "Nous vous avons envoyé par courriel les instructions pour activer le compte "
 "à l'adresse que vous avez indiquée. Vous devriez le recevoir rapidement."
 
+#~ msgid "Check all"
+#~ msgstr "Cocher tout"
+
+#~ msgid "Uncheck all"
+#~ msgstr "Décocher tout"
+
 #~ msgid "The language has been modified"
 #~ msgstr "La langue a été modifiée"
 
--- a/src/ldt/ldt/static/ldt/css/ldtform.css	Wed Aug 31 16:33:03 2011 +0200
+++ b/src/ldt/ldt/static/ldt/css/ldtform.css	Wed Aug 31 17:52:47 2011 +0200
@@ -110,6 +110,11 @@
 	width: 70 px;
 }
 
+.selectallprojects {
+	width: 35px;
+	text-align: center;
+}
+
 #contentslistheader {
 	padding: 1px 10px 1px 36px;	
 }
--- a/src/ldt/ldt/static/ldt/js/projectscontents.js	Wed Aug 31 16:33:03 2011 +0200
+++ b/src/ldt/ldt/static/ldt/js/projectscontents.js	Wed Aug 31 17:52:47 2011 +0200
@@ -243,12 +243,13 @@
                 nm.store.iframe.width(frameW);
                 nm.store.iframe.height(frameH);
             },
-            afterClose: function(nm) {
-            	searchCallback($('#searchprojectsinput'), "#contentslistcontainer", searchprojectfilterurl);
-            },
             close: function(nm) {
                 // We don't do anything here, we hack the callback directly from the close function.
             },
+            afterClose: function(nm) {
+                // Can't do that because searchprojectfilterurl is not defined in init_events_base params
+                searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
+            }
         }
     });