Skip to content

Commit

Permalink
改进看板编辑页面资源编辑功能:添加资源功能改为明确的上传资源功能
Browse files Browse the repository at this point in the history
  • Loading branch information
datageartech committed Nov 22, 2020
1 parent 165d2f2 commit bc07b55
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ public ResponseEntity<OperationMessage> save(HttpServletRequest request, HttpSer
@RequestMapping(value = "/saveTemplateNames", produces = CONTENT_TYPE_JSON)
@ResponseBody
public ResponseEntity<OperationMessage> saveTemplateNames(HttpServletRequest request, HttpServletResponse response,
org.springframework.ui.Model model, @RequestParam("id") String id,
@RequestParam(value = "templates", required = false) String[] templates) throws Exception
org.springframework.ui.Model model, @RequestParam("id") String id, @RequestBody String[] templates)
throws Exception
{
if (isEmpty(templates))
return buildOperationMessageFailResponseEntity(request, HttpStatus.BAD_REQUEST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,12 @@ dashboard.dashboardResource=看板资源
dashboard.confirmDeleteSelectedResource=确认删除选中的看板资源吗?
dashboard.pleaseSaveDashboardFirst=请先保存看板
dashboard.copyResourceNameToClipboard=拷贝资源名到剪切板
dashboard.addResource=添加资源
dashboard.addResource=新建资源
dashboard.addResource.desc=新建可编辑的HTML、CSS、JS资源
dashboard.uploadResource=上传资源
dashboard.uploadResource.select=选择文件
dashboard.uploadResource.savePath=存储路径
dashboard.uploadResource.savePath.desc=例如:bg.png、images/bg.png
dashboard.editTemplateContent=编辑模板内容
dashboard.resourceAsTemplate=将普通资源设置为看板模板
dashboard.asFirstTemplate=将看板模板设置为主页模板
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ form .form-content .form-item .form-item-label label{
width: 95%;
overflow: hidden;
}
form .form-content .form-item .form-item-label label[title]{
form .form-content .form-item .form-item-label label[title],
form .form-content .tip-label[title]{
position: relative;
}
form .form-content .form-item .form-item-label label[title]::after,
Expand Down Expand Up @@ -2764,7 +2765,9 @@ table.dataTable tbody tr td select{
left: 0;
top: 0;
bottom: 0;
right: 10.6em;
right: 12.8em;
}
.page-form-dashboard .resources-wrapper .resource-editor-tabs .ui-tabs-nav{
}
.page-form-dashboard .resources-wrapper .resource-editor-tabs .resource-editor-tab-pane{
position: absolute;
Expand Down Expand Up @@ -2808,6 +2811,7 @@ table.dataTable tbody tr td select{
position: absolute;
right: 0;
top: 1.8em;
right: 0;
}
.page-form-dashboard .resources-wrapper .insert-chart-button-wrapper .ui-button{
margin-right: 0;
Expand All @@ -2817,7 +2821,7 @@ table.dataTable tbody tr td select{
right: 0;
top: 0.1em;
bottom: 0;
width: 10em;
width: 12em;
white-space: nowrap;
box-sizing: border-box;
-moz-box-sizing: border-box;
Expand Down Expand Up @@ -2897,34 +2901,37 @@ table.dataTable tbody tr td select{
border-left-width: 0px;
border-right-width: 0px;
}
.page-form-dashboard .resources-wrapper .resource-list-wrapper .add-resource-panel{
.page-form-dashboard .resources-wrapper .resource-list-wrapper .upload-resource-panel{
position: absolute;
display: none;
width: 120%;
right: 0px;
top: 1.8em;
padding: 0.3em 0.3em;
}
.page-form-dashboard .resources-wrapper .resource-list-wrapper .add-resource-panel .ui-widget-header{
.page-form-dashboard .resources-wrapper .resource-list-wrapper .upload-resource-panel .ui-widget-header{
font-weight: normal;
padding-left: 0.2em;
}
.page-form-dashboard .resources-wrapper .resource-list-wrapper .add-resource-panel .add-resource-panel-content{
.page-form-dashboard .resources-wrapper .resource-list-wrapper .upload-resource-panel .upload-resource-panel-content{
padding: 1em 0.5em;
}
.page-form-dashboard .resources-wrapper .resource-list-wrapper .add-resource-panel .add-resource-panel-content .content-item{
.page-form-dashboard .resources-wrapper .resource-list-wrapper .upload-resource-panel .upload-resource-panel-content .content-item{
padding-top: 0.2em;
padding-bottom: 0.2em;
}
.page-form-dashboard .resources-wrapper .resource-list-wrapper .add-resource-panel .add-resource-panel-content .add-resource-name-input{
.page-form-dashboard .resources-wrapper .resource-list-wrapper .upload-resource-panel .upload-resource-panel-content .content-item .label-wrapper{
padding-bottom: 0.2em;
}
.page-form-dashboard .resources-wrapper .resource-list-wrapper .upload-resource-panel .upload-resource-panel-content .upload-res-name-input{
width: 90%;
}
.page-form-dashboard .resources-wrapper .resource-list-wrapper .add-resource-panel .add-resource-panel-content .upload-file-info{
.page-form-dashboard .resources-wrapper .resource-list-wrapper .upload-resource-panel .upload-resource-panel-content .upload-file-info{
display: block;
margin-left: 0;
height: 1.2em;
}
.page-form-dashboard .resources-wrapper .resource-list-wrapper .add-resource-panel .add-resource-panel-foot{
.page-form-dashboard .resources-wrapper .resource-list-wrapper .upload-resource-panel .upload-resource-panel-foot{
text-align: center;
padding-top: 0.3em;
padding-bottom: 0.3em;
Expand All @@ -2933,7 +2940,7 @@ table.dataTable tbody tr td select{
position: absolute;
display: inline-block;
z-index: 10;
bottom: -1em;
bottom: -0.5em;
}
.page-form-dashboard .form-item-value-resources .resize-editor-wrapper.resize-left{
left: -0.6em;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,37 +66,48 @@ readonly 是否只读操作,允许为null
<#if !readonly>
<div class="resource-button-wrapper">
<button type='button' class='edit-template-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='dashboard.editTemplateContent' />"><span class='ui-icon ui-icon-pencil'></span><span class='ui-button-icon-space'></span></button>
<button type='button' class='add-resource-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='dashboard.addResource' />"><span class='ui-icon ui-icon-plus'></span><span class='ui-button-icon-space'></span></button>
<!--
<button type='button' class='add-resource-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='dashboard.addResource.desc' />"><span class='ui-icon ui-icon-plus'></span><span class='ui-button-icon-space'></span></button>
-->
<button type='button' class='upload-resource-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='dashboard.uploadResource' />"><span class='ui-icon ui-icon-arrowstop-1-n'></span><span class='ui-button-icon-space'></span></button>
<button type='button' class='delete-resource-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='delete' />"><span class='ui-icon ui-icon-close'></span><span class='ui-button-icon-space'></span></button>
<div class="resource-more-button-wrapper">
<span class="resource-more-icon ui-icon ui-icon-caret-1-s"></span>
<div class="resource-more-button-panel ui-widget ui-widget-content ui-corner-all ui-front ui-widget-shadow">
<button type='button' class='copy-resource-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='dashboard.copyResourceNameToClipboard' />"><span class='ui-icon ui-icon-copy'></span><span class='ui-button-icon-space'></span></button>
<button type='button' class='as-template-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='dashboard.resourceAsTemplate' />"><span class='ui-icon ui-icon-arrow-1-n'></span><span class='ui-button-icon-space'></span></button>
<button type='button' class='as-resource-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='dashboard.templateAsNormalResource' />"><span class='ui-icon ui-icon-arrow-1-s'></span><span class='ui-button-icon-space'></span></button>
<button type='button' class='as-template-first-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='dashboard.asFirstTemplate' />"><span class='ui-icon ui-icon-arrowstop-1-n'></span><span class='ui-button-icon-space'></span></button>
<button type='button' class='as-template-first-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='dashboard.asFirstTemplate' />"><span class='ui-icon ui-icon-home'></span><span class='ui-button-icon-space'></span></button>
<button type='button' class='refresh-resource-button resource-button ui-button ui-corner-all ui-widget ui-button-icon-only' title="<@spring.message code='refresh' />"><span class='ui-icon ui-icon-refresh'></span><span class='ui-button-icon-space'></span></button>
</div>
</div>
</div>
</#if>
</div>
<div class="resource-content"></div>
<div class='add-resource-panel ui-widget ui-widget-content ui-corner-all ui-front ui-widget-shadow'>
<div class="add-resource-panel-head ui-widget-header ui-corner-all"><@spring.message code='dashboard.addResource' /></div>
<div class="add-resource-panel-content">
<div class='upload-resource-panel ui-widget ui-widget-content ui-corner-all ui-front ui-widget-shadow'>
<div class="upload-resource-panel-head ui-widget-header ui-corner-all"><@spring.message code='dashboard.uploadResource' /></div>
<div class="upload-resource-panel-content">
<div class="content-item">
<div class="fileinput-button ui-button ui-corner-all ui-widget" title="<@spring.message code='dashboard.import.desc' />">
<div class="label-wrapper">
<label><@spring.message code='dashboard.uploadResource.select' /></label>
</div>
<div class="fileinput-button ui-button ui-corner-all ui-widget">
<@spring.message code='select' /><input type="file" class="ignore">
</div>
<div class="upload-file-info"></div>
</div>
<div class="content-item">
<input type="text" name="" value="" class="add-resource-name-input ui-widget ui-widget-content" />
<div class="label-wrapper">
<label title="<@spring.message code='dashboard.uploadResource.savePath.desc' />" class="tip-label">
<@spring.message code='dashboard.uploadResource.savePath' />
</label>
</div>
<input type="text" name="" value="" class="upload-res-name-input ui-widget ui-widget-content" />
<input type="hidden" value="" class="resource-uploadFilePath" />
</div>
</div>
<div class="add-resource-panel-foot">
<div class="upload-resource-panel-foot">
<button type="button" class="save-resource-button"><@spring.message code='confirm' /></button>
</div>
</div>
Expand Down Expand Up @@ -532,16 +543,16 @@ readonly 是否只读操作,允许为null
$.tipSuccess("<@spring.message code='copyToClipboardSuccess' />");
});
po.element(".add-resource-panel").draggable({ handle : ".add-resource-panel-head" });
po.element(".upload-resource-panel").draggable({ handle : ".upload-resource-panel-head" });
$(document.body).on("click", function(event)
{
var $target = $(event.target);
var $ssp = po.element(".add-resource-panel");
var $ssp = po.element(".upload-resource-panel");
if(!$ssp.is(":hidden"))
{
if($target.closest(".add-resource-panel, .add-resource-button").length == 0)
if($target.closest(".upload-resource-panel, .upload-resource-button").length == 0)
$ssp.hide();
}
});
Expand Down Expand Up @@ -680,19 +691,31 @@ readonly 是否只读操作,允许为null
if(!id)
return;
var param = $.toParamString("templates", templateNames);
$.post(po.url("saveTemplateNames?id="+id), param, function(response)
$.ajaxJson(po.url("saveTemplateNames?id="+id),
{
po.templates = response.data.templates;
po.refreshDashboardResources();
if(success)
success();
data: templateNames,
success : function(response)
{
po.templates = response.data.templates;
po.refreshDashboardResources();
if(success)
success();
}
});
};
po.element(".add-resource-button").click(function()
po.element(".upload-res-name-input").on("keydown", function(e)
{
if(e.keyCode == $.ui.keyCode.ENTER)
{
po.element(".save-resource-button").click();
//防止提交表单
return false;
}
});
po.element(".upload-resource-button").click(function()
{
var id = po.getDashboardId();
Expand All @@ -702,11 +725,11 @@ readonly 是否只读操作,允许为null
return;
}
po.element(".add-resource-name-input").val("");
po.element(".upload-res-name-input").val("");
po.element(".resource-uploadFilePath").val("");
po.element(".upload-file-info").text("");
var $panel = po.element(".add-resource-panel");
var $panel = po.element(".upload-resource-panel");
$panel.show();
//$panel.position({ my : "right top", at : "right+20 bottom+3", of : this});
});
Expand All @@ -715,7 +738,7 @@ readonly 是否只读操作,允许为null
{
var id = po.getDashboardId();
var resourceFilePath = po.element(".resource-uploadFilePath").val();
var resourceName = po.element(".add-resource-name-input").val();
var resourceName = po.element(".upload-res-name-input").val();
if(!id || !resourceFilePath || !resourceName)
return;
Expand All @@ -724,7 +747,7 @@ readonly 是否只读操作,允许为null
function()
{
po.refreshDashboardResources();
po.element(".add-resource-panel").hide();
po.element(".upload-resource-panel").hide();
});
});
Expand Down Expand Up @@ -778,7 +801,7 @@ readonly 是否只读操作,允许为null
else
currentRes = "";
po.element(".add-resource-name-input").val(currentRes + uploadResult.fileName);
po.element(".upload-res-name-input").val(currentRes + uploadResult.fileName);
po.element(".resource-uploadFilePath").val(uploadResult.uploadFilePath);
$.fileuploadsuccessHandlerForUploadInfo(po.fileUploadInfo(), false);
Expand Down

0 comments on commit bc07b55

Please sign in to comment.