aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/js/fileactions.js16
-rw-r--r--apps/files/tests/js/fileactionsSpec.js150
-rw-r--r--apps/files_sharing/css/public.css37
-rw-r--r--apps/files_sharing/js/public.js2
-rw-r--r--apps/files_sharing/js/sharedfilelist.js9
-rw-r--r--apps/files_sharing/lib/api.php6
-rw-r--r--apps/files_sharing/templates/public.php4
-rw-r--r--core/css/header.css6
-rw-r--r--core/css/styles.css6
9 files changed, 210 insertions, 26 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index e06d2912274..cbfd047e98f 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -91,15 +91,11 @@
if (!this.actions[mime]) {
this.actions[mime] = {};
}
- if (!this.actions[mime][name]) {
- this.actions[mime][name] = {};
- }
- if (!displayName) {
- displayName = t('files', name);
- }
- this.actions[mime][name]['action'] = action;
- this.actions[mime][name]['permissions'] = permissions;
- this.actions[mime][name]['displayName'] = displayName;
+ this.actions[mime][name] = {
+ action: action,
+ permissions: permissions,
+ displayName: displayName || t('files', name)
+ };
this.icons[name] = icon;
this._notifyUpdateListeners();
},
@@ -314,7 +310,7 @@
});
this.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
- var dir = context.fileList.getCurrentDirectory();
+ var dir = context.$file.attr('data-path') || context.fileList.getCurrentDirectory();
if (dir !== '/') {
dir = dir + '/';
}
diff --git a/apps/files/tests/js/fileactionsSpec.js b/apps/files/tests/js/fileactionsSpec.js
index f464800730a..f087239de9d 100644
--- a/apps/files/tests/js/fileactionsSpec.js
+++ b/apps/files/tests/js/fileactionsSpec.js
@@ -193,6 +193,156 @@ describe('OCA.Files.FileActions tests', function() {
context = actionStub.getCall(0).args[1];
expect(context.dir).toEqual('/somepath');
});
+ describe('merging', function() {
+ var $tr;
+ beforeEach(function() {
+ var fileData = {
+ id: 18,
+ type: 'file',
+ name: 'testName.txt',
+ path: '/anotherpath/there',
+ mimetype: 'text/plain',
+ size: '1234',
+ etag: 'a01234c',
+ mtime: '123456'
+ };
+ $tr = fileList.add(fileData);
+ });
+ afterEach(function() {
+ $tr = null;
+ });
+ it('copies all actions to target file actions', function() {
+ var actions1 = new OCA.Files.FileActions();
+ var actions2 = new OCA.Files.FileActions();
+ var actionStub1 = sinon.stub();
+ var actionStub2 = sinon.stub();
+ actions1.register(
+ 'all',
+ 'Test',
+ OC.PERMISSION_READ,
+ OC.imagePath('core', 'actions/test'),
+ actionStub1
+ );
+ actions2.register(
+ 'all',
+ 'Test2',
+ OC.PERMISSION_READ,
+ OC.imagePath('core', 'actions/test'),
+ actionStub2
+ );
+ actions2.merge(actions1);
+
+ actions2.display($tr.find('td.filename'), true, fileList);
+
+ expect($tr.find('.action-test').length).toEqual(1);
+ expect($tr.find('.action-test2').length).toEqual(1);
+
+ $tr.find('.action-test').click();
+ expect(actionStub1.calledOnce).toEqual(true);
+ expect(actionStub2.notCalled).toEqual(true);
+
+ actionStub1.reset();
+
+ $tr.find('.action-test2').click();
+ expect(actionStub1.notCalled).toEqual(true);
+ expect(actionStub2.calledOnce).toEqual(true);
+ });
+ it('overrides existing actions on merge', function() {
+ var actions1 = new OCA.Files.FileActions();
+ var actions2 = new OCA.Files.FileActions();
+ var actionStub1 = sinon.stub();
+ var actionStub2 = sinon.stub();
+ actions1.register(
+ 'all',
+ 'Test',
+ OC.PERMISSION_READ,
+ OC.imagePath('core', 'actions/test'),
+ actionStub1
+ );
+ actions2.register(
+ 'all',
+ 'Test', // override
+ OC.PERMISSION_READ,
+ OC.imagePath('core', 'actions/test'),
+ actionStub2
+ );
+ actions1.merge(actions2);
+
+ actions1.display($tr.find('td.filename'), true, fileList);
+
+ expect($tr.find('.action-test').length).toEqual(1);
+
+ $tr.find('.action-test').click();
+ expect(actionStub1.notCalled).toEqual(true);
+ expect(actionStub2.calledOnce).toEqual(true);
+ });
+ it('overrides existing action when calling register after merge', function() {
+ var actions1 = new OCA.Files.FileActions();
+ var actions2 = new OCA.Files.FileActions();
+ var actionStub1 = sinon.stub();
+ var actionStub2 = sinon.stub();
+ actions1.register(
+ 'all',
+ 'Test',
+ OC.PERMISSION_READ,
+ OC.imagePath('core', 'actions/test'),
+ actionStub1
+ );
+
+ actions1.merge(actions2);
+
+ // late override
+ actions1.register(
+ 'all',
+ 'Test', // override
+ OC.PERMISSION_READ,
+ OC.imagePath('core', 'actions/test'),
+ actionStub2
+ );
+
+ actions1.display($tr.find('td.filename'), true, fileList);
+
+ expect($tr.find('.action-test').length).toEqual(1);
+
+ $tr.find('.action-test').click();
+ expect(actionStub1.notCalled).toEqual(true);
+ expect(actionStub2.calledOnce).toEqual(true);
+ });
+ it('leaves original file actions untouched (clean copy)', function() {
+ var actions1 = new OCA.Files.FileActions();
+ var actions2 = new OCA.Files.FileActions();
+ var actionStub1 = sinon.stub();
+ var actionStub2 = sinon.stub();
+ actions1.register(
+ 'all',
+ 'Test',
+ OC.PERMISSION_READ,
+ OC.imagePath('core', 'actions/test'),
+ actionStub1
+ );
+
+ // copy the Test action to actions2
+ actions2.merge(actions1);
+
+ // late override
+ actions2.register(
+ 'all',
+ 'Test', // override
+ OC.PERMISSION_READ,
+ OC.imagePath('core', 'actions/test'),
+ actionStub2
+ );
+
+ // check if original actions still call the correct handler
+ actions1.display($tr.find('td.filename'), true, fileList);
+
+ expect($tr.find('.action-test').length).toEqual(1);
+
+ $tr.find('.action-test').click();
+ expect(actionStub1.calledOnce).toEqual(true);
+ expect(actionStub2.notCalled).toEqual(true);
+ });
+ });
describe('events', function() {
var clock;
beforeEach(function() {
diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css
index 04c482d10e4..97c9696ad59 100644
--- a/apps/files_sharing/css/public.css
+++ b/apps/files_sharing/css/public.css
@@ -89,21 +89,48 @@ thead {
}
/* within #save */
+#save .save-form {
+ position: relative;
+}
+
#remote_address {
margin: 0;
+ width: 130px;
height: 14px;
padding: 6px;
+ padding-right: 24px;
+}
+
+.ie8 #remote_address {
+ padding-right: 30px;
}
-#save button {
+#save #save-button,
+#save #save-button-confirm {
margin: 0 5px;
height: 28px;
padding-bottom: 4px;
line-height: 14px;
}
-#save .save-form [type="submit"] {
- margin: 0 5px;
- height: 28px;
- padding-bottom: 4px;
+#save-button-confirm {
+ position: absolute;
+ background-color: transparent;
+ border: none;
+ margin: 2px 4px !important;
+ right: 0;
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
+ filter: alpha(opacity=50);
+ opacity: .5;
+}
+
+.ie8 #save-button-confirm {
+ margin: 2px 0 !important;
+}
+
+#save-button-confirm:hover,
+#save-button-confirm:focus {
+ -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
+ filter: alpha(opacity=100);
+ opacity: 1;
}
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index a5027da0cfb..2c68f440756 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -163,7 +163,7 @@ OCA.Sharing.PublicApp = {
OCA.Sharing.PublicApp._saveToOwnCloud(remote, token, owner, name, isProtected);
});
- $('#save > button').click(function () {
+ $('#save #save-button').click(function () {
$(this).hide();
$('.save-form').css('display', 'inline');
$('#remote_address').focus();
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index 304f77a8d77..ea9071cfcb8 100644
--- a/apps/files_sharing/js/sharedfilelist.js
+++ b/apps/files_sharing/js/sharedfilelist.js
@@ -166,11 +166,10 @@
}
else {
file.type = 'file';
- // force preview retrieval as we don't have mime types,
- // the preview endpoint will fall back to the mime type
- // icon if no preview exists
- file.isPreviewAvailable = true;
- file.icon = true;
+ if (share.isPreviewAvailable) {
+ file.icon = true;
+ file.isPreviewAvailable = true;
+ }
}
file.share = {
id: share.id,
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index 2e824a4a9df..50ba74f5beb 100644
--- a/apps/files_sharing/lib/api.php
+++ b/apps/files_sharing/lib/api.php
@@ -60,6 +60,9 @@ class Api {
foreach ($shares as &$share) {
if ($share['item_type'] === 'file' && isset($share['path'])) {
$share['mimetype'] = \OC_Helper::getFileNameMimeType($share['path']);
+ if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
+ $share['isPreviewAvailable'] = true;
+ }
}
$newShares[] = $share;
}
@@ -214,6 +217,9 @@ class Api {
foreach ($shares as &$share) {
if ($share['item_type'] === 'file') {
$share['mimetype'] = \OC_Helper::getFileNameMimeType($share['file_target']);
+ if (\OC::$server->getPreviewManager()->isMimeSupported($share['mimetype'])) {
+ $share['isPreviewAvailable'] = true;
+ }
}
}
$result = new \OC_OCS_Result($shares);
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index 2476beac1fb..386fa7e17cd 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -19,10 +19,10 @@
<div class="header-right">
<span id="details">
<span id="save" data-protected="<?php p($_['protected'])?>" data-owner="<?php p($_['displayName'])?>" data-name="<?php p($_['filename'])?>">
- <button><?php p($l->t('Add to your ownCloud')) ?></button>
+ <button id="save-button"><?php p($l->t('Add to your ownCloud')) ?></button>
<form class="save-form hidden" action="#">
<input type="text" id="remote_address" placeholder="example.com/owncloud"/>
- <input type="submit" value="<?php p($l->t('Save')) ?>"/>
+ <button id="save-button-confirm" class="icon-confirm svg"></button>
</form>
</span>
<a href="<?php p($_['downloadURL']); ?>" id="download" class="button">
diff --git a/core/css/header.css b/core/css/header.css
index 91dfeb798a5..86db48a3f08 100644
--- a/core/css/header.css
+++ b/core/css/header.css
@@ -241,20 +241,26 @@
float: left;
display: inline-block;
margin-right: 5px;
+ cursor: pointer;
}
#header .avatardiv img {
opacity: 1;
+ cursor: pointer;
}
#settings {
float: right;
color: #bbb;
+ cursor: pointer;
}
#expand {
display: block;
padding: 7px 12px 6px 7px;
cursor: pointer;
}
+#expand * {
+ cursor: pointer;
+}
#expand:hover, #expand:focus, #expand:active { color:#fff; }
#expand img { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; filter:alpha(opacity=70); opacity:.7; margin-bottom:-2px; }
#expand:hover img, #expand:focus img, #expand:active img { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; }
diff --git a/core/css/styles.css b/core/css/styles.css
index d959aec0361..78b9b930f35 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -420,13 +420,13 @@ input[name='password-clone'] {
#password-icon {
position: absolute;
left: 16px;
- top: 20px;
+ top: 22px;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
filter: alpha(opacity=30);
opacity: .3;
}
#adminpass-icon, #password-icon {
- top: 15px;
+ top: 17px;
}
/* General new input field look */
@@ -474,10 +474,10 @@ label.infield {
#body-login form input[type="checkbox"]+label {
position: relative;
margin: 0;
- font-size: 13px;
padding: 14px;
padding-left: 28px;
margin-left: -28px;
+ vertical-align: middle;
}
#body-login form .errors { background:#fed7d7; border:1px solid #f00; list-style-indent:inside; margin:0 0 2em; padding:1em; }
#body-login .success { background:#d7fed7; border:1px solid #0f0; width: 35%; margin: 30px auto; padding:1em; text-align: center;}