# HG changeset patch
# User cavaliet
# Date 1308068812 -7200
# Node ID ffd77b2b939fbd9e82e6b1c50e0d3138e218a3ef
# Parent 142d0440c9aa73443e768200e333a1063df34a33
First step of tag list. Enhance js function for datasheet context or tag list context.
diff -r 142d0440c9aa -r ffd77b2b939f web/hdabo/static/hdabo/css/style.css
--- a/web/hdabo/static/hdabo/css/style.css Tue Jun 14 15:28:11 2011 +0200
+++ b/web/hdabo/static/hdabo/css/style.css Tue Jun 14 18:26:52 2011 +0200
@@ -222,11 +222,26 @@
margin-top: 2px;
margin-bottom: 2px;
border-bottom: 2px solid #707070;
+ padding-top : 0px;
+ padding-bottom : 0px;
}
-#toolbar p {
+#toolbar ul{
+ padding-left : 0px;
+ padding-right : 0px;
+ padding-top : 0px;
+ padding-bottom : 0px;
+ margin-left : 0px;
+ margin-right : 0px;
margin-top: 5px;
margin-bottom: 5px;
}
+#toolbar ul li{
+ display: inline;
+ padding-left : 10px;
+ padding-right : 10px;
+ padding-top : 0px;
+ padding-bottom : 0px;
+}
#inner_content {
padding: 5px 0px 50px 0px;
diff -r 142d0440c9aa -r ffd77b2b939f web/hdabo/static/hdabo/js/hdabo.js
--- a/web/hdabo/static/hdabo/js/hdabo.js Tue Jun 14 15:28:11 2011 +0200
+++ b/web/hdabo/static/hdabo/js/hdabo.js Tue Jun 14 18:26:52 2011 +0200
@@ -5,7 +5,8 @@
$(".up,.down").click(function(){
tag_up_down(this);
});
- //activate_wp_cb
+
+ // Tag simple operations : activate/unactivate wp link, reset wp info, remove wp link, remove tag from list
$(".activate_wp_cb").click(function(e){
new_checked = $(this).is(':checked');
if(new_checked){
@@ -14,7 +15,8 @@
question = "Confirmez-vous la désactivation du lien Wikipédia pour le tag \"" + $(this).attr('alt') + "\" ?";
}
if(confirm(question)){
- validate_wp_link(this);
+ //validate_wp_link(this);
+ update_tag(this);
}
else{
// Since the click event is dispatched after the checked changed, we change the checked changed if confirm is false.
@@ -22,13 +24,6 @@
$(this).attr('checked', !new_checked);
}
});
-
- // Tag simple operations : remove tag from list, reset wp info, remove wp link
- $(".remove_tag_from_list").click(function(){
- if(confirm("Confirmez-vous la suppression du tag \"" + $(this).attr('alt') + "\" de la liste courante ?")){
- update_tag(this);
- }
- });
$(".reset_wp_info").click(function(e){
if(confirm("Confirmez-vous le rétablissement du label original de ce tag ?")){
update_tag(this);
@@ -39,6 +34,11 @@
update_tag(this);
}
});
+ $(".remove_tag_from_list").click(function(){
+ if(confirm("Confirmez-vous la suppression du tag \"" + $(this).attr('alt') + "\" de la liste courante ?")){
+ update_tag(this);
+ }
+ });
$("#wp_search").autocomplete({
source: function( request, response ) {
@@ -89,7 +89,12 @@
type : "autocomplete",
tooltip : "Cliquer pour éditer...",
onblur : "submit",
- submitdata: {csrfmiddlewaretoken:global_csrf_token, datasheet_id:$('#datasheet_id').val()},
+ submitdata: {
+ csrfmiddlewaretoken:global_csrf_token,
+ datasheet_id:$('#datasheet_id').val(),
+ num_page:$('#num_page').val(),
+ nb_by_page:$('#nb_by_page').val()
+ },
callback : function(value, settings) {
$('#tag_table_container').html(value);
init_tags_events();
@@ -128,30 +133,9 @@
}
-function validate_wp_link(cb)
-{
- var url = validate_wp_link_url;
- var id_tag = $(cb).attr('id');
- new_checked = $(cb).is(':checked');
- $.ajax({
- url: url,
- type: 'POST',
- data: {csrfmiddlewaretoken:global_csrf_token,
- datasheet_id:$('#datasheet_id').val(),
- tag_id:id_tag,
- activated:new_checked
- },
- // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
- //dataType: 'json',
- success: function(msg, textStatus, XMLHttpRequest) {
- $('#tag_table_container').html(msg);
- init_tags_events();
- }
- });
-}
-
function update_tag(btn)
{
+ new_checked = false;
if ($(btn).is(".remove_tag_from_list")) {
var url = remove_tag_from_list_url;
var id_tag = $(btn).attr('id');
@@ -159,17 +143,30 @@
else if ($(btn).is(".reset_wp_info")) {
var url = reset_wp_info_url;
var id_tag = $(btn).html();
+ $(btn).html("
");
}
else if ($(btn).is(".remove_wp_link")) {
var url = remove_wp_link_url;
var id_tag = $(btn).attr('id');
}
+ else if ($(btn).is(".activate_wp_cb")) {
+ var url = validate_wp_link_url;
+ var id_tag = $(btn).attr('id');
+ new_checked = $(btn).is(':checked');
+ }
+
+ // 2 cases :
+ // - ordered tag for one datasheet : $('#datasheet_id') is not null
+ // - all tags list : $('#datasheet_id') is null and $('#num_page') and $('#nb_by_page') are not null
$.ajax({
url: url,
type: 'POST',
data: {csrfmiddlewaretoken:global_csrf_token,
datasheet_id:$('#datasheet_id').val(),
- tag_id:id_tag
+ num_page:$('#num_page').val(),
+ nb_by_page:$('#nb_by_page').val(),
+ tag_id:id_tag,
+ activated:new_checked
},
// bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
//dataType: 'json',
diff -r 142d0440c9aa -r ffd77b2b939f web/hdabo/templates/all_tags.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/hdabo/templates/all_tags.html Tue Jun 14 18:26:52 2011 +0200
@@ -0,0 +1,74 @@
+{% extends "hdabo_base.html" %}
+ {% block title %}HDA - BO : Tous les tags{% endblock %}
+
+ {% block js_import %}
+ {{block.super}}
+
+
+ {% endblock %}
+
+ {% block js_declaration %}
+ {{block.super}}
+ {% if valid != "2" %}
+
+ {% endif %}
+ {% endblock %}
+
+ {% block css_import %}
+ {{block.super}}
+
+ {% endblock %}
+
+ {% block css_declaration %}
+ {{block.super}}
+
+ {% endblock %}
+
+
+ {% block content %}
+ {{block.super}}
+
Tags {{ current_page.start_index }} à {{ current_page.end_index }} sur {{ nb_total }}
+ + + +