modxcms / revolution

MODX Revolution - Content Management Framework
https://modx.com/
GNU General Public License v2.0
1.36k stars 529 forks source link

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

Open Extrabash opened 1 year ago

Extrabash commented 1 year ago

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

Ruslan-Aleev commented 1 year ago

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.

halftrainedharry commented 1 year ago

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 commented 1 year ago

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?

Ruslan-Aleev commented 1 year ago

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.

halftrainedharry commented 1 year ago

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?

Ruslan-Aleev commented 1 year ago

Where is the sorting wrong?

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

Extrabash commented 1 year ago

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

image

halftrainedharry commented 1 year ago

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.

Extrabash commented 1 year ago

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.