promethee 1.6.14 → 1.6.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/promethee-edit.sass +11 -0
  3. data/app/assets/stylesheets/promethee-edit/_move.sass +0 -42
  4. data/app/assets/stylesheets/promethee.sass +10 -7
  5. data/app/controllers/promethee_controller.rb +2 -1
  6. data/app/models/concerns/promethee_data.rb +29 -0
  7. data/app/views/promethee/_edit.html.erb +2 -12
  8. data/app/views/promethee/_localize.html.erb +0 -11
  9. data/app/views/promethee/components/aside/_edit.define.html.erb +3 -3
  10. data/app/views/promethee/components/aside/_edit.inspect.html.erb +3 -3
  11. data/app/views/promethee/components/aside/_edit.move.html.erb +11 -8
  12. data/app/views/promethee/components/aside/_localize.html.erb +8 -10
  13. data/app/views/promethee/components/aside/_show.html.erb +7 -7
  14. data/app/views/promethee/components/collection/_edit.move.html.erb +0 -1
  15. data/app/views/promethee/components/column/_edit.move.html.erb +0 -8
  16. data/app/views/promethee/components/cover/_edit.define.html.erb +3 -3
  17. data/app/views/promethee/components/cover/_edit.inspect.html.erb +3 -3
  18. data/app/views/promethee/components/cover/_edit.move.html.erb +3 -4
  19. data/app/views/promethee/components/cover/_localize.html.erb +10 -13
  20. data/app/views/promethee/components/cover/_show.html.erb +9 -9
  21. data/app/views/promethee/components/image/_edit.define.html.erb +2 -2
  22. data/app/views/promethee/components/image/_edit.inspect.html.erb +5 -11
  23. data/app/views/promethee/components/image/_edit.move.html.erb +3 -2
  24. data/app/views/promethee/components/image/_localize.html.erb +7 -9
  25. data/app/views/promethee/components/image/_show.html.erb +5 -5
  26. data/app/views/promethee/components/page/_edit.define.html.erb +2 -2
  27. data/app/views/promethee/components/page/_edit.inspect.html.erb +9 -15
  28. data/app/views/promethee/components/page/_edit.move.html.erb +0 -4
  29. data/app/views/promethee/components/page/_localize.html.erb +5 -8
  30. data/app/views/promethee/components/row/_edit.define.html.erb +2 -9
  31. data/app/views/promethee/components/row/_edit.inspect.html.erb +37 -15
  32. data/app/views/promethee/components/row/_edit.move.html.erb +7 -3
  33. data/app/views/promethee/components/row/_localize.html.erb +0 -1
  34. data/app/views/promethee/components/row/_show.html.erb +23 -1
  35. data/app/views/promethee/components/slider/_edit.define.html.erb +0 -3
  36. data/app/views/promethee/components/slider/_edit.inspect.html.erb +11 -51
  37. data/app/views/promethee/components/slider/_edit.move.html.erb +0 -14
  38. data/app/views/promethee/components/slider/_show.html.erb +4 -5
  39. data/app/views/promethee/components/slider_item/_edit.define.html.erb +18 -0
  40. data/app/views/promethee/components/slider_item/_edit.inspect.html.erb +52 -0
  41. data/app/views/promethee/components/slider_item/_edit.move.html.erb +14 -0
  42. data/app/views/promethee/components/slider_item/_icon.svg +3 -0
  43. data/app/views/promethee/components/slider_item/_localize.html.erb +15 -0
  44. data/app/views/promethee/components/slider_item/_show.html.erb +5 -0
  45. data/app/views/promethee/components/text/_edit.define.html.erb +1 -1
  46. data/app/views/promethee/components/text/_edit.inspect.html.erb +3 -3
  47. data/app/views/promethee/components/text/_edit.move.html.erb +1 -2
  48. data/app/views/promethee/components/text/_localize.html.erb +3 -5
  49. data/app/views/promethee/components/text/_show.html.erb +2 -2
  50. data/app/views/promethee/components/video/_edit.inspect.html.erb +4 -2
  51. data/app/views/promethee/components/video/_edit.move.html.erb +6 -1
  52. data/app/views/promethee/components/video/_localize.html.erb +0 -1
  53. data/app/views/promethee/edit/_inspect.advanced.html.erb +7 -0
  54. data/app/views/promethee/edit/_move.html.erb +3 -15
  55. data/app/views/promethee/edit/_radiobuttons.html.erb +8 -0
  56. data/app/views/promethee/templates/_uploader.html.erb +7 -3
  57. data/lib/promethee/rails/version.rb +1 -1
  58. metadata +9 -1
@@ -4,21 +4,21 @@ if image_data && image_data[:id]
4
4
  blob = ActiveStorage::Blob.find image_data[:id]
5
5
  end
6
6
 
7
- surtitle = component[:attributes][:surtitle].to_s
8
- title = component[:attributes][:title].to_s
9
- subtitle = component[:attributes][:subtitle].to_s
7
+ searchable_surtitle = component[:attributes][:searchable_surtitle].to_s
8
+ searchable_title = component[:attributes][:searchable_title].to_s
9
+ searchable_subtitle = component[:attributes][:searchable_subtitle].to_s
10
10
  %>
11
11
  <div id="component-<%= image_data[:id] %>" class="<%= promethee_class_for(component) %>" style="background-image: url(<%= url_for(blob.variant(resize: '1920')) if blob %>)">
12
- <% if surtitle.present? %>
13
- <p><%= surtitle %></p>
12
+ <% if searchable_surtitle.present? %>
13
+ <p><%= searchable_surtitle %></p>
14
14
  <% end %>
15
15
 
16
- <% if title.present? %>
17
- <h1><%= title %></h1>
16
+ <% if searchable_title.present? %>
17
+ <h1><%= searchable_title %></h1>
18
18
  <% end %>
19
19
 
20
- <% if subtitle.present? %>
21
- <p><%= subtitle %></p>
20
+ <% if searchable_subtitle.present? %>
21
+ <p><%= searchable_subtitle %></p>
22
22
  <% end %>
23
23
 
24
24
  </div>
@@ -12,8 +12,8 @@
12
12
  id: undefined,
13
13
  name: ''
14
14
  },
15
- alt: '',
16
- caption: ''
15
+ searchable_alt: '',
16
+ searchable_caption: ''
17
17
  }
18
18
  }
19
19
  })
@@ -4,19 +4,13 @@
4
4
 
5
5
  <div class="form-group">
6
6
  <label class="label-control">Caption</label>
7
- <input class="form-control" ng-model="promethee.inspected.attributes.caption">
7
+ <input class="form-control" ng-model="promethee.inspected.attributes.searchable_caption">
8
8
  </div>
9
9
 
10
- <div class="panel panel-default" ng-init="advancedConfigurationOpen = false">
11
- <div class="panel-heading" ng-click="advancedConfigurationOpen = !advancedConfigurationOpen">
12
- Advanced configuration
13
- <%= fa_icon 'angle-down', class: 'fa-pull-right', 'ng-class': "{'fa-rotate-180': advancedConfigurationOpen}", style: 'font-size: 18px' %>
14
- </div>
15
- <div class="panel-body" ng-show="advancedConfigurationOpen">
16
- <div class="form-group">
17
- <label class="label-control">Alt</label>
18
- <input class="form-control" ng-model="promethee.inspected.attributes.alt">
19
- </div>
10
+ <%= render 'promethee/edit/inspect.advanced' %>
11
+ <div class="form-group">
12
+ <label class="label-control">Alt</label>
13
+ <input class="form-control" ng-model="promethee.inspected.attributes.searchable_alt">
20
14
  </div>
21
15
  </div>
22
16
  </script>
@@ -3,13 +3,14 @@
3
3
  <figure ng-show="component.attributes.image.id">
4
4
  <img ng-src="/promethee/blob/{{component.attributes.image.id}}"
5
5
  class="img-responsive">
6
- <figcaption ng-show="component.attributes.caption">{{component.attributes.caption}}</figcaption>
6
+ <figcaption ng-show="component.attributes.searchable_caption">
7
+ {{component.attributes.searchable_caption}}
8
+ </figcaption>
7
9
  </figure>
8
10
  <div ng-hide="component.attributes.image.id">
9
11
  <p ng-hide="editing"
10
12
  class="text-center text-empty">Click to set the image</p>
11
13
  </div>
12
- <pre class="hidden">{{component.attributes.search = (component.attributes.caption + ' ' + component.attributes.alt)}}</pre>
13
14
  </div>
14
15
  </div>
15
16
  </script>
@@ -1,5 +1,5 @@
1
1
  <script type="text/ng-template" id="promethee/components/image/localize">
2
- <div ng-show="component.master.attributes.alt || component.master.attributes.caption">
2
+ <div ng-show="component.master.attributes.searchable_alt || component.master.attributes.searchable_caption">
3
3
  <hr>
4
4
 
5
5
  <div class="row">
@@ -8,32 +8,30 @@
8
8
  </div>
9
9
  </div>
10
10
 
11
- <div class="row" ng-show="component.master.attributes.alt">
11
+ <div class="row" ng-show="component.master.attributes.searchable_alt">
12
12
  <div class="col-md-6">
13
13
  <b>Alt</b>
14
- <p>{{component.master.attributes.alt}}</p>
14
+ <p>{{component.master.attributes.searchable_alt}}</p>
15
15
  </div>
16
16
  <div class="col-md-6">
17
17
  <div class="form-group">
18
18
  <label class="label-control">Alt</label>
19
- <input class="form-control" ng-model="component.attributes.alt" type="text">
19
+ <input class="form-control" ng-model="component.attributes.searchable_alt" type="text">
20
20
  </div>
21
21
  </div>
22
22
  </div>
23
23
 
24
- <div class="row" ng-show="component.master.attributes.caption">
24
+ <div class="row" ng-show="component.master.attributes.searchable_caption">
25
25
  <div class="col-md-6">
26
26
  <b>Caption</b>
27
- <p>{{component.master.attributes.caption}}</p>
27
+ <p>{{component.master.attributes.searchable_caption}}</p>
28
28
  </div>
29
29
  <div class="col-md-6">
30
30
  <div class="form-group">
31
31
  <label class="label-control">Caption</label>
32
- <input class="form-control" ng-model="component.attributes.caption" type="text">
32
+ <input class="form-control" ng-model="component.attributes.searchable_caption" type="text">
33
33
  </div>
34
34
  </div>
35
35
  </div>
36
36
  </div>
37
-
38
- <pre class="hidden">{{component.attributes.search = (component.attributes.caption + ' ' + component.attributes.alt)}}</pre>
39
37
  </script>
@@ -4,14 +4,14 @@ if image_data && image_data[:id]
4
4
  blob = ActiveStorage::Blob.find image_data[:id]
5
5
  end
6
6
 
7
- alt = component[:attributes][:alt]
8
- caption = component[:attributes][:caption].to_s
7
+ searchable_alt = component[:attributes][:searchable_alt].to_s
8
+ searchable_caption = component[:attributes][:searchable_caption].to_s
9
9
  %>
10
10
  <figure class="<%= promethee_class_for component %>">
11
- <%= image_tag url_for(blob.variant(resize: '1920')), class: 'img-responsive', alt: alt if blob %>
12
- <% unless caption.blank? %>
11
+ <%= image_tag url_for(blob.variant(resize: '1920')), class: 'img-responsive', alt: searchable_alt if blob %>
12
+ <% unless searchable_caption.blank? %>
13
13
  <figcaption>
14
- <%= caption %>
14
+ <%= searchable_caption %>
15
15
  </figcaption>
16
16
  <% end %>
17
17
  </figure>
@@ -8,8 +8,8 @@
8
8
  data: {
9
9
  type: 'page',
10
10
  attributes: {
11
- title: 'New page',
12
- description: '',
11
+ searchable_title: 'New page',
12
+ searchable_description: '',
13
13
  stylesheets: '',
14
14
  javascripts: ''
15
15
  },
@@ -1,29 +1,23 @@
1
1
  <script type="text/ng-template" id="promethee/components/page/edit/inspect">
2
2
  <div class="form-group">
3
3
  <label class="label-control">Title</label>
4
- <input class="form-control" ng-model="promethee.inspected.attributes.title">
4
+ <input class="form-control" ng-model="promethee.inspected.attributes.searchable_title">
5
5
  </div>
6
6
 
7
7
  <div class="form-group">
8
8
  <label class="label-control">Description</label>
9
- <textarea class="form-control" ng-model="promethee.inspected.attributes.description"></textarea>
9
+ <textarea class="form-control" ng-model="promethee.inspected.attributes.searchable_description"></textarea>
10
10
  </div>
11
11
 
12
- <div class="panel panel-default" ng-init="advancedConfigurationOpen = false">
13
- <div class="panel-heading" ng-click="advancedConfigurationOpen = !advancedConfigurationOpen">
14
- Advanced configuration
15
- <%= fa_icon 'angle-down', class: 'fa-pull-right', 'ng-class': "{'fa-rotate-180': advancedConfigurationOpen}", style: 'font-size: 18px' %>
12
+ <%= render 'promethee/edit/inspect.advanced' %>
13
+ <div class="form-group">
14
+ <label class="label-control">Stylesheets</label>
15
+ <textarea class="form-control" ng-model="promethee.inspected.attributes.stylesheets"></textarea>
16
16
  </div>
17
- <div class="panel-body" ng-show="advancedConfigurationOpen">
18
- <div class="form-group">
19
- <label class="label-control">Stylesheets</label>
20
- <textarea class="form-control" ng-model="promethee.inspected.attributes.stylesheets"></textarea>
21
- </div>
22
17
 
23
- <div class="form-group">
24
- <label class="label-control">Javascripts</label>
25
- <textarea class="form-control" ng-model="promethee.inspected.attributes.javascripts"></textarea>
26
- </div>
18
+ <div class="form-group">
19
+ <label class="label-control">Javascripts</label>
20
+ <textarea class="form-control" ng-model="promethee.inspected.attributes.javascripts"></textarea>
27
21
  </div>
28
22
  </div>
29
23
  </script>
@@ -4,7 +4,6 @@
4
4
  class="<%= promethee_bem_classes 'promethee-edit__component', "--page" %>">
5
5
  <div class="promethee-edit__component__inner">
6
6
  <div class="header">Page</div>
7
-
8
7
  <div class="promethee-edit__move__columns">
9
8
  <div class="row">
10
9
  <% 12.times do %>
@@ -12,9 +11,6 @@
12
11
  <% end %>
13
12
  </div>
14
13
  </div>
15
-
16
- <pre class="hidden">{{component.attributes.search = concatenateChildrenSearch(component)}}</pre>
17
-
18
14
  <ng-include src="'promethee/move/components'"></ng-include>
19
15
  </div>
20
16
  </div>
@@ -4,31 +4,28 @@
4
4
  <div class="row">
5
5
  <div class="col-md-6">
6
6
  <b>Page title</b>
7
- <p>{{component.master.attributes.title}}</p><br>
7
+ <p>{{component.master.attributes.searchable_title}}</p><br>
8
8
  </div>
9
9
  <div class="col-md-6">
10
10
  <div class="form-group">
11
11
  <label class="label-control">Page title</label>
12
- <input class="form-control" ng-model="component.attributes.title" type="text">
12
+ <input class="form-control" ng-model="component.attributes.searchable_title" type="text">
13
13
  </div>
14
14
  </div>
15
15
  </div>
16
16
 
17
- <div class="row" ng-show="component.master.attributes.description">
17
+ <div class="row" ng-show="component.master.attributes.searchable_description">
18
18
  <div class="col-md-6">
19
19
  <div>
20
20
  <b>Page description</b>
21
- <p>{{component.master.attributes.description}}</p>
21
+ <p>{{component.master.attributes.searchable_description}}</p>
22
22
  </div>
23
23
  </div>
24
24
  <div class="col-md-6">
25
25
  <div class="form-group">
26
26
  <label class="label-control">Page description</label>
27
- <textarea class="form-control" ng-model="component.attributes.description"></textarea>
27
+ <textarea class="form-control" ng-model="component.attributes.searchable_description"></textarea>
28
28
  </div>
29
29
  </div>
30
30
  </div>
31
-
32
- <pre class="hidden">{{component.attributes.search = concatenateSearch()}}</pre>
33
-
34
31
  </script>
@@ -8,15 +8,8 @@
8
8
  data: {
9
9
  type: 'row',
10
10
  attributes: {
11
- bgcolor: "transparent",
12
- bgimage1: {
13
- id: undefined,
14
- name: ''
15
- },
16
- bgimage2: {
17
- id: undefined,
18
- name: ''
19
- },
11
+ bgcolor: "rgba(255,255,255,0)",
12
+ backgrounds: []
20
13
  },
21
14
  children: []
22
15
  }
@@ -1,24 +1,46 @@
1
1
  <script type="text/ng-template" id="promethee/components/row/edit/inspect">
2
2
  <div class="form-group">
3
- <div class="btn btn-default" ng-click="addComponentByType('column', promethee.inspected.children)">Add column</div>
4
- <ul class="list-unstyled">
5
- <li ng-repeat="column in promethee.inspected.children">Column {{$index + 1}}</li>
6
- </ul>
3
+ <div class="btn btn-default"
4
+ ng-click="addComponentByType('column', promethee.inspected.children)">
5
+ Add column
6
+ </div>
7
+ <div ng-show="promethee.inspected.children.length > 1">
8
+ <br><br>
9
+ <label class="label-control">Drag the columns below to reorder them:</label>
10
+ <ul ui-sortable
11
+ ng-model="promethee.inspected.children"
12
+ class="list-unstyled">
13
+ <li ng-repeat="column in promethee.inspected.children">
14
+ <%= fa_icon :bars %> Column {{$index + 1}}
15
+ </li>
16
+ </ul>
17
+ </div>
7
18
  </div>
8
19
 
9
- <div class="panel panel-default" ng-init="advancedConfigurationOpen = false">
10
- <div class="panel-heading" ng-click="advancedConfigurationOpen = !advancedConfigurationOpen">
11
- Advanced configuration
12
- <%= fa_icon 'angle-down', class: 'fa-pull-right', 'ng-class': "{'fa-rotate-180': advancedConfigurationOpen}", style: 'font-size: 18px' %>
20
+ <%= render 'promethee/edit/inspect.advanced' %>
21
+ <div class="form-group">
22
+ <label class="label-control">Background color</label>
23
+ <input ng-model="promethee.inspected.attributes.bgcolor"
24
+ colorpicker="rgba"
25
+ class="form-control"
26
+ type="text" />
13
27
  </div>
14
- <div class="panel-body" ng-show="advancedConfigurationOpen">
15
- <div class="form-group">
16
- <label class="label-control">Background color</label>
17
- <input ng-model="promethee.inspected.attributes.bgcolor" colorpicker="rgba" class="form-control" type="text" />
18
- </div>
19
28
 
20
- <promethee-uploader ng-model="promethee.inspected.attributes.bgimage1" label="Background Image 1" limits="'.jpg,.jpeg,.png,.gif'"></promethee-uploader>
21
- <promethee-uploader ng-model="promethee.inspected.attributes.bgimage2" label="Background Image 2" limits="'.jpg,.jpeg,.png,.gif'"></promethee-uploader>
29
+ <div>
30
+ <div class="btn btn-default" ng-click="promethee.inspected.attributes.backgrounds.push( { image: { id: undefined, name: '' }, posh: 'center', posv: 'center', size: 'auto' } )">Add background image</div>
31
+
32
+ <div ng-repeat="background in promethee.inspected.attributes.backgrounds" style="margin-top: 20px">
33
+ <h3>Background {{$index + 1}} <span class="fa fa-trash" ng-click="promethee.inspected.attributes.backgrounds.splice($index, 1)" style="cursor: pointer"></span></h3>
34
+ <promethee-uploader ng-model="background.image" label="" limits="'.jpg,.jpeg,.png,.gif'"></promethee-uploader>
35
+
36
+ <%= render 'promethee/edit/radiobuttons', label: 'Horizontal position', attribute: 'posh', values: ['left', 'center', 'right'] %>
37
+ <%= render 'promethee/edit/radiobuttons', label: 'Vertical position', attribute: 'posv', values: ['top', 'center', 'bottom'] %>
38
+ <%= render 'promethee/edit/radiobuttons', label: 'Size', attribute: 'size', values: ['auto', 'cover', 'contain'] %>
39
+ </div>
22
40
 
23
41
  </div>
42
+
43
+
44
+
45
+ </div>
24
46
  </script>
@@ -1,9 +1,13 @@
1
1
  <script type="text/ng-template" id="promethee/components/row/edit/move">
2
2
  <%= render 'promethee/edit/move.header', type: 'row' %>
3
3
  <div class="header">Row</div>
4
- <div class="row" style="background-image:url('{{ component.attributes.blob.id ? '/promethee/blob/' + component.attributes.blob.id : '' }}')">
5
- <ng-include src="'promethee/move/components'"></ng-include>
6
- <pre class="hidden">{{component.attributes.search = concatenateChildrenSearch(component)}}</pre>
4
+ <div class="row">
5
+ <div ng-init="components = component.children">
6
+ <div ng-repeat="component in components"
7
+ class="<%= promethee_bem_classes 'promethee-edit__move__draggable', '--{{component.type}}' %>">
8
+ <ng-include src="'promethee/move/component'"></ng-include>
9
+ </div>
10
+ </div>
7
11
  </div>
8
12
  </div>
9
13
  </div>
@@ -1,3 +1,2 @@
1
1
  <script type="text/ng-template" id="promethee/components/row/localize">
2
-
3
2
  </script>
@@ -1,3 +1,25 @@
1
- <div class="row <%= promethee_class_for component %>">
1
+ <%
2
+ background_color = component[:attributes][:bgcolor]
3
+ background_images = []
4
+ background_positions = []
5
+ background_sizes = []
6
+
7
+ if component[:attributes].has_key?(:backgrounds) # retro-compatibility
8
+ component[:attributes][:backgrounds].each do |item|
9
+ image_data = item[:image]
10
+ if image_data && image_data[:id]
11
+ blob_id = image_data[:id]
12
+ blob = ActiveStorage::Blob.find blob_id
13
+ url = "url(#{url_for(blob)})"
14
+ position = "#{item[:posh]} #{item[:posv]}"
15
+ background_images << url
16
+ background_positions << position
17
+ background_sizes << item[:size]
18
+ end
19
+ end
20
+ end
21
+ %>
22
+
23
+ <div class="row <%= promethee_class_for component %>" style="background-color: <%= background_color %>; <%= background_images.count > 0 ? "background-repeat: no-repeat; background-image: #{background_images.join(', ')}; background-position: #{background_positions.join(', ')}; background-size: #{background_sizes.join(', ')};" : '' %>">
2
24
  <%= render 'promethee/show/components', components: component[:children] %>
3
25
  </div>
@@ -7,9 +7,6 @@
7
7
  library: true,
8
8
  data: {
9
9
  type: 'slider',
10
- attributes: {
11
- contents: {}
12
- },
13
10
  children: []
14
11
  }
15
12
  })
@@ -1,54 +1,14 @@
1
1
  <script type="text/ng-template" id="promethee/components/slider/edit/inspect">
2
- <div ui-sortable="{handle: '.handle'}" ng-model="promethee.inspected.children">
3
- <div
4
- class="panel panel-default"
5
- ng-repeat="component in promethee.inspected.children"
6
- >
7
- <div class="panel-body">
8
- <div class="row handle">
9
- <div class="col-xs-9">
10
- <span class="label label-default">#{{$index + 1}}</span>
11
- <span class="label label-info">{{component.type}}</span>
12
- </div>
13
- <div class="col-xs-3">
14
- <ng-include src="'promethee/move/component'"></ng-include>
15
- </div>
16
- </div>
17
-
18
- <div class="row">
19
- <div class="col-xs-12">
20
- <div class="form-group">
21
- <label class="label-control">Text</label>
22
- <summernote config="summernoteConfig" ng-model="promethee.inspected.attributes.contents['content-' + component.id]"></summernote>
23
- </div>
24
- </div>
25
- </div>
26
- </div>
2
+ <div class="form-group">
3
+ <div class="btn btn-default" ng-click="addComponentByType('slider_item', promethee.inspected.children)">Add item</div>
4
+ <div ng-show="promethee.inspected.children.length > 1">
5
+ <br><br>
6
+ <label class="label-control">Drag the items below to reorder them:</label>
7
+ <ul ui-sortable ng-model="promethee.inspected.children" class="list-unstyled">
8
+ <li ng-repeat="item in promethee.inspected.children">
9
+ <%= fa_icon :bars %> Item {{$index + 1}}
10
+ </li>
11
+ </ul>
27
12
  </div>
28
13
  </div>
29
-
30
- <div class="pull-right btn-toolbar" ng-controller="SliderInspectorController">
31
- <span ng-repeat="definition in itemDefinitions" class="btn btn-default" ng-click="addItem(definition)">Add {{definition.name}}</span>
32
- </div>
33
- </script>
34
-
35
- <script>
36
- promethee.controller('SliderInspectorController', ['$scope', function($scope) {
37
- var availableComponents = ['image', 'video'];
38
-
39
- $scope.itemDefinitions = $scope.promethee.definitions.filter(function(definition) {
40
- return availableComponents.includes(definition.data.type);
41
- });
42
-
43
- var clone = function(object) {
44
- return JSON.parse(JSON.stringify(object));
45
- };
46
-
47
- $scope.addItem = function(definition) {
48
- var item = JSON.parse(JSON.stringify(definition.data));
49
- item.id = $scope.generateIdentifier();
50
-
51
- $scope.promethee.inspected.children.push(item);
52
- }
53
- }])
54
- </script>
14
+ </script>