diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-01-02 17:01:27 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-01-02 17:01:27 -0500 |
commit | 3833c12ccce59bcc49c4cfa892401973558f604d (patch) | |
tree | b67b0e10cdc3d42e5626f728206138a444a40ed0 /app/Template/project_file | |
parent | d49ce63e51f596ad3bf0d02b689aea673cf544f8 (diff) |
Refactoring/rewrite of modal boxes handling
Diffstat (limited to 'app/Template/project_file')
-rw-r--r-- | app/Template/project_file/create.php | 43 | ||||
-rw-r--r-- | app/Template/project_file/remove.php | 10 |
2 files changed, 20 insertions, 33 deletions
diff --git a/app/Template/project_file/create.php b/app/Template/project_file/create.php index e262799b..de35f87c 100644 --- a/app/Template/project_file/create.php +++ b/app/Template/project_file/create.php @@ -1,33 +1,20 @@ <div class="page-header"> <h2><?= t('Attach a document') ?></h2> </div> -<div id="file-done" style="display:none"> - <p class="alert alert-success"> - <?= t('All files have been uploaded successfully.') ?> - <?= $this->url->link(t('View uploaded files'), 'ProjectOverviewController', 'show', array('project_id' => $project['id'])) ?> - </p> -</div> - -<div id="file-error-max-size" style="display:none"> - <p class="alert alert-error"> - <?= t('The maximum allowed file size is %sB.', $this->text->bytes($max_size)) ?> - <a href="#" id="file-browser"><?= t('Choose files again') ?></a> - </p> -</div> -<div - id="file-dropzone" - data-max-size="<?= $max_size ?>" - data-url="<?= $this->url->href('ProjectFileController', 'save', array('project_id' => $project['id'])) ?>"> - <div id="file-dropzone-inner"> - <?= t('Drag and drop your files here') ?> <?= t('or') ?> <a href="#" id="file-browser"><?= t('choose files') ?></a> - </div> -</div> - -<input type="file" name="files[]" multiple style="display:none" id="file-form-element"> +<?= $this->app->component('file-upload', array( + 'maxSize' => $max_size, + 'url' => $this->url->to('ProjectFileController', 'save', array('project_id' => $project['id'])), + 'labelDropzone' => t('Drag and drop your files here'), + 'labelOr' => t('or'), + 'labelChooseFiles' => t('choose files'), + 'labelOversize' => t('The maximum allowed file size is %sB.', $this->text->bytes($max_size)), + 'labelSuccess' => t('All files have been uploaded successfully.'), + 'labelCloseSuccess' => t('Close this window'), + 'labelUploadError' => t('Unable to upload this file.'), +)) ?> -<div class="form-actions"> - <input type="submit" value="<?= t('Upload files') ?>" class="btn btn-blue" id="file-upload-button" disabled> - <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'ProjectOverviewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> -</div> +<?= $this->modal->submitButtons(array( + 'submitLabel' => t('Upload files'), + 'disabled' => true, +)) ?> diff --git a/app/Template/project_file/remove.php b/app/Template/project_file/remove.php index 0517a9e7..043b8fc8 100644 --- a/app/Template/project_file/remove.php +++ b/app/Template/project_file/remove.php @@ -7,9 +7,9 @@ <?= t('Do you really want to remove this file: "%s"?', $this->text->e($file['name'])) ?> </p> - <div class="form-actions"> - <?= $this->url->link(t('Yes'), 'ProjectFileController', 'remove', array('project_id' => $project['id'], 'file_id' => $file['id']), true, 'btn btn-red') ?> - <?= t('or') ?> - <?= $this->url->link(t('cancel'), 'ProjectOverviewController', 'show', array('project_id' => $project['id']), false, 'close-popover') ?> - </div> + <?= $this->modal->confirmButtons( + 'ProjectFileController', + 'remove', + array('project_id' => $project['id'], 'file_id' => $file['id']) + ) ?> </div> |