THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

attachment: Move download icon from back to ahead

tags/v1.11.0
Suwon Chae 1 year ago
parent
commit
d8f01912a1
3 changed files with 23 additions and 23 deletions
  1. +20
    -20
      app/assets/stylesheets/less/_page.less
  2. +1
    -1
      public/javascripts/common/yobi.Attachments.js
  3. +2
    -2
      public/javascripts/yona-lib.js

+ 20
- 20
app/assets/stylesheets/less/_page.less View File

@@ -3063,26 +3063,6 @@ label.inline-list {
}
}

.attach {
color: #9E9E9E;
padding:7px 15px;
background-color:#f8f8f8;

&:first-of-type {
.border-radius(3px 0 0 0);
}
.yobicon-paperclip {vertical-align:middle;}
.ybtn.download {
color: inherit;
float: right;
background-color: rgba(255,255,255,0.5);

&:hover, &:focus {
background-color: rgba(255,255,255,0.85);
}
}
}

.comment-body {
font-size: 1.1em;
padding: 5px 20px;
@@ -7388,3 +7368,23 @@ div.diff-body[data-outdated="true"] tr:hover .icon-comment {
}
}
}

.attach {
color: #9E9E9E;
padding:4px 10px 0 10px;

&:last-child {
padding-bottom: 6px;
}

.yobicon-paperclip {vertical-align:middle;}
.ybtn.download {
color: inherit;
margin-right: 10px;
background-color: rgba(255,255,255,0.5);

&:hover, &:focus {
background-color: rgba(255,255,255,0.85);
}
}
}

+ 1
- 1
public/javascripts/common/yobi.Attachments.js View File

@@ -47,7 +47,7 @@ yobi.Attachments = function(htOptions) {
var sFileLink = '<a href="${fileHref}" class="vmiddle" target="_blank"><i class="yobicon-paperclip"></i><span class="filename">${fileName}</span><span class="filesize">(${fileSizeReadable})</span></a>';
var sFileDownloadLink = '<a href="${fileHref}?action=download" class="download ybtn ybtn-mini" title="' + Messages("button.download") + ' ${fileName}"><i class="yobicon-download"></i></a>';
htVar.sTplFileList = htOptions.sTplFileList || '<ul class="attaches wm">';
htVar.sTplFileItem = htOptions.sTplFileItem || '<li class="attach">'+ sFileLink + sFileDownloadLink + '</li>';
htVar.sTplFileItem = htOptions.sTplFileItem || '<li class="attach">'+ sFileDownloadLink + sFileLink + '</li>';
htVar.sResourceId = htOptions.sResourceId; // ResId: Optional
htVar.sResourceType = htOptions.sResourceType; // ResType: Required
}


+ 2
- 2
public/javascripts/yona-lib.js View File

@@ -6,8 +6,8 @@ a&&h(b,100);b=$(["#"+r.nSubmitId,'.attached-file[data-id="'+r.oRes.id+'"]'].join
B(a);a.remove();0===k.welFileList.children().length&&(k.welFileList.hide(),k.welFileListHelp.hide())},fOnError:function(a){$yobi.notify(Messages("common.attach.error.delete",a.status,a.statusText))}})}function a(a){var b=k.welTextarea;if(0===b.length)return!1;var m=b.prop("selectionStart"),c=b.val();a="string"===typeof a?a:w(a);b.val(c.substring(0,m)+a+c.substring(m));z(b,m+a.length)}function d(a){return 0<=["video/mp4","video/ogg","video/webm"].indexOf($.trim(a).toLowerCase())}function u(a,b){d(b)&&
a.children("i.mimetype").addClass("yobicon-video2").show()}function w(a){var b=a.attr("data-mime"),k=a.attr("data-name");a=a.attr("data-href");k="["+k+"]("+a+") ";return"image"===b.substr(0,5)?"!"+k:d(b)?$("<div>").append($("<video>").attr("controls",!0).append($("<source>").attr("src",a)).append(k)).html():k}function y(a){return"\x3c!--_"+a+"_--\x3e"}function B(a){var b=k.welTextarea;if(0===b.length)return!1;a="string"===typeof a?a:w(a);var m=b.val().split(a).join(""),m=m.split(a.trim()).join("");
b.val(m)}function z(a,b){var k=a.get(0);k.setSelectionRange?k.setSelectionRange(b,b):k.createTextRange&&(k=k.createTextRange(),k.collapse(!0),k.moveEnd("character",b),k.moveStart("character",b),k.select())}function A(b){a(y(b.nSubmitId))}function t(a){var b=k.welTextarea;if(0===b.length)return!1;var m=b.prop("selectionStart"),c=b.val();b.val(c.substring(0,m)+a.markdownTableText+c.substring(m));z(b,m+a.markdownTableText.length)}function v(b){var k=b.oFiles,m=k.length;if("textarea"===b.weEvt.target.tagName.toLowerCase())for(b=
0;b<m;b++)a(y(k[b].nSubmitId))}function x(a){p({vFile:a.attachments,bTemporary:!1});"undefined"===typeof m.sResourceId&&p({vFile:a.tempFiles,bTemporary:!0})}var m={},k={};(function(a){var b=a=a||{},c='<a href="${fileHref}?action=download" class="download ybtn ybtn-mini" title="'+Messages("button.download")+' ${fileName}"><i class="yobicon-download"></i></a>';m.sTplFileList=b.sTplFileList||'<ul class="attaches wm">';m.sTplFileItem=b.sTplFileItem||'<li class="attach"><a href="${fileHref}" class="vmiddle" target="_blank"><i class="yobicon-paperclip"></i><span class="filename">${fileName}</span><span class="filesize">(${fileSizeReadable})</span></a>'+
c+"</li>";m.sResourceId=b.sResourceId;m.sResourceType=b.sResourceType;b=a;k.welToAttach=b.targetFormId||$(b.elContainer);k.welTemporaryUploadFileList=$('<input type="hidden" name="'+(b.sTagNameForTemporaryUploadFiles||"temporaryUploadFiles")+'">');k.welToAttach.prepend(k.welTemporaryUploadFileList);m.aTemporaryFileIds=[];k.welContainer=$(b.elContainer);k.welContainer.data("isYobiAttachment",!0);m.sResourceId=m.sResourceId||k.welContainer.data("resourceId");m.sResourceType=m.sResourceType||k.welContainer.data("resourceType");
0;b<m;b++)a(y(k[b].nSubmitId))}function x(a){p({vFile:a.attachments,bTemporary:!1});"undefined"===typeof m.sResourceId&&p({vFile:a.tempFiles,bTemporary:!0})}var m={},k={};(function(a){var b=a=a||{},c='<a href="${fileHref}?action=download" class="download ybtn ybtn-mini" title="'+Messages("button.download")+' ${fileName}"><i class="yobicon-download"></i></a>';m.sTplFileList=b.sTplFileList||'<ul class="attaches wm">';m.sTplFileItem=b.sTplFileItem||'<li class="attach">'+c+'<a href="${fileHref}" class="vmiddle" target="_blank"><i class="yobicon-paperclip"></i><span class="filename">${fileName}</span><span class="filesize">(${fileSizeReadable})</span></a></li>';
m.sResourceId=b.sResourceId;m.sResourceType=b.sResourceType;b=a;k.welToAttach=b.targetFormId||$(b.elContainer);k.welTemporaryUploadFileList=$('<input type="hidden" name="'+(b.sTagNameForTemporaryUploadFiles||"temporaryUploadFiles")+'">');k.welToAttach.prepend(k.welTemporaryUploadFileList);m.aTemporaryFileIds=[];k.welContainer=$(b.elContainer);k.welContainer.data("isYobiAttachment",!0);m.sResourceId=m.sResourceId||k.welContainer.data("resourceId");m.sResourceType=m.sResourceType||k.welContainer.data("resourceType");
m.attachments||(m.attachments=k.welContainer.data("attachments"));k.welTextarea=$(b.elTextarea);k.welFileList=k.welContainer.find("ul.attached-files");k.welFileListHelp=k.welContainer.find("p.help");b=yobi.Files.getEnv();k.welHelpDroppable=k.welContainer.find(".help-droppable");k.welHelpPastable=k.welContainer.find(".help-pastable");k.welHelpDroppable[b.bDroppable?"show":"hide"]();k.welHelpPastable[b.bPastable?"show":"hide"]();m.attachments?x(m.attachments):(m.sResourceType&&m.sResourceId||m.attachments)&&
yobi.Files.getList({fOnLoad:x,sResourceType:m.sResourceType,sResourceId:m.sResourceId});a.sUploaderId&&yobi.Files.attach({beforeUpload:n,uploadProgress:f,successUpload:l,errorUpload:e,pasteFile:A,pasteMarkdownTable:t,dropFile:v},a.sUploaderId)})(g||{});return{destroy:function(){g.sUploaderId&&yobi.Files.detach({beforeUpload:n,uploadProgress:f,successUpload:l,errorUpload:e,pasteFile:A,dropFile:v},g.sUploaderId);for(var a in k)k[a]=null;k=null}}};yobi.Files=function(){function g(a,b){if(a&&a.length)for(var c=0;c<a.length;c++)n(a[c],z(),b);else n(a,z(),b)}function n(a,b,c){a&&(a.nSubmitId=b||z());return!1===A("beforeUpload",{oFile:a,nSubmitId:a?a.nSubmitId:b},c)?!1:t.bXHR2?p(b,a,c):q(b,a,c)}function p(a,b,c){if(b.size&&b.size>t.nMaxFileSize)return h(a,{status:humanize.filesize(b.size),statusText:Messages("error.toolargefile",humanize.filesize(t.nMaxFileSize))},c);var d=new FormData;d.append("filePath",b,"image.png"===b.name?a+".png":b.name);
$.ajax({type:"post",url:t.sUploadURL,data:d,cache:!1,processData:!1,contentType:!1,success:function(b){f(a,b,c)},error:function(b){h(a,b,c)},xhr:function(){var b=$.ajaxSettings.xhr();b.upload&&b.upload.addEventListener("progress",function(b){b.lengthComputable&&l(a,Math.ceil(b.loaded/b.total*100),c)},!1);return b}})}function q(a,b,c){var d=v[c];if(!d.welInputFile&&!b)return!1;var e=d.welInputFile||$(b);b=e.clone();var u=$('<form method="post" enctype="multipart/form-data" style="display:none">');


Loading…
Cancel
Save