summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-09-06 14:40:31 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-11-01 17:26:31 +0100
commitb78773f3fb954654515d551bef9cb8e68cd4b05a (patch)
tree7247bfa4c2bc11a9050a7b249404caded450e36b
parentc9fa3ed37fd1371ef24f6c3330995025295d7baf (diff)
Support creation of multipaste from upload thumbnail history
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--application/views/file/upload_history_thumbnails.php7
-rw-r--r--public_html/data/js/thumbnail-view.js42
2 files changed, 25 insertions, 24 deletions
diff --git a/application/views/file/upload_history_thumbnails.php b/application/views/file/upload_history_thumbnails.php
index 9fb9c5450..7d4fc6298 100644
--- a/application/views/file/upload_history_thumbnails.php
+++ b/application/views/file/upload_history_thumbnails.php
@@ -1,10 +1,11 @@
<div class="nav-history">
<div class="container">
<div class="pull-right">
- <?php echo form_open("file/do_delete/", array("id" => "delete_form", "style" => "display: inline")); ?>
- <button type="submit" class="btn btn-danger" id="delete_button" style="display: none">Delete selected</button>
+ <?php echo form_open("file/handle_history_submit/", array("id" => "submit_form", "style" => "display: inline")); ?>
+ <button type="submit" class="btn btn-danger" style="display: none" name='process' value='delete'>Delete selected</button>
+ <button type="submit" class="btn btn-primary" style="display: none" name='process' value='multipaste'>Add selected to multipaste queue</button>
</form>
- <button class="btn btn-default" id="toggle_delete_mode" style="display: inline">Delete mode</button>
+ <button class="btn btn-default" id="toggle_select_mode" style="display: inline">Select mode</button>
</div>
<?php include 'nav_history.php'; ?>
diff --git a/public_html/data/js/thumbnail-view.js b/public_html/data/js/thumbnail-view.js
index a2820069a..dc2f547ab 100644
--- a/public_html/data/js/thumbnail-view.js
+++ b/public_html/data/js/thumbnail-view.js
@@ -1,22 +1,22 @@
(function () {
'use strict';
-define(['jquery', 'underscore', 'jquery.colorbox'], function ($, _) {
+define(['jquery', 'underscore', 'multipaste', 'jquery.colorbox'], function ($, _, Multipaste) {
var ui = {
thumbnailLinks: '.upload_thumbnails a',
- deleteButton: '#delete_button',
- deleteForm: '#delete_form',
+ formButtons: '#submit_form button[type=submit]',
+ submitForm: '#submit_form',
markedThumbnails: '.upload_thumbnails .marked',
colorbox: '.colorbox',
thumbnails: '.upload_thumbnails',
- toggleDeleteModeButton: '#toggle_delete_mode'
+ toggleSelectModeButton: '#toggle_select_mode',
};
var PrivateFunctions = {
- inDeleteMode: false,
+ inSelectMode: false,
setupEvents: function () {
- $(ui.toggleDeleteModeButton).on('click', _.bind(this.toggleDeleteMode, this));
- $(ui.thumbnailLinks).on('click', _.bind(this.toggleMarkForDeletion, this));
+ $(ui.toggleSelectModeButton).on('click', _.bind(this.toggleSelectMode, this));
+ $(ui.thumbnailLinks).on('click', _.bind(this.thumbnailClick, this));
$(window).resize(_.bind(this.onResize, this));
},
@@ -53,39 +53,39 @@ define(['jquery', 'underscore', 'jquery.colorbox'], function ($, _) {
});
},
- toggleDeleteMode: function () {
- if (this.inDeleteMode) {
- $(ui.deleteButton).hide();
- $(ui.deleteForm).find('input').remove();
+ toggleSelectMode: function () {
+ if (this.inSelectMode) {
+ $(ui.formButtons).hide();
+ $(ui.submitForm).find('input').remove();
$(ui.markedThumbnails).removeClass('marked');
this.setupColorbox();
} else {
- $(ui.deleteButton).show();
+ $(ui.formButtons).show();
this.removeColorbox();
}
- this.inDeleteMode = !this.inDeleteMode;
+ this.inSelectMode = !this.inSelectMode;
},
- deleteInput: function (id) {
+ submitInput: function (id) {
return $('<input>').attr({
type: 'hidden',
name: 'ids[' + id + ']',
value: id,
- id: 'delete_' +id
+ id: 'submit_' +id
});
},
- toggleMarkForDeletion: function (event) {
- if (!this.inDeleteMode) { return; }
+ thumbnailClick: function (event) {
+ if (!this.inSelectMode) { return; }
event.preventDefault();
var id = $(event.target).closest('a').data('id');
- var deleteInput = $(ui.deleteForm).find('input#delete_' + id);
+ var submitInput = $(ui.submitForm).find('input#submit_' + id);
- if (deleteInput.length === 0) {
- $(ui.deleteForm).append(this.deleteInput(id));
+ if (submitInput.length === 0) {
+ $(ui.submitForm).append(this.submitInput(id));
} else {
- deleteInput.remove();
+ submitInput.remove();
}
$(event.target).closest('a').toggleClass('marked');
},