revolution icon indicating copy to clipboard operation
revolution copied to clipboard

modx revo 2.8.5 tamplate - available for template (tvs) doesn't save info, only checkboxes

Open Extrabash opened this issue 2 years ago • 9 comments

Bug report

Summary

Modx revo 2.8.5 tamplate - available for template (tvs) doesn't save info, only checkboxes. Nor name no order will be saved.

Step to reproduce

Go to any template, check it's template variables, try to rename one, or change sort number. On save - checkbox will be saved, name and sort number wouldn't.

Observed behavior

Fields will stay after save.

Expected behavior

Should save new info.

Environment

MODX version 2.8.5

Extrabash avatar Oct 22 '23 13:10 Extrabash

I confirm! The name and label of the TV changes when double-clicked, BUT is not saved. Moreover, if TV is located in a category, then problems also appear for sorting.

tvs

p.s. This is probably also true for the 3.x branch.

Ruslan-Aleev avatar Oct 22 '23 13:10 Ruslan-Aleev

Nor name no order will be saved.

The value in the column "Rank" (Сортировка) is saved correctly, when the checkbox "Access" (Доступ) is checked. This "Rank" value is specific to the template the TV is assigned to. If the TV is not assigned to the template, then there is no place to store the value.

https://github.com/modxcms/revolution/blob/3f887dc6494fe32d3b2a52da20ec76a63bc8fb7d/core/model/modx/processors/element/template/update.class.php#L77


What is the expected solution for this issue?

Just to disable the inline editing of the columns "name" and "caption" in the grid?

Here in the code: https://github.com/modxcms/revolution/blob/3f887dc6494fe32d3b2a52da20ec76a63bc8fb7d/manager/assets/modext/widgets/element/modx.grid.template.tv.js#L53

Or to add the missing functionality to the update processor?

Here in the code: https://github.com/modxcms/revolution/blob/3f887dc6494fe32d3b2a52da20ec76a63bc8fb7d/core/model/modx/processors/element/template/update.class.php#L65

halftrainedharry avatar Oct 23 '23 11:10 halftrainedharry

p.s. This is probably also true for the 3.x branch.

@Ruslan-Aleev In MODX 3, you removed the inline edition in the grid (https://github.com/modxcms/revolution/commit/369ea78d2d5f4decbb3e2e02826229fe2e9f874a). So I suppose this is the preferred solution for the 2.x branch as well?

halftrainedharry avatar Oct 23 '23 11:10 halftrainedharry

The value in the column "Rank" (Сортировка) is saved correctly, when the checkbox "Access" (Доступ) is checked. This "Rank" value is specific to the template the TV is assigned to. If the TV is not assigned to the template, then there is no place to store the value.

I understand about "Access", yes. BUT, there seems to be a problem with sorting if TVs are located inside a category (not without a category, but within a separate category). Check back if you have time.

So I suppose this is the preferred solution for the 2.x branch as well?

I think yes. There is no need to add new functionality for the 2.x branch.

Ruslan-Aleev avatar Oct 23 '23 13:10 Ruslan-Aleev

BUT, there seems to be a problem with sorting if TVs are located inside a category (not without a category, but within a separate category).

I'm sorry, but I don't understand what you mean exactly.

Where is the sorting wrong? In the "Template Variables" tab (shown in your screenshot above) when edition a template? Or in the "Template Variables" tab of a resource?

halftrainedharry avatar Oct 23 '23 16:10 halftrainedharry

Where is the sorting wrong?

Apparently I made a mistake, I double-checked everything again - there is no error, the sorting works.

Ruslan-Aleev avatar Oct 23 '23 19:10 Ruslan-Aleev

One more thing - sort field is filled with nuber in tv form, but 0's in category in sort field.

image

Extrabash avatar Oct 29 '23 15:10 Extrabash

sort field is filled with nuber in tv form, but 0's in category in sort field.

These are two different values. One is stored in the database table modx_site_tmplvars (column rank) and is set per TV. The other is stored in the database table modx_site_tmplvar_templates (column rank) and is specific to this template. This value can be used to give the TV a different rank, if it's used in multiple templates and should appear in a different position.

halftrainedharry avatar Oct 30 '23 08:10 halftrainedharry

Ok, See now. Didn't know this one, seems totally useless)) The way to move categories attached to templates in diffetent order, that would be really useful, while building multiple pages, containing same info blocks. To have them in order as on page.

Extrabash avatar Oct 30 '23 16:10 Extrabash