# HG changeset patch # User veltr # Date 1372851779 -7200 # Node ID 15e048e0000256bede8d17bd9258e8070b5eda57 # Parent f53a7999ae7b0323a540632069a5ea5a257d485f Better User List Management diff -r f53a7999ae7b -r 15e048e00002 client/css/renkan.css --- a/client/css/renkan.css Fri Jun 14 12:36:32 2013 +0200 +++ b/client/css/renkan.css Wed Jul 03 13:42:59 2013 +0200 @@ -104,12 +104,16 @@ } .Rk-CurrentUser-Color { - display: inline-block; width: 12px; height: 12px; border: 1px solid #333333; margin: -2px 2px; -} + display: inline-block; width: 12px; height: 12px; border: 1px solid #333333; margin: -2px 2px; position: relative; +} + +.Rk-CurrentUser input { + width: 95px; padding: 1px; border: none; border-radius: 2px; +} .Rk-UserList { box-shadow: 0 2px 2px #999999; - position: relative; z-index: 4; display: none; padding-top: 8px; + position: relative; z-index: 3; display: none; padding-top: 8px; } .Rk-User { @@ -333,11 +337,11 @@ } .Rk-Edit-Color { - display: inline-block; width: 10px; height: 10px; border: 2px solid #333333; margin: -2px 2px; + display: inline-block; width: 10px; height: 10px; border: 2px solid #333333; margin: -2px 2px; position: relative; } .Rk-Edit-ColorTip { - display: block; width: 3px; height: 3px; background: #fff; margin: 7px 0 0 7px; cursor: pointer; + display: block; width: 3px; height: 3px; background: #fff; position: absolute; bottom: 0; right: 0; cursor: pointer; } .Rk-Edit-ColorPicker-Wrapper { @@ -349,6 +353,11 @@ padding: 5px 4px 4px 5px; background: #ffffff; border-radius: 5px; display: none; z-index: 4; } + +.Rk-CurrentUser .Rk-Edit-ColorPicker { + left: -105px; top: 2px; +} + .Rk-Edit-ColorPicker-Text { color: #303080; font-weight: bold; } diff -r f53a7999ae7b -r 15e048e00002 client/data/test-data.json --- a/client/data/test-data.json Fri Jun 14 12:36:32 2013 +0200 +++ b/client/data/test-data.json Wed Jul 03 13:42:59 2013 +0200 @@ -1,298 +1,1 @@ -{ - "users": [ - { - "_id": "u-iri", - "title": "IRI", - "uri": "", - "description": "", - "color": "#dd00dd" - }, { - "_id": "u-cybunk", - "title": "Samuel", - "uri": "http://twitter.com/cybunk", - "description": "", - "color": "#e00000" - }, { - "_id": "u-raphv", - "title": "Raphael", - "uri": "http://twitter.com/raphv", - "description": "", - "color": "#00a000" - } - ], - "nodes": [ - { - "_id": "node-2012-08-22-9da6eef6c6391d05-0001", - "title": "Chocs technologiques et tâches de l’université...", - "uri": "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/e328e188-ff2f-11e0-b9e1-00145ea49a02/#id=s_6C326EED-B91A-AEDF-032D-40D9A60AAD7E", - "description": "Bernard Stiegler:\nChocs technologiques et tâches de l’université. L'époque des digital studies\nベルナール・スティグレールによるプレゼンテーション『テクノロジーの衝撃と大学の諸課題――デジタル・スタディーズの時代』 (langue française フランス語)", - "position": { - "x": 35.50145330596697, - "y": -79.8809523809524 - }, - "image": "http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/ldt-segment.png", - "created_by": "u-cybunk" - }, { - "_id": "node-2012-08-22-9da6eef6c6391d05-0002", - "title": "Wiki: ベルナール・スティグレール", - "uri": "http://ja.wikipedia.org/wiki/%E3%83%99%E3%83%AB%E3%83%8A%E3%83%BC%E3%83%AB%E3%83%BB%E3%82%B9%E3%83%86%E3%82%A3%E3%82%B0%E3%83%AC%E3%83%BC%E3%83%AB", - "description": "|image_name = Bernard-Stiegler.jpg\n'''ベルナール・スティグレール'''('''Bernard Stiegler''',[[1952年]][[4月1日]] - )は、[[フランス]]の[[哲学者]]。\n", - "position": { - "x": -212.89325104742056, - "y": -142.05921029473706 - }, - "image": "http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/wikipedia.png", - "created_by": "u-raphv" - }, { - "_id": "node-2012-08-22-9da6eef6c6391d05-0003", - "title": "Wiki: Bernard Stiegler", - "uri": "http://fr.wikipedia.org/wiki/Bernard_Stiegler", - "description": "Bernard Stiegler, né le 1 | avril | 1952, est un philosophe français qui axe sa réflexion sur les enjeux des mutations actuelles — ... ", - "position": { - "x": -199.613212880364, - "y": -297.6715155910511 - }, - "image": "http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/wikipedia.png", - "created_by": "u-raphv" - }, { - "_id": "node-2012-08-22-9da6eef6c6391d05-0004", - "title": "Tag: Stiegler", - "uri": "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/search/?search=Stiegler&field=all", - "description": "Tag 'Stiegler'", - "position": { - "x": -68.40773762286169, - "y": -205.76155213199334 - }, - "image": "http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/ldt-tag.png", - "created_by": "u-raphv" - }, { - "_id": "node-2012-08-22-9da6eef6c6391d05-0009", - "title": "Wiki: Humanités numériques", - "uri": "http://fr.wikipedia.org/wiki/Humanit%C3%A9s_num%C3%A9riques", - "description": "une proposition de définition a été élaborée lors du THATCamp des 18 et 19 mai 2010 sous la forme d'un « Manifeste des digital humanities : ... ", - "position": { - "x": -227.84295519248332, - "y": 91.1816115015538 - }, - "image": "http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/wikipedia.png", - "created_by": "u-raphv" - }, { - "_id": "node-2012-08-22-9da6eef6c6391d05-000a", - "title": "Wiki: デジタル・ヒューマニティーズ", - "uri": "http://ja.wikipedia.org/wiki/%E3%83%87%E3%82%B8%E3%82%BF%E3%83%AB%E3%83%BB%E3%83%92%E3%83%A5%E3%83%BC%E3%83%9E%E3%83%8B%E3%83%86%E3%82%A3%E3%83%BC%E3%82%BA", - "description": "...(digital humanities)は、コンピューティングと人文科学(humanities)諸分野と間の接点に関して調査、研究、教育、および�\n* Centre for Computing in the Humanities\n", - "position": { - "x": -221.48701615763574, - "y": 242.80740052545508 - }, - "image": "http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/wikipedia.png", - "created_by": "u-raphv" - }, { - "_id": "node-2012-08-22-9da6eef6c6391d05-000b", - "title": "Digital studies", - "uri": "", - "description": "", - "position": { - "x": -62.798895620242085, - "y": 32.09820725365255 - }, - "created_by": "u-raphv" - }, { - "_id": "node-2012-08-22-9da6eef6c6391d05-000c", - "title": "Digital Humanities", - "uri": "", - "description": "", - "position": { - "x": -110.57020731070799, - "y": 160.92139209086253 - }, - "created_by": "u-raphv" - }, { - "_id": "node-2012-08-22-b778a9fc31296d6b-0008", - "title": "Les rétentions (Tweet)", - "uri": "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/e328e188-ff2f-11e0-b9e1-00145ea49a02/#id=a924b90c-46a1-4f0a-9e13-bcf69f7b5de0-127750274034049024", - "description": "Tweet by Vincent Puig: #tfcem Les rétentions primaires (perception) s'aggrégent et forment des rétentions secondaires (mémoire), gravées sur rétentions tertiaires", - "position": { - "x": 186.15055288633457, - "y": -184.66836073709257 - }, - "image": "http://a1.twimg.com/profile_images/379424006/PortaitVP120Ko_normal.jpg", - "created_by": "u-cybunk" - }, { - "_id": "node-2012-08-22-b778a9fc31296d6b-0009", - "title": "L'origine de la géométrie (Tweet)", - "uri": "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/e328e188-ff2f-11e0-b9e1-00145ea49a02/#id=5b34ae61-ffb1-4535-a479-007cb0ef57e8-127752118743474177", - "description": "Tweet by Vincent Puig: #tfcem L'origine de la géométrie: l'écriture est processus long de transindividuation. Nos tweets quasi temps réel sont de même nature++", - "position": { - "x": 87.82365160023906, - "y": -280.3591650733953 - }, - "image": "http://a1.twimg.com/profile_images/379424006/PortaitVP120Ko_normal.jpg", - "created_by": "u-cybunk" - }, { - "_id": "node-2012-08-22-b778a9fc31296d6b-000a", - "title": "Polemictweet : un outil Digital Studies (Tweet)", - "uri": "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/e328e188-ff2f-11e0-b9e1-00145ea49a02/#id=4b34e895-221b-467b-a0f2-8ff4ae87cae4-127758736415666177", - "description": "Tweet by Vincent Puig:\n#tfcem Polemictweet : un outil Digital Studies pensé à l'IRI comme rétention tertiaire numérique avec les même armes que l'industrie", - "position": { - "x": 168.59118089416432, - "y": 57.97933221077804 - }, - "image": "http://a1.twimg.com/profile_images/379424006/PortaitVP120Ko_normal.jpg", - "created_by": "u-cybunk" - }, { - "_id": "node-2012-08-22-b778a9fc31296d6b-000f", - "title": "Rétention (Définition AI)", - "uri": "http://arsindustrialis.org/vocabulaire-ars-industrialis/r%C3%A9tention", - "description": "Les rétentions sont ce qui est retenu ou recueilli par la conscience. Ce terme est emprunté à Husserl ; mais les rétentions tertiaires sont propres à la philosophie de Bernard Stiegler.\n\nLes rétentions sont des sélections : dans le flux de conscience que vous êtes vous ne pouvez pas tout retenir, ce que vous retenez est ce que vous êtes, mais ce que vous retenez dépend ce que vous avez déjà retenu.\n\nL’espèce humaine, étant originairement constituée par sa prothéticité, dispose d’une troisième mémoire, ni génétique, ni épigénétique : le milieu épiphylogénétique, comme ensemble des rétentions tertiaires formant des dispositifs rétentionels.", - "position": { - "x": 276.41820932461013, - "y": -62.82646518900019 - }, - "image": "http://www.arsindustrialis.org/sites/default/files/userfiles/user3/Logovocabulairenoir.JPG", - "created_by": "u-cybunk" - }, { - "_id": "node-2012-08-22-5b349e49066c1b01-0001", - "title": "Polemic Tweet", - "uri": "http://polemictweet.com/", - "description": "Polemic Tweet Web Site", - "position": { - "x": 220.96817493563964, - "y": 196.75746750735607 - }, - "image": "http://www.polemictweet.com/images/ENMI_2010_logo.gif", - "created_by": "u-cybunk" - } - ], - "edges": [ - { - "_id": "edge-2012-08-22-9da6eef6c6391d05-0005", - "title": "is about", - "uri": "", - "description": "", - "from": "node-2012-08-22-9da6eef6c6391d05-0002", - "to": "node-2012-08-22-9da6eef6c6391d05-0004", - "created_by": "u-raphv" - }, { - "_id": "edge-2012-08-22-9da6eef6c6391d05-0006", - "title": "is about", - "uri": "", - "description": "", - "from": "node-2012-08-22-9da6eef6c6391d05-0003", - "to": "node-2012-08-22-9da6eef6c6391d05-0004", - "created_by": "u-raphv" - }, { - "_id": "edge-2012-08-22-9da6eef6c6391d05-0007", - "title": "speech by", - "uri": "", - "description": "", - "from": "node-2012-08-22-9da6eef6c6391d05-0001", - "to": "node-2012-08-22-9da6eef6c6391d05-0004", - "created_by": "u-raphv" - }, { - "_id": "edge-2012-08-22-b778a9fc31296d6b-0001", - "title": "is about", - "uri": "", - "description": "", - "from": "node-2012-08-22-9da6eef6c6391d05-0001", - "to": "node-2012-08-22-9da6eef6c6391d05-000b", - "created_by": "u-raphv" - }, { - "_id": "edge-2012-08-22-b778a9fc31296d6b-0002", - "title": "Are related to", - "uri": "", - "description": "", - "from": "node-2012-08-22-9da6eef6c6391d05-000b", - "to": "node-2012-08-22-9da6eef6c6391d05-000c", - "created_by": "u-raphv" - }, { - "_id": "edge-2012-08-22-b778a9fc31296d6b-0003", - "title": "is about", - "uri": "", - "description": "", - "from": "node-2012-08-22-9da6eef6c6391d05-0009", - "to": "node-2012-08-22-9da6eef6c6391d05-000c", - "created_by": "u-raphv" - }, { - "_id": "edge-2012-08-22-b778a9fc31296d6b-0004", - "title": "is about", - "uri": "", - "description": "", - "from": "node-2012-08-22-9da6eef6c6391d05-000a", - "to": "node-2012-08-22-9da6eef6c6391d05-000c", - "created_by": "u-raphv" - }, { - "_id": "edge-2012-08-22-b778a9fc31296d6b-000b", - "title": "is about", - "uri": "", - "description": "", - "from": "node-2012-08-22-b778a9fc31296d6b-000a", - "to": "node-2012-08-22-9da6eef6c6391d05-000b", - "created_by": "u-raphv" - }, { - "_id": "edge-2012-08-22-b778a9fc31296d6b-000c", - "title": "tweeted during", - "uri": "", - "description": "", - "from": "node-2012-08-22-b778a9fc31296d6b-0009", - "to": "node-2012-08-22-9da6eef6c6391d05-0001", - "created_by": "u-cybunk" - }, { - "_id": "edge-2012-08-22-b778a9fc31296d6b-000d", - "title": "tweeted during", - "uri": "", - "description": "", - "from": "node-2012-08-22-b778a9fc31296d6b-0008", - "to": "node-2012-08-22-9da6eef6c6391d05-0001", - "created_by": "u-cybunk" - }, { - "_id": "edge-2012-08-22-b778a9fc31296d6b-000e", - "title": "tweeted during", - "uri": "", - "description": "", - "from": "node-2012-08-22-b778a9fc31296d6b-000a", - "to": "node-2012-08-22-9da6eef6c6391d05-0001", - "created_by": "u-cybunk" - }, { - "_id": "edge-2012-08-22-b778a9fc31296d6b-0011", - "title": "is about", - "uri": "", - "description": "", - "from": "node-2012-08-22-b778a9fc31296d6b-0008", - "to": "node-2012-08-22-b778a9fc31296d6b-000f", - "created_by": "u-cybunk" - }, { - "_id": "edge-2012-08-22-b778a9fc31296d6b-0012", - "title": "is about", - "uri": "", - "description": "", - "from": "node-2012-08-22-b778a9fc31296d6b-000a", - "to": "node-2012-08-22-b778a9fc31296d6b-000f", - "created_by": "u-cybunk" - }, { - "_id": "edge-2012-08-22-5b349e49066c1b01-0002", - "title": "is about", - "uri": "", - "description": "", - "from": "node-2012-08-22-b778a9fc31296d6b-000a", - "to": "node-2012-08-22-5b349e49066c1b01-0001", - "created_by": "u-cybunk" - }, { - "_id": "edge-2012-09-06-70cc0c2d5e1112d3-0001", - "title": "is an example of", - "uri": "", - "description": "", - "from": "node-2012-08-22-b778a9fc31296d6b-000a", - "to": "node-2012-08-22-9da6eef6c6391d05-000b", - "created_by": "u-iri" - }, { - "_id": "edge-2012-09-06-70cc0c2d5e1112d3-0002", - "title": "tool used", - "uri": "", - "description": "", - "from": "node-2012-08-22-5b349e49066c1b01-0001", - "to": "node-2012-08-22-b778a9fc31296d6b-000a", - "created_by": "u-iri" - } - ] -} \ No newline at end of file +{"users":[{"_id":"u-iri","title":"IRI","uri":"","description":"","color":"#dd00dd"},{"_id":"u-cybunk","title":"Samuel","uri":"http://twitter.com/cybunk","description":"","color":"#e00000"},{"_id":"u-raphv","title":"Raphael","uri":"http://twitter.com/raphv","description":"","color":"#00a000"}],"nodes":[{"_id":"node-2012-08-22-9da6eef6c6391d05-0001","title":"Chocs technologiques et tâches de l’université...","uri":"http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/e328e188-ff2f-11e0-b9e1-00145ea49a02/#id=s_6C326EED-B91A-AEDF-032D-40D9A60AAD7E","description":"Bernard Stiegler:\nChocs technologiques et tâches de l’université. L'époque des digital studies\nベルナール・スティグレールによるプレゼンテーション『テクノロジーの衝撃と大学の諸課題――デジタル・スタディーズの時代』 (langue française フランス語)","position":{"x":35.50145330596697,"y":-79.8809523809524},"image":"http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/ldt-segment.png","created_by":"u-cybunk"},{"_id":"node-2012-08-22-9da6eef6c6391d05-0002","title":"Wiki: ベルナール・スティグレール","uri":"http://ja.wikipedia.org/wiki/%E3%83%99%E3%83%AB%E3%83%8A%E3%83%BC%E3%83%AB%E3%83%BB%E3%82%B9%E3%83%86%E3%82%A3%E3%82%B0%E3%83%AC%E3%83%BC%E3%83%AB","description":"|image_name = Bernard-Stiegler.jpg\n'''ベルナール・スティグレール'''('''Bernard Stiegler''',[[1952年]][[4月1日]] - )は、[[フランス]]の[[哲学者]]。\n","position":{"x":-212.89325104742056,"y":-142.05921029473706},"image":"http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/wikipedia.png","created_by":"u-raphv"},{"_id":"node-2012-08-22-9da6eef6c6391d05-0003","title":"Wiki: Bernard Stiegler","uri":"http://fr.wikipedia.org/wiki/Bernard_Stiegler","description":"Bernard Stiegler, né le 1 | avril | 1952, est un philosophe français qui axe sa réflexion sur les enjeux des mutations actuelles — ... ","position":{"x":-199.613212880364,"y":-297.6715155910511},"image":"http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/wikipedia.png","created_by":"u-raphv"},{"_id":"node-2012-08-22-9da6eef6c6391d05-0004","title":"Tag: Stiegler","uri":"http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/search/?search=Stiegler&field=all","description":"Tag 'Stiegler'","position":{"x":-68.40773762286169,"y":-205.76155213199334},"image":"http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/ldt-tag.png","created_by":"u-raphv"},{"_id":"node-2012-08-22-9da6eef6c6391d05-0009","title":"Wiki: Humanités numériques","uri":"http://fr.wikipedia.org/wiki/Humanit%C3%A9s_num%C3%A9riques","description":"une proposition de définition a été élaborée lors du THATCamp des 18 et 19 mai 2010 sous la forme d'un « Manifeste des digital humanities : ... ","position":{"x":-227.84295519248332,"y":91.1816115015538},"image":"http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/wikipedia.png","created_by":"u-raphv"},{"_id":"node-2012-08-22-9da6eef6c6391d05-000a","title":"Wiki: デジタル・ヒューマニティーズ","uri":"http://ja.wikipedia.org/wiki/%E3%83%87%E3%82%B8%E3%82%BF%E3%83%AB%E3%83%BB%E3%83%92%E3%83%A5%E3%83%BC%E3%83%9E%E3%83%8B%E3%83%86%E3%82%A3%E3%83%BC%E3%82%BA","description":"...(digital humanities)は、コンピューティングと人文科学(humanities)諸分野と間の接点に関して調査、研究、教育、および�\n* Centre for Computing in the Humanities\n","position":{"x":-221.48701615763574,"y":242.80740052545508},"image":"http://www.iri.centrepompidou.fr/dev/~veltr/hitachi-tests/img/wikipedia.png","created_by":"u-raphv"},{"_id":"node-2012-08-22-9da6eef6c6391d05-000b","title":"Digital studies","uri":"","description":"","position":{"x":-62.798895620242085,"y":32.09820725365255},"created_by":"u-raphv"},{"_id":"node-2012-08-22-9da6eef6c6391d05-000c","title":"Digital Humanities","uri":"","description":"","position":{"x":-110.57020731070799,"y":160.92139209086253},"created_by":"u-raphv"},{"_id":"node-2012-08-22-b778a9fc31296d6b-0008","title":"Les rétentions (Tweet)","uri":"http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/e328e188-ff2f-11e0-b9e1-00145ea49a02/#id=a924b90c-46a1-4f0a-9e13-bcf69f7b5de0-127750274034049024","description":"Tweet by Vincent Puig: #tfcem Les rétentions primaires (perception) s'aggrégent et forment des rétentions secondaires (mémoire), gravées sur rétentions tertiaires","position":{"x":186.15055288633457,"y":-184.66836073709257},"image":"http://a1.twimg.com/profile_images/379424006/PortaitVP120Ko_normal.jpg","created_by":"u-cybunk"},{"_id":"node-2012-08-22-b778a9fc31296d6b-0009","title":"L'origine de la géométrie (Tweet)","uri":"http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/e328e188-ff2f-11e0-b9e1-00145ea49a02/#id=5b34ae61-ffb1-4535-a479-007cb0ef57e8-127752118743474177","description":"Tweet by Vincent Puig: #tfcem L'origine de la géométrie: l'écriture est processus long de transindividuation. Nos tweets quasi temps réel sont de même nature++","position":{"x":87.82365160023906,"y":-280.3591650733953},"image":"http://a1.twimg.com/profile_images/379424006/PortaitVP120Ko_normal.jpg","created_by":"u-cybunk"},{"_id":"node-2012-08-22-b778a9fc31296d6b-000a","title":"Polemictweet : un outil Digital Studies (Tweet)","uri":"http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/e328e188-ff2f-11e0-b9e1-00145ea49a02/#id=4b34e895-221b-467b-a0f2-8ff4ae87cae4-127758736415666177","description":"Tweet by Vincent Puig:\n#tfcem Polemictweet : un outil Digital Studies pensé à l'IRI comme rétention tertiaire numérique avec les même armes que l'industrie","position":{"x":168.59118089416432,"y":57.97933221077804},"image":"http://a1.twimg.com/profile_images/379424006/PortaitVP120Ko_normal.jpg","created_by":"u-cybunk"},{"_id":"node-2012-08-22-b778a9fc31296d6b-000f","title":"Rétention (Définition AI)","uri":"http://arsindustrialis.org/vocabulaire-ars-industrialis/r%C3%A9tention","description":"Les rétentions sont ce qui est retenu ou recueilli par la conscience. Ce terme est emprunté à Husserl ; mais les rétentions tertiaires sont propres à la philosophie de Bernard Stiegler.\n\nLes rétentions sont des sélections : dans le flux de conscience que vous êtes vous ne pouvez pas tout retenir, ce que vous retenez est ce que vous êtes, mais ce que vous retenez dépend ce que vous avez déjà retenu.\n\nL’espèce humaine, étant originairement constituée par sa prothéticité, dispose d’une troisième mémoire, ni génétique, ni épigénétique : le milieu épiphylogénétique, comme ensemble des rétentions tertiaires formant des dispositifs rétentionels.","position":{"x":276.41820932461013,"y":-62.82646518900019},"image":"http://www.arsindustrialis.org/sites/default/files/userfiles/user3/Logovocabulairenoir.JPG","created_by":"u-cybunk"},{"_id":"node-2012-08-22-5b349e49066c1b01-0001","title":"Polemic Tweet","uri":"http://polemictweet.com/","description":"Polemic Tweet Web Site","position":{"x":220.96817493563964,"y":196.75746750735607},"image":"http://www.polemictweet.com/images/ENMI_2010_logo.gif","created_by":"u-cybunk"}],"edges":[{"_id":"edge-2012-08-22-9da6eef6c6391d05-0005","title":"is about","uri":"","description":"","from":"node-2012-08-22-9da6eef6c6391d05-0002","to":"node-2012-08-22-9da6eef6c6391d05-0004","created_by":"u-raphv"},{"_id":"edge-2012-08-22-9da6eef6c6391d05-0006","title":"is about","uri":"","description":"","from":"node-2012-08-22-9da6eef6c6391d05-0003","to":"node-2012-08-22-9da6eef6c6391d05-0004","created_by":"u-raphv"},{"_id":"edge-2012-08-22-9da6eef6c6391d05-0007","title":"speech by","uri":"","description":"","from":"node-2012-08-22-9da6eef6c6391d05-0001","to":"node-2012-08-22-9da6eef6c6391d05-0004","created_by":"u-raphv"},{"_id":"edge-2012-08-22-b778a9fc31296d6b-0001","title":"is about","uri":"","description":"","from":"node-2012-08-22-9da6eef6c6391d05-0001","to":"node-2012-08-22-9da6eef6c6391d05-000b","created_by":"u-raphv"},{"_id":"edge-2012-08-22-b778a9fc31296d6b-0002","title":"Are related to","uri":"","description":"","from":"node-2012-08-22-9da6eef6c6391d05-000b","to":"node-2012-08-22-9da6eef6c6391d05-000c","created_by":"u-raphv"},{"_id":"edge-2012-08-22-b778a9fc31296d6b-0003","title":"is about","uri":"","description":"","from":"node-2012-08-22-9da6eef6c6391d05-0009","to":"node-2012-08-22-9da6eef6c6391d05-000c","created_by":"u-raphv"},{"_id":"edge-2012-08-22-b778a9fc31296d6b-0004","title":"is about","uri":"","description":"","from":"node-2012-08-22-9da6eef6c6391d05-000a","to":"node-2012-08-22-9da6eef6c6391d05-000c","created_by":"u-raphv"},{"_id":"edge-2012-08-22-b778a9fc31296d6b-000b","title":"is about","uri":"","description":"","from":"node-2012-08-22-b778a9fc31296d6b-000a","to":"node-2012-08-22-9da6eef6c6391d05-000b","created_by":"u-raphv"},{"_id":"edge-2012-08-22-b778a9fc31296d6b-000c","title":"tweeted during","uri":"","description":"","from":"node-2012-08-22-b778a9fc31296d6b-0009","to":"node-2012-08-22-9da6eef6c6391d05-0001","created_by":"u-cybunk"},{"_id":"edge-2012-08-22-b778a9fc31296d6b-000d","title":"tweeted during","uri":"","description":"","from":"node-2012-08-22-b778a9fc31296d6b-0008","to":"node-2012-08-22-9da6eef6c6391d05-0001","created_by":"u-cybunk"},{"_id":"edge-2012-08-22-b778a9fc31296d6b-000e","title":"tweeted during","uri":"","description":"","from":"node-2012-08-22-b778a9fc31296d6b-000a","to":"node-2012-08-22-9da6eef6c6391d05-0001","created_by":"u-cybunk"},{"_id":"edge-2012-08-22-b778a9fc31296d6b-0011","title":"is about","uri":"","description":"","from":"node-2012-08-22-b778a9fc31296d6b-0008","to":"node-2012-08-22-b778a9fc31296d6b-000f","created_by":"u-cybunk"},{"_id":"edge-2012-08-22-b778a9fc31296d6b-0012","title":"is about","uri":"","description":"","from":"node-2012-08-22-b778a9fc31296d6b-000a","to":"node-2012-08-22-b778a9fc31296d6b-000f","created_by":"u-cybunk"},{"_id":"edge-2012-08-22-5b349e49066c1b01-0002","title":"is about","uri":"","description":"","from":"node-2012-08-22-b778a9fc31296d6b-000a","to":"node-2012-08-22-5b349e49066c1b01-0001","created_by":"u-cybunk"},{"_id":"edge-2012-09-06-70cc0c2d5e1112d3-0001","title":"is an example of","uri":"","description":"","from":"node-2012-08-22-b778a9fc31296d6b-000a","to":"node-2012-08-22-9da6eef6c6391d05-000b","created_by":"u-iri"},{"_id":"edge-2012-09-06-70cc0c2d5e1112d3-0002","title":"tool used","uri":"","description":"","from":"node-2012-08-22-5b349e49066c1b01-0001","to":"node-2012-08-22-b778a9fc31296d6b-000a","created_by":"u-iri"}],"id":"f4d002b7-d4fd-486c-8898-6c6ceebc3354","title":"Renkan","description":"(empty description)","uri":null,"color":null,"revCounter":2241,"created":"2013-03-18T10:32:40.253+0000","space_id":"17f968e4-2640-4319-aa61-b5b8b527ebb4","updated":"2013-05-13T16:17:35.412+0000"} \ No newline at end of file diff -r f53a7999ae7b -r 15e048e00002 client/js/ldtjson-bin.js --- a/client/js/ldtjson-bin.js Fri Jun 14 12:36:32 2013 +0200 +++ b/client/js/ldtjson-bin.js Wed Jul 03 13:42:59 2013 +0200 @@ -1,8 +1,11 @@ -Rkns.Ldt = {}; +(function(Rkns) { +"use strict" -Rkns.Ldt.Bin = function(_renkan, _opts) { +var Ldt = Rkns.Ldt = {}; + +var Bin = Ldt.Bin = function(_renkan, _opts) { if (_opts.ldt_type) { - var resclass = Rkns.Ldt[_opts.ldt_type+"Bin"]; + var resclass = Ldt[_opts.ldt_type+"Bin"]; if (resclass) { return new resclass(_renkan, _opts); } @@ -10,19 +13,19 @@ console.error("No such LDT Bin Type"); }; -Rkns.Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin); +var ProjectBin = Ldt.ProjectBin = Rkns.Utils.inherit(Rkns._BaseBin); -Rkns.Ldt.ProjectBin.prototype.tagTemplate = Rkns._.template( +ProjectBin.prototype.tagTemplate = Rkns._.template( '
  • ' + '

    <%=htitle%>

  • ' ); -Rkns.Ldt.ProjectBin.prototype.annotationTemplate = Rkns._.template( +ProjectBin.prototype.annotationTemplate = Rkns._.template( '
  • ' + '

    <%=htitle%>

    <%=hdescription%>

    Start: <%=start%>, End: <%=end%>, Duration: <%=duration%>

  • ' ); -Rkns.Ldt.ProjectBin.prototype._init = function(_renkan, _opts) { +ProjectBin.prototype._init = function(_renkan, _opts) { this.renkan = _renkan; this.proj_id = _opts.project_id; this.ldt_platform = _opts.ldt_platform || "http://ldt.iri.centrepompidou.fr/"; @@ -31,7 +34,7 @@ this.refresh(); }; -Rkns.Ldt.ProjectBin.prototype.render = function(searchstr) { +ProjectBin.prototype.render = function(searchstr) { if (searchstr) { var rxbase = searchstr.replace(/(\W)/g,'\\$1'), _rgxp = new RegExp('('+rxbase+')','gi'), @@ -123,7 +126,7 @@ this.renkan.resizeBins(); }; -Rkns.Ldt.ProjectBin.prototype.refresh = function() { +ProjectBin.prototype.refresh = function() { var _this = this; Rkns.$.ajax({ url: this.ldt_platform + 'ldtplatform/ldt/cljson/id/' + this.proj_id, @@ -135,35 +138,35 @@ }); }; -Rkns.Ldt.Search = function(_renkan, _opts) { +var Search = Ldt.Search = function(_renkan, _opts) { this.renkan = _renkan; this.lang = _opts.lang || "en"; }; -Rkns.Ldt.Search.prototype.getBgClass = function() { +Search.prototype.getBgClass = function() { return "Rk-Ldt-Icon"; }; -Rkns.Ldt.Search.prototype.getSearchTitle = function() { +Search.prototype.getSearchTitle = function() { return this.renkan.translate("Lignes de Temps"); }; -Rkns.Ldt.Search.prototype.search = function(_q) { +Search.prototype.search = function(_q) { this.renkan.tabs.push( - new Rkns.Ldt.ResultsBin(this.renkan, { + new ResultsBin(this.renkan, { search: _q }) ); }; -Rkns.Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin); +var ResultsBin = Ldt.ResultsBin = Rkns.Utils.inherit(Rkns._BaseBin); -Rkns.Ldt.ResultsBin.prototype.segmentTemplate = Rkns._.template( +ResultsBin.prototype.segmentTemplate = Rkns._.template( '
  • ' + '

    <%=htitle%>

    <%=hdescription%>

    Start: <%=start%>, End: <%=end%>, Duration: <%=duration%>

  • ' ); -Rkns.Ldt.ResultsBin.prototype._init = function(_renkan, _opts) { +ResultsBin.prototype._init = function(_renkan, _opts) { this.renkan = _renkan; this.ldt_platform = _opts.ldt_platform || "http://ldt.iri.centrepompidou.fr/"; this.max_results = _opts.max_results || 50; @@ -173,7 +176,7 @@ this.refresh(); }; -Rkns.Ldt.ResultsBin.prototype.render = function(searchstr) { +ResultsBin.prototype.render = function(searchstr) { if (searchstr) { var rxbase = searchstr.replace(/(\W)/g,'\\$1'), _rgxp = new RegExp('('+rxbase+')','gi'), @@ -254,7 +257,7 @@ this.renkan.resizeBins(); }; -Rkns.Ldt.ResultsBin.prototype.refresh = function() { +ResultsBin.prototype.refresh = function() { var _this = this; Rkns.$.ajax({ url: this.ldt_platform + 'ldtplatform/api/ldt/1.0/segments/search/', @@ -269,4 +272,6 @@ _this.render(); } }); -}; \ No newline at end of file +}; + +})(window.Rkns); diff -r f53a7999ae7b -r 15e048e00002 client/js/main.js --- a/client/js/main.js Fri Jun 14 12:36:32 2013 +0200 +++ b/client/js/main.js Wed Jul 03 13:42:59 2013 +0200 @@ -25,13 +25,17 @@ /* Declaring the Renkan Namespace Rkns and Default values */ -if (typeof Rkns !== "object") { - Rkns = {}; +(function(root) { + +"use strict"; + +if (typeof root.Rkns !== "object") { + root.Rkns = {}; } -Rkns.$ = jQuery; - -Rkns._ = _; +var Rkns = root.Rkns; +var $ = Rkns.$ = root.jQuery; +var _ = Rkns._ = root._; Rkns.VERSION = '0.2'; @@ -44,7 +48,9 @@ "#8f198f", "#a800a8", "#d826d8", "#ff00fe", "#e87ce8", "#ff65fe", "#f7d3f7", "#feccfe", "#000000", "#242424", "#484848", "#6d6d6d", "#919191", "#b6b6b6", "#dadada", "#ffffff"]; -Rkns._BaseBin = function(_renkan, _opts) { +Rkns.__renkans = []; + +var _BaseBin = Rkns._BaseBin = function(_renkan, _opts) { if (typeof _renkan !== "undefined") { this.renkan = _renkan; this.renkan.$.find(".Rk-Bin-Main").hide(); @@ -105,16 +111,18 @@ } }; -Rkns._BaseBin.prototype.destroy = function() { +_BaseBin.prototype.destroy = function() { this.$.detach(); this.renkan.resizeBins(); }; /* Point of entry */ -Rkns.Renkan = function(_opts) { +var Renkan = Rkns.Renkan = function(_opts) { var _this = this; + Rkns.__renkans.push(this); + this.options = _.defaults(_opts, Rkns.defaults); Rkns._(this.options.property_files).each(function(f) { @@ -135,15 +143,26 @@ .addClass("Rk-Main") .html(this.template(this)); - if (this.options.show_editor) { - this.renderer = new Rkns.Renderer.Scene(this); - } - this.tabs = []; this.search_engines = []; this.current_user_list = new Rkns.Models.UsersList(); + this.current_user_list.on("add remove", function() { + if (this.renderer) { + this.renderer.redrawUsers(); + } + }); + + this.colorPicker = (function() { + var _tmpl = _.template('
  • '); + return '' + })(); + + if (this.options.show_editor) { + this.renderer = new Rkns.Renderer.Scene(this); + } + if (!this.options.search.length) { this.$.find(".Rk-Web-Search-Form").detach(); } else { @@ -271,9 +290,10 @@ this.$.find(".Rk-Bins-Search-Form").submit(function() { return false; }); + }; -Rkns.Renkan.prototype.template = Rkns._.template( +Renkan.prototype.template = Rkns._.template( '<% if (options.show_bins) { %>

    <%- translate("Select contents:")%>

    ' + '
    " />' + '
      ' @@ -284,7 +304,7 @@ + '<% if (options.show_editor) { %>
      <% } %>' ); -Rkns.Renkan.prototype.translate = function(_text) { +Renkan.prototype.translate = function(_text) { if (Rkns.i18n[this.options.language] && Rkns.i18n[this.options.language][_text]) { return Rkns.i18n[this.options.language][_text]; } @@ -294,16 +314,16 @@ return _text; }; -Rkns.Renkan.prototype.onStatusChange = function() { +Renkan.prototype.onStatusChange = function() { this.renderer.onStatusChange(); }; -Rkns.Renkan.prototype.setSearchEngine = function(_key) { +Renkan.prototype.setSearchEngine = function(_key) { this.search_engine = this.search_engines[_key]; this.$.find(".Rk-Search-Current").attr("class","Rk-Search-Current " + this.search_engine.getBgClass()); }; -Rkns.Renkan.prototype.resizeBins = function() { +Renkan.prototype.resizeBins = function() { var _d = + this.$.find(".Rk-Bins-Head").outerHeight(); this.$.find(".Rk-Bin-Title:visible").each(function() { _d += Rkns.$(this).outerHeight(); @@ -375,5 +395,6 @@ } }; +})(window); /* END main.js */ diff -r f53a7999ae7b -r 15e048e00002 client/js/models.js --- a/client/js/models.js Fri Jun 14 12:36:32 2013 +0200 +++ b/client/js/models.js Wed Jul 03 13:42:59 2013 +0200 @@ -1,5 +1,5 @@ (function() { - + "use strict"; var root = this; var Backbone = root.Backbone; @@ -75,7 +75,7 @@ relatedModel: User }], prepare: function(options) { - project = options.project; + var project = options.project; this.addReference(options, "created_by", project.get("users"), options.created_by, project.current_user); options.description = options.description || ""; return options; @@ -117,7 +117,7 @@ }, ], prepare: function(options) { - project = options.project; + var project = options.project; this.addReference(options, "created_by", project.get("users"), options.created_by, project.current_user); this.addReference(options, "from", project.get("nodes"), options.from); this.addReference(options, "to", project.get("nodes"), options.to); diff -r f53a7999ae7b -r 15e048e00002 client/js/paper-renderer.js --- a/client/js/paper-renderer.js Fri Jun 14 12:36:32 2013 +0200 +++ b/client/js/paper-renderer.js Wed Jul 03 13:42:59 2013 +0200 @@ -1,8 +1,12 @@ /* paper-renderer.js */ -(function() { - -var Rkns = this.Rkns; +(function(root) { + +"use strict"; + +var Rkns = root.Rkns, + _ = Rkns._, + $ = Rkns.$; var Renderer = Rkns.Renderer = {}, _MIN_DRAG_DISTANCE = 2, @@ -111,7 +115,7 @@ } }; -Rkns._(_BaseRepresentation.prototype).extend({ +_(_BaseRepresentation.prototype).extend({ _super: function(_func) { return _BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1)); }, @@ -151,7 +155,7 @@ var _BaseButton = Renderer._BaseButton = Rkns.Utils.inherit(_BaseRepresentation); -Rkns._(_BaseButton.prototype).extend({ +_(_BaseButton.prototype).extend({ moveTo: function(_pos) { this.sector.moveTo(_pos); }, @@ -179,7 +183,7 @@ var NodeRepr = Renderer.Node = Rkns.Utils.inherit(_BaseRepresentation); -Rkns._(NodeRepr.prototype).extend({ +_(NodeRepr.prototype).extend({ _init: function() { this.renderer.node_layer.activate(); this.type = "Node"; @@ -191,7 +195,7 @@ } else { this.h_ratio = 0; } - this.title = Rkns.$('
      ').appendTo(this.renderer.labels_$); + this.title = $('
      ').appendTo(this.renderer.labels_$); if (this.options.editor_mode) { this.normal_buttons = [ new NodeEditButton(this.renderer, null), @@ -309,12 +313,20 @@ } if (!_dontRedrawEdges) { - Rkns._.each(this.project.get("edges").filter(function (ed) { return ((ed.to === this.model) || (ed.from === this.model));}), function(edge, index, list){ - var repr = this.renderer.getRepresentationByModel(edge); - if (repr && typeof repr.from_representation !== "undefined" && typeof repr.from_representation.paper_coords !== "undefined" && typeof repr.to_representation !== "undefined" && typeof repr.to_representation.paper_coords !== "undefined") { - repr.redraw(); + var _this = this; + _.each( + this.project.get("edges").filter( + function (ed) { + return ((ed.get("to") === _this.model) || (ed.get("from") === _this.model)); + } + ), + function(edge, index, list) { + var repr = _this.renderer.getRepresentationByModel(edge); + if (repr && typeof repr.from_representation !== "undefined" && typeof repr.from_representation.paper_coords !== "undefined" && typeof repr.to_representation !== "undefined" && typeof repr.to_representation.paper_coords !== "undefined") { + repr.redraw(); + } } - }, this); + ); } }, @@ -344,7 +356,7 @@ maxX = -Infinity, maxY = -Infinity; - function transformCoords(tabc, relative) { + var transformCoords = function(tabc, relative) { var newCoords = tabc.slice(1).map(function(v, k) { var res = parseFloat(v), isY = k % 2; @@ -437,7 +449,7 @@ this.renderer.throttledPaperDraw(); } else { var _this = this; - Rkns.$(_image).on("load", function() { + $(_image).on("load", function() { _this.showImage(); }); } @@ -469,8 +481,8 @@ } var _uri = this.model.get("uri"); if (_uri) { - Rkns.$('.Rk-Bin-Item').each(function() { - var _el = Rkns.$(this); + $('.Rk-Bin-Item').each(function() { + var _el = $(this); if (_el.attr("data-uri") == _uri) { _el.addClass("selected"); } @@ -493,7 +505,7 @@ b.hide(); }); this.circle.strokeWidth = this.options.node_stroke_width; - Rkns.$('.Rk-Bin-Item').removeClass("selected"); + $('.Rk-Bin-Item').removeClass("selected"); if (this.renderer.minimap) { this.minimap_circle.strokeColor = undefined; } @@ -567,7 +579,7 @@ var Edge = Renderer.Edge = Rkns.Utils.inherit(_BaseRepresentation); -Rkns._(Edge.prototype).extend({ +_(Edge.prototype).extend({ _init: function() { this.renderer.edge_layer.activate(); this.type = "Edge"; @@ -585,7 +597,7 @@ [ 0, this.options.edge_arrow_width ] ); this.arrow.__representation = this; - this.text = Rkns.$('
      ').appendTo(this.renderer.labels_$); + this.text = $('
      ').appendTo(this.renderer.labels_$); this.arrow_angle = 0; if (this.options.editor_mode) { this.normal_buttons = [ @@ -779,7 +791,7 @@ b.destroy(); }); var _this = this; - this.bundle.edges = Rkns._(this.bundle.edges).reject(function(_edge) { + this.bundle.edges = _(this.bundle.edges).reject(function(_edge) { return _edge === _this; }); } @@ -789,7 +801,7 @@ var TempEdge = Renderer.TempEdge = Rkns.Utils.inherit(_BaseRepresentation); -Rkns._(TempEdge.prototype).extend({ +_(TempEdge.prototype).extend({ _init: function() { this.renderer.edge_layer.activate(); this.type = "Temp-edge"; @@ -876,17 +888,17 @@ var _BaseEditor = Renderer._BaseEditor = Rkns.Utils.inherit(_BaseRepresentation); -Rkns._(_BaseEditor.prototype).extend({ +_(_BaseEditor.prototype).extend({ _init: function() { this.renderer.buttons_layer.activate(); this.type = "editor"; this.editor_block = new paper.Path(); - var _pts = Rkns._(Rkns._.range(8)).map(function() {return [0,0];}); + var _pts = _(_.range(8)).map(function() {return [0,0];}); this.editor_block.add.apply(this.editor_block, _pts); this.editor_block.strokeWidth = this.options.tooltip_border_width; this.editor_block.strokeColor = this.options.tooltip_border_color; this.editor_block.opacity = .8; - this.editor_$ = Rkns.$('
      ') + this.editor_$ = $('
      ') .appendTo(this.renderer.editor_$) .css({ position: "absolute", @@ -904,22 +916,22 @@ var NodeEditor = Renderer.NodeEditor = Rkns.Utils.inherit(_BaseEditor); -Rkns._(NodeEditor.prototype).extend({ -template: Rkns._.template( +_(NodeEditor.prototype).extend({ +template: _.template( '

      ×<%-renkan.translate("Edit Node")%>

      ' + '

      ' + '<% if (options.show_node_editor_uri) { %>

      <% } %>' + '<% if (options.show_node_editor_description) { %>

      <% } %>' + '<% if (options.show_node_editor_size) { %>

      <%-renkan.translate("Size:")%>-<%-node.size%>+

      <% } %>' - + '<% if (options.show_node_editor_color) { %>
      <%-renkan.translate("Node color:")%>
        ' - + '<% _(Rkns.pickerColors).each(function(c) { %>
      • <% }); %>
      <%- renkan.translate("Choose color") %>
      <% } %>' + + '<% if (options.show_node_editor_color) { %>
      <%-renkan.translate("Node color:")%>
      ' + + '<%= renkan.colorPicker %><%- renkan.translate("Choose color") %>
      <% } %>' + '<% if (options.show_node_editor_image) { %>
      ' + '<% if (node.clip_path) { %><% }%>' + '

      ' + '

      <% } %>' + '<% if (options.show_node_editor_creator && node.has_creator) { %>

      <%-renkan.translate("Created by:")%> <%- shortenText(node.created_by_title, 25) %>

      <% } %>' ), -readOnlyTemplate: Rkns._.template( +readOnlyTemplate: _.template( '

      ×<% if (options.show_node_tooltip_color) { %><% } %>' + '<% if (node.uri) { %><% } %><%-node.title%><% if (node.uri) { %><% } %>

      ' + '<% if (node.uri && options.show_node_tooltip_uri) { %>

      <%-node.short_uri%>

      <% } %>' @@ -970,8 +982,8 @@ if (this.renderer.isEditable()) { - var onFieldChange = Rkns._(function() { - Rkns._(function() { + var onFieldChange = _(function() { + _(function() { if (_this.renderer.isEditable()) { var _data = { title: _this.editor_$.find(".Rk-Edit-Title").val() @@ -1058,7 +1070,7 @@ } }); - function shiftSize(n) { + var shiftSize = function(n) { if (_this.renderer.isEditable()) { var _newsize = n+(_model.get("size") || 0); _this.editor_$.find(".Rk-Edit-Size-Value").text((_newsize > 0 ? "+" : "") + _newsize); @@ -1094,8 +1106,8 @@ var EdgeEditor = Renderer.EdgeEditor = Rkns.Utils.inherit(_BaseEditor); -Rkns._(EdgeEditor.prototype).extend({ -template: Rkns._.template( +_(EdgeEditor.prototype).extend({ +template: _.template( '

      ×<%-renkan.translate("Edit Edge")%>

      ' + '

      ' + '<% if (options.show_edge_editor_uri) { %>

      ' @@ -1104,14 +1116,14 @@ + '<% _(ontology.properties).each(function(property) { var uri = ontology["base-uri"] + property.uri; %>' + '<% }) %><% }) %>

      <% } } %>' - + '<% if (options.show_edge_editor_color) { %>
      <%-renkan.translate("Edge color:")%>
        ' - + '<% _(Rkns.pickerColors).each(function(c) { %>
      • <% }); %>
      <%- renkan.translate("Choose color") %>
      <% } %>' + + '<% if (options.show_edge_editor_color) { %>
      <%-renkan.translate("Edge color:")%>
      ' + + '<%= renkan.colorPicker %><%- renkan.translate("Choose color") %>
      <% } %>' + '<% if (options.show_edge_editor_direction) { %>

      <%- renkan.translate("Change edge direction") %>

      <% } %>' + '<% if (options.show_edge_editor_nodes) { %>

      <%-renkan.translate("From:")%><%- shortenText(edge.from_title, 25) %>

      ' + '

      <%-renkan.translate("To:")%><%- shortenText(edge.to_title, 25) %>

      <% } %>' + '<% if (options.show_edge_editor_creator && edge.has_creator) { %>

      <%-renkan.translate("Created by:")%><%- shortenText(edge.created_by_title, 25) %>

      <% } %>' ), -readOnlyTemplate: Rkns._.template( +readOnlyTemplate: _.template( '

      ×<% if (options.show_edge_tooltip_color) { %><% } %>' + '<% if (edge.uri) { %><% } %><%-edge.title%><% if (edge.uri) { %><% } %>

      ' + '<% if (options.show_edge_tooltip_uri && edge.uri) { %>

      <%-edge.short_uri%>

      <% } %>' @@ -1144,7 +1156,7 @@ }, renkan: this.renkan, shortenText: shortenText, - options: this.options, + options: this.options })); this.redraw(); var _this = this, @@ -1161,8 +1173,8 @@ if (this.renderer.isEditable()) { - var onFieldChange = Rkns._(function() { - Rkns._(function() { + var onFieldChange = _(function() { + _(function() { if (_this.renderer.isEditable()) { var _data = { title: _this.editor_$.find(".Rk-Edit-Title").val() @@ -1254,7 +1266,7 @@ var _NodeButton = Renderer._NodeButton = Rkns.Utils.inherit(_BaseButton); -Rkns._(_NodeButton.prototype).extend({ +_(_NodeButton.prototype).extend({ setSectorSize: function() { var sectorInner = this.source_representation.circle_radius; if (sectorInner !== this.lastSectorInner) { @@ -1279,7 +1291,7 @@ var NodeEditButton = Renderer.NodeEditButton = Rkns.Utils.inherit(_NodeButton); -Rkns._(NodeEditButton.prototype).extend({ +_(NodeEditButton.prototype).extend({ _init: function() { this.type = "Node-edit-button"; this.lastSectorInner = 0; @@ -1299,7 +1311,7 @@ var NodeRemoveButton = Renderer.NodeRemoveButton = Rkns.Utils.inherit(_NodeButton); -Rkns._(NodeRemoveButton.prototype).extend({ +_(NodeRemoveButton.prototype).extend({ _init: function() { this.type = "Node-remove-button"; this.lastSectorInner = 0; @@ -1333,7 +1345,7 @@ var NodeRevertButton = Renderer.NodeRevertButton = Rkns.Utils.inherit(_NodeButton); -Rkns._(NodeRevertButton.prototype).extend({ +_(NodeRevertButton.prototype).extend({ _init: function() { this.type = "Node-revert-button"; this.lastSectorInner = 0; @@ -1355,7 +1367,7 @@ var NodeLinkButton = Renderer.NodeLinkButton = Rkns.Utils.inherit(_NodeButton); -Rkns._(NodeLinkButton.prototype).extend({ +_(NodeLinkButton.prototype).extend({ _init: function() { this.type = "Node-link-button"; this.lastSectorInner = 0; @@ -1382,7 +1394,7 @@ var NodeEnlargeButton = Renderer.NodeEnlargeButton = Rkns.Utils.inherit(_NodeButton); -Rkns._(NodeEnlargeButton.prototype).extend({ +_(NodeEnlargeButton.prototype).extend({ _init: function() { this.type = "Node-enlarge-button"; this.lastSectorInner = 0; @@ -1404,7 +1416,7 @@ var NodeShrinkButton = Renderer.NodeShrinkButton = Rkns.Utils.inherit(_NodeButton); -Rkns._(NodeShrinkButton.prototype).extend({ +_(NodeShrinkButton.prototype).extend({ _init: function() { this.type = "Node-shrink-button"; this.lastSectorInner = 0; @@ -1426,7 +1438,7 @@ var EdgeEditButton = Renderer.EdgeEditButton = Rkns.Utils.inherit(_BaseButton); -Rkns._(EdgeEditButton.prototype).extend({ +_(EdgeEditButton.prototype).extend({ _init: function() { this.type = "Edge-edit-button"; this.sector = this.renderer.drawSector(this, _EDGE_BUTTON_INNER, _EDGE_BUTTON_OUTER, -270, -90, 1, "edit", this.renkan.translate("Edit")); @@ -1442,7 +1454,7 @@ var EdgeRemoveButton = Renderer.EdgeRemoveButton = Rkns.Utils.inherit(_BaseButton); -Rkns._(EdgeRemoveButton.prototype).extend({ +_(EdgeRemoveButton.prototype).extend({ _init: function() { this.type = "Edge-remove-button"; this.sector = this.renderer.drawSector(this, _EDGE_BUTTON_INNER, _EDGE_BUTTON_OUTER, -90, 90, 1, "remove", this.renkan.translate("Remove")); @@ -1472,7 +1484,7 @@ var EdgeRevertButton = Renderer.EdgeRevertButton = Rkns.Utils.inherit(_BaseButton); -Rkns._(EdgeRevertButton.prototype).extend({ +_(EdgeRevertButton.prototype).extend({ _init: function() { this.type = "Edge-revert-button"; this.sector = this.renderer.drawSector(this, _EDGE_BUTTON_INNER, _EDGE_BUTTON_OUTER, -135, 135, 1, "revert", this.renkan.translate("Cancel deletion")); @@ -1490,7 +1502,7 @@ var MiniFrame = Renderer.MiniFrame = Rkns.Utils.inherit(_BaseRepresentation); -Rkns._(MiniFrame.prototype).extend({ +_(MiniFrame.prototype).extend({ paperShift: function(_delta) { this.renderer.offset = this.renderer.offset.subtract(_delta.divide(this.renderer.minimap.scale).multiply(this.renderer.scale)); this.renderer.redraw(); @@ -1505,7 +1517,7 @@ var Scene = Renderer.Scene = function(_renkan) { this.renkan = _renkan; - this.$ = Rkns.$(".Rk-Render"); + this.$ = $(".Rk-Render"); this.representations = []; this.$.html(this.template(_renkan)); this.onStatusChange(); @@ -1556,7 +1568,7 @@ this.minimap.miniframe.__representation = new MiniFrame(this, null); } - this.throttledPaperDraw = Rkns._(function() { + this.throttledPaperDraw = _(function() { paper.view.draw(); }).throttle(100); @@ -1677,7 +1689,7 @@ _event.preventDefault(); _allowScroll = true; var res = {}; - Rkns._(_event.originalEvent.dataTransfer.types).each(function(t) { + _(_event.originalEvent.dataTransfer.types).each(function(t) { try { res[t] = _event.originalEvent.dataTransfer.getData(t); } catch(e) {} @@ -1747,9 +1759,9 @@ return false; }); this.$.find(".Rk-TopBar-Button").mouseover(function() { - Rkns.$(this).find(".Rk-TopBar-Tooltip").show(); + $(this).find(".Rk-TopBar-Tooltip").show(); }).mouseout(function() { - Rkns.$(this).find(".Rk-TopBar-Tooltip").hide(); + $(this).find(".Rk-TopBar-Tooltip").hide(); }); bindClick(".Rk-Fold-Bins", "foldBins"); @@ -1763,7 +1775,7 @@ _this.redraw(); }; - var _thRedraw = Rkns._.throttle(function() { + var _thRedraw = _.throttle(function() { _this.redraw(); },50); @@ -1777,13 +1789,14 @@ _renkan.project.set({"title": $(this).val()}); }); - this.renkan.project.get("users").each(function(_user) { - _this.addUser(_user); - }); + var _thRedrawUsers = _.throttle(function() { + _this.redrawUsers(); + }, 100); - this.renkan.project.on("add:users", function(_user) { - _this.addUser(_user); - }); + _thRedrawUsers(); + + this.renkan.project.on("add:users remove:users", _thRedrawUsers); + this.renkan.project.on("add:nodes", function(_node) { _this.addRepresentation("Node", _node); _thRedraw(); @@ -1823,6 +1836,33 @@ }); } + if (_renkan.options.show_user_list) { + var $cpwrapper = this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"), + $cplist = this.$.find(".Rk-Users .Rk-Edit-ColorPicker"); + + $cpwrapper.hover( + function(_e) { + if (_this.isEditable()) { + _e.preventDefault(); + $cplist.show(); + } + }, + function(_e) { + _e.preventDefault(); + $cplist.hide(); + } + ); + + $cplist.find("li").mouseenter( + function(_e) { + if (_this.isEditable()) { + _e.preventDefault(); + _this.$.find(".Rk-CurrentUser-Color").css("background", $(this).attr("data-color")); + } + } + ); + } + this.redraw(); window.setInterval(function() { @@ -1852,11 +1892,12 @@ }; -Rkns._(Scene.prototype).extend({ -template: Rkns._.template( +_(Scene.prototype).extend({ +template: _.template( '<% if (options.show_top_bar) { %>
      <% if (!options.editor_mode) { %>

      <%- project.get("title") || translate("Untitled project")%>

      ' + '<% } else { %>" placeholder="<%-translate("Untitled project")%>" /><% } %>' - + '<% if (options.show_user_list) { %>
      <unknown user>
        <% } %>' + + '<% if (options.show_user_list) { %>
        ' + + '<%= colorPicker %>
        <unknown user>
          <% } %>' + '<% if (options.home_button_url) {%>
          ' + '<%- translate(options.home_button_title) %>
          <% } %>' + '<% if (options.show_fullscreen_button) { %>
          <%-translate("Full Screen")%>
          <% } %>' @@ -1992,13 +2033,13 @@ if (_img.width) { showImage(); } else { - Rkns.$(_img).on("load",showImage); + $(_img).on("load",showImage); } return _res; }, addToBundles: function(_edgeRepr) { - var _bundle = Rkns._(this.bundles).find(function(_bundle) { + var _bundle = _(this.bundles).find(function(_bundle) { return ( ( _bundle.from === _edgeRepr.from_representation && _bundle.to === _edgeRepr.to_representation ) || ( _bundle.from === _edgeRepr.to_representation && _bundle.to === _edgeRepr.from_representation ) @@ -2013,7 +2054,7 @@ edges: [ _edgeRepr ], getPosition: function(_er) { var _dir = (_er.from_representation === this.from) ? 1 : -1; - return _dir * ( Rkns._(this.edges).indexOf(_er) - (this.edges.length - 1) / 2 ); + return _dir * ( _(this.edges).indexOf(_er) - (this.edges.length - 1) / 2 ); } }; this.bundles.push(_bundle); @@ -2038,6 +2079,7 @@ tip.text(this.renkan.translate("Auto-save enabled")); } } + this.redrawUsers(); }, setScale: function(_newScale, _offset) { if (_newScale > _MIN_SCALE && _newScale < _MAX_SCALE) { @@ -2113,27 +2155,64 @@ _this.addRepresentation(_type, _model); }); }, -userTemplate: Rkns._.template( +userTemplate: _.template( '
        • <%=name%>
        • ' ), -addUser: function(_user) { - if (_user.get("_id") === this.renkan.current_user) { - this.$.find(".Rk-CurrentUser-Name").text(_user.get("title")); - this.$.find(".Rk-CurrentUser-Color").css("background", _user.get("color")); - } else { - this.$.find(".Rk-UserList").append( - Rkns.$( - this.userTemplate({ - name: _user.get("title"), - background: _user.get("color") - }) - ) - ); +redrawUsers: function() { + if (!this.renkan.options.show_user_list) { + return; } + var allUsers = [].concat((this.renkan.project.current_user_list || {}).models || [], (this.renkan.project.get("users") || {}).models || []), + ulistHtml = '', + $userpanel = this.$.find(".Rk-Users"), + $name = $userpanel.find(".Rk-CurrentUser-Name"), + $cpwrapper = $userpanel.find(".Rk-Edit-ColorPicker-Wrapper"), + $cpitems = $userpanel.find(".Rk-Edit-ColorPicker li"), + $colorsquare = $userpanel.find(".Rk-CurrentUser-Color"), + _this = this; + $name.off("click").text(this.renkan.translate("")); + $cpitems.off("mouseleave click"); + allUsers.forEach(function(_user) { + if (_user.get("_id") === _this.renkan.current_user) { + $name.text(_user.get("title")); + if (_this.isEditable()) { + $name.click(function() { + var $this = $(this), + $input = $('').val(_user.get("title")).blur(function() { + _user.set("title", $(this).val()); + _this.redrawUsers(); + _this.redraw(); + }); + $this.empty().html($input); + $input.select(); + }); + + $cpitems.click( + function(_e) { + _e.preventDefault(); + if (_this.isEditable()) { + _user.set("color", $(this).attr("data-color")); + } + $(this).parent().hide(); + } + ).mouseleave(function() { + $colorsquare.css("background", _user.get("color")); + }); + $colorsquare.css("background", _user.get("color")); + } + + } else { + ulistHtml += _this.userTemplate({ + name: _user.get("title"), + background: _user.get("color") + }); + } + }); + $userpanel.find(".Rk-UserList").html(ulistHtml); }, removeRepresentation: function(_representation) { _representation.destroy(); - this.representations = Rkns._(this.representations).reject( + this.representations = _(this.representations).reject( function(_repr) { return _repr == _representation; } @@ -2143,16 +2222,16 @@ if (!_model) { return undefined; } - return Rkns._(this.representations).find(function(_repr) { + return _(this.representations).find(function(_repr) { return _repr.model === _model; }); }, removeRepresentationsOfType: function(_type) { - var _representations = Rkns._(this.representations).filter(function(_repr) { + var _representations = _(this.representations).filter(function(_repr) { return _repr.type == _type; }), _this = this; - Rkns._(_representations).each(function(_repr) { + _(_representations).each(function(_repr) { _this.removeRepresentation(_repr); }); }, @@ -2163,17 +2242,17 @@ } }, unhighlightAll: function(_model) { - Rkns._(this.representations).each(function(_repr) { + _(this.representations).each(function(_repr) { _repr.unhighlight(); }); }, unselectAll: function(_model) { - Rkns._(this.representations).each(function(_repr) { + _(this.representations).each(function(_repr) { _repr.unselect(); }); }, redraw: function() { - Rkns._(this.representations).each(function(_representation) { + _(this.representations).each(function(_representation) { _representation.redraw(true); }); if (this.minimap) { @@ -2270,7 +2349,7 @@ this.addTempEdge(this.click_target, _point); this.click_mode = _CLICKMODE_ENDEDGE; this.notif_$.fadeOut(function() { - Rkns.$(this).html(_renkan.translate("Click on a second node to complete the edge")).fadeIn(); + $(this).html(_renkan.translate("Click on a second node to complete the edge")).fadeIn(); }); } else { this.notif_$.hide(); @@ -2336,9 +2415,9 @@ x: _coords.x, y: _coords.y } - }; + }, _node = this.renkan.project.addNode(_data); - this.getRepresentationByModel(_node).openEditor(); + this.getRepresentationByModel(_node).openEditor(); } paper.view.draw(); }, @@ -2356,7 +2435,7 @@ var newNode = {}; switch(_data["text/x-iri-specific-site"]) { case "twitter": - var snippet = Rkns.$('
          ').html(_data["text/x-iri-selected-html"]), + var snippet = $('
          ').html(_data["text/x-iri-selected-html"]), tweetdiv = snippet.find(".tweet"); newNode.title = _renkan.translate("Tweet by ") + tweetdiv.attr("data-name"); newNode.uri = "http://twitter.com/" + tweetdiv.attr("data-screen-name") + "/status/" + tweetdiv.attr("data-tweet-id"); @@ -2364,7 +2443,7 @@ newNode.description = tweetdiv.find(".js-tweet-text:first").text(); break; case "google": - var snippet = Rkns.$('
          ').html(_data["text/x-iri-selected-html"]); + var snippet = $('
          ').html(_data["text/x-iri-selected-html"]); newNode.title = snippet.find("h3:first").text().trim(); newNode.uri = snippet.find("h3 a").attr("href"); newNode.description = snippet.find(".st:first").text().trim(); @@ -2378,7 +2457,7 @@ newNode.description = (_data["text/plain"] || _data["text/x-iri-selected-text"]).replace(/[\s\n]+/gm,' ').trim(); } if (_data["text/html"] || _data["text/x-iri-selected-html"]) { - var snippet = Rkns.$('
          ').html(_data["text/html"] || _data["text/x-iri-selected-html"]); + var snippet = $('
          ').html(_data["text/html"] || _data["text/x-iri-selected-html"]); var _svgimgs = snippet.find("image"); if (_svgimgs.length) { newNode.image = _svgimgs.attr("xlink:href"); @@ -2538,6 +2617,6 @@ save: function() { }, open: function() { } }); -}).call(window); +})(window); /* END paper-renderer.js */ diff -r f53a7999ae7b -r 15e048e00002 client/render-test.html --- a/client/render-test.html Fri Jun 14 12:36:32 2013 +0200 +++ b/client/render-test.html Wed Jul 03 13:42:59 2013 +0200 @@ -25,9 +25,6 @@ var _renkan; $(function() { _renkan = new Rkns.Renkan({ - show_node_circles: false, - clip_node_images: false, - //node_images_fill_mode: true, bins: [ { title: "Projet Lignes de Temps",