FCF - Full Stack Javascript Framework
OpenSource is a full stack development framework designed to simplify the development of WEB projects of various complexity levels.
It is based on unique technologies that open up new opportunities in development approaches with NODEJS.
Revision | eedfa948465e228551fa91cdb57a18ef9c0f7161 (tree) |
---|---|
Time | 2021-01-17 23:01:31 |
Author | Vladimir Markin <v.o.markin221@gmai...> |
Commiter | Vladimir Markin |
the requireRecord property takes an array of property names
@@ -76,7 +76,15 @@ | ||
76 | 76 | a_options.args = {}; |
77 | 77 | a_options.args = fcf.append({}, a_options.args, { fcfCP: fcfCP, fcfParent: a_initializeOptions.args.fcfWrapper ? a_initializeOptions.args.fcfId : undefined}); |
78 | 78 | |
79 | - if (a_options.view.requireRecord){ | |
79 | + if (Array.isArray(a_options.view.requireRecord) && fcf.isArg(a_options.record) && a_options.record.type == "reference"){ | |
80 | + let recordPattern = ""; | |
81 | + fcf.each(a_options.view.requireRecord, (a_key, a_field)=>{ | |
82 | + let argRef = fcf.arg("reference", {id: a_options.record.object.id, arg: a_options.record.arg + `["${a_field}"]` }); | |
83 | + a_options.args[`@record@${a_field}`] = argRef; | |
84 | + recordPattern += `"${a_field}": args["@record@${a_field}"],` | |
85 | + }) | |
86 | + a_options.args.record = fcf.argVal("@{{ {" + recordPattern + "} }}@"); | |
87 | + } else if (a_options.view.requireRecord){ | |
80 | 88 | a_options.args.record = a_options.record; |
81 | 89 | } |
82 | 90 |
@@ -85,11 +85,11 @@ | ||
85 | 85 | type: "text", |
86 | 86 | }, |
87 | 87 | { |
88 | - alias: "action", | |
89 | - title: "!{{Actions}}!", | |
90 | - type: "text", | |
91 | - template: "@controls:button", | |
92 | - requireRecord: true, | |
88 | + alias: "action", | |
89 | + title: "!{{Actions}}!", | |
90 | + type: "text", | |
91 | + template: "@controls:button", | |
92 | + requireRecord: ["path", "modify"], | |
93 | 93 | args: { |
94 | 94 | title: "!{{Remove}}!", |
95 | 95 | enable: fcf.argVal("@{{args.editableFile == args.record.path || args.record.modify}}@"), |
@@ -35,12 +35,17 @@ | ||
35 | 35 | let t = a_value[address[0]][address[1]]; |
36 | 36 | if (!t) |
37 | 37 | return; |
38 | + | |
39 | + let modifyData = t.modify !== true || t.path !== this._editableFiles[address[0]]; | |
40 | + | |
38 | 41 | t.modify = true; |
39 | - t.path = this._editableFiles[address[0]]; | |
42 | + t.path = this._editableFiles[address[0]]; | |
40 | 43 | translationsModify[address[0]][t.phrase] = t; |
41 | 44 | this.setArg("translationsModify", translationsModify); |
42 | - this.setArg(`translations["${address[0]}"]["${address[1]}"].modify`, t.modify); | |
43 | - this.setArg(`translations["${address[0]}"]["${address[1]}"].path`, t.path); | |
45 | + if (modifyData){ | |
46 | + this.setArg(`translations["${address[0]}"]["${address[1]}"].modify`, t.modify); | |
47 | + this.setArg(`translations["${address[0]}"]["${address[1]}"].path`, t.path); | |
48 | + } | |
44 | 49 | } |
45 | 50 | |
46 | 51 | onAppendRecord() { |