From 3833c12ccce59bcc49c4cfa892401973558f604d Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 2 Jan 2017 17:01:27 -0500 Subject: Refactoring/rewrite of modal boxes handling --- app/Template/task_file/create.php | 43 ++++++++++++----------------------- app/Template/task_file/files.php | 6 ++--- app/Template/task_file/images.php | 3 +-- app/Template/task_file/remove.php | 10 ++++---- app/Template/task_file/screenshot.php | 10 +++----- 5 files changed, 26 insertions(+), 46 deletions(-) (limited to 'app/Template/task_file') diff --git a/app/Template/task_file/create.php b/app/Template/task_file/create.php index e05cf829..eebb08eb 100644 --- a/app/Template/task_file/create.php +++ b/app/Template/task_file/create.php @@ -1,33 +1,20 @@ - - - -
-
- -
-
- - +app->component('file-upload', array( + 'maxSize' => $max_size, + 'url' => $this->url->to('TaskFileController', 'save', array('task_id' => $task['id'], 'project_id' => $task['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.'), +)) ?> -
- - - url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> -
+modal->submitButtons(array( + 'submitLabel' => t('Upload files'), + 'disabled' => true, +)) ?> diff --git a/app/Template/task_file/files.php b/app/Template/task_file/files.php index 32bebdcb..ffebdb84 100644 --- a/app/Template/task_file/files.php +++ b/app/Template/task_file/files.php @@ -15,8 +15,7 @@ diff --git a/app/Template/task_file/images.php b/app/Template/task_file/images.php index 8be89274..e3599441 100644 --- a/app/Template/task_file/images.php +++ b/app/Template/task_file/images.php @@ -24,8 +24,7 @@ user->hasProjectAccess('TaskFileController', 'remove', $task['project_id'])): ?>
  • - - url->link(t('Remove'), 'TaskFileController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), false, 'popover') ?> + modal->confirm('trash-o', t('Remove'), 'TaskFileController', 'confirm', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id'])) ?>
  • diff --git a/app/Template/task_file/remove.php b/app/Template/task_file/remove.php index 42894f05..e7ffe560 100644 --- a/app/Template/task_file/remove.php +++ b/app/Template/task_file/remove.php @@ -7,9 +7,9 @@ text->e($file['name'])) ?>

    -
    - url->link(t('Yes'), 'TaskFileController', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']), true, 'btn btn-red') ?> - - url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> -
    + modal->confirmButtons( + 'TaskFileController', + 'remove', + array('task_id' => $task['id'], 'project_id' => $task['project_id'], 'file_id' => $file['id']) + ) ?> diff --git a/app/Template/task_file/screenshot.php b/app/Template/task_file/screenshot.php index 6300159f..dad8c233 100644 --- a/app/Template/task_file/screenshot.php +++ b/app/Template/task_file/screenshot.php @@ -6,14 +6,10 @@

    -
    - + form->csrf() ?> -
    - - - url->link(t('cancel'), 'TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id']), false, 'close-popover') ?> -
    + app->component('screenshot') ?> + modal->submitButtons() ?>

    -- cgit v1.2.3