promethee 3.0.2 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/UPGRADING +2 -2
- data/app/assets/stylesheets/promethee-edit.sass +1 -0
- data/app/assets/stylesheets/promethee-edit/_localizer.sass +4 -0
- data/app/models/concerns/promethee_data.rb +57 -34
- data/app/services/promethee/structure_upgrader/components/aside.rb +51 -0
- data/app/services/promethee/structure_upgrader/components/base.rb +36 -0
- data/app/services/promethee/structure_upgrader/components/blockquote.rb +32 -0
- data/app/services/promethee/structure_upgrader/components/collection.rb +31 -0
- data/app/services/promethee/structure_upgrader/components/collection_item.rb +55 -0
- data/app/services/promethee/structure_upgrader/components/column.rb +92 -0
- data/app/services/promethee/structure_upgrader/components/cover.rb +49 -0
- data/app/services/promethee/structure_upgrader/components/faq.rb +16 -0
- data/app/services/promethee/structure_upgrader/components/faq_item.rb +49 -0
- data/app/services/promethee/structure_upgrader/components/image.rb +42 -0
- data/app/services/promethee/structure_upgrader/components/page.rb +56 -0
- data/app/services/promethee/structure_upgrader/components/row.rb +32 -0
- data/app/services/promethee/structure_upgrader/components/slider.rb +16 -0
- data/app/services/promethee/structure_upgrader/components/slider_item.rb +55 -0
- data/app/services/promethee/structure_upgrader/components/table.rb +116 -0
- data/app/services/promethee/structure_upgrader/components/table_cell.rb +16 -0
- data/app/services/promethee/structure_upgrader/components/text.rb +25 -0
- data/app/services/promethee/structure_upgrader/components/video.rb +32 -0
- data/app/services/promethee/structure_upgrader_service.rb +110 -0
- data/app/views/promethee/_edit.html.erb +34 -4
- data/app/views/promethee/_localize.html.erb +34 -3
- data/app/views/promethee/components/aside/_edit.define.html.erb +29 -4
- data/app/views/promethee/components/aside/_edit.inspect.html.erb +6 -6
- data/app/views/promethee/components/aside/_edit.move.html.erb +7 -7
- data/app/views/promethee/components/aside/_localize.html.erb +11 -11
- data/app/views/promethee/components/aside/_show.html.erb +8 -8
- data/app/views/promethee/components/blockquote/_edit.define.html.erb +12 -2
- data/app/views/promethee/components/blockquote/_edit.inspect.html.erb +4 -4
- data/app/views/promethee/components/blockquote/_edit.move.html.erb +3 -3
- data/app/views/promethee/components/blockquote/_localize.html.erb +8 -8
- data/app/views/promethee/components/blockquote/_show.html.erb +3 -3
- data/app/views/promethee/components/collection/_edit.define.html.erb +12 -1
- data/app/views/promethee/components/collection/_edit.inspect.html.erb +4 -4
- data/app/views/promethee/components/collection/_edit.move.html.erb +1 -1
- data/app/views/promethee/components/collection/_localize.html.erb +0 -1
- data/app/views/promethee/components/collection/_show.html.erb +1 -2
- data/app/views/promethee/components/collection_item/_edit.define.html.erb +27 -5
- data/app/views/promethee/components/collection_item/_edit.inspect.html.erb +6 -6
- data/app/views/promethee/components/collection_item/_edit.move.html.erb +5 -5
- data/app/views/promethee/components/collection_item/_localize.html.erb +9 -9
- data/app/views/promethee/components/collection_item/_show.html.erb +7 -7
- data/app/views/promethee/components/column/_edit.define.html.erb +58 -8
- data/app/views/promethee/components/column/_edit.inspect.html.erb +19 -19
- data/app/views/promethee/components/column/_localize.html.erb +0 -1
- data/app/views/promethee/components/column/_show.html.erb +10 -10
- data/app/views/promethee/components/cover/_edit.define.html.erb +26 -6
- data/app/views/promethee/components/cover/_edit.inspect.html.erb +4 -4
- data/app/views/promethee/components/cover/_edit.move.html.erb +4 -4
- data/app/views/promethee/components/cover/_localize.html.erb +14 -14
- data/app/views/promethee/components/cover/_show.html.erb +10 -10
- data/app/views/promethee/components/faq_item/_edit.define.html.erb +25 -5
- data/app/views/promethee/components/faq_item/_edit.inspect.html.erb +4 -4
- data/app/views/promethee/components/faq_item/_edit.move.html.erb +6 -6
- data/app/views/promethee/components/faq_item/_localize.html.erb +7 -7
- data/app/views/promethee/components/faq_item/_show.html.erb +7 -7
- data/app/views/promethee/components/image/_edit.define.html.erb +19 -4
- data/app/views/promethee/components/image/_edit.inspect.html.erb +3 -3
- data/app/views/promethee/components/image/_edit.move.html.erb +5 -5
- data/app/views/promethee/components/image/_localize.html.erb +20 -17
- data/app/views/promethee/components/image/_show.html.erb +6 -6
- data/app/views/promethee/components/page/_edit.define.html.erb +32 -7
- data/app/views/promethee/components/page/_edit.inspect.html.erb +5 -5
- data/app/views/promethee/components/page/_localize.html.erb +8 -8
- data/app/views/promethee/components/page/_show.html.erb +4 -4
- data/app/views/promethee/components/row/_edit.define.html.erb +12 -2
- data/app/views/promethee/components/row/_edit.inspect.html.erb +8 -8
- data/app/views/promethee/components/row/_edit.move.html.erb +9 -9
- data/app/views/promethee/components/row/_show.html.erb +7 -6
- data/app/views/promethee/components/slider_item/_edit.define.html.erb +27 -5
- data/app/views/promethee/components/slider_item/_edit.inspect.html.erb +6 -6
- data/app/views/promethee/components/slider_item/_edit.move.html.erb +7 -7
- data/app/views/promethee/components/slider_item/_localize.html.erb +9 -9
- data/app/views/promethee/components/slider_item/_show.html.erb +7 -8
- data/app/views/promethee/components/table/_edit.define.html.erb +9 -6
- data/app/views/promethee/components/table/_edit.inspect.html.erb +138 -50
- data/app/views/promethee/components/table/_edit.move.html.erb +17 -7
- data/app/views/promethee/components/table/_localize.html.erb +0 -43
- data/app/views/promethee/components/table/_show.html.erb +13 -16
- data/app/views/promethee/components/table_cell/_edit.define.html.erb +22 -0
- data/app/views/promethee/components/table_cell/_edit.inspect.html.erb +0 -0
- data/app/views/promethee/components/table_cell/_edit.move.html.erb +0 -0
- data/app/views/promethee/components/table_cell/_icon.svg +3 -0
- data/app/views/promethee/components/table_cell/_localize.html.erb +14 -0
- data/app/views/promethee/components/table_cell/_show.html.erb +0 -0
- data/app/views/promethee/components/text/_edit.define.html.erb +6 -1
- data/app/views/promethee/components/text/_edit.inspect.html.erb +3 -3
- data/app/views/promethee/components/text/_edit.move.html.erb +1 -1
- data/app/views/promethee/components/text/_localize.html.erb +3 -3
- data/app/views/promethee/components/text/_show.html.erb +2 -2
- data/app/views/promethee/components/video/_edit.define.html.erb +12 -2
- data/app/views/promethee/components/video/_edit.inspect.html.erb +2 -2
- data/app/views/promethee/components/video/_edit.move.html.erb +6 -6
- data/app/views/promethee/components/video/_localize.html.erb +4 -4
- data/app/views/promethee/components/video/_show.html.erb +4 -3
- data/app/views/promethee/presets/_image-with-text.html.erb +171 -6
- data/lib/promethee/data/localization.rb +13 -2
- data/lib/promethee/rails/version.rb +1 -1
- data/lib/tasks/promethee/promethee.rake +6 -0
- metadata +31 -6
@@ -1,26 +1,26 @@
|
|
1
1
|
<script type="text/ng-template" id="promethee/components/slider_item/localize">
|
2
|
-
<div ng-show="master.attributes.
|
2
|
+
<div ng-show="master.attributes.caption.value !== '' || master.attributes.media_type.value == 'video'">
|
3
3
|
<hr>
|
4
4
|
|
5
|
-
<div class="row" ng-show="master.attributes.
|
5
|
+
<div class="row" ng-show="master.attributes.caption.value !== ''">
|
6
6
|
<div class="col-md-6">
|
7
7
|
<b>Slider Item Caption</b>
|
8
|
-
<div class="promethee-edit__wrapper" ng-bind-html="master.attributes.
|
8
|
+
<div class="promethee-edit__wrapper" ng-bind-html="master.attributes.caption.value | htmlSafe"></div>
|
9
9
|
</div>
|
10
10
|
<div class="col-md-6">
|
11
|
-
<
|
12
|
-
<summernote config="summernoteConfig" ng-model="component.attributes.
|
11
|
+
<b>Slider Item Caption</b>
|
12
|
+
<summernote config="summernoteConfig" ng-model="component.attributes.caption.value"></summernote>
|
13
13
|
</div>
|
14
14
|
</div>
|
15
15
|
|
16
|
-
<div class="row" ng-show="master.attributes.media_type == 'video'">
|
16
|
+
<div class="row" ng-show="master.attributes.media_type.value == 'video'">
|
17
17
|
<div class="col-md-6">
|
18
18
|
<b>Video URL</b>
|
19
|
-
<div ng-bind-html="master.attributes.video.
|
19
|
+
<div ng-bind-html="master.attributes.video.value | htmlSafe"></div>
|
20
20
|
</div>
|
21
21
|
<div class="col-md-6">
|
22
|
-
<
|
23
|
-
<input class="form-control" ng-model="component.attributes.video.
|
22
|
+
<b>Video URL</b>
|
23
|
+
<input class="form-control" ng-model="component.attributes.video.value" type="text">
|
24
24
|
</div>
|
25
25
|
</div>
|
26
26
|
</div>
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%
|
2
|
-
media_type = component[:attributes]
|
3
|
-
|
2
|
+
media_type = component[:attributes].dig(:media_type, :value)
|
3
|
+
caption = component[:attributes].dig(:caption, :value)&.to_s&.html_safe
|
4
4
|
case media_type
|
5
5
|
when 'image'
|
6
|
-
image_blob = blob_from_data component[:attributes]
|
6
|
+
image_blob = blob_from_data component[:attributes].dig(:image, :value)
|
7
7
|
when 'video'
|
8
|
-
url = component[:attributes]
|
8
|
+
url = component[:attributes].dig(:video, :value)&.to_s
|
9
9
|
if 'vimeo'.in? url
|
10
10
|
video_id = url.gsub(/\A(?:https?:)?\/\/(?:(?:www|player)\.)?vimeo\.com\/(?:video\/)?(\d+).*?\z/, '\1')
|
11
11
|
iframe_src = "https://player.vimeo.com/video/#{video_id}?color=ffffff&title=0&byline=0&portrait=0"
|
@@ -18,13 +18,12 @@ when 'video'
|
|
18
18
|
end
|
19
19
|
%>
|
20
20
|
<div class="carousel-item__content">
|
21
|
-
|
22
21
|
<% if iframe_src.present? %>
|
23
22
|
<div class="embed-responsive embed-responsive-16by9">
|
24
23
|
<iframe frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen="allowfullscreen" src="<%= iframe_src %>"></iframe>
|
25
24
|
</div>
|
26
25
|
<% elsif image_blob.present? %>
|
27
|
-
<%= render 'promethee/show/image.srcset', blob: image_blob, alt: '', caption:
|
26
|
+
<%= render 'promethee/show/image.srcset', blob: image_blob, alt: '', caption: caption %>
|
28
27
|
<% end %>
|
29
|
-
<%=
|
30
|
-
</div>
|
28
|
+
<%= caption %>
|
29
|
+
</div>
|
@@ -8,13 +8,16 @@
|
|
8
8
|
data: {
|
9
9
|
type: 'table',
|
10
10
|
attributes: {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
structure: {
|
12
|
+
searchable: false,
|
13
|
+
translatable: false,
|
14
|
+
type: 'matrix',
|
15
|
+
value: []
|
16
|
+
}
|
17
|
+
},
|
18
|
+
children: []
|
16
19
|
}
|
17
20
|
})
|
18
21
|
JAVASCRIPT
|
19
22
|
%>
|
20
|
-
<div ng-init="<%= init %>"></div>
|
23
|
+
<div ng-init="<%= init %>"></div>
|
@@ -1,25 +1,24 @@
|
|
1
1
|
<script type="text/ng-template" id="promethee/components/table/edit/inspect">
|
2
2
|
<div ng-controller="TableInspectController">
|
3
3
|
<div class="form-group">
|
4
|
-
<
|
5
|
-
<div
|
6
|
-
ng-click="addColumn()">
|
4
|
+
<h3>Columns</h3>
|
5
|
+
<div class="btn btn-default btn-light btn-sm" ng-click="addColumn()">
|
7
6
|
Add column
|
8
|
-
</div
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div ui-sortable="sortableColumnsOptions"
|
10
|
+
ng-model="promethee.inspected.attributes.structure.value[0]">
|
11
|
+
<div ng-if="getHeaderCellUids().length > 1" ng-repeat="cellUid in getHeaderCellUids()">
|
12
|
+
<div class="row align-items-center">
|
12
13
|
<div class="col-1" style="line-height: 38px">
|
13
14
|
<i class="fas fa-bars"></i>
|
14
15
|
</div>
|
15
16
|
<div class="col-9">
|
16
|
-
|
17
|
-
ng-model="promethee.inspected.attributes.cols_data[colUid].searchable_text"
|
18
|
-
class="form-control" />
|
17
|
+
{{ getTableCell(cellUid).attributes.text.value }}
|
19
18
|
</div>
|
20
19
|
<div class="col-2">
|
21
20
|
<a class="btn btn-default btn-light btn-sm"
|
22
|
-
ng-click="removeColumn(
|
21
|
+
ng-click="removeColumn($index)">
|
23
22
|
<%= icon('fa', 'close') %>
|
24
23
|
</a>
|
25
24
|
</div>
|
@@ -27,74 +26,163 @@
|
|
27
26
|
</div>
|
28
27
|
</div>
|
29
28
|
</div>
|
30
|
-
|
29
|
+
|
31
30
|
<div class="form-group">
|
32
|
-
<
|
33
|
-
<div
|
34
|
-
ng-click="addRow()">
|
31
|
+
<h3>Rows</h3>
|
32
|
+
<div class="btn btn-default btn-light btn-sm" ng-click="addRow(true)">
|
35
33
|
Add row
|
36
|
-
</div
|
37
|
-
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div class="mb-2" ng-repeat="row in promethee.inspected.attributes.structure.value">
|
37
|
+
<b ng-if="$index === 0">Header</b>
|
38
|
+
<b ng-if="$index > 0">Row {{$index}}</b>
|
38
39
|
<span class="small">
|
39
|
-
<b>Row {{$index+1}}</b>
|
40
40
|
<a class="btn btn-default btn-light btn-sm float-right"
|
41
|
-
ng-click="removeRow(
|
41
|
+
ng-click="removeRow($index)">
|
42
42
|
<%= icon('fa', 'close') %>
|
43
43
|
</a>
|
44
44
|
</span><br/>
|
45
|
-
<div ng-repeat="
|
45
|
+
<div ng-repeat="cellUid in row">
|
46
46
|
<span class="small">
|
47
|
-
{{
|
47
|
+
{{ getTableCell(getHeaderCellUids()[$index]).attributes.text.value }}
|
48
48
|
</span>
|
49
49
|
<br/>
|
50
50
|
<input type="text"
|
51
|
-
ng-model="
|
51
|
+
ng-model="getTableCell(cellUid).attributes.text.value"
|
52
52
|
class="form-control" />
|
53
53
|
</div>
|
54
|
-
<hr/>
|
55
54
|
</div>
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
55
|
+
<hr>
|
56
|
+
<div ng-show="promethee.inspected.attributes.structure.value.length > 1">
|
57
|
+
<label class="label-control">Drag the rows below to reorder them:</label>
|
58
|
+
<ul ui-sortable
|
59
|
+
ng-model="promethee.inspected.attributes.structure.value"
|
60
|
+
class="list-unstyled">
|
61
|
+
<li ng-repeat="_ in promethee.inspected.attributes.structure.value track by $index">
|
62
|
+
<%= icon('fa', 'bars') %>
|
63
|
+
<span ng-if="$index === 0">Header</span>
|
64
|
+
<span ng-if="$index > 0">Row {{$index}}</span>
|
65
|
+
</li>
|
66
|
+
</ul>
|
67
|
+
</div>
|
66
68
|
</div>
|
67
69
|
</div>
|
68
70
|
</script>
|
69
71
|
|
70
72
|
<script>
|
71
73
|
promethee.controller('TableInspectController', ['$scope', 'uidService', function($scope, uidService) {
|
72
|
-
$scope.
|
73
|
-
|
74
|
-
|
75
|
-
|
74
|
+
$scope.sortableColumnsOptions = {
|
75
|
+
update: function (e, ui) {
|
76
|
+
var originalIndex = ui.item.sortable.index,
|
77
|
+
newIndex = ui.item.sortable.dropindex;
|
78
|
+
|
79
|
+
ui.item.sortable.cancel();
|
80
|
+
this.sortColumns(originalIndex, newIndex);
|
81
|
+
}.bind($scope)
|
82
|
+
};
|
83
|
+
|
84
|
+
$scope.getHeaderCellUids = function () {
|
85
|
+
if (this.promethee.inspected.attributes.structure.value.length === 0) {
|
86
|
+
return [];
|
87
|
+
}
|
88
|
+
|
89
|
+
return this.promethee.inspected.attributes.structure.value[0];
|
76
90
|
}
|
77
91
|
|
78
|
-
$scope.
|
79
|
-
var
|
80
|
-
this.promethee.inspected.attributes.
|
92
|
+
$scope.sortColumns = function (oldIndex, newIndex) {
|
93
|
+
var i;
|
94
|
+
for (i = 0; i < this.promethee.inspected.attributes.structure.value.length; i += 1) {
|
95
|
+
var uid = this.promethee.inspected.attributes.structure.value[i][oldIndex]
|
96
|
+
|
97
|
+
this.promethee.inspected.attributes.structure.value[i].splice(oldIndex, 1);
|
98
|
+
this.promethee.inspected.attributes.structure.value[i].splice(newIndex, 0, uid);
|
99
|
+
}
|
100
|
+
};
|
101
|
+
|
102
|
+
$scope.getColumnsCount = function () {
|
103
|
+
return $scope.getRowsCount() === 0 ? 0 : this.promethee.inspected.attributes.structure.value[0].length;
|
104
|
+
};
|
105
|
+
|
106
|
+
$scope.getRowsCount = function () {
|
107
|
+
return this.promethee.inspected.attributes.structure.value.length;
|
108
|
+
};
|
109
|
+
|
110
|
+
$scope.removeRow = function (index) {
|
111
|
+
var uids = this.promethee.inspected.attributes.structure.value[index],
|
112
|
+
i;
|
113
|
+
|
114
|
+
this.promethee.inspected.attributes.structure.value.splice(index, 1);
|
115
|
+
$scope.removeData(uids);
|
81
116
|
}
|
82
117
|
|
83
|
-
$scope.
|
84
|
-
var
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
118
|
+
$scope.removeColumn = function (index) {
|
119
|
+
var uids = [],
|
120
|
+
i;
|
121
|
+
|
122
|
+
for (i = 0; i < this.promethee.inspected.attributes.structure.value.length; i += 1) {
|
123
|
+
uids.push(this.promethee.inspected.attributes.structure.value[i][index]);
|
124
|
+
this.promethee.inspected.attributes.structure.value[i].splice(index, 1);
|
89
125
|
}
|
126
|
+
|
127
|
+
$scope.removeData(uids);
|
90
128
|
}
|
91
129
|
|
92
|
-
$scope.
|
93
|
-
|
130
|
+
$scope.removeData = function (uids) {
|
131
|
+
var filteredChildren = this.promethee.inspected.children.filter(function (childComponent) {
|
132
|
+
// Select children where id is not in the input array
|
133
|
+
return uids.indexOf(childComponent.id) === -1;
|
134
|
+
});
|
135
|
+
|
136
|
+
this.promethee.inspected.children = filteredChildren;
|
94
137
|
}
|
95
138
|
|
96
|
-
$scope.
|
97
|
-
|
139
|
+
$scope.addColumn = function () {
|
140
|
+
var tableCell,
|
141
|
+
uid,
|
142
|
+
i;
|
143
|
+
|
144
|
+
if ($scope.getRowsCount() === 0) {
|
145
|
+
$scope.addRow(false);
|
146
|
+
}
|
147
|
+
|
148
|
+
for (i = 0; i < this.promethee.inspected.attributes.structure.value.length; i += 1) {
|
149
|
+
tableCell = $scope.createNewCell();
|
150
|
+
this.promethee.inspected.attributes.structure.value[i].push(tableCell.id);
|
151
|
+
}
|
152
|
+
};
|
153
|
+
|
154
|
+
$scope.addRow = function (forceColumn) {
|
155
|
+
var rowsCount = $scope.getRowsCount(),
|
156
|
+
columnsCount = $scope.getColumnsCount(),
|
157
|
+
newRow = [],
|
158
|
+
tableCell,
|
159
|
+
uid,
|
160
|
+
i;
|
161
|
+
|
162
|
+
for (i = 0; i < columnsCount; i += 1) {
|
163
|
+
tableCell = $scope.createNewCell();
|
164
|
+
newRow.push(tableCell.id);
|
165
|
+
}
|
166
|
+
|
167
|
+
this.promethee.inspected.attributes.structure.value.push(newRow);
|
168
|
+
|
169
|
+
if (columnsCount === 0 && forceColumn) {
|
170
|
+
$scope.addColumn();
|
171
|
+
}
|
172
|
+
};
|
173
|
+
|
174
|
+
$scope.getTableCell = function (uid) {
|
175
|
+
return this.promethee.inspected.children.filter(function (childComponent) {
|
176
|
+
return childComponent.id === uid;
|
177
|
+
})[0];
|
98
178
|
}
|
179
|
+
|
180
|
+
$scope.createNewCell = function () {
|
181
|
+
var definition = $scope.findDefinitionByType('table_cell'),
|
182
|
+
newCell = $scope.createComponentFromDefinition(definition);
|
183
|
+
|
184
|
+
this.promethee.inspected.children.push(newCell);
|
185
|
+
return newCell;
|
186
|
+
};
|
99
187
|
}]);
|
100
188
|
</script>
|
@@ -1,18 +1,18 @@
|
|
1
1
|
<script type="text/ng-template" id="promethee/components/table/edit/move">
|
2
2
|
<%= render 'promethee/edit/move.header', type: 'table' %>
|
3
|
-
<div class="table-responsive">
|
3
|
+
<div class="table-responsive" ng-controller="TableMoveController">
|
4
4
|
<table class="table">
|
5
5
|
<thead>
|
6
6
|
<tr>
|
7
|
-
<th ng-repeat="
|
8
|
-
{{
|
7
|
+
<th ng-repeat="cellUid in component.attributes.structure.value[0]">
|
8
|
+
{{getTableCell(cellUid).attributes.text.value}}
|
9
9
|
</th>
|
10
10
|
</tr>
|
11
11
|
</thead>
|
12
12
|
<tbody>
|
13
|
-
<tr ng-repeat="
|
14
|
-
<td ng-repeat="
|
15
|
-
{{
|
13
|
+
<tr ng-repeat="row in component.attributes.structure.value" ng-if="$index > 0">
|
14
|
+
<td ng-repeat="cellUid in row">
|
15
|
+
{{getTableCell(cellUid).attributes.text.value}}
|
16
16
|
</td>
|
17
17
|
</tr>
|
18
18
|
</tbody>
|
@@ -20,4 +20,14 @@
|
|
20
20
|
</div>
|
21
21
|
</div>
|
22
22
|
</div>
|
23
|
-
</script>
|
23
|
+
</script>
|
24
|
+
|
25
|
+
<script>
|
26
|
+
promethee.controller('TableMoveController', ['$scope', 'uidService', function($scope, uidService) {
|
27
|
+
$scope.getTableCell = function (uid) {
|
28
|
+
return this.component.children.filter(function (childComponent) {
|
29
|
+
return childComponent.id === uid;
|
30
|
+
})[0];
|
31
|
+
}
|
32
|
+
}]);
|
33
|
+
</script>
|
@@ -1,46 +1,3 @@
|
|
1
1
|
<script type="text/ng-template" id="promethee/components/table/localize">
|
2
2
|
<hr>
|
3
|
-
|
4
|
-
<div class="row">
|
5
|
-
<div class="col-md-6">
|
6
|
-
<table class="table">
|
7
|
-
<thead>
|
8
|
-
<tr>
|
9
|
-
<th ng-repeat="colUid in master.attributes.cols track by $index">
|
10
|
-
{{ master.attributes.cols_data[colUid].searchable_text }}
|
11
|
-
</th>
|
12
|
-
</tr>
|
13
|
-
</thead>
|
14
|
-
<tbody>
|
15
|
-
<tr ng-repeat="rowUid in master.attributes.rows">
|
16
|
-
<td ng-repeat="colUid in master.attributes.cols">
|
17
|
-
{{ master.attributes.rows_data[rowUid][colUid].searchable_text }}
|
18
|
-
</td>
|
19
|
-
</tr>
|
20
|
-
</tbody>
|
21
|
-
</table>
|
22
|
-
</div>
|
23
|
-
<div class="col-md-6">
|
24
|
-
<table class="table">
|
25
|
-
<thead>
|
26
|
-
<tr>
|
27
|
-
<th ng-repeat="colUid in master.attributes.cols track by $index">
|
28
|
-
<input type="text"
|
29
|
-
ng-model="component.attributes.cols_data[colUid].searchable_text"
|
30
|
-
class="form-control">
|
31
|
-
</th>
|
32
|
-
</tr>
|
33
|
-
</thead>
|
34
|
-
<tbody>
|
35
|
-
<tr ng-repeat="rowUid in master.attributes.rows">
|
36
|
-
<td ng-repeat="colUid in master.attributes.cols">
|
37
|
-
<input class="form-control"
|
38
|
-
ng-model="component.attributes.rows_data[rowUid][colUid].searchable_text"
|
39
|
-
type="text">
|
40
|
-
</td>
|
41
|
-
</tr>
|
42
|
-
</tbody>
|
43
|
-
</table>
|
44
|
-
</div>
|
45
|
-
</div>
|
46
3
|
</script>
|
@@ -1,14 +1,15 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
cells = component[:children]
|
3
|
+
rows = component.dig(:attributes, :structure, :value).map { |row|
|
4
|
+
row.map { |cellUid|
|
5
|
+
{
|
6
|
+
uid: cellUid,
|
7
|
+
text: cells.find { |cell| cell[:id] == cellUid }.dig(:attributes, :text, :value)
|
8
|
+
}
|
9
|
+
}
|
6
10
|
}
|
7
11
|
|
8
|
-
|
9
|
-
rowData = component[:attributes][:rows_data][rowUid.to_sym] || {}
|
10
|
-
{ uid: rowUid, data: rowData }
|
11
|
-
}
|
12
|
+
headerRow = rows.shift
|
12
13
|
%>
|
13
14
|
|
14
15
|
<div id="component-<%= component[:id] %>" class="<%= promethee_class_for(component) %>">
|
@@ -16,20 +17,16 @@
|
|
16
17
|
<table class="table">
|
17
18
|
<thead>
|
18
19
|
<tr>
|
19
|
-
<%
|
20
|
-
<th><%=
|
20
|
+
<% headerRow.each do |cell| %>
|
21
|
+
<th><%= cell[:text] %></th>
|
21
22
|
<% end %>
|
22
23
|
</tr>
|
23
24
|
</thead>
|
24
25
|
<tbody>
|
25
26
|
<% rows.each do |row| %>
|
26
27
|
<tr>
|
27
|
-
<%
|
28
|
-
|
29
|
-
cell = row[:data][col[:uid].to_sym]
|
30
|
-
next if cell.nil?
|
31
|
-
%>
|
32
|
-
<td><%= cell[:searchable_text] %></td>
|
28
|
+
<% row.each do |cell| %>
|
29
|
+
<td><%= cell[:text] %></td>
|
33
30
|
<% end %>
|
34
31
|
</tr>
|
35
32
|
<% end %>
|