infopark_cloud_connector 6.9.5 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +8 -8
  2. data/app/controllers/rails_connector/default_cms_controller.rb +0 -1
  3. data/app/controllers/rails_connector/objs_controller.rb +31 -27
  4. data/app/helpers/rails_connector/cms_tag_helper.rb +20 -12
  5. data/app/views/rails_connector/objs/show_widget.html.erb +1 -0
  6. data/config/ca-bundle.crt +1 -1
  7. data/config/locales/de.rails_connector.views.yml +0 -3
  8. data/config/locales/en.rails_connector.views.yml +0 -3
  9. data/config/routes.rb +2 -1
  10. data/lib/assets/fonts/infopark_icons-webfont.eot +0 -0
  11. data/lib/assets/fonts/infopark_icons-webfont.ttf +0 -0
  12. data/lib/assets/fonts/infopark_icons-webfont.woff +0 -0
  13. data/lib/assets/javascripts/infopark_editing.js +84 -35
  14. data/lib/assets/stylesheets/infopark_editing.css +227 -33
  15. data/lib/generators/cms/migration/migration_generator.rb +1 -1
  16. data/lib/generators/cms/migration/templates/{migration.rb → migration.erb} +0 -0
  17. data/lib/rails_connector/attribute_content.rb +39 -40
  18. data/lib/rails_connector/basic_obj.rb +64 -56
  19. data/lib/rails_connector/basic_widget.rb +2 -0
  20. data/lib/rails_connector/cms_accessible.rb +0 -17
  21. data/lib/rails_connector/cms_backend.rb +2 -2
  22. data/lib/rails_connector/cms_env.rb +0 -5
  23. data/lib/rails_connector/cms_rest_api.rb +62 -30
  24. data/lib/rails_connector/configuration.rb +3 -3
  25. data/lib/rails_connector/connection_manager.rb +98 -0
  26. data/lib/rails_connector/content_service.rb +12 -94
  27. data/lib/rails_connector/content_state_caching.rb +3 -5
  28. data/lib/rails_connector/deprecation.rb +21 -0
  29. data/lib/rails_connector/link.rb +12 -22
  30. data/lib/rails_connector/migrations/cms_backend.rb +1 -1
  31. data/lib/rails_connector/migrations/migration.rb +1 -1
  32. data/lib/rails_connector/migrations/migration_dsl.rb +10 -101
  33. data/lib/rails_connector/named_link.rb +1 -1
  34. data/lib/rails_connector/obj_search_enumerator.rb +37 -49
  35. metadata +6 -5
  36. data/app/views/errors/410_gone.html.erb +0 -7
  37. data/app/views/rails_connector/objs/show.html.erb +0 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjQxZDQ1MTE2NzI2YjU3MTQ3Zjg0MDY0MWFjZDEyZTE4Y2Q0MzQzMg==
4
+ Njg3ODYzOWQxMmFhNzRjNTAyNmYzNWFlMGRkMmIyZDc0NjBlNmY3NQ==
5
5
  data.tar.gz: !binary |-
6
- YmNmZjYwMGZiYWRmZjRmODEzNGZlNGEwMWY4YmVlOTIyOTBiOTZjNA==
6
+ YWU2ZTYxNzZlMTkyYjI2OTEzZWJlMmY2NzIwODA1ZTczOGM5N2NjMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Mzk1OGU2Y2FjNmY0Mzc4ZDA5MmFhOTVkZDI4ZWQ0ZjA2YjI0NmEyNjYzZDMw
10
- MDRiNzIwNDNjMzhkZjI4MDJjNTliNDI0NDg5ZDM3NzllOTBiNDcwZjg3NjQy
11
- ODI5NGNhZjNhMzQ0MzgzNTE3MDVjMGRlMzg3NzUwMDM2MDU2MDU=
9
+ NDBhZTc0Y2M1NzRmYjg2ODg4NDRhZDBjZWZhYjRmYTUzNWJiOTEyZjFkNzUy
10
+ Nzg5MDdmZmNkYzBkMTYxZGJlODEyYTIwMDk5YmE2NTFiNjVhZjIwNjBjMTU0
11
+ NDk4M2NhMzI3MDQ1M2RhMzRhOWZhNGYxMDBiMjQzZGNkMmRiMWM=
12
12
  data.tar.gz: !binary |-
13
- ZmNiYjYyMTkzY2M3NzkzYTcwM2NlODk0YjRlNDExZDQ2MzM2ZTA0ZDc3M2U2
14
- YmRlM2EyNTUzNzlmMGJlOTg4YzA2NjhjOGNhNzFiOWNlMDhhMzEyNDVjNDg5
15
- N2QyNWI0MjhmZDU2OTFhZWZkMTkzOGZlYzA4NmNjOGMzMjFkNTc=
13
+ MWE0ODA5Mzk3ZjliOGMwNTBiNDk5NjA1YThjODliNDA1NjVmOGIwYWI0Yzc2
14
+ ZDUyOGMyY2UxMDM2ZTUxM2QxNTNiNmMzMTZhZmRlZDc2Y2ZiN2ZmNzQ2NDQ5
15
+ Y2VhYzk5ZGJmZmVkMzVkZGUzYmYzN2Y0ZWQyNGUxMDg0OTViMTM=
@@ -8,7 +8,6 @@ module RailsConnector
8
8
  class DefaultCmsController < ApplicationController
9
9
  include CmsAccessible
10
10
  before_filter :load_object
11
- before_filter :ensure_object_is_active
12
11
  before_filter :ensure_object_is_permitted
13
12
  before_filter :set_google_expire_header
14
13
 
@@ -1,16 +1,12 @@
1
1
  module RailsConnector
2
2
 
3
3
  class ObjsController < WebserviceController
4
- before_filter :load_object, only: [:show, :edit, :update, :destroy, :widget_class_selection,
5
- :create_widget, :edit_widget]
6
-
7
- def show
8
- render json: {markup: render_to_string(layout: false)}
9
- end
4
+ before_filter :load_object, only: [:edit, :update, :destroy,
5
+ :show_widget, :widget_class_selection, :create_widget, :edit_widget]
10
6
 
11
7
  def create
12
- created_obj = CmsRestApi.task_unaware_request(:post,
13
- "revisions/#{Workspace.current.revision_id}/objs",
8
+ created_obj = task_unaware_request(:post,
9
+ "workspaces/#{Workspace.current.id}/objs",
14
10
  {obj: obj_params}
15
11
  )
16
12
  render json: created_obj
@@ -21,8 +17,8 @@ module RailsConnector
21
17
  end
22
18
 
23
19
  def update
24
- changed_obj = CmsRestApi.task_unaware_request(:put,
25
- "revisions/#{Workspace.current.revision_id}/objs/#{params[:id]}",
20
+ changed_obj = task_unaware_request(:put,
21
+ "workspaces/#{Workspace.current.id}/objs/#{params[:id]}",
26
22
  {obj: obj_params}
27
23
  )
28
24
  render json: changed_obj
@@ -58,6 +54,12 @@ module RailsConnector
58
54
  render json: page_class_names.compact
59
55
  end
60
56
 
57
+ def show_widget
58
+ @widget = @obj.widget_from_pool(params[:widget_id])
59
+
60
+ render json: {markup: render_to_string(layout: false)}
61
+ end
62
+
61
63
  def widget_class_selection
62
64
  valid_widget_classes = @obj.valid_widget_classes_for(params[:field_name]) || all_widget_classes
63
65
  valid_widget_classes.map!(&:to_s)
@@ -71,23 +73,25 @@ module RailsConnector
71
73
  end
72
74
 
73
75
  def create_widget
74
- widget = CmsRestApi.task_unaware_request(:post,
75
- "revisions/#{Workspace.current.revision_id}/objs", {
76
- obj: {
77
- _path: "/_widgets/#{@obj.id}/#{SecureRandom.hex}",
78
- _obj_class: params[:obj_class],
79
- },
80
- }
81
- )
76
+ widget_pool_id = BasicObj.generate_widget_pool_id
77
+
78
+ task_unaware_request(:put, "workspaces/#{Workspace.current.id}/objs/#{params[:id]}",
79
+ {obj: {_widget_pool: {widget_pool_id => {_obj_class: params[:obj_class]}}}})
80
+
81
+ Workspace.current = Workspace.find(Workspace.current.id)
82
+ @obj.reload
82
83
 
83
- @widget = Obj.find(widget['id'])
84
+ @widget = @obj.widget_from_pool(widget_pool_id)
84
85
 
85
86
  render json: {markup: render_to_string(layout: false)}
86
87
  end
87
88
 
88
89
  def edit_widget
89
- markup = WidgetRenderer.new(request).
90
- process(:edit, @obj, current_page, params[:field_name], @obj.widget_container)
90
+ @widget = @obj.widget_from_pool(params[:widget_id])
91
+
92
+ markup = WidgetRenderer.new(request)
93
+ .process(:edit, @widget, current_page, params[:field_name], @obj)
94
+
91
95
  render json: {markup: markup}
92
96
  end
93
97
 
@@ -120,13 +124,11 @@ module RailsConnector
120
124
 
121
125
  copied_attributes['_path'] = "#{target_path}/#{SecureRandom.hex(6)}"
122
126
 
123
- CmsRestApi.task_unaware_request(
124
- :post, "revisions/#{Workspace.current.revision_id}/objs", obj: copied_attributes)
127
+ task_unaware_request(:post, "workspaces/#{Workspace.current.id}/objs", obj: copied_attributes)
125
128
  end
126
129
 
127
130
  def get_obj_attributes(id)
128
- CmsRestApi.task_unaware_request(
129
- :get, "revisions/#{Workspace.current.revision_id}/objs/#{id}")
131
+ task_unaware_request(:get, "workspaces/#{Workspace.current.id}/objs/#{id}")
130
132
  end
131
133
 
132
134
  def parent_path(path)
@@ -139,14 +141,16 @@ module RailsConnector
139
141
  helper_method :current_page
140
142
 
141
143
  def all_page_classes
142
- page_classes = CmsRestApi.task_unaware_request(:get,
143
- "revisions/#{Workspace.current.revision_id}/obj_classes")['results']
144
+ page_classes = task_unaware_request(:get,
145
+ "workspaces/#{Workspace.current.id}/obj_classes")['results']
144
146
  page_classes.map { |page_class| page_class['name'] }.sort
145
147
  end
146
148
 
147
149
  def all_widget_classes
148
150
  Dir[Rails.root + 'app/widgets/*'].map { |path| File.basename(path).camelize }.sort
149
151
  end
152
+
153
+ delegate :task_unaware_request, to: CmsRestApi
150
154
  end
151
155
 
152
156
  end
@@ -38,33 +38,41 @@ module RailsConnector
38
38
  # <% end %>
39
39
  #
40
40
  # @api public
41
- def cms_tag(tag_name, obj, field_name, options = {}, &block)
41
+ def cms_tag(tag_name, obj_or_widget, field_name, options = {}, &block)
42
42
  begin
43
- field_type = obj.type_of_attribute(field_name.to_s)
43
+ field_type = obj_or_widget.type_of_attribute(field_name.to_s)
44
44
  rescue RailsConnectorError => e
45
45
  return content_tag(tag_name, '', options)
46
46
  end
47
47
 
48
- options = options.merge({
49
- 'data-ip-private-field-id' => obj.id,
50
- 'data-ip-field-obj-class' => obj.obj_class,
51
- 'data-ip-field-name' => field_name,
52
- 'data-ip-field-type' => field_type,
53
- }) if inplace_editing_allowed?
48
+ if inplace_editing_allowed?
49
+ options = options.merge({
50
+ 'data-ip-field-name' => field_name,
51
+ 'data-ip-field-obj-class' => obj_or_widget.obj_class,
52
+ 'data-ip-field-type' => field_type,
53
+ })
54
+
55
+ if obj_or_widget.kind_of?(BasicWidget)
56
+ options['data-ip-private-field-id'] = obj_or_widget.obj.id
57
+ options['data-ip-private-field-widget-id'] = obj_or_widget.id
58
+ else
59
+ options['data-ip-private-field-id'] = obj_or_widget.id
60
+ end
61
+ end
54
62
 
55
63
  if field_type == 'widget'
56
- rendered_widgets = obj.widgets(field_name).map do |widget|
57
- render_widget(widget, obj, field_name, obj)
64
+ rendered_widgets = obj_or_widget.widgets(field_name).map do |widget|
65
+ render_widget(widget, obj_or_widget, field_name, obj_or_widget)
58
66
  end
59
67
  inner_html = safe_join(rendered_widgets)
60
68
  else
61
69
  if inplace_editing_allowed? && FIELD_TYPES_WITH_ORIGINAL_CONTENT.include?(field_type)
62
- original_value = display_original_value(obj[field_name])
70
+ original_value = display_original_value(obj_or_widget[field_name])
63
71
  original_content = cms_tag_original_content(field_type, original_value)
64
72
  options['data-ip-private-field-original-content'] = MultiJson.encode(original_content)
65
73
  end
66
74
 
67
- inner_html = block_given? ? capture { yield } : display_value(obj[field_name])
75
+ inner_html = block_given? ? capture { yield } : display_value(obj_or_widget[field_name])
68
76
  end
69
77
 
70
78
  if VOID_TAGS.include?(tag_name.to_s)
@@ -0,0 +1 @@
1
+ <%= render_widget(@widget, current_page, params[:field_name], @obj) %>
data/config/ca-bundle.crt CHANGED
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  ## /Network/Servers/xs2.infopark/Users/develop/dcc/tmp/Rails_Connector__Kris__dev__93/repos/cloud_connector/config/ca-bundle.crt -- Bundle of CA Root Certificates
3
3
  ##
4
- ## Converted at: Thu Oct 24 14:57:22 2013 UTC
4
+ ## Converted at: Mon Nov 11 13:18:12 2013 UTC
5
5
  ##
6
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
@@ -4,6 +4,3 @@ de:
4
4
  errors:
5
5
  forbidden:
6
6
  no_permissions: "Sie haben nicht die notwendigen Zugriffsrechte"
7
- gone:
8
- not_released_anymore: "Die Datei war nur bis zum %{valid_until} veröffentlicht."
9
- not_yet_released: "Die Datei wird erst am %{valid_from} veröffentlicht."
@@ -4,6 +4,3 @@ en:
4
4
  errors:
5
5
  forbidden:
6
6
  no_permissions: "You don't have the required permissions"
7
- gone:
8
- not_released_anymore: "The file was released only until %{valid_until}"
9
- not_yet_released: "The file will be released on %{valid_from}"
data/config/routes.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  Rails.application.routes.draw do
2
2
  resources :objs, controller: 'rails_connector/objs', path: '__ipcms/objs',
3
- only: [:show, :edit, :create, :update, :destroy] do
3
+ only: [:edit, :create, :update, :destroy] do
4
4
  get :page_class_selection, on: :collection
5
5
 
6
6
  member do
7
+ get :show_widget
7
8
  get :widget_class_selection
8
9
  post :create_widget
9
10
  get :edit_widget
@@ -7247,7 +7247,7 @@ $.i18n().load({
7247
7247
  'menu_bar.create_new_ws_confirmation_desc': 'Bitte geben Sie den Titel der neuen Arbeitskopie ein.',
7248
7248
  'menu_bar.create_new_ws_confirmation_placeholder': 'Neuer Titel',
7249
7249
 
7250
- 'menu_bar_dropdown.edit_current_page': 'Diese Seite bearbeiten',
7250
+ 'menu_bar_dropdown.edit_current_page': 'Seiteneigenschaften',
7251
7251
  'menu_bar_dropdown.delete_current_page': 'Diese Seite löschen',
7252
7252
  'menu_bar_dropdown.save_current_page_to_clipboard': 'Diese Seite im Clipboard ablegen',
7253
7253
  'menu_bar_dropdown.duplicate_current_page': 'Diese Seite duplizieren',
@@ -7262,9 +7262,8 @@ $.i18n().load({
7262
7262
  'child_list_menus.copy_here': 'Seite im Clipboard hier einfügen',
7263
7263
 
7264
7264
  'widget_menus.add_widget': 'Widget einfügen',
7265
- 'widget_menus.edit_widget': 'Widget bearbeiten',
7265
+ 'widget_menus.edit_widget': 'Widget-Eigenschaften',
7266
7266
  'widget_menus.delete_widget': 'Widget löschen',
7267
- 'widget_menus.open_in_admin_gui': 'Im Admin-GUI öffnen',
7268
7267
 
7269
7268
  'commands.delete_obj.confirm_title': 'Wirklich diese Seite löschen?',
7270
7269
  'commands.delete_obj.confirm_description': 'Eine gelöschte Seite kann nicht wiederhergestellt werden.',
@@ -7332,7 +7331,7 @@ $.i18n().load({
7332
7331
  'menu_bar.create_new_ws_confirmation_desc': 'Please enter the title of the new working copy.',
7333
7332
  'menu_bar.create_new_ws_confirmation_placeholder': 'new title',
7334
7333
 
7335
- 'menu_bar_dropdown.edit_current_page': 'Edit this page',
7334
+ 'menu_bar_dropdown.edit_current_page': 'Page properties',
7336
7335
  'menu_bar_dropdown.delete_current_page': 'Delete this page',
7337
7336
  'menu_bar_dropdown.save_current_page_to_clipboard': 'Place this page on the clipboard',
7338
7337
  'menu_bar_dropdown.duplicate_current_page': 'Duplicate this page',
@@ -7347,9 +7346,8 @@ $.i18n().load({
7347
7346
  'child_list_menus.copy_here': 'Copy page on clipboard here',
7348
7347
 
7349
7348
  'widget_menus.add_widget': 'Insert widget',
7350
- 'widget_menus.edit_widget': 'Edit widget',
7349
+ 'widget_menus.edit_widget': 'Widget properties',
7351
7350
  'widget_menus.delete_widget': 'Delete widget',
7352
- 'widget_menus.open_in_admin_gui': 'Open in admin GUI',
7353
7351
 
7354
7352
  'commands.delete_obj.confirm_title': 'Really delete this page?',
7355
7353
  'commands.delete_obj.confirm_description': 'A deleted page cannot be restored.',
@@ -8254,6 +8252,15 @@ $(function() {
8254
8252
  );
8255
8253
  },
8256
8254
 
8255
+ widget: function() {
8256
+ var widget_id = that.dom_element().attr('data-ip-private-field-widget-id');
8257
+
8258
+ if (widget_id) {
8259
+ return infopark.widget.create_instance(that.obj(), widget_id,
8260
+ that.dom_element().attr('data-ip-private-widget-obj-class'));
8261
+ }
8262
+ },
8263
+
8257
8264
  save: function(content) {
8258
8265
  if (content === undefined) {
8259
8266
  if (that.content) {
@@ -8265,7 +8272,13 @@ $(function() {
8265
8272
 
8266
8273
  var changes = {};
8267
8274
  changes[that.field_name()] = content;
8268
- return that.obj().save(changes);
8275
+
8276
+ var widget = that.widget();
8277
+ if (widget) {
8278
+ return that.widget().save(changes);
8279
+ } else {
8280
+ return that.obj().save(changes);
8281
+ }
8269
8282
  },
8270
8283
 
8271
8284
  original_content: function() {
@@ -8489,6 +8502,43 @@ $(function() {
8489
8502
 
8490
8503
  infopark.cms_element.definitions.push(infopark.string_field_element);
8491
8504
  }());
8505
+ (function() {
8506
+ $.extend(infopark, {
8507
+ widget: {
8508
+ create_instance: function(obj, id, widget_class_name) {
8509
+ var that = {
8510
+ id: function() {
8511
+ return id;
8512
+ },
8513
+
8514
+ obj: function() {
8515
+ return obj;
8516
+ },
8517
+
8518
+ widget_class_name: function() {
8519
+ return widget_class_name;
8520
+ },
8521
+
8522
+ save: function(widget_attributes) {
8523
+ return that.obj().save(build_obj_attributes(widget_attributes));
8524
+ },
8525
+
8526
+ destroy: function() {
8527
+ return that.obj().save(build_obj_attributes(null));
8528
+ }
8529
+ };
8530
+
8531
+ var build_obj_attributes = function(widget_attributes) {
8532
+ var obj_attributes = {_widget_pool: {}};
8533
+ obj_attributes._widget_pool[that.id()] = widget_attributes;
8534
+ return obj_attributes;
8535
+ };
8536
+
8537
+ return that;
8538
+ }
8539
+ }
8540
+ });
8541
+ }());
8492
8542
  (function() {
8493
8543
  $.extend(infopark, {
8494
8544
  widget_element: {
@@ -8497,12 +8547,13 @@ $(function() {
8497
8547
  var that = cms_element;
8498
8548
 
8499
8549
  $.extend(that, {
8500
- obj: function() {
8501
- return infopark.obj.create_instance(
8550
+ widget: function() {
8551
+ return infopark.widget.create_instance(that.widget_field().obj(),
8502
8552
  that.dom_element().attr('data-ip-private-widget-id'),
8503
8553
  that.dom_element().attr('data-ip-private-widget-obj-class')
8504
8554
  );
8505
8555
  },
8556
+
8506
8557
  widget_field: function() {
8507
8558
  return infopark.cms_element.from_dom_element(that.dom_element().parent());
8508
8559
  },
@@ -8512,16 +8563,23 @@ $(function() {
8512
8563
  },
8513
8564
 
8514
8565
  fetch_edit_markup: function() {
8515
- return infopark.ajax('GET', 'objs/' + that.obj().id() + '/edit_widget').then(function(data) {
8566
+ var url = 'objs/' + that.widget().obj().id() + '/edit_widget?' + $.param({
8567
+ widget_id: that.widget().id()
8568
+ });
8569
+
8570
+ return infopark.ajax('GET', url).then(function(data) {
8516
8571
  return data.markup;
8517
8572
  });
8518
8573
  },
8519
8574
 
8520
8575
  fetch_show_markup: function() {
8521
- return infopark.ajax('GET', 'objs/' + that.obj().id() + '?' + $.param({
8576
+ var url = 'objs/' + that.widget().obj().id() + '/show_widget?' + $.param({
8577
+ widget_id: that.widget().id(),
8522
8578
  current_page_id: infopark.obj.current_page().id(),
8523
8579
  field_name: that.field_name()
8524
- })).then(function(data) {
8580
+ });
8581
+
8582
+ return infopark.ajax('GET', url).then(function(data) {
8525
8583
  return data.markup;
8526
8584
  });
8527
8585
  },
@@ -8548,20 +8606,17 @@ $(function() {
8548
8606
 
8549
8607
  $.extend(that, {
8550
8608
  content: function() {
8551
- var widgets = that.widgets();
8552
- return {
8553
- layout: $.map(widgets, function(widget, index) {
8554
- return { widget: widget.obj().id() };
8555
- })
8556
- };
8609
+ return {list: _.map(that.widget_elements(), function(widget_element) {
8610
+ return {widget: widget_element.widget().id()};
8611
+ })};
8557
8612
  },
8558
8613
 
8559
- widgets: function() {
8560
- var widgets_dom = that.dom_element().children('[data-ip-private-widget-id]');
8561
- var widgets = _.map(widgets_dom, function(widget_dom) {
8562
- return infopark.cms_element.from_dom_element($(widget_dom));
8614
+ widget_elements: function() {
8615
+ var widget_elements_dom = that.dom_element().children('[data-ip-private-widget-id]');
8616
+ var widget_elements = _.map(widget_elements_dom, function(widget_element_dom) {
8617
+ return infopark.cms_element.from_dom_element($(widget_element_dom));
8563
8618
  });
8564
- return widgets;
8619
+ return widget_elements;
8565
8620
  },
8566
8621
 
8567
8622
  create_widget: function(widget_class) {
@@ -9579,7 +9634,7 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9579
9634
  },
9580
9635
 
9581
9636
  edit_widget: function(widget_element) {
9582
- var obj = widget_element.obj();
9637
+ var widget = widget_element.widget();
9583
9638
  var dom_element = widget_element.dom_element();
9584
9639
 
9585
9640
  var has_changes = false;
@@ -9587,10 +9642,11 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9587
9642
  has_changes = true;
9588
9643
  });
9589
9644
 
9590
- var title = obj.obj_class_name();
9645
+ var title = widget.widget_class_name();
9591
9646
  var fetch_markup = function() {
9592
9647
  return widget_element.fetch_edit_markup();
9593
9648
  };
9649
+
9594
9650
  return infopark.edit_dialog.open(title, fetch_markup).then(function() {
9595
9651
  infopark.write_monitor.off(token);
9596
9652
  if (has_changes) {
@@ -9607,10 +9663,11 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9607
9663
  title: infopark.i18n.translate('commands.delete_widget.confirm_title'),
9608
9664
  description: infopark.i18n.translate('commands.delete_widget.confirm_description')
9609
9665
  }).then(function() {
9666
+ var widget = widget_element.widget();
9610
9667
  widget_element.dom_element().remove();
9611
9668
 
9612
9669
  return widget_field_element.save().then(function() {
9613
- return widget_element.obj().destroy();
9670
+ return widget.destroy();
9614
9671
  });
9615
9672
  });
9616
9673
  },
@@ -9647,7 +9704,7 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9647
9704
  infopark.inplace_menus.define(function(menu) {
9648
9705
  if (infopark.editing.workspace().is_editable()) {
9649
9706
  _.each(infopark.widget_field_element.all(), function(widget_field_element) {
9650
- var widget_elements = widget_field_element.widgets();
9707
+ var widget_elements = widget_field_element.widget_elements();
9651
9708
 
9652
9709
  if (widget_elements.length === 0) {
9653
9710
  menu.add_item(widget_field_element.dom_element(), {
@@ -9685,14 +9742,6 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
9685
9742
  infopark.commands.delete_widget(widget_field_element, widget_element);
9686
9743
  }
9687
9744
  });
9688
-
9689
- menu.add_item(widget_dom_element, {
9690
- title: infopark.i18n.translate('widget_menus.open_in_admin_gui'),
9691
- icon: '\uF000',
9692
- execute: function() {
9693
- infopark.commands.open_in_admin_gui(widget_element.obj().id());
9694
- }
9695
- });
9696
9745
  });
9697
9746
  });
9698
9747
  }