# HG changeset patch # User cavaliet # Date 1405957496 -7200 # Node ID 108fd271717770e264c7574b03d63324db31abae # Parent 8e00641076e70580b1ae021e2ac8db87ec3185ac new renkan button and table sorter diff -r 8e00641076e7 -r 108fd2717177 src/hdalab/static/hdalab/css/profile.css --- a/src/hdalab/static/hdalab/css/profile.css Mon Jul 21 16:07:00 2014 +0200 +++ b/src/hdalab/static/hdalab/css/profile.css Mon Jul 21 17:44:56 2014 +0200 @@ -16,4 +16,17 @@ float: left; margin-right: 5px; } -.ui-icon-eye { background-position: -160px -144px; } \ No newline at end of file +.ui-icon-eye { background-position: -160px -144px; } +/* sortable */ +.header{ + background-image:url('../img/bg.gif'); + background-repeat: no-repeat; + /*background-attachment: fixed;*/ + background-position: right center; +} +.headerSortUp{ + background-image: url('../img/asc.gif'); +} +.headerSortDown{ + background-image:url('../img/desc.gif'); +} \ No newline at end of file diff -r 8e00641076e7 -r 108fd2717177 src/hdalab/static/hdalab/img/asc.gif Binary file src/hdalab/static/hdalab/img/asc.gif has changed diff -r 8e00641076e7 -r 108fd2717177 src/hdalab/static/hdalab/img/bg.gif Binary file src/hdalab/static/hdalab/img/bg.gif has changed diff -r 8e00641076e7 -r 108fd2717177 src/hdalab/static/hdalab/img/desc.gif Binary file src/hdalab/static/hdalab/img/desc.gif has changed diff -r 8e00641076e7 -r 108fd2717177 src/hdalab/static/hdalab/lib/jquery.tablesorter.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hdalab/static/hdalab/lib/jquery.tablesorter.min.js Mon Jul 21 17:44:56 2014 +0200 @@ -0,0 +1,4 @@ + +(function($){$.extend({tablesorter:new +function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((ab)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i + + {% endblock %} {% block main_content %}

Votre profil

+

Nouveau Renkan

Vos renkans :

- +
+ + + {% for hr in renkan_list %} {% with hr.renkan as r %} @@ -38,6 +49,7 @@ {% endwith %} {% endfor %} +
NomDate de modificationPreviewStatutActions

Gestion du mot de passe : modification

{% endblock %} \ No newline at end of file diff -r 8e00641076e7 -r 108fd2717177 src/hdalab/urls.py --- a/src/hdalab/urls.py Mon Jul 21 16:07:00 2014 +0200 +++ b/src/hdalab/urls.py Mon Jul 21 17:44:56 2014 +0200 @@ -2,7 +2,8 @@ from django.conf.urls import patterns, include, url from django.views.generic import TemplateView from renkanmanager.views import RenkanCopy, RenkanDelete -from hdalab.views.profile import ProfileHome, RenkanEdit, HdalabRenkanGetPut +from hdalab.views.profile import ProfileHome, RenkanEdit, HdalabRenkanGetPut,\ + RenkanNew # Uncomment the next two lines to enable the admin: # from django.contrib import admin @@ -30,6 +31,7 @@ url(r'^notice/(?P[\w-]+)$', 'hdalab.views.pages.datasheet', name='notice'), + url(r'^renkan/new/$', RenkanNew.as_view(), name='renkan_new'), url(r'^renkan/edit/$', RenkanEdit.as_view(), name='renkan_edit'), url(r'^renkan/getput/$', HdalabRenkanGetPut.as_view(), name='renkan_get_put'), url(r'^renkan/view/$', TemplateView.as_view(template_name="renkan_view.html"), name='renkan_view'), diff -r 8e00641076e7 -r 108fd2717177 src/hdalab/views/profile.py --- a/src/hdalab/views/profile.py Mon Jul 21 16:07:00 2014 +0200 +++ b/src/hdalab/views/profile.py Mon Jul 21 17:44:56 2014 +0200 @@ -7,10 +7,11 @@ from datetime import datetime from django.db.models import Q from django.http import HttpResponse -from django.shortcuts import get_object_or_404 +from django.shortcuts import get_object_or_404, redirect from django.views.decorators.csrf import csrf_exempt -from django.views.generic import TemplateView +from django.views.generic import TemplateView, View from hdabo.models import Tag +from hdalab.models.renkan import HdalabRenkan from hdalab.views.ajax import filter_generic from renkanmanager.models import Renkan from renkanmanager.utils import LineNodePlacer @@ -20,7 +21,7 @@ import logging -from hdalab.models.renkan import HdalabRenkan +from django.core.urlresolvers import reverse logger = logging.getLogger(__name__) @@ -30,25 +31,29 @@ def get_context_data(self, **kwargs): context = super(ProfileHome, self).get_context_data(**kwargs) + context['renkan_list'] = HdalabRenkan.objects.select_related("renkan").filter(renkan__owner=self.request.user).order_by("-renkan__modification_date") + return context + + + +class RenkanNew(View): + + def get(self, request): -# now = datetime.utcnow().isoformat() -# -# rk = Renkan() -# rk.rk_id = unicode(uuid.uuid1()) -# rk.owner = self.request.user -# rk.content = '{"parrot":"dead"}' -# rk.title = now -# rk.save() -# hr = HdalabRenkan() -# hr.renkan = rk -# from random import randrange -# hr.state = randrange(4) + 1 -# hr.save() + rk = Renkan() + rk_id = unicode(uuid.uuid1()) + rk.rk_id = rk_id + rk.owner = request.user + rk.content = '{}' + rk.title = "Nouveau Renkan " + rk.save() + hr = HdalabRenkan() + hr.renkan = rk + from random import randrange + hr.state = randrange(4) + 1 + hr.save() - - context['renkan_list'] = HdalabRenkan.objects.filter(renkan__owner=self.request.user).order_by("-renkan__modification_date") - - return context + return redirect("%s?rk_id=%s" % (reverse('renkan_edit'), rk_id))