server/java/renkan-web/src/main/webapp/WEB-INF/templates/projectIndex.html
author rougeronj
Mon, 22 Dec 2014 12:38:16 +0100
changeset 350 0b6f2883a67b
parent 316 242510015401
child 435 e529b633c339
permissions -rw-r--r--
update path to the new lib folders
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
150
5b62100b8562 - replace simple http authentication by form auth
ymh <ymh.work@gmail.com>
parents: 137
diff changeset
     1
<!DOCTYPE html>
224
0167b777ad15 remove deprecated warnings + fix date picker default langauge
ymh <ymh.work@gmail.com>
parents: 150
diff changeset
     2
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" th:lang="${#ctx.getLocale().toLanguageTag()}" >
76
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
     3
    <head>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
        <title>Renkan</title>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
        <meta charset="utf-8"/>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
127
906fed13c1e1 space admin edit.
ymh <ymh.work@gmail.com>
parents: 123
diff changeset
    10
        <link rel="shortcut icon" href="../../static/img/favicon.ico" th:href="@{/static/img/favicon.ico}"/>
123
daa99448319d first step for site administration
ymh <ymh.work@gmail.com>
parents: 99
diff changeset
    11
        
350
0b6f2883a67b update path to the new lib folders
rougeronj
parents: 316
diff changeset
    12
        <script th:remove="all" type="text/javascript" src="../../static/lib/jquery/jquery.js"></script>
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    13
        <script th:remove="all" type="text/javascript" src="../../static/js/thymol.js"></script>
123
daa99448319d first step for site administration
ymh <ymh.work@gmail.com>
parents: 99
diff changeset
    14
        
350
0b6f2883a67b update path to the new lib folders
rougeronj
parents: 316
diff changeset
    15
        <script src="../../static/lib/jquery/jquery.js" th:src="@{/static/lib/jquery/jquery.js}" ></script>
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    16
        <script src="../../static/lib/jquery-ui/jquery-ui.min.js" th:src="@{/static/lib/jquery-ui/jquery-ui.min.js}" ></script>
350
0b6f2883a67b update path to the new lib folders
rougeronj
parents: 316
diff changeset
    17
        <script src="../../static/lib/underscore/underscore.js" th:src="@{/static/lib/underscore/underscore.js}" ></script>
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    18
        <script src="../../static/lib/URI.js" th:src="@{/static/lib/URI.js}" ></script>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    20
        <link href="../../static/lib/jquery-ui/css/ui-lightness/jquery-ui.min.css" rel="stylesheet" th:href="@{/static/lib/jquery-ui/css/ui-lightness/jquery-ui.min.css}"/>
97
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
    21
        <link href="../../static/css/style.css" rel="stylesheet" th:href="@{/static/css/style.css}"/>
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    22
        <link href="../../static/css/index.css" rel="stylesheet" th:href="@{/static/css/index.css}"/>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    23
76
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
    24
    </head>
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
    25
    <body>
97
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
    26
      <div id="container">
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
        <div id="wrapper">
150
5b62100b8562 - replace simple http authentication by form auth
ymh <ymh.work@gmail.com>
parents: 137
diff changeset
    28
            <header id="header">
5b62100b8562 - replace simple http authentication by form auth
ymh <ymh.work@gmail.com>
parents: 137
diff changeset
    29
                <h1><a href="renkanIndex.html" th:href="@{'/'}" id="home-link" th:text="#{renkanIndex.renkan_space}">Renkan Space</a>: <span th:text="${space.title}">Titre</span></h1>
5b62100b8562 - replace simple http authentication by form auth
ymh <ymh.work@gmail.com>
parents: 137
diff changeset
    30
                <div id="headerNav" th:include="fragment/pageFragment :: headerNavFragment"></div>
5b62100b8562 - replace simple http authentication by form auth
ymh <ymh.work@gmail.com>
parents: 137
diff changeset
    31
            </header>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
            <div id="inner">
87
6c810f746837 Externalize properties
ymh <ymh.work@gmail.com>
parents: 86
diff changeset
    33
                <div id="label" class="translate" th:text="#{renkanIndex.renkan_exp}">Create a Renkan</div> 
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
    34
                <form action="#" id="new-renkan-form">
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
    35
                    <fieldset id="form-fields">
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
    36
                        <div id="title-field"><label th:text="#{renkanIndex.renkan_title}" for="renkantitle">title</label><input type="text" id="renkantitle" autofocus="autofocus" x-webkit-speech="x-webkit-speech"/></div>
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
    37
                        <div id="file-field"><label th:text="#{renkanIndex.renkan_file}" for="renkanfile">file</label><input type="file" id="renkanfile"/></div> 
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
    38
                    </fieldset>
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
    39
                    <div id="form-submit"><button type="submit">OK</button></div>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
                </form>
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
            </div>
137
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    42
            <div id="project-list-container">
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    43
              <h2 th:text="#{renkanIndex.project_list}">Project list</h2>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    44
              <div id="project-filter-container">
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    45
                  <form method="get"> 
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    46
                      <input type="text" id="project-filter" name="filter" placeholder="filter title" th:placeholder="#{renkanIndex.project_filter}" th:value="${param['filter']}?${param['filter'][0]}:''" /> 
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    47
                      <button type="submit">OK</button>
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
    48
                  </form>
137
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    49
              </div>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    50
              <div th:include="fragment/paginationFragment :: paginationFragment" class="pagination-container">
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
    51
                  <div>
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
    52
                      <a href="#?p.page=1">&lt;&lt;</a>
137
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    53
                      <a href="#?p.page=3">&lt;</a>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    54
                      <span>...</span>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    55
                      <a href="#?p.page=2">2</a>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    56
                      <a href="#?p.page=3">3</a>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    57
                      <span>4</span>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    58
                      <a href="#?p.page=5">5</a>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    59
                      <a href="#?p.page=6">6</a>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    60
                      <span>...</span>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    61
                      <a href="#?p.page=5">&gt;</a>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    62
                      <a href="#?p.page=7">&gt;&gt;</a> 
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    63
                  </div>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    64
              </div>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    65
              <table th:with="columnSort=${param['p.sort']}?${param['p.sort'][0]}:'updated',sortDir=${param['p.sort.dir']}?${param['p.sort.dir'][0]}:'desc'">
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    66
                <thead th:with="sortDirInv=${sortDir}=='desc'?'asc':'desc'">
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    67
                  <tr>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    68
                      <th th:with="sorted=(${columnSort}=='title')"><span th:text="#{renkanIndex.project_name}">Name</span><form method="get" class="proj-sort-form"><input type="hidden" name="p.sort" value="title"/><input type="hidden" name="p.sort.dir" th:value="${sorted}?${sortDirInv}:'desc'"/><input th:if="${param['filter']}" name="filter" type="hidden" th:value="${param['filter'][0]}"/><input type="submit" class="proj-sortable-col" th:class="${sorted}?'proj-sort-'+${sortDir}+'-col':'proj-sortable-col'" value=""/></form></th>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    69
                      <th th:with="sorted=(${columnSort}=='updated')"><span th:text="#{renkanIndex.project_updated}">Updated</span><form method="get" class="proj-sort-form"><input type="hidden" name="p.sort" value="updated"/><input type="hidden" name="p.sort.dir" th:value="(${sorted})?${sortDirInv}:'desc'"/><input th:if="${param['filter']}" name="filter" type="hidden" th:value="${param['filter'][0]}"/><input type="submit" class="proj-sort-desc-col" th:class="${sorted}?'proj-sort-'+${sortDir}+'-col':'proj-sortable-col'" value=""/></form></th>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    70
                      <th th:with="sorted=(${columnSort}=='created')"><span th:text="#{renkanIndex.project_creation}" >Creation</span><form method="get" class="proj-sort-form"><input type="hidden" name="p.sort" value="created"/><input type="hidden" name="p.sort.dir" th:value="${sorted}?${sortDirInv}:'desc'"/><input th:if="${param['filter']}" name="filter" type="hidden" th:value="${param['filter'][0]}"/><input type="submit" class="proj-sort-asc-col" th:class="${sorted}?'proj-sort-'+${sortDir}+'-col':'proj-sortable-col'" value=""/></form></th>
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    71
                      <th th:text="#{renkanIndex.project_commands}">Comm.</th>
137
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    72
                  </tr>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    73
                </thead>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    74
                <tbody>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    75
                  <tr th:each="project: ${page}">
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    76
                    <th th:text="${project.title}">title</th>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    77
                    <td th:text="${project.updated}?${#dates.format(project.updated, #messages.msg('date.format'))}:''">update</td>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    78
                    <td th:text="${#dates.format(project.created, #messages.msg('date.format'))}">date</td>
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    79
                    <td>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    80
                        <a href="#" th:href="@{'/p/'+${project.id}(cowebkey=${project.getKey(2)})}" th:title="#{renkanIndex.project_edit_link}"><span class="ui-icon ui-icon-pencil renkan-basic-action"></span></a>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    81
                        <a href="#" th:href="@{'/p/pub/'+${project.id}(cowebkey=${project.getKey(1)})}" th:title="#{renkanIndex.project_render_link}"><span class="ui-icon renkan-icon-eye renkan-basic-action"></span></a>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    82
                        <span class="ui-icon ui-icon-triangle-1-e renkan-basic-action renkan-action-button" th:id="'renkan-action-button-'+${project.id}" th:attr="data-project_id=${project.id}"></span>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    83
                    </td>
137
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    84
                  </tr>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    85
                </tbody>
efc0fce30814 Add filter on projects
ymh <ymh.work@gmail.com>
parents: 136
diff changeset
    86
              </table>
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    87
              <ul th:each="project: ${page}" class="action-menu" id="action-menu-" th:id="'action-menu-'+${project.id}">
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    88
                 <li><a href="#" th:href="@{'/p/'+${project.id}(cowebkey=${project.getKey(2)})}"><span class="ui-icon ui-icon-pencil"></span><span th:text="#{renkanIndex.project_edit_link}">Edit project</span></a></li>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    89
                 <li><a href="#" th:attr="data-project_id=${project.id}" class="copy-project"><span class="ui-icon ui-icon-copy"></span><span th:text="#{renkanIndex.project_copy_link}">Copy project</span></a></li>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    90
                 <li><a href="#" th:attr="data-project_id=${project.id},data-project_title=${project.title}" class="delete-project"><span class="ui-icon ui-icon-trash"></span><span th:text="#{renkanIndex.project_delete_link}">Delete project</span></a></li>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    91
                 <li><a href="#" th:href="@{'/p/pub/'+${project.id}(cowebkey=${project.getKey(1)})}"><span class=" ui-icon renkan-icon-eye"></span><span th:text="#{renkanIndex.project_render_link}">View project</span></a></li>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    92
                 <li><a href="#" th:href="@{'/p/exp/'+${project.id}}"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span><span th:text="#{renkanIndex.project_export_link}">Export project</span></a></li>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    93
             </ul>
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
    94
              
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
    95
            </div>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
        </div>
127
906fed13c1e1 space admin edit.
ymh <ymh.work@gmail.com>
parents: 123
diff changeset
    97
        <footer id="footer" th:include="fragment/pageFragment :: footerFragment">
257
6bf1126c5add add header to go back to space
ymh <ymh.work@gmail.com>
parents: 224
diff changeset
    98
            <div id="version">© <span class="version-date">2014</span> <a href="http://www.iri.centrepompidou.fr" target="_blanck">IRI</a> - Version <span class="version-version">0.0</span></div>
127
906fed13c1e1 space admin edit.
ymh <ymh.work@gmail.com>
parents: 123
diff changeset
    99
        </footer>        
97
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   100
      </div>
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   101
      <script th:inline="javascript" >
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   102
      /*<![CDATA[*/
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   103
          'use strict';
97
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   104
          function go2Title()
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   105
          {
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   106
              var renkantitle = $("#renkantitle").val(),
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   107
                  renkanfiles = $("#renkanfile").prop("files");
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   108
              
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   109
              if(renkantitle.length === 0 && renkanfiles.length === 0) {
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   110
              	var alert_message = /*[[#{renkanIndex.js.empty_form_error}]]*/"Please enter a title or a file"; 
97
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   111
              	alert(alert_message);
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   112
              	return false;
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   113
              }
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   114
              var post_url = /*[[@{/rest/projects/}]]*/"/rest/projects/",
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   115
                  deferred = $.Deferred();
97
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   116
              
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   117
              deferred.done(function(new_renkan) {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   118
                  new_renkan.space_id = /*[[${space.id}]]*/"_";
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   119
                  $.ajax(post_url, {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   120
                      data:JSON.stringify(new_renkan),
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   121
                      type: "POST",
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   122
                      dataType: "json",
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   123
                      contentType: "application/json; charset=UTF-8"
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   124
                  }).done(function(project){
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   125
                      var uri = new URI(window.location);
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   126
                      window.location = uri.setSearch("p.sort","created").setSearch("p.sort.dir", "desc").href();
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   127
                  });
97
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   128
              });
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   129
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   130
              if(renkanfiles.length === 0) {
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   131
                  deferred.resolve({
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   132
                      title: renkantitle,
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   133
                      description: "",
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   134
                      uri: null,
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   135
                  });
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   136
              }
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   137
              else {
308
7fcb9d12e181 Correct problem with project id and exported/imported project
ymh <ymh.work@gmail.com>
parents: 305
diff changeset
   138
                  var fr = new FileReader();
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   139
                  fr.onload = function() {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   140
                      var new_renkan = JSON.parse(fr.result);
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   141
                      if(renkantitle.length > 0) {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   142
                          new_renkan.title = renkantitle;
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   143
                      }
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   144
                      if(typeof new_renkan.created !== "undefined") {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   145
                          delete new_renkan.created;
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   146
                      }
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   147
                      if(typeof new_renkan.updated !== "undefined") {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   148
                          delete new_renkan.updated;
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   149
                      }
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   150
                      deferred.resolve(new_renkan);
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   151
                  };
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   152
                  fr.readAsText(renkanfiles[0]);
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   153
              }
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   154
          }
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   155
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   156
          function copyProject(project_id)
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   157
          {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   158
          	var post_url = /*[[@{/p/copy}]]*/"#";
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   159
              $.post(post_url, {"project_id": project_id})
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   160
                  .done(function(p){
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   161
                      window.location.reload();
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   162
              });
97
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   163
          }
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
      
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   165
          function deleteProject(project_id, project_title)
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   166
          {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   167
          	var message = /*[[#{renkanIndex.project_delete_confirm}]]*/"Delete project \"<%= title %>\"";
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   168
          	if(confirm(_.template(message, {title: project_title}))) {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   169
                  var delete_url = /*[[@{/rest/projects}]]*/"#";
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   170
                  $.ajax(delete_url+"/"+project_id, {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   171
                      type: "DELETE"	
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   172
                  }).done(function(){
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   173
                  	window.location.reload();
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   174
                  });
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   175
          	}
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   176
          }
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   177
          
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   178
          function createMenuHandler(menu, timeoutCallback) {
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   179
              return function(e) {
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   180
                  menu.toggle();
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   181
                  $(e.target).toggleClass("ui-icon-triangle-1-e").toggleClass("ui-icon-triangle-1-se");
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   182
                  $('.renkan-action-button').each(function() {
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   183
                      if($(this).prop('id') !== $(e.target).prop('id')) {
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   184
                          $(this).removeClass("ui-icon-triangle-1-se").addClass("ui-icon-triangle-1-e");
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   185
                          $("#action-menu-"+$(this).data('project_id')).hide();
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   186
                          var timeout = $("#action-menu-"+$(this).data('project_id')).data('blurtimeout');
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   187
                          if(typeof timeout !== 'undefined') {
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   188
                              clearTimeout(menu.data('blurtimeout'));
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   189
                              menu.removeData('blurtimeout');
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   190
                          }
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   191
                      }
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   192
                  });
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   193
                  if(menu.is(":visible")) {
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   194
                      menu.data('blurtimeout', setTimeout( timeoutCallback,5000));
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   195
                  } 
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   196
              }
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   197
          }
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   198
          
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   199
          $(function(){
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   200
             
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   201
              $(".copy-project").click(function(event) {
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   202
                  var project_id = $(event.currentTarget).data("project_id");
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   203
                  copyProject(project_id);
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   204
              });
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   205
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   206
              $(".delete-project").click(function(event) {
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   207
                  deleteProject($(event.currentTarget).data("project_id"), $(event.currentTarget).data("project_title"));
298
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   208
              });
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   209
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   210
              
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   211
              $("#new-renkan-form").submit(function(e) {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   212
                  e.preventDefault();
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   213
                  go2Title();
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   214
                  return false;
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   215
              });
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   216
              
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   217
              $("#import-renkan-form").submit(function(e) {
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   218
                  e.preventDefault();
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   219
                  console.log("import form event :", e);
2f35c2ae7de8 export + import renkans
ymh <ymh.work@gmail.com>
parents: 257
diff changeset
   220
              });
305
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   221
              
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   222
              $('.renkan-action-button').each(function() {
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   223
                  var projectId = $(this).data('project_id');
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   224
                  var menu = $('#action-menu-'+projectId).menu().position({ my: "left top", at: "right top", of: this }).hide();
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   225
                  var that = this;
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   226
                  
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   227
                  var timeoutCallback = function() {
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   228
                      menu.hide();
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   229
                      $(that).removeClass("ui-icon-triangle-1-se").addClass("ui-icon-triangle-1-e");
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   230
                      menu.removeData('blurtimeout');
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   231
                  };
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   232
                  
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   233
                  menu.on('menufocus', function() {
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   234
                      clearTimeout(menu.data('blurtimeout'));
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   235
                      menu.removeData('blurtimeout');
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   236
                  });
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   237
                  menu.on('menublur',function(e) {
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   238
                      menu.data('blurtimeout', setTimeout( timeoutCallback,200));
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   239
                  });
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   240
                  
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   241
                  $(this).click(createMenuHandler(menu, timeoutCallback));
4dc484119b4c Streamline commands. Add popup menus. new version
ymh <ymh.work@gmail.com>
parents: 304
diff changeset
   242
              });
97
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   243
          });
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   244
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   245
      /*]]>*/
f7d611f50e58 add version str + improver css + new version
ymh <ymh.work@gmail.com>
parents: 90
diff changeset
   246
      </script>
76
523f0647513e add the count of project by spaces, add pagination, update libraries and add some more unit tests.
ymh <ymh.work@gmail.com>
parents: 71
diff changeset
   247
    </body>
71
9af0874ce43f First version of space level.
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
</html>