# HG changeset patch # User cavaliet # Date 1372330292 -7200 # Node ID c90576d183195f28d773a13413a97455d29cff09 # Parent 61ff8ecfdb28aae30370d5cb1116513077f46753 argumentaire/list collection view diff -r 61ff8ecfdb28 -r c90576d18319 src/egonomy/migrations/0003_add_collection_and_items.py --- a/src/egonomy/migrations/0003_add_collection_and_items.py Thu Jun 27 12:28:09 2013 +0200 +++ b/src/egonomy/migrations/0003_add_collection_and_items.py Thu Jun 27 12:51:32 2013 +0200 @@ -25,7 +25,7 @@ db.create_table(u'egonomy_collectionitem', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), - ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')()), + ('object_id', self.gf('django.db.models.fields.CharField')(max_length=15)), ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), ('order', self.gf('django.db.models.fields.IntegerField')()), ('collection', self.gf('django.db.models.fields.related.ForeignKey')(related_name='items', to=orm['egonomy.Collection'])), @@ -95,7 +95,7 @@ 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}), + 'object_id': ('django.db.models.fields.CharField', [], {'max_length': '15'}), 'order': ('django.db.models.fields.IntegerField', [], {}) }, u'egonomy.fragment': { diff -r 61ff8ecfdb28 -r c90576d18319 src/egonomy/models.py --- a/src/egonomy/models.py Thu Jun 27 12:28:09 2013 +0200 +++ b/src/egonomy/models.py Thu Jun 27 12:51:32 2013 +0200 @@ -196,7 +196,7 @@ class CollectionItem(models.Model): content_type = models.ForeignKey(ContentType) # can be image ou fragment - object_id = models.PositiveIntegerField() + object_id = models.CharField(null=False, blank=False, max_length=15) # has to be char because of image id content_object = generic.GenericForeignKey('content_type', 'object_id') description = models.TextField(blank=True, null=True) order = models.IntegerField() diff -r 61ff8ecfdb28 -r c90576d18319 src/egonomy/static/egonomy/css/style.css --- a/src/egonomy/static/egonomy/css/style.css Thu Jun 27 12:28:09 2013 +0200 +++ b/src/egonomy/static/egonomy/css/style.css Thu Jun 27 12:51:32 2013 +0200 @@ -106,7 +106,7 @@ .list-projets-2 .bot p{color: #333; background-color: #fff; font-family: 'Lato'; font-weight: 300; font-style: italic; padding: 8px 14px 0 14px; font-size: 14px; height: 104px; border-bottom: 1px solid #000; border-left: 1px solid #BBB; border-right: 1px solid #BBB;} .list-projets-2 .bot{height: 113px; overflow: hidden;} -li .toggle{display: block;} +li .toggle{display: none;} li:hover .toggle{ display:block; } .tools{ text-align:right; width:100%; position:absolute; bottom:0; left:0; background: rgba(255, 255, 255, .85);} @@ -119,10 +119,10 @@ .list-projets-3{margin-bottom: 50px;} .list-projets-3>li{width: 465px; background-color: #eee; margin-bottom: 20px;} .list-projets-3 .col-left{position: relative;} -.list-projets-3 li img{max-width: 465px; display: inherit;} +.list-projets-3 li img{max-width: 465px; display: block; margin: 0 auto;} .list-projets-3 li.horizontal .col-left{ width: 225px;} .list-projets-3 li.horizontal .col-right{height:100%; width: 240px; } -.list-projets-3 .project-title{position:relative; padding-left: 14px; font-size: 18px;height: 60px; border-bottom: 1px solid #CCC;} +.list-projets-3 .project-title{position:relative; padding-left: 14px; font-size: 18px;min-height: 60px; border-bottom: 1px solid #CCC;} .project-title h3{ font-family: 'Lato'; font-weight : bold; padding-top: 12px; margin-bottom: 4px; } .project-title h4{ font-family: 'Lato'; font-weight: 300; font-style: italic;} .project-title a.edit{ position: absolute; top: 10px; right: 10px; opacity: 0.7;} @@ -262,7 +262,7 @@ .content-project p{font-family: 'Lato'; font-size: 13px; font-weight: 300; line-height: 15px; padding: 10px;} body{overflow: auto !important;} -#map{width: 100%; height: 400px;} +#map{width: 100%; height: 360px; margin-bottom: 20px;} /* imported */ diff -r 61ff8ecfdb28 -r c90576d18319 src/egonomy/static/egonomy/img/icon-pencil-15.png Binary file src/egonomy/static/egonomy/img/icon-pencil-15.png has changed diff -r 61ff8ecfdb28 -r c90576d18319 src/egonomy/static/egonomy/js/main.js --- a/src/egonomy/static/egonomy/js/main.js Thu Jun 27 12:28:09 2013 +0200 +++ b/src/egonomy/static/egonomy/js/main.js Thu Jun 27 12:51:32 2013 +0200 @@ -81,7 +81,7 @@ iconAction = li.find('.icon-action'), index = li.index(), keyword = $(this).attr('data-keyword'); - enabledDisplayKeyword(li, keyword, iconAction); + ul.find('li').each(function(k, v){ if(index != k){ @@ -91,12 +91,15 @@ disabledDisplayKeyword($(v), keyword, iconAction); } }); + + enabledDisplayKeyword(li, keyword, iconAction); }); $('.icon-action').bind('click', function(e){ e.preventDefault(); var li = $(this).parents('li'); toggleDisplayKeyword(li); }); +/* function toggleDisplayKeyword(li){ var displayKeyword = li.find('.display-keyword'), iconAction = li.find('.icon-action'), @@ -119,5 +122,83 @@ $('li.keyword-'+keyword).find('.curtain').show(); iconAction.addClass('circle'); } +*/ + function toggleDisplayKeyword(li){ + var displayKeyword = li.find('.display-keyword'), + iconAction = li.find('.icon-action'), + keyword = displayKeyword.attr('data-keyword'); + if(li.hasClass('disabled')){ + enabledDisplayKeyword(li, keyword, iconAction); + }else{ + disabledDisplayKeyword(li, keyword, iconAction); + } + } + function enabledDisplayKeyword(li, keyword, iconAction){ + iconAction.removeClass('cross').removeClass('circle'); + li.removeClass('disabled'); + $('ul.mosaic > li').each(function(k, v){ + + var keywords = $(v).attr('data-keywords'), + item = $(v); + keywords = keywords.split(','); + for(var i=0; i<= keywords.length; i++){ + if($.trim(keywords[i]) == keyword){ + item.find('.curtain').hide(); + } + } + }); + $('li.keyword-'+keyword).find('.curtain').hide(); + iconAction.addClass('cross'); + } + function disabledDisplayKeyword(li, keyword, iconAction){ + iconAction.removeClass('cross').removeClass('circle'); + li.addClass('disabled'); + $('ul.mosaic > li').each(function(k, v){ + + var keywords = $(v).attr('data-keywords'), + item = $(v); + keywords = keywords.split(','); + for(var i=0; i<= keywords.length; i++){ + if($.trim(keywords[i]) == keyword){ + item.find('.curtain').show(); + } + } + }); + iconAction.addClass('circle'); + } + -});//ready + // add item to collection behaviour + $('.additemtocollection').bind('click', function(e){ + // When an item meant to be added to a collection is clicked, + // we fill the form in the add-to-collection div + console.log(this + ", " + $(this) + ", " + $(this).attr('data-type') + ", " + $(this).attr('data-id')); + $('#add-to-collection .item-type').val($(this).attr('data-type')); + $('#add-to-collection .item-id').val($(this).attr('data-id')); + }); + + + //map + if($('#map').length){ + initmap() + } +function initmap() { + // set up the map + map = new L.Map('map'); + + // create the tile layer with correct attribution + var osmUrl='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; + var osm = new L.TileLayer(osmUrl, {minZoom: 3, maxZoom: 20}); + + // start the map in South-East England + map.setView(new L.LatLng(48.833, 2.333),4); + map.addLayer(osm); + + // markers + var marker1 = L.marker([48.833, 2.333]).addTo(map); + marker1.bindPopup("Beaux-Arts de Paris"); + var marker2 = L.marker([47.233,-1.583]).addTo(map); + marker2.bindPopup("Beaux-Arts de Nantes"); +} + +});//ready \ No newline at end of file diff -r 61ff8ecfdb28 -r c90576d18319 src/egonomy/templates/egonomy_all_collections.html --- a/src/egonomy/templates/egonomy_all_collections.html Thu Jun 27 12:28:09 2013 +0200 +++ b/src/egonomy/templates/egonomy_all_collections.html Thu Jun 27 12:51:32 2013 +0200 @@ -15,7 +15,6 @@ {% endblock %} {% block popins %} -
-
+
+
par Hubert Trucchose
-
+
+
+ {% endthumbnail %}
+
+ {% else %}
+
+ {% endif %}
+ {% endwith %}
+ {% endwith %}
+ {% endifequal %}
+ {% endfor %}
+
+ {% endifequal %}
+ {% else %}