Changeset 129


Ignore:
Timestamp:
Sep 20, 2011, 3:49:19 PM (5 years ago)
Author:
work@…
Message:
  • add 'delete all files' button in development
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/home/index.gsp

    r127 r129  
    11<html>
    2  <head>
    3   <meta name="layout" content="main" />
    4  </head>
    5  <body>
    6   <div id="uploadedFiles">
    7    <mm:uploadedFileList files="${files}"/>
    8   </div>
    9   <div id="studyOverview">
    10    <g:render template="studyList"/>
    11   </div>
    12  </body>
     2<head>
     3        <meta name="layout" content="main"/>
     4</head>
     5<body>
     6<div id="uploadedFiles">
     7        <mm:uploadedFileList files="${files}"/>
     8</div>
     9
     10<div id="studyOverview">
     11        <g:render template="studyList"/>
     12</div>
     13<g:if env="development">
     14<input type="button" value="delete all files" onclick="if (confirm('are you really super massive sure?')) { deleteAll(); } else { return false; }"/>
     15<r:script>
     16function deleteAll() {
     17        <g:each var="file" in="${files}" status="s">
     18        deleteFile({fileName: '${file.name}', fileId: ${file.id}});</g:each>
     19        document.location = document.location;
     20}
     21function deleteFile(file) {
     22        var a = $.ajax(
     23                '<g:createLink plugin="dbxpModuleStorage" controller="uploadedFile" action="deleteUploadedFile"/>',
     24                {
     25                        async: false,
     26                        headers: {
     27                                'X-File-Name': file.fileName,
     28                                'X-File-Id': file.fileId
     29                        },
     30                        success: function(data) { result = data; }
     31                }
     32        );
     33}
     34</r:script>
     35</g:if>
     36</body>
    1337</html>
Note: See TracChangeset for help on using the changeset viewer.