Converts attachment items to buttons instead of links

This commit is contained in:
Tim van der Meij 2014-04-25 22:42:19 +02:00
parent 094d0e24ce
commit 9d6ffbb3bf
2 changed files with 31 additions and 13 deletions

View File

@ -32,7 +32,6 @@ var DocumentAttachmentsView = function documentAttachmentsView(attachments) {
} }
function bindItemLink(domObj, item) { function bindItemLink(domObj, item) {
domObj.href = '#';
domObj.onclick = function documentAttachmentsViewOnclick(e) { domObj.onclick = function documentAttachmentsViewOnclick(e) {
var downloadManager = new DownloadManager(); var downloadManager = new DownloadManager();
downloadManager.downloadData(item.content, getFileName(item.filename), downloadManager.downloadData(item.content, getFileName(item.filename),
@ -48,10 +47,10 @@ var DocumentAttachmentsView = function documentAttachmentsView(attachments) {
var item = attachments[names[i]]; var item = attachments[names[i]];
var div = document.createElement('div'); var div = document.createElement('div');
div.className = 'attachmentsItem'; div.className = 'attachmentsItem';
var a = document.createElement('a'); var button = document.createElement('button');
bindItemLink(a, item); bindItemLink(button, item);
a.textContent = getFileName(item.filename); button.textContent = getFileName(item.filename);
div.appendChild(a); div.appendChild(button);
attachmentsView.appendChild(div); attachmentsView.appendChild(div);
} }
}; };

View File

@ -1178,13 +1178,19 @@ a:focus > .thumbnail > .thumbnailSelectionRing,
width: 192px; width: 192px;
top: 0; top: 0;
bottom: 0; bottom: 0;
padding: 4px 4px 0;
overflow: auto; overflow: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
} }
#outlineView {
padding: 4px 4px 0;
}
#attachmentsView {
padding: 3px 4px 0;
}
html[dir='ltr'] .outlineItem > .outlineItems { html[dir='ltr'] .outlineItem > .outlineItems {
margin-left: 20px; margin-left: 20px;
} }
@ -1194,7 +1200,7 @@ html[dir='rtl'] .outlineItem > .outlineItems {
} }
.outlineItem > a, .outlineItem > a,
.attachmentsItem > a { .attachmentsItem > button {
text-decoration: none; text-decoration: none;
display: inline-block; display: inline-block;
min-width: 95%; min-width: 95%;
@ -1208,18 +1214,31 @@ html[dir='rtl'] .outlineItem > .outlineItems {
white-space: normal; white-space: normal;
} }
html[dir='ltr'] .outlineItem > a, .attachmentsItem > button {
html[dir='ltr'] .attachmentsItem > a { border: 0 none;
padding: 2px 0 5px 10px; background: none;
cursor: pointer;
width: 100%;
} }
html[dir='rtl'] .outlineItem > a, html[dir='ltr'] .outlineItem > a {
html[dir='rtl'] .attachmentsItem > a { padding: 2px 0 5px 10px;
}
html[dir='ltr'] .attachmentsItem > button {
padding: 2px 0 3px 7px;
text-align: left;
}
html[dir='rtl'] .outlineItem > a {
padding: 2px 10px 5px 0; padding: 2px 10px 5px 0;
} }
html[dir='rtl'] .attachmentsItem > button {
padding: 2px 7px 3px 0;
text-align: right;
}
.outlineItem > a:hover, .outlineItem > a:hover,
.attachmentsItem > a:hover { .attachmentsItem > button:hover {
background-color: hsla(0,0%,100%,.02); background-color: hsla(0,0%,100%,.02);
background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0));
background-clip: padding-box; background-clip: padding-box;