infopark_cloud_connector 6.9.0.3.197272233 → 6.9.1.3.22208381

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- <%= render_widget(@widget, @obj, params[:field_name], @container) %>
1
+ <%= render_widget(@widget, @current_page, params[:field_name], @obj) %>
@@ -0,0 +1,6 @@
1
+ de:
2
+ rails_connector:
3
+ errors:
4
+ models:
5
+ basic_obj:
6
+ has_children: 'Diese Seite hat Unterseiten.'
@@ -0,0 +1,6 @@
1
+ en:
2
+ rails_connector:
3
+ errors:
4
+ models:
5
+ basic_obj:
6
+ has_children: 'This page has children.'
data/config/routes.rb CHANGED
@@ -1,8 +1,24 @@
1
1
  Rails.application.routes.draw do
2
- resources :objs, controller: 'rails_connector/objs', path: '__ipcms/objs', only: [:update, :destroy] do
2
+ resources :objs, controller: 'rails_connector/objs', path: '__ipcms/objs',
3
+ only: [:create, :update, :destroy] do
4
+ get :page_class_selection, on: :collection
5
+
3
6
  member do
4
7
  get :widget_class_selection
5
8
  post :create_widget
6
9
  end
7
10
  end
11
+
12
+ resources :tasks, controller: 'rails_connector/tasks', path: '__ipcms/tasks', only: [:show]
13
+
14
+ match '__ipcms/blobs/upload_permission' => 'rails_connector/blobs#upload_permission', via: :get
15
+
16
+ resources :workspaces,
17
+ controller: 'rails_connector/workspaces',
18
+ path: '__ipcms/workspaces',
19
+ only: [:index, :create, :update, :destroy] do
20
+ member do
21
+ put :publish
22
+ end
23
+ end
8
24
  end
Binary file
Binary file
@@ -9751,9 +9751,9 @@ var RLANG = {
9751
9751
  }
9752
9752
  }
9753
9753
  })(jQuery);
9754
- // Underscore.js 1.4.3
9754
+ // Underscore.js 1.4.4
9755
9755
  // http://underscorejs.org
9756
- // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
9756
+ // (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
9757
9757
  // Underscore may be freely distributed under the MIT license.
9758
9758
 
9759
9759
  (function() {
@@ -9817,7 +9817,7 @@ var RLANG = {
9817
9817
  }
9818
9818
 
9819
9819
  // Current version.
9820
- _.VERSION = '1.4.3';
9820
+ _.VERSION = '1.4.4';
9821
9821
 
9822
9822
  // Collection Functions
9823
9823
  // --------------------
@@ -9977,8 +9977,9 @@ var RLANG = {
9977
9977
  // Invoke a method (with arguments) on every item in a collection.
9978
9978
  _.invoke = function(obj, method) {
9979
9979
  var args = slice.call(arguments, 2);
9980
+ var isFunc = _.isFunction(method);
9980
9981
  return _.map(obj, function(value) {
9981
- return (_.isFunction(method) ? method : value[method]).apply(value, args);
9982
+ return (isFunc ? method : value[method]).apply(value, args);
9982
9983
  });
9983
9984
  };
9984
9985
 
@@ -9988,10 +9989,10 @@ var RLANG = {
9988
9989
  };
9989
9990
 
9990
9991
  // Convenience version of a common use case of `filter`: selecting only objects
9991
- // with specific `key:value` pairs.
9992
- _.where = function(obj, attrs) {
9993
- if (_.isEmpty(attrs)) return [];
9994
- return _.filter(obj, function(value) {
9992
+ // containing specific `key:value` pairs.
9993
+ _.where = function(obj, attrs, first) {
9994
+ if (_.isEmpty(attrs)) return first ? void 0 : [];
9995
+ return _[first ? 'find' : 'filter'](obj, function(value) {
9995
9996
  for (var key in attrs) {
9996
9997
  if (attrs[key] !== value[key]) return false;
9997
9998
  }
@@ -9999,6 +10000,12 @@ var RLANG = {
9999
10000
  });
10000
10001
  };
10001
10002
 
10003
+ // Convenience version of a common use case of `find`: getting the first object
10004
+ // containing specific `key:value` pairs.
10005
+ _.findWhere = function(obj, attrs) {
10006
+ return _.where(obj, attrs, true);
10007
+ };
10008
+
10002
10009
  // Return the maximum element or (element-based computation).
10003
10010
  // Can't optimize arrays of integers longer than 65,535 elements.
10004
10011
  // See: https://bugs.webkit.org/show_bug.cgi?id=80797
@@ -10070,7 +10077,7 @@ var RLANG = {
10070
10077
  // An internal function used for aggregate "group by" operations.
10071
10078
  var group = function(obj, value, context, behavior) {
10072
10079
  var result = {};
10073
- var iterator = lookupIterator(value || _.identity);
10080
+ var iterator = lookupIterator(value == null ? _.identity : value);
10074
10081
  each(obj, function(value, index) {
10075
10082
  var key = iterator.call(context, value, index, obj);
10076
10083
  behavior(result, key, value);
@@ -10324,9 +10331,8 @@ var RLANG = {
10324
10331
  var ctor = function(){};
10325
10332
 
10326
10333
  // Create a function bound to a given object (assigning `this`, and arguments,
10327
- // optionally). Binding with arguments is also known as `curry`.
10328
- // Delegates to **ECMAScript 5**'s native `Function.bind` if available.
10329
- // We check for `func.bind` first, to fail fast when `func` is undefined.
10334
+ // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
10335
+ // available.
10330
10336
  _.bind = function(func, context) {
10331
10337
  var args, bound;
10332
10338
  if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
@@ -10343,11 +10349,20 @@ var RLANG = {
10343
10349
  };
10344
10350
  };
10345
10351
 
10352
+ // Partially apply a function by creating a version that has had some of its
10353
+ // arguments pre-filled, without changing its dynamic `this` context.
10354
+ _.partial = function(func) {
10355
+ var args = slice.call(arguments, 1);
10356
+ return function() {
10357
+ return func.apply(this, args.concat(slice.call(arguments)));
10358
+ };
10359
+ };
10360
+
10346
10361
  // Bind all of an object's methods to that object. Useful for ensuring that
10347
10362
  // all callbacks defined on an object belong to it.
10348
10363
  _.bindAll = function(obj) {
10349
10364
  var funcs = slice.call(arguments, 1);
10350
- if (funcs.length == 0) funcs = _.functions(obj);
10365
+ if (funcs.length === 0) throw new Error("bindAll must be passed function names");
10351
10366
  each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
10352
10367
  return obj;
10353
10368
  };
@@ -10549,7 +10564,7 @@ var RLANG = {
10549
10564
  each(slice.call(arguments, 1), function(source) {
10550
10565
  if (source) {
10551
10566
  for (var prop in source) {
10552
- if (obj[prop] == null) obj[prop] = source[prop];
10567
+ if (obj[prop] === void 0) obj[prop] = source[prop];
10553
10568
  }
10554
10569
  }
10555
10570
  });
@@ -10772,7 +10787,7 @@ var RLANG = {
10772
10787
  max = min;
10773
10788
  min = 0;
10774
10789
  }
10775
- return min + (0 | Math.random() * (max - min + 1));
10790
+ return min + Math.floor(Math.random() * (max - min + 1));
10776
10791
  };
10777
10792
 
10778
10793
  // List of HTML entities for escaping.
@@ -10807,7 +10822,7 @@ var RLANG = {
10807
10822
  // If the value of the named property is a function then invoke it;
10808
10823
  // otherwise, return it.
10809
10824
  _.result = function(object, property) {
10810
- if (object == null) return null;
10825
+ if (object == null) return void 0;
10811
10826
  var value = object[property];
10812
10827
  return _.isFunction(value) ? value.call(object) : value;
10813
10828
  };
@@ -10828,7 +10843,7 @@ var RLANG = {
10828
10843
  // Useful for temporary DOM ids.
10829
10844
  var idCounter = 0;
10830
10845
  _.uniqueId = function(prefix) {
10831
- var id = '' + ++idCounter;
10846
+ var id = ++idCounter + '';
10832
10847
  return prefix ? prefix + id : id;
10833
10848
  };
10834
10849
 
@@ -10863,6 +10878,7 @@ var RLANG = {
10863
10878
  // Underscore templating handles arbitrary delimiters, preserves whitespace,
10864
10879
  // and correctly escapes quotes within interpolated code.
10865
10880
  _.template = function(text, data, settings) {
10881
+ var render;
10866
10882
  settings = _.defaults({}, settings, _.templateSettings);
10867
10883
 
10868
10884
  // Combine delimiters into one regular expression via alternation.
@@ -10901,7 +10917,7 @@ var RLANG = {
10901
10917
  source + "return __p;\n";
10902
10918
 
10903
10919
  try {
10904
- var render = new Function(settings.variable || 'obj', '_', source);
10920
+ render = new Function(settings.variable || 'obj', '_', source);
10905
10921
  } catch (e) {
10906
10922
  e.source = source;
10907
10923
  throw e;
@@ -10974,10 +10990,10 @@ var RLANG = {
10974
10990
  }).call(this);
10975
10991
  (function() {
10976
10992
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
10977
- this.InfoparkHandlebarsTemplates["choose_widget_class_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
10993
+ this.InfoparkHandlebarsTemplates["choose_obj_class_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
10978
10994
  this.compilerInfo = [2,'>= 1.0.0-rc.3'];
10979
10995
  helpers = helpers || Handlebars.helpers; data = data || {};
10980
- var buffer = "", stack1, stack2, options, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
10996
+ var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
10981
10997
 
10982
10998
  function program1(depth0,data) {
10983
10999
 
@@ -10991,44 +11007,39 @@ function program1(depth0,data) {
10991
11007
  function program2(depth0,data) {
10992
11008
 
10993
11009
  var buffer = "", stack1;
10994
- buffer += "\n <div class=\"ip-widget_thumbnail ip_editing_widget_preview\" data-ip-widget-class-name=\"";
10995
- if (stack1 = helpers.widget_class_name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
10996
- else { stack1 = depth0.widget_class_name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11010
+ buffer += "\n <div class=\"ip-obj_class_thumbnail ip_editing_widget_preview\" data-ip-obj-class-name=\"";
11011
+ if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11012
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
10997
11013
  buffer += escapeExpression(stack1)
10998
11014
  + "\">\n ";
10999
- if (stack1 = helpers.widget_markup) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11000
- else { stack1 = depth0.widget_markup; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11015
+ if (stack1 = helpers.markup) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11016
+ else { stack1 = depth0.markup; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11001
11017
  if(stack1 || stack1 === 0) { buffer += stack1; }
11002
11018
  buffer += "\n </div>\n ";
11003
11019
  return buffer;
11004
11020
  }
11005
11021
 
11006
- buffer += "<div class=\"ip-choose_widget_class_dialog ip_editing_modal_big\">\n\n <div class=\"modal_header\">\n <h3><i class=\"ip_editing_icon\" title=\"widget\">&#61498;</i> ";
11007
- options = {hash:{},data:data};
11008
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "choose_widget_class_dialog.title", options) : helperMissing.call(depth0, "translate", "choose_widget_class_dialog.title", options)))
11009
- + "</h3>\n <p>";
11010
- options = {hash:{},data:data};
11011
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "choose_widget_class_dialog.description", options) : helperMissing.call(depth0, "translate", "choose_widget_class_dialog.description", options)))
11012
- + "</p>\n </div>\n\n <div class=\"modal_body auto_height\">\n ";
11013
- stack2 = helpers.each.call(depth0, depth0.widgets, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
11014
- if(stack2 || stack2 === 0) { buffer += stack2; }
11015
- buffer += "\n </div>\n\n <div class=\"modal_footer\">\n <a href=\"#\" class=\"ip_editing_button cancel\">";
11022
+ buffer += "<div class=\"ip-choose_obj_class_dialog ip_modal_big\">\n\n <div class=\"modal_header\">\n <h3><i class=\"ip_icon\">&#61498;</i>";
11023
+ if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11024
+ else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11025
+ buffer += escapeExpression(stack1)
11026
+ + "</h3>\n </div>\n\n <div class=\"modal_body auto_height\">\n ";
11027
+ stack1 = helpers.each.call(depth0, depth0.obj_classes, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
11028
+ if(stack1 || stack1 === 0) { buffer += stack1; }
11029
+ buffer += "\n </div>\n\n <div class=\"modal_footer\">\n <a href=\"#\" class=\"ip_button cancel\">";
11016
11030
  options = {hash:{},data:data};
11017
11031
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "cancel", options) : helperMissing.call(depth0, "translate", "cancel", options)))
11018
- + "</a>\n <a href=\"#\" class=\"ip_editing_button green confirm\"><i class=\"ip_editing_icon\">&#61503;</i> ";
11019
- options = {hash:{},data:data};
11020
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "choose_widget_class_dialog.confirm", options) : helperMissing.call(depth0, "translate", "choose_widget_class_dialog.confirm", options)))
11021
11032
  + "</a>\n </div>\n\n</div>\n";
11022
11033
  return buffer;
11023
11034
  });
11024
- return this.InfoparkHandlebarsTemplates["choose_widget_class_dialog"];
11035
+ return this.InfoparkHandlebarsTemplates["choose_obj_class_dialog"];
11025
11036
  }).call(this);
11026
11037
  (function() {
11027
11038
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
11028
11039
  this.InfoparkHandlebarsTemplates["confirmation_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
11029
11040
  this.compilerInfo = [2,'>= 1.0.0-rc.3'];
11030
11041
  helpers = helpers || Handlebars.helpers; data = data || {};
11031
- var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
11042
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
11032
11043
 
11033
11044
  function program1(depth0,data) {
11034
11045
 
@@ -11041,23 +11052,69 @@ function program1(depth0,data) {
11041
11052
  return buffer;
11042
11053
  }
11043
11054
 
11044
- buffer += "<div class=\"ip-confirmation_dialog ip_editing_modal_small\">\n <div class=\"modal_header\">\n <i class=\"ip_editing_icon\">&#61469;</i>\n <h3 class=\"title\">";
11055
+ buffer += "<div class=\"ip-confirmation_dialog ip_modal_small\">\n <div class=\"modal_header\">\n <i class=\"ip_icon\">";
11056
+ if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11057
+ else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11058
+ if(stack1 || stack1 === 0) { buffer += stack1; }
11059
+ buffer += "</i>\n <h3 class=\"title\">";
11045
11060
  if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11046
11061
  else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11047
11062
  buffer += escapeExpression(stack1)
11048
11063
  + "</h3>\n ";
11049
11064
  stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
11050
11065
  if(stack1 || stack1 === 0) { buffer += stack1; }
11051
- buffer += "\n </div>\n <div class=\"modal_footer\">\n <a href=\"#\" class=\"ip_editing_button cancel\">";
11066
+ buffer += "\n </div>\n <div class=\"modal_footer\">\n <a href=\"#\" class=\"ip_button ";
11067
+ if (stack1 = helpers.cancel_button_color) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11068
+ else { stack1 = depth0.cancel_button_color; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11069
+ buffer += escapeExpression(stack1)
11070
+ + " cancel\">\n ";
11071
+ if (stack1 = helpers.cancel_button_text) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11072
+ else { stack1 = depth0.cancel_button_text; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11073
+ buffer += escapeExpression(stack1)
11074
+ + "\n </a>\n <a href=\"#\" class=\"ip_button ";
11075
+ if (stack1 = helpers.confirm_button_color) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11076
+ else { stack1 = depth0.confirm_button_color; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11077
+ buffer += escapeExpression(stack1)
11078
+ + " confirm\">\n ";
11079
+ if (stack1 = helpers.confirm_button_text) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11080
+ else { stack1 = depth0.confirm_button_text; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11081
+ buffer += escapeExpression(stack1)
11082
+ + "\n </a>\n </div>\n</div>\n";
11083
+ return buffer;
11084
+ });
11085
+ return this.InfoparkHandlebarsTemplates["confirmation_dialog"];
11086
+ }).call(this);
11087
+ (function() {
11088
+ this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
11089
+ this.InfoparkHandlebarsTemplates["deactivate_menu_bar_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
11090
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
11091
+ helpers = helpers || Handlebars.helpers; data = data || {};
11092
+ var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
11093
+
11094
+
11095
+ buffer += "<i class=\"ip_icon\" title=\"";
11052
11096
  options = {hash:{},data:data};
11053
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "cancel", options) : helperMissing.call(depth0, "translate", "cancel", options)))
11054
- + "</a>\n <a href=\"#\" class=\"ip_editing_button blue confirm\">";
11097
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.deactivate_editing", options) : helperMissing.call(depth0, "translate", "menu_bar.deactivate_editing", options)))
11098
+ + "\">&#xF06C;</i>\n";
11099
+ return buffer;
11100
+ });
11101
+ return this.InfoparkHandlebarsTemplates["deactivate_menu_bar_item"];
11102
+ }).call(this);
11103
+ (function() {
11104
+ this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
11105
+ this.InfoparkHandlebarsTemplates["delete_current_page_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
11106
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
11107
+ helpers = helpers || Handlebars.helpers; data = data || {};
11108
+ var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
11109
+
11110
+
11111
+ buffer += "<i class=\"ip_icon\">&#xF018;</i>\n<span class=\"ip_button_label\">";
11055
11112
  options = {hash:{},data:data};
11056
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "confirm", options) : helperMissing.call(depth0, "translate", "confirm", options)))
11057
- + "</a>\n </div>\n</div>\n";
11113
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.delete_current_page", options) : helperMissing.call(depth0, "translate", "menu_bar.delete_current_page", options)))
11114
+ + "</span>\n";
11058
11115
  return buffer;
11059
11116
  });
11060
- return this.InfoparkHandlebarsTemplates["confirmation_dialog"];
11117
+ return this.InfoparkHandlebarsTemplates["delete_current_page_item"];
11061
11118
  }).call(this);
11062
11119
  (function() {
11063
11120
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
@@ -11069,7 +11126,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
11069
11126
  function program1(depth0,data) {
11070
11127
 
11071
11128
  var buffer = "", stack1;
11072
- buffer += "\n <li class=\"ip_editing_menu_item\">\n <span><i class=\"ip_editing_icon\">"
11129
+ buffer += "\n <li class=\"ip_menu_item\">\n <span><i class=\"ip_icon\">"
11073
11130
  + escapeExpression(((stack1 = depth0.icon),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
11074
11131
  + "</i>"
11075
11132
  + escapeExpression(((stack1 = depth0.text),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
@@ -11081,7 +11138,7 @@ function program1(depth0,data) {
11081
11138
  if (stack1 = helpers.menu_id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11082
11139
  else { stack1 = depth0.menu_id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11083
11140
  buffer += escapeExpression(stack1)
11084
- + "\">\n <ul class=\"ip_editing_menu_box\">\n ";
11141
+ + "\">\n <ul class=\"ip_menu_box\">\n ";
11085
11142
  stack1 = helpers.each.call(depth0, depth0.items, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
11086
11143
  if(stack1 || stack1 === 0) { buffer += stack1; }
11087
11144
  buffer += "\n </ul>\n</div>\n";
@@ -11094,13 +11151,30 @@ function program1(depth0,data) {
11094
11151
  this.InfoparkHandlebarsTemplates["inplace_menu_icon"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
11095
11152
  this.compilerInfo = [2,'>= 1.0.0-rc.3'];
11096
11153
  helpers = helpers || Handlebars.helpers; data = data || {};
11097
-
11154
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
11098
11155
 
11099
11156
 
11100
- return "<span class=\"ip_editing_marker\"><i class=\"ip_editing_icon\">&#xF03D;</i></span>\n";
11157
+ buffer += "<span class=\"ip_editing_marker\" id=\"";
11158
+ if (stack1 = helpers.menu_icon_id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11159
+ else { stack1 = depth0.menu_icon_id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11160
+ buffer += escapeExpression(stack1)
11161
+ + "\"><i class=\"ip_icon\">&#xF03D;</i></span>\n";
11162
+ return buffer;
11101
11163
  });
11102
11164
  return this.InfoparkHandlebarsTemplates["inplace_menu_icon"];
11103
11165
  }).call(this);
11166
+ (function() {
11167
+ this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
11168
+ this.InfoparkHandlebarsTemplates["menu_bar"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
11169
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
11170
+ helpers = helpers || Handlebars.helpers; data = data || {};
11171
+
11172
+
11173
+
11174
+ return "<div class=\"ip_topbar\">\n <div class=\"ip_first_level\">\n <div class=\"ip_button_bar ip_app ip_no_hover\">\n <span class=\"ip_logo\"></span>\n <span class=\"ip_product_name\">CMS</span>\n </div>\n\n <div id=\"ip_select_workspace\" class=\"ip_button_bar\"></div>\n <div id=\"ip_deactivate_editing\" class=\"ip_button_bar ip_right\"></div>\n <div id=\"ip_delete_current_page\" class=\"ip_button_bar ip_right ip_red\"></div>\n </div>\n</div>\n";
11175
+ });
11176
+ return this.InfoparkHandlebarsTemplates["menu_bar"];
11177
+ }).call(this);
11104
11178
  (function() {
11105
11179
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
11106
11180
  this.InfoparkHandlebarsTemplates["overlay"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
@@ -11109,10 +11183,60 @@ helpers = helpers || Handlebars.helpers; data = data || {};
11109
11183
 
11110
11184
 
11111
11185
 
11112
- return "<div class=\"ip-overlay ip_editing_overlay\"></div>\n";
11186
+ return "<div class=\"ip-overlay ip_overlay\"></div>\n";
11113
11187
  });
11114
11188
  return this.InfoparkHandlebarsTemplates["overlay"];
11115
11189
  }).call(this);
11190
+ (function() {
11191
+ this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
11192
+ this.InfoparkHandlebarsTemplates["prompt_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
11193
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
11194
+ helpers = helpers || Handlebars.helpers; data = data || {};
11195
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
11196
+
11197
+ function program1(depth0,data) {
11198
+
11199
+ var buffer = "", stack1;
11200
+ buffer += "\n <p class=\"description\">";
11201
+ if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11202
+ else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11203
+ buffer += escapeExpression(stack1)
11204
+ + "</p>\n ";
11205
+ return buffer;
11206
+ }
11207
+
11208
+ buffer += "<div class=\"ip-prompt_dialog ip_modal_small\">\n <div class=\"modal_header\">\n <i class=\"ip_icon\">";
11209
+ if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11210
+ else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11211
+ if(stack1 || stack1 === 0) { buffer += stack1; }
11212
+ buffer += "</i>\n <h3 class=\"title\">";
11213
+ if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11214
+ else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11215
+ buffer += escapeExpression(stack1)
11216
+ + "</h3>\n ";
11217
+ stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
11218
+ if(stack1 || stack1 === 0) { buffer += stack1; }
11219
+ buffer += "\n </div>\n <div class=\"modal_body\">\n <input type=\"text\" value=\"";
11220
+ if (stack1 = helpers.value) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11221
+ else { stack1 = depth0.value; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11222
+ buffer += escapeExpression(stack1)
11223
+ + "\" placeholder=\"";
11224
+ if (stack1 = helpers.placeholder) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11225
+ else { stack1 = depth0.placeholder; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11226
+ buffer += escapeExpression(stack1)
11227
+ + "\"></input>\n </div>\n <div class=\"modal_footer\">\n <a href=\"#\" class=\"ip_button cancel\">";
11228
+ if (stack1 = helpers.cancel_button_text) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11229
+ else { stack1 = depth0.cancel_button_text; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11230
+ buffer += escapeExpression(stack1)
11231
+ + "</a>\n <a href=\"#\" class=\"ip_button ip_blue accept\">";
11232
+ if (stack1 = helpers.accept_button_text) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11233
+ else { stack1 = depth0.accept_button_text; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11234
+ buffer += escapeExpression(stack1)
11235
+ + "</a>\n </div>\n</div>\n";
11236
+ return buffer;
11237
+ });
11238
+ return this.InfoparkHandlebarsTemplates["prompt_dialog"];
11239
+ }).call(this);
11116
11240
  (function() {
11117
11241
  this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
11118
11242
  this.InfoparkHandlebarsTemplates["saving_overlay"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
@@ -11121,7 +11245,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
11121
11245
 
11122
11246
 
11123
11247
 
11124
- return "<div class=\"ip-saving-overlay ip_editing_overlay\">\n <i class=\"ip_editing_icon ip_processing\">&#61475;</i>\n</div>\n";
11248
+ return "<div class=\"ip-saving-overlay ip_overlay\">\n <i class=\"ip_icon ip_processing\">&#61475;</i>\n</div>\n";
11125
11249
  });
11126
11250
  return this.InfoparkHandlebarsTemplates["saving_overlay"];
11127
11251
  }).call(this);
@@ -11142,39 +11266,212 @@ helpers = helpers || Handlebars.helpers; data = data || {};
11142
11266
  });
11143
11267
  return this.InfoparkHandlebarsTemplates["title"];
11144
11268
  }).call(this);
11269
+ (function() {
11270
+ this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
11271
+ this.InfoparkHandlebarsTemplates["workspace_select_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
11272
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
11273
+ helpers = helpers || Handlebars.helpers; data = data || {};
11274
+ var buffer = "", stack1, self=this, functionType="function", escapeExpression=this.escapeExpression;
11275
+
11276
+ function program1(depth0,data) {
11277
+
11278
+ var buffer = "", stack1, stack2;
11279
+ buffer += "\n ";
11280
+ stack1 = helpers.unless.call(depth0, depth0.is_editable, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
11281
+ if(stack1 || stack1 === 0) { buffer += stack1; }
11282
+ buffer += "\n\n <li class=\"ip_menu_item\">\n <span>\n <i class=\"ip_icon\" title=\""
11283
+ + escapeExpression(((stack1 = depth0.long_title),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
11284
+ + "\">\n ";
11285
+ stack2 = helpers['if'].call(depth0, depth0.is_editable, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
11286
+ if(stack2 || stack2 === 0) { buffer += stack2; }
11287
+ buffer += "\n </i>\n "
11288
+ + escapeExpression(((stack1 = depth0.short_title),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
11289
+ + "\n ";
11290
+ stack2 = helpers['if'].call(depth0, depth0.is_current_workspace, {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
11291
+ if(stack2 || stack2 === 0) { buffer += stack2; }
11292
+ buffer += "\n </span>\n </li>\n";
11293
+ return buffer;
11294
+ }
11295
+ function program2(depth0,data) {
11296
+
11297
+
11298
+ return "\n <li class=\"ip_menu_separator\"></li>\n ";
11299
+ }
11300
+
11301
+ function program4(depth0,data) {
11302
+
11303
+
11304
+ return "\n &#xF011;\n ";
11305
+ }
11306
+
11307
+ function program6(depth0,data) {
11308
+
11309
+
11310
+ return "\n &#xF064;\n ";
11311
+ }
11312
+
11313
+ function program8(depth0,data) {
11314
+
11315
+
11316
+ return "\n <i class=\"ip_icon\" title=\"check\">&#61503;</i>\n ";
11317
+ }
11318
+
11319
+ stack1 = helpers.each.call(depth0, depth0.workspaces, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
11320
+ if(stack1 || stack1 === 0) { buffer += stack1; }
11321
+ buffer += "\n";
11322
+ return buffer;
11323
+ });
11324
+ return this.InfoparkHandlebarsTemplates["workspace_select_list"];
11325
+ }).call(this);
11326
+ (function() {
11327
+ this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
11328
+ this.InfoparkHandlebarsTemplates["workspace_select_menu_bar_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
11329
+ this.compilerInfo = [2,'>= 1.0.0-rc.3'];
11330
+ helpers = helpers || Handlebars.helpers; data = data || {};
11331
+ var buffer = "", stack1, stack2, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function", self=this;
11332
+
11333
+ function program1(depth0,data) {
11334
+
11335
+ var buffer = "", stack1, options;
11336
+ buffer += "\n <li class=\"ip_menu_separator\"></li>\n <li class=\"ip_menu_item\">\n <span id='ip-publish-current-ws'>\n <i class=\"ip_icon\"\n title=\"";
11337
+ options = {hash:{},data:data};
11338
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.publish_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.publish_working_copy", depth0.current_short_title, options)))
11339
+ + " \">\n &#xF064;\n </i>\n ";
11340
+ options = {hash:{},data:data};
11341
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.publish_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.publish_working_copy", depth0.current_short_title, options)))
11342
+ + "\n </span>\n </li>\n <li class=\"ip_menu_item\">\n <span id='ip-rename-current-ws'>\n <i class=\"ip_icon\"\n title=\"";
11343
+ options = {hash:{},data:data};
11344
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rename_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rename_working_copy", depth0.current_short_title, options)))
11345
+ + " \">&#61519;</i>\n ";
11346
+ options = {hash:{},data:data};
11347
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rename_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rename_working_copy", depth0.current_short_title, options)))
11348
+ + "\n </span>\n </li>\n <li class=\"ip_menu_item\">\n <span id='ip-delete-current-ws'>\n <i class=\"ip_icon\"\n title=\"";
11349
+ options = {hash:{},data:data};
11350
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.delete_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.delete_working_copy", depth0.current_short_title, options)))
11351
+ + " \">&#61464;</i>\n ";
11352
+ options = {hash:{},data:data};
11353
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.delete_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.delete_working_copy", depth0.current_short_title, options)))
11354
+ + "\n </span>\n </li>\n ";
11355
+ return buffer;
11356
+ }
11357
+
11358
+ buffer += "<i class=\"ip_icon\">&#xf011;</i>\n<span class=\"ip_button_label\">";
11359
+ if (stack1 = helpers.current_long_title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
11360
+ else { stack1 = depth0.current_long_title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
11361
+ buffer += escapeExpression(stack1)
11362
+ + "</span>\n\n<ul class=\"ip_menu_box\" style=\"display: none;\">\n <li class=\"ip_menu_item\">\n <span id='ip-create-new-ws'>\n <i class=\"ip_icon\" title=\"";
11363
+ options = {hash:{},data:data};
11364
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.create_new_working_copy", options) : helperMissing.call(depth0, "translate", "menu_bar.create_new_working_copy", options)))
11365
+ + "\">&#61474;</i>\n ";
11366
+ options = {hash:{},data:data};
11367
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.create_new_working_copy", options) : helperMissing.call(depth0, "translate", "menu_bar.create_new_working_copy", options)))
11368
+ + "\n </span>\n </li>\n ";
11369
+ stack2 = helpers['if'].call(depth0, ((stack1 = depth0.current_workspace),stack1 == null || stack1 === false ? stack1 : stack1.is_editable), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
11370
+ if(stack2 || stack2 === 0) { buffer += stack2; }
11371
+ buffer += "\n <li class=\"ip_menu_separator\"></li>\n <li class=\"ip_menu_item\" id=\"ip_replace_with_real_ws\">\n <span>\n <i class=\"ip_icon ip_spinning\"\n title=\"";
11372
+ options = {hash:{},data:data};
11373
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.loading_workspaces", options) : helperMissing.call(depth0, "translate", "menu_bar.loading_workspaces", options)))
11374
+ + "\">&#61475;</i>\n ";
11375
+ options = {hash:{},data:data};
11376
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.loading_workspaces", options) : helperMissing.call(depth0, "translate", "menu_bar.loading_workspaces", options)))
11377
+ + "\n </span>\n </li>\n</ul>\n";
11378
+ return buffer;
11379
+ });
11380
+ return this.InfoparkHandlebarsTemplates["workspace_select_menu_bar_item"];
11381
+ }).call(this);
11145
11382
  $.i18n().load({
11146
11383
  'confirm': 'Bestätigen',
11147
11384
  'cancel': 'Abbrechen',
11148
11385
  'save': 'Speichern',
11149
11386
  'welcome': 'Willkommen',
11150
-
11151
- 'choose_widget_class_dialog.title': 'Widget Browser',
11152
- 'choose_widget_class_dialog.description': 'Bitte wählen Sie einen Widget aus.',
11153
- 'choose_widget_class_dialog.confirm': 'Widget einfügen',
11387
+ 'welcome_x': 'Willkommen $1',
11388
+ 'accept': 'Übernehmen',
11389
+
11390
+ 'choose_obj_class_dialog.add_child_page.title': 'Seitenvorlage auswählen',
11391
+ 'choose_obj_class_dialog.add_widget.title': 'Widget auswählen',
11392
+
11393
+ 'menu_bar.deactivate_editing': 'Direktbearbeitung deaktivieren',
11394
+ 'menu_bar.working_copy': 'Arbeitskopie',
11395
+ 'menu_bar.empty_workspace_title': '<leerer Titel>',
11396
+ 'menu_bar.published_workspace_title': 'Veröffentlichte Inhalte',
11397
+ 'menu_bar.loading_workspaces': 'Lade Arbeitskopien',
11398
+ 'menu_bar.publish_working_copy': '"$1" veröffentlichen',
11399
+ 'menu_bar.publish_ws_confirmation': '"$1" veröffentlichen?',
11400
+ 'menu_bar.publish_ws_confirmation_desc': 'Eine Arbeitskopie zu veröffentlichen ist endgültig. Dieser Vorgang kann nicht rückgängig gemacht werden.',
11401
+ 'menu_bar.rename_working_copy': '"$1" umbenennen',
11402
+ 'menu_bar.rename_working_copy_desc': 'Bitte geben Sie den neuen Titel der Arbeitskopie ein.',
11403
+ 'menu_bar.rename': 'Umbenennen',
11404
+ 'menu_bar.delete_working_copy': '"$1" löschen',
11405
+ 'menu_bar.delete_ws_confirmation': 'Wirklich "$1" löschen?',
11406
+ 'menu_bar.delete_ws_confirmation_desc': 'Eine gelöschte Arbeitskopie kann nicht wiederhergestellt werden.',
11407
+ 'menu_bar.delete': 'Löschen',
11408
+ 'menu_bar.create': 'Anlegen',
11409
+ 'menu_bar.publish': 'Veröffentlichen',
11410
+ 'menu_bar.create_new_working_copy': 'Arbeitskopie anlegen',
11411
+ 'menu_bar.create_new_ws_confirmation': 'Arbeitskopie anlegen',
11412
+ 'menu_bar.create_new_ws_confirmation_desc': 'Bitte geben Sie den Titel der neuen Arbeitskopie ein.',
11413
+ 'menu_bar.create_new_ws_confirmation_placeholder': 'Neuer Titel',
11414
+ 'menu_bar.delete_current_page': 'Diese Seite löschen',
11415
+
11416
+ 'child_list_menus.add_subpage': 'Neue Seite anlegen',
11154
11417
 
11155
11418
  'widget_menus.add_widget': 'Widget einfügen',
11156
11419
  'widget_menus.delete_widget': 'Widget löschen',
11157
- 'widget_menus.open_in_admin_gui': ' In der Admin-GUI öffnen',
11420
+ 'widget_menus.open_in_admin_gui': ' Im Admin-GUI öffnen',
11158
11421
 
11159
- 'commands.delete_widget.confirm_title': 'Sind Sie sicher, dass sie dieses Widget löschen wollen?',
11160
- 'commands.delete_widget.confirm_description': 'Das kann nicht mehr rückgängig gemacht werden!'
11422
+ 'commands.delete_obj.confirm_title': 'Sind Sie sicher, dass sie diese Seite löschen wollen?',
11423
+ 'commands.delete_obj.confirm_description': 'Das kann nicht mehr rückgängig gemacht werden!',
11424
+ 'commands.delete_widget.confirm_title': 'Wirklich dieses Widget löschen?',
11425
+ 'commands.delete_widget.confirm_description': 'Ein gelöschtes Widget kann nicht wiederhergestellt werden.',
11426
+
11427
+ 'image_upload.too_many_files': 'Nur eine Detei erlaubt.'
11161
11428
  }, 'de');
11162
11429
  $.i18n().load({
11163
11430
  'confirm': 'Confirm',
11164
11431
  'cancel': 'Cancel',
11165
11432
  'save': 'Save',
11166
11433
  'welcome': 'Welcome',
11167
-
11168
- 'choose_widget_class_dialog.title': 'Widget browser',
11169
- 'choose_widget_class_dialog.description': 'Please select a widget.',
11170
- 'choose_widget_class_dialog.confirm': 'Paste widget',
11434
+ 'welcome_x': 'Welcome $1',
11435
+ 'accept': 'Accept',
11436
+
11437
+ 'choose_obj_class_dialog.add_child_page.title': 'Select Page Type',
11438
+ 'choose_obj_class_dialog.add_widget.title': 'Select Widget',
11439
+
11440
+ 'menu_bar.deactivate_editing': 'deactivate in-place editing',
11441
+ 'menu_bar.working_copy': 'Working copy',
11442
+ 'menu_bar.empty_workspace_title': '<empty title>',
11443
+ 'menu_bar.published_workspace_title': 'Published content',
11444
+ 'menu_bar.loading_workspaces': 'Loading working copies',
11445
+ 'menu_bar.publish_working_copy': 'Publish "$1"',
11446
+ 'menu_bar.publish_ws_confirmation': 'Publish "$1"?',
11447
+ 'menu_bar.publish_ws_confirmation_desc': 'Publishing a working copy is final. This action cannot be undone.',
11448
+ 'menu_bar.rename_working_copy': 'Rename "$1"',
11449
+ 'menu_bar.rename_working_copy_desc': 'Please enter the new title of the working copy.',
11450
+ 'menu_bar.rename': 'Rename',
11451
+ 'menu_bar.delete_working_copy': 'Delete "$1"',
11452
+ 'menu_bar.delete_ws_confirmation': 'Really delete "$1"?',
11453
+ 'menu_bar.delete_ws_confirmation_desc': 'A deleted working copy cannot be restored.',
11454
+ 'menu_bar.delete': 'Delete',
11455
+ 'menu_bar.create': 'Create',
11456
+ 'menu_bar.publish': 'Publish',
11457
+ 'menu_bar.create_new_working_copy': 'Create working copy',
11458
+ 'menu_bar.create_new_ws_confirmation': 'Create a working copy',
11459
+ 'menu_bar.create_new_ws_confirmation_desc': 'Please enter the title of the new working copy.',
11460
+ 'menu_bar.create_new_ws_confirmation_placeholder': 'new title',
11461
+ 'menu_bar.delete_current_page': 'Delete this page',
11462
+
11463
+ 'child_list_menus.add_subpage': 'Create new page',
11171
11464
 
11172
11465
  'widget_menus.add_widget': 'Insert widget',
11173
- 'widget_menus.delete_widget': 'Remove widget',
11466
+ 'widget_menus.delete_widget': 'Delete widget',
11174
11467
  'widget_menus.open_in_admin_gui': 'Open in admin GUI',
11175
11468
 
11176
- 'commands.delete_widget.confirm_title': 'Are you sure you want to delete this widget?',
11177
- 'commands.delete_widget.confirm_description': 'This can not be undone!'
11469
+ 'commands.delete_obj.confirm_title': 'Are you sure you want to delete this page?',
11470
+ 'commands.delete_obj.confirm_description': 'This can not be undone!',
11471
+ 'commands.delete_widget.confirm_title': 'Really delete this widget?',
11472
+ 'commands.delete_widget.confirm_description': 'A deleted widget cannot be restored.',
11473
+
11474
+ 'image_upload.too_many_files': 'Only one file allowed.'
11178
11475
  }, 'en');
11179
11476
  /*global alert:false */
11180
11477
 
@@ -11183,13 +11480,39 @@ var infopark = {
11183
11480
  suppress_alerts: false,
11184
11481
 
11185
11482
  alert: function(message) {
11186
- if (infopark.suppress_alerts) {
11187
- window.console.debug('Infopark alert: ' + message);
11188
- } else {
11483
+ if (!infopark.suppress_alerts) {
11189
11484
  window.alert(message);
11190
11485
  }
11191
11486
  },
11192
11487
 
11488
+ change_location: function(location) {
11489
+ // this is a proxy method, so we can stub it easier.
11490
+ window.location = location;
11491
+ },
11492
+
11493
+ redirect_to: function(location) {
11494
+ infopark.change_location(location);
11495
+ // it returns an never resolved or rejected deferred.
11496
+ return $.Deferred();
11497
+ },
11498
+
11499
+ wait: function(seconds) {
11500
+ // this is a proxy method, so we can stub it easier.
11501
+ return $.Deferred(function(dfd) {
11502
+ setTimeout(dfd.resolve, seconds * 1000);
11503
+ });
11504
+ },
11505
+
11506
+ // For testing purpose only.
11507
+ reload_location: function() {
11508
+ window.location.reload();
11509
+ },
11510
+
11511
+ reload: function() {
11512
+ infopark.reload_location();
11513
+ return $.Deferred();
11514
+ },
11515
+
11193
11516
  center: function(elem) {
11194
11517
  if (elem.length === 1) {
11195
11518
  elem.css({
@@ -11200,6 +11523,19 @@ var infopark = {
11200
11523
  }
11201
11524
  },
11202
11525
 
11526
+ ensure_fully_visible_within: function(elem, viewport_container, viewport_height) {
11527
+ var viewport_offset = viewport_container.scrollTop();
11528
+
11529
+ var widget_offset = elem.offset().top;
11530
+ var widget_height = elem.height();
11531
+
11532
+ if (viewport_offset > widget_offset) {
11533
+ viewport_container.animate({scrollTop: widget_offset - 50});
11534
+ } else if (widget_offset + widget_height > viewport_offset + viewport_height) {
11535
+ viewport_container.animate({scrollTop: widget_height + widget_offset + 50 - viewport_height});
11536
+ }
11537
+ },
11538
+
11203
11539
  describe_element: function(elem) {
11204
11540
  var description = elem.get(0).nodeName;
11205
11541
  if (elem.attr("id")) { description += "#"+elem.attr("id"); }
@@ -11212,7 +11548,33 @@ var infopark = {
11212
11548
  return "["+description+"]";
11213
11549
  },
11214
11550
 
11215
- admin_gui_base_url: null
11551
+ add_enter_and_escape_action: function(enter_action, escape_action) {
11552
+ var key_actions = {
11553
+ 13: enter_action, // enter key
11554
+ 27: escape_action // escape key
11555
+ };
11556
+
11557
+ $(document).on('keyup.ip_enter_escape_action', function(e) {
11558
+ if (key_actions[e.keyCode]) {
11559
+ e.preventDefault();
11560
+ key_actions[e.keyCode](e);
11561
+ }
11562
+ });
11563
+ },
11564
+
11565
+ remove_enter_and_escape_action: function() {
11566
+ $(document).off('keyup.ip_enter_escape_action');
11567
+ },
11568
+
11569
+ admin_gui_base_url: null,
11570
+
11571
+ random_hex: function() {
11572
+ var hex = Math.floor(Math.random() * Math.pow(16, 8)).toString(16);
11573
+ while (hex.length < 8) {
11574
+ hex = '0' + hex;
11575
+ }
11576
+ return hex;
11577
+ }
11216
11578
  };
11217
11579
  (function() {
11218
11580
  var valid_locale = ['en', 'de'];
@@ -11232,9 +11594,9 @@ var infopark = {
11232
11594
  }
11233
11595
  },
11234
11596
 
11235
- translate: function(key) {
11597
+ translate: function(key, param1) {
11236
11598
  $.i18n().locale = infopark.i18n.locale();
11237
- return $.i18n(key);
11599
+ return $.i18n(key, param1);
11238
11600
  }
11239
11601
  }
11240
11602
  });
@@ -11244,22 +11606,30 @@ var infopark = {
11244
11606
 
11245
11607
  var event_handlers = {};
11246
11608
 
11609
+ var current_workspace;
11610
+
11611
+ var real_activate = function(options) {
11612
+ if(!infopark.editing.is_active()) {
11613
+ editing_active = true;
11614
+ $.cookie('infopark_editing_active', 'true', { path: '/' });
11615
+ _.each($(event_handlers.activate), function(handler) {
11616
+ handler(options || {});
11617
+ });
11618
+ }
11619
+ };
11620
+
11247
11621
  $.extend(infopark, {
11248
11622
  editing: {
11249
11623
  initialize: function() {
11250
11624
  if($.cookie('infopark_editing_active') === 'true') {
11251
- infopark.editing.activate();
11625
+ real_activate({on_initialize: true});
11252
11626
  }
11253
11627
 
11254
11628
  $('body').append('<div id="ip-editing"></div>');
11255
11629
  },
11256
11630
 
11257
11631
  activate: function() {
11258
- editing_active = true;
11259
- $.cookie('infopark_editing_active', 'true', { path: '/' });
11260
- _.each($(event_handlers.activate), function(handler) {
11261
- handler();
11262
- });
11632
+ return real_activate();
11263
11633
  },
11264
11634
 
11265
11635
  deactivate: function() {
@@ -11287,6 +11657,14 @@ var infopark = {
11287
11657
  event_handlers[event_name].push(handler);
11288
11658
  },
11289
11659
 
11660
+ set_workspace: function(workspace) {
11661
+ current_workspace = workspace;
11662
+ },
11663
+
11664
+ workspace: function() {
11665
+ return current_workspace;
11666
+ },
11667
+
11290
11668
  // for testing purposes only
11291
11669
  reset_event_handlers: function() {
11292
11670
  event_handlers = {};
@@ -11295,59 +11673,419 @@ var infopark = {
11295
11673
  });
11296
11674
  }());
11297
11675
  (function() {
11298
- $.extend(infopark, {
11299
- ajax: function(type, path, options) {
11300
- var base_url = window.location.protocol + '//' + window.location.host + '/__ipcms/';
11301
- return $.ajax(base_url + path, $.extend(options || {}, {
11302
- type: type, dataType: 'json', contentType: 'application/json; charset=utf-8'
11303
- })).fail(function(xhr, text_status, error) {
11304
- var error_description;
11676
+ var handle_task = function(task) {
11677
+ switch (task.status) {
11678
+ case 'success':
11679
+ return $.Deferred().resolve(task.result);
11680
+ case 'error':
11681
+ return $.Deferred().reject(task.message);
11682
+ case 'open':
11683
+ return infopark.wait(2).then(function() {
11684
+ return single_ajax('GET', 'tasks/' + task.id).then(function(data) {
11685
+ return handle_task(data);
11686
+ });
11687
+ });
11688
+ default:
11689
+ throw { message: "Invalid task (wrong status)", task: task };
11690
+ }
11691
+ };
11692
+
11693
+ var single_ajax = function(type, path, options) {
11694
+ var base_url = window.location.protocol + '//' + window.location.host + '/__ipcms/';
11695
+ if (options && options.data) {
11696
+ options.data = JSON.stringify(options.data);
11697
+ }
11698
+ return $.ajax(base_url + path, $.extend(options || {}, {
11699
+ type: type, dataType: 'json', contentType: 'application/json; charset=utf-8'
11700
+ })).then(
11701
+ function(result, text_status, xhr) {
11702
+ return $.Deferred().resolve(result);
11703
+ }, function(xhr, text_status, error) {
11704
+ var error_message;
11305
11705
  try {
11306
- error_description = JSON.parse(xhr.responseText).error;
11706
+ error_message = JSON.parse(xhr.responseText).error;
11307
11707
  } catch (SyntaxError) {}
11308
11708
 
11309
- if (!error_description) {
11310
- error_description = error;
11709
+ if (!error_message) {
11710
+ error_message = error;
11311
11711
  }
11712
+ return $.Deferred().reject(error_message);
11713
+ }
11714
+ ).fail(function(error_message) {
11715
+ infopark.alert(error_message);
11716
+ });
11717
+ };
11312
11718
 
11313
- infopark.alert(error_description);
11719
+ $.extend(infopark, {
11720
+ ajax: function(type, path, options) {
11721
+ return single_ajax(type, path, options).then(function(result) {
11722
+ if (result && result.task && _.size(result) === 1) {
11723
+ return handle_task(result.task);
11724
+ } else {
11725
+ return $.Deferred().resolve(result);
11726
+ }
11314
11727
  });
11315
11728
  }
11316
11729
  });
11317
11730
  }());
11318
11731
  (function() {
11319
- $.extend(infopark, {
11320
- cms_element: {
11321
- create_instance: function(dom_element) {
11322
- var that = {
11323
- dom_element: function() {
11324
- return dom_element;
11325
- }
11326
- };
11732
+ var fade_time = 500;
11733
+ var menu_bar_items_renderer = [];
11327
11734
 
11328
- return that;
11735
+ var add_menu_bar = function(skip_fade) {
11736
+ var body = $('body');
11737
+ body.addClass('ip_editing_active');
11738
+
11739
+ var view = $(infopark.template.render('menu_bar'));
11740
+
11741
+ _.each(menu_bar_items_renderer, function(item_renderer) {
11742
+ item_renderer(view);
11743
+ });
11744
+
11745
+ view.hide();
11746
+ body.append(view);
11747
+ if (skip_fade) {
11748
+ view.show();
11749
+ } else {
11750
+ view.slideDown(fade_time);
11751
+ }
11752
+ };
11753
+
11754
+ var remove_menu_bar = function() {
11755
+ var dom_item = $('.ip_topbar');
11756
+ dom_item.slideUp(fade_time, function() {
11757
+ dom_item.remove();
11758
+ });
11759
+ $('body').removeClass('ip_editing_active');
11760
+ };
11761
+
11762
+ $.extend(infopark, {
11763
+ menu_bar: {
11764
+ register_item_renderer: function(item_renderer) {
11765
+ menu_bar_items_renderer.push(item_renderer);
11329
11766
  },
11330
- from_dom_element: function(dom_element) {
11331
- var cms_element = infopark.cms_element.create_instance(dom_element);
11332
- var special_element;
11767
+ // this is for testing purposes only!
11768
+ reset_menu_bar_items_renderer: function() {
11769
+ menu_bar_items_renderer = [];
11770
+ },
11771
+ init: function() {
11772
+ infopark.editing.on('activate', function(options) {
11773
+ add_menu_bar(options.on_initialize === true);
11774
+ });
11333
11775
 
11334
- _.detect(infopark.cms_element.definitions, function(definition) {
11335
- special_element = definition.create_instance(cms_element);
11336
- return special_element;
11776
+ infopark.editing.on('deactivate', function() {
11777
+ remove_menu_bar();
11337
11778
  });
11779
+ }
11780
+ }
11781
+ });
11782
+ }());
11783
+ (function() {
11784
+ var renderer = function(parent_view) {
11785
+ var view = $(infopark.template.render('deactivate_menu_bar_item'));
11786
+ parent_view.find('#ip_deactivate_editing').append(view);
11787
+ };
11338
11788
 
11339
- return special_element;
11340
- },
11341
- definitions: []
11789
+ $(document).on("click.ip-deactivate-editing", "#ip_deactivate_editing", function(e) {
11790
+ e.preventDefault();
11791
+ infopark.editing.deactivate();
11792
+ });
11793
+
11794
+ $.extend(infopark, {
11795
+ deactivate_menu_bar_item: {
11796
+ init: function() {
11797
+ infopark.menu_bar.register_item_renderer(renderer);
11798
+ }
11342
11799
  }
11343
11800
  });
11344
11801
  }());
11345
11802
  (function() {
11346
11803
  $.extend(infopark, {
11347
- cms_field_element: {
11348
- create_instance: function(cms_element) {
11349
- var that = cms_element;
11350
-
11804
+ delete_current_page_item: {
11805
+ init: function() {
11806
+ infopark.menu_bar.register_item_renderer(function(target) {
11807
+ if (infopark.obj.current_page()) {
11808
+ target.find('#ip_delete_current_page').append(
11809
+ $(infopark.template.render('delete_current_page_item')));
11810
+ }
11811
+ });
11812
+ }
11813
+ }
11814
+ });
11815
+
11816
+ $(document).on('click.ip-delete-current-page', '#ip_delete_current_page', function(e) {
11817
+ e.preventDefault();
11818
+ infopark.commands.delete_obj(infopark.obj.current_page());
11819
+ });
11820
+ }());
11821
+ (function() {
11822
+ var t = infopark.i18n.translate;
11823
+
11824
+ var workspace_title_short = function(workspace) {
11825
+ if (workspace.is_editable()) {
11826
+ if (workspace.title()) {
11827
+ return workspace.title();
11828
+ } else {
11829
+ return t('menu_bar.empty_workspace_title');
11830
+ }
11831
+ } else {
11832
+ return t('menu_bar.published_workspace_title');
11833
+ }
11834
+ };
11835
+
11836
+ var workspace_title_long = function(workspace) {
11837
+ if (workspace.is_editable()) {
11838
+ var title = t('menu_bar.working_copy') + ': ';
11839
+ return title + workspace_title_short(workspace);
11840
+ } else {
11841
+ return workspace_title_short(workspace);
11842
+ }
11843
+ };
11844
+
11845
+ var renderer = function(view) {
11846
+ var select_menu_view = $(infopark.template.render('workspace_select_menu_bar_item', {
11847
+ current_workspace: infopark.editing.workspace(),
11848
+ current_short_title: workspace_title_short(infopark.editing.workspace()),
11849
+ current_long_title: workspace_title_long(infopark.editing.workspace())
11850
+ }));
11851
+
11852
+ view.find('#ip_select_workspace').append(select_menu_view);
11853
+ };
11854
+
11855
+ var default_click_action = function(e) {
11856
+ e.preventDefault();
11857
+ e.stopPropagation();
11858
+ $('#ip_select_workspace .ip_menu_box').fadeToggle('50');
11859
+ };
11860
+
11861
+ $(document).on("click.ip-toggle-ws-select", "#ip_select_workspace", function(e) {
11862
+ default_click_action(e);
11863
+
11864
+ var replace_with_real_ws = $('#ip_select_workspace #ip_replace_with_real_ws');
11865
+ if(replace_with_real_ws.length > 0) {
11866
+ infopark.workspace.all().done(function(workspaces) {
11867
+ var sorted_workspaces = _.sortBy(workspaces, function(ws) {
11868
+ if(ws.is_editable()) {
11869
+ return (ws.title() || '').toUpperCase();
11870
+ } else {
11871
+ return 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'; // max string
11872
+ }
11873
+ });
11874
+
11875
+ var handlebars_workspaces = _.map(sorted_workspaces, function(ws) {
11876
+ return {
11877
+ is_editable: ws.is_editable,
11878
+ long_title: workspace_title_long(ws),
11879
+ short_title: workspace_title_short(ws),
11880
+ is_current_workspace: (ws.id() === infopark.editing.workspace().id())
11881
+ };
11882
+ });
11883
+
11884
+ var ws_list_view_html = infopark.template.render('workspace_select_list', {
11885
+ workspaces: handlebars_workspaces
11886
+ });
11887
+ var ws_list_view = $($.trim(ws_list_view_html));
11888
+
11889
+ _.each(ws_list_view.find('span'), function(dom_element, index) {
11890
+ $(dom_element).on('click.ip_open_workspace', function(e) {
11891
+ default_click_action(e);
11892
+ infopark.redirect_to("?_rc-ws=" + sorted_workspaces[index].id());
11893
+ });
11894
+ });
11895
+
11896
+ replace_with_real_ws.replaceWith(ws_list_view);
11897
+ });
11898
+ }
11899
+ });
11900
+
11901
+ $(document).on("click.ip-create-ws", "#ip-create-new-ws", function(e) {
11902
+ default_click_action(e);
11903
+ infopark.prompt_dialog({
11904
+ icon: '&#xF022;',
11905
+ title: t('menu_bar.create_new_ws_confirmation'),
11906
+ description: t('menu_bar.create_new_ws_confirmation_desc'),
11907
+ placeholder: t('menu_bar.create_new_ws_confirmation_placeholder'),
11908
+ accept_button_text: t('menu_bar.create')
11909
+ }).done(function(title) {
11910
+ infopark.with_saving_overlay(
11911
+ infopark.workspace.create(title).then(function(new_workspace) {
11912
+ return infopark.redirect_to('?_rc-ws=' + new_workspace.id());
11913
+ })
11914
+ );
11915
+ });
11916
+ });
11917
+
11918
+ $(document).on("click.ip-publish-ws", "#ip-publish-current-ws", function(e) {
11919
+ default_click_action(e);
11920
+ infopark.confirmation_dialog({
11921
+ icon: '&#xF064;',
11922
+ confirm_button_text: t('menu_bar.publish'),
11923
+ title: t('menu_bar.publish_ws_confirmation', workspace_title_short(
11924
+ infopark.editing.workspace())),
11925
+ description: t('menu_bar.publish_ws_confirmation_desc')
11926
+ }).done(function() {
11927
+ infopark.with_saving_overlay(
11928
+ infopark.editing.workspace().publish().then(function() {
11929
+ return infopark.redirect_to('?_rc-ws=published');
11930
+ })
11931
+ );
11932
+ });
11933
+ });
11934
+
11935
+ $(document).on("click.ip-rename-ws", "#ip-rename-current-ws", function(e) {
11936
+ default_click_action(e);
11937
+ infopark.prompt_dialog({
11938
+ icon: '&#xF04F;',
11939
+ title: t('menu_bar.rename_working_copy', infopark.editing.workspace().title()),
11940
+ description: t('menu_bar.rename_working_copy_desc'),
11941
+ value: infopark.editing.workspace().title(),
11942
+ accept_button_text: t('menu_bar.rename')
11943
+ }).done(function(new_title) {
11944
+ infopark.with_saving_overlay(
11945
+ infopark.editing.workspace().rename(new_title).then(function() {
11946
+ return infopark.redirect_to('?_rc-ws=' + infopark.editing.workspace().id());
11947
+ })
11948
+ );
11949
+ });
11950
+ });
11951
+
11952
+ $(document).on("click.ip-delete-ws", "#ip-delete-current-ws", function(e) {
11953
+ default_click_action(e);
11954
+ infopark.confirmation_dialog({
11955
+ icon: '&#xF018;',
11956
+ confirm_button_color: 'ip_red',
11957
+ confirm_button_text: t('menu_bar.delete'),
11958
+ title: t('menu_bar.delete_ws_confirmation', workspace_title_short(
11959
+ infopark.editing.workspace())),
11960
+ description: t('menu_bar.delete_ws_confirmation_desc')
11961
+ }).done(function() {
11962
+ infopark.with_saving_overlay(
11963
+ infopark.editing.workspace().destroy().then(function(new_workspace) {
11964
+ return infopark.redirect_to('?_rc-ws=published');
11965
+ })
11966
+ );
11967
+ });
11968
+ });
11969
+
11970
+ $.extend(infopark, {
11971
+ workspace_select: {
11972
+ init: function() {
11973
+ infopark.menu_bar.register_item_renderer(renderer);
11974
+ }
11975
+ }
11976
+ });
11977
+ }());
11978
+ (function() {
11979
+
11980
+ $.extend(infopark, {
11981
+ blob: {
11982
+ create: function(file) {
11983
+ return get_upload_permission().then(function(permission) {
11984
+ return upload_to_s3(file, permission);
11985
+ });
11986
+ },
11987
+
11988
+ // For testing purpose only.
11989
+ get_form_data: function() {
11990
+ return new FormData();
11991
+ }
11992
+ }
11993
+ });
11994
+
11995
+ var get_upload_permission = function() {
11996
+ return infopark.ajax('GET', 'blobs/upload_permission');
11997
+ };
11998
+
11999
+ var upload_to_s3 = function(file, permission) {
12000
+ var form_data = infopark.blob.get_form_data();
12001
+ _.each(permission.fields, function(value, name) {
12002
+ form_data.append(name, value);
12003
+ });
12004
+ form_data.append('file', file); // File must be appended last, otherwise S3 will complain.
12005
+
12006
+ return $.ajax({type: 'POST', url: permission.url, data: form_data,
12007
+ // These are needed in order for jQuery to work properly with a FormData.
12008
+ contentType: false,
12009
+ processData: false
12010
+ }).then(function() { return permission.blob; });
12011
+ };
12012
+
12013
+ }());
12014
+ (function() {
12015
+ $.extend(infopark, {
12016
+ child_list_element: {
12017
+ create_instance: function(cms_element) {
12018
+ if (cms_element.dom_element().attr('data-ip-child-list-path')) {
12019
+ var that = cms_element;
12020
+
12021
+ $.extend(that, {
12022
+ path: function() {
12023
+ return that.dom_element().attr('data-ip-child-list-path');
12024
+ },
12025
+
12026
+ fetch_page_class_selection: function() {
12027
+ return infopark.ajax('GET', 'objs/page_class_selection');
12028
+ },
12029
+
12030
+ create_child: function(obj_class) {
12031
+ var name = infopark.random_hex();
12032
+ var path = that.path() + "/" + name;
12033
+
12034
+ return infopark.obj.create({
12035
+ _path: path,
12036
+ _obj_class: obj_class
12037
+ });
12038
+ }
12039
+ });
12040
+
12041
+ return that;
12042
+ }
12043
+ },
12044
+ all: function() {
12045
+ return _.map($('[data-ip-child-list-path]'), function(dom_element) {
12046
+ return infopark.cms_element.from_dom_element($(dom_element));
12047
+ });
12048
+ }
12049
+ }
12050
+ });
12051
+ }());
12052
+
12053
+ $(function() {
12054
+ infopark.cms_element.definitions.push(infopark.child_list_element);
12055
+ });
12056
+ (function() {
12057
+ $.extend(infopark, {
12058
+ cms_element: {
12059
+ create_instance: function(dom_element) {
12060
+ var that = {
12061
+ dom_element: function() {
12062
+ return dom_element;
12063
+ }
12064
+ };
12065
+
12066
+ return that;
12067
+ },
12068
+ from_dom_element: function(dom_element) {
12069
+ var cms_element = infopark.cms_element.create_instance(dom_element);
12070
+ var special_element;
12071
+
12072
+ _.detect(infopark.cms_element.definitions, function(definition) {
12073
+ special_element = definition.create_instance(cms_element);
12074
+ return special_element;
12075
+ });
12076
+
12077
+ return special_element;
12078
+ },
12079
+ definitions: []
12080
+ }
12081
+ });
12082
+ }());
12083
+ (function() {
12084
+ $.extend(infopark, {
12085
+ cms_field_element: {
12086
+ create_instance: function(cms_element) {
12087
+ var that = cms_element;
12088
+
11351
12089
  $.extend(that, {
11352
12090
  field_name: function() {
11353
12091
  return that.dom_element().attr('data-ip-field-name');
@@ -11409,28 +12147,40 @@ var infopark = {
11409
12147
  id: function() {
11410
12148
  return id;
11411
12149
  },
12150
+
11412
12151
  obj_class_name: function() {
11413
12152
  return obj_class_name;
11414
12153
  },
11415
12154
 
11416
12155
  save: function(data) {
11417
- var json_data = JSON.stringify({obj: data});
11418
- return infopark.ajax('PUT', 'objs/' + that.id(), {data: json_data}).then(
11419
- function(data, text_status, xhr) { return; }
12156
+ return infopark.ajax('PUT', 'objs/' + that.id(), {data: {obj: data}}).then(
12157
+ function(result) { return; }
11420
12158
  );
11421
12159
  },
11422
12160
 
11423
12161
  destroy: function() {
11424
- return infopark.ajax('DELETE', 'objs/' + that.id()).then(
11425
- function(data, text_status, xhr) { return data; }
11426
- );
12162
+ return infopark.ajax('DELETE', 'objs/' + that.id());
11427
12163
  }
11428
12164
  };
11429
12165
 
11430
12166
  return that;
11431
12167
  },
11432
12168
 
11433
- current_container_id: null
12169
+ create: function(data) {
12170
+ return infopark.ajax('POST', 'objs', {data: {obj: data}}).then(
12171
+ function(new_data) {
12172
+ return infopark.obj.create_instance(new_data.id, new_data._obj_class);
12173
+ }
12174
+ );
12175
+ },
12176
+
12177
+ current_page_id: null,
12178
+
12179
+ current_page: function() {
12180
+ if (infopark.obj.current_page_id) {
12181
+ return infopark.obj.create_instance(infopark.obj.current_page_id);
12182
+ }
12183
+ }
11434
12184
  }
11435
12185
  });
11436
12186
  }());
@@ -11514,17 +12264,18 @@ var infopark = {
11514
12264
  },
11515
12265
 
11516
12266
  create_widget: function(widget_class) {
11517
- var data = JSON.stringify({
12267
+ var url = 'objs/' + that.obj().id() + '/create_widget';
12268
+ var data = {
11518
12269
  obj_class: widget_class,
11519
- container_id: infopark.obj.current_container_id,
12270
+ current_page_id: infopark.obj.current_page().id(),
11520
12271
  field_name: that.field_name()
11521
- });
12272
+ };
11522
12273
 
11523
- var url = 'objs/' + that.obj().id() + '/create_widget';
11524
- return infopark.ajax('POST', url, {data: data}).then(
11525
- function(data, text_status, xhr) { return data; },
11526
- function(xhr, text_status, error) { return text_status; }
11527
- );
12274
+ return infopark.ajax('POST', url, {data: data});
12275
+ },
12276
+
12277
+ fetch_widget_class_selection: function() {
12278
+ return infopark.ajax('GET', 'objs/_/widget_class_selection');
11528
12279
  }
11529
12280
  });
11530
12281
 
@@ -11542,6 +12293,54 @@ var infopark = {
11542
12293
 
11543
12294
  infopark.cms_element.definitions.push(infopark.widget_field_element);
11544
12295
  }());
12296
+ (function() {
12297
+ $.extend(infopark, {
12298
+ workspace: {
12299
+ from_data: function(data) {
12300
+ var that = {
12301
+ id: function() {
12302
+ return data.id;
12303
+ },
12304
+ title: function() {
12305
+ return data.title;
12306
+ },
12307
+ is_editable: function() {
12308
+ return that.id() !== 'published';
12309
+ },
12310
+ publish: function() {
12311
+ if (that.is_editable()) {
12312
+ return infopark.ajax('PUT', 'workspaces/' + that.id() + '/publish');
12313
+ } else {
12314
+ throw "publish not allowed for already published contents";
12315
+ }
12316
+ },
12317
+ rename: function(new_title) {
12318
+ return infopark.ajax('PUT', 'workspaces/' + that.id(),
12319
+ {data: {workspace: {title: new_title}}});
12320
+ },
12321
+ destroy: function() {
12322
+ return infopark.ajax('DELETE', 'workspaces/' + that.id());
12323
+ }
12324
+ };
12325
+
12326
+ return that;
12327
+ },
12328
+ all: function() {
12329
+ return infopark.ajax('GET', 'workspaces').then(function(ws_data) {
12330
+ return _.map(ws_data.results, function(workspace) {
12331
+ return infopark.workspace.from_data(workspace);
12332
+ });
12333
+ });
12334
+ },
12335
+ create: function(title) {
12336
+ return infopark.ajax('POST', 'workspaces', {data: {workspace: {title: title}}}).
12337
+ then(function(ws_data) {
12338
+ return infopark.workspace.from_data(ws_data);
12339
+ });
12340
+ }
12341
+ }
12342
+ });
12343
+ }());
11545
12344
  (function() {
11546
12345
  $.extend(infopark, {
11547
12346
  /*
@@ -11575,6 +12374,9 @@ var infopark = {
11575
12374
  var save_action = function(obj, event, key) {
11576
12375
  obj.$box.addClass('ip_field_saving');
11577
12376
 
12377
+ if (!obj.opts.visual) {
12378
+ obj.toggle();
12379
+ }
11578
12380
  var item = infopark.cms_element.from_dom_element(obj.$content);
11579
12381
  item.save().done(function() {
11580
12382
  obj.$editor.destroyEditor();
@@ -11649,24 +12451,28 @@ var infopark = {
11649
12451
  };
11650
12452
 
11651
12453
  var add_onclick_redactor_handlers = function() {
11652
- _.each(cms_fields(), function(cms_field) {
11653
- var redactor_options = redactor_options_for_type(cms_field.field_type());
11654
- var dom_item = cms_field.dom_element();
11655
- if (redactor_options !== null) {
11656
- if(!($(dom_item).hasClass('ip_field_editable'))) {
11657
- $(dom_item).addClass('ip_field_editable');
11658
-
11659
- $(dom_item).on('click.ip-editing', function(e) {
11660
- e.preventDefault();
11661
-
11662
- if($(dom_item).data('redactor') === undefined) {
11663
- $(dom_item).html($(dom_item).attr('data-ip-field-original-content'));
11664
- $(dom_item).redactor(redactor_options);
11665
- }
11666
- });
12454
+ if (infopark.editing.workspace().is_editable()) {
12455
+ _.each(cms_fields(), function(cms_field) {
12456
+ var redactor_options = redactor_options_for_type(cms_field.field_type());
12457
+ var dom_item = cms_field.dom_element();
12458
+ if (redactor_options !== null) {
12459
+ if(!($(dom_item).hasClass('ip_field_editable'))) {
12460
+ $(dom_item).addClass('ip_field_editable');
12461
+
12462
+ $(dom_item).on('click.ip-editing', function(e) {
12463
+ e.preventDefault();
12464
+
12465
+ infopark.inplace_menus.close_all_menus();
12466
+
12467
+ if($(dom_item).data('redactor') === undefined) {
12468
+ $(dom_item).html($(dom_item).attr('data-ip-field-original-content'));
12469
+ $(dom_item).redactor(redactor_options);
12470
+ }
12471
+ });
12472
+ }
11667
12473
  }
11668
- }
11669
- });
12474
+ });
12475
+ }
11670
12476
  };
11671
12477
 
11672
12478
  $.extend(infopark, {
@@ -11817,7 +12623,7 @@ var infopark = {
11817
12623
  }
11818
12624
  if(template === undefined) {
11819
12625
  if(infopark.template.load_templates_from_server) {
11820
- var url = "/app/assets/javascripts/templates/" + template_path + ".hbs";
12626
+ var url = "/app/assets/javascripts/templates/" + template_path + ".hbs?" + Math.random();
11821
12627
  var source = jQuery.ajax(url, { async: false }).responseText;
11822
12628
  template = Handlebars.compile(source);
11823
12629
  } else {
@@ -11888,7 +12694,9 @@ var infopark = {
11888
12694
  if (view) {
11889
12695
  infopark.transition(view, function() {
11890
12696
  view.removeClass('show');
11891
- }).then(function() {
12697
+ }).then(function(e) {
12698
+ // Remove the view only if event is triggered by a "fade-out" transition.
12699
+ if (e && $(e.target).hasClass('show')) { return; }
11892
12700
  view.remove();
11893
12701
  view = null;
11894
12702
  });
@@ -11917,90 +12725,177 @@ var infopark = {
11917
12725
 
11918
12726
  $.extend(infopark.confirmation_dialog, {
11919
12727
  open: function(options) {
12728
+ if(!options.icon) {
12729
+ options.icon = '&#xF01D;';
12730
+ }
12731
+ if(!options.cancel_button_text) {
12732
+ options.cancel_button_text = infopark.i18n.translate('cancel');
12733
+ }
12734
+ if(!options.confirm_button_color) {
12735
+ options.confirm_button_color = 'ip_blue';
12736
+ }
12737
+ if(!options.confirm_button_text) {
12738
+ options.confirm_button_text = infopark.i18n.translate('confirm');
12739
+ }
11920
12740
  var view = $(infopark.template.render('confirmation_dialog', options));
11921
12741
 
11922
12742
  $('#ip-editing').append(view);
11923
12743
 
11924
12744
  var deferred = $.Deferred();
11925
12745
 
11926
- view.find('.confirm').on('click', function() {
12746
+ var click_action = function(e) {
12747
+ e.preventDefault();
11927
12748
  close(view);
12749
+ };
12750
+
12751
+ var confirm_action = function(e) {
12752
+ click_action(e);
11928
12753
  deferred.resolve();
11929
- });
12754
+ };
11930
12755
 
11931
- view.find('.cancel').on('click', function() {
11932
- close(view);
12756
+ var cancel_action = function(e) {
12757
+ click_action(e);
11933
12758
  deferred.reject();
11934
- });
12759
+ };
12760
+
12761
+ view.find('.confirm').on('click', confirm_action);
12762
+ view.find('.cancel').on('click', cancel_action);
11935
12763
 
11936
12764
  infopark.transition(view, function() {
11937
12765
  view.addClass('show');
11938
12766
  });
11939
12767
 
11940
- return infopark.with_overlay(deferred);
12768
+ return infopark.with_dialog_behaviour(deferred, {
12769
+ enter: confirm_action,
12770
+ escape: cancel_action
12771
+ });
11941
12772
  }
11942
12773
  });
11943
12774
  }());
11944
12775
  (function() {
11945
12776
  $.extend(infopark, {
11946
- choose_widget_class_dialog: function(widget_field_name) {
11947
- return infopark.choose_widget_class_dialog.open(widget_field_name);
12777
+ prompt_dialog: function(options) {
12778
+ return infopark.prompt_dialog.open(options);
11948
12779
  }
11949
12780
  });
11950
12781
 
11951
- var adjust = function(elem) {
11952
- infopark.center(elem);
11953
- infopark.invalidate_auto_height_for(elem);
11954
- infopark.update_auto_height_for(elem);
12782
+ var close = function(view) {
12783
+ infopark.transition(view, function() {
12784
+ view.removeClass('show');
12785
+ }).then(function() {
12786
+ view.remove();
12787
+ view = null;
12788
+ });
11955
12789
  };
11956
12790
 
11957
- $(window).on('resize', function() {
11958
- _.each($('.ip-choose_widget_class_dialog'), function(elem) {
11959
- adjust($(elem));
11960
- });
12791
+ $.extend(infopark.prompt_dialog, {
12792
+ open: function(options) {
12793
+ if (!options.icon) {
12794
+ options.icon = '&#61468;';
12795
+ }
12796
+ if(!options.cancel_button_text) {
12797
+ options.cancel_button_text = infopark.i18n.translate('cancel');
12798
+ }
12799
+ if(!options.accept_button_text) {
12800
+ options.accept_button_text = infopark.i18n.translate('accept');
12801
+ }
12802
+
12803
+ var view = $(infopark.template.render('prompt_dialog', options));
12804
+
12805
+ $('#ip-editing').append(view);
12806
+
12807
+ var deferred = $.Deferred();
12808
+
12809
+ var click_action = function(e) {
12810
+ e.preventDefault();
12811
+ close(view);
12812
+ };
12813
+
12814
+ var accept_action = function(e) {
12815
+ e.preventDefault();
12816
+ var val = view.find('input').val();
12817
+ if (val) {
12818
+ click_action(e);
12819
+ deferred.resolve(val);
12820
+ }
12821
+ };
12822
+
12823
+ var cancel_action = function(e) {
12824
+ click_action(e);
12825
+ deferred.reject();
12826
+ };
12827
+
12828
+ view.find('.accept').on('click', accept_action);
12829
+ view.find('.cancel').on('click', cancel_action);
12830
+
12831
+ infopark.transition(view, function() {
12832
+ view.find('input').focus();
12833
+ view.addClass('show');
12834
+ });
12835
+
12836
+
12837
+ return infopark.with_dialog_behaviour(deferred, {
12838
+ enter: accept_action,
12839
+ escape: cancel_action
12840
+ });
12841
+ }
12842
+ });
12843
+ }());
12844
+ (function() {
12845
+ $.extend(infopark, {
12846
+ choose_obj_class_dialog: function(obj_class_selection, locale_path) {
12847
+ return infopark.choose_obj_class_dialog.open(obj_class_selection, locale_path);
12848
+ }
11961
12849
  });
11962
12850
 
11963
- var render = function(data) {
11964
- var deferred = $.Deferred();
12851
+ $.extend(infopark.choose_obj_class_dialog, {
12852
+ open: function(obj_class_selection, locale_path) {
12853
+ var deferred = $.Deferred();
11965
12854
 
11966
- var widgets = _.map(data, function(widget_markup, widget_class_name) {
11967
- return {widget_class_name: widget_class_name, widget_markup: widget_markup};
11968
- });
12855
+ var obj_classes = _.map(obj_class_selection, function(markup, name) {
12856
+ return {name: name, markup: markup};
12857
+ });
12858
+
12859
+ var view = $(infopark.template.render('choose_obj_class_dialog', {
12860
+ obj_classes: obj_classes,
12861
+ title: infopark.i18n.translate('choose_obj_class_dialog.' + locale_path + '.title'),
12862
+ description: infopark.i18n.translate('choose_obj_class_dialog.' + locale_path + '.description')
12863
+ }));
11969
12864
 
11970
- var view = $(infopark.template.render('choose_widget_class_dialog', {widgets: widgets}));
12865
+ $('#ip-editing').append(view);
11971
12866
 
11972
- $('#ip-editing').append(view);
12867
+ var accept_action = function(e) {
12868
+ e.preventDefault();
12869
+ close_dialog(view);
12870
+ deferred.resolve($(this).attr('data-ip-obj-class-name'));
12871
+ };
11973
12872
 
11974
- view.find('.ip-widget_thumbnail').on('click', function(e) {
11975
- e.preventDefault();
11976
- $('.ip-widget_thumbnail').removeClass('selected');
11977
- $(this).addClass('selected');
11978
- });
12873
+ var cancel_action = function(e) {
12874
+ e.preventDefault();
12875
+ close_dialog(view);
12876
+ deferred.reject();
12877
+ };
11979
12878
 
11980
- view.find('.confirm').on('click', function() {
11981
- var widget_class_name = view.find('.ip-widget_thumbnail.selected').
11982
- attr('data-ip-widget-class-name');
11983
- if (widget_class_name) {
11984
- close(view);
11985
- deferred.resolve(widget_class_name);
11986
- }
11987
- });
12879
+ view.find('.ip-obj_class_thumbnail').on('click', accept_action);
12880
+ view.find('.cancel').on('click', cancel_action);
11988
12881
 
11989
- view.find('.cancel').on('click', function() {
11990
- close(view);
11991
- deferred.reject();
11992
- });
12882
+ infopark.transition(view, function() {
12883
+ view.addClass('show');
12884
+ });
11993
12885
 
11994
- infopark.transition(view, function() {
11995
- view.addClass('show');
11996
- });
12886
+ adjust_dialog(view);
11997
12887
 
11998
- adjust(view);
12888
+ return infopark.with_dialog_behaviour(deferred, {escape: cancel_action});
12889
+ }
12890
+ });
11999
12891
 
12000
- return deferred;
12892
+ var adjust_dialog = function(view) {
12893
+ infopark.center(view);
12894
+ infopark.invalidate_auto_height_for(view);
12895
+ infopark.update_auto_height_for(view);
12001
12896
  };
12002
12897
 
12003
- var close = function(view) {
12898
+ var close_dialog = function(view) {
12004
12899
  infopark.transition(view, function() {
12005
12900
  view.removeClass('show');
12006
12901
  }).then(function() {
@@ -12009,18 +12904,16 @@ var infopark = {
12009
12904
  });
12010
12905
  };
12011
12906
 
12012
- $.extend(infopark.choose_widget_class_dialog, {
12013
- open: function(widget_field_name) {
12014
- var path = 'objs/_/widget_class_selection';
12015
- return infopark.with_overlay(infopark.ajax('GET', path).then(function(data) {
12016
- return render(data);
12017
- }));
12018
- }
12907
+ $(window).on('resize', function() {
12908
+ _.each($('.ip-choose_obj_class_dialog'), function(elem) {
12909
+ adjust_dialog($(elem));
12910
+ });
12019
12911
  });
12020
12912
  }());
12021
12913
  (function() {
12022
12914
  var menu_define_callbacks = [];
12023
12915
  var dom_elements_with_menu = [];
12916
+ var fade_time = 500;
12024
12917
 
12025
12918
  $.extend(infopark, {
12026
12919
  inplace_menus: {
@@ -12028,13 +12921,10 @@ var infopark = {
12028
12921
  menu_define_callbacks.push(menu_define_callback);
12029
12922
  },
12030
12923
  refresh_positions: function() {
12031
- _.each($('.ip_editing_marker'), function(marker_dom) {
12032
- var marker = $(marker_dom);
12033
- var menu = $('#' + marker.data('infopark-editing-menu-id'));
12034
-
12035
- var widget_position = marker.parent().offset();
12036
- marker.offset(widget_position);
12037
- menu.offset(widget_position);
12924
+ _.each($('.ip_editing_marker_menu'), function(menu_dom) {
12925
+ var menu = $(menu_dom);
12926
+ var marker = $('#' + menu.data('infopark-editing-menu-icon-id'));
12927
+ menu.offset(marker.offset());
12038
12928
  });
12039
12929
  },
12040
12930
  reset_menu_define_callbacks: function() {
@@ -12053,7 +12943,6 @@ var infopark = {
12053
12943
  remove_markers_and_menus();
12054
12944
  });
12055
12945
  },
12056
-
12057
12946
  close_all_menus: function() {
12058
12947
  remove_menus();
12059
12948
  }
@@ -12080,15 +12969,18 @@ var infopark = {
12080
12969
  _.each($(dom_elements_with_menu), function(dom_element, menu_index) {
12081
12970
  if(dom_element.children('.ip_editing_marker').length === 0) {
12082
12971
  var menu_id = 'ip_editing_marker_menu_' + menu_index;
12972
+ var menu_icon_id = 'ip_editing_marker_menu_icon_' + menu_index;
12973
+
12083
12974
  var dom_menu = dom_element.data('infopark-editing-menu');
12084
12975
 
12085
- var menu_icon = $(infopark.template.render('inplace_menu_icon', {}));
12976
+ var menu_icon = $(infopark.template.render('inplace_menu_icon', {
12977
+ menu_icon_id: menu_icon_id
12978
+ }));
12086
12979
  menu_icon.data('infopark-editing-menu-id', menu_id);
12087
12980
  menu_icon.on('click.ip-menu-open', function(e) {
12088
12981
  e.preventDefault();
12089
12982
 
12090
12983
  var menu = $('#' + menu_id);
12091
- var fade_time = 500;
12092
12984
 
12093
12985
  var remove_menu = function() {
12094
12986
  menu.fadeOut(fade_time, function() {
@@ -12117,15 +13009,18 @@ var infopark = {
12117
13009
  });
12118
13010
  });
12119
13011
 
12120
- menu.offset(menu_icon.offset());
12121
- menu.fadeIn(fade_time);
13012
+ menu.data('infopark-editing-menu-icon-id', menu_icon_id);
12122
13013
 
12123
13014
  $('body').append(menu);
13015
+
13016
+ // Bugfix IE: offset can not be set before append.
13017
+ menu.offset(menu_icon.offset());
13018
+ menu.find('.ip_menu_box').fadeIn(fade_time);
12124
13019
  } else {
12125
13020
  remove_menu();
12126
13021
  }
12127
13022
  });
12128
- dom_element.append(menu_icon);
13023
+ dom_element.prepend(menu_icon);
12129
13024
  }
12130
13025
  });
12131
13026
  };
@@ -12136,7 +13031,9 @@ var infopark = {
12136
13031
  };
12137
13032
 
12138
13033
  var remove_menus = function() {
12139
- $('.ip_editing_marker_menu').remove();
13034
+ $('.ip_editing_marker_menu').fadeOut(fade_time, function() {
13035
+ $('.ip_editing_marker_menu').remove();
13036
+ });
12140
13037
  _.each($(dom_elements_with_menu), function(dom_element) {
12141
13038
  dom_element.removeData('infopark-editing-menu');
12142
13039
  });
@@ -12151,51 +13048,84 @@ var infopark = {
12151
13048
  };
12152
13049
  }());
12153
13050
 
12154
- $(window).resize(function () { infopark.inplace_menus.refresh_positions(); });
13051
+ $(window).on('resize', function () { infopark.inplace_menus.refresh_positions(); });
13052
+ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); });
12155
13053
  (function() {
12156
13054
  $.extend(infopark, {
12157
13055
  commands: {
12158
13056
 
13057
+ new_child_page: function(child_list_element) {
13058
+ return child_list_element.fetch_page_class_selection().then(function(selection) {
13059
+ return infopark.choose_obj_class_dialog(selection, 'add_child_page').then(
13060
+ function(obj_class) {
13061
+ return infopark.with_saving_overlay(
13062
+ child_list_element.create_child(obj_class).then(function(new_obj) {
13063
+ return infopark.redirect_to(new_obj.id());
13064
+ })
13065
+ );
13066
+ }
13067
+ );
13068
+ });
13069
+ },
13070
+
13071
+ delete_obj: function(obj) {
13072
+ return infopark.confirmation_dialog({
13073
+ title: infopark.i18n.translate('commands.delete_obj.confirm_title'),
13074
+ description: infopark.i18n.translate('commands.delete_obj.confirm_description')
13075
+ }).then(function() {
13076
+ return infopark.with_saving_overlay(obj.destroy().then(function() {
13077
+ return infopark.redirect_to('/');
13078
+ }));
13079
+ });
13080
+ },
13081
+
12159
13082
  add_widget: function(widget_field_element, widget_element) {
12160
- return function() {
12161
- return infopark.choose_widget_class_dialog().then(function(widget_class) {
12162
- infopark.with_saving_overlay(widget_field_element.create_widget(widget_class).
12163
- then(function(data) {
12164
- if (widget_element) {
12165
- widget_element.dom_element().after(data.markup);
12166
- } else {
12167
- widget_field_element.dom_element().append(data.markup);
12168
- }
12169
- infopark.editing.refresh();
12170
- return widget_field_element.save();
12171
- }));
13083
+ return widget_field_element.fetch_widget_class_selection().then(function(selection) {
13084
+ return infopark.choose_obj_class_dialog(selection, 'add_widget').then(function(obj_class) {
13085
+ var new_dom_element;
13086
+ infopark.with_saving_overlay(
13087
+ widget_field_element.create_widget(obj_class).then(function(data) {
13088
+ new_dom_element = $(data.markup);
13089
+ if (widget_element) {
13090
+ widget_element.dom_element().after(new_dom_element);
13091
+ } else {
13092
+ widget_field_element.dom_element().append(new_dom_element);
13093
+ }
13094
+ infopark.editing.refresh();
13095
+ return widget_field_element.save();
13096
+ })
13097
+ ).then(function() {
13098
+ infopark.ensure_fully_visible_within(new_dom_element, $('body'), $(window).height());
13099
+ });
12172
13100
  });
12173
- };
13101
+ });
12174
13102
  },
12175
13103
 
12176
13104
  delete_widget: function(widget_field_element, widget_element) {
12177
- return function() {
12178
- return infopark.confirmation_dialog({
12179
- title: infopark.i18n.translate('commands.delete_widget.confirm_title'),
12180
- description: infopark.i18n.translate('commands.delete_widget.confirm_description')
12181
- }).then(function() {
12182
- var delete_widget = function() {
12183
- widget_element.dom_element().remove();
12184
- infopark.editing.refresh();
12185
- return widget_field_element.save().then(function() {
12186
- return widget_element.obj().destroy();
12187
- });
12188
- };
12189
- infopark.with_saving_overlay(delete_widget());
12190
- });
12191
- };
13105
+ return infopark.confirmation_dialog({
13106
+ icon: '&#xF018;',
13107
+ confirm_button_color: 'ip_red',
13108
+ confirm_button_text: infopark.i18n.translate('menu_bar.delete'),
13109
+ title: infopark.i18n.translate('commands.delete_widget.confirm_title'),
13110
+ description: infopark.i18n.translate('commands.delete_widget.confirm_description')
13111
+ }).then(function() {
13112
+ var delete_widget = function() {
13113
+ widget_element.dom_element().remove();
13114
+ infopark.editing.refresh();
13115
+ return widget_field_element.save().then(function() {
13116
+ return widget_element.obj().destroy();
13117
+ });
13118
+ };
13119
+ infopark.with_saving_overlay(delete_widget());
13120
+ });
12192
13121
  },
12193
13122
 
12194
13123
  open_in_admin_gui: function(obj_id) {
12195
- return function() {
12196
- // New window has a name, so it can be easily identified in integration tests.
12197
- window.open(infopark.admin_gui_base_url + '#' + obj_id + ';dc', 'admin-gui', '_blank');
12198
- };
13124
+ window.open(
13125
+ infopark.admin_gui_base_url + '#' + obj_id + ';dc;' + infopark.editing.workspace().id(),
13126
+ 'admin-gui', // New window has a name, so it can be identified in integration tests.
13127
+ 'status=1,toolbar=1,location=1,menubar=1,scrollbars=1,resizable=1'
13128
+ );
12199
13129
  }
12200
13130
 
12201
13131
  }
@@ -12206,39 +13136,47 @@ $(window).resize(function () { infopark.inplace_menus.refresh_positions(); });
12206
13136
  widget_menus: {
12207
13137
  init: function() {
12208
13138
  infopark.inplace_menus.define(function(menu) {
12209
- _.each(infopark.widget_field_element.all(), function(widget_field_element) {
12210
- var widget_elements = widget_field_element.widgets();
12211
-
12212
- if (widget_elements.length === 0) {
12213
- menu.add_item(widget_field_element.dom_element(), {
12214
- title: infopark.i18n.translate('widget_menus.add_widget'),
12215
- icon: '\uF022',
12216
- execute: infopark.commands.add_widget(widget_field_element)
12217
- });
12218
- }
12219
-
12220
- _.each(widget_elements, function(widget_element) {
12221
- var widget_dom_element = widget_element.dom_element();
12222
-
12223
- menu.add_item(widget_dom_element, {
12224
- title: infopark.i18n.translate('widget_menus.add_widget'),
12225
- icon: '\uF022',
12226
- execute: infopark.commands.add_widget(widget_field_element, widget_element)
12227
- });
12228
-
12229
- menu.add_item(widget_dom_element, {
12230
- title: infopark.i18n.translate('widget_menus.delete_widget'),
12231
- icon: '\uF03E',
12232
- execute: infopark.commands.delete_widget(widget_field_element, widget_element)
12233
- });
13139
+ if (infopark.editing.workspace().is_editable()) {
13140
+ _.each(infopark.widget_field_element.all(), function(widget_field_element) {
13141
+ var widget_elements = widget_field_element.widgets();
13142
+
13143
+ if (widget_elements.length === 0) {
13144
+ menu.add_item(widget_field_element.dom_element(), {
13145
+ title: infopark.i18n.translate('widget_menus.add_widget'),
13146
+ icon: '\uF022',
13147
+ execute: function() { infopark.commands.add_widget(widget_field_element); }
13148
+ });
13149
+ }
12234
13150
 
12235
- menu.add_item(widget_dom_element, {
12236
- title: infopark.i18n.translate('widget_menus.open_in_admin_gui'),
12237
- icon: '\uF000',
12238
- execute: infopark.commands.open_in_admin_gui(widget_element.obj().id())
13151
+ _.each(widget_elements, function(widget_element) {
13152
+ var widget_dom_element = widget_element.dom_element();
13153
+
13154
+ menu.add_item(widget_dom_element, {
13155
+ title: infopark.i18n.translate('widget_menus.add_widget'),
13156
+ icon: '\uF022',
13157
+ execute: function() {
13158
+ infopark.commands.add_widget(widget_field_element, widget_element);
13159
+ }
13160
+ });
13161
+
13162
+ menu.add_item(widget_dom_element, {
13163
+ title: infopark.i18n.translate('widget_menus.delete_widget'),
13164
+ icon: '\uF018',
13165
+ execute: function() {
13166
+ infopark.commands.delete_widget(widget_field_element, widget_element);
13167
+ }
13168
+ });
13169
+
13170
+ menu.add_item(widget_dom_element, {
13171
+ title: infopark.i18n.translate('widget_menus.open_in_admin_gui'),
13172
+ icon: '\uF000',
13173
+ execute: function() {
13174
+ infopark.commands.open_in_admin_gui(widget_element.obj().id());
13175
+ }
13176
+ });
12239
13177
  });
12240
13178
  });
12241
- });
13179
+ }
12242
13180
  });
12243
13181
  }
12244
13182
  }
@@ -12256,8 +13194,6 @@ $(window).resize(function () { infopark.inplace_menus.refresh_positions(); });
12256
13194
  // Called when actual dragging started.
12257
13195
  activate: function(event, ui) {
12258
13196
  var marker = ui.item.find('.ip_editing_marker');
12259
- marker.css('top', 0);
12260
- marker.css('left', 0);
12261
13197
  $('.ip_editing_marker').not(marker).hide();
12262
13198
  infopark.inplace_menus.close_all_menus();
12263
13199
  },
@@ -12277,11 +13213,11 @@ $(window).resize(function () { infopark.inplace_menus.refresh_positions(); });
12277
13213
  }
12278
13214
  });
12279
13215
 
12280
- var dom_elements_with_sorting = [];
12281
-
12282
13216
  var create_or_refresh_widget_sorting = function() {
12283
- remove_widget_sorting();
12284
- create_widget_sorting();
13217
+ if (infopark.editing.workspace().is_editable()) {
13218
+ remove_widget_sorting();
13219
+ create_widget_sorting();
13220
+ }
12285
13221
  };
12286
13222
 
12287
13223
  var create_widget_sorting = function() {
@@ -12296,17 +13232,165 @@ $(window).resize(function () { infopark.inplace_menus.refresh_positions(); });
12296
13232
  deactivate: infopark.widget_sorting.deactivate,
12297
13233
  update: infopark.widget_sorting.update
12298
13234
  });
12299
-
12300
- dom_elements_with_sorting.push(dom_element);
12301
13235
  });
12302
13236
  };
12303
13237
 
12304
13238
  var remove_widget_sorting = function() {
12305
- _.each(dom_elements_with_sorting, function(dom_element) {
12306
- dom_element.sortable('destroy');
13239
+ _.each(infopark.widget_field_element.all(), function(widget_field_element) {
13240
+ var dom_element = widget_field_element.dom_element();
13241
+ if (dom_element.data('ui-sortable')) {
13242
+ dom_element.sortable('destroy');
13243
+ }
13244
+ });
13245
+ };
13246
+ }());
13247
+ (function() {
13248
+ $.extend(infopark, {
13249
+ child_list_menus: {
13250
+ init: function() {
13251
+ infopark.inplace_menus.define(function(menu) {
13252
+ if (infopark.editing.workspace().is_editable()) {
13253
+ _.each(infopark.child_list_element.all(), function(child_list_element) {
13254
+ menu.add_item(child_list_element.dom_element(), {
13255
+ title: infopark.i18n.translate('child_list_menus.add_subpage'),
13256
+ icon: '\uF022',
13257
+ execute: function() { infopark.commands.new_child_page(child_list_element); }
13258
+ });
13259
+ });
13260
+ }
13261
+ });
13262
+ }
13263
+ }
13264
+ });
13265
+ }());
13266
+ (function() {
13267
+ $.extend(infopark, {
13268
+ hotkeys: {
13269
+ add_actions_while: function(promise, key_map) {
13270
+ var key_actions = {
13271
+ 13: key_map.enter, // enter key
13272
+ 27: key_map.escape // escape key
13273
+ };
13274
+
13275
+ $(document).on('keyup.ip_hotkeys_add_actions_while', function(e) {
13276
+ if (key_actions[e.keyCode]) {
13277
+ e.preventDefault();
13278
+ key_actions[e.keyCode](e);
13279
+ }
13280
+ });
13281
+
13282
+ return promise.always(function() {
13283
+ $(document).off('keyup.ip_hotkeys_add_actions_while');
13284
+ });
13285
+ }
13286
+ }
13287
+ });
13288
+ }());
13289
+ (function() {
13290
+ $.extend(infopark, {
13291
+ with_dialog_behaviour: function(promise, key_map) {
13292
+ return infopark.with_overlay(
13293
+ infopark.hotkeys.add_actions_while(promise, key_map)
13294
+ );
13295
+ }
13296
+ });
13297
+ }());
13298
+ (function() {
13299
+
13300
+ $.extend(infopark, {
13301
+ image_upload: {
13302
+ init: function() {
13303
+ infopark.editing.on('activate', create_or_refresh_image_upload);
13304
+ infopark.editing.on('refresh', create_or_refresh_image_upload);
13305
+ infopark.editing.on('deactivate', remove_image_upload);
13306
+
13307
+ // Disable DnD for all elements by default to prevent the user
13308
+ // from accidentally opening an image in browser.
13309
+ $('body').on('dragover', function(e) { return false; });
13310
+ $('body').on('drop', function(e) { return false; });
13311
+ },
13312
+
13313
+ upload_image: function(event, dom_element) {
13314
+ var data_transfer = event.originalEvent.dataTransfer;
13315
+ if (!data_transfer) { return; }
13316
+
13317
+ var files = data_transfer.files;
13318
+ if (files.length === 0) {
13319
+ return;
13320
+ } else if (files.length > 1) {
13321
+ infopark.alert(infopark.i18n.translate('image_upload.too_many_files'));
13322
+ dom_element.removeClass('ip_editing_dragover');
13323
+ return;
13324
+ }
13325
+
13326
+ var file = files[0];
13327
+ var obj_id = dom_element.attr('data-ip-resource-source-obj-id');
13328
+ var field_name = dom_element.attr('data-ip-resource-source-field-name');
13329
+
13330
+ var create_resource_obj = function(blob_id) {
13331
+ var obj_name = file.name.replace(/[^a-z0-9_.$\-]/ig, '-');
13332
+ var path = '_resources/' + infopark.random_hex() + '/' + obj_name;
13333
+ return infopark.obj.create({ blob: blob_id, _path: path, _obj_class: 'Image' });
13334
+ };
13335
+
13336
+ var link_resource_obj = function(resource_id) {
13337
+ var attributes = {};
13338
+ attributes[field_name] = [{obj_id: resource_id}];
13339
+ return infopark.obj.create_instance(obj_id).save(attributes);
13340
+ };
13341
+
13342
+ infopark.with_saving_overlay(
13343
+ infopark.blob.create(file).then(function(blob_id) {
13344
+ return create_resource_obj(blob_id).then(function(resource_data) {
13345
+ return link_resource_obj(resource_data.id()).then(function() {
13346
+ return infopark.reload();
13347
+ });
13348
+ });
13349
+ })
13350
+ );
13351
+ }
13352
+
13353
+ }
13354
+ });
13355
+
13356
+ var create_or_refresh_image_upload = function() {
13357
+ remove_image_upload();
13358
+ create_image_upload();
13359
+ };
13360
+
13361
+ var create_image_upload = function() {
13362
+ each_dom_element(function(dom_element) {
13363
+ dom_element.on('dragover', function() {
13364
+ dom_element.addClass('ip_editing_dragover');
13365
+ return false;
13366
+ });
13367
+
13368
+ dom_element.on('dragleave', function() {
13369
+ dom_element.removeClass('ip_editing_dragover');
13370
+ return false;
13371
+ });
13372
+
13373
+ dom_element.on('drop', function(event) {
13374
+ infopark.image_upload.upload_image(event, dom_element);
13375
+ return false;
13376
+ });
13377
+ });
13378
+ };
13379
+
13380
+ var remove_image_upload = function() {
13381
+ each_dom_element(function(dom_element) {
13382
+ dom_element.unbind('dragover');
13383
+ dom_element.unbind('dragleave');
13384
+ dom_element.unbind('drop');
12307
13385
  });
12308
- dom_elements_with_sorting = [];
12309
13386
  };
13387
+
13388
+ var each_dom_element = function(callback) {
13389
+ _.each($('img[data-ip-resource-source-field-name]'), function(dom_element) {
13390
+ callback($(dom_element));
13391
+ });
13392
+ };
13393
+
12310
13394
  }());
12311
13395
 
12312
13396
 
@@ -12332,6 +13416,15 @@ $(window).resize(function () { infopark.inplace_menus.refresh_positions(); });
12332
13416
 
12333
13417
 
12334
13418
 
13419
+
13420
+
13421
+
13422
+
13423
+
13424
+
13425
+
13426
+
13427
+
12335
13428
 
12336
13429
 
12337
13430
 
@@ -12344,5 +13437,11 @@ $(window).resize(function () { infopark.inplace_menus.refresh_positions(); });
12344
13437
 
12345
13438
  infopark.redactor.init();
12346
13439
  infopark.inplace_menus.init();
13440
+ infopark.deactivate_menu_bar_item.init();
13441
+ infopark.delete_current_page_item.init();
13442
+ infopark.workspace_select.init();
13443
+ infopark.menu_bar.init();
12347
13444
  infopark.widget_menus.init();
12348
13445
  infopark.widget_sorting.init();
13446
+ infopark.image_upload.init();
13447
+ infopark.child_list_menus.init();