diff --git a/src/DependencyInjection/FlagbitTableAttributeExtension.php b/src/DependencyInjection/FlagbitTableAttributeExtension.php
index 36af6f6..748a95f 100644
--- a/src/DependencyInjection/FlagbitTableAttributeExtension.php
+++ b/src/DependencyInjection/FlagbitTableAttributeExtension.php
@@ -37,5 +37,6 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('query_builders.xml');
$loader->load('factories.xml');
$loader->load('doctrine.xml');
+ $loader->load('copiers.xml');
}
}
diff --git a/src/Resources/config/copiers.xml b/src/Resources/config/copiers.xml
new file mode 100644
index 0000000..04da1eb
--- /dev/null
+++ b/src/Resources/config/copiers.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+ flagbit_catalog_table
+
+
+ flagbit_catalog_table
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Resources/public/js/inittable.js b/src/Resources/public/js/inittable.js
index 7e34920..f700c21 100644
--- a/src/Resources/public/js/inittable.js
+++ b/src/Resources/public/js/inittable.js
@@ -3,7 +3,7 @@ define(
function ($, _) {
'use strict';
return {
- init: function ($target, columns) {
+ init: function ($target, columns, editMode) {
var $headerRow = $target.find('thead tr');
if ($headerRow[0].innerHTML && $headerRow[0].innerHTML.length != 0) {
@@ -44,7 +44,7 @@ define(
htmlColumns.push(this.createColumn(column, value));
}.bind(this)
);
- $tbody.append(this.createRow(htmlColumns));
+ $tbody.append(this.createRow(htmlColumns, editMode));
}.bind(this)
);
},
@@ -54,7 +54,7 @@ define(
return td;
},
- createRow: function (htmlColumns) {
+ createRow: function (htmlColumns, editMode) {
var row = $('
');
row.append($(' | '));
_.each(
@@ -62,7 +62,11 @@ define(
row.append(htmlColumn);
}
);
- row.append($(' | '));
+ if (editMode === 'view') {
+ row.append($(' | '));
+ } else {
+ row.append($(' | '));
+ }
return row;
},
diff --git a/src/Resources/public/js/product/field/table-field.js b/src/Resources/public/js/product/field/table-field.js
index db9965e..45190e0 100644
--- a/src/Resources/public/js/product/field/table-field.js
+++ b/src/Resources/public/js/product/field/table-field.js
@@ -50,7 +50,7 @@ define(
this.columns[column.id] = column;
}.bind(this)
);
- initTable.init(this.$('.flagbit-table-attribute'), this.columns);
+ initTable.init(this.$('.flagbit-table-attribute'), this.columns, this.getEditMode());
// initialize dran & drop sorting
this.$('.flagbit-table-values tbody').sortable(
{
@@ -119,7 +119,8 @@ define(
text: i18n.getLabel(item.labels, UserContext.get('catalogLocale'), item.code),
config: item.type_config,
type: item.type,
- func: this.createColumnFunctions(item)
+ func: this.createColumnFunctions(item),
+ editMode: this.getEditMode()
};
},
createColumnFunctions: function (item) {
@@ -139,10 +140,10 @@ define(
switch (item.type) {
case "text":
- fieldTemplate = "";
+ fieldTemplate = "/>";
break;
case "number":
- fieldTemplate = "' />";
+ fieldTemplate = "' <%= column.editMode === 'view' ? 'disabled' : '' %>/>";
if ('is_decimal' in item.type_config && item.type_config.is_decimal === true) {
parser = function (td) {
return parseFloat($('input', td).val());
@@ -154,7 +155,7 @@ define(
}
break;
case "select":
- fieldTemplate = "";
+ fieldTemplate = "/>";
parser = function (td) {
var option = $('input', td).select2('data');
@@ -190,7 +191,7 @@ define(
}.bind(this);
break;
case "select_from_url":
- fieldTemplate = "";
+ fieldTemplate = "/>";
parser = function (td) {
var option = $('input', td).select2('data');
diff --git a/src/Resources/public/templates/product/field/table.html b/src/Resources/public/templates/product/field/table.html
index e289f70..c76cbff 100644
--- a/src/Resources/public/templates/product/field/table.html
+++ b/src/Resources/public/templates/product/field/table.html
@@ -1,6 +1,8 @@
+ <% if(editMode === 'edit') { %>
+ <% } %>
+ data-scope="<%= value.scope %>"
<%= editMode === 'view' ? 'disabled' : '' %> />