correct validation + css
authorymh <ymh.work@gmail.com>
Mon, 17 Jun 2013 05:14:43 +0200
changeset 8 ab84fda7d1f4
parent 7 001e8b9e6085
child 9 3799e12bdba3
correct validation + css
src/jocondelab/static/jocondelab/css/style.css
src/jocondelab/static/jocondelab/js/jocondelab.js
src/jocondelab/templates/jocondelab/term_edit.html
--- a/src/jocondelab/static/jocondelab/css/style.css	Sun Jun 16 21:55:39 2013 +0200
+++ b/src/jocondelab/static/jocondelab/css/style.css	Mon Jun 17 05:14:43 2013 +0200
@@ -422,6 +422,10 @@
 	text-align: right;
 }
 
+#term-list-table td {
+	padding: 2px;
+}
+
 .term-list-label {
 	width : 500px;
 }
@@ -443,14 +447,40 @@
     padding-right: 1px;
 }
 
+
+#wrapper {
+    width:1024px;
+    margin:0 auto 0 0;
+}
+
 #term-filter-top-container {
 	margin-bottom: 20px;
 }
 
 #term-explorer-container {
+	width: 580px;
 	float: left;
+	padding:10px;
 }
 
 #term-detail-container {
-	float: right;
+    width: 404px;
+    float: right;
+    padding:10px;
+}
+
+#tags_commands {
+	margin-bottom: 10px;
+}
+
+#term-table > tr > td:first-child {
+	padding-right:10px;
+}
+
+#edition-wk > td > span {
+	margin-right:10px;
+}
+
+#info-wk > td > span {
+    margin-right:10px;
 }
\ No newline at end of file
--- a/src/jocondelab/static/jocondelab/js/jocondelab.js	Sun Jun 16 21:55:39 2013 +0200
+++ b/src/jocondelab/static/jocondelab/js/jocondelab.js	Mon Jun 17 05:14:43 2013 +0200
@@ -57,18 +57,18 @@
         }
     });
     // Validate sheet management : the radiobutton name has is "'gr_validated' + datasheet.hda_id"
-    $("#validated").click(function(e){
+    $("input[type='radio'][name='gr_validated']").click(function(e){
         e.preventDefault();
-        if(confirm("Confirmez-vous la validation de ce terme ?")){
-            $.post(validate_term_url,{term_id: term_id, validation_val: 'True', csrfmiddlewaretoken: global_csrf_token},function(data) {
-                window.location.reload(true);
-            });
+        console.log(e);
+        val = $("input[type='radio'][name='gr_validated']:checked").val();
+        if(val === 'True') {
+            msg = "Confirmez-vous la validation de ce terme ?";            
         }
-    });
-    $("#not_validated").click(function(e){
-        e.preventDefault();
-        if(confirm("Confirmez-vous l'invalidation de cette fiche ?")){
-            $.post(validate_term_url,{term_id: term_id, validation_val: 'False', csrfmiddlewaretoken: global_csrf_token},function(data) {
+        else {
+            msg = "Confirmez-vous l'invalidation de cette fiche ?"
+        }
+        if(confirm(msg)) {
+            $.post(validate_term_url,{term_id: term_id, validation_val: val, csrfmiddlewaretoken: global_csrf_token},function(data) {
                 window.location.reload(true);
             });
         }
@@ -130,4 +130,13 @@
     });
 }
 
+function init_filter_events() {
+    $('#term-filter-form').submit(function(){
+        var values = $('#term-filter-form').serialize();
+        $('#term-explorer-container').load(term_list_table_url, values, function() {
+            $('#term-list-table #term-'+term_id).addClass('currenttermline');
+        });
+        return false;
+    });
+}
 
--- a/src/jocondelab/templates/jocondelab/term_edit.html	Sun Jun 16 21:55:39 2013 +0200
+++ b/src/jocondelab/templates/jocondelab/term_edit.html	Mon Jun 17 05:14:43 2013 +0200
@@ -19,13 +19,7 @@
     
     $(document).ready(function(){
         init_term_events();
-        $('#term-filter-form').submit(function(){
-            var values = $('#term-filter-form').serialize();
-            $('#term-explorer-container').load(term_list_table_url, values, function() {
-                $('#term-list-table #term-'+term_id).addClass('currenttermline');
-            });
-            return false;
-        });
+        init_filter_events();
         $('#term-filter-form').submit();
     });
     
@@ -53,6 +47,7 @@
 
 
 {% block content %}
+<div id="wrapper">
 <div id="filter-container">
 {% include "jocondelab/partial/filter.html" %}
 </div>
@@ -60,9 +55,9 @@
 <div id='term-explorer-container'>
 </div>
 <div id="term-detail-container">
-<div id="tags_commands" style="float:left;width: 100%" >
-    <div style="float:left;"><input type="radio" name="gr_validated{{term.id}}" id="not_validated" value="not_validated" {% if not term.validated %}checked{% endif %}/>En cours
-    <input type="radio" name="gr_validated{{term.id}}" id="validated" value="validated" {% if term.validated %}checked{% endif %} />Validé
+<div id="tags_commands">
+    <div><input type="radio" name="gr_validated" id="not_validated{{term.id}}" value="False" {% if not term.validated %}checked{% endif %}/>En cours
+    <input type="radio" name="gr_validated" id="validated{{term.id}}" value="True" {% if term.validated %}checked{% endif %} />Validé
     {% if term.validated %}
     par {{term.validator.username}} le {{term.validation_date|date:"d/m/Y"}}
     {% endif %}
@@ -70,52 +65,55 @@
     {% csrf_token %}
 </div>
 
-<table>
+<table id="term-table">
     <tr>
-        <td>{% trans 'Term label' %}</td>
+        <td>{% trans 'label' %}</td>
         <td class="{{term.url_status_text}}">{{term.label}}</td>
     </tr>
     <tr>
-        <td>{% trans 'Term id' %}</td>
+        <td>{% trans 'id' %}</td>
         <td>{{term.id}}</td>       
     </tr>
     <tr>
-        <td>{% trans 'Term uri' %}</td>
+        <td>{% trans 'uri' %}</td>
         <td>{{term.uri}}</td>
     </tr>
-    <tr>
-        <td>{% trans 'url wikipedia' %}</td>
+    <tr id="info-wk">
+        <td>{% trans 'info wikipedia' %}</td>
         <td>
+            <span>
             {% if term.wikipedia_url and term.wikipedia_url != ""  %}
-            <a href="{{term.wikipedia_url}}" target="_blank"><img src="{{STATIC_URL}}jocondelab/img/arrow_right.png" ></a>
+            <a href="{{term.wikipedia_url}}" target="_blank"><img src="{{STATIC_URL}}jocondelab/img/arrow_right.png" >&nbsp;{{term.wp_label}}</a>
             {% else %}
             <a href="http://fr.wikipedia.org/w/index.php?search={{term.label}}" target="_blank"><img src="{{STATIC_URL}}jocondelab/img/wikipedia_search.png" ></a>
             {% endif %}
-        </td>
-    </tr>
-    <tr>
-        <td>{% trans 'Wikipedia revision id' %}</td>
-        <td>
+            </span>
+            <span>
             {% if term.wikipedia_revision_id  %}
             <a href="{{term.wikipedia_revision_permalink}}" target="_blank"><img src="{{STATIC_URL}}jocondelab/img/clock_arrow.png" ></a>
             {% else %}
             &nbsp;
-            {% endif %}
-        </td>
-    </tr>
-    <tr>
-        <td>{% trans 'DBpedia url' %}</td>
-        <td>
+            {% endif %}            
+            </span>
+            <span>
             {% if term.dbpedia_uri and term.dbpedia_uri != ""  %}
             <a href="{{term.dbpedia_uri}}" target="_blank"><img src="{{STATIC_URL}}jocondelab/img/arrow_green_right.png" ></a>
             {% else %}
             &nbsp;
             {% endif %}
+            </span>
         </td>
     </tr>
     <tr>
-        <td>{% trans 'remove wikipedia link' %}</td>    
+        <td>{% trans 'Rech. joconde' %}</td>
         <td>
+        <a href='http://www.culture.gouv.fr/public/mistral/joconde_fr?FIELD_1={{term.thesaurus.label}}&VALUE_1={{term.label|urlencode:""}}&ACTION=CHERCHER' target="_blank">Recherche joconde</a>
+        </td>
+    </tr>
+    <tr id="edition-wk">
+        <td>{% trans 'Edition wk' %}</td>    
+        <td>
+            <span>
             {% if term.wikipedia_url and term.wikipedia_url != ""  %}
               {% if term.validated %}
               <img src="{{STATIC_URL}}jocondelab/img/red_cross_disabled.png" class="remove_wp_link_disabled" id="{{term.id}}" alt="{{term.label}}" />
@@ -125,26 +123,19 @@
             {% else %}
             &nbsp;
             {% endif %}
+            </span>
+            <span>
+            {% if term.validated %}
+            <span><input type="text" name="wp_search" id="wp_search" size="35" disabled="disabled" /> <span id="ok_search_disabled" class="hand_cursor_disabled"><b>OK</b></span></span>
+            {% else %}
+            <span><input type="text" name="wp_search" id="wp_search" size="35" /> <span id="ok_search" class="hand_cursor"><b>OK</b></span></span>
+            {% endif %}
+            </span>
         </td>
     </tr>
-    <tr>
-        <td>{% trans 'edit wikipedia link' %}</td>
-        <td>
-        {% if term.validated %}
-        <span>{% trans "Select Wikipedia page" %} : <input type="text" name="wp_search" id="wp_search" size="35" disabled="disabled" /> <span id="ok_search_disabled" class="hand_cursor_disabled"><b>OK</b></span></span>
-        {% else %}
-        <span>{% trans "Select Wikipedia page" %} : <input type="text" name="wp_search" id="wp_search" size="35" /> <span id="ok_search" class="hand_cursor"><b>OK</b></span></span>
-        {% endif %}
-        </td>
-    </tr>
-    <tr>
-        <td>{% trans 'Recherche joconde' %}</td>
-        <td>
-        <a href='http://www.culture.gouv.fr/public/mistral/joconde_fr?FIELD_1={{term.thesaurus.label}}&VALUE_1={{term.label|urlencode:""}}&ACTION=CHERCHER' target="_blank">Recherche joconde</a>
-        </td>
-   </tr>
 </table>
 </div>
 </div>
+</div>
 
 {% endblock %}
\ No newline at end of file