client/README.md
author ymh <ymh.work@gmail.com>
Thu, 12 Jan 2017 14:09:02 +0100
changeset 652 153f5d09a11a
parent 647 eaaa1efce396
permissions -rw-r--r--
Define version 00.13
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
     1
# Renkan - Client configuration
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
     2
398
57f8d344fde9 Correct button shift on hover that appeared after paperjs v 0.9.15
ymh <ymh.work@gmail.com>
parents: 265
diff changeset
     3
Renkan is a tool to simply build oriented graphs by creating nodes and drag'n'droping links,
57f8d344fde9 Correct button shift on hover that appeared after paperjs v 0.9.15
ymh <ymh.work@gmail.com>
parents: 265
diff changeset
     4
pictures and html elements from web pages. Each node can have title, description, uri/url, color,
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
     5
image and specific size. Each node can have title, uri/url and color.
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
     6
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
     7
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
     8
## Embedding Renkan in a web page
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
     9
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    10
Whatever configuration you have, you need to import those javascript files **in that order**...
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    11
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    12
```html
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    13
<script src="[...]/jquery.min.js"></script>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    14
<script src="[...]/jquery.mousewheel.min.js"></script>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    15
<script src="[...]/underscore-min.js"></script>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    16
<script src="[...]/backbone.js"></script>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    17
<script src="[...]/backbone-relational.js"></script>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    18
<script src="[...]/paper.js"></script>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    19
<script src="[...]/renkan.js"></script>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    20
```
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    21
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    22
... and the renkan css file :
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    23
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    24
```html
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    25
<link rel="stylesheet" href="[...]/renkan.css" />
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    26
```
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    27
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    28
Finally, add the div in you DOM :
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    29
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    30
```html
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    31
<div id="renkan"></div>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    32
```
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    33
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    34
Your Renkan should be displayed. Now let's see more specifically the 2 displays possibilities : in body 100% or in a div with set width and height.
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    35
251
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
    36
N.B. : renkan.js is the concatenation of those js files : header.js main.js models.js defaults.js i18n.js paper-renderer.js full-json.js ldtjson-bin.js list-bin.js wikipedia-bin.js.
398
57f8d344fde9 Correct button shift on hover that appeared after paperjs v 0.9.15
ymh <ymh.work@gmail.com>
parents: 265
diff changeset
    37
It is built with the script available in sbin/build/compil.sh.
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    38
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    39
### In body 100%
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    40
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    41
Nothing to add, the html is very simple :
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    42
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    43
```html
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    44
<body>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    45
    <div id="renkan"></div>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    46
</body>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    47
```
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    48
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    49
### In a div
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    50
398
57f8d344fde9 Correct button shift on hover that appeared after paperjs v 0.9.15
ymh <ymh.work@gmail.com>
parents: 265
diff changeset
    51
The renkan div has the css attributes position:absolute/top:0/left:0/bottom:0/right:0,
250
ea459415fdc9 writable renkan in div
cavaliet
parents: 249
diff changeset
    52
so the parent div has to be in position:relative and define width and height. Here is a simple example including css and partial html :
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    53
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    54
```html
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    55
<head>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    56
  <style type="text/css">
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    57
    body{
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    58
        margin: 0 auto;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    59
        width: 960px;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    60
    }
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    61
    .header, .footer {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    62
        font-size: 14px;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    63
        height: 40px;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    64
        padding-top: 10px;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    65
    }
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    66
    .rnk-container{
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    67
        height: 500px;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    68
        position: relative;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    69
        width: 700px;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    70
    }
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    71
  </style>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    72
</head>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    73
<body>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    74
  <div class="header">
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    75
    This is a header
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    76
  </div>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    77
  <div class="rnk-container">
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    78
     <div id="renkan"></div>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    79
  </div>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    80
  <div class="footer">
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    81
    This is a footer
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    82
  </div>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    83
</body>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    84
```
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    85
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    86
## Embedding a read only Renkan
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    87
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    88
To embed a read only Renkan, just add this script tag :
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    89
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    90
```html
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    91
<script type="text/javascript">
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    92
    var _renkan;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    93
    $(function() {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    94
        _renkan = new Rkns.Renkan({
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    95
            editor_mode: false,
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    96
            show_bins: false,
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
    97
        });
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    98
        Rkns.jsonIO(_renkan, {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
    99
            url: "any_local_or_jsonp_url"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   100
        });
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   101
    });
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   102
</script>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   103
```
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   104
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   105
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   106
## Embedding a writable Renkan
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   107
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   108
### Simple mode : no bins on the left, just the canvas
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   109
398
57f8d344fde9 Correct button shift on hover that appeared after paperjs v 0.9.15
ymh <ymh.work@gmail.com>
parents: 265
diff changeset
   110
To embed a simple writable Renkan, just add this script tag. In the client folder, "data/simple-persist.php" makes a very simple persistent url.
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   111
The persistent url is supposed to give the json data on GET request at page load, and save datas at PUT request sent by the browser :
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   112
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   113
```html
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   114
<script type="text/javascript">
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   115
    var _renkan;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   116
    $(function() {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   117
        _renkan = new Rkns.Renkan({
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   118
            show_bins: false
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   119
        });
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   120
        Rkns.jsonIO(_renkan, {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   121
            url: "url_of_a_persistent_connection"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   122
        });
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   123
    });
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   124
</script>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   125
```
249
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   126
3d8937fa93a8 read me dans clearer test pages
cavaliet
parents:
diff changeset
   127
251
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   128
## Search and bins
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   129
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   130
On the right of your renkan interface, you can add some search engine and data bins.
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   131
398
57f8d344fde9 Correct button shift on hover that appeared after paperjs v 0.9.15
ymh <ymh.work@gmail.com>
parents: 265
diff changeset
   132
Search engine can be the current [IRI's Lignes de temps platform](http://ldt.iri.centrepompidou.fr/) and wikipedia in any available language.
251
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   133
Here is an example of configuration :
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   134
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   135
```js
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   136
_renkan = new Rkns.Renkan({
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   137
    search: [
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   138
            {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   139
                type: "Ldt"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   140
            },
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   141
            {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   142
                type: "Wikipedia",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   143
                lang: "fr"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   144
            },
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   145
            {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   146
                type: "Wikipedia",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   147
                lang: "ja"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   148
            }
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   149
    ]
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   150
});
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   151
Rkns.jsonIO(_renkan, {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   152
    url: "data/simple-persist.php"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   153
});
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   154
```
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   155
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   156
You can also define data bins : annotations loaded from IRI's Lignes de temps projects, and any resources which can be drag and dropped into the renkan.
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   157
Resources can be simple texts, links or objects with title, description, url and image. Here is an example of configuration :
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   158
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   159
```js
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   160
_renkan = new Rkns.Renkan({
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   161
    search: [
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   162
        ...
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   163
    ],
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   164
    bins: [
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   165
        {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   166
            title: "To be or not to be on Lignes de Temps",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   167
            type: "Ldt",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   168
            ldt_type: "Project",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   169
            project_id: "6af4019c-8283-11e2-9678-00145ea4a2be",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   170
            ldt_platform: "http://ldt.iri.centrepompidou.fr/"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   171
        },
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   172
        {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   173
            type: "ResourceList",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   174
            title: "Ressources",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   175
            list: [
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   176
                {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   177
                    url: "http://www.google.com/",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   178
                    title: "Google",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   179
                    description: "Search engine",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   180
                    image: "http://www.google.fr/images/srpr/logo4w.png"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   181
                },
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   182
                "Polemic Tweet http://www.polemictweet.com",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   183
                "Twitter http://www.twitter.com/"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   184
            ]
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   185
        }
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   186
    ]
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   187
});
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   188
Rkns.jsonIO(_renkan, {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   189
    url: "data/simple-persist.php"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   190
});
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   191
```
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   192
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   193
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   194
If you embed the renkan in a div, the renkan container css should have overflow:hidden in order to hide bins when the user wants to.
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   195
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   196
## More configuration
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   197
647
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   198
You can configure several things here are some examples:
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   199
* the language of your interface, english (default) or french
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   200
* you can fill your nodes with black color instead of transparent.
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   201
* thanks to an external file, you can define properties for links between node.
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   202
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   203
```js
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   204
_renkan = new Rkns.Renkan({
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   205
    ...
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   206
    property_files: [ "data/properties.json" ],
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   207
    node_fill_color: true,
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   208
    language: "fr"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   209
});
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   210
```
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   211
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   212
Here is an example of properties file :
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   213
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   214
```json
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   215
[
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   216
    {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   217
        "label": "Dublin Core Metadata",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   218
        "base-uri": "http://purl.org/dc/elements/1.1/",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   219
        "properties": [
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   220
            {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   221
                "uri": "creator",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   222
                "label": "created by"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   223
            }, {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   224
                "uri": "date",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   225
                "label": "has date"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   226
            }, {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   227
                "uri": "subject",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   228
                "label": "has subject"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   229
            }
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   230
        ]
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   231
    }, {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   232
        "label": "SKOS Semantic relations",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   233
        "base-uri": "http://www.w3.org/2004/02/skos/core#",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   234
        "properties": [
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   235
            {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   236
                "uri": "broader",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   237
                "label": "has broader"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   238
            }, {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   239
                "uri": "narrower",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   240
                "label": "has narrower"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   241
            }, {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   242
                "uri": "related",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   243
                "label": "has related"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   244
            }
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   245
        ]
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   246
    }
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   247
]
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   248
```
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   249
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   250
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   251
Finally, here is an example of full configuration :
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   252
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   253
```html
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   254
<script type="text/javascript">
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   255
    var _renkan;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   256
    $(function() {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   257
        _renkan = new Rkns.Renkan({
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   258
            search: [
251
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   259
                {
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   260
                    type: "Ldt"
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   261
                },
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   262
                {
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   263
                    type: "Wikipedia",
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   264
                    lang: "fr"
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   265
                },
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   266
                {
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   267
                    type: "Wikipedia",
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   268
                    lang: "ja"
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   269
                }
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   270
            ],
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   271
            bins: [
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   272
                {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   273
                    title: "Projet Lignes de Temps",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   274
                    type: "Ldt",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   275
                    ldt_type: "Project",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   276
                    project_id: "6af4019c-8283-11e2-9678-00145ea4a2be",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   277
                    ldt_platform: "http://ldt.iri.centrepompidou.fr/"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   278
               },
251
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   279
                {
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   280
                    type: "ResourceList",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   281
                    title: "Ressources",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   282
                    list: [
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   283
                        {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   284
                            url: "http://www.google.com/",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   285
                            title: "Google",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   286
                            description: "Search engine",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   287
                            image: "http://www.google.fr/images/srpr/logo4w.png"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   288
                        },
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   289
                        "Polemic Tweet http://www.polemictweet.com",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   290
                        "Twitter http://www.twitter.com/"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   291
                    ]
251
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   292
                }
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   293
            ],
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   294
            property_files: [ "data/properties.json" ],
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   295
            node_fill_color: false,
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   296
            language: "fr"
251
163b59b3e50b update writable demo and read me.
cavaliet
parents: 250
diff changeset
   297
        });
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   298
        Rkns.jsonIO(_renkan, {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   299
            url: "data/simple-persist.php"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   300
        });
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   301
    });
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   302
</script>
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   303
```
264
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   304
647
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   305
All the possible configurations (with some minimal documentation) are found in the `js/defaults.js` file.
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   306
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   307
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   308
## Templates configuration
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   309
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   310
A significant part of the renkan dialogs and interface are defined in templates and these templates cant be overrided.
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   311
The template system uses `underscore` templates ([http://underscorejs.org/#template](http://underscorejs.org/#template)).
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   312
The templates are compiled beforehand (c.f. `jst` `bower` task).
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   313
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   314
The list of templates is found under the `templates/` directory.
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   315
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   316
2 options control the template system `templates` and `node_editor-templates`, examples :
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   317
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   318
```js
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   319
_renkan = new Rkns.Renkan({
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   320
    ...
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   321
    templates: custom_templates,
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   322
    node_editor_templates: {
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   323
        "audio": "nodeeditor_audio"
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   324
    }
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   325
    ...
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   326
});
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   327
```
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   328
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   329
Example of such settings can be found in the following files :
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   330
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   331
- `test/test-readonly-custom-templates.html`,
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   332
- `test/test-readonly-custom-templates-youtube.html`,
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   333
- `test/test-writable-custom-templates.html`,
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   334
- `test/test-writable-custom-templates-youtube.html`
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   335
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   336
### `templates` parameter
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   337
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   338
This must be a dictionary of JST templates (keys : string and values are JST compiled templates). This dictionnary will be merged with the default templates dictionnary.
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   339
its default key list are :
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   340
- `templates/colorpicker.html`: color picker template
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   341
- `templates/edgeeditor_readonly.html`: template for edges popup in read mode
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   342
- `templates/edgeeditor.html`: template for the edge editor in write mode
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   343
- `templates/main.html`: mais display template
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   344
- `templates/nodeeditor.html`: template for node editor in write mode
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   345
- `templates/nodeeditor_readonly.html`: template for nodes popup in read mode with `default` node type
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   346
- `templates/nodeeditor_video.html`: template for nodes popup in read mode with `video` node type. This displays a simple video html5 element with the node uri as single video source.
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   347
- `templates/scene.html`: The renkan editor and display main template
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   348
- `templates/search.html`: Search result for web search bin
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   349
- `templates/wikipedia-bin/resulttemplate.html`: template for wikipedia search result (wikipedia bin)
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   350
- `templates/ldtjson-bin/annotationtemplate.html`: template for ldt project annotation (ldt bin)
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   351
- `templates/ldtjson-bin/segmenttemplate.html`: template for ldt project segment (ldt bin)
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   352
- `templates/ldtjson-bin/tagtemplate.html`: template for ldt project tags (ldt bin)
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   353
- `templates/list-bin.html`: template for bin result list
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   354
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   355
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   356
### `node_editor_templates` parameter
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   357
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   358
This dictionnary gives a mapping between node types and the keys for "read-mode" templates for node.
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   359
The keys are node types, the value are templates keys (c.f. above `templates` parameter).
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   360
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   361
This dictionnary is merged with the default dictionnary and the keys of the result will populate the dropdown list for types in the node editor.
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   362
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   363
The value of the default dictionnary is:
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   364
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   365
```js
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   366
{
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   367
    default: "templates/nodeeditor_readonly.html",
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   368
    video: "templates/nodeeditor_video.html"
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   369
}
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   370
```
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   371
527
e5d023194681 update the README and add a new section "Url Parameters"
rougeronj
parents: 493
diff changeset
   372
## Url Parameters
e5d023194681 update the README and add a new section "Url Parameters"
rougeronj
parents: 493
diff changeset
   373
e5d023194681 update the README and add a new section "Url Parameters"
rougeronj
parents: 493
diff changeset
   374
Renkan accepts few Hash parameters allowing you to change the view, navigate in the map, highlight some nodes, etc. (e.g: http://myrenkan.com/renkan1/#?viewIndex=2&idNode=12345)
e5d023194681 update the README and add a new section "Url Parameters"
rougeronj
parents: 493
diff changeset
   375
Here is an exhaustive list of these parameters:
e5d023194681 update the README and add a new section "Url Parameters"
rougeronj
parents: 493
diff changeset
   376
* viewIndex=index: init the renkan with the indexed view. Negative index starts from the end of the list of views (viewIndex=-1 will load the last view). In case the view doesn't exist, the initial view (viewIndex=0) will be loaded.
e5d023194681 update the README and add a new section "Url Parameters"
rougeronj
parents: 493
diff changeset
   377
* view=offset-x,offset-y,zoom-level: Load a view with the given zoom and offset parameters
560
05a4380227f3 - Renames and changes default options
rougeronj
parents: 527
diff changeset
   378
* view=autoscale: force the view to be autoscaled when the renkan loads
597
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   379
* idNode=id: highlight a node according to the given node id.
527
e5d023194681 update the README and add a new section "Url Parameters"
rougeronj
parents: 493
diff changeset
   380
264
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   381
## Drop management
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   382
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   383
You can override, partially or totally, the function that handle the drop event from an other web page.
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   384
The current function catches drops from google results page, tweets, links, images and other things like svg paths.
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   385
If you want to override totally the handler function, you can define a **drop\_handler** function that receives a \_data object
398
57f8d344fde9 Correct button shift on hover that appeared after paperjs v 0.9.15
ymh <ymh.work@gmail.com>
parents: 265
diff changeset
   386
and returns a node object. A node object has title, description, image and uri properties. The \_data object is received from the
264
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   387
browser's drop event. Here is an example of drop\_handler function :
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   388
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   389
```js
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   390
_renkan = new Rkns.Renkan({
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   391
    ...
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   392
    drop_handler: function(_data){
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   393
        var newNode = {};
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   394
        newNode.title = "Overridden title";
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   395
        newNode.description = "Overridden description " + _data["text/plain"];
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   396
        return newNode;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   397
    }
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   398
});
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   399
```
264
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   400
398
57f8d344fde9 Correct button shift on hover that appeared after paperjs v 0.9.15
ymh <ymh.work@gmail.com>
parents: 265
diff changeset
   401
You can also define a **drop\_enhancer** function that receives the already formed node object and \_data object. This function has to
264
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   402
return the overriden node object. Here is an example of drop\_enhancer function :
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   403
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   404
```js
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   405
_renkan = new Rkns.Renkan({
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   406
    ...
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   407
    drop_enhancer: function(newNode, _data){
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   408
        newNode.title = "Prefixed title : " + newNode.title;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   409
        return newNode;
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   410
    }
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   411
});
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   412
```
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   413
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   414
## Data and api
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   415
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   416
### Data
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   417
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   418
The data exchanged by Renkan is a json object ths following structure:
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   419
(Warning: some fields are optionals, and )
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   420
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   421
```json
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   422
{
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   423
    "id": "f4d002b7-d4fd-486c-8898-6c6ceebc3354",
597
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   424
    "schema_version": 2, #version of schema, latest is 2.
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   425
    "title": "Example of Renkan with movies",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   426
    "description": "A long description",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   427
    "created": "2013-03-18T11:32:40.253+01:00",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   428
    "updated": "2014-02-04T15:12:56.619+01:00",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   429
    "nodes": [
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   430
        {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   431
            "id": "node-2013-05-08-72c911bafdf9932c-0001",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   432
            "title": "Une femme mène l'enquête",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   433
            "description": "La caméra suit la femme qui marche\nJeu avec la caméra qui se substitue au spectateur",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   434
            "uri": "http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/lyceehulst_3extraits/c8a61ee4-b33c-11e2-802c-00145ea4a2be#id=s_DCA8D184-EFC2-314B-0F6B-84043E8F9984",
597
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   435
            "style": { #optional
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   436
                "color": "#ff7f00", #line color, optional (null)
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   437
                "thickness": 1, #thickness of the line, optional (1)
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   438
                "dash": false, #dashed line, optional (false)
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   439
            },
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   440
            "position": {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   441
                "x": -547.0499881440252,
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   442
                "y": -221.5401229374163
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   443
            },
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   444
            "image": "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   445
            "size": 0,
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   446
            "project_id": "f4d002b7-d4fd-486c-8898-6c6ceebc3354",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   447
            "created_by": "de68xf75y6hs5rgjhgghxbm217xk",
597
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   448
            "type": "...",
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   449
            "hidden": false,
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   450
            "shape": "circle",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   451
        },
264
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   452
        ...
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   453
    ],
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   454
    "edges": [
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   455
        {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   456
            "id": "edge-2013-05-08-72c911bafdf9932c-0002",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   457
            "title": "",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   458
            "description": "",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   459
            "uri": "",
597
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   460
            "style": { #optional
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   461
                "color": "#ff7f00", #line color, optional (null)
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   462
                "thickness": 1, #thickness of the line, optional (1)
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   463
                "dash": false, #dashed line, optional (false)
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   464
                "arrow": true,  #draw the arrow, optional (true)  
ebdd1d769158 small documentation improvements
ymh <ymh.work@gmail.com>
parents: 560
diff changeset
   465
            },
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   466
            "from": "node-2013-04-30-a81adec6694db5f4-0032",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   467
            "to": "node-2013-05-08-72c911bafdf9932c-0001",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   468
            "project_id": "f4d002b7-d4fd-486c-8898-6c6ceebc3354",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   469
            "created_by": "de68xf75y6hs5rgjhgghxbm217xk"
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   470
        },
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   471
        ...
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   472
    ],
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   473
    "users": [ #optional
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   474
        {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   475
            "userId": "user-2015-05-05-72c911bafdf9932c-0001",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   476
            "color": "#cc9866",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   477
            "username": "user1",
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   478
            "anonymous": true
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   479
        },
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   480
    ...
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   481
    ],
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   482
    "space_id": "17f968e4-2640-4319-aa61-b5b8b527ebb4", #Optional
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   483
    "views": [ #Optional
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   484
        {
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   485
            "zoom_level": 0.8275032552816195,
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   486
            "offset_x": 832.0104075533723,
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   487
            "offset_y": 402.8917139487223
264
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   488
        }
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   489
    ]
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   490
}
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   491
```
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   492
440
2311be523b92 typos corrections
ymh <ymh.work@gmail.com>
parents: 439
diff changeset
   493
This data is a direct json serialisation of the data model (cf `client/js/`).
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   494
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   495
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   496
### IO module and server communications
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   497
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   498
Currently 2 modules are defined to load and save data:
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   499
  - save-once: data is loaded by ajax at the page initialization and saved each time the save button is clicked (floppy disc icon)
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   500
  - full-json: data is loaded by ajax at the page initialization and saved each time the data is modified.
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   501
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   502
The code of these 2 modules is rather simple and easy to adapt. the various examples in the `test` folder show how to configure them.
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   503
Both these 2 modules communicate with the server with a single endpoint. The communication is made with JSON documents and is bidirectional: 'GET' to load the project, 'POST' to send back the modified project.
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   504
the dev environement (see [dev](#dev)) offer a simple implementation of such an endpoint for testing support. The code of this endpoint is in the file `client/data/simple-persist.js`.
264
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   505
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   506
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   507
## <a name="dev"></a>Dev
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   508
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   509
Renkan offers a dev environment that uses [Grunt](http://gruntjs.com/) for running tasks and [Bower](http://bower.io/) for managing dependencies.
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   510
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   511
### Setup
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   512
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   513
The only prerequisite is to install [nodejs](https://nodejs.org/) or [iojs](https://iojs.org/en/index.html). Once installed, the complete dev environment can be obtained with the following commands:
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   514
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   515
```sh
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   516
$ npm i
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   517
$ ./node_modules/.bin/bower install
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   518
```
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   519
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   520
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   521
### Grunt tasks
264
cc1b3aa8cada drop handler and enhancer functions, and read me explains this.
cavaliet
parents: 253
diff changeset
   522
431
1387779706e5 update README file to reference the task available in grunt
rougeronj
parents: 403
diff changeset
   523
We offer a environment to develop without having to build all the project manually after each change. We define few grunt task to help us
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   524
making it easier. You can launch them by running `./node_modules/.bin/grunt <task>`.
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   525
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   526
* `dev`: will build the project but keep the temporary file like templates.js to let us test the application through the test files (see ['Tests'](#tests) part below). Then it will launch a small web server for testing and watch the modifications of the js/css/html to build the project again in case of any change. The test server runs on port 9001 on your local machine i.e. http://localhost:9001 . The folder served is the `client/` folder.
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   527
431
1387779706e5 update README file to reference the task available in grunt
rougeronj
parents: 403
diff changeset
   528
Tasks for production :
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   529
* `default`: will build the project and clean the temporary files (like templates.js) used during development and building.
493
6f2ab1a72f4a add search to space screen + new version
ymh <ymh.work@gmail.com>
parents: 440
diff changeset
   530
* `copy-server`: will copy the built project to the server part of this project.
647
eaaa1efce396 add examples for youtube node types, add a way to open node urls with a single click
ymh <ymh.work@gmail.com>
parents: 597
diff changeset
   531
* `jst` with `jst:compile` and `jst:compile-test`: are compiling the templates in `templates/` and `test/templates` respectively.
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   532
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   533
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   534
## <a name="tests"></a>Tests
253
9851e84a0b37 update readme
cavaliet
parents: 252
diff changeset
   535
9851e84a0b37 update readme
cavaliet
parents: 252
diff changeset
   536
Because of a simple php file enabling persistent connection, you can not test the writables examples by only opening them in your browser.
9851e84a0b37 update readme
cavaliet
parents: 252
diff changeset
   537
A url like file:///path/to/folder/test-writable-\*.html will not work.
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   538
You need to run a localhost server that executes php and go to a url like http://localhost:9001/test/test-writable-\*.html. (cf. [Dev](#dev) above)
253
9851e84a0b37 update readme
cavaliet
parents: 252
diff changeset
   539
9851e84a0b37 update readme
cavaliet
parents: 252
diff changeset
   540
For read only examples, it appears that for security reasons urls like file:///path/to/folder/test-readonly-\*.html only work on Firefox.
439
741fd2028c99 slightly improve documentation
ymh <ymh.work@gmail.com>
parents: 431
diff changeset
   541
To see those examples with other browsers, you also need to run a localhost server and go to a url like http://localhost:9001/test/test-readonly-\*.html. (cf. [Dev](#dev) above)