# HG changeset patch
# User cavaliet
# Date 1308148888 -7200
# Node ID 26368d096723ee18eada8e7547f2b8bf0971a8f2
# Parent ffd77b2b939fbd9e82e6b1c50e0d3138e218a3ef
Datasheet validation, better repartition of js function, hand cursor on buttons.
diff -r ffd77b2b939f -r 26368d096723 web/hdabo/static/hdabo/css/style.css
--- a/web/hdabo/static/hdabo/css/style.css Tue Jun 14 18:26:52 2011 +0200
+++ b/web/hdabo/static/hdabo/css/style.css Wed Jun 15 16:41:28 2011 +0200
@@ -361,6 +361,10 @@
.text_centered {
text-align: center;
}
+.hand_cursor, .reset_wp_info, .updown_td, .remove_wp_link, .remove_tag_from_list {
+ cursor: pointer;
+}
+
/* styles for the 4 types of STATUS*/
.null_result {
diff -r ffd77b2b939f -r 26368d096723 web/hdabo/static/hdabo/js/hdabo.js
--- a/web/hdabo/static/hdabo/js/hdabo.js Tue Jun 14 18:26:52 2011 +0200
+++ b/web/hdabo/static/hdabo/js/hdabo.js Wed Jun 15 16:41:28 2011 +0200
@@ -40,50 +40,13 @@
}
});
- $("#wp_search").autocomplete({
- source: function( request, response ) {
- $.ajax({
- url: "http://fr.wikipedia.org/w/api.php",
- dataType: "jsonp",
- data: {
- action: "opensearch",
- limit: "20",
- namespace: "0",
- format: "json",
- search: request.term
- },
- success: function( data ) {
- response( $.map( data[1], function( item ) {
- return {
- label: item,
- value: item
- }
- }));
- }
- });
- },
- minLength: 2,
- open: function() {
- $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
- },
- close: function() {
- $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
- }
- });
-
- $("#ok_search").click(function(){
- if($("#wp_search").val()!=""){
- add_tag($("#wp_search").val());
- }
- });
-
+ // Wikipedia search management (autocompletion, save changes and new tag)
$.editable.addInputType('autocomplete', {
element : $.editable.types.text.element,
plugin : function(settings, original) {
$('input', this).autocomplete(settings.autocomplete);
}
});
-
$(".wikipediatag").editable(modify_tag_url, {
indicator : "
",
type : "autocomplete",
@@ -127,10 +90,70 @@
},
close: function() {
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
- }
+ }
}
});
+}
+
+function init_datasheet_events()
+{
+ // Wikipedia search management (autocompletion, save changes and new tag)
+ $("#wp_search").autocomplete({
+ source: function( request, response ) {
+ $.ajax({
+ url: "http://fr.wikipedia.org/w/api.php",
+ dataType: "jsonp",
+ data: {
+ action: "opensearch",
+ limit: "20",
+ namespace: "0",
+ format: "json",
+ search: request.term
+ },
+ success: function( data ) {
+ response( $.map( data[1], function( item ) {
+ return {
+ label: item,
+ value: item
+ }
+ }));
+ }
+ });
+ },
+ minLength: 2,
+ open: function() {
+ $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
+ },
+ close: function() {
+ $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
+ }
+ });
+ $("#ok_search").click(function(){
+ if($("#wp_search").val()!=""){
+ add_tag($("#wp_search").val());
+ }
+ });
+ // Validate sheet management : the radiobutton name has is "'gr_validated' + datasheet.hda_id"
+ $("#validated").click(function(e){
+ e.preventDefault();
+ // We count the number of tags. It has to be between 5 and 25
+ var nb_tags = $('#tag_table tr').length - 1;
+ if(nb_tags<5 || nb_tags>25){
+ alert("Cette fiche n'est pas validable : elle doit contenir entre 5 et 25 tags.");
+ }
+ else{
+ if(confirm("Confirmez-vous la validation de cette fiche ? Elle contient " + nb_tags + " tags.")){
+ window.location = validate_datasheet_url + "/" + $('#datasheet_id').val() + "/true";
+ }
+ }
+ });
+ $("#not_validated").click(function(e){
+ e.preventDefault();
+ if(confirm("Confirmez-vous l'invalidation de cette fiche ?")){
+ window.location = validate_datasheet_url + "/" + $('#datasheet_id').val() + "/false";
+ }
+ });
}
function update_tag(btn)
diff -r ffd77b2b939f -r 26368d096723 web/hdabo/templates/all_tags.html
--- a/web/hdabo/templates/all_tags.html Tue Jun 14 18:26:52 2011 +0200
+++ b/web/hdabo/templates/all_tags.html Wed Jun 15 16:41:28 2011 +0200
@@ -65,10 +65,10 @@
{% include "partial/all_tags_table.html" %}
Fiche(s) pour l'organisation {{ orga_name }} : {{nb_sheets}} fiche(s)
+Fiche(s) {% if valid == "1" %}validées{% else %}{% if valid != "2" %}non validées{% endif %}{% endif %} + pour l'organisation {{ orga_name }} : {{nb_sheets}} fiche(s)
{% if valid != "2" %}En cours - Validé +
En cours + Validé {% if ds.validated %} - par : - le {{ds.validation_date}} + par {{ds.validator}} le {{ds.validation_date|date:"d/m/Y"}} {% endif %} {% if valid != "2" %} - Ajouter un tag : OK + Ajouter un tag : OK {% endif %}
{% csrf_token %} diff -r ffd77b2b939f -r 26368d096723 web/hdabo/urls.py --- a/web/hdabo/urls.py Tue Jun 14 18:26:52 2011 +0200 +++ b/web/hdabo/urls.py Wed Jun 15 16:41:28 2011 +0200 @@ -16,13 +16,13 @@ url(r'^admin/', include(admin.site.urls)), url(r'^search/', include('haystack.urls')), url(r'^$', 'hdabo.views.home', name='home'), - url(r'^list/(?P