summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/css/mobile.css2
-rw-r--r--core/js/js.js68
-rw-r--r--core/js/sharedialoglinkshareview.js6
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js37
4 files changed, 86 insertions, 27 deletions
diff --git a/core/css/mobile.css b/core/css/mobile.css
index e8ed33933b7..26f7b8520b9 100644
--- a/core/css/mobile.css
+++ b/core/css/mobile.css
@@ -83,7 +83,7 @@
}
#app-sidebar{
- width: 100%;
+ width: 100% !important;
}
/* allow horizontal scrollbar in settings
diff --git a/core/js/js.js b/core/js/js.js
index 36fa90e78a3..4f0f288bd0c 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1641,6 +1641,45 @@ OC.Util = {
},
/**
+ * Returns the width of a generic browser scrollbar
+ *
+ * @return {int} width of scrollbar
+ */
+ getScrollBarWidth: function() {
+ if (this._scrollBarWidth) {
+ return this._scrollBarWidth;
+ }
+
+ var inner = document.createElement('p');
+ inner.style.width = "100%";
+ inner.style.height = "200px";
+
+ var outer = document.createElement('div');
+ outer.style.position = "absolute";
+ outer.style.top = "0px";
+ outer.style.left = "0px";
+ outer.style.visibility = "hidden";
+ outer.style.width = "200px";
+ outer.style.height = "150px";
+ outer.style.overflow = "hidden";
+ outer.appendChild (inner);
+
+ document.body.appendChild (outer);
+ var w1 = inner.offsetWidth;
+ outer.style.overflow = 'scroll';
+ var w2 = inner.offsetWidth;
+ if(w1 === w2) {
+ w2 = outer.clientWidth;
+ }
+
+ document.body.removeChild (outer);
+
+ this._scrollBarWidth = (w1 - w2);
+
+ return this._scrollBarWidth;
+ },
+
+ /**
* Remove the time component from a given date
*
* @param {Date} date date
@@ -1930,32 +1969,11 @@ jQuery.fn.exists = function(){
return this.length > 0;
};
+/**
+ * @deprecated use OC.Util.getScrollBarWidth() instead
+ */
function getScrollBarWidth() {
- var inner = document.createElement('p');
- inner.style.width = "100%";
- inner.style.height = "200px";
-
- var outer = document.createElement('div');
- outer.style.position = "absolute";
- outer.style.top = "0px";
- outer.style.left = "0px";
- outer.style.visibility = "hidden";
- outer.style.width = "200px";
- outer.style.height = "150px";
- outer.style.overflow = "hidden";
- outer.appendChild (inner);
-
- document.body.appendChild (outer);
- var w1 = inner.offsetWidth;
- outer.style.overflow = 'scroll';
- var w2 = inner.offsetWidth;
- if(w1 === w2) {
- w2 = outer.clientWidth;
- }
-
- document.body.removeChild (outer);
-
- return (w1 - w2);
+ return OC.Util.getScrollBarWidth();
}
/**
diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js
index 3d8fb461461..792062f0e16 100644
--- a/core/js/sharedialoglinkshareview.js
+++ b/core/js/sharedialoglinkshareview.js
@@ -124,7 +124,11 @@
this.$el.find('#linkPassText').focus();
}
} else {
- this.model.removeLinkShare();
+ if (this.model.get('linkShare').isLinkShare) {
+ this.model.removeLinkShare();
+ } else {
+ this.$el.find('#linkPass').slideToggle(OC.menuSpeed);
+ }
}
},
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index 37590ba79c2..22ae63e796a 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -231,6 +231,43 @@ describe('OC.Share.ShareDialogView', function() {
expect(dialog.$el.find('#linkCheckbox').prop('checked')).toEqual(true);
expect(dialog.$el.find('#linkText').val()).toEqual(link);
});
+ describe('password', function() {
+ var slideToggleStub;
+
+ beforeEach(function() {
+ $('#allowShareWithLink').val('yes');
+ configModel.set({
+ enforcePasswordForPublicLink: false
+ });
+
+ slideToggleStub = sinon.stub($.fn, 'slideToggle');
+ });
+ afterEach(function() {
+ slideToggleStub.restore();
+ });
+
+ it('enforced but toggled does not fire request', function() {
+ configModel.set('enforcePasswordForPublicLink', true);
+ dialog.render();
+
+ dialog.$el.find('[name=linkCheckbox]').click();
+
+ // The password linkPass field is shown (slideToggle is called).
+ // No request is made yet
+ expect(slideToggleStub.callCount).toEqual(1);
+ expect(slideToggleStub.getCall(0).thisValue.eq(0).attr('id')).toEqual('linkPass');
+ expect(fakeServer.requests.length).toEqual(0);
+
+ // Now untoggle share by link
+ dialog.$el.find('[name=linkCheckbox]').click();
+ dialog.render();
+
+ // Password field disappears and no ajax requests have been made
+ expect(fakeServer.requests.length).toEqual(0);
+ expect(slideToggleStub.callCount).toEqual(2);
+ expect(slideToggleStub.getCall(1).thisValue.eq(0).attr('id')).toEqual('linkPass');
+ });
+ });
describe('expiration date', function() {
var shareData;
var shareItem;