Skip to content

Commit

Permalink
#4145 - Uploader's enhancement (studio)
Browse files Browse the repository at this point in the history
  • Loading branch information
romanlesnikov committed Dec 6, 2022
1 parent ec8092e commit 78492b0
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 75 deletions.
12 changes: 12 additions & 0 deletions studio/template/form_ghost_template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost mt-2 flex items-start">
<div class="bx-uploader-ghost-cnt">
<a class="bx-anchor-invisible" name="album-media-{file_id}"></a>
<input type="hidden" name="__name__[]" value="{file_id}" />
<div class="bx-base-general-icon-wrapper">
<img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
</div>
<span class="bx-base-general-uploader-ghost">
<a class="bx-btn bx-btn-small" href="javascript:void(0);" title="<bx_text:_sys_txt_form_entry_input_picture_delete />" onclick="javascript: {js_instance_name}.deleteGhost('{file_id}');"><i class="sys-icon times"></i></a>
</span>
</div>
</div>
4 changes: 1 addition & 3 deletions studio/template/scripts/BxBaseStudioBuilderPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -1162,9 +1162,7 @@ protected function getSettingsCover($aPage = array(), $bCreate = true, $bInputsO
'uploaders' => $this->aUploadersCover,
'multiple' => false,
'content_id' => isset($aPage['id']) ? $aPage['id'] : 0,
'ghost_template' => BxDolStudioTemplate::getInstance()->parseHtmlByName('uploader_fgt_cover.html', array(
'name' => 'cover_image',
)),
'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate('cover_image'),
'caption' => _t('_adm_bp_txt_page_cover_image'),
'db' => array (
'pass' => 'Int',
Expand Down
18 changes: 5 additions & 13 deletions studio/template/scripts/BxBaseStudioDesigner.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ protected function getIcon()
),
);
}

$aForm = array(
'form_attrs' => array(
'id' => $this->sIconFormId,
Expand Down Expand Up @@ -322,9 +322,7 @@ protected function getIcon()
'uploaders' => ['sys_html5'],
'multiple' => false,
'content_id' => $this->aIcons['icon_apple']['id'],
'ghost_template' => $oTemplate->parseHtmlByName('uploader_fgt_icon.html', array(
'name' => 'icon_apple',
)),
'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate('icon_apple'),
'caption' => _t('_adm_dsg_txt_upload_icon_apple'),
'info' => _t('_adm_dsg_txt_upload_icon_apple_inf'),
),
Expand All @@ -336,9 +334,7 @@ protected function getIcon()
'uploaders' => ['sys_html5'],
'multiple' => false,
'content_id' => $this->aIcons['icon_android']['id'],
'ghost_template' => $oTemplate->parseHtmlByName('uploader_fgt_icon.html', array(
'name' => 'icon_android',
)),
'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate('icon_android'),
'caption' => _t('_adm_dsg_txt_upload_icon_android'),
'info' => _t('_adm_dsg_txt_upload_icon_android_inf'),
),
Expand All @@ -350,9 +346,7 @@ protected function getIcon()
'uploaders' => ['sys_html5'],
'multiple' => false,
'content_id' => $this->aIcons['icon_android_splash']['id'],
'ghost_template' => $oTemplate->parseHtmlByName('uploader_fgt_icon.html', array(
'name' => 'icon_android_splash',
)),
'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate('icon_android_splash'),
'caption' => _t('_adm_dsg_txt_upload_icon_android_splash'),
'info' => _t('_adm_dsg_txt_upload_icon_android_splash_inf'),
),
Expand Down Expand Up @@ -405,9 +399,7 @@ protected function getCover()
'uploaders' => array('sys_std_crop_cover'),
'multiple' => false,
'content_id' => $aSetting['id'],
'ghost_template' => BxDolStudioTemplate::getInstance()->parseHtmlByName('uploader_fgt_cover.html', array(
'name' => $sCover,
)),
'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate($sCover),
'caption' => _t('_adm_dsg_txt_upload_' . $sCover),
'db' => array (
'pass' => 'Int',
Expand Down
1 change: 0 additions & 1 deletion studio/template/scripts/BxBaseStudioFormsField.php
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,6 @@ public function init()
);

$aUploaders = array(
'sys_simple' => '_sys_uploader_simple_title',
'sys_html5' => '_sys_uploader_html5_title'
);
foreach($aUploaders as $sObject => $sTitle) {
Expand Down
9 changes: 9 additions & 0 deletions studio/template/scripts/BxBaseStudioFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ public function getWidget($mixedWidget, $aParams = array())
));
}


public function getDefaultGhostTemplate($mParams, $sTemplateName = 'form_ghost_template.html')
{
if (!is_array($mParams))
$mParams = ['name' => $mParams];

return BxDolStudioTemplate::getInstance()->parseHtmlByName($sTemplateName, $mParams);
}

protected function getInjHeadLiveUpdates()
{
return '';
Expand Down
6 changes: 3 additions & 3 deletions studio/template/scripts/BxBaseStudioGridStorages.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ protected function _getFormObject($sAction)
'uploaders' => $this->_aUploaders,
'multiple' => true,
'content_id' => 0,
'ghost_template' => BxDolStudioTemplate::getInstance()->parseHtmlByName('strg_fgt_' . $this->_sType . '.html', array(
'name' => $this->_sType . '[]'
)),
'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate($this->_sType . '[]'),
'caption' => ''
),
'submit' => array(
Expand All @@ -172,3 +170,5 @@ protected function _getFormObject($sAction)
}

/** @} */


2 changes: 1 addition & 1 deletion studio/template/scripts/BxBaseStudioOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ protected function field($aItem, $aItems2Mixes)
'upload_buttons_titles' => ['HTML5' => _t('_sys_uploader_button_name_single')],
'multiple' => false,
'content_id' => $iContentId,
'ghost_template' => ['inputs' => []],
'ghost_template' => BxTemplStudioFunctions::getInstance()->getDefaultGhostTemplate($aItem['name']),
'caption' => _t($aItem['caption']),
'value' => $mixedValue,
'attrs' => $aAttributes,
Expand Down
12 changes: 0 additions & 12 deletions studio/template/strg_fgt_files.html

This file was deleted.

12 changes: 0 additions & 12 deletions studio/template/strg_fgt_images.html

This file was deleted.

11 changes: 0 additions & 11 deletions studio/template/uploader_fgt_cover.html

This file was deleted.

11 changes: 0 additions & 11 deletions studio/template/uploader_fgt_icon.html

This file was deleted.

7 changes: 1 addition & 6 deletions template/css/uploaders.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
color:#900;
}
.bx-uploader-ghost{
width: 290px;
max-width: 290px;
display: flex;
flex-direction: column;
align-items: center;
Expand Down Expand Up @@ -57,11 +57,6 @@
-webkit-box-reflect: below 0px -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(.7, transparent), to(rgba(0,0,0,0.4)));
}

.bx-uploader-ghost-form {
width:500px;
float:left;
}

.bx-uploader-ghost-form-filename {

}
Expand Down
4 changes: 2 additions & 2 deletions template/uploader_nested_form_wrapper.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost">
<div id="bx-uploader-file-{storage_object}-{file_id}">
<div class="bx-uploader-ghost-preview bx-def-padding-right bx-def-padding-top">
<img src="{file_icon}" class="bx-def-border" onload="$(this).css('background-image', 'url()')" />
</div>
<div class="bx-uploader-ghost-form ">
<div class="bx-uploader-ghost-form-filename bx-def-padding-top bx-def-padding-bottom bx-def-font-grayed">{file_name}</div>
__nested_form__
<div class="bx-uploader-ghost-form-actions bx-def-margin-top bx-clearfix"><a class="bx-btn bx-btn-small" href="javascript:void(0);" onclick="{js_instance_name}.deleteGhost('{file_id}')"><bx_text:_Delete /></a></div>
<div class="bx-uploader-ghost-form-actions bx-clearfix"><a class="bx-btn bx-btn-small" href="javascript:void(0);" onclick="{js_instance_name}.deleteGhost('{file_id}')"><bx_text:_Delete /></a></div>
</div>
<div class="bx-clear"></div>
</div>

0 comments on commit 78492b0

Please sign in to comment.