|
17 | 17 | ] |
18 | 18 | ] |
19 | 19 | %} |
20 | | -{% if module['id'] is defined %} |
21 | | - {% set moduleDependencies = module['dependencies'] %} |
22 | | -{% endif %} |
23 | 20 | <form data-validateon="section" id="{{componentId}}-{{sectionId}}-form"> |
24 | 21 | <fieldset id="{{componentId}}-{{sectionId}}-fieldset"> |
25 | 22 | {{adminltetags.useTag('tabs', |
|
60 | 57 | dataCollectionSection['{{componentId}}-{{sectionId}}-form']; |
61 | 58 | } |
62 | 59 |
|
63 | | -var modules = JSON.parse('{{modulesJson}}'); |
64 | | -var moduleDependencies = JSON.parse('{{moduleDependencies}}'); |
| 60 | +dataCollectionSectionForm['vars'] = { }; |
| 61 | +dataCollectionSectionForm['vars']['modules'] = JSON.parse('{{modulesJson}}'); |
| 62 | +dataCollectionSectionForm['vars']['moduleDependenciese'] = JSON.parse('{{moduleDependencies}}'); |
65 | 63 |
|
66 | 64 | dataCollectionSection = |
67 | 65 | $.extend(dataCollectionSection, { |
68 | 66 | '{{componentId}}-{{sectionId}}-id' : { }, |
69 | 67 | '{{componentId}}-{{sectionId}}-type' : { }, |
70 | 68 | '{{componentId}}-{{sectionId}}-name' : { }, |
| 69 | + '{{componentId}}-{{sectionId}}-display_name' : { }, |
71 | 70 | '{{componentId}}-{{sectionId}}-route' : { }, |
72 | 71 | '{{componentId}}-{{sectionId}}-description' : { }, |
| 72 | + '{{componentId}}-{{sectionId}}-module_type' : { |
| 73 | + 'placeholder' : 'SELECT MODULE TYPE' |
| 74 | + }, |
73 | 75 | '{{componentId}}-{{sectionId}}-app_type' : { }, |
74 | 76 | '{{componentId}}-{{sectionId}}-category' : { }, |
75 | 77 | '{{componentId}}-{{sectionId}}-sub_category' : { }, |
|
88 | 90 | id = e.params.data.id; |
89 | 91 | label = $(e.params.data.element).parents('optgroup').attr('label').toLowerCase(); |
90 | 92 |
|
91 | | - moduleData = modules[label][id]; |
| 93 | + moduleData = dataCollectionSectionForm['vars']['modules'][label][id]; |
92 | 94 | $('#{{componentId}}-{{sectionId}}-dependencies-modulename').val(moduleData['name']); |
93 | 95 | $('#{{componentId}}-{{sectionId}}-dependencies-moduleversion').val(moduleData['version']); |
94 | 96 | $('#{{componentId}}-{{sectionId}}-dependencies-modulerepo').val(moduleData['repo']); |
95 | 97 |
|
96 | | - $('#{{componentId}}-{{sectionId}}-dependencies-add, #{{componentId}}-{{sectionId}}-dependencies-remove').attr('disabled', false); |
| 98 | + $('#{{componentId}}-{{sectionId}}-dependencies-add, ' + |
| 99 | + '#{{componentId}}-{{sectionId}}-dependencies-remove').attr('disabled', false); |
97 | 100 | }); |
98 | 101 |
|
99 | 102 | function reset() { |
100 | | - $('#{{componentId}}-{{sectionId}}-dependencies-add, #{{componentId}}-{{sectionId}}-dependencies-remove').attr('disabled', true); |
| 103 | + $('#{{componentId}}-{{sectionId}}-dependencies-add, ' + |
| 104 | + '#{{componentId}}-{{sectionId}}-dependencies-remove').attr('disabled', true); |
101 | 105 |
|
102 | 106 | $('#{{componentId}}-{{sectionId}}-dependencies-modulename').val(''); |
103 | 107 | $('#{{componentId}}-{{sectionId}}-dependencies-moduleversion').val(''); |
104 | 108 | $('#{{componentId}}-{{sectionId}}-dependencies-modulerepo').val(''); |
105 | 109 | $('#{{componentId}}-{{sectionId}}-dependencies-modules').val(0).trigger('change'); |
106 | 110 | } |
107 | 111 |
|
108 | | - // function prettyfyDependencies() { |
109 | | - // $('#{{componentId}}-{{sectionId}}-dependencies-pretty').val(JSON.stringify(moduleDependencies, null, 4)); |
110 | | - // $('#{{componentId}}-{{sectionId}}-dependencies').val(JSON.stringify(moduleDependencies)); |
111 | | - // } |
| 112 | + function prettyfyDependencies() { |
| 113 | + $('#{{componentId}}-{{sectionId}}-dependencies') |
| 114 | + .val(JSON.stringify(dataCollectionSectionForm['vars']['moduleDependenciese'], null, 4)); |
| 115 | + } |
112 | 116 |
|
113 | 117 | $('#{{componentId}}-{{sectionId}}-dependencies-add').click(function(e) { |
114 | 118 | e.preventDefault(); |
115 | 119 |
|
116 | 120 | var found = false; |
117 | 121 |
|
118 | 122 | if (label === 'core') { |
119 | | - moduleDependencies[label]['name'] = moduleData['name']; |
120 | | - moduleDependencies[label]['version'] = moduleData['version']; |
121 | | - moduleDependencies[label]['repo'] = moduleData['repo']; |
| 123 | + dataCollectionSectionForm['vars']['moduleDependenciese'][label]['name'] = moduleData['name']; |
| 124 | + dataCollectionSectionForm['vars']['moduleDependenciese'][label]['version'] = moduleData['version']; |
| 125 | + dataCollectionSectionForm['vars']['moduleDependenciese'][label]['repo'] = moduleData['repo']; |
122 | 126 | } else { |
123 | | - for (var modules in moduleDependencies) { |
| 127 | + for (var modules in dataCollectionSectionForm['vars']['moduleDependenciese']) { |
124 | 128 | if (label === modules) { |
125 | | - $.each(moduleDependencies[modules], function(index, mod) { |
| 129 | + $.each(dataCollectionSectionForm['vars']['moduleDependenciese'][modules], function(index, mod) { |
126 | 130 | if (mod['name'] === moduleData['name']) { |
127 | 131 | found = true; |
128 | 132 | } |
129 | 133 | }); |
130 | 134 |
|
131 | 135 | if (!found) { |
132 | | - moduleDependencies[modules].push(moduleData); |
| 136 | + dataCollectionSectionForm['vars']['moduleDependenciese'][modules].push(moduleData); |
133 | 137 | } |
134 | 138 | } |
135 | 139 | } |
136 | 140 | } |
137 | 141 |
|
138 | 142 | reset(); |
139 | | - // prettyfyDependencies(); |
| 143 | + prettyfyDependencies(); |
140 | 144 | }); |
141 | 145 |
|
142 | 146 | $('#{{componentId}}-{{sectionId}}-dependencies-remove').click(function(e) { |
|
146 | 150 | var foundIndex; |
147 | 151 |
|
148 | 152 | if (label === 'core') { |
149 | | - moduleDependencies[label]['name'] = moduleData['name']; |
150 | | - moduleDependencies[label]['version'] = moduleData['version']; |
151 | | - moduleDependencies[label]['repo'] = moduleData['repo']; |
| 153 | + dataCollectionSectionForm['vars']['moduleDependenciese'][label]['name'] = moduleData['name']; |
| 154 | + dataCollectionSectionForm['vars']['moduleDependenciese'][label]['version'] = moduleData['version']; |
| 155 | + dataCollectionSectionForm['vars']['moduleDependenciese'][label]['repo'] = moduleData['repo']; |
152 | 156 | } else { |
153 | | - for (var modules in moduleDependencies) { |
| 157 | + for (var modules in dataCollectionSectionForm['vars']['moduleDependenciese']) { |
154 | 158 | if (label === modules) { |
155 | | - $.each(moduleDependencies[modules], function(index, mod) { |
| 159 | + $.each(dataCollectionSectionForm['vars']['moduleDependenciese'][modules], function(index, mod) { |
156 | 160 | if (mod['name'] === moduleData['name']) { |
157 | 161 | found = true; |
158 | 162 | foundIndex = index; |
159 | 163 | } |
160 | 164 | }); |
161 | 165 |
|
162 | 166 | if (found) { |
163 | | - moduleDependencies[modules].splice(foundIndex); |
| 167 | + dataCollectionSectionForm['vars']['moduleDependenciese'][modules].splice(foundIndex); |
164 | 168 | } |
165 | 169 | } |
166 | 170 | } |
167 | 171 | } |
168 | 172 |
|
169 | 173 | reset(); |
170 | | - // prettyfyDependencies(); |
| 174 | + prettyfyDependencies(); |
171 | 175 | }); |
172 | 176 |
|
173 | | - // prettyfyDependencies(); |
| 177 | + prettyfyDependencies(); |
174 | 178 | } |
175 | 179 | }, |
176 | 180 | '{{componentId}}-{{sectionId}}-dependencies-modulename' : { }, |
|
0 commit comments