Skip to content

Commit

Permalink
иправление загрузки еще, добавлено отображение иконки, если обложки нет
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriitux committed Jan 10, 2023
1 parent 4c1ea1a commit 4925ba2
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 62 deletions.
23 changes: 20 additions & 3 deletions installer/media/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ window.Sovmart = {
function (ev) {
let button_install = this;
let button_delete = SovmartUI.getContainerToolbar().querySelector('.ri-btn-delete');
let logs_container = SovmartUI.getContainerPage().querySelector('.sovmart-logs');
let logs_container = SovmartUI.getPage().querySelector('.sovmart-logs');

logs_container.innerHTML = '';

Expand Down Expand Up @@ -1002,7 +1002,7 @@ window.Sovmart = {

let button_install = SovmartUI.getContainerToolbar().querySelector('.ri-btn-install');
let button_delete = this;
let logs_container = SovmartUI.getContainerPage().querySelector('.sovmart-logs');
let logs_container = SovmartUI.getPage().querySelector('.sovmart-logs');

logs_container.innerHTML = '';

Expand Down Expand Up @@ -1301,6 +1301,19 @@ window.Sovmart = {
showPageNext: function (url) {
let self = this;
let page = SovmartUI.getPage();
let content = page.querySelector('.sovmart-group-content');

if(
content === null ||
content === undefined
)
{
return;
}

// забираем первый див, в него будет вставлять
content = content.children[0];

let button = SovmartUtils.createElement('div', {class: 'sovmart-flex sovmart-flex-center sovmart-margin'})
.add('button', {
type: 'button',
Expand Down Expand Up @@ -1341,7 +1354,11 @@ window.Sovmart = {
});

button_self.parentElement.remove();
page.appendChild(grid);
let collections = Array.from(grid.children);

for(let i=0;i<collections.length;i++) {
content.appendChild(collections[i]);
}

SovmartProject.checkInstall({
ids: ids,
Expand Down
120 changes: 63 additions & 57 deletions installer/media/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ window.SovmartUI = {
return this.container_toolbar;
},

getContainerPage: function () {
return this.container_page;
},

renderToolbar: function (args) {
let toolbar = SovmartUtils.createElement('div', {class: 'sovmart-toolbar sovmart-flex sovmart-child-margin-right-small'});

Expand Down Expand Up @@ -335,8 +331,8 @@ window.SovmartUI = {
{
group = group
.addChild('div', {class: 'sovmart-width-auto sovmart-margin-right'})
.add('h4', {}, args.groups[k].label)
.getParent();
.add('h4', {}, args.groups[k].label)
.getParent();
}

if (args.groups[k].buttons !== undefined) {
Expand Down Expand Up @@ -527,13 +523,13 @@ window.SovmartUI = {
]
]
})
.addChild('div', {class: 'sovmart-margin-small'})
.add('input', {class: 'sovmart-width-1-1 ri-input ri-input-medium', type: 'text', name: 'token', placeholder: SovmartLangs.text_token_input})
.getParent()
.addChild('div', {class: 'sovmart-margin-small'})
.add('button', {type: 'submit', class: 'ri-btn ri-btn-primary'}, SovmartLangs.login)
.getParent()
.getParent()
.addChild('div', {class: 'sovmart-margin-small'})
.add('input', {class: 'sovmart-width-1-1 ri-input ri-input-medium', type: 'text', name: 'token', placeholder: SovmartLangs.text_token_input})
.getParent()
.addChild('div', {class: 'sovmart-margin-small'})
.add('button', {type: 'submit', class: 'ri-btn ri-btn-primary'}, SovmartLangs.login)
.getParent()
.getParent()

return SovmartUI.renderDropdownButton({
label: SovmartLangs.auth,
Expand All @@ -552,34 +548,34 @@ window.SovmartUI = {

container = container.add('div', {}, SovmartLangs.hi + '<b>' + SovmartConfig.name + '</b>!')
.addChild('div', {class: 'sovmart-text-right'})
.add('a', {
href: '#',
events: [
[
'click',
function (event) {
event.preventDefault();

SovmartUtils.ajaxPost(Sovmart.url + '&method=savetoken', {token: ''})
.done(function (response) {
Sovmart.reload();
})
.fail(function (xhr) {
let response = JSON.parse(xhr.responseText);

if (response !== null && response.data[0] !== undefined) {
SovmartUtils.createAlert(response.data[0], 'danger', 5000);
return;
}
.add('a', {
href: '#',
events: [
[
'click',
function (event) {
event.preventDefault();

SovmartUtils.createAlert(SovmartLangs.alert_service_error, 'danger', 5000);
});
SovmartUtils.ajaxPost(Sovmart.url + '&method=savetoken', {token: ''})
.done(function (response) {
Sovmart.reload();
})
.fail(function (xhr) {
let response = JSON.parse(xhr.responseText);

return false;
}
]
]}, SovmartLangs.logout)
.getParent();
if (response !== null && response.data[0] !== undefined) {
SovmartUtils.createAlert(response.data[0], 'danger', 5000);
return;
}

SovmartUtils.createAlert(SovmartLangs.alert_service_error, 'danger', 5000);
});

return false;
}
]
]}, SovmartLangs.logout)
.getParent();

return container.build();
},
Expand All @@ -590,7 +586,8 @@ window.SovmartUI = {
width = 5,
close = false,
grid_row_id = SovmartUtils.randomInteger(1111111111, 9999999999),
items = [];
items = [],
count = args.items.length;

if (window.matchMedia("(max-width: 2100px)").matches) {
width = 4;
Expand All @@ -601,7 +598,7 @@ window.SovmartUI = {
'data-row': grid_row_id
});

for (let i = 0; i < args.items.length; i++) {
for (let i = 0; i < count; i++) {
current++;
close = false;
items.push(args.items[i]);
Expand All @@ -622,11 +619,13 @@ window.SovmartUI = {
args.trigger_grid_row_end_for(items, grid_row_id);
}

grid_row_id = SovmartUtils.randomInteger(1111111111, 9999999999);
grid = grid.addChild('div', {
class: 'sovmart-grid sovmart-grid-width-1-' + width,
'data-row': grid_row_id
});
if((i + 1) !== count) {
grid_row_id = SovmartUtils.randomInteger(1111111111, 9999999999);
grid = grid.addChild('div', {
class: 'sovmart-grid sovmart-grid-width-1-' + width,
'data-row': grid_row_id
});
}

current = 0;
close = true;
Expand Down Expand Up @@ -656,8 +655,6 @@ window.SovmartUI = {
args.trigger_grid_row_end_for(items, grid_row_id);
}

} else {
grid = grid.getParent();
}

return grid.build();
Expand All @@ -683,6 +680,15 @@ window.SovmartUI = {
cover_class = 'cover';
}

if (
args.images !== undefined &&
args.images.icon !== false &&
args.images.icon !== ''
) {
cover = Sovmart.api + '/' + args.images.icon;
cover_class = 'cover';
}

if (
args.cover !== undefined &&
args.cover !== ''
Expand Down Expand Up @@ -784,9 +790,9 @@ window.SovmartUI = {
'events': [
[
'click', function (event) {
Sovmart.showCategory(categories_list[i].id)
event.preventDefault();
}
Sovmart.showCategory(categories_list[i].id)
event.preventDefault();
}
]
]
}, categories_list[i].title);
Expand Down Expand Up @@ -1023,11 +1029,11 @@ window.SovmartUI = {

card = card
.addChild('div', {class: 'sovmart-project-card-more-wrap'} )
.addChild('div', {class: 'sovmart-project-card-more'} )
.add('div', {}, categories.build())
.add('div', {class: 'sovmart-project-card-description'}, description)
.getParent()
.getParent();
.addChild('div', {class: 'sovmart-project-card-more'} )
.add('div', {}, categories.build())
.add('div', {class: 'sovmart-project-card-description'}, description)
.getParent()
.getParent();

return card.build();
},
Expand All @@ -1039,7 +1045,7 @@ window.SovmartUI = {
.addChild('div', {
class: 'ri-dropdown ri-dropdown-' + (args.position !== undefined ? args.position : 'left') + ' ' + (args.padding !== undefined ? 'sovmart-padding-small' : '')
})
.add('div', {}, args.content)
.add('div', {}, args.content)
.getParent()
.build();
},
Expand Down
2 changes: 1 addition & 1 deletion installer/sovmart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<license>GNU General Public License version 3; see LICENSE.txt</license>
<authorEmail>cymbal@delo-design.ru</authorEmail>
<authorUrl>https://delo-design.ru</authorUrl>
<version>1.5.7</version>
<version>1.5.8</version>
<description>PLG_INSTALLER_SOVMART_PLUGIN_XML_DESCRIPTION</description>
<scriptfile>script.php</scriptfile>

Expand Down
2 changes: 1 addition & 1 deletion pkg_sovmart.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<license>GNU General Public License version 3; see LICENSE.txt</license>
<authorEmail>cymbal@delo-design.ru</authorEmail>
<authorUrl>https://delo-deisgn.ru</authorUrl>
<version>1.5.7</version>
<version>1.5.8</version>
<scriptfile>script.php</scriptfile>
<description>PKG_SOVMART_XML_DESCRIPTION</description>
<languages folder="language">
Expand Down

0 comments on commit 4925ba2

Please sign in to comment.