scrivito_sdk 0.18.1 → 0.30.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/scrivito/blobs_controller.rb +1 -2
  3. data/app/controllers/scrivito/default_cms_controller.rb +9 -75
  4. data/app/controllers/scrivito/objs_controller.rb +107 -119
  5. data/app/controllers/scrivito/tasks_controller.rb +1 -1
  6. data/app/controllers/scrivito/users_controller.rb +1 -1
  7. data/app/controllers/scrivito/webservice_controller.rb +6 -2
  8. data/app/controllers/scrivito/workspaces_controller.rb +57 -17
  9. data/app/helpers/scrivito_helper.rb +285 -0
  10. data/app/views/google_maps_widget/show.html.erb +1 -0
  11. data/app/views/scrivito/_editing_auth_warning.html.erb +43 -0
  12. data/app/views/scrivito/blobs/upload_permission.json.jbuilder +1 -0
  13. data/app/views/scrivito/objs/copy.json.jbuilder +1 -0
  14. data/app/views/scrivito/objs/copy_widget.html.erb +1 -1
  15. data/app/views/scrivito/objs/create.json.jbuilder +1 -0
  16. data/app/views/scrivito/objs/create_widget.html.erb +1 -1
  17. data/app/views/scrivito/objs/details.json.jbuilder +1 -0
  18. data/app/views/scrivito/objs/format_missing_error.json.jbuilder +1 -0
  19. data/app/views/scrivito/objs/modification.json.jbuilder +1 -0
  20. data/app/views/scrivito/objs/page_class_selection.json.jbuilder +1 -0
  21. data/app/views/scrivito/objs/search.json.jbuilder +6 -0
  22. data/app/views/scrivito/objs/search_only_size.json.jbuilder +1 -0
  23. data/app/views/scrivito/objs/update.json.jbuilder +1 -0
  24. data/app/views/scrivito/objs/widget_class_selection.json.jbuilder +1 -0
  25. data/app/views/scrivito/objs/widget_modification.json.jbuilder +1 -0
  26. data/app/views/scrivito/tasks/show.json.jbuilder +3 -0
  27. data/app/views/scrivito/users/suggest.json.jbuilder +1 -0
  28. data/app/views/scrivito/webservice/empty.json +1 -0
  29. data/app/views/scrivito/webservice/error.json.jbuilder +2 -0
  30. data/app/views/scrivito/workspaces/_workspace.json.jbuilder +5 -0
  31. data/app/views/scrivito/workspaces/check.json.jbuilder +1 -0
  32. data/app/views/scrivito/workspaces/create.json.jbuilder +1 -0
  33. data/app/views/scrivito/workspaces/index.json.jbuilder +1 -0
  34. data/app/views/scrivito/workspaces/show.json.jbuilder +1 -0
  35. data/app/views/scrivito/workspaces/task.json.jbuilder +5 -0
  36. data/config/ca-bundle.crt +259 -234
  37. data/config/cms_routes.rb +2 -2
  38. data/config/routes.rb +3 -0
  39. data/lib/assets/javascripts/{scrivito_editing.js → scrivito_sdk.js} +1662 -1180
  40. data/lib/assets/stylesheets/{scrivito_editing.css → scrivito_sdk.css} +242 -6
  41. data/lib/generators/scrivito/install/install_generator.rb +62 -0
  42. data/lib/generators/scrivito/install/templates/app/controllers/cms_controller.rb +3 -0
  43. data/lib/generators/scrivito/install/templates/app/controllers/page_controller.rb +2 -0
  44. data/lib/generators/scrivito/install/templates/app/models/headline_widget.rb +7 -0
  45. data/lib/generators/scrivito/install/templates/app/models/image.rb +5 -0
  46. data/lib/generators/scrivito/install/templates/app/models/image_widget.rb +7 -0
  47. data/lib/generators/scrivito/install/templates/app/models/obj.rb +2 -0
  48. data/lib/generators/scrivito/install/templates/app/models/page.rb +8 -0
  49. data/lib/generators/scrivito/install/templates/app/models/text_widget.rb +7 -0
  50. data/lib/generators/scrivito/install/templates/app/models/widget.rb +2 -0
  51. data/lib/generators/scrivito/install/templates/app/views/headline_widget/show.html.erb +1 -0
  52. data/lib/generators/scrivito/install/templates/app/views/headline_widget/thumbnail.html.erb +3 -0
  53. data/lib/generators/scrivito/install/templates/app/views/image_widget/show.html.erb +1 -0
  54. data/lib/generators/scrivito/install/templates/app/views/image_widget/thumbnail.html.erb +3 -0
  55. data/lib/generators/scrivito/install/templates/app/views/page/details.html.erb +1 -0
  56. data/lib/generators/scrivito/install/templates/app/views/page/index.html.erb +16 -0
  57. data/lib/generators/scrivito/install/templates/app/views/page/thumbnail.html.erb +3 -0
  58. data/lib/generators/scrivito/install/templates/app/views/text_widget/show.html.erb +1 -0
  59. data/lib/generators/scrivito/install/templates/app/views/text_widget/thumbnail.html.erb +3 -0
  60. data/lib/generators/scrivito/install/templates/config/initializers/scrivito.rb +10 -0
  61. data/lib/generators/scrivito/install/templates/scrivito/migrate/install_scrivito.rb +49 -0
  62. data/lib/generators/scrivito/migration/USAGE +9 -0
  63. data/lib/generators/{cms → scrivito}/migration/migration_generator.rb +4 -9
  64. data/lib/generators/{cms → scrivito}/migration/templates/migration.erb +3 -3
  65. data/lib/generators/{cms → scrivito}/widget/templates/details.html.erb +0 -0
  66. data/lib/generators/{cms → scrivito}/widget/templates/migration.erb +0 -0
  67. data/lib/generators/{cms → scrivito}/widget/templates/model.erb +0 -0
  68. data/lib/generators/{cms → scrivito}/widget/templates/show.html.erb +0 -0
  69. data/lib/generators/scrivito/widget/templates/thumbnail.html.erb +3 -0
  70. data/lib/generators/{cms → scrivito}/widget/widget_generator.rb +3 -2
  71. data/lib/obj.rb +17 -3
  72. data/lib/scrivito/attribute_collection.rb +7 -12
  73. data/lib/scrivito/attribute_content.rb +31 -12
  74. data/lib/scrivito/basic_obj.rb +186 -96
  75. data/lib/scrivito/basic_widget.rb +25 -10
  76. data/lib/scrivito/binary.rb +75 -0
  77. data/lib/scrivito/cache_garbage_collector.rb +19 -4
  78. data/lib/scrivito/child_list_tag.rb +108 -0
  79. data/lib/scrivito/client_config.rb +2 -1
  80. data/lib/scrivito/client_error.rb +3 -2
  81. data/lib/scrivito/cms_backend.rb +81 -16
  82. data/lib/scrivito/cms_dispatch_controller.rb +7 -0
  83. data/lib/scrivito/cms_env.rb +0 -2
  84. data/lib/scrivito/cms_field_tag.rb +44 -35
  85. data/lib/scrivito/cms_rest_api.rb +23 -6
  86. data/lib/scrivito/cms_rest_api/attribute_serializer.rb +1 -1
  87. data/lib/scrivito/cms_routing.rb +120 -0
  88. data/lib/scrivito/configuration.rb +69 -58
  89. data/lib/scrivito/connection_manager.rb +30 -1
  90. data/lib/scrivito/content_service.rb +10 -7
  91. data/lib/scrivito/controller_actions.rb +108 -0
  92. data/lib/scrivito/diff.rb +30 -15
  93. data/lib/scrivito/editing_context.rb +4 -0
  94. data/lib/scrivito/editing_context_helper.rb +19 -0
  95. data/lib/scrivito/editing_context_middleware.rb +20 -1
  96. data/lib/scrivito/image_tag_helper.rb +44 -0
  97. data/lib/scrivito/layout_tags.rb +33 -0
  98. data/lib/scrivito/link.rb +4 -2
  99. data/lib/scrivito/membership.rb +0 -8
  100. data/lib/scrivito/migrations.rb +0 -1
  101. data/lib/scrivito/migrations/installer.rb +1 -1
  102. data/lib/scrivito/migrations/migration.rb +0 -2
  103. data/lib/scrivito/migrations/migrator.rb +2 -3
  104. data/lib/scrivito/obj_class.rb +64 -16
  105. data/lib/scrivito/obj_class_data.rb +4 -0
  106. data/lib/scrivito/obj_search_enumerator.rb +1 -1
  107. data/lib/scrivito/routing_helper.rb +42 -0
  108. data/lib/scrivito/{engine.rb → sdk_engine.rb} +15 -29
  109. data/lib/scrivito/tag_renderer.rb +40 -0
  110. data/lib/scrivito/test_request.rb +40 -0
  111. data/lib/scrivito/type_computer.rb +1 -6
  112. data/lib/scrivito/user.rb +33 -15
  113. data/lib/scrivito/user_definition.rb +34 -6
  114. data/lib/scrivito/widget_tag.rb +67 -0
  115. data/lib/scrivito/workspace.rb +12 -24
  116. data/lib/scrivito_sdk.rb +17 -1
  117. data/lib/tasks/cache.rake +4 -5
  118. data/lib/tasks/migration.rake +1 -1
  119. data/lib/widget.rb +21 -3
  120. metadata +119 -70
  121. data/README +0 -6
  122. data/app/controllers/cms_controller.rb +0 -7
  123. data/app/helpers/cms_helper.rb +0 -7
  124. data/app/helpers/cms_routing_helper.rb +0 -7
  125. data/app/helpers/scrivito/cms_asset_helper.rb +0 -110
  126. data/app/helpers/scrivito/cms_tag_helper.rb +0 -232
  127. data/app/helpers/scrivito/default_cms_helper.rb +0 -21
  128. data/app/helpers/scrivito/default_cms_routing_helper.rb +0 -128
  129. data/app/helpers/scrivito/display_helper.rb +0 -64
  130. data/app/helpers/scrivito/editing_helper.rb +0 -32
  131. data/app/helpers/scrivito/layout_helper.rb +0 -21
  132. data/app/models/named_link.rb +0 -2
  133. data/app/views/cms/_index.html.erb +0 -7
  134. data/app/views/cms/index.html.erb +0 -1
  135. data/app/views/scrivito/_editing_javascript.html.erb +0 -7
  136. data/app/views/scrivito/default_cms/show_widget.html.erb +0 -1
  137. data/lib/assets/stylesheets/scrivito.css +0 -199
  138. data/lib/generators/cms/migration/USAGE +0 -9
  139. data/lib/generators/cms/widget/templates/thumbnail.html.erb +0 -2
  140. data/lib/scrivito/blob.rb +0 -48
  141. data/lib/scrivito/cms_accessible.rb +0 -30
  142. data/lib/scrivito/cms_rest_api/blob_uploader.rb +0 -18
  143. data/lib/scrivito/cms_test_request.rb +0 -23
  144. data/lib/scrivito/migrations/migration_dsl.rb +0 -180
@@ -1,5 +1,5 @@
1
1
  Rails.application.routes.draw do
2
- get '/' => 'scrivito/cms_dispatch#index', as: 'cms_root'
2
+ get '/' => 'scrivito/cms_dispatch#index', as: :scrivito_root
3
3
 
4
4
  get '__scrivito/render_widget/:id/show_widget/:widget_id' => 'scrivito/cms_dispatch#show_widget'
5
5
  get '__scrivito/render_widget/:id/widget_details/:widget_id' => 'scrivito/cms_dispatch#widget_details'
@@ -14,7 +14,7 @@ Rails.application.routes.draw do
14
14
 
15
15
  match '/*permalink',
16
16
  to: 'scrivito/cms_dispatch#index',
17
- as: 'cms_permalink',
17
+ as: :scrivito_permalink,
18
18
  format: false,
19
19
  via: :all
20
20
  end
@@ -9,6 +9,8 @@ Rails.application.routes.draw do
9
9
  member do
10
10
  get :details
11
11
  get :widget_class_selection
12
+ get :modification
13
+ get :widget_modification
12
14
 
13
15
  post :copy
14
16
  post :duplicate
@@ -17,6 +19,7 @@ Rails.application.routes.draw do
17
19
  put :restore
18
20
  put :mark_resolved
19
21
  put :destroy_widget
22
+ put :revert_widget
20
23
  end
21
24
  end
22
25
 
@@ -5403,7 +5403,7 @@ if (typeof module !== 'undefined' && module.exports) {
5403
5403
  }
5404
5404
 
5405
5405
  ;
5406
- // Underscore.js 1.6.0
5406
+ // Underscore.js 1.7.0
5407
5407
  // http://underscorejs.org
5408
5408
  // (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
5409
5409
  // Underscore may be freely distributed under the MIT license.
@@ -5419,9 +5419,6 @@ if (typeof module !== 'undefined' && module.exports) {
5419
5419
  // Save the previous value of the `_` variable.
5420
5420
  var previousUnderscore = root._;
5421
5421
 
5422
- // Establish the object that gets returned to break out of a loop iteration.
5423
- var breaker = {};
5424
-
5425
5422
  // Save bytes in the minified (but not gzipped) version:
5426
5423
  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
5427
5424
 
@@ -5436,15 +5433,6 @@ if (typeof module !== 'undefined' && module.exports) {
5436
5433
  // All **ECMAScript 5** native function implementations that we hope to use
5437
5434
  // are declared here.
5438
5435
  var
5439
- nativeForEach = ArrayProto.forEach,
5440
- nativeMap = ArrayProto.map,
5441
- nativeReduce = ArrayProto.reduce,
5442
- nativeReduceRight = ArrayProto.reduceRight,
5443
- nativeFilter = ArrayProto.filter,
5444
- nativeEvery = ArrayProto.every,
5445
- nativeSome = ArrayProto.some,
5446
- nativeIndexOf = ArrayProto.indexOf,
5447
- nativeLastIndexOf = ArrayProto.lastIndexOf,
5448
5436
  nativeIsArray = Array.isArray,
5449
5437
  nativeKeys = Object.keys,
5450
5438
  nativeBind = FuncProto.bind;
@@ -5458,8 +5446,7 @@ if (typeof module !== 'undefined' && module.exports) {
5458
5446
 
5459
5447
  // Export the Underscore object for **Node.js**, with
5460
5448
  // backwards-compatibility for the old `require()` API. If we're in
5461
- // the browser, add `_` as a global object via a string identifier,
5462
- // for Closure Compiler "advanced" mode.
5449
+ // the browser, add `_` as a global object.
5463
5450
  if (typeof exports !== 'undefined') {
5464
5451
  if (typeof module !== 'undefined' && module.exports) {
5465
5452
  exports = module.exports = _;
@@ -5470,98 +5457,125 @@ if (typeof module !== 'undefined' && module.exports) {
5470
5457
  }
5471
5458
 
5472
5459
  // Current version.
5473
- _.VERSION = '1.6.0';
5460
+ _.VERSION = '1.7.0';
5461
+
5462
+ // Internal function that returns an efficient (for current engines) version
5463
+ // of the passed-in callback, to be repeatedly applied in other Underscore
5464
+ // functions.
5465
+ var createCallback = function(func, context, argCount) {
5466
+ if (context === void 0) return func;
5467
+ switch (argCount == null ? 3 : argCount) {
5468
+ case 1: return function(value) {
5469
+ return func.call(context, value);
5470
+ };
5471
+ case 2: return function(value, other) {
5472
+ return func.call(context, value, other);
5473
+ };
5474
+ case 3: return function(value, index, collection) {
5475
+ return func.call(context, value, index, collection);
5476
+ };
5477
+ case 4: return function(accumulator, value, index, collection) {
5478
+ return func.call(context, accumulator, value, index, collection);
5479
+ };
5480
+ }
5481
+ return function() {
5482
+ return func.apply(context, arguments);
5483
+ };
5484
+ };
5485
+
5486
+ // A mostly-internal function to generate callbacks that can be applied
5487
+ // to each element in a collection, returning the desired result — either
5488
+ // identity, an arbitrary callback, a property matcher, or a property accessor.
5489
+ _.iteratee = function(value, context, argCount) {
5490
+ if (value == null) return _.identity;
5491
+ if (_.isFunction(value)) return createCallback(value, context, argCount);
5492
+ if (_.isObject(value)) return _.matches(value);
5493
+ return _.property(value);
5494
+ };
5474
5495
 
5475
5496
  // Collection Functions
5476
5497
  // --------------------
5477
5498
 
5478
5499
  // The cornerstone, an `each` implementation, aka `forEach`.
5479
- // Handles objects with the built-in `forEach`, arrays, and raw objects.
5480
- // Delegates to **ECMAScript 5**'s native `forEach` if available.
5481
- var each = _.each = _.forEach = function(obj, iterator, context) {
5500
+ // Handles raw objects in addition to array-likes. Treats all
5501
+ // sparse array-likes as if they were dense.
5502
+ _.each = _.forEach = function(obj, iteratee, context) {
5482
5503
  if (obj == null) return obj;
5483
- if (nativeForEach && obj.forEach === nativeForEach) {
5484
- obj.forEach(iterator, context);
5485
- } else if (obj.length === +obj.length) {
5486
- for (var i = 0, length = obj.length; i < length; i++) {
5487
- if (iterator.call(context, obj[i], i, obj) === breaker) return;
5504
+ iteratee = createCallback(iteratee, context);
5505
+ var i, length = obj.length;
5506
+ if (length === +length) {
5507
+ for (i = 0; i < length; i++) {
5508
+ iteratee(obj[i], i, obj);
5488
5509
  }
5489
5510
  } else {
5490
5511
  var keys = _.keys(obj);
5491
- for (var i = 0, length = keys.length; i < length; i++) {
5492
- if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return;
5512
+ for (i = 0, length = keys.length; i < length; i++) {
5513
+ iteratee(obj[keys[i]], keys[i], obj);
5493
5514
  }
5494
5515
  }
5495
5516
  return obj;
5496
5517
  };
5497
5518
 
5498
- // Return the results of applying the iterator to each element.
5499
- // Delegates to **ECMAScript 5**'s native `map` if available.
5500
- _.map = _.collect = function(obj, iterator, context) {
5501
- var results = [];
5502
- if (obj == null) return results;
5503
- if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
5504
- each(obj, function(value, index, list) {
5505
- results.push(iterator.call(context, value, index, list));
5506
- });
5519
+ // Return the results of applying the iteratee to each element.
5520
+ _.map = _.collect = function(obj, iteratee, context) {
5521
+ if (obj == null) return [];
5522
+ iteratee = _.iteratee(iteratee, context);
5523
+ var keys = obj.length !== +obj.length && _.keys(obj),
5524
+ length = (keys || obj).length,
5525
+ results = Array(length),
5526
+ currentKey;
5527
+ for (var index = 0; index < length; index++) {
5528
+ currentKey = keys ? keys[index] : index;
5529
+ results[index] = iteratee(obj[currentKey], currentKey, obj);
5530
+ }
5507
5531
  return results;
5508
5532
  };
5509
5533
 
5510
5534
  var reduceError = 'Reduce of empty array with no initial value';
5511
5535
 
5512
5536
  // **Reduce** builds up a single result from a list of values, aka `inject`,
5513
- // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
5514
- _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
5515
- var initial = arguments.length > 2;
5537
+ // or `foldl`.
5538
+ _.reduce = _.foldl = _.inject = function(obj, iteratee, memo, context) {
5516
5539
  if (obj == null) obj = [];
5517
- if (nativeReduce && obj.reduce === nativeReduce) {
5518
- if (context) iterator = _.bind(iterator, context);
5519
- return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
5520
- }
5521
- each(obj, function(value, index, list) {
5522
- if (!initial) {
5523
- memo = value;
5524
- initial = true;
5525
- } else {
5526
- memo = iterator.call(context, memo, value, index, list);
5527
- }
5528
- });
5529
- if (!initial) throw new TypeError(reduceError);
5540
+ iteratee = createCallback(iteratee, context, 4);
5541
+ var keys = obj.length !== +obj.length && _.keys(obj),
5542
+ length = (keys || obj).length,
5543
+ index = 0, currentKey;
5544
+ if (arguments.length < 3) {
5545
+ if (!length) throw new TypeError(reduceError);
5546
+ memo = obj[keys ? keys[index++] : index++];
5547
+ }
5548
+ for (; index < length; index++) {
5549
+ currentKey = keys ? keys[index] : index;
5550
+ memo = iteratee(memo, obj[currentKey], currentKey, obj);
5551
+ }
5530
5552
  return memo;
5531
5553
  };
5532
5554
 
5533
5555
  // The right-associative version of reduce, also known as `foldr`.
5534
- // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
5535
- _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
5536
- var initial = arguments.length > 2;
5556
+ _.reduceRight = _.foldr = function(obj, iteratee, memo, context) {
5537
5557
  if (obj == null) obj = [];
5538
- if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
5539
- if (context) iterator = _.bind(iterator, context);
5540
- return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
5558
+ iteratee = createCallback(iteratee, context, 4);
5559
+ var keys = obj.length !== + obj.length && _.keys(obj),
5560
+ index = (keys || obj).length,
5561
+ currentKey;
5562
+ if (arguments.length < 3) {
5563
+ if (!index) throw new TypeError(reduceError);
5564
+ memo = obj[keys ? keys[--index] : --index];
5541
5565
  }
5542
- var length = obj.length;
5543
- if (length !== +length) {
5544
- var keys = _.keys(obj);
5545
- length = keys.length;
5566
+ while (index--) {
5567
+ currentKey = keys ? keys[index] : index;
5568
+ memo = iteratee(memo, obj[currentKey], currentKey, obj);
5546
5569
  }
5547
- each(obj, function(value, index, list) {
5548
- index = keys ? keys[--length] : --length;
5549
- if (!initial) {
5550
- memo = obj[index];
5551
- initial = true;
5552
- } else {
5553
- memo = iterator.call(context, memo, obj[index], index, list);
5554
- }
5555
- });
5556
- if (!initial) throw new TypeError(reduceError);
5557
5570
  return memo;
5558
5571
  };
5559
5572
 
5560
5573
  // Return the first value which passes a truth test. Aliased as `detect`.
5561
5574
  _.find = _.detect = function(obj, predicate, context) {
5562
5575
  var result;
5563
- any(obj, function(value, index, list) {
5564
- if (predicate.call(context, value, index, list)) {
5576
+ predicate = _.iteratee(predicate, context);
5577
+ _.some(obj, function(value, index, list) {
5578
+ if (predicate(value, index, list)) {
5565
5579
  result = value;
5566
5580
  return true;
5567
5581
  }
@@ -5570,61 +5584,58 @@ if (typeof module !== 'undefined' && module.exports) {
5570
5584
  };
5571
5585
 
5572
5586
  // Return all the elements that pass a truth test.
5573
- // Delegates to **ECMAScript 5**'s native `filter` if available.
5574
5587
  // Aliased as `select`.
5575
5588
  _.filter = _.select = function(obj, predicate, context) {
5576
5589
  var results = [];
5577
5590
  if (obj == null) return results;
5578
- if (nativeFilter && obj.filter === nativeFilter) return obj.filter(predicate, context);
5579
- each(obj, function(value, index, list) {
5580
- if (predicate.call(context, value, index, list)) results.push(value);
5591
+ predicate = _.iteratee(predicate, context);
5592
+ _.each(obj, function(value, index, list) {
5593
+ if (predicate(value, index, list)) results.push(value);
5581
5594
  });
5582
5595
  return results;
5583
5596
  };
5584
5597
 
5585
5598
  // Return all the elements for which a truth test fails.
5586
5599
  _.reject = function(obj, predicate, context) {
5587
- return _.filter(obj, function(value, index, list) {
5588
- return !predicate.call(context, value, index, list);
5589
- }, context);
5600
+ return _.filter(obj, _.negate(_.iteratee(predicate)), context);
5590
5601
  };
5591
5602
 
5592
5603
  // Determine whether all of the elements match a truth test.
5593
- // Delegates to **ECMAScript 5**'s native `every` if available.
5594
5604
  // Aliased as `all`.
5595
5605
  _.every = _.all = function(obj, predicate, context) {
5596
- predicate || (predicate = _.identity);
5597
- var result = true;
5598
- if (obj == null) return result;
5599
- if (nativeEvery && obj.every === nativeEvery) return obj.every(predicate, context);
5600
- each(obj, function(value, index, list) {
5601
- if (!(result = result && predicate.call(context, value, index, list))) return breaker;
5602
- });
5603
- return !!result;
5606
+ if (obj == null) return true;
5607
+ predicate = _.iteratee(predicate, context);
5608
+ var keys = obj.length !== +obj.length && _.keys(obj),
5609
+ length = (keys || obj).length,
5610
+ index, currentKey;
5611
+ for (index = 0; index < length; index++) {
5612
+ currentKey = keys ? keys[index] : index;
5613
+ if (!predicate(obj[currentKey], currentKey, obj)) return false;
5614
+ }
5615
+ return true;
5604
5616
  };
5605
5617
 
5606
5618
  // Determine if at least one element in the object matches a truth test.
5607
- // Delegates to **ECMAScript 5**'s native `some` if available.
5608
5619
  // Aliased as `any`.
5609
- var any = _.some = _.any = function(obj, predicate, context) {
5610
- predicate || (predicate = _.identity);
5611
- var result = false;
5612
- if (obj == null) return result;
5613
- if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context);
5614
- each(obj, function(value, index, list) {
5615
- if (result || (result = predicate.call(context, value, index, list))) return breaker;
5616
- });
5617
- return !!result;
5620
+ _.some = _.any = function(obj, predicate, context) {
5621
+ if (obj == null) return false;
5622
+ predicate = _.iteratee(predicate, context);
5623
+ var keys = obj.length !== +obj.length && _.keys(obj),
5624
+ length = (keys || obj).length,
5625
+ index, currentKey;
5626
+ for (index = 0; index < length; index++) {
5627
+ currentKey = keys ? keys[index] : index;
5628
+ if (predicate(obj[currentKey], currentKey, obj)) return true;
5629
+ }
5630
+ return false;
5618
5631
  };
5619
5632
 
5620
5633
  // Determine if the array or object contains a given value (using `===`).
5621
5634
  // Aliased as `include`.
5622
5635
  _.contains = _.include = function(obj, target) {
5623
5636
  if (obj == null) return false;
5624
- if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
5625
- return any(obj, function(value) {
5626
- return value === target;
5627
- });
5637
+ if (obj.length !== +obj.length) obj = _.values(obj);
5638
+ return _.indexOf(obj, target) >= 0;
5628
5639
  };
5629
5640
 
5630
5641
  // Invoke a method (with arguments) on every item in a collection.
@@ -5653,51 +5664,67 @@ if (typeof module !== 'undefined' && module.exports) {
5653
5664
  return _.find(obj, _.matches(attrs));
5654
5665
  };
5655
5666
 
5656
- // Return the maximum element or (element-based computation).
5657
- // Can't optimize arrays of integers longer than 65,535 elements.
5658
- // See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797)
5659
- _.max = function(obj, iterator, context) {
5660
- if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
5661
- return Math.max.apply(Math, obj);
5662
- }
5663
- var result = -Infinity, lastComputed = -Infinity;
5664
- each(obj, function(value, index, list) {
5665
- var computed = iterator ? iterator.call(context, value, index, list) : value;
5666
- if (computed > lastComputed) {
5667
- result = value;
5668
- lastComputed = computed;
5667
+ // Return the maximum element (or element-based computation).
5668
+ _.max = function(obj, iteratee, context) {
5669
+ var result = -Infinity, lastComputed = -Infinity,
5670
+ value, computed;
5671
+ if (iteratee == null && obj != null) {
5672
+ obj = obj.length === +obj.length ? obj : _.values(obj);
5673
+ for (var i = 0, length = obj.length; i < length; i++) {
5674
+ value = obj[i];
5675
+ if (value > result) {
5676
+ result = value;
5677
+ }
5669
5678
  }
5670
- });
5679
+ } else {
5680
+ iteratee = _.iteratee(iteratee, context);
5681
+ _.each(obj, function(value, index, list) {
5682
+ computed = iteratee(value, index, list);
5683
+ if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
5684
+ result = value;
5685
+ lastComputed = computed;
5686
+ }
5687
+ });
5688
+ }
5671
5689
  return result;
5672
5690
  };
5673
5691
 
5674
5692
  // Return the minimum element (or element-based computation).
5675
- _.min = function(obj, iterator, context) {
5676
- if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
5677
- return Math.min.apply(Math, obj);
5678
- }
5679
- var result = Infinity, lastComputed = Infinity;
5680
- each(obj, function(value, index, list) {
5681
- var computed = iterator ? iterator.call(context, value, index, list) : value;
5682
- if (computed < lastComputed) {
5683
- result = value;
5684
- lastComputed = computed;
5693
+ _.min = function(obj, iteratee, context) {
5694
+ var result = Infinity, lastComputed = Infinity,
5695
+ value, computed;
5696
+ if (iteratee == null && obj != null) {
5697
+ obj = obj.length === +obj.length ? obj : _.values(obj);
5698
+ for (var i = 0, length = obj.length; i < length; i++) {
5699
+ value = obj[i];
5700
+ if (value < result) {
5701
+ result = value;
5702
+ }
5685
5703
  }
5686
- });
5704
+ } else {
5705
+ iteratee = _.iteratee(iteratee, context);
5706
+ _.each(obj, function(value, index, list) {
5707
+ computed = iteratee(value, index, list);
5708
+ if (computed < lastComputed || computed === Infinity && result === Infinity) {
5709
+ result = value;
5710
+ lastComputed = computed;
5711
+ }
5712
+ });
5713
+ }
5687
5714
  return result;
5688
5715
  };
5689
5716
 
5690
- // Shuffle an array, using the modern version of the
5717
+ // Shuffle a collection, using the modern version of the
5691
5718
  // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
5692
5719
  _.shuffle = function(obj) {
5693
- var rand;
5694
- var index = 0;
5695
- var shuffled = [];
5696
- each(obj, function(value) {
5697
- rand = _.random(index++);
5698
- shuffled[index - 1] = shuffled[rand];
5699
- shuffled[rand] = value;
5700
- });
5720
+ var set = obj && obj.length === +obj.length ? obj : _.values(obj);
5721
+ var length = set.length;
5722
+ var shuffled = Array(length);
5723
+ for (var index = 0, rand; index < length; index++) {
5724
+ rand = _.random(0, index);
5725
+ if (rand !== index) shuffled[index] = shuffled[rand];
5726
+ shuffled[rand] = set[index];
5727
+ }
5701
5728
  return shuffled;
5702
5729
  };
5703
5730
 
@@ -5712,21 +5739,14 @@ if (typeof module !== 'undefined' && module.exports) {
5712
5739
  return _.shuffle(obj).slice(0, Math.max(0, n));
5713
5740
  };
5714
5741
 
5715
- // An internal function to generate lookup iterators.
5716
- var lookupIterator = function(value) {
5717
- if (value == null) return _.identity;
5718
- if (_.isFunction(value)) return value;
5719
- return _.property(value);
5720
- };
5721
-
5722
- // Sort the object's values by a criterion produced by an iterator.
5723
- _.sortBy = function(obj, iterator, context) {
5724
- iterator = lookupIterator(iterator);
5742
+ // Sort the object's values by a criterion produced by an iteratee.
5743
+ _.sortBy = function(obj, iteratee, context) {
5744
+ iteratee = _.iteratee(iteratee, context);
5725
5745
  return _.pluck(_.map(obj, function(value, index, list) {
5726
5746
  return {
5727
5747
  value: value,
5728
5748
  index: index,
5729
- criteria: iterator.call(context, value, index, list)
5749
+ criteria: iteratee(value, index, list)
5730
5750
  };
5731
5751
  }).sort(function(left, right) {
5732
5752
  var a = left.criteria;
@@ -5741,12 +5761,12 @@ if (typeof module !== 'undefined' && module.exports) {
5741
5761
 
5742
5762
  // An internal function used for aggregate "group by" operations.
5743
5763
  var group = function(behavior) {
5744
- return function(obj, iterator, context) {
5764
+ return function(obj, iteratee, context) {
5745
5765
  var result = {};
5746
- iterator = lookupIterator(iterator);
5747
- each(obj, function(value, index) {
5748
- var key = iterator.call(context, value, index, obj);
5749
- behavior(result, key, value);
5766
+ iteratee = _.iteratee(iteratee, context);
5767
+ _.each(obj, function(value, index) {
5768
+ var key = iteratee(value, index, obj);
5769
+ behavior(result, value, key);
5750
5770
  });
5751
5771
  return result;
5752
5772
  };
@@ -5754,32 +5774,32 @@ if (typeof module !== 'undefined' && module.exports) {
5754
5774
 
5755
5775
  // Groups the object's values by a criterion. Pass either a string attribute
5756
5776
  // to group by, or a function that returns the criterion.
5757
- _.groupBy = group(function(result, key, value) {
5758
- _.has(result, key) ? result[key].push(value) : result[key] = [value];
5777
+ _.groupBy = group(function(result, value, key) {
5778
+ if (_.has(result, key)) result[key].push(value); else result[key] = [value];
5759
5779
  });
5760
5780
 
5761
5781
  // Indexes the object's values by a criterion, similar to `groupBy`, but for
5762
5782
  // when you know that your index values will be unique.
5763
- _.indexBy = group(function(result, key, value) {
5783
+ _.indexBy = group(function(result, value, key) {
5764
5784
  result[key] = value;
5765
5785
  });
5766
5786
 
5767
5787
  // Counts instances of an object that group by a certain criterion. Pass
5768
5788
  // either a string attribute to count by, or a function that returns the
5769
5789
  // criterion.
5770
- _.countBy = group(function(result, key) {
5771
- _.has(result, key) ? result[key]++ : result[key] = 1;
5790
+ _.countBy = group(function(result, value, key) {
5791
+ if (_.has(result, key)) result[key]++; else result[key] = 1;
5772
5792
  });
5773
5793
 
5774
5794
  // Use a comparator function to figure out the smallest index at which
5775
5795
  // an object should be inserted so as to maintain order. Uses binary search.
5776
- _.sortedIndex = function(array, obj, iterator, context) {
5777
- iterator = lookupIterator(iterator);
5778
- var value = iterator.call(context, obj);
5796
+ _.sortedIndex = function(array, obj, iteratee, context) {
5797
+ iteratee = _.iteratee(iteratee, context, 1);
5798
+ var value = iteratee(obj);
5779
5799
  var low = 0, high = array.length;
5780
5800
  while (low < high) {
5781
- var mid = (low + high) >>> 1;
5782
- iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
5801
+ var mid = low + high >>> 1;
5802
+ if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
5783
5803
  }
5784
5804
  return low;
5785
5805
  };
@@ -5795,7 +5815,18 @@ if (typeof module !== 'undefined' && module.exports) {
5795
5815
  // Return the number of elements in an object.
5796
5816
  _.size = function(obj) {
5797
5817
  if (obj == null) return 0;
5798
- return (obj.length === +obj.length) ? obj.length : _.keys(obj).length;
5818
+ return obj.length === +obj.length ? obj.length : _.keys(obj).length;
5819
+ };
5820
+
5821
+ // Split a collection into two arrays: one whose elements all satisfy the given
5822
+ // predicate, and one whose elements all do not satisfy the predicate.
5823
+ _.partition = function(obj, predicate, context) {
5824
+ predicate = _.iteratee(predicate, context);
5825
+ var pass = [], fail = [];
5826
+ _.each(obj, function(value, key, obj) {
5827
+ (predicate(value, key, obj) ? pass : fail).push(value);
5828
+ });
5829
+ return [pass, fail];
5799
5830
  };
5800
5831
 
5801
5832
  // Array Functions
@@ -5806,7 +5837,7 @@ if (typeof module !== 'undefined' && module.exports) {
5806
5837
  // allows it to work with `_.map`.
5807
5838
  _.first = _.head = _.take = function(array, n, guard) {
5808
5839
  if (array == null) return void 0;
5809
- if ((n == null) || guard) return array[0];
5840
+ if (n == null || guard) return array[0];
5810
5841
  if (n < 0) return [];
5811
5842
  return slice.call(array, 0, n);
5812
5843
  };
@@ -5816,14 +5847,14 @@ if (typeof module !== 'undefined' && module.exports) {
5816
5847
  // the array, excluding the last N. The **guard** check allows it to work with
5817
5848
  // `_.map`.
5818
5849
  _.initial = function(array, n, guard) {
5819
- return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
5850
+ return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
5820
5851
  };
5821
5852
 
5822
5853
  // Get the last element of an array. Passing **n** will return the last N
5823
5854
  // values in the array. The **guard** check allows it to work with `_.map`.
5824
5855
  _.last = function(array, n, guard) {
5825
5856
  if (array == null) return void 0;
5826
- if ((n == null) || guard) return array[array.length - 1];
5857
+ if (n == null || guard) return array[array.length - 1];
5827
5858
  return slice.call(array, Math.max(array.length - n, 0));
5828
5859
  };
5829
5860
 
@@ -5832,7 +5863,7 @@ if (typeof module !== 'undefined' && module.exports) {
5832
5863
  // the rest N values in the array. The **guard**
5833
5864
  // check allows it to work with `_.map`.
5834
5865
  _.rest = _.tail = _.drop = function(array, n, guard) {
5835
- return slice.call(array, (n == null) || guard ? 1 : n);
5866
+ return slice.call(array, n == null || guard ? 1 : n);
5836
5867
  };
5837
5868
 
5838
5869
  // Trim out all falsy values from an array.
@@ -5841,23 +5872,26 @@ if (typeof module !== 'undefined' && module.exports) {
5841
5872
  };
5842
5873
 
5843
5874
  // Internal implementation of a recursive `flatten` function.
5844
- var flatten = function(input, shallow, output) {
5875
+ var flatten = function(input, shallow, strict, output) {
5845
5876
  if (shallow && _.every(input, _.isArray)) {
5846
5877
  return concat.apply(output, input);
5847
5878
  }
5848
- each(input, function(value) {
5849
- if (_.isArray(value) || _.isArguments(value)) {
5850
- shallow ? push.apply(output, value) : flatten(value, shallow, output);
5879
+ for (var i = 0, length = input.length; i < length; i++) {
5880
+ var value = input[i];
5881
+ if (!_.isArray(value) && !_.isArguments(value)) {
5882
+ if (!strict) output.push(value);
5883
+ } else if (shallow) {
5884
+ push.apply(output, value);
5851
5885
  } else {
5852
- output.push(value);
5886
+ flatten(value, shallow, strict, output);
5853
5887
  }
5854
- });
5888
+ }
5855
5889
  return output;
5856
5890
  };
5857
5891
 
5858
5892
  // Flatten out an array, either recursively (by default), or just one level.
5859
5893
  _.flatten = function(array, shallow) {
5860
- return flatten(array, shallow, []);
5894
+ return flatten(array, shallow, false, []);
5861
5895
  };
5862
5896
 
5863
5897
  // Return a version of the array that does not contain the specified value(s).
@@ -5865,68 +5899,77 @@ if (typeof module !== 'undefined' && module.exports) {
5865
5899
  return _.difference(array, slice.call(arguments, 1));
5866
5900
  };
5867
5901
 
5868
- // Split an array into two arrays: one whose elements all satisfy the given
5869
- // predicate, and one whose elements all do not satisfy the predicate.
5870
- _.partition = function(array, predicate) {
5871
- var pass = [], fail = [];
5872
- each(array, function(elem) {
5873
- (predicate(elem) ? pass : fail).push(elem);
5874
- });
5875
- return [pass, fail];
5876
- };
5877
-
5878
5902
  // Produce a duplicate-free version of the array. If the array has already
5879
5903
  // been sorted, you have the option of using a faster algorithm.
5880
5904
  // Aliased as `unique`.
5881
- _.uniq = _.unique = function(array, isSorted, iterator, context) {
5882
- if (_.isFunction(isSorted)) {
5883
- context = iterator;
5884
- iterator = isSorted;
5905
+ _.uniq = _.unique = function(array, isSorted, iteratee, context) {
5906
+ if (array == null) return [];
5907
+ if (!_.isBoolean(isSorted)) {
5908
+ context = iteratee;
5909
+ iteratee = isSorted;
5885
5910
  isSorted = false;
5886
5911
  }
5887
- var initial = iterator ? _.map(array, iterator, context) : array;
5888
- var results = [];
5912
+ if (iteratee != null) iteratee = _.iteratee(iteratee, context);
5913
+ var result = [];
5889
5914
  var seen = [];
5890
- each(initial, function(value, index) {
5891
- if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) {
5892
- seen.push(value);
5893
- results.push(array[index]);
5915
+ for (var i = 0, length = array.length; i < length; i++) {
5916
+ var value = array[i];
5917
+ if (isSorted) {
5918
+ if (!i || seen !== value) result.push(value);
5919
+ seen = value;
5920
+ } else if (iteratee) {
5921
+ var computed = iteratee(value, i, array);
5922
+ if (_.indexOf(seen, computed) < 0) {
5923
+ seen.push(computed);
5924
+ result.push(value);
5925
+ }
5926
+ } else if (_.indexOf(result, value) < 0) {
5927
+ result.push(value);
5894
5928
  }
5895
- });
5896
- return results;
5929
+ }
5930
+ return result;
5897
5931
  };
5898
5932
 
5899
5933
  // Produce an array that contains the union: each distinct element from all of
5900
5934
  // the passed-in arrays.
5901
5935
  _.union = function() {
5902
- return _.uniq(_.flatten(arguments, true));
5936
+ return _.uniq(flatten(arguments, true, true, []));
5903
5937
  };
5904
5938
 
5905
5939
  // Produce an array that contains every item shared between all the
5906
5940
  // passed-in arrays.
5907
5941
  _.intersection = function(array) {
5908
- var rest = slice.call(arguments, 1);
5909
- return _.filter(_.uniq(array), function(item) {
5910
- return _.every(rest, function(other) {
5911
- return _.contains(other, item);
5912
- });
5913
- });
5942
+ if (array == null) return [];
5943
+ var result = [];
5944
+ var argsLength = arguments.length;
5945
+ for (var i = 0, length = array.length; i < length; i++) {
5946
+ var item = array[i];
5947
+ if (_.contains(result, item)) continue;
5948
+ for (var j = 1; j < argsLength; j++) {
5949
+ if (!_.contains(arguments[j], item)) break;
5950
+ }
5951
+ if (j === argsLength) result.push(item);
5952
+ }
5953
+ return result;
5914
5954
  };
5915
5955
 
5916
5956
  // Take the difference between one array and a number of other arrays.
5917
5957
  // Only the elements present in just the first array will remain.
5918
5958
  _.difference = function(array) {
5919
- var rest = concat.apply(ArrayProto, slice.call(arguments, 1));
5920
- return _.filter(array, function(value){ return !_.contains(rest, value); });
5959
+ var rest = flatten(slice.call(arguments, 1), true, true, []);
5960
+ return _.filter(array, function(value){
5961
+ return !_.contains(rest, value);
5962
+ });
5921
5963
  };
5922
5964
 
5923
5965
  // Zip together multiple lists into a single array -- elements that share
5924
5966
  // an index go together.
5925
- _.zip = function() {
5926
- var length = _.max(_.pluck(arguments, 'length').concat(0));
5927
- var results = new Array(length);
5967
+ _.zip = function(array) {
5968
+ if (array == null) return [];
5969
+ var length = _.max(arguments, 'length').length;
5970
+ var results = Array(length);
5928
5971
  for (var i = 0; i < length; i++) {
5929
- results[i] = _.pluck(arguments, '' + i);
5972
+ results[i] = _.pluck(arguments, i);
5930
5973
  }
5931
5974
  return results;
5932
5975
  };
@@ -5947,10 +5990,8 @@ if (typeof module !== 'undefined' && module.exports) {
5947
5990
  return result;
5948
5991
  };
5949
5992
 
5950
- // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
5951
- // we need this function. Return the position of the first occurrence of an
5952
- // item in an array, or -1 if the item is not included in the array.
5953
- // Delegates to **ECMAScript 5**'s native `indexOf` if available.
5993
+ // Return the position of the first occurrence of an item in an array,
5994
+ // or -1 if the item is not included in the array.
5954
5995
  // If the array is large and already in sort order, pass `true`
5955
5996
  // for **isSorted** to use binary search.
5956
5997
  _.indexOf = function(array, item, isSorted) {
@@ -5958,26 +5999,23 @@ if (typeof module !== 'undefined' && module.exports) {
5958
5999
  var i = 0, length = array.length;
5959
6000
  if (isSorted) {
5960
6001
  if (typeof isSorted == 'number') {
5961
- i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted);
6002
+ i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted;
5962
6003
  } else {
5963
6004
  i = _.sortedIndex(array, item);
5964
6005
  return array[i] === item ? i : -1;
5965
6006
  }
5966
6007
  }
5967
- if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
5968
6008
  for (; i < length; i++) if (array[i] === item) return i;
5969
6009
  return -1;
5970
6010
  };
5971
6011
 
5972
- // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
5973
6012
  _.lastIndexOf = function(array, item, from) {
5974
6013
  if (array == null) return -1;
5975
- var hasIndex = from != null;
5976
- if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) {
5977
- return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item);
6014
+ var idx = array.length;
6015
+ if (typeof from == 'number') {
6016
+ idx = from < 0 ? idx + from + 1 : Math.min(idx, from + 1);
5978
6017
  }
5979
- var i = (hasIndex ? from : array.length);
5980
- while (i--) if (array[i] === item) return i;
6018
+ while (--idx >= 0) if (array[idx] === item) return idx;
5981
6019
  return -1;
5982
6020
  };
5983
6021
 
@@ -5989,15 +6027,13 @@ if (typeof module !== 'undefined' && module.exports) {
5989
6027
  stop = start || 0;
5990
6028
  start = 0;
5991
6029
  }
5992
- step = arguments[2] || 1;
6030
+ step = step || 1;
5993
6031
 
5994
6032
  var length = Math.max(Math.ceil((stop - start) / step), 0);
5995
- var idx = 0;
5996
- var range = new Array(length);
6033
+ var range = Array(length);
5997
6034
 
5998
- while(idx < length) {
5999
- range[idx++] = start;
6000
- start += step;
6035
+ for (var idx = 0; idx < length; idx++, start += step) {
6036
+ range[idx] = start;
6001
6037
  }
6002
6038
 
6003
6039
  return range;
@@ -6007,7 +6043,7 @@ if (typeof module !== 'undefined' && module.exports) {
6007
6043
  // ------------------
6008
6044
 
6009
6045
  // Reusable constructor function for prototype setting.
6010
- var ctor = function(){};
6046
+ var Ctor = function(){};
6011
6047
 
6012
6048
  // Create a function bound to a given object (assigning `this`, and arguments,
6013
6049
  // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
@@ -6015,17 +6051,18 @@ if (typeof module !== 'undefined' && module.exports) {
6015
6051
  _.bind = function(func, context) {
6016
6052
  var args, bound;
6017
6053
  if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
6018
- if (!_.isFunction(func)) throw new TypeError;
6054
+ if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
6019
6055
  args = slice.call(arguments, 2);
6020
- return bound = function() {
6056
+ bound = function() {
6021
6057
  if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
6022
- ctor.prototype = func.prototype;
6023
- var self = new ctor;
6024
- ctor.prototype = null;
6058
+ Ctor.prototype = func.prototype;
6059
+ var self = new Ctor;
6060
+ Ctor.prototype = null;
6025
6061
  var result = func.apply(self, args.concat(slice.call(arguments)));
6026
- if (Object(result) === result) return result;
6062
+ if (_.isObject(result)) return result;
6027
6063
  return self;
6028
6064
  };
6065
+ return bound;
6029
6066
  };
6030
6067
 
6031
6068
  // Partially apply a function by creating a version that has had some of its
@@ -6048,27 +6085,34 @@ if (typeof module !== 'undefined' && module.exports) {
6048
6085
  // are the method names to be bound. Useful for ensuring that all callbacks
6049
6086
  // defined on an object belong to it.
6050
6087
  _.bindAll = function(obj) {
6051
- var funcs = slice.call(arguments, 1);
6052
- if (funcs.length === 0) throw new Error('bindAll must be passed function names');
6053
- each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
6088
+ var i, length = arguments.length, key;
6089
+ if (length <= 1) throw new Error('bindAll must be passed function names');
6090
+ for (i = 1; i < length; i++) {
6091
+ key = arguments[i];
6092
+ obj[key] = _.bind(obj[key], obj);
6093
+ }
6054
6094
  return obj;
6055
6095
  };
6056
6096
 
6057
6097
  // Memoize an expensive function by storing its results.
6058
6098
  _.memoize = function(func, hasher) {
6059
- var memo = {};
6060
- hasher || (hasher = _.identity);
6061
- return function() {
6062
- var key = hasher.apply(this, arguments);
6063
- return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
6099
+ var memoize = function(key) {
6100
+ var cache = memoize.cache;
6101
+ var address = hasher ? hasher.apply(this, arguments) : key;
6102
+ if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
6103
+ return cache[address];
6064
6104
  };
6105
+ memoize.cache = {};
6106
+ return memoize;
6065
6107
  };
6066
6108
 
6067
6109
  // Delays a function for the given number of milliseconds, and then calls
6068
6110
  // it with the arguments supplied.
6069
6111
  _.delay = function(func, wait) {
6070
6112
  var args = slice.call(arguments, 2);
6071
- return setTimeout(function(){ return func.apply(null, args); }, wait);
6113
+ return setTimeout(function(){
6114
+ return func.apply(null, args);
6115
+ }, wait);
6072
6116
  };
6073
6117
 
6074
6118
  // Defers a function, scheduling it to run after the current call stack has
@@ -6086,12 +6130,12 @@ if (typeof module !== 'undefined' && module.exports) {
6086
6130
  var context, args, result;
6087
6131
  var timeout = null;
6088
6132
  var previous = 0;
6089
- options || (options = {});
6133
+ if (!options) options = {};
6090
6134
  var later = function() {
6091
6135
  previous = options.leading === false ? 0 : _.now();
6092
6136
  timeout = null;
6093
6137
  result = func.apply(context, args);
6094
- context = args = null;
6138
+ if (!timeout) context = args = null;
6095
6139
  };
6096
6140
  return function() {
6097
6141
  var now = _.now();
@@ -6099,12 +6143,12 @@ if (typeof module !== 'undefined' && module.exports) {
6099
6143
  var remaining = wait - (now - previous);
6100
6144
  context = this;
6101
6145
  args = arguments;
6102
- if (remaining <= 0) {
6146
+ if (remaining <= 0 || remaining > wait) {
6103
6147
  clearTimeout(timeout);
6104
6148
  timeout = null;
6105
6149
  previous = now;
6106
6150
  result = func.apply(context, args);
6107
- context = args = null;
6151
+ if (!timeout) context = args = null;
6108
6152
  } else if (!timeout && options.trailing !== false) {
6109
6153
  timeout = setTimeout(later, remaining);
6110
6154
  }
@@ -6121,13 +6165,14 @@ if (typeof module !== 'undefined' && module.exports) {
6121
6165
 
6122
6166
  var later = function() {
6123
6167
  var last = _.now() - timestamp;
6124
- if (last < wait) {
6168
+
6169
+ if (last < wait && last > 0) {
6125
6170
  timeout = setTimeout(later, wait - last);
6126
6171
  } else {
6127
6172
  timeout = null;
6128
6173
  if (!immediate) {
6129
6174
  result = func.apply(context, args);
6130
- context = args = null;
6175
+ if (!timeout) context = args = null;
6131
6176
  }
6132
6177
  }
6133
6178
  };
@@ -6137,9 +6182,7 @@ if (typeof module !== 'undefined' && module.exports) {
6137
6182
  args = arguments;
6138
6183
  timestamp = _.now();
6139
6184
  var callNow = immediate && !timeout;
6140
- if (!timeout) {
6141
- timeout = setTimeout(later, wait);
6142
- }
6185
+ if (!timeout) timeout = setTimeout(later, wait);
6143
6186
  if (callNow) {
6144
6187
  result = func.apply(context, args);
6145
6188
  context = args = null;
@@ -6149,19 +6192,6 @@ if (typeof module !== 'undefined' && module.exports) {
6149
6192
  };
6150
6193
  };
6151
6194
 
6152
- // Returns a function that will be executed at most one time, no matter how
6153
- // often you call it. Useful for lazy initialization.
6154
- _.once = function(func) {
6155
- var ran = false, memo;
6156
- return function() {
6157
- if (ran) return memo;
6158
- ran = true;
6159
- memo = func.apply(this, arguments);
6160
- func = null;
6161
- return memo;
6162
- };
6163
- };
6164
-
6165
6195
  // Returns the first function passed as an argument to the second,
6166
6196
  // allowing you to adjust arguments, run code before and after, and
6167
6197
  // conditionally execute the original function.
@@ -6169,16 +6199,23 @@ if (typeof module !== 'undefined' && module.exports) {
6169
6199
  return _.partial(wrapper, func);
6170
6200
  };
6171
6201
 
6202
+ // Returns a negated version of the passed-in predicate.
6203
+ _.negate = function(predicate) {
6204
+ return function() {
6205
+ return !predicate.apply(this, arguments);
6206
+ };
6207
+ };
6208
+
6172
6209
  // Returns a function that is the composition of a list of functions, each
6173
6210
  // consuming the return value of the function that follows.
6174
6211
  _.compose = function() {
6175
- var funcs = arguments;
6212
+ var args = arguments;
6213
+ var start = args.length - 1;
6176
6214
  return function() {
6177
- var args = arguments;
6178
- for (var i = funcs.length - 1; i >= 0; i--) {
6179
- args = [funcs[i].apply(this, args)];
6180
- }
6181
- return args[0];
6215
+ var i = start;
6216
+ var result = args[start].apply(this, arguments);
6217
+ while (i--) result = args[i].call(this, result);
6218
+ return result;
6182
6219
  };
6183
6220
  };
6184
6221
 
@@ -6191,6 +6228,23 @@ if (typeof module !== 'undefined' && module.exports) {
6191
6228
  };
6192
6229
  };
6193
6230
 
6231
+ // Returns a function that will only be executed before being called N times.
6232
+ _.before = function(times, func) {
6233
+ var memo;
6234
+ return function() {
6235
+ if (--times > 0) {
6236
+ memo = func.apply(this, arguments);
6237
+ } else {
6238
+ func = null;
6239
+ }
6240
+ return memo;
6241
+ };
6242
+ };
6243
+
6244
+ // Returns a function that will be executed at most one time, no matter how
6245
+ // often you call it. Useful for lazy initialization.
6246
+ _.once = _.partial(_.before, 2);
6247
+
6194
6248
  // Object Functions
6195
6249
  // ----------------
6196
6250
 
@@ -6208,7 +6262,7 @@ if (typeof module !== 'undefined' && module.exports) {
6208
6262
  _.values = function(obj) {
6209
6263
  var keys = _.keys(obj);
6210
6264
  var length = keys.length;
6211
- var values = new Array(length);
6265
+ var values = Array(length);
6212
6266
  for (var i = 0; i < length; i++) {
6213
6267
  values[i] = obj[keys[i]];
6214
6268
  }
@@ -6219,7 +6273,7 @@ if (typeof module !== 'undefined' && module.exports) {
6219
6273
  _.pairs = function(obj) {
6220
6274
  var keys = _.keys(obj);
6221
6275
  var length = keys.length;
6222
- var pairs = new Array(length);
6276
+ var pairs = Array(length);
6223
6277
  for (var i = 0; i < length; i++) {
6224
6278
  pairs[i] = [keys[i], obj[keys[i]]];
6225
6279
  }
@@ -6248,45 +6302,62 @@ if (typeof module !== 'undefined' && module.exports) {
6248
6302
 
6249
6303
  // Extend a given object with all the properties in passed-in object(s).
6250
6304
  _.extend = function(obj) {
6251
- each(slice.call(arguments, 1), function(source) {
6252
- if (source) {
6253
- for (var prop in source) {
6254
- obj[prop] = source[prop];
6305
+ if (!_.isObject(obj)) return obj;
6306
+ var source, prop;
6307
+ for (var i = 1, length = arguments.length; i < length; i++) {
6308
+ source = arguments[i];
6309
+ for (prop in source) {
6310
+ if (hasOwnProperty.call(source, prop)) {
6311
+ obj[prop] = source[prop];
6255
6312
  }
6256
6313
  }
6257
- });
6314
+ }
6258
6315
  return obj;
6259
6316
  };
6260
6317
 
6261
6318
  // Return a copy of the object only containing the whitelisted properties.
6262
- _.pick = function(obj) {
6263
- var copy = {};
6264
- var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
6265
- each(keys, function(key) {
6266
- if (key in obj) copy[key] = obj[key];
6267
- });
6268
- return copy;
6319
+ _.pick = function(obj, iteratee, context) {
6320
+ var result = {}, key;
6321
+ if (obj == null) return result;
6322
+ if (_.isFunction(iteratee)) {
6323
+ iteratee = createCallback(iteratee, context);
6324
+ for (key in obj) {
6325
+ var value = obj[key];
6326
+ if (iteratee(value, key, obj)) result[key] = value;
6327
+ }
6328
+ } else {
6329
+ var keys = concat.apply([], slice.call(arguments, 1));
6330
+ obj = new Object(obj);
6331
+ for (var i = 0, length = keys.length; i < length; i++) {
6332
+ key = keys[i];
6333
+ if (key in obj) result[key] = obj[key];
6334
+ }
6335
+ }
6336
+ return result;
6269
6337
  };
6270
6338
 
6271
6339
  // Return a copy of the object without the blacklisted properties.
6272
- _.omit = function(obj) {
6273
- var copy = {};
6274
- var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
6275
- for (var key in obj) {
6276
- if (!_.contains(keys, key)) copy[key] = obj[key];
6340
+ _.omit = function(obj, iteratee, context) {
6341
+ if (_.isFunction(iteratee)) {
6342
+ iteratee = _.negate(iteratee);
6343
+ } else {
6344
+ var keys = _.map(concat.apply([], slice.call(arguments, 1)), String);
6345
+ iteratee = function(value, key) {
6346
+ return !_.contains(keys, key);
6347
+ };
6277
6348
  }
6278
- return copy;
6349
+ return _.pick(obj, iteratee, context);
6279
6350
  };
6280
6351
 
6281
6352
  // Fill in a given object with default properties.
6282
6353
  _.defaults = function(obj) {
6283
- each(slice.call(arguments, 1), function(source) {
6284
- if (source) {
6285
- for (var prop in source) {
6286
- if (obj[prop] === void 0) obj[prop] = source[prop];
6287
- }
6354
+ if (!_.isObject(obj)) return obj;
6355
+ for (var i = 1, length = arguments.length; i < length; i++) {
6356
+ var source = arguments[i];
6357
+ for (var prop in source) {
6358
+ if (obj[prop] === void 0) obj[prop] = source[prop];
6288
6359
  }
6289
- });
6360
+ }
6290
6361
  return obj;
6291
6362
  };
6292
6363
 
@@ -6308,7 +6379,7 @@ if (typeof module !== 'undefined' && module.exports) {
6308
6379
  var eq = function(a, b, aStack, bStack) {
6309
6380
  // Identical objects are equal. `0 === -0`, but they aren't identical.
6310
6381
  // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
6311
- if (a === b) return a !== 0 || 1 / a == 1 / b;
6382
+ if (a === b) return a !== 0 || 1 / a === 1 / b;
6312
6383
  // A strict comparison is necessary because `null == undefined`.
6313
6384
  if (a == null || b == null) return a === b;
6314
6385
  // Unwrap any wrapped objects.
@@ -6316,29 +6387,27 @@ if (typeof module !== 'undefined' && module.exports) {
6316
6387
  if (b instanceof _) b = b._wrapped;
6317
6388
  // Compare `[[Class]]` names.
6318
6389
  var className = toString.call(a);
6319
- if (className != toString.call(b)) return false;
6390
+ if (className !== toString.call(b)) return false;
6320
6391
  switch (className) {
6321
- // Strings, numbers, dates, and booleans are compared by value.
6392
+ // Strings, numbers, regular expressions, dates, and booleans are compared by value.
6393
+ case '[object RegExp]':
6394
+ // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
6322
6395
  case '[object String]':
6323
6396
  // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
6324
6397
  // equivalent to `new String("5")`.
6325
- return a == String(b);
6398
+ return '' + a === '' + b;
6326
6399
  case '[object Number]':
6327
- // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
6328
- // other numeric values.
6329
- return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
6400
+ // `NaN`s are equivalent, but non-reflexive.
6401
+ // Object(NaN) is equivalent to NaN
6402
+ if (+a !== +a) return +b !== +b;
6403
+ // An `egal` comparison is performed for other numeric values.
6404
+ return +a === 0 ? 1 / +a === 1 / b : +a === +b;
6330
6405
  case '[object Date]':
6331
6406
  case '[object Boolean]':
6332
6407
  // Coerce dates and booleans to numeric primitive values. Dates are compared by their
6333
6408
  // millisecond representations. Note that invalid dates with millisecond representations
6334
6409
  // of `NaN` are not equivalent.
6335
- return +a == +b;
6336
- // RegExps are compared by their source patterns and flags.
6337
- case '[object RegExp]':
6338
- return a.source == b.source &&
6339
- a.global == b.global &&
6340
- a.multiline == b.multiline &&
6341
- a.ignoreCase == b.ignoreCase;
6410
+ return +a === +b;
6342
6411
  }
6343
6412
  if (typeof a != 'object' || typeof b != 'object') return false;
6344
6413
  // Assume equality for cyclic structures. The algorithm for detecting cyclic
@@ -6347,25 +6416,29 @@ if (typeof module !== 'undefined' && module.exports) {
6347
6416
  while (length--) {
6348
6417
  // Linear search. Performance is inversely proportional to the number of
6349
6418
  // unique nested structures.
6350
- if (aStack[length] == a) return bStack[length] == b;
6419
+ if (aStack[length] === a) return bStack[length] === b;
6351
6420
  }
6352
6421
  // Objects with different constructors are not equivalent, but `Object`s
6353
6422
  // from different frames are.
6354
6423
  var aCtor = a.constructor, bCtor = b.constructor;
6355
- if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
6356
- _.isFunction(bCtor) && (bCtor instanceof bCtor))
6357
- && ('constructor' in a && 'constructor' in b)) {
6424
+ if (
6425
+ aCtor !== bCtor &&
6426
+ // Handle Object.create(x) cases
6427
+ 'constructor' in a && 'constructor' in b &&
6428
+ !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
6429
+ _.isFunction(bCtor) && bCtor instanceof bCtor)
6430
+ ) {
6358
6431
  return false;
6359
6432
  }
6360
6433
  // Add the first object to the stack of traversed objects.
6361
6434
  aStack.push(a);
6362
6435
  bStack.push(b);
6363
- var size = 0, result = true;
6436
+ var size, result;
6364
6437
  // Recursively compare objects and arrays.
6365
- if (className == '[object Array]') {
6438
+ if (className === '[object Array]') {
6366
6439
  // Compare array lengths to determine if a deep comparison is necessary.
6367
6440
  size = a.length;
6368
- result = size == b.length;
6441
+ result = size === b.length;
6369
6442
  if (result) {
6370
6443
  // Deep compare the contents, ignoring non-numeric properties.
6371
6444
  while (size--) {
@@ -6374,20 +6447,16 @@ if (typeof module !== 'undefined' && module.exports) {
6374
6447
  }
6375
6448
  } else {
6376
6449
  // Deep compare objects.
6377
- for (var key in a) {
6378
- if (_.has(a, key)) {
6379
- // Count the expected number of properties.
6380
- size++;
6381
- // Deep compare each member.
6382
- if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
6383
- }
6384
- }
6385
- // Ensure that both objects contain the same number of properties.
6450
+ var keys = _.keys(a), key;
6451
+ size = keys.length;
6452
+ // Ensure that both objects contain the same number of properties before comparing deep equality.
6453
+ result = _.keys(b).length === size;
6386
6454
  if (result) {
6387
- for (key in b) {
6388
- if (_.has(b, key) && !(size--)) break;
6455
+ while (size--) {
6456
+ // Deep compare each member
6457
+ key = keys[size];
6458
+ if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
6389
6459
  }
6390
- result = !size;
6391
6460
  }
6392
6461
  }
6393
6462
  // Remove the first object from the stack of traversed objects.
@@ -6405,7 +6474,7 @@ if (typeof module !== 'undefined' && module.exports) {
6405
6474
  // An "empty" object has no enumerable own-properties.
6406
6475
  _.isEmpty = function(obj) {
6407
6476
  if (obj == null) return true;
6408
- if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
6477
+ if (_.isArray(obj) || _.isString(obj) || _.isArguments(obj)) return obj.length === 0;
6409
6478
  for (var key in obj) if (_.has(obj, key)) return false;
6410
6479
  return true;
6411
6480
  };
@@ -6418,18 +6487,19 @@ if (typeof module !== 'undefined' && module.exports) {
6418
6487
  // Is a given value an array?
6419
6488
  // Delegates to ECMA5's native Array.isArray
6420
6489
  _.isArray = nativeIsArray || function(obj) {
6421
- return toString.call(obj) == '[object Array]';
6490
+ return toString.call(obj) === '[object Array]';
6422
6491
  };
6423
6492
 
6424
6493
  // Is a given variable an object?
6425
6494
  _.isObject = function(obj) {
6426
- return obj === Object(obj);
6495
+ var type = typeof obj;
6496
+ return type === 'function' || type === 'object' && !!obj;
6427
6497
  };
6428
6498
 
6429
6499
  // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
6430
- each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
6500
+ _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
6431
6501
  _['is' + name] = function(obj) {
6432
- return toString.call(obj) == '[object ' + name + ']';
6502
+ return toString.call(obj) === '[object ' + name + ']';
6433
6503
  };
6434
6504
  });
6435
6505
 
@@ -6437,14 +6507,14 @@ if (typeof module !== 'undefined' && module.exports) {
6437
6507
  // there isn't any inspectable "Arguments" type.
6438
6508
  if (!_.isArguments(arguments)) {
6439
6509
  _.isArguments = function(obj) {
6440
- return !!(obj && _.has(obj, 'callee'));
6510
+ return _.has(obj, 'callee');
6441
6511
  };
6442
6512
  }
6443
6513
 
6444
- // Optimize `isFunction` if appropriate.
6445
- if (typeof (/./) !== 'function') {
6514
+ // Optimize `isFunction` if appropriate. Work around an IE 11 bug.
6515
+ if (typeof /./ !== 'function') {
6446
6516
  _.isFunction = function(obj) {
6447
- return typeof obj === 'function';
6517
+ return typeof obj == 'function' || false;
6448
6518
  };
6449
6519
  }
6450
6520
 
@@ -6455,12 +6525,12 @@ if (typeof module !== 'undefined' && module.exports) {
6455
6525
 
6456
6526
  // Is the given value `NaN`? (NaN is the only number which does not equal itself).
6457
6527
  _.isNaN = function(obj) {
6458
- return _.isNumber(obj) && obj != +obj;
6528
+ return _.isNumber(obj) && obj !== +obj;
6459
6529
  };
6460
6530
 
6461
6531
  // Is a given value a boolean?
6462
6532
  _.isBoolean = function(obj) {
6463
- return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
6533
+ return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
6464
6534
  };
6465
6535
 
6466
6536
  // Is a given value equal to null?
@@ -6476,7 +6546,7 @@ if (typeof module !== 'undefined' && module.exports) {
6476
6546
  // Shortcut function for checking if an object has a given property directly
6477
6547
  // on itself (in other words, not on a prototype).
6478
6548
  _.has = function(obj, key) {
6479
- return hasOwnProperty.call(obj, key);
6549
+ return obj != null && hasOwnProperty.call(obj, key);
6480
6550
  };
6481
6551
 
6482
6552
  // Utility Functions
@@ -6489,17 +6559,20 @@ if (typeof module !== 'undefined' && module.exports) {
6489
6559
  return this;
6490
6560
  };
6491
6561
 
6492
- // Keep the identity function around for default iterators.
6562
+ // Keep the identity function around for default iteratees.
6493
6563
  _.identity = function(value) {
6494
6564
  return value;
6495
6565
  };
6496
6566
 
6567
+ // Predicate-generating functions. Often useful outside of Underscore.
6497
6568
  _.constant = function(value) {
6498
- return function () {
6569
+ return function() {
6499
6570
  return value;
6500
6571
  };
6501
6572
  };
6502
6573
 
6574
+ _.noop = function(){};
6575
+
6503
6576
  _.property = function(key) {
6504
6577
  return function(obj) {
6505
6578
  return obj[key];
@@ -6508,20 +6581,23 @@ if (typeof module !== 'undefined' && module.exports) {
6508
6581
 
6509
6582
  // Returns a predicate for checking whether an object has a given set of `key:value` pairs.
6510
6583
  _.matches = function(attrs) {
6584
+ var pairs = _.pairs(attrs), length = pairs.length;
6511
6585
  return function(obj) {
6512
- if (obj === attrs) return true; //avoid comparing an object to itself.
6513
- for (var key in attrs) {
6514
- if (attrs[key] !== obj[key])
6515
- return false;
6586
+ if (obj == null) return !length;
6587
+ obj = new Object(obj);
6588
+ for (var i = 0; i < length; i++) {
6589
+ var pair = pairs[i], key = pair[0];
6590
+ if (pair[1] !== obj[key] || !(key in obj)) return false;
6516
6591
  }
6517
6592
  return true;
6518
- }
6593
+ };
6519
6594
  };
6520
6595
 
6521
6596
  // Run a function **n** times.
6522
- _.times = function(n, iterator, context) {
6597
+ _.times = function(n, iteratee, context) {
6523
6598
  var accum = Array(Math.max(0, n));
6524
- for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
6599
+ iteratee = createCallback(iteratee, context, 1);
6600
+ for (var i = 0; i < n; i++) accum[i] = iteratee(i);
6525
6601
  return accum;
6526
6602
  };
6527
6603
 
@@ -6535,54 +6611,44 @@ if (typeof module !== 'undefined' && module.exports) {
6535
6611
  };
6536
6612
 
6537
6613
  // A (possibly faster) way to get the current timestamp as an integer.
6538
- _.now = Date.now || function() { return new Date().getTime(); };
6539
-
6540
- // List of HTML entities for escaping.
6541
- var entityMap = {
6542
- escape: {
6543
- '&': '&amp;',
6544
- '<': '&lt;',
6545
- '>': '&gt;',
6546
- '"': '&quot;',
6547
- "'": '&#x27;'
6548
- }
6614
+ _.now = Date.now || function() {
6615
+ return new Date().getTime();
6549
6616
  };
6550
- entityMap.unescape = _.invert(entityMap.escape);
6551
6617
 
6552
- // Regexes containing the keys and values listed immediately above.
6553
- var entityRegexes = {
6554
- escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'),
6555
- unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g')
6618
+ // List of HTML entities for escaping.
6619
+ var escapeMap = {
6620
+ '&': '&amp;',
6621
+ '<': '&lt;',
6622
+ '>': '&gt;',
6623
+ '"': '&quot;',
6624
+ "'": '&#x27;',
6625
+ '`': '&#x60;'
6556
6626
  };
6627
+ var unescapeMap = _.invert(escapeMap);
6557
6628
 
6558
6629
  // Functions for escaping and unescaping strings to/from HTML interpolation.
6559
- _.each(['escape', 'unescape'], function(method) {
6560
- _[method] = function(string) {
6561
- if (string == null) return '';
6562
- return ('' + string).replace(entityRegexes[method], function(match) {
6563
- return entityMap[method][match];
6564
- });
6630
+ var createEscaper = function(map) {
6631
+ var escaper = function(match) {
6632
+ return map[match];
6565
6633
  };
6566
- });
6634
+ // Regexes for identifying a key that needs to be escaped
6635
+ var source = '(?:' + _.keys(map).join('|') + ')';
6636
+ var testRegexp = RegExp(source);
6637
+ var replaceRegexp = RegExp(source, 'g');
6638
+ return function(string) {
6639
+ string = string == null ? '' : '' + string;
6640
+ return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
6641
+ };
6642
+ };
6643
+ _.escape = createEscaper(escapeMap);
6644
+ _.unescape = createEscaper(unescapeMap);
6567
6645
 
6568
6646
  // If the value of the named `property` is a function then invoke it with the
6569
6647
  // `object` as context; otherwise, return it.
6570
6648
  _.result = function(object, property) {
6571
6649
  if (object == null) return void 0;
6572
6650
  var value = object[property];
6573
- return _.isFunction(value) ? value.call(object) : value;
6574
- };
6575
-
6576
- // Add your own custom functions to the Underscore object.
6577
- _.mixin = function(obj) {
6578
- each(_.functions(obj), function(name) {
6579
- var func = _[name] = obj[name];
6580
- _.prototype[name] = function() {
6581
- var args = [this._wrapped];
6582
- push.apply(args, arguments);
6583
- return result.call(this, func.apply(_, args));
6584
- };
6585
- });
6651
+ return _.isFunction(value) ? object[property]() : value;
6586
6652
  };
6587
6653
 
6588
6654
  // Generate a unique integer id (unique within the entire client session).
@@ -6613,22 +6679,26 @@ if (typeof module !== 'undefined' && module.exports) {
6613
6679
  '\\': '\\',
6614
6680
  '\r': 'r',
6615
6681
  '\n': 'n',
6616
- '\t': 't',
6617
6682
  '\u2028': 'u2028',
6618
6683
  '\u2029': 'u2029'
6619
6684
  };
6620
6685
 
6621
- var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
6686
+ var escaper = /\\|'|\r|\n|\u2028|\u2029/g;
6687
+
6688
+ var escapeChar = function(match) {
6689
+ return '\\' + escapes[match];
6690
+ };
6622
6691
 
6623
6692
  // JavaScript micro-templating, similar to John Resig's implementation.
6624
6693
  // Underscore templating handles arbitrary delimiters, preserves whitespace,
6625
6694
  // and correctly escapes quotes within interpolated code.
6626
- _.template = function(text, data, settings) {
6627
- var render;
6695
+ // NB: `oldSettings` only exists for backwards compatibility.
6696
+ _.template = function(text, settings, oldSettings) {
6697
+ if (!settings && oldSettings) settings = oldSettings;
6628
6698
  settings = _.defaults({}, settings, _.templateSettings);
6629
6699
 
6630
6700
  // Combine delimiters into one regular expression via alternation.
6631
- var matcher = new RegExp([
6701
+ var matcher = RegExp([
6632
6702
  (settings.escape || noMatch).source,
6633
6703
  (settings.interpolate || noMatch).source,
6634
6704
  (settings.evaluate || noMatch).source
@@ -6638,19 +6708,18 @@ if (typeof module !== 'undefined' && module.exports) {
6638
6708
  var index = 0;
6639
6709
  var source = "__p+='";
6640
6710
  text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
6641
- source += text.slice(index, offset)
6642
- .replace(escaper, function(match) { return '\\' + escapes[match]; });
6711
+ source += text.slice(index, offset).replace(escaper, escapeChar);
6712
+ index = offset + match.length;
6643
6713
 
6644
6714
  if (escape) {
6645
6715
  source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
6646
- }
6647
- if (interpolate) {
6716
+ } else if (interpolate) {
6648
6717
  source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
6649
- }
6650
- if (evaluate) {
6718
+ } else if (evaluate) {
6651
6719
  source += "';\n" + evaluate + "\n__p+='";
6652
6720
  }
6653
- index = offset + match.length;
6721
+
6722
+ // Adobe VMs need the match returned to produce the correct offest.
6654
6723
  return match;
6655
6724
  });
6656
6725
  source += "';\n";
@@ -6660,29 +6729,31 @@ if (typeof module !== 'undefined' && module.exports) {
6660
6729
 
6661
6730
  source = "var __t,__p='',__j=Array.prototype.join," +
6662
6731
  "print=function(){__p+=__j.call(arguments,'');};\n" +
6663
- source + "return __p;\n";
6732
+ source + 'return __p;\n';
6664
6733
 
6665
6734
  try {
6666
- render = new Function(settings.variable || 'obj', '_', source);
6735
+ var render = new Function(settings.variable || 'obj', '_', source);
6667
6736
  } catch (e) {
6668
6737
  e.source = source;
6669
6738
  throw e;
6670
6739
  }
6671
6740
 
6672
- if (data) return render(data, _);
6673
6741
  var template = function(data) {
6674
6742
  return render.call(this, data, _);
6675
6743
  };
6676
6744
 
6677
- // Provide the compiled function source as a convenience for precompilation.
6678
- template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}';
6745
+ // Provide the compiled source as a convenience for precompilation.
6746
+ var argument = settings.variable || 'obj';
6747
+ template.source = 'function(' + argument + '){\n' + source + '}';
6679
6748
 
6680
6749
  return template;
6681
6750
  };
6682
6751
 
6683
- // Add a "chain" function, which will delegate to the wrapper.
6752
+ // Add a "chain" function. Start chaining a wrapped Underscore object.
6684
6753
  _.chain = function(obj) {
6685
- return _(obj).chain();
6754
+ var instance = _(obj);
6755
+ instance._chain = true;
6756
+ return instance;
6686
6757
  };
6687
6758
 
6688
6759
  // OOP
@@ -6696,42 +6767,44 @@ if (typeof module !== 'undefined' && module.exports) {
6696
6767
  return this._chain ? _(obj).chain() : obj;
6697
6768
  };
6698
6769
 
6770
+ // Add your own custom functions to the Underscore object.
6771
+ _.mixin = function(obj) {
6772
+ _.each(_.functions(obj), function(name) {
6773
+ var func = _[name] = obj[name];
6774
+ _.prototype[name] = function() {
6775
+ var args = [this._wrapped];
6776
+ push.apply(args, arguments);
6777
+ return result.call(this, func.apply(_, args));
6778
+ };
6779
+ });
6780
+ };
6781
+
6699
6782
  // Add all of the Underscore functions to the wrapper object.
6700
6783
  _.mixin(_);
6701
6784
 
6702
6785
  // Add all mutator Array functions to the wrapper.
6703
- each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
6786
+ _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
6704
6787
  var method = ArrayProto[name];
6705
6788
  _.prototype[name] = function() {
6706
6789
  var obj = this._wrapped;
6707
6790
  method.apply(obj, arguments);
6708
- if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0];
6791
+ if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];
6709
6792
  return result.call(this, obj);
6710
6793
  };
6711
6794
  });
6712
6795
 
6713
6796
  // Add all accessor Array functions to the wrapper.
6714
- each(['concat', 'join', 'slice'], function(name) {
6797
+ _.each(['concat', 'join', 'slice'], function(name) {
6715
6798
  var method = ArrayProto[name];
6716
6799
  _.prototype[name] = function() {
6717
6800
  return result.call(this, method.apply(this._wrapped, arguments));
6718
6801
  };
6719
6802
  });
6720
6803
 
6721
- _.extend(_.prototype, {
6722
-
6723
- // Start chaining a wrapped Underscore object.
6724
- chain: function() {
6725
- this._chain = true;
6726
- return this;
6727
- },
6728
-
6729
- // Extracts the result from a wrapped and chained object.
6730
- value: function() {
6731
- return this._wrapped;
6732
- }
6733
-
6734
- });
6804
+ // Extracts the result from a wrapped and chained object.
6805
+ _.prototype.value = function() {
6806
+ return this._wrapped;
6807
+ };
6735
6808
 
6736
6809
  // AMD registration happens at the end for compatibility with AMD loaders
6737
6810
  // that may not enforce next-turn semantics on modules. Even though general
@@ -6745,7 +6818,7 @@ if (typeof module !== 'undefined' && module.exports) {
6745
6818
  return _;
6746
6819
  });
6747
6820
  }
6748
- }).call(this);
6821
+ }.call(this));
6749
6822
  //! moment.js
6750
6823
  //! version : 2.6.0
6751
6824
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
@@ -12834,10 +12907,10 @@ helpers = helpers || Handlebars.helpers; data = data || {};
12834
12907
  + "</span></th>\n <th><span class=\"scrivito_sortable sort_down\" data-scrivito-private-sort-by=\"last_changed\">";
12835
12908
  options = {hash:{},data:data};
12836
12909
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "changes_list.row.last_changed", options) : helperMissing.call(depth0, "translate", "changes_list.row.last_changed", options)))
12837
- + "</span></th>\n </tr>\n </thead>\n <tbody id=\"scrivito_changes_table_loaded\">\n </tbody>\n <tbody id=\"scrivito_changes_table_empty_result\" style=\"display:none;\">\n <tr>\n <td colspan=\"4\">\n ";
12910
+ + "</span></th>\n </tr>\n </thead>\n <tbody id=\"scrivito_changes_table_loaded\">\n </tbody>\n <tbody id=\"scrivito_changes_table_empty_result\" style=\"display:none;\">\n <tr>\n <td colspan=\"5\">\n ";
12838
12911
  options = {hash:{},data:data};
12839
12912
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "changes_list.empty_result", options) : helperMissing.call(depth0, "translate", "changes_list.empty_result", options)))
12840
- + "\n </td>\n </tr>\n </tbody>\n <tbody id=\"scrivito_changes_table_loading\">\n <tr>\n <td colspan=\"4\">\n <i class=\"scrivito_icon scrivito_spinning\">&#xf023;</i>\n </td>\n </tr>\n </tbody>\n\n </table>\n\n <span class=\"scrivito_load_more\" style=\"display: none;\">";
12913
+ + "\n </td>\n </tr>\n </tbody>\n <tbody id=\"scrivito_changes_table_loading\">\n <tr>\n <td colspan=\"5\">\n <i class=\"scrivito_icon scrivito_spinning\">&#xf023;</i>\n </td>\n </tr>\n </tbody>\n\n </table>\n\n <span class=\"scrivito_load_more\" style=\"display: none;\">";
12841
12914
  options = {hash:{},data:data};
12842
12915
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "changes_list.more", options) : helperMissing.call(depth0, "translate", "changes_list.more", options)))
12843
12916
  + "</span>\n\n </div>\n <div class=\"scrivito_modal_footer\">\n <a class=\"scrivito_button scrivito_cancel scrivito_green\" href=\"#\">";
@@ -13085,7 +13158,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
13085
13158
  this.ScrivitoHandlebarsTemplates["details_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
13086
13159
  this.compilerInfo = [3,'>= 1.0.0-rc.4'];
13087
13160
  helpers = helpers || Handlebars.helpers; data = data || {};
13088
- var buffer = "", stack1, stack2, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, self=this;
13161
+ var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, helperMissing=helpers.helperMissing;
13089
13162
 
13090
13163
  function program1(depth0,data) {
13091
13164
 
@@ -13098,11 +13171,12 @@ function program1(depth0,data) {
13098
13171
  else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13099
13172
  if(stack1 || stack1 === 0) { buffer += stack1; }
13100
13173
  buffer += "</i>";
13101
- options = {hash:{},data:data};
13102
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "details_dialog.title", depth0.title, options) : helperMissing.call(depth0, "translate", "details_dialog.title", depth0.title, options)))
13174
+ if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13175
+ else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13176
+ buffer += escapeExpression(stack1)
13103
13177
  + "</h3>\n <div class=\"scrivito_details_dialog_saving_indicator\"></div>\n ";
13104
- stack2 = helpers['if'].call(depth0, depth0.obj, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
13105
- if(stack2 || stack2 === 0) { buffer += stack2; }
13178
+ stack1 = helpers['if'].call(depth0, depth0.obj, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
13179
+ if(stack1 || stack1 === 0) { buffer += stack1; }
13106
13180
  buffer += "\n </div>\n\n <div class=\"scrivito_modal_body scrivito_auto_height\">\n <i class=\"scrivito_icon scrivito_spinning\">&#xf023;</i>\n <div class=\"scrivito_details_dialog_markup\"></div>\n </div>\n\n <div class=\"scrivito_modal_footer\">\n <a href=\"#\" class=\"scrivito_button scrivito_cancel scrivito_green\">";
13107
13181
  options = {hash:{},data:data};
13108
13182
  buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "done", options) : helperMissing.call(depth0, "translate", "done", options)))
@@ -13301,64 +13375,19 @@ function program3(depth0,data) {
13301
13375
 
13302
13376
  function program5(depth0,data) {
13303
13377
 
13304
- var buffer = "", stack1;
13378
+ var buffer = "", stack1, stack2;
13305
13379
  buffer += "\n ";
13306
- stack1 = helpers['if'].call(depth0, depth0.is_present, {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
13307
- if(stack1 || stack1 === 0) { buffer += stack1; }
13380
+ stack2 = ((stack1 = depth0.render),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
13381
+ if(stack2 || stack2 === 0) { buffer += stack2; }
13308
13382
  buffer += "\n ";
13309
13383
  return buffer;
13310
13384
  }
13311
- function program6(depth0,data) {
13312
-
13313
- var buffer = "", stack1;
13314
- buffer += "\n <li class=\"scrivito_menu_item scrivito_";
13315
- if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13316
- else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13317
- buffer += escapeExpression(stack1)
13318
- + " ";
13319
- stack1 = helpers['if'].call(depth0, depth0.is_disabled, {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
13320
- if(stack1 || stack1 === 0) { buffer += stack1; }
13321
- buffer += "\">\n <span title=\"";
13322
- stack1 = helpers['if'].call(depth0, depth0.is_enabled, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data});
13323
- if(stack1 || stack1 === 0) { buffer += stack1; }
13324
- buffer += "\">\n <i class=\"scrivito_icon\">";
13325
- if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13326
- else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13327
- if(stack1 || stack1 === 0) { buffer += stack1; }
13328
- buffer += "</i>";
13329
- if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13330
- else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13331
- buffer += escapeExpression(stack1)
13332
- + "\n </span>\n </li>\n ";
13333
- return buffer;
13334
- }
13335
- function program7(depth0,data) {
13336
-
13337
-
13338
- return "scrivito_disabled";
13339
- }
13340
-
13341
- function program9(depth0,data) {
13342
-
13343
- var stack1;
13344
- if (stack1 = helpers.tooltip) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13345
- else { stack1 = depth0.tooltip; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13346
- return escapeExpression(stack1);
13347
- }
13348
-
13349
- function program11(depth0,data) {
13350
-
13351
- var stack1;
13352
- if (stack1 = helpers.reason_for_being_disabled) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13353
- else { stack1 = depth0.reason_for_being_disabled; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13354
- return escapeExpression(stack1);
13355
- }
13356
13385
 
13357
13386
  buffer += "<div class=\"scrivito_editing_marker_menu\">\n <ul class=\"scrivito_menu_box ";
13358
13387
  stack1 = helpers['if'].call(depth0, depth0.align, {hash:{},inverse:self.program(3, program3, data),fn:self.program(1, program1, data),data:data});
13359
13388
  if(stack1 || stack1 === 0) { buffer += stack1; }
13360
13389
  buffer += "\">\n ";
13361
- stack1 = helpers.each.call(depth0, depth0.commands, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
13390
+ stack1 = helpers.each.call(depth0, depth0.menu_items, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
13362
13391
  if(stack1 || stack1 === 0) { buffer += stack1; }
13363
13392
  buffer += "\n </ul>\n</div>\n";
13364
13393
  return buffer;
@@ -13373,7 +13402,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
13373
13402
 
13374
13403
 
13375
13404
 
13376
- return "<div class=\"scrivito_topbar\">\n <div class=\"scrivito_first_level\">\n <div id=\"scrivito_menu_bar_toggle\" class=\"scrivito_viewmodes_wrapper\"></div>\n <div class=\"scrivito_button_bar scrivito_app scrivito_no_hover\"><span class=\"scrivito_logo\"></span></div>\n <div id=\"scrivito_select_workspace\" class=\"scrivito_button_bar\"></div>\n <div id=\"scrivito_current_page_menu\" class=\"scrivito_button_bar scrivito_right\"></div>\n <div id=\"scrivito_current_page_restriction\"></div>\n <div id=\"scrivito_menu_bar_saving_indicator\"></div>\n </div>\n</div>\n";
13405
+ return "<div class=\"scrivito_topbar\">\n <div class=\"scrivito_first_level\">\n <div id=\"scrivito_menu_bar_toggle\" class=\"scrivito_viewmodes_wrapper\"></div>\n <div class=\"scrivito_button_bar scrivito_app scrivito_no_hover\"><span class=\"scrivito_logo\"></span></div>\n <div id=\"scrivito_workspace_select\" class=\"scrivito_button_bar\"></div>\n <div id=\"scrivito_current_page_menu\" class=\"scrivito_button_bar scrivito_right\"></div>\n <div id=\"scrivito_current_page_restriction\"></div>\n <div id=\"scrivito_menu_bar_saving_indicator\"></div>\n </div>\n</div>\n";
13377
13406
  });
13378
13407
  return this.ScrivitoHandlebarsTemplates["menu_bar"];
13379
13408
  }).call(this);
@@ -13412,30 +13441,102 @@ helpers = helpers || Handlebars.helpers; data = data || {};
13412
13441
  }).call(this);
13413
13442
  (function() {
13414
13443
  this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
13415
- this.ScrivitoHandlebarsTemplates["obj_menu"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
13444
+ this.ScrivitoHandlebarsTemplates["menu_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
13416
13445
  this.compilerInfo = [3,'>= 1.0.0-rc.4'];
13417
13446
  helpers = helpers || Handlebars.helpers; data = data || {};
13418
- var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression, self=this;
13447
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
13419
13448
 
13420
13449
  function program1(depth0,data) {
13421
13450
 
13422
13451
 
13423
- return "\n scrivito_new\n ";
13452
+ return "scrivito_disabled";
13424
13453
  }
13425
13454
 
13426
13455
  function program3(depth0,data) {
13427
13456
 
13428
-
13429
- return "\n scrivito_changed\n ";
13457
+ var stack1;
13458
+ if (stack1 = helpers.tooltip) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13459
+ else { stack1 = depth0.tooltip; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13460
+ return escapeExpression(stack1);
13430
13461
  }
13431
13462
 
13432
13463
  function program5(depth0,data) {
13433
13464
 
13434
-
13435
- return "\n scrivito_deleted\n ";
13465
+ var stack1;
13466
+ if (stack1 = helpers.reason_for_being_disabled) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13467
+ else { stack1 = depth0.reason_for_being_disabled; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13468
+ return escapeExpression(stack1);
13436
13469
  }
13437
13470
 
13438
- function program7(depth0,data) {
13471
+ buffer += "<li class=\"scrivito_menu_item scrivito_";
13472
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13473
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13474
+ buffer += escapeExpression(stack1)
13475
+ + " ";
13476
+ stack1 = helpers['if'].call(depth0, depth0.is_disabled, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
13477
+ if(stack1 || stack1 === 0) { buffer += stack1; }
13478
+ buffer += "\">\n <span title=\"";
13479
+ stack1 = helpers['if'].call(depth0, depth0.is_enabled, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data),data:data});
13480
+ if(stack1 || stack1 === 0) { buffer += stack1; }
13481
+ buffer += "\">\n <i class=\"scrivito_icon\">";
13482
+ if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13483
+ else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13484
+ if(stack1 || stack1 === 0) { buffer += stack1; }
13485
+ buffer += "</i>";
13486
+ if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13487
+ else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13488
+ buffer += escapeExpression(stack1)
13489
+ + "\n </span>\n</li>\n";
13490
+ return buffer;
13491
+ });
13492
+ return this.ScrivitoHandlebarsTemplates["menu_item"];
13493
+ }).call(this);
13494
+ (function() {
13495
+ this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
13496
+ this.ScrivitoHandlebarsTemplates["menu_item/spinner"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
13497
+ this.compilerInfo = [3,'>= 1.0.0-rc.4'];
13498
+ helpers = helpers || Handlebars.helpers; data = data || {};
13499
+ var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing;
13500
+
13501
+
13502
+ buffer += "<li id=\"";
13503
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13504
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13505
+ buffer += escapeExpression(stack1)
13506
+ + "\" class=\"scrivito_menu_item\">\n <span>\n <i class=\"scrivito_icon scrivito_spinning\">&#xf023;</i>\n ";
13507
+ options = {hash:{},data:data};
13508
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_item.spinner.loading", options) : helperMissing.call(depth0, "translate", "menu_item.spinner.loading", options)))
13509
+ + "\n </span>\n</li>\n";
13510
+ return buffer;
13511
+ });
13512
+ return this.ScrivitoHandlebarsTemplates["menu_item/spinner"];
13513
+ }).call(this);
13514
+ (function() {
13515
+ this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
13516
+ this.ScrivitoHandlebarsTemplates["obj_menu"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
13517
+ this.compilerInfo = [3,'>= 1.0.0-rc.4'];
13518
+ helpers = helpers || Handlebars.helpers; data = data || {};
13519
+ var buffer = "", stack1, stack2, functionType="function", escapeExpression=this.escapeExpression, self=this;
13520
+
13521
+ function program1(depth0,data) {
13522
+
13523
+
13524
+ return "\n scrivito_new\n ";
13525
+ }
13526
+
13527
+ function program3(depth0,data) {
13528
+
13529
+
13530
+ return "\n scrivito_changed\n ";
13531
+ }
13532
+
13533
+ function program5(depth0,data) {
13534
+
13535
+
13536
+ return "\n scrivito_deleted\n ";
13537
+ }
13538
+
13539
+ function program7(depth0,data) {
13439
13540
 
13440
13541
 
13441
13542
  return "\n scrivito_conflict\n ";
@@ -13636,146 +13737,189 @@ helpers = helpers || Handlebars.helpers; data = data || {};
13636
13737
  }).call(this);
13637
13738
  (function() {
13638
13739
  this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
13639
- this.ScrivitoHandlebarsTemplates["workspace_select_list"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
13740
+ this.ScrivitoHandlebarsTemplates["workspace_select"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
13640
13741
  this.compilerInfo = [3,'>= 1.0.0-rc.4'];
13641
13742
  helpers = helpers || Handlebars.helpers; data = data || {};
13642
- var buffer = "", stack1, self=this, functionType="function", escapeExpression=this.escapeExpression;
13743
+ var buffer = "", stack1, stack2, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, functionType="function", self=this;
13643
13744
 
13644
13745
  function program1(depth0,data) {
13645
13746
 
13646
- var buffer = "", stack1, stack2;
13647
- buffer += "\n ";
13648
- stack1 = helpers.unless.call(depth0, depth0.is_editable, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
13747
+ var buffer = "", stack1;
13748
+ buffer += "\n <i class=\"scrivito_icon\">";
13749
+ if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13750
+ else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13649
13751
  if(stack1 || stack1 === 0) { buffer += stack1; }
13650
- buffer += "\n\n <li class=\"scrivito_menu_item\">\n <span>\n <i class=\"scrivito_icon\" title=\""
13651
- + escapeExpression(((stack1 = depth0.long_title),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
13652
- + "\">\n ";
13653
- stack2 = helpers['if'].call(depth0, depth0.is_editable, {hash:{},inverse:self.program(6, program6, data),fn:self.program(4, program4, data),data:data});
13654
- if(stack2 || stack2 === 0) { buffer += stack2; }
13655
- buffer += "\n </i>\n "
13656
- + escapeExpression(((stack1 = depth0.select_title),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
13657
- + "\n ";
13658
- stack2 = helpers['if'].call(depth0, depth0.is_current_workspace, {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data});
13659
- if(stack2 || stack2 === 0) { buffer += stack2; }
13660
- buffer += "\n </span>\n </li>\n";
13752
+ buffer += "</i>\n <span class=\"scrivito_button_label\">";
13753
+ if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13754
+ else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13755
+ buffer += escapeExpression(stack1)
13756
+ + "</span>\n ";
13757
+ stack1 = helpers['if'].call(depth0, depth0.is_outdated, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
13758
+ if(stack1 || stack1 === 0) { buffer += stack1; }
13759
+ buffer += "\n";
13661
13760
  return buffer;
13662
13761
  }
13663
13762
  function program2(depth0,data) {
13664
13763
 
13665
-
13666
- return "\n <li class=\"scrivito_menu_separator\"></li>\n ";
13764
+ var buffer = "", stack1, options;
13765
+ buffer += "\n <span class=\"scrivito_button_notice\">\n <i class=\"scrivito_icon\">&#xf021;</i>\n ";
13766
+ options = {hash:{},data:data};
13767
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "workspace_select.outdated", options) : helperMissing.call(depth0, "translate", "workspace_select.outdated", options)))
13768
+ + "\n </span>\n ";
13769
+ return buffer;
13667
13770
  }
13668
13771
 
13669
13772
  function program4(depth0,data) {
13670
13773
 
13774
+ var buffer = "", stack1, stack2, options;
13775
+ buffer += "\n <li class=\"scrivito_menu_separator\">\n <span>";
13776
+ options = {hash:{},data:data};
13777
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "workspace_select.this_workspace", options) : helperMissing.call(depth0, "translate", "workspace_select.this_workspace", options)))
13778
+ + "</span>\n </li>\n ";
13779
+ stack2 = helpers.each.call(depth0, ((stack1 = depth0.commands),stack1 == null || stack1 === false ? stack1 : stack1.for_editable), {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
13780
+ if(stack2 || stack2 === 0) { buffer += stack2; }
13781
+ buffer += "\n <li class=\"scrivito_menu_separator\"></li>\n ";
13782
+ return buffer;
13783
+ }
13784
+ function program5(depth0,data) {
13671
13785
 
13672
- return "\n &#xf011;\n ";
13786
+ var buffer = "", stack1, stack2, options;
13787
+ buffer += "\n ";
13788
+ options = {hash:{},data:data};
13789
+ stack2 = ((stack1 = helpers.render),stack1 ? stack1.call(depth0, "workspace_select/menu_item", depth0, options) : helperMissing.call(depth0, "render", "workspace_select/menu_item", depth0, options));
13790
+ if(stack2 || stack2 === 0) { buffer += stack2; }
13791
+ buffer += "\n ";
13792
+ return buffer;
13673
13793
  }
13674
13794
 
13675
- function program6(depth0,data) {
13795
+ function program7(depth0,data) {
13796
+
13797
+ var buffer = "", stack1, stack2, options;
13798
+ buffer += "\n <li class=\"scrivito_menu_separator\"></li>\n ";
13799
+ options = {hash:{},data:data};
13800
+ stack2 = ((stack1 = helpers.render),stack1 ? stack1.call(depth0, "workspace_select/menu_item", ((stack1 = depth0.commands),stack1 == null || stack1 === false ? stack1 : stack1.select_published), options) : helperMissing.call(depth0, "render", "workspace_select/menu_item", ((stack1 = depth0.commands),stack1 == null || stack1 === false ? stack1 : stack1.select_published), options));
13801
+ if(stack2 || stack2 === 0) { buffer += stack2; }
13802
+ buffer += "\n ";
13803
+ return buffer;
13804
+ }
13805
+
13806
+ stack1 = helpers['with'].call(depth0, depth0.selected_workspace, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
13807
+ if(stack1 || stack1 === 0) { buffer += stack1; }
13808
+ buffer += "\n\n<ul class=\"scrivito_menu_box\" style=\"display:none\">\n ";
13809
+ stack2 = helpers['if'].call(depth0, ((stack1 = depth0.selected_workspace),stack1 == null || stack1 === false ? stack1 : stack1.is_editable), {hash:{},inverse:self.noop,fn:self.program(4, program4, data),data:data});
13810
+ if(stack2 || stack2 === 0) { buffer += stack2; }
13811
+ buffer += "\n\n <li class=\"scrivito_menu_separator\">\n <span>";
13812
+ options = {hash:{},data:data};
13813
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "workspace_select.other_workspaces", options) : helperMissing.call(depth0, "translate", "workspace_select.other_workspaces", options)))
13814
+ + "</span>\n </li>\n\n ";
13815
+ options = {hash:{},data:data};
13816
+ stack2 = ((stack1 = helpers.render),stack1 ? stack1.call(depth0, "workspace_select/menu_item", ((stack1 = depth0.commands),stack1 == null || stack1 === false ? stack1 : stack1.create_workspace), options) : helperMissing.call(depth0, "render", "workspace_select/menu_item", ((stack1 = depth0.commands),stack1 == null || stack1 === false ? stack1 : stack1.create_workspace), options));
13817
+ if(stack2 || stack2 === 0) { buffer += stack2; }
13818
+ buffer += "\n\n <li class=\"scrivito_menu_item scrivito_workspace_list\">\n <span>\n <i class=\"scrivito_icon scrivito_spinning\">&#xf023;</i>\n ";
13819
+ options = {hash:{},data:data};
13820
+ buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.loading_workspaces", options) : helperMissing.call(depth0, "translate", "menu_bar.loading_workspaces", options)))
13821
+ + "\n </span>\n </li>\n\n ";
13822
+ stack2 = helpers.unless.call(depth0, ((stack1 = depth0.selected_workspace),stack1 == null || stack1 === false ? stack1 : stack1.is_published), {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
13823
+ if(stack2 || stack2 === 0) { buffer += stack2; }
13824
+ buffer += "\n</ul>\n";
13825
+ return buffer;
13826
+ });
13827
+ return this.ScrivitoHandlebarsTemplates["workspace_select"];
13828
+ }).call(this);
13829
+ (function() {
13830
+ this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
13831
+ this.ScrivitoHandlebarsTemplates["workspace_select/menu_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
13832
+ this.compilerInfo = [3,'>= 1.0.0-rc.4'];
13833
+ helpers = helpers || Handlebars.helpers; data = data || {};
13834
+ var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
13835
+
13836
+ function program1(depth0,data) {
13676
13837
 
13677
13838
 
13678
- return "\n &#xf064;\n ";
13839
+ return "scrivito_highlight";
13679
13840
  }
13680
13841
 
13681
- function program8(depth0,data) {
13842
+ function program3(depth0,data) {
13682
13843
 
13683
13844
 
13684
- return "\n <i class=\"scrivito_icon\" title=\"check\">&#61503;</i>\n ";
13845
+ return "scrivito_disabled";
13685
13846
  }
13686
13847
 
13687
- stack1 = helpers.each.call(depth0, depth0.workspaces, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
13848
+ function program5(depth0,data) {
13849
+
13850
+ var stack1;
13851
+ if (stack1 = helpers.tooltip) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13852
+ else { stack1 = depth0.tooltip; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13853
+ return escapeExpression(stack1);
13854
+ }
13855
+
13856
+ function program7(depth0,data) {
13857
+
13858
+ var stack1;
13859
+ if (stack1 = helpers.reason_for_being_disabled) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13860
+ else { stack1 = depth0.reason_for_being_disabled; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13861
+ return escapeExpression(stack1);
13862
+ }
13863
+
13864
+ buffer += "<li id=\"scrivito_";
13865
+ if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13866
+ else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13867
+ buffer += escapeExpression(stack1)
13868
+ + "\" class=\"scrivito_menu_item\n ";
13869
+ stack1 = helpers['if'].call(depth0, depth0.is_action_required, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
13688
13870
  if(stack1 || stack1 === 0) { buffer += stack1; }
13689
- buffer += "\n";
13871
+ buffer += "\n ";
13872
+ stack1 = helpers['if'].call(depth0, depth0.is_disabled, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
13873
+ if(stack1 || stack1 === 0) { buffer += stack1; }
13874
+ buffer += "\">\n <span title=\"";
13875
+ stack1 = helpers['if'].call(depth0, depth0.is_enabled, {hash:{},inverse:self.program(7, program7, data),fn:self.program(5, program5, data),data:data});
13876
+ if(stack1 || stack1 === 0) { buffer += stack1; }
13877
+ buffer += "\">\n <i class=\"scrivito_icon\">";
13878
+ if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13879
+ else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13880
+ if(stack1 || stack1 === 0) { buffer += stack1; }
13881
+ buffer += "</i> ";
13882
+ if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13883
+ else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13884
+ buffer += escapeExpression(stack1)
13885
+ + "\n </span>\n</li>\n";
13690
13886
  return buffer;
13691
13887
  });
13692
- return this.ScrivitoHandlebarsTemplates["workspace_select_list"];
13888
+ return this.ScrivitoHandlebarsTemplates["workspace_select/menu_item"];
13693
13889
  }).call(this);
13694
13890
  (function() {
13695
13891
  this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
13696
- this.ScrivitoHandlebarsTemplates["workspace_select_menu_bar_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
13892
+ this.ScrivitoHandlebarsTemplates["workspace_select/other_workspaces"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
13697
13893
  this.compilerInfo = [3,'>= 1.0.0-rc.4'];
13698
13894
  helpers = helpers || Handlebars.helpers; data = data || {};
13699
- var buffer = "", stack1, stack2, options, functionType="function", escapeExpression=this.escapeExpression, helperMissing=helpers.helperMissing, self=this;
13895
+ var buffer = "", stack1, stack2, helperMissing=helpers.helperMissing, self=this;
13700
13896
 
13701
13897
  function program1(depth0,data) {
13702
13898
 
13899
+
13900
+ return "\n <li class=\"scrivito_menu_separator\"></li>\n";
13901
+ }
13902
+
13903
+ function program3(depth0,data) {
13904
+
13703
13905
  var buffer = "", stack1, stack2, options;
13704
- buffer += "\n <li class=\"scrivito_menu_separator\"></li>\n\n <li id=\"scrivito_workspace_settings\" class=\"scrivito_menu_item\">\n <span>\n <i class=\"scrivito_icon\">";
13705
- stack2 = ((stack1 = ((stack1 = depth0.workspace_settings_command),stack1 == null || stack1 === false ? stack1 : stack1.icon)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
13706
- if(stack2 || stack2 === 0) { buffer += stack2; }
13707
- buffer += "</i>\n "
13708
- + escapeExpression(((stack1 = ((stack1 = depth0.workspace_settings_command),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
13709
- + "\n </span>\n </li>\n\n <li id=\"scrivito_changes_list_toggle\" class=\"scrivito_menu_item\">\n <span>\n <i class=\"scrivito_icon\" title=\"";
13710
- options = {hash:{},data:data};
13711
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "changes_list.menu_item", options) : helperMissing.call(depth0, "translate", "changes_list.menu_item", options)))
13712
- + "\">&#xf080;</i>\n ";
13906
+ buffer += "\n ";
13713
13907
  options = {hash:{},data:data};
13714
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "changes_list.menu_item", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "changes_list.menu_item", depth0.current_short_title, options)))
13715
- + "\n </span>\n </li>\n <li class=\"scrivito_menu_item ";
13716
- stack2 = helpers['if'].call(depth0, ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.is_disabled), {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
13908
+ stack2 = ((stack1 = helpers.render),stack1 ? stack1.call(depth0, "workspace_select/menu_item", depth0, options) : helperMissing.call(depth0, "render", "workspace_select/menu_item", depth0, options));
13717
13909
  if(stack2 || stack2 === 0) { buffer += stack2; }
13718
- buffer += "\">\n <span id='"
13719
- + escapeExpression(((stack1 = ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
13720
- + "' title='"
13721
- + escapeExpression(((stack1 = ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.reason_for_being_disabled)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
13722
- + "'>\n <i class=\"scrivito_icon\" title=\""
13723
- + escapeExpression(((stack1 = ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.tooltip)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
13724
- + "\">\n ";
13725
- stack2 = ((stack1 = ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.icon)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
13726
- if(stack2 || stack2 === 0) { buffer += stack2; }
13727
- buffer += "\n </i>\n "
13728
- + escapeExpression(((stack1 = ((stack1 = depth0.publish_command),stack1 == null || stack1 === false ? stack1 : stack1.title)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
13729
- + "\n </span>\n </li>\n <li class=\"scrivito_menu_item\">\n <span id='scrivito_rename_current_ws'>\n <i class=\"scrivito_icon\"\n title=\"";
13730
- options = {hash:{},data:data};
13731
- 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)))
13732
- + " \">&#61519;</i>\n ";
13733
- options = {hash:{},data:data};
13734
- 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)))
13735
- + "\n </span>\n </li>\n <li class=\"scrivito_menu_item\">\n <span id='scrivito_rebase_current_ws'>\n <i class=\"scrivito_icon\"\n title=\"";
13736
- options = {hash:{},data:data};
13737
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rebase_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rebase_working_copy", depth0.current_short_title, options)))
13738
- + " \">\n &#xf023;\n </i>\n ";
13739
- options = {hash:{},data:data};
13740
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.rebase_working_copy", depth0.current_short_title, options) : helperMissing.call(depth0, "translate", "menu_bar.rebase_working_copy", depth0.current_short_title, options)))
13741
- + "\n </span>\n </li>\n <li class=\"scrivito_menu_item\">\n <span id='scrivito_delete_current_ws'>\n <i class=\"scrivito_icon\"\n title=\"";
13742
- options = {hash:{},data:data};
13743
- 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)))
13744
- + " \">&#61464;</i>\n ";
13745
- options = {hash:{},data:data};
13746
- 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)))
13747
- + "\n </span>\n </li>\n ";
13910
+ buffer += "\n";
13748
13911
  return buffer;
13749
13912
  }
13750
- function program2(depth0,data) {
13751
-
13752
-
13753
- return "scrivito_disabled";
13754
- }
13755
13913
 
13756
- buffer += "<i class=\"scrivito_icon\">&#xf011;</i>\n<span class=\"scrivito_button_label\">";
13757
- if (stack1 = helpers.current_long_title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
13758
- else { stack1 = depth0.current_long_title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
13759
- buffer += escapeExpression(stack1)
13760
- + "</span>\n\n<ul class=\"scrivito_menu_box\" style=\"display: none;\">\n <li class=\"scrivito_menu_item\">\n <span id='scrivito_create_new_ws'>\n <i class=\"scrivito_icon\" title=\"";
13761
- options = {hash:{},data:data};
13762
- 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)))
13763
- + "\">&#61474;</i>\n ";
13764
- options = {hash:{},data:data};
13765
- 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)))
13766
- + "\n </span>\n </li>\n ";
13767
- 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});
13914
+ stack2 = helpers['if'].call(depth0, ((stack1 = depth0.commands),stack1 == null || stack1 === false ? stack1 : stack1.length), {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
13768
13915
  if(stack2 || stack2 === 0) { buffer += stack2; }
13769
- buffer += "\n <li class=\"scrivito_menu_separator\"></li>\n <li class=\"scrivito_menu_item\" id=\"scrivito_replace_with_real_ws\">\n <span>\n <i class=\"scrivito_icon scrivito_spinning\"\n title=\"";
13770
- options = {hash:{},data:data};
13771
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.loading_workspaces", options) : helperMissing.call(depth0, "translate", "menu_bar.loading_workspaces", options)))
13772
- + "\">&#61475;</i>\n ";
13773
- options = {hash:{},data:data};
13774
- buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.loading_workspaces", options) : helperMissing.call(depth0, "translate", "menu_bar.loading_workspaces", options)))
13775
- + "\n </span>\n </li>\n</ul>\n";
13916
+ buffer += "\n";
13917
+ stack2 = helpers.each.call(depth0, depth0.commands, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
13918
+ if(stack2 || stack2 === 0) { buffer += stack2; }
13919
+ buffer += "\n";
13776
13920
  return buffer;
13777
13921
  });
13778
- return this.ScrivitoHandlebarsTemplates["workspace_select_menu_bar_item"];
13922
+ return this.ScrivitoHandlebarsTemplates["workspace_select/other_workspaces"];
13779
13923
  }).call(this);
13780
13924
  (function() {
13781
13925
  this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
@@ -13825,11 +13969,20 @@ $.i18n().load({
13825
13969
  'obj.tooltip.has_conflict': 'Auf dieser Seite gab es parallele Änderungen, die mit den Änderungen in dieser Arbeitskopie zusammengeführt werden sollten.',
13826
13970
  'obj.tooltip.is_deleted': 'Diese Seite wurde gelöscht.',
13827
13971
 
13972
+ 'workspace.title_published': 'Veröffentlichte Inhalte',
13973
+ 'workspace.empty_title': '<leerer Titel>',
13974
+
13828
13975
  'workspace_settings_dialog.owners': 'Besitzer',
13829
13976
  'workspace_settings_dialog.nothing_found': 'Nichts gefunden',
13830
13977
  'workspace_settings_dialog.searching': 'Suche...',
13831
13978
  'workspace_settings_dialog.too_short': 'Benutzer suchen...',
13832
13979
 
13980
+ 'workspace_select.outdated': 'veraltet',
13981
+ 'workspace_select.this_workspace': 'Diese Arbeitskopie',
13982
+ 'workspace_select.other_workspaces': 'Andere Arbeitskopien',
13983
+
13984
+ 'menu_item.spinner.loading': 'Laden...',
13985
+
13833
13986
  'choose_obj_class_dialog.add_child_page.title': 'Seitenvorlage auswählen',
13834
13987
  'choose_obj_class_dialog.add_widget.title': 'Widget auswählen',
13835
13988
 
@@ -13842,9 +13995,7 @@ $.i18n().load({
13842
13995
  'editable_ws_dialog.create_new_playholder': 'Titel der neuen Arbeitskopie',
13843
13996
  'editable_ws_dialog.select': 'Auswählen',
13844
13997
 
13845
- 'details_dialog.title': '$1 bearbeiten',
13846
-
13847
- 'resource_dialog.title': 'Ressource',
13998
+ 'resource_dialog.title': 'Eigenschaften der Ressource "$1"',
13848
13999
 
13849
14000
  'resource_dialog.commands.revert_obj.title': 'Änderungen an Ressource verwerfen',
13850
14001
  'resource_dialog.commands.revert_obj.rtc_workspace': 'Diese Ressource ist Teil der "rtc"-Arbeitskopie, bei der Änderungen nicht verworfen werden können.',
@@ -13862,26 +14013,10 @@ $.i18n().load({
13862
14013
  'resource_dialog.commands.delete_obj.dialog.title': 'Wirklich diese Ressource löschen?',
13863
14014
  'resource_dialog.commands.delete_obj.dialog.description': 'Änderungen an einer gelöschten Ressource können nicht wiederhergestellt werden.',
13864
14015
 
13865
- 'menu_bar.working_copy': 'Arbeitskopie',
13866
- 'menu_bar.empty_workspace_title': '<leerer Titel>',
13867
- 'menu_bar.published_workspace_title': 'Veröffentlichte Inhalte',
13868
14016
  'menu_bar.loading_workspaces': 'Lade Arbeitskopien',
13869
- 'menu_bar.select_working_copy': '"$1" auswählen',
13870
- 'menu_bar.rebase_working_copy': '"$1" aktualisieren',
13871
- 'menu_bar.rename_working_copy': '"$1" umbenennen',
13872
- 'menu_bar.rename_working_copy_desc': 'Bitte geben Sie den neuen Titel der Arbeitskopie ein.',
13873
- 'menu_bar.rename': 'Umbenennen',
13874
- 'menu_bar.delete_working_copy': '"$1" löschen',
13875
- 'menu_bar.delete_ws_confirmation': 'Wirklich "$1" löschen?',
13876
- 'menu_bar.delete_ws_confirmation_desc': 'Eine gelöschte Arbeitskopie kann nicht wiederhergestellt werden.',
13877
- 'menu_bar.delete': 'Löschen',
13878
14017
  'menu_bar.move': 'Verschieben',
13879
14018
  'menu_bar.copy': 'Kopieren',
13880
14019
  'menu_bar.create': 'Anlegen',
13881
- 'menu_bar.create_new_working_copy': 'Arbeitskopie anlegen',
13882
- 'menu_bar.create_new_ws_confirmation': 'Arbeitskopie anlegen',
13883
- 'menu_bar.create_new_ws_confirmation_desc': 'Bitte geben Sie den Titel der neuen Arbeitskopie ein.',
13884
- 'menu_bar.create_new_ws_confirmation_placeholder': 'Neuer Titel',
13885
14020
 
13886
14021
  'saving_indicator_item.saving': 'Wird gespeichert...',
13887
14022
  'saving_indicator_item.saved': 'Änderungen gespeichert',
@@ -13896,7 +14031,6 @@ $.i18n().load({
13896
14031
 
13897
14032
  'child_list_menu.description': 'Elemente von $1',
13898
14033
 
13899
- 'changes_list.menu_item': 'Änderungen von "$1"',
13900
14034
  'changes_list.title': 'Änderungen von "$1"',
13901
14035
  'changes_list.empty_result': 'In dieser Arbeitskopie wurde nichts geändert.',
13902
14036
  'changes_list.more': 'Mehr...',
@@ -13906,9 +14040,33 @@ $.i18n().load({
13906
14040
  'changes_list.row.type': 'Typ',
13907
14041
  'changes_list.row.last_changed': 'Letzte Änderung',
13908
14042
 
13909
- 'commands.workspace_settings.title': 'Einstellungen von "$1"',
14043
+ 'commands.create_workspace.title': 'Arbeitskopie anlegen',
14044
+ 'commands.create_workspace.dialog.title': 'Arbeitskopie anlegen',
14045
+ 'commands.create_workspace.dialog.description': 'Bitte geben Sie den Titel der neuen Arbeitskopie ein.',
14046
+ 'commands.create_workspace.dialog.placeholder': 'Neuer Titel',
14047
+ 'commands.create_workspace.dialog.accept': 'Anlegen',
14048
+
14049
+ 'commands.rename_workspace.title': 'Umbenennen',
14050
+ 'commands.rename_workspace.dialog.title': '"$1" umbenennen',
14051
+ 'commands.rename_workspace.dialog.description': 'Bitte geben Sie den neuen Titel der Arbeitskopie ein.',
14052
+ 'commands.rename_workspace.dialog.accept': 'Umbenennen',
14053
+
14054
+ 'commands.rebase_workspace.title': 'Aktualisieren',
14055
+ 'commands.rebase_workspace.tooltip': 'Arbeitskopie "$1" is veraltet. Bitte aktualisieren Sie sie.',
14056
+ 'commands.rebase_workspace.uptodate': 'Arbeitskopie "$1" muss nicht aktualisiert werden.',
14057
+
14058
+ 'commands.delete_workspace.title': 'Löschen',
14059
+ 'commands.delete_workspace.dialog.title': 'Wirklich "$1" löschen?',
14060
+ 'commands.delete_workspace.dialog.description': 'Eine gelöschte Arbeitskopie kann nicht wiederhergestellt werden.',
14061
+ 'commands.delete_workspace.dialog.confirm': 'Löschen',
14062
+
14063
+ 'commands.workspace_settings.title': 'Einstellungen bearbeiten',
14064
+ 'commands.workspace_settings.dialog.title': 'Einstellungen von "$1"',
14065
+
14066
+ 'commands.workspace_changes.title': 'Änderungen anzeigen',
13910
14067
 
13911
14068
  'commands.obj_details.title': 'Seiteneigenschaften',
14069
+ 'commands.obj_details.dialog.title': 'Eigenschaften von "$1"',
13912
14070
 
13913
14071
  'commands.save_obj_to_clipboard.title': 'Seite zum Kopieren oder Verschieben markieren',
13914
14072
  'commands.save_obj_to_clipboard.has_children': 'Seiten mit Unterseiten können noch nicht verschoben oder kopiert werden.',
@@ -13930,6 +14088,13 @@ $.i18n().load({
13930
14088
  'commands.revert_obj.dialog.description': 'Verworfene Änderungen können nicht wiederhergestellt werden.',
13931
14089
  'commands.revert_obj.dialog.confirm': 'Verwerfen',
13932
14090
 
14091
+ 'commands.revert_widget.title': 'Änderungen am Widget verwerfen',
14092
+ 'commands.revert_widget.is_new': 'Dies ist ein neues Widget. Um die Erstellung dieses Widgets rückgängig zu machen, löschen Sie es bitte.',
14093
+ 'commands.revert_widget.is_not_modified': 'Dieses Widget wurde nicht geändert. Daher gibt es nichts zu verwerfen.',
14094
+ 'commands.revert_widget.dialog.title': 'Wirklich Änderungen an diesem Widget verwerfen?',
14095
+ 'commands.revert_widget.dialog.description': 'Verworfene Änderungen können nicht wiederhergestellt werden.',
14096
+ 'commands.revert_widget.dialog.confirm': 'Verwerfen',
14097
+
13933
14098
  'commands.restore_obj.title': 'Seite wiederherstellen',
13934
14099
  'commands.restore_obj.rtc_workspace': 'Diese Seite ist Teil der "rtc"-Arbeitskopie, bei der gelöschte Seiten nicht wiederhergestellt werden können.',
13935
14100
 
@@ -13962,10 +14127,11 @@ $.i18n().load({
13962
14127
 
13963
14128
  'commands.widget_details.title': 'Widget-Eigenschaften',
13964
14129
  'commands.widget_details.no_details_view': 'Dieses Widget hat keine Eigenschaften',
14130
+ 'commands.widget_details.dialog.title': 'Eigenschaften von "$1"',
13965
14131
 
13966
14132
  'commands.save_widget_to_clipboard.title': 'Widget zum Kopieren markieren',
13967
14133
 
13968
- 'commands.copy_widget_from_clipboard.title': 'Markiertes Widget hierher kopieren',
14134
+ 'commands.copy_widget_from_clipboard.title': 'Kopie des markierten Widgets anhängen',
13969
14135
  'commands.copy_widget_from_clipboard.paste_forbidden': 'Aufgrund ihres Typs kann das Widget hier nicht eingefügt werden. Nur Widgets der folgenden Typen können hierher verschoben oder kopiert werden: $1',
13970
14136
 
13971
14137
  'commands.delete_widget.title': 'Widget löschen',
@@ -13980,17 +14146,19 @@ $.i18n().load({
13980
14146
  'commands.switch_mode.deleted': 'Gelöscht',
13981
14147
  'commands.switch_mode.disabled': 'Aktuell ausgewählter Anzeigemodus',
13982
14148
 
13983
- 'commands.publish_workspace.title': '"$1" veröffentlichen',
14149
+ 'commands.publish_workspace.title': 'Veröffentlichen',
13984
14150
  'commands.publish_workspace.permission_denied': 'Die Arbeitskopie kann aufgrund fehlender Benutzerrechte nicht veröffentlicht werden.',
13985
14151
  'commands.publish_workspace.dialog.confirm': 'Veröffentlichen',
13986
14152
  'commands.publish_workspace.dialog.title': '"$1" veröffentlichen?',
13987
14153
  'commands.publish_workspace.dialog.description': 'Eine Arbeitskopie zu veröffentlichen ist endgültig. Dieser Vorgang kann nicht rückgängig gemacht werden.',
13988
14154
  'commands.publish_workspace.error_dialog.title': 'Fehler beim Publizieren',
13989
- 'commands.publish_workspace.error_dialog.description': 'Einige der geänderten CMS-Objekte können aufgrund fehlender Rechte nicht veröffentlicht werden.',
14155
+ 'commands.publish_workspace.error_dialog.description': 'Ihre Arbeitskopie konnte nicht veröffentlicht werden. Bitte entnehmen Sie die Details der Liste der Änderungen.',
13990
14156
  'commands.publish_workspace.error_dialog.confirm': 'Liste der Änderungen',
13991
14157
  'commands.publish_workspace.alert.invalid_certificates': 'Die Arbeitskopie konnte nicht veröffentlicht werden, weil mindestens ein Benutzer gerade Inhalte darin ändert.',
13992
14158
 
13993
- 'ajax.timeout': 'Kommunikation mit dem CMS ist fehlgeschlagen. Bitte überprüfen Sie Ihre Netzwerkverbindung.',
14159
+ 'ajax.error': 'Die Kommunikation mit dem CMS ist aufgrund eines Fehlers fehlgeschlagen: $1',
14160
+ 'ajax.error.communication': 'Die Kommunikation mit dem CMS ist fehlgeschlagen. Bitte überprüfen Sie Ihre Netzwerkverbindung.',
14161
+ 'ajax.error.unknown': 'Die Kommunikation mit dem CMS ist aufgrund eines unbekannten Fehlers fehlgeschlagen.',
13994
14162
 
13995
14163
  'warn_before_unloading': 'Sie haben nicht gespeicherte Änderungen! Sind Sie sicher, dass sie schließen wollen?'
13996
14164
  }, 'de');
@@ -14012,11 +14180,20 @@ $.i18n().load({
14012
14180
  'obj.tooltip.has_conflict': 'To this page concurrent changes were made that should be merged with the changes in this working copy.',
14013
14181
  'obj.tooltip.is_deleted': 'This page has been deleted.',
14014
14182
 
14183
+ 'workspace.title_published': 'Published content',
14184
+ 'workspace.empty_title': '<empty title>',
14185
+
14015
14186
  'workspace_settings_dialog.owners': 'Owners',
14016
14187
  'workspace_settings_dialog.nothing_found': 'Nothing found',
14017
14188
  'workspace_settings_dialog.searching': 'Searching...',
14018
14189
  'workspace_settings_dialog.too_short': 'Find user...',
14019
14190
 
14191
+ 'workspace_select.outdated': 'outdated',
14192
+ 'workspace_select.this_workspace': 'This working copy',
14193
+ 'workspace_select.other_workspaces': 'Other working copies',
14194
+
14195
+ 'menu_item.spinner.loading': 'Loading...',
14196
+
14020
14197
  'choose_obj_class_dialog.add_child_page.title': 'Select Page Type',
14021
14198
  'choose_obj_class_dialog.add_widget.title': 'Select Widget',
14022
14199
 
@@ -14029,9 +14206,7 @@ $.i18n().load({
14029
14206
  'editable_ws_dialog.create_new_playholder': 'new working copy title',
14030
14207
  'editable_ws_dialog.select': 'Select',
14031
14208
 
14032
- 'details_dialog.title': 'Edit $1',
14033
-
14034
- 'resource_dialog.title': 'resource',
14209
+ 'resource_dialog.title': 'Properties of resource "$1"',
14035
14210
 
14036
14211
  'resource_dialog.commands.revert_obj.title': 'Discard changes to resource',
14037
14212
  'resource_dialog.commands.revert_obj.rtc_workspace': 'This resource is part of the "rtc" working copy, for which discarding changes is not supported.',
@@ -14049,26 +14224,10 @@ $.i18n().load({
14049
14224
  'resource_dialog.commands.delete_obj.dialog.title': 'Really delete this resource?',
14050
14225
  'resource_dialog.commands.delete_obj.dialog.description': 'Changes to a deleted resource cannot be restored.',
14051
14226
 
14052
- 'menu_bar.working_copy': 'Working copy',
14053
- 'menu_bar.empty_workspace_title': '<empty title>',
14054
- 'menu_bar.published_workspace_title': 'Published content',
14055
14227
  'menu_bar.loading_workspaces': 'Loading working copies',
14056
- 'menu_bar.select_working_copy': 'Select "$1"',
14057
- 'menu_bar.rebase_working_copy': 'Update "$1"',
14058
- 'menu_bar.rename_working_copy': 'Rename "$1"',
14059
- 'menu_bar.rename_working_copy_desc': 'Please enter the new title of the working copy.',
14060
- 'menu_bar.rename': 'Rename',
14061
- 'menu_bar.delete_working_copy': 'Delete "$1"',
14062
- 'menu_bar.delete_ws_confirmation': 'Really delete "$1"?',
14063
- 'menu_bar.delete_ws_confirmation_desc': 'A deleted working copy cannot be restored.',
14064
- 'menu_bar.delete': 'Delete',
14065
14228
  'menu_bar.create': 'Create',
14066
14229
  'menu_bar.move': 'Move',
14067
14230
  'menu_bar.copy': 'Copy',
14068
- 'menu_bar.create_new_working_copy': 'Create working copy',
14069
- 'menu_bar.create_new_ws_confirmation': 'Create a working copy',
14070
- 'menu_bar.create_new_ws_confirmation_desc': 'Please enter the title of the new working copy.',
14071
- 'menu_bar.create_new_ws_confirmation_placeholder': 'new title',
14072
14231
 
14073
14232
  'saving_indicator_item.saving': 'Saving...',
14074
14233
  'saving_indicator_item.saved': 'Changes saved',
@@ -14083,7 +14242,6 @@ $.i18n().load({
14083
14242
 
14084
14243
  'child_list_menu.description': 'Items of $1',
14085
14244
 
14086
- 'changes_list.menu_item': 'Changes to "$1"',
14087
14245
  'changes_list.title': 'Changes to "$1"',
14088
14246
  'changes_list.empty_result': 'Nothing was changed in this working copy.',
14089
14247
  'changes_list.more': 'More...',
@@ -14093,9 +14251,33 @@ $.i18n().load({
14093
14251
  'changes_list.row.type': 'Type',
14094
14252
  'changes_list.row.last_changed': 'Last change',
14095
14253
 
14096
- 'commands.workspace_settings.title': 'Settings for "$1"',
14254
+ 'commands.create_workspace.title': 'Create working copy',
14255
+ 'commands.create_workspace.dialog.title': 'Create working copy',
14256
+ 'commands.create_workspace.dialog.description': 'Please enter the title of the new working copy.',
14257
+ 'commands.create_workspace.dialog.placeholder': 'new title',
14258
+ 'commands.create_workspace.dialog.accept': 'Create',
14259
+
14260
+ 'commands.rename_workspace.title': 'Rename',
14261
+ 'commands.rename_workspace.dialog.title': 'Rename "$1"',
14262
+ 'commands.rename_workspace.dialog.description': 'Please enter the new title of the working copy.',
14263
+ 'commands.rename_workspace.dialog.accept': 'Rename',
14264
+
14265
+ 'commands.rebase_workspace.title': 'Update',
14266
+ 'commands.rebase_workspace.tooltip': 'Working copy "$1" is outdated. Please update it.',
14267
+ 'commands.rebase_workspace.uptodate': 'Working copy "$1" is up to date.',
14268
+
14269
+ 'commands.delete_workspace.title': 'Delete',
14270
+ 'commands.delete_workspace.dialog.title': 'Really delete "$1"?',
14271
+ 'commands.delete_workspace.dialog.description': 'A deleted working copy cannot be restored.',
14272
+ 'commands.delete_workspace.dialog.confirm': 'Delete',
14273
+
14274
+ 'commands.workspace_settings.title': 'Edit settings',
14275
+ 'commands.workspace_settings.dialog.title': 'Settings for "$1"',
14276
+
14277
+ 'commands.workspace_changes.title': 'Show changes',
14097
14278
 
14098
14279
  'commands.obj_details.title': 'Page properties',
14280
+ 'commands.obj_details.dialog.title': 'Properties of "$1"',
14099
14281
 
14100
14282
  'commands.save_obj_to_clipboard.title': 'Mark page for copying or moving',
14101
14283
  'commands.save_obj_to_clipboard.has_children': 'Pages with subpages cannot be copied or moved yet.',
@@ -14117,6 +14299,13 @@ $.i18n().load({
14117
14299
  'commands.revert_obj.dialog.description': 'Discarded changes cannot be restored.',
14118
14300
  'commands.revert_obj.dialog.confirm': 'Discard',
14119
14301
 
14302
+ 'commands.revert_widget.title': 'Discard changes to widget',
14303
+ 'commands.revert_widget.is_new': 'This is a new widget. To discard the creation of this widget, please delete it.',
14304
+ 'commands.revert_widget.is_not_modified': 'This widget has not been modified. Therefore, nothing can be discarded.',
14305
+ 'commands.revert_widget.dialog.title': 'Really discard changes to this widget?',
14306
+ 'commands.revert_widget.dialog.description': 'Discarded changes cannot be restored.',
14307
+ 'commands.revert_widget.dialog.confirm': 'Discard',
14308
+
14120
14309
  'commands.restore_obj.title': 'Restore page',
14121
14310
  'commands.restore_obj.rtc_workspace': 'This page is part of the "rtc" working copy, for which restoring pages is not supported.',
14122
14311
 
@@ -14149,10 +14338,11 @@ $.i18n().load({
14149
14338
 
14150
14339
  'commands.widget_details.title': 'Widget properties',
14151
14340
  'commands.widget_details.no_details_view': 'This widget has no properties',
14341
+ 'commands.widget_details.dialog.title': 'Properties of "$1"',
14152
14342
 
14153
14343
  'commands.save_widget_to_clipboard.title': 'Mark widget for copying',
14154
14344
 
14155
- 'commands.copy_widget_from_clipboard.title': 'Copy marked widget here',
14345
+ 'commands.copy_widget_from_clipboard.title': 'Append copy of marked widget',
14156
14346
  'commands.copy_widget_from_clipboard.paste_forbidden': 'Due to its type, the widget cannot be moved or copied here. Only widgets of the following types can be inserted here: $1',
14157
14347
 
14158
14348
  'commands.delete_widget.title': 'Delete widget',
@@ -14167,23 +14357,106 @@ $.i18n().load({
14167
14357
  'commands.switch_mode.deleted': 'Deletions',
14168
14358
  'commands.switch_mode.disabled': 'Currently selected display mode',
14169
14359
 
14170
- 'commands.publish_workspace.title': 'Publish "$1"',
14360
+ 'commands.publish_workspace.title': 'Publish',
14171
14361
  'commands.publish_workspace.permission_denied': 'The working copy can not be published due to missing user permissions.',
14172
14362
  'commands.publish_workspace.dialog.confirm': 'Publish',
14173
14363
  'commands.publish_workspace.dialog.title': 'Publish "$1"?',
14174
14364
  'commands.publish_workspace.dialog.description': 'Publishing a working copy is final. This action cannot be undone.',
14175
14365
  'commands.publish_workspace.error_dialog.title': 'Error while publishing',
14176
- 'commands.publish_workspace.error_dialog.description': 'Some of the changed CMS objects can not be published due to missing permissions.',
14366
+ 'commands.publish_workspace.error_dialog.description': 'Your working copy could not be published. Please check the changes list for details.',
14177
14367
  'commands.publish_workspace.error_dialog.confirm': 'Open Changes List',
14178
14368
  'commands.publish_workspace.alert.invalid_certificates': 'The working copy could not be published because at least one user is currently modifying content in it.',
14179
14369
 
14180
- 'ajax.timeout': 'Communication with the CMS failed. Please check your network connectivity.',
14370
+ 'ajax.error': 'Communication with the CMS failed with error: $1',
14371
+ 'ajax.error.communication': 'Communication with the CMS failed. Please check your network connectivity.',
14372
+ 'ajax.error.unknown': 'Communication with the CMS failed for unknown reasons.',
14181
14373
 
14182
14374
  'warn_before_unloading': 'You have unsaved changes. Are you sure you want to quit?',
14183
14375
 
14184
14376
  'test.two_arguments': '$1, $2',
14185
14377
  'test.four_arguments': '$1, $2, $3, $4'
14186
14378
  }, 'en');
14379
+
14380
+
14381
+
14382
+
14383
+
14384
+
14385
+
14386
+
14387
+
14388
+
14389
+
14390
+
14391
+
14392
+
14393
+
14394
+
14395
+
14396
+
14397
+
14398
+
14399
+
14400
+
14401
+
14402
+
14403
+
14404
+
14405
+
14406
+
14407
+
14408
+
14409
+
14410
+
14411
+
14412
+
14413
+
14414
+
14415
+
14416
+
14417
+
14418
+
14419
+
14420
+
14421
+
14422
+
14423
+
14424
+
14425
+
14426
+
14427
+
14428
+
14429
+
14430
+
14431
+
14432
+
14433
+
14434
+
14435
+
14436
+ //
14437
+
14438
+ //
14439
+
14440
+
14441
+
14442
+ //
14443
+
14444
+
14445
+
14446
+ //
14447
+
14448
+
14449
+
14450
+
14451
+
14452
+
14453
+
14454
+
14455
+
14456
+
14457
+ //
14458
+
14459
+
14187
14460
  /*global alert:false */
14188
14461
 
14189
14462
 
@@ -14305,20 +14578,6 @@ var scrivito = {};
14305
14578
  return "["+description+"]";
14306
14579
  },
14307
14580
 
14308
- add_enter_and_escape_action: function(enter_action, escape_action) {
14309
- var key_actions = {
14310
- 13: enter_action, // enter key
14311
- 27: escape_action // escape key
14312
- };
14313
-
14314
- $(document).on('keyup.scrivito_enter_escape_action', function(e) {
14315
- if (key_actions[e.keyCode]) {
14316
- e.preventDefault();
14317
- key_actions[e.keyCode](e);
14318
- }
14319
- });
14320
- },
14321
-
14322
14581
  remove_enter_and_escape_action: function() {
14323
14582
  $(document).off('keyup.scrivito_enter_escape_action');
14324
14583
  },
@@ -14346,30 +14605,19 @@ var scrivito = {};
14346
14605
  if (window.console) {
14347
14606
  window.console.warn(message);
14348
14607
  }
14349
- },
14350
-
14351
- on: function(event, callback) {
14352
- if (event === 'editing') {
14353
- scrivito.deprecation_warning('scrivito.on("editing", ...)',
14354
- 'scrivito.on("load", ...) && scrivito.in_editable_view()');
14355
- scrivito.gui.on('editing', function() {
14356
- if (scrivito.editing_context.visible_workspace.is_editable()) {
14357
- callback();
14358
- }
14359
- });
14360
- } else if (event === 'new_content') {
14361
- scrivito.deprecation_warning('scrivito.on("new_content", ...)',
14362
- 'scrivito.on("content", ...)');
14363
- scrivito.gui.on('new_content', function(dom_element) {
14364
- callback(dom_element);
14365
- });
14366
- } else if (event === 'load') {
14608
+ },
14609
+
14610
+ // @api public
14611
+ on: function(event, callback) {
14612
+ if (event === 'load') {
14367
14613
  scrivito.gui.on('open', function() {
14368
14614
  callback();
14369
14615
  });
14370
14616
 
14371
14617
  if (scrivito.gui.is_started()) {
14372
- callback();
14618
+ scrivito.run_new_event(function() {
14619
+ callback();
14620
+ });
14373
14621
  }
14374
14622
  } else if (event === 'content') {
14375
14623
  scrivito.on('load', function() {
@@ -14384,12 +14632,14 @@ var scrivito = {};
14384
14632
  }
14385
14633
  },
14386
14634
 
14635
+ // @api public
14387
14636
  create_obj: function(attributes) {
14388
14637
  return scrivito.obj.create(attributes).then(function(obj) {
14389
14638
  return {id: obj.id()};
14390
14639
  }, convert_internal_error);
14391
14640
  },
14392
14641
 
14642
+ // @api public
14393
14643
  delete_obj: function(id) {
14394
14644
  if (id) {
14395
14645
  return scrivito.obj.create_instance({id: id}).destroy()
@@ -14399,6 +14649,7 @@ var scrivito = {};
14399
14649
  }
14400
14650
  },
14401
14651
 
14652
+ // @api public
14402
14653
  is_current_page_restricted: function() {
14403
14654
  return !!scrivito.obj.current_page && scrivito.obj.current_page.has_restriction();
14404
14655
  },
@@ -14407,16 +14658,22 @@ var scrivito = {};
14407
14658
  return $.Deferred();
14408
14659
  },
14409
14660
 
14661
+ // @api public
14410
14662
  trigger: function(event_name, dom_element) {
14411
- if (event_name === 'new_content') {
14663
+ if (event_name === 'content') {
14412
14664
  _.each($(dom_element), function(e) {
14413
14665
  scrivito.gui.new_content(e);
14414
14666
  });
14667
+ } else if (event_name === 'new_content') {
14668
+ scrivito.deprecation_warning(
14669
+ 'scrivito.trigger("new_content")', 'scrivito.trigger("content")');
14670
+ scrivito.trigger('content', dom_element);
14415
14671
  } else {
14416
14672
  $.error('Unknown event "' + event_name + '"');
14417
14673
  }
14418
14674
  },
14419
14675
 
14676
+ // @api public
14420
14677
  in_editable_view: function() {
14421
14678
  return scrivito.editing_context.display_mode === 'editing' &&
14422
14679
  scrivito.editing_context.visible_workspace.is_editable();
@@ -14431,27 +14688,20 @@ var scrivito = {};
14431
14688
  return scrivito.bypass_throttle ? fn : _.throttle(fn, ms);
14432
14689
  },
14433
14690
 
14434
- // window.atob does not handle encoded UTF8 strings. See http://mzl.la/1p1zI9k.
14435
- base64_to_utf8: function(base64_string) {
14436
- return decodeURIComponent(window.escape(atob(base64_string)));
14437
- },
14438
-
14439
- // window.btoa does not handle encoded UTF8 strings. See http://mzl.la/1p1zI9k.
14440
- utf8_to_base64: function(utf8_string) {
14441
- return btoa(window.unescape(encodeURIComponent(utf8_string)));
14442
- },
14443
-
14444
14691
  json_parse_base64: function(base64_string) {
14445
- var utf8_string = scrivito.base64_to_utf8(base64_string);
14446
- // The server escapes non-unicode characters (e.g. '<') when encoding JSON.
14447
- utf8_string = utf8_string.replace(/\\u([\d\w]{4})/gi, function(match, grp) {
14448
- return String.fromCharCode(parseInt(grp, 16));
14449
- });
14450
- return JSON.parse(utf8_string);
14692
+ // See http://mzl.la/1p1zI9k.
14693
+ var dom_string = decodeURIComponent(window.escape(atob(base64_string)));
14694
+ return JSON.parse(dom_string);
14451
14695
  },
14452
14696
 
14453
14697
  json_stringify_base64: function(object) {
14454
- return scrivito.utf8_to_base64(JSON.stringify(object));
14698
+ var dom_string = JSON.stringify(object);
14699
+ // See http://mzl.la/1p1zI9k.
14700
+ return btoa(window.unescape(encodeURIComponent(dom_string)));
14701
+ },
14702
+
14703
+ t: function() {
14704
+ return scrivito.i18n.translate.apply(null, arguments);
14455
14705
  },
14456
14706
 
14457
14707
  init: function(config) {
@@ -14596,6 +14846,7 @@ var scrivito = {};
14596
14846
  };
14597
14847
  };
14598
14848
 
14849
+ // @api public
14599
14850
  $.fn.scrivito = function(method, content) {
14600
14851
  switch (method) {
14601
14852
  case 'save':
@@ -14614,11 +14865,15 @@ var scrivito = {};
14614
14865
 
14615
14866
  // The callback has to be function that takes no arguments
14616
14867
  var log_exception_in_callback = function(event_name, callback) {
14617
- try {
14868
+ if (scrivito.gui.sandbox_callbacks) {
14869
+ try {
14870
+ callback();
14871
+ } catch(exception) {
14872
+ var text = "'"+event_name+"' callback threw exception: ";
14873
+ scrivito.log_error(text, exception);
14874
+ }
14875
+ } else {
14618
14876
  callback();
14619
- } catch(exception) {
14620
- var text = "'"+event_name+"' callback threw exception: ";
14621
- scrivito.log_error(text, exception);
14622
14877
  }
14623
14878
  };
14624
14879
 
@@ -14658,12 +14913,23 @@ var scrivito = {};
14658
14913
  }
14659
14914
  };
14660
14915
 
14916
+ var assert_no_turbolinks = function() {
14917
+ if (window.Turbolinks) {
14918
+ scrivito.alert_dialog(
14919
+ 'You have Turbolinks enabled. ' +
14920
+ 'Scrivito does not yet support Turbolink. ' +
14921
+ 'Please remove it from your assets.'
14922
+ );
14923
+ }
14924
+ };
14925
+
14661
14926
  $.extend(scrivito, {
14662
14927
  gui: {
14663
14928
  start: function() {
14664
14929
  $('body').attr('data-scrivito-display-mode', scrivito.editing_context.display_mode);
14665
14930
  $('body').append('<div id="scrivito_editing"></div>');
14666
14931
  run_open_callbacks();
14932
+ assert_no_turbolinks();
14667
14933
  },
14668
14934
 
14669
14935
  new_content: function(dom_element) {
@@ -14678,11 +14944,14 @@ var scrivito = {};
14678
14944
  callbacks[event_name].push(callback);
14679
14945
  },
14680
14946
 
14681
- // for testing purposes only
14947
+ // For testing purpose only.
14682
14948
  reset_callbacks: function() {
14683
14949
  callbacks = {};
14684
14950
  },
14685
14951
 
14952
+ // For testing purpose only.
14953
+ sandbox_callbacks: true,
14954
+
14686
14955
  is_started: function() {
14687
14956
  return !!$('body').attr('data-scrivito-display-mode');
14688
14957
  }
@@ -14797,7 +15066,10 @@ var scrivito = {};
14797
15066
  case 'success':
14798
15067
  return $.Deferred().resolve(task.result);
14799
15068
  case 'error':
14800
- return $.Deferred().reject(task.message);
15069
+ return $.Deferred().reject({
15070
+ message: task.message,
15071
+ code: task.code
15072
+ });
14801
15073
  case 'open':
14802
15074
  return scrivito.wait(2).then(function() {
14803
15075
  return single_ajax('GET', 'tasks/' + task.id).then(function(data) {
@@ -14824,14 +15096,21 @@ var scrivito = {};
14824
15096
  return $.Deferred().resolve(result);
14825
15097
  }, function(xhr, text_status, error) {
14826
15098
  var error_message;
15099
+ var error_code;
14827
15100
  try {
14828
- error_message = JSON.parse(xhr.responseText).error;
15101
+ var error_json = JSON.parse(xhr.responseText);
15102
+ error_message = error_json.error;
15103
+ error_code = error_json.code;
14829
15104
  } catch (SyntaxError) {}
14830
15105
 
14831
15106
  if (!error_message) {
14832
15107
  error_message = error;
14833
15108
  }
14834
- return $.Deferred().reject({status: xhr.status, message: error_message});
15109
+ return $.Deferred().reject({
15110
+ status: xhr.status,
15111
+ message: error_message,
15112
+ code: error_code
15113
+ });
14835
15114
  }
14836
15115
  );
14837
15116
  };
@@ -14861,14 +15140,23 @@ var scrivito = {};
14861
15140
 
14862
15141
  return ajax_promise;
14863
15142
  },
15143
+
14864
15144
  ajax: function(type, path, options) {
14865
- return scrivito.silent_ajax(type, path, options).fail(scrivito.alert_ajax_error);
15145
+ return scrivito.silent_ajax(type, path, options).fail(function(error) {
15146
+ scrivito.display_ajax_error(error);
15147
+ });
14866
15148
  },
14867
- alert_ajax_error: function(error) {
14868
- if (error.message === 'timeout') {
14869
- scrivito.alert_dialog(scrivito.i18n.translate('ajax.timeout'));
15149
+
15150
+ display_ajax_error: function(error) {
15151
+ var error_message = error.message;
15152
+ if (_.contains(['abort', 'parsererror', 'timeout'], error_message)) {
15153
+ scrivito.alert_dialog(scrivito.t('ajax.error.communication'));
15154
+ } else if (error_message === 'error') {
15155
+ scrivito.alert_dialog(scrivito.t('ajax.error.unknown'));
15156
+ } else if (error_message) {
15157
+ scrivito.alert_dialog(scrivito.t('ajax.error', error_message));
14870
15158
  } else {
14871
- scrivito.alert(error.message);
15159
+ scrivito.alert_dialog(scrivito.t('ajax.error.unknown'));
14872
15160
  }
14873
15161
  }
14874
15162
  });
@@ -14914,6 +15202,11 @@ var scrivito = {};
14914
15202
  return !!that.reason_for_being_disabled();
14915
15203
  },
14916
15204
 
15205
+ is_action_required: function() {
15206
+ var is_action_required = params.action_required;
15207
+ return typeof is_action_required === 'function' && is_action_required();
15208
+ },
15209
+
14917
15210
  reason_for_being_disabled: function() {
14918
15211
  var reason_for_being_disabled = params.disabled;
14919
15212
  if (typeof reason_for_being_disabled === 'function') {
@@ -14921,6 +15214,16 @@ var scrivito = {};
14921
15214
  }
14922
15215
  },
14923
15216
 
15217
+ update: function() {
15218
+ if (that.needs_update()) {
15219
+ return params.update();
15220
+ }
15221
+ },
15222
+
15223
+ needs_update: function() {
15224
+ return !!params.update;
15225
+ },
15226
+
14924
15227
  execute: function() {
14925
15228
  if (that.is_present() && that.is_enabled()) {
14926
15229
  params.execute();
@@ -14935,6 +15238,35 @@ var scrivito = {};
14935
15238
  }
14936
15239
  });
14937
15240
  }());
15241
+ (function() {
15242
+ $.extend(scrivito, {
15243
+ menu_item: {
15244
+ create_instance: function(command) {
15245
+ var render_menu_item = function() {
15246
+ return scrivito.template.render('menu_item', command);
15247
+ };
15248
+
15249
+ return {
15250
+ render: function() {
15251
+ if (command.is_present()) {
15252
+ var view;
15253
+ if (command.needs_update()) {
15254
+ var id = _.uniqueId('scrivito_' + command.id());
15255
+ view = scrivito.template.render('menu_item/spinner', {id: id});
15256
+ command.update().then(function() {
15257
+ $('#' + id).replaceWith(render_menu_item());
15258
+ });
15259
+ } else {
15260
+ view = render_menu_item();
15261
+ }
15262
+ return view;
15263
+ }
15264
+ }
15265
+ };
15266
+ }
15267
+ }
15268
+ });
15269
+ }());
14938
15270
  (function() {
14939
15271
  var callbacks = {};
14940
15272
  var current_token = 0;
@@ -15177,192 +15509,68 @@ var scrivito = {};
15177
15509
  });
15178
15510
  }());
15179
15511
  (function() {
15180
- var t = scrivito.i18n.translate;
15181
-
15182
- var workspace_title_short = function(workspace) {
15183
- if (workspace.is_editable()) {
15184
- if (workspace.title()) {
15185
- return workspace.title();
15186
- } else {
15187
- return t('menu_bar.empty_workspace_title');
15188
- }
15189
- } else {
15190
- return t('menu_bar.published_workspace_title');
15191
- }
15192
- };
15193
-
15194
- var workspace_title_long = function(workspace) {
15195
- if (workspace.is_editable()) {
15196
- var title = t('menu_bar.working_copy') + ': ';
15197
- return title + workspace_title_short(workspace);
15198
- } else {
15199
- return workspace_title_short(workspace);
15200
- }
15201
- };
15202
-
15203
- var workspace_title_select = function(workspace) {
15204
- var title = workspace_title_short(workspace);
15205
-
15206
- return t('menu_bar.select_working_copy', title);
15207
- };
15208
-
15209
- var renderer = function(view) {
15210
- var workspace = scrivito.editing_context.selected_workspace;
15211
-
15212
- var select_menu_view = $(scrivito.template.render('workspace_select_menu_bar_item', {
15213
- current_workspace: workspace,
15214
- current_short_title: workspace_title_short(workspace),
15215
- current_long_title: workspace_title_long(workspace),
15216
- workspace_settings_command: workspace_settings_command(),
15217
- publish_command: scrivito.publish_workspace_command(workspace)
15218
- }));
15219
-
15220
- view.find('#scrivito_select_workspace').append(select_menu_view);
15221
- };
15222
-
15223
- var default_click_action = function(e) {
15224
- e.preventDefault();
15225
- e.stopPropagation();
15226
- scrivito.workspace_select.close_menu();
15227
- };
15228
-
15229
- $(document).on("click.scrivito_toggle_ws_select", "#scrivito_select_workspace", function(e) {
15230
- default_click_action(e);
15512
+ $.extend(scrivito, {
15513
+ workspace_select: {
15514
+ init: function() {
15515
+ var selected_workspace = scrivito.editing_context.selected_workspace;
15516
+ var commands = {
15517
+ create_workspace: scrivito.create_workspace_command(),
15518
+ select_published: scrivito.select_workspace_command(scrivito.workspace.published()),
15519
+ for_editable: [
15520
+ scrivito.workspace_settings_command(selected_workspace),
15521
+ scrivito.workspace_changes_command(),
15522
+ scrivito.rename_workspace_command(selected_workspace),
15523
+ scrivito.rebase_workspace_command(selected_workspace),
15524
+ scrivito.delete_workspace_command(selected_workspace),
15525
+ scrivito.publish_workspace_command(selected_workspace)
15526
+ ]
15527
+ };
15231
15528
 
15232
- var replace_with_real_ws = $('#scrivito_select_workspace #scrivito_replace_with_real_ws');
15233
- if(replace_with_real_ws.length > 0) {
15234
- scrivito.workspace.all().done(function(workspaces) {
15235
- var workspaces_where_published_is_last = _.sortBy(workspaces, function(ws) {
15236
- return !ws.is_editable();
15237
- });
15529
+ scrivito.menu_bar.register_item_renderer(function(menu_bar) {
15530
+ var workspace_select = menu_bar.find('#scrivito_workspace_select');
15531
+ workspace_select.append(scrivito.template.render('workspace_select', {
15532
+ selected_workspace: selected_workspace,
15533
+ commands: commands
15534
+ }));
15238
15535
 
15239
- var handlebars_workspaces = _.map(workspaces_where_published_is_last, function(ws) {
15240
- return {
15241
- is_editable: ws.is_editable,
15242
- long_title: workspace_title_long(ws),
15243
- select_title: workspace_title_select(ws),
15244
- is_current_workspace: (ws.id() === scrivito.editing_context.selected_workspace.id())
15536
+ var bind_command = function(command) {
15537
+ workspace_select.on('click', '#scrivito_' + command.id(), function() {
15538
+ return command.execute();
15539
+ });
15245
15540
  };
15246
- });
15247
15541
 
15248
- var ws_list_view_html = scrivito.template.render('workspace_select_list', {
15249
- workspaces: handlebars_workspaces
15250
- });
15251
- var ws_list_view = $($.trim(ws_list_view_html));
15252
-
15253
- _.each(ws_list_view.find('span'), function(dom_element, index) {
15254
- $(dom_element).on('click.scrivito_open_workspace', function(e) {
15255
- default_click_action(e);
15256
- scrivito.with_saving_overlay(
15257
- scrivito.redirect_to("?_scrivito_workspace_id=" +
15258
- workspaces_where_published_is_last[index].id())
15259
- );
15542
+ bind_command(commands.create_workspace);
15543
+ bind_command(commands.select_published);
15544
+ _.each(commands.for_editable, function(command) {
15545
+ bind_command(command);
15260
15546
  });
15261
- });
15262
-
15263
- replace_with_real_ws.replaceWith(ws_list_view);
15264
- });
15265
- }
15266
- });
15267
-
15268
- $(document).on("click.scrivito_create_ws", "#scrivito_create_new_ws", function(e) {
15269
- default_click_action(e);
15270
- scrivito.prompt_dialog({
15271
- icon: '&#xf022;',
15272
- color: 'green',
15273
- title: t('menu_bar.create_new_ws_confirmation'),
15274
- description: t('menu_bar.create_new_ws_confirmation_desc'),
15275
- placeholder: t('menu_bar.create_new_ws_confirmation_placeholder'),
15276
- accept_button_text: t('menu_bar.create'),
15277
- accept_button_color: 'green'
15278
- }).done(function(title) {
15279
- scrivito.with_saving_overlay(
15280
- scrivito.workspace.create(title).then(function(new_workspace) {
15281
- var path = '?_scrivito_workspace_id=' + new_workspace.id();
15282
- if (!scrivito.editing_context.selected_workspace.is_editable()) {
15283
- path += '&_scrivito_display_mode=editing';
15284
- }
15285
- return scrivito.redirect_to(path);
15286
- })
15287
- );
15288
- });
15289
- });
15290
-
15291
- var workspace_settings_command = function() {
15292
- return scrivito.workspace_settings_command(scrivito.editing_context.selected_workspace);
15293
- };
15294
-
15295
- $(document).on('click.scrivito_workspace_settings', '#scrivito_workspace_settings', function() {
15296
- workspace_settings_command().execute();
15297
- return true;
15298
- });
15299
-
15300
- $(document).on("click.scrivito_publish_ws", "#scrivito_publish_current_ws", function(e) {
15301
- scrivito.publish_workspace_command(scrivito.editing_context.selected_workspace).
15302
- execute();
15303
-
15304
- return false;
15305
- });
15306
-
15307
- $(document).on("click.scrivito_rename_ws", "#scrivito_rename_current_ws", function(e) {
15308
- default_click_action(e);
15309
- scrivito.prompt_dialog({
15310
- icon: '&#xf04f;',
15311
- color: 'green',
15312
- title: t('menu_bar.rename_working_copy', scrivito.editing_context.selected_workspace.title()),
15313
- description: t('menu_bar.rename_working_copy_desc'),
15314
- value: scrivito.editing_context.selected_workspace.title(),
15315
- accept_button_text: t('menu_bar.rename'),
15316
- accept_button_color: 'green'
15317
- }).done(function(new_title) {
15318
- scrivito.with_saving_overlay(
15319
- scrivito.editing_context.selected_workspace.rename(new_title).then(function() {
15320
- return scrivito.reload();
15321
- })
15322
- );
15323
- });
15324
- });
15325
15547
 
15326
- $(document).on("click.scrivito_rebase_ws", "#scrivito_rebase_current_ws", function(e) {
15327
- default_click_action(e);
15328
- scrivito.with_saving_overlay(
15329
- scrivito.editing_context.selected_workspace.rebase().then(function() {
15330
- return scrivito.reload();
15331
- })
15332
- );
15333
- });
15548
+ workspace_select.on('click', function() {
15549
+ var menu_box = workspace_select.find('.scrivito_menu_box');
15550
+ menu_box.fadeToggle('50');
15551
+
15552
+ var workspace_list = menu_box.find('.scrivito_workspace_list');
15553
+ if (workspace_list.find('.scrivito_spinning').length) {
15554
+ scrivito.workspace.all_editable().then(function(workspaces) {
15555
+ var commands = _(workspaces).reject(function(workspace) {
15556
+ return workspace.id() === selected_workspace.id();
15557
+ }).map(function(workspace) {
15558
+ return scrivito.select_workspace_command(workspace);
15559
+ });
15334
15560
 
15335
- $(document).on("click.scrivito_delete_ws", "#scrivito_delete_current_ws", function(e) {
15336
- default_click_action(e);
15337
- scrivito.confirmation_dialog({
15338
- color: 'red',
15339
- icon: '&#xf018;',
15340
- confirm_button_color: 'red',
15341
- confirm_button_text: t('menu_bar.delete'),
15342
- title: t('menu_bar.delete_ws_confirmation', workspace_title_short(
15343
- scrivito.editing_context.selected_workspace)),
15344
- description: t('menu_bar.delete_ws_confirmation_desc')
15345
- }).done(function() {
15346
- scrivito.with_saving_overlay(
15347
- scrivito.editing_context.selected_workspace.destroy().then(function(new_workspace) {
15348
- return scrivito.redirect_to('?_scrivito_workspace_id=published');
15349
- })
15350
- );
15351
- });
15352
- });
15561
+ workspace_list.replaceWith(scrivito.template.render(
15562
+ 'workspace_select/other_workspaces', {commands: commands}
15563
+ ));
15353
15564
 
15354
- $(document).on('click', '#scrivito_changes_list_toggle', function(e) {
15355
- e.preventDefault();
15356
- scrivito.changes_dialog.open();
15357
- });
15565
+ _.each(commands, function(command) {
15566
+ bind_command(command);
15567
+ });
15568
+ });
15569
+ }
15358
15570
 
15359
- $.extend(scrivito, {
15360
- workspace_select: {
15361
- init: function() {
15362
- scrivito.menu_bar.register_item_renderer(renderer);
15363
- },
15364
- close_menu: function() {
15365
- $('#scrivito_select_workspace .scrivito_menu_box').fadeToggle('50');
15571
+ return false;
15572
+ });
15573
+ });
15366
15574
  }
15367
15575
  }
15368
15576
  });
@@ -15614,6 +15822,8 @@ var scrivito = {};
15614
15822
  });
15615
15823
  form_data.append('file', file); // File must be appended last, otherwise S3 will complain.
15616
15824
 
15825
+ permission.blob.filename = file.name;
15826
+
15617
15827
  return $.ajax({type: 'POST', url: permission.url, data: form_data,
15618
15828
  // These are needed in order for jQuery to work properly with a FormData.
15619
15829
  contentType: false,
@@ -15794,7 +16004,7 @@ $(function() {
15794
16004
  },
15795
16005
  obj: function() {
15796
16006
  return scrivito.obj.create_instance({
15797
- id: that.dom_element().attr('data-scrivito-private-field-id'),
16007
+ id: that.dom_element().attr('data-scrivito-private-field-obj-id'),
15798
16008
  obj_class_name: that.dom_element().attr('data-scrivito-field-obj-class')
15799
16009
  });
15800
16010
  },
@@ -15988,25 +16198,49 @@ $(function() {
15988
16198
  return string.length === 1 ? '0' + string : string;
15989
16199
  };
15990
16200
 
15991
- var prepare_attributes = function(data) {
15992
- var attributes = {};
15993
- _.each(data, function(value, field_name) {
16201
+ var convert_attributes = function(data) {
16202
+ var collected_promises = _.map(data, function(value, field_name) {
15994
16203
  if (value instanceof Date) {
15995
- value = format_date(value);
16204
+ return $.Deferred().resolve([field_name, format_date(value)]);
16205
+ } else if (value instanceof window.File) {
16206
+ return scrivito.blob.create(value).then(function(value) {
16207
+ return [field_name, value];
16208
+ });
16209
+ } else {
16210
+ return $.Deferred().resolve([field_name, value]);
15996
16211
  }
15997
- attributes[field_name] = value;
15998
16212
  });
15999
16213
 
16000
- if (attributes.blob) {
16001
- return scrivito.blob.create(attributes.blob).then(function(blob_id) {
16002
- attributes.blob = blob_id;
16003
- return attributes;
16214
+ return $.when.apply(this, collected_promises).then(function() {
16215
+ return _.object(arguments);
16216
+ });
16217
+ };
16218
+
16219
+ var convert_widget_pool = function(widget_pool) {
16220
+ if(widget_pool) {
16221
+ var conversion_promises = _.map(widget_pool, function(attributes, widget_id) {
16222
+ return convert_attributes(attributes).then(function(attributes) {
16223
+ return [widget_id, attributes];
16224
+ });
16225
+ });
16226
+
16227
+ return $.when.apply(this, conversion_promises).then(function() {
16228
+ return _.object(arguments);
16004
16229
  });
16005
16230
  } else {
16006
- return $.Deferred().resolve(attributes);
16231
+ return $.Deferred().resolve(widget_pool);
16007
16232
  }
16008
16233
  };
16009
16234
 
16235
+ var prepare_attributes = function(data) {
16236
+ return convert_widget_pool(data._widget_pool).then(function(widget_pool) {
16237
+ return convert_attributes(data).then(function(attributes) {
16238
+ attributes._widget_pool = widget_pool;
16239
+ return attributes;
16240
+ });
16241
+ });
16242
+ };
16243
+
16010
16244
  $.extend(scrivito, {
16011
16245
  obj: {
16012
16246
  init: function(config) {
@@ -16015,22 +16249,22 @@ $(function() {
16015
16249
  }
16016
16250
  },
16017
16251
 
16018
- create_instance: function(create_params) {
16252
+ create_instance: function(params) {
16019
16253
  var that = {
16020
16254
  id: function() {
16021
- return create_params.id;
16255
+ return params.id;
16022
16256
  },
16023
16257
 
16024
16258
  obj_class_name: function() {
16025
- return create_params.obj_class_name;
16259
+ return params.obj_class_name;
16026
16260
  },
16027
16261
 
16028
16262
  description_for_editor: function() {
16029
- return create_params.description_for_editor;
16263
+ return params.description_for_editor;
16030
16264
  },
16031
16265
 
16032
16266
  modification: function() {
16033
- return create_params.modification;
16267
+ return params.modification;
16034
16268
  },
16035
16269
 
16036
16270
  is_new: function() {
@@ -16046,11 +16280,11 @@ $(function() {
16046
16280
  },
16047
16281
 
16048
16282
  has_children: function() {
16049
- return !!create_params.has_children;
16283
+ return !!params.has_children;
16050
16284
  },
16051
16285
 
16052
16286
  has_conflict: function() {
16053
- return !!create_params.has_conflict;
16287
+ return !!params.has_conflict;
16054
16288
  },
16055
16289
 
16056
16290
  has_restriction : function() {
@@ -16058,25 +16292,25 @@ $(function() {
16058
16292
  },
16059
16293
 
16060
16294
  restriction_messages: function() {
16061
- return create_params.restriction_messages || [];
16295
+ return params.restriction_messages || [];
16062
16296
  },
16063
16297
 
16064
16298
  is_binary: function() {
16065
- return !!create_params.is_binary;
16299
+ return !!params.is_binary;
16066
16300
  },
16067
16301
 
16068
16302
  has_details_view: function() {
16069
- return !!create_params.has_details_view;
16303
+ return !!params.has_details_view;
16070
16304
  },
16071
16305
 
16072
16306
  tooltip: function() {
16073
16307
  if (editing_state()) {
16074
- return scrivito.i18n.translate('obj.tooltip.' + editing_state());
16308
+ return scrivito.t('obj.tooltip.' + editing_state());
16075
16309
  }
16076
16310
  },
16077
16311
 
16078
16312
  last_changed: function() {
16079
- return create_params.last_changed;
16313
+ return params.last_changed;
16080
16314
  },
16081
16315
 
16082
16316
  save: function(data) {
@@ -16098,6 +16332,15 @@ $(function() {
16098
16332
  return scrivito.ajax('PUT', 'objs/' + that.id() + '/revert');
16099
16333
  },
16100
16334
 
16335
+ revert_widget: function(widget_id) {
16336
+ return scrivito.ajax('PUT',
16337
+ 'objs/' + that.id() + '/revert_widget?widget_id=' + widget_id);
16338
+ },
16339
+
16340
+ update_widget_modification: function(widget_id) {
16341
+ return scrivito.ajax('GET', 'objs/' + that.id() + '/widget_modification?widget_id=' + widget_id);
16342
+ },
16343
+
16101
16344
  restore: function() {
16102
16345
  return scrivito.ajax('PUT', 'objs/' + that.id() + '/restore');
16103
16346
  },
@@ -16125,6 +16368,12 @@ $(function() {
16125
16368
  return scrivito.ajax('POST', 'objs/'+that.id()+'/duplicate').then(function(new_data) {
16126
16369
  return scrivito.obj.create_instance_from_server_data(new_data);
16127
16370
  });
16371
+ },
16372
+
16373
+ update_modification: function() {
16374
+ return scrivito.ajax('GET', 'objs/' + that.id() + '/modification').then(function(data) {
16375
+ params.modification = data.modification;
16376
+ });
16128
16377
  }
16129
16378
  };
16130
16379
 
@@ -16149,10 +16398,10 @@ $(function() {
16149
16398
  return that;
16150
16399
  },
16151
16400
 
16152
- create_instance_from_server_data: function(create_params) {
16401
+ create_instance_from_server_data: function(params) {
16153
16402
  return scrivito.obj.create_instance({
16154
- id: (create_params.id || create_params._id),
16155
- obj_class_name: create_params._obj_class
16403
+ id: (params.id || params._id),
16404
+ obj_class_name: params._obj_class
16156
16405
  });
16157
16406
  },
16158
16407
 
@@ -16204,7 +16453,6 @@ $(function() {
16204
16453
  $.extend(scrivito, {
16205
16454
  chainable_search: {
16206
16455
  create_instance: function(build_query) {
16207
- // Private
16208
16456
  var query = build_query || { predicates: [] };
16209
16457
 
16210
16458
  var add_predicate = function(field, operator, value, boost, negate) {
@@ -16231,32 +16479,37 @@ $(function() {
16231
16479
  $.param({query: JSON.stringify(query), query_action: action}));
16232
16480
  };
16233
16481
 
16234
- // Public
16235
16482
  var that = {
16483
+ // @api public
16236
16484
  query: function() {
16237
16485
  return query;
16238
16486
  },
16239
16487
 
16488
+ // @api public
16240
16489
  and: function(field, operator, value, boost) {
16241
16490
  add_predicate(field, operator, value, boost);
16242
16491
  return that;
16243
16492
  },
16244
16493
 
16494
+ // @api public
16245
16495
  and_not: function(field, operator, value) {
16246
16496
  add_predicate(field, operator, value, undefined, true);
16247
16497
  return that;
16248
16498
  },
16249
16499
 
16500
+ // @api public
16250
16501
  offset: function(offset) {
16251
16502
  query.offset = offset;
16252
16503
  return that;
16253
16504
  },
16254
16505
 
16506
+ // @api public
16255
16507
  order: function(order) {
16256
16508
  query.order = order;
16257
16509
  return that;
16258
16510
  },
16259
16511
 
16512
+ // @api public
16260
16513
  reverse_order: function() {
16261
16514
  if (query.reverse_order) {
16262
16515
  delete query.reverse_order;
@@ -16266,21 +16519,25 @@ $(function() {
16266
16519
  return that;
16267
16520
  },
16268
16521
 
16522
+ // @api public
16269
16523
  batch_size: function(batch_size) {
16270
16524
  query.batch_size = batch_size;
16271
16525
  return that;
16272
16526
  },
16273
16527
 
16528
+ // @api public
16274
16529
  format: function(name) {
16275
16530
  query.format = name;
16276
16531
  return that;
16277
16532
  },
16278
16533
 
16534
+ // @api public
16279
16535
  include_deleted: function() {
16280
16536
  query.include_deleted = true;
16281
16537
  return that;
16282
16538
  },
16283
16539
 
16540
+ // @api public
16284
16541
  load_batch: function() {
16285
16542
  var offset = query.offset || 0;
16286
16543
  var next;
@@ -16301,12 +16558,14 @@ $(function() {
16301
16558
  });
16302
16559
  },
16303
16560
 
16561
+ // @api public
16304
16562
  size: function() {
16305
16563
  return execute_search(query, 'size').then(function(result) {
16306
16564
  return $.Deferred().resolve(result.total);
16307
16565
  });
16308
16566
  },
16309
16567
 
16568
+ // @api public
16310
16569
  clone: function() {
16311
16570
  var cloned_query = $.extend(true, {}, query);
16312
16571
  return scrivito.chainable_search.create_instance(cloned_query);
@@ -16324,6 +16583,7 @@ $(function() {
16324
16583
 
16325
16584
  (function() {
16326
16585
  $.extend(scrivito, {
16586
+ // @api public
16327
16587
  obj_where: function(field, operator, value, boost) {
16328
16588
  return scrivito.chainable_search.create_instance().and(field, operator, value, boost);
16329
16589
  }
@@ -16427,8 +16687,8 @@ $(function() {
16427
16687
  return options.modification;
16428
16688
  },
16429
16689
 
16430
- container_modification: function() {
16431
- return options.container_modification;
16690
+ placement_modification: function() {
16691
+ return options.placement_modification;
16432
16692
  },
16433
16693
 
16434
16694
  description_for_editor: function() {
@@ -16436,7 +16696,23 @@ $(function() {
16436
16696
  },
16437
16697
 
16438
16698
  is_modified: function() {
16439
- return !!(that.modification() || that.container_modification());
16699
+ return !!that.modification();
16700
+ },
16701
+
16702
+ is_new: function() {
16703
+ return that.modification() === 'new';
16704
+ },
16705
+
16706
+ is_edited: function() {
16707
+ return that.modification() === 'edited';
16708
+ },
16709
+
16710
+ is_deleted: function() {
16711
+ return that.modification() === 'deleted';
16712
+ },
16713
+
16714
+ is_placement_modified: function() {
16715
+ return !!that.placement_modification();
16440
16716
  },
16441
16717
 
16442
16718
  save: function(widget_attributes) {
@@ -16458,11 +16734,23 @@ $(function() {
16458
16734
  return that.fetch_markup('show_widget');
16459
16735
  },
16460
16736
 
16737
+ revert: function() {
16738
+ return that.obj().revert_widget(that.id()).then(function() {
16739
+ options.modification = null;
16740
+ });
16741
+ },
16742
+
16461
16743
  fetch_markup: function(action_name) {
16462
16744
  var obj_id = that.obj().id();
16463
16745
  var widget_id = that.id();
16464
16746
  var url = 'render_widget/' + obj_id + '/' + action_name + '/' + widget_id;
16465
16747
  return scrivito.ajax('GET', url, {dataType: 'html'});
16748
+ },
16749
+
16750
+ update_modification: function() {
16751
+ return that.obj().update_widget_modification(that.id()).then(function(data) {
16752
+ options.modification = data.modification;
16753
+ });
16466
16754
  }
16467
16755
  };
16468
16756
 
@@ -16492,8 +16780,8 @@ $(function() {
16492
16780
  dom_element.attr('data-scrivito-widget-obj-class'),
16493
16781
  {
16494
16782
  modification: dom_element.attr('data-scrivito-private-widget-modification'),
16495
- container_modification: dom_element.attr(
16496
- 'data-scrivito-private-widget-container-modification'),
16783
+ placement_modification: dom_element.attr(
16784
+ 'data-scrivito-private-widget-placement-modification'),
16497
16785
  description_for_editor: dom_element.attr(
16498
16786
  'data-scrivito-private-widget-description-for-editor')
16499
16787
  }
@@ -16560,6 +16848,13 @@ $(function() {
16560
16848
  return that.widget_elements().length === 0;
16561
16849
  },
16562
16850
 
16851
+ parent_widget: function() {
16852
+ var widgets = that.dom_element().parents('[data-scrivito-private-widget-id]');
16853
+ if (widgets.length) {
16854
+ return scrivito.cms_element.from_dom_element(widgets.eq(0)).widget();
16855
+ }
16856
+ },
16857
+
16563
16858
  create_widget: function(widget_class, widget_element) {
16564
16859
  var widget_spec = {create: {_obj_class: widget_class}};
16565
16860
  return add_widget(widget_spec, widget_element);
@@ -16571,8 +16866,13 @@ $(function() {
16571
16866
  },
16572
16867
 
16573
16868
  fetch_widget_class_selection: function() {
16869
+ var params = {field_name: that.field_name()};
16870
+ var parent_widget = that.parent_widget();
16871
+ if (parent_widget) {
16872
+ params.widget_id = parent_widget.id();
16873
+ }
16574
16874
  return scrivito.ajax('GET', 'objs/' + that.obj().id() + '/widget_class_selection?' +
16575
- $.param({field_name: that.field_name()}));
16875
+ $.param(params));
16576
16876
  },
16577
16877
 
16578
16878
  allowed_classes: function() {
@@ -16641,60 +16941,37 @@ $(function() {
16641
16941
  $.extend(scrivito, {
16642
16942
  workspace: {
16643
16943
  from_data: function(data) {
16644
- var get_check = function(offset) {
16645
- return scrivito.ajax('GET', 'workspaces/' + that.id() + '/check?from='+offset);
16646
- };
16647
-
16648
- var check_result = function(result, certificates) {
16649
- if (result.result === 'fail') {
16650
- return $.Deferred().resolve(false);
16651
- }
16652
-
16653
- certificates.push(result.certificate);
16654
-
16655
- if (result.pass.until === 'END') {
16656
- return $.Deferred().resolve(certificates);
16657
- } else {
16658
- var offset = parseInt(result.pass.until, 10) + 1;
16659
-
16660
- return get_check(offset).then(function(result) {
16661
- return check_result(result, certificates);
16662
- });
16663
- }
16664
- };
16665
-
16666
- var check_and_publish_with_retry = function(workspace, retry_number) {
16667
- return workspace.check().then(function(certificates) {
16668
- if (certificates) {
16669
- return workspace.publish(certificates).then(null, function(error) {
16670
- if (error.status === 409) {
16671
- if (retry_number < 2) {
16672
- return check_and_publish_with_retry(workspace, retry_number + 1);
16673
- } else {
16674
- return $.Deferred().reject({type: 'outdated_certificates'});
16675
- }
16676
- } else {
16677
- scrivito.alert_ajax_error(error);
16678
- return error;
16679
- }
16680
- });
16681
- } else {
16682
- return $.Deferred().reject({type: 'check_failed'});
16683
- }
16684
- });
16685
- };
16686
-
16687
16944
  var that = {
16688
16945
  id: function() {
16689
16946
  return data.id;
16690
16947
  },
16691
16948
 
16692
16949
  title: function() {
16950
+ return that.original_title() || default_title();
16951
+ },
16952
+
16953
+ original_title: function() {
16693
16954
  return data.title;
16694
16955
  },
16695
16956
 
16957
+ icon: function() {
16958
+ return that.is_published() ? '&#xf064;' : '&#xf011;';
16959
+ },
16960
+
16961
+ is_published: function() {
16962
+ return that.id() === 'published';
16963
+ },
16964
+
16965
+ is_outdated: function() {
16966
+ return !!data.outdated;
16967
+ },
16968
+
16969
+ mark_as_outdated: function() {
16970
+ data.outdated = true;
16971
+ },
16972
+
16696
16973
  is_editable: function() {
16697
- return that.id() !== 'published';
16974
+ return !that.is_published();
16698
16975
  },
16699
16976
 
16700
16977
  is_rtc: function() {
@@ -16702,13 +16979,13 @@ $(function() {
16702
16979
  },
16703
16980
 
16704
16981
  check: function() {
16705
- return get_check(0).then(function(result) {
16706
- return check_result(result, []);
16982
+ return check(0).then(function(result) {
16983
+ return handle_check_result(result, []);
16707
16984
  });
16708
16985
  },
16709
16986
 
16710
16987
  check_and_publish: function() {
16711
- return check_and_publish_with_retry(that, 0);
16988
+ return check_and_publish(0);
16712
16989
  },
16713
16990
 
16714
16991
  publish: function(certificates) {
@@ -16716,25 +16993,95 @@ $(function() {
16716
16993
  {data: { certificates: certificates }});
16717
16994
  },
16718
16995
 
16719
- rebase: function() {
16720
- return scrivito.ajax('PUT', 'workspaces/' + that.id() + '/rebase');
16721
- },
16996
+ rebase: function() {
16997
+ return scrivito.ajax('PUT', 'workspaces/' + that.id() + '/rebase').done(function() {
16998
+ data.outdated = false;
16999
+ });
17000
+ },
17001
+
17002
+ update: function(attributes) {
17003
+ return scrivito.ajax('PUT', 'workspaces/' + that.id(), {data: {workspace: attributes}});
17004
+ },
17005
+
17006
+ rename: function(new_title) {
17007
+ return that.update({title: new_title});
17008
+ },
17009
+
17010
+ destroy: function() {
17011
+ return scrivito.ajax('DELETE', 'workspaces/' + that.id());
17012
+ },
17013
+
17014
+ fetch_memberships: function() {
17015
+ return scrivito.ajax('GET', 'workspaces/' + that.id()).then(function(details) {
17016
+ return details.memberships;
17017
+ });
17018
+ }
17019
+ };
17020
+
17021
+ var check_and_publish = function(number_of_retries) {
17022
+ return rebase_outdated().then(function() {
17023
+ return that.check().then(function(certificates) {
17024
+ if (certificates) {
17025
+ return that.publish(certificates).then(null, function(error) {
17026
+ return handle_check_and_publish_error(error, number_of_retries);
17027
+ });
17028
+ } else {
17029
+ return $.Deferred().reject({type: 'check_failed'});
17030
+ }
17031
+ }, function(error) {
17032
+ return handle_check_and_publish_error(error, number_of_retries);
17033
+ });
17034
+ });
17035
+ };
17036
+
17037
+ var rebase_outdated = function() {
17038
+ return that.is_outdated() ? that.rebase() : $.Deferred().resolve();
17039
+ };
17040
+
17041
+ var check = function(offset) {
17042
+ return scrivito.silent_ajax('GET', 'workspaces/' + that.id() + '/check?from=' + offset);
17043
+ };
17044
+
17045
+ var handle_check_result = function(result, certificates) {
17046
+ if (result.result === 'fail') {
17047
+ return $.Deferred().resolve(false);
17048
+ }
17049
+
17050
+ certificates.push(result.certificate);
16722
17051
 
16723
- update: function(attributes) {
16724
- return scrivito.ajax('PUT', 'workspaces/' + that.id(), {data: {workspace: attributes}});
16725
- },
17052
+ if (result.pass.until === 'END') {
17053
+ return $.Deferred().resolve(certificates);
17054
+ } else {
17055
+ var offset = parseInt(result.pass.until, 10) + 1;
17056
+ return check(offset).then(function(result) {
17057
+ return handle_check_result(result, certificates);
17058
+ });
17059
+ }
17060
+ };
16726
17061
 
16727
- rename: function(new_title) {
16728
- return that.update({title: new_title});
16729
- },
16730
- destroy: function() {
16731
- return scrivito.ajax('DELETE', 'workspaces/' + that.id());
16732
- },
17062
+ var handle_check_and_publish_error = function(error, number_of_retries) {
17063
+ if (error.code === 'precondition_not_verifiable.workspace.publish.content_state_id') {
17064
+ // Another workspace has been published since last check.
17065
+ that.mark_as_outdated();
17066
+ return check_and_publish(number_of_retries);
17067
+ } else if (error.code === 'precondition_not_met.workspace.publish.content_state_id') {
17068
+ // The workspace has been changed since last check.
17069
+ if (number_of_retries === 2) {
17070
+ return $.Deferred().reject({type: 'outdated_certificates'});
17071
+ } else {
17072
+ return check_and_publish(number_of_retries + 1);
17073
+ }
17074
+ } else {
17075
+ scrivito.display_ajax_error(error);
17076
+ return error;
17077
+ }
17078
+ };
16733
17079
 
16734
- fetch_memberships: function() {
16735
- return scrivito.ajax('GET', 'workspaces/' + that.id()).then(function(details) {
16736
- return details.memberships;
16737
- });
17080
+ var default_title = function() {
17081
+ if (that.is_published()) {
17082
+ return scrivito.t('workspace.title_published');
17083
+ } else {
17084
+ return scrivito.t('workspace.empty_title');
16738
17085
  }
16739
17086
  };
16740
17087
 
@@ -16746,7 +17093,7 @@ $(function() {
16746
17093
  return _.sortBy(_.map(workspace_datas, function(workspace_data) {
16747
17094
  return scrivito.workspace.from_data(workspace_data);
16748
17095
  }, function(workspace) {
16749
- return (workspace.title() || '').toUpperCase();
17096
+ return workspace.is_published() ? '' : workspace.title().toUpperCase();
16750
17097
  }));
16751
17098
  });
16752
17099
  },
@@ -16759,6 +17106,10 @@ $(function() {
16759
17106
  });
16760
17107
  },
16761
17108
 
17109
+ published: function() {
17110
+ return scrivito.workspace.from_data({id: 'published'});
17111
+ },
17112
+
16762
17113
  create: function(title) {
16763
17114
  return scrivito.ajax('POST', 'workspaces', {data: {workspace: {title: title}}}).
16764
17115
  then(function(ws_data) {
@@ -16937,9 +17288,11 @@ $(function() {
16937
17288
 
16938
17289
  (function() {
16939
17290
  Handlebars.registerHelper('translate', scrivito.i18n.translate);
17291
+
16940
17292
  Handlebars.registerHelper('localize_date', function(date_value_function) {
16941
17293
  return scrivito.i18n.localize_date(date_value_function());
16942
17294
  });
17295
+
16943
17296
  Handlebars.registerHelper('localize_date_relative', function(date_value_function) {
16944
17297
  return scrivito.i18n.localize_date_relative(date_value_function());
16945
17298
  });
@@ -16952,6 +17305,10 @@ $(function() {
16952
17305
  return new Handlebars.SafeString(escaped_array.join('&#13;'));
16953
17306
  });
16954
17307
 
17308
+ Handlebars.registerHelper('render', function(template_path, object) {
17309
+ return new Handlebars.SafeString(scrivito.template.render(template_path, object));
17310
+ });
17311
+
16955
17312
  $.extend(scrivito, {
16956
17313
  template: {
16957
17314
  load_templates_from_server: false,
@@ -17122,7 +17479,7 @@ $(function() {
17122
17479
  var dom_element_position = dom_element.position();
17123
17480
  var view = $(scrivito.template.render('element_overlay')).css({
17124
17481
  position: 'absolute', // Required for unit tests to pass without an extra CSS file.
17125
- top: dom_element_position.top,
17482
+ top: 0,
17126
17483
  left: dom_element_position.left,
17127
17484
  width: dom_element.width(),
17128
17485
  height: dom_element.height()
@@ -17172,8 +17529,8 @@ $(function() {
17172
17529
  open: function(options) {
17173
17530
  var view = $(scrivito.template.render('confirmation_dialog', $.extend({
17174
17531
  icon: '&#xf01d;',
17175
- cancel_button_text: scrivito.i18n.translate('cancel'),
17176
- confirm_button_text: scrivito.i18n.translate('confirm')
17532
+ cancel_button_text: scrivito.t('cancel'),
17533
+ confirm_button_text: scrivito.t('confirm')
17177
17534
  }, options || {})));
17178
17535
 
17179
17536
  $('#scrivito_editing').append(view);
@@ -17216,8 +17573,8 @@ $(function() {
17216
17573
  open: function(options) {
17217
17574
  var view = $(scrivito.template.render('prompt_dialog', $.extend({
17218
17575
  icon: '&#61468;',
17219
- accept_button_text: scrivito.i18n.translate('accept'),
17220
- cancel_button_text: scrivito.i18n.translate('cancel')
17576
+ accept_button_text: scrivito.t('accept'),
17577
+ cancel_button_text: scrivito.t('cancel')
17221
17578
  }, options || {})));
17222
17579
 
17223
17580
  $('#scrivito_editing').append(view);
@@ -17320,8 +17677,8 @@ $(function() {
17320
17677
  var deferred = $.Deferred();
17321
17678
 
17322
17679
  var view = $(scrivito.template.render('choose_obj_class_dialog', {
17323
- title: scrivito.i18n.translate('choose_obj_class_dialog.' + locale_path + '.title'),
17324
- description: scrivito.i18n.translate('choose_obj_class_dialog.' + locale_path + '.description')
17680
+ title: scrivito.t('choose_obj_class_dialog.' + locale_path + '.title'),
17681
+ description: scrivito.t('choose_obj_class_dialog.' + locale_path + '.description')
17325
17682
  }));
17326
17683
 
17327
17684
  obj_classes_deferred.done(function(obj_class_selection) {
@@ -17434,7 +17791,12 @@ $(function() {
17434
17791
  open: function(dom_element, commands) {
17435
17792
  scrivito.close_all_menus();
17436
17793
 
17437
- var menu = $(scrivito.template.render('menu', {commands: commands}));
17794
+ var menu = $(scrivito.template.render('menu', {
17795
+ menu_items: _.map(commands, function(command) {
17796
+ return scrivito.menu_item.create_instance(command);
17797
+ })
17798
+ }));
17799
+
17438
17800
  dom_element.data('scrivito-private-menu', menu);
17439
17801
 
17440
17802
  menu.data('scrivito-menu-close', function() {
@@ -17449,7 +17811,7 @@ $(function() {
17449
17811
  });
17450
17812
 
17451
17813
  _.each(commands, function(command) {
17452
- menu.find('.scrivito_' + command.id()).on('click', function() {
17814
+ menu.on('click', '.scrivito_' + command.id(), function() {
17453
17815
  if (command.is_enabled()) {
17454
17816
  menu.data('scrivito-menu-close')();
17455
17817
  }
@@ -17508,7 +17870,11 @@ $(window).on('load', function() {
17508
17870
  var open = function(dom_element, commands, align) {
17509
17871
  scrivito.close_all_menus();
17510
17872
 
17511
- var menu = $(scrivito.template.render('menu', {commands: commands, align: align}));
17873
+ var menu = $(scrivito.template.render('menu', {align: align,
17874
+ menu_items: _.map(commands, function(command) {
17875
+ return scrivito.menu_item.create_instance(command);
17876
+ })
17877
+ }));
17512
17878
 
17513
17879
  menu.data('scrivito-menu-close', function() {
17514
17880
  menu.find('.scrivito_menu_box').fadeOut(500, function() {
@@ -17517,7 +17883,7 @@ $(window).on('load', function() {
17517
17883
  });
17518
17884
 
17519
17885
  _.each(commands, function(command) {
17520
- menu.find('.scrivito_menu_item.scrivito_' + command.id()).on('click', function() {
17886
+ menu.on('click', '.scrivito_' + command.id(), function() {
17521
17887
  if (command.is_enabled()) {
17522
17888
  menu.data('scrivito-menu-close')();
17523
17889
  }
@@ -17618,8 +17984,7 @@ $(window).on('load', function() {
17618
17984
 
17619
17985
  open: function(obj) {
17620
17986
  return scrivito.details_dialog.open({
17621
- title: scrivito.i18n.translate('resource_dialog.title'),
17622
- icon: '&#xf03d;',
17987
+ title: scrivito.t('resource_dialog.title', obj.obj_class_name()),
17623
17988
  fetch_markup: function() {
17624
17989
  return obj.fetch_details_markup();
17625
17990
  },
@@ -17640,9 +18005,9 @@ $(window).on('load', function() {
17640
18005
  add_subpage_command: function(child_list_element) {
17641
18006
  return scrivito.command.create_instance({
17642
18007
  id: 'add_subpage',
17643
- title: scrivito.i18n.translate('commands.add_subpage.title'),
18008
+ title: scrivito.t('commands.add_subpage.title'),
17644
18009
  icon: '&#xf022;',
17645
- tooltip: scrivito.i18n.translate('commands.add_subpage.tooltip',
18010
+ tooltip: scrivito.t('commands.add_subpage.tooltip',
17646
18011
  child_list_element.obj().description_for_editor()),
17647
18012
 
17648
18013
  execute: function() {
@@ -17666,7 +18031,7 @@ $(window).on('load', function() {
17666
18031
  add_widget_command: function(widget_field_element, widget_element) {
17667
18032
  return scrivito.command.create_instance({
17668
18033
  id: 'add_widget',
17669
- title: scrivito.i18n.translate('commands.add_widget.title'),
18034
+ title: scrivito.t('commands.add_widget.title'),
17670
18035
  icon: '&#xf022;',
17671
18036
 
17672
18037
  present: function() {
@@ -17703,7 +18068,7 @@ $(window).on('load', function() {
17703
18068
  copy_page_from_clipboard_command: function(child_list_element) {
17704
18069
  return scrivito.command.create_instance({
17705
18070
  id: 'copy_page_from_clipboard',
17706
- title: scrivito.i18n.translate('commands.copy_page_from_clipboard.title'),
18071
+ title: scrivito.t('commands.copy_page_from_clipboard.title'),
17707
18072
  icon: '&#xf015;',
17708
18073
 
17709
18074
  present: function() {
@@ -17713,7 +18078,7 @@ $(window).on('load', function() {
17713
18078
  disabled: function() {
17714
18079
  var obj_class_name = scrivito.obj_clipboard.obj().obj_class_name();
17715
18080
  if (!child_list_element.is_valid_child_class(obj_class_name)) {
17716
- return scrivito.i18n.translate('commands.copy_page_from_clipboard.paste_forbidden',
18081
+ return scrivito.t('commands.copy_page_from_clipboard.paste_forbidden',
17717
18082
  child_list_element.allowed_classes().join(', '));
17718
18083
  }
17719
18084
  },
@@ -17734,7 +18099,7 @@ $(window).on('load', function() {
17734
18099
  copy_widget_from_clipboard_command: function(widget_field_element, widget_element) {
17735
18100
  return scrivito.command.create_instance({
17736
18101
  id: 'copy_widget_from_clipboard',
17737
- title: scrivito.i18n.translate('commands.copy_widget_from_clipboard.title'),
18102
+ title: scrivito.t('commands.copy_widget_from_clipboard.title'),
17738
18103
  icon: '&#xf015;',
17739
18104
 
17740
18105
  present: function() {
@@ -17751,7 +18116,7 @@ $(window).on('load', function() {
17751
18116
  disabled: function() {
17752
18117
  var widget_class_name = scrivito.widget_clipboard.widget().widget_class_name();
17753
18118
  if (!widget_field_element.is_valid_child_class(widget_class_name)) {
17754
- return scrivito.i18n.translate('commands.copy_widget_from_clipboard.paste_forbidden',
18119
+ return scrivito.t('commands.copy_widget_from_clipboard.paste_forbidden',
17755
18120
  widget_field_element.allowed_classes().join(', '));
17756
18121
  }
17757
18122
  },
@@ -17776,6 +18141,37 @@ $(window).on('load', function() {
17776
18141
  }
17777
18142
  });
17778
18143
  }());
18144
+ (function() {
18145
+ $.extend(scrivito, {
18146
+ create_workspace_command: function() {
18147
+ return scrivito.command.create_instance({
18148
+ id: 'create_workspace',
18149
+ title: scrivito.t('commands.create_workspace.title'),
18150
+ icon: '&#xf022;',
18151
+
18152
+ execute: function() {
18153
+ scrivito.prompt_dialog({
18154
+ title: scrivito.t('commands.create_workspace.dialog.title'),
18155
+ description: scrivito.t('commands.create_workspace.dialog.description'),
18156
+ placeholder: scrivito.t('commands.create_workspace.dialog.placeholder'),
18157
+ icon: '&#xf022;',
18158
+ color: 'green',
18159
+ accept_button_text: scrivito.t('commands.create_workspace.dialog.accept'),
18160
+ accept_button_color: 'green'
18161
+ }).then(function(title) {
18162
+ scrivito.with_saving_overlay(scrivito.workspace.create(title).then(function(workspace) {
18163
+ var path = '?_scrivito_workspace_id=' + workspace.id();
18164
+ if (!scrivito.editing_context.selected_workspace.is_editable()) {
18165
+ path += '&_scrivito_display_mode=editing';
18166
+ }
18167
+ return scrivito.redirect_to(path);
18168
+ }));
18169
+ });
18170
+ }
18171
+ });
18172
+ }
18173
+ });
18174
+ }());
17779
18175
  (function() {
17780
18176
  $.extend(scrivito, {
17781
18177
  delete_obj_command: function(obj, translations_namespace) {
@@ -17785,7 +18181,7 @@ $(window).on('load', function() {
17785
18181
 
17786
18182
  return scrivito.command.create_instance({
17787
18183
  id: 'delete_obj',
17788
- title: scrivito.i18n.translate(translations_namespace + '.title'),
18184
+ title: scrivito.t(translations_namespace + '.title'),
17789
18185
  icon: '&#xf018;',
17790
18186
 
17791
18187
  present: function() {
@@ -17794,20 +18190,20 @@ $(window).on('load', function() {
17794
18190
 
17795
18191
  disabled: function() {
17796
18192
  if (!scrivito.editing_context.selected_workspace.is_editable()) {
17797
- return scrivito.i18n.translate('commands.delete_obj.published_workspace');
18193
+ return scrivito.t('commands.delete_obj.published_workspace');
17798
18194
  }
17799
18195
  if (obj.has_children()) {
17800
- return scrivito.i18n.translate('commands.delete_obj.has_children');
18196
+ return scrivito.t('commands.delete_obj.has_children');
17801
18197
  }
17802
18198
  },
17803
18199
 
17804
18200
  execute: function() {
17805
18201
  return scrivito.confirmation_dialog({
17806
- title: scrivito.i18n.translate(translations_namespace + '.dialog.title'),
17807
- description: scrivito.i18n.translate(translations_namespace + '.dialog.description'),
18202
+ title: scrivito.t(translations_namespace + '.dialog.title'),
18203
+ description: scrivito.t(translations_namespace + '.dialog.description'),
17808
18204
  icon: '&#xf018;',
17809
18205
  color: 'red',
17810
- confirm_button_text: scrivito.i18n.translate('commands.delete_obj.dialog.confirm'),
18206
+ confirm_button_text: scrivito.t('commands.delete_obj.dialog.confirm'),
17811
18207
  confirm_button_color: 'red'
17812
18208
  }).then(function() {
17813
18209
  return scrivito.with_saving_overlay(obj.destroy().then(function() {
@@ -17828,7 +18224,7 @@ $(window).on('load', function() {
17828
18224
  delete_widget_command: function(widget_field_element, widget_element) {
17829
18225
  return scrivito.command.create_instance({
17830
18226
  id: 'delete_widget',
17831
- title: scrivito.i18n.translate('commands.delete_widget.title'),
18227
+ title: scrivito.t('commands.delete_widget.title'),
17832
18228
  icon: '&#xf018;',
17833
18229
 
17834
18230
  present: function() {
@@ -17837,11 +18233,11 @@ $(window).on('load', function() {
17837
18233
 
17838
18234
  execute: function() {
17839
18235
  return scrivito.confirmation_dialog({
17840
- title: scrivito.i18n.translate('commands.delete_widget.dialog.title'),
17841
- description: scrivito.i18n.translate('commands.delete_widget.dialog.description'),
18236
+ title: scrivito.t('commands.delete_widget.dialog.title'),
18237
+ description: scrivito.t('commands.delete_widget.dialog.description'),
17842
18238
  icon: '&#xf018;',
17843
18239
  color: 'red',
17844
- confirm_button_text: scrivito.i18n.translate('commands.delete_widget.dialog.confirm'),
18240
+ confirm_button_text: scrivito.t('commands.delete_widget.dialog.confirm'),
17845
18241
  confirm_button_color: 'red'
17846
18242
  }).then(function() {
17847
18243
  var widget = widget_element.widget();
@@ -17865,12 +18261,38 @@ $(window).on('load', function() {
17865
18261
  }
17866
18262
  });
17867
18263
  }());
18264
+ (function() {
18265
+ $.extend(scrivito, {
18266
+ delete_workspace_command: function(workspace) {
18267
+ return scrivito.command.create_instance({
18268
+ id: 'delete_workspace',
18269
+ title: scrivito.t('commands.delete_workspace.title'),
18270
+ icon: '&#xf018;',
18271
+
18272
+ execute: function() {
18273
+ scrivito.confirmation_dialog({
18274
+ title: scrivito.t('commands.delete_workspace.dialog.title', workspace.title()),
18275
+ description: scrivito.t('commands.delete_workspace.dialog.description'),
18276
+ icon: '&#xf018;',
18277
+ color: 'red',
18278
+ confirm_button_text: scrivito.t('commands.delete_workspace.dialog.confirm'),
18279
+ confirm_button_color: 'red'
18280
+ }).done(function() {
18281
+ scrivito.with_saving_overlay(workspace.destroy().then(function() {
18282
+ return scrivito.redirect_to('?_scrivito_workspace_id=published');
18283
+ }));
18284
+ });
18285
+ }
18286
+ });
18287
+ }
18288
+ });
18289
+ }());
17868
18290
  (function() {
17869
18291
  $.extend(scrivito, {
17870
18292
  duplicate_obj_command: function(obj) {
17871
18293
  return scrivito.command.create_instance({
17872
18294
  id: 'duplicate_obj',
17873
- title: scrivito.i18n.translate('commands.duplicate_obj.title'),
18295
+ title: scrivito.t('commands.duplicate_obj.title'),
17874
18296
  icon: '&#xf015;',
17875
18297
 
17876
18298
  present: function() {
@@ -17879,10 +18301,10 @@ $(window).on('load', function() {
17879
18301
 
17880
18302
  disabled: function() {
17881
18303
  if (!scrivito.editing_context.selected_workspace.is_editable()) {
17882
- return scrivito.i18n.translate('commands.duplicate_obj.published_workspace');
18304
+ return scrivito.t('commands.duplicate_obj.published_workspace');
17883
18305
  }
17884
18306
  if (obj.has_children()) {
17885
- return scrivito.i18n.translate('commands.duplicate_obj.has_children');
18307
+ return scrivito.t('commands.duplicate_obj.has_children');
17886
18308
  }
17887
18309
  },
17888
18310
 
@@ -17904,7 +18326,7 @@ $(window).on('load', function() {
17904
18326
 
17905
18327
  return scrivito.command.create_instance({
17906
18328
  id: 'mark_resolved_obj',
17907
- title: scrivito.i18n.translate(translations_namespace + '.title'),
18329
+ title: scrivito.t(translations_namespace + '.title'),
17908
18330
  icon: '&#xf124;',
17909
18331
 
17910
18332
  present: function() {
@@ -17913,11 +18335,11 @@ $(window).on('load', function() {
17913
18335
 
17914
18336
  execute: function() {
17915
18337
  return scrivito.confirmation_dialog({
17916
- title: scrivito.i18n.translate('commands.mark_resolved_obj.dialog.title'),
17917
- description: scrivito.i18n.translate(translations_namespace + '.dialog.description'),
18338
+ title: scrivito.t('commands.mark_resolved_obj.dialog.title'),
18339
+ description: scrivito.t(translations_namespace + '.dialog.description'),
17918
18340
  icon: '&#xf124;',
17919
18341
  color: 'red',
17920
- confirm_button_text: scrivito.i18n.translate('commands.mark_resolved_obj.dialog.confirm'),
18342
+ confirm_button_text: scrivito.t('commands.mark_resolved_obj.dialog.confirm'),
17921
18343
  confirm_button_color: 'red'
17922
18344
  }).then(function() {
17923
18345
  return scrivito.with_saving_overlay(obj.mark_resolved().then(function() {
@@ -17934,7 +18356,7 @@ $(window).on('load', function() {
17934
18356
  move_page_from_clipboard_command: function(child_list_element) {
17935
18357
  return scrivito.command.create_instance({
17936
18358
  id: 'move_page_from_clipboard',
17937
- title: scrivito.i18n.translate('commands.move_page_from_clipboard.title'),
18359
+ title: scrivito.t('commands.move_page_from_clipboard.title'),
17938
18360
  icon: '&#xf016;',
17939
18361
 
17940
18362
  present: function() {
@@ -17944,7 +18366,7 @@ $(window).on('load', function() {
17944
18366
  disabled: function() {
17945
18367
  var obj_class_name = scrivito.obj_clipboard.obj().obj_class_name();
17946
18368
  if (!child_list_element.is_valid_child_class(obj_class_name)) {
17947
- return scrivito.i18n.translate('commands.move_page_from_clipboard.paste_forbidden',
18369
+ return scrivito.t('commands.move_page_from_clipboard.paste_forbidden',
17948
18370
  child_list_element.allowed_classes().join(', '));
17949
18371
  }
17950
18372
  },
@@ -17965,8 +18387,8 @@ $(window).on('load', function() {
17965
18387
  obj_details_command: function(obj) {
17966
18388
  return scrivito.command.create_instance({
17967
18389
  id: 'obj_details',
17968
- title: scrivito.i18n.translate('commands.obj_details.title'),
17969
- icon: '&#xf03d;',
18390
+ title: scrivito.t('commands.obj_details.title'),
18391
+ icon: '&#xf030;',
17970
18392
 
17971
18393
  present: function() {
17972
18394
  return obj.has_details_view();
@@ -17975,8 +18397,7 @@ $(window).on('load', function() {
17975
18397
  execute: function() {
17976
18398
  return scrivito.write_monitor.track_changes(function() {
17977
18399
  return scrivito.details_dialog.open({
17978
- title: scrivito.i18n.translate('current_page'),
17979
- icon: '&#xf03d;',
18400
+ title: scrivito.t('commands.obj_details.dialog.title', obj.obj_class_name()),
17980
18401
  fetch_markup: function() {
17981
18402
  return obj.fetch_details_markup();
17982
18403
  }
@@ -17992,63 +18413,111 @@ $(window).on('load', function() {
17992
18413
  (function() {
17993
18414
  $.extend(scrivito, {
17994
18415
  publish_workspace_command: function(workspace) {
17995
- var t = scrivito.i18n.translate;
17996
- var workspace_title = workspace.title() ||
17997
- t('menu_bar.empty_workspace_title');
18416
+ var open_confirmation_dialog = function() {
18417
+ return scrivito.confirmation_dialog({
18418
+ title: scrivito.t('commands.publish_workspace.dialog.title', workspace.title()),
18419
+ description: scrivito.t('commands.publish_workspace.dialog.description'),
18420
+ icon: '&#xf064;',
18421
+ color: 'green',
18422
+ confirm_button_text: scrivito.t('commands.publish_workspace.dialog.confirm'),
18423
+ confirm_button_color: 'green'
18424
+ });
18425
+ };
17998
18426
 
17999
18427
  var open_check_failed_dialog = function() {
18000
18428
  scrivito.confirmation_dialog({
18001
- title: scrivito.i18n.translate('commands.publish_workspace.error_dialog.title'),
18002
- description: scrivito.i18n.translate('commands.publish_workspace.error_dialog.description'),
18429
+ title: scrivito.t('commands.publish_workspace.error_dialog.title'),
18430
+ description: scrivito.t('commands.publish_workspace.error_dialog.description'),
18003
18431
  color: 'red',
18004
18432
  icon: '&#xf064;',
18005
- confirm_button_text: scrivito.i18n.translate('commands.publish_workspace.error_dialog.confirm')
18433
+ confirm_button_text: scrivito.t('commands.publish_workspace.error_dialog.confirm')
18006
18434
  }).then(function() {
18007
18435
  scrivito.changes_dialog.open();
18008
18436
  });
18009
18437
  };
18010
18438
 
18011
18439
  return scrivito.command.create_instance({
18012
- id: 'scrivito_publish_current_ws',
18013
- title: t('commands.publish_workspace.title', workspace_title),
18440
+ id: 'publish_workspace',
18441
+ title: scrivito.t('commands.publish_workspace.title'),
18014
18442
  icon: '&#xf064;',
18015
- tooltip: t('commands.publish_workspace.title', workspace_title),
18443
+ tooltip: scrivito.t('commands.publish_workspace.title', workspace.title()),
18444
+
18016
18445
  disabled: function() {
18017
- if (!scrivito.user_permissions.can("publish_workspace")) {
18018
- return t('commands.publish_workspace.permission_denied');
18446
+ if (!scrivito.user_permissions.can('publish_workspace')) {
18447
+ return scrivito.t('commands.publish_workspace.permission_denied');
18019
18448
  }
18020
18449
  },
18450
+
18021
18451
  execute: function() {
18022
- if (scrivito.user_permissions.can("publish_workspace")) {
18023
- scrivito.workspace_select.close_menu();
18024
-
18025
- scrivito.confirmation_dialog({
18026
- icon: '&#xf064;',
18027
- color: 'green',
18028
- confirm_button_text: t('commands.publish_workspace.dialog.confirm'),
18029
- confirm_button_color: 'green',
18030
- title: t('commands.publish_workspace.dialog.title', workspace_title),
18031
- description: t('commands.publish_workspace.dialog.description')
18032
- }).done(function() {
18033
- scrivito.with_saving_overlay(
18034
- workspace.check_and_publish().done(function() {
18035
- return scrivito.redirect_to('?_scrivito_workspace_id=published');
18036
- }).fail(function(error) {
18037
- if (error.type) {
18038
- if (error.type === 'check_failed') {
18039
- open_check_failed_dialog();
18040
- }
18041
- if (error.type === 'outdated_certificates') {
18042
- scrivito.alert_dialog(
18043
- t('commands.publish_workspace.alert.invalid_certificates')
18044
- );
18045
- }
18046
- }
18047
- })
18048
- );
18452
+ if (scrivito.user_permissions.can('publish_workspace')) {
18453
+ open_confirmation_dialog().done(function() {
18454
+ scrivito.with_saving_overlay(workspace.check_and_publish().done(function() {
18455
+ return scrivito.redirect_to('?_scrivito_workspace_id=published');
18456
+ }).fail(function(error) {
18457
+ if (error.type === 'check_failed') {
18458
+ open_check_failed_dialog();
18459
+ } else if (error.type === 'outdated_certificates') {
18460
+ scrivito.alert_dialog(
18461
+ scrivito.t('commands.publish_workspace.alert.invalid_certificates'));
18462
+ }
18463
+ }));
18049
18464
  });
18050
18465
  }
18051
- return false;
18466
+ }
18467
+ });
18468
+ }
18469
+ });
18470
+ }());
18471
+ (function() {
18472
+ $.extend(scrivito, {
18473
+ rebase_workspace_command: function(workspace) {
18474
+ return scrivito.command.create_instance({
18475
+ id: 'rebase_workspace',
18476
+ title: scrivito.t('commands.rebase_workspace.title'),
18477
+ icon: '&#xf023;',
18478
+ tooltip: scrivito.t('commands.rebase_workspace.tooltip', workspace.title()),
18479
+
18480
+ disabled: function() {
18481
+ if (!workspace.is_outdated()) {
18482
+ return scrivito.t('commands.rebase_workspace.uptodate', workspace.title());
18483
+ }
18484
+ },
18485
+
18486
+ action_required: function() {
18487
+ return workspace.is_outdated();
18488
+ },
18489
+
18490
+ execute: function() {
18491
+ scrivito.with_saving_overlay(workspace.rebase().then(function() {
18492
+ return scrivito.reload();
18493
+ }));
18494
+ }
18495
+ });
18496
+ }
18497
+ });
18498
+ }());
18499
+ (function() {
18500
+ $.extend(scrivito, {
18501
+ rename_workspace_command: function(workspace) {
18502
+ return scrivito.command.create_instance({
18503
+ id: 'rename_workspace',
18504
+ title: scrivito.t('commands.rename_workspace.title'),
18505
+ icon: '&#xf04f;',
18506
+
18507
+ execute: function() {
18508
+ scrivito.prompt_dialog({
18509
+ title: scrivito.t('commands.rename_workspace.dialog.title', workspace.title()),
18510
+ description: scrivito.t('commands.rename_workspace.dialog.description'),
18511
+ value: workspace.original_title(),
18512
+ icon: '&#xf04f;',
18513
+ color: 'green',
18514
+ accept_button_text: scrivito.t('commands.rename_workspace.dialog.accept'),
18515
+ accept_button_color: 'green'
18516
+ }).done(function(new_title) {
18517
+ scrivito.with_saving_overlay(workspace.rename(new_title).then(function() {
18518
+ return scrivito.reload();
18519
+ }));
18520
+ });
18052
18521
  }
18053
18522
  });
18054
18523
  }
@@ -18063,7 +18532,7 @@ $(window).on('load', function() {
18063
18532
 
18064
18533
  return scrivito.command.create_instance({
18065
18534
  id: 'restore_obj',
18066
- title: scrivito.i18n.translate(translations_namespace + '.title'),
18535
+ title: scrivito.t(translations_namespace + '.title'),
18067
18536
  icon: '&#xf032;',
18068
18537
 
18069
18538
  present: function() {
@@ -18072,7 +18541,7 @@ $(window).on('load', function() {
18072
18541
 
18073
18542
  disabled: function() {
18074
18543
  if (scrivito.editing_context.selected_workspace.is_rtc()) {
18075
- return scrivito.i18n.translate(translations_namespace + '.rtc_workspace');
18544
+ return scrivito.t(translations_namespace + '.rtc_workspace');
18076
18545
  }
18077
18546
  },
18078
18547
 
@@ -18094,35 +18563,37 @@ $(window).on('load', function() {
18094
18563
 
18095
18564
  return scrivito.command.create_instance({
18096
18565
  id: 'revert_obj',
18097
- title: scrivito.i18n.translate(translations_namespace + '.title'),
18566
+ title: scrivito.t(translations_namespace + '.title'),
18098
18567
  icon: '&#xf032;',
18099
18568
 
18100
18569
  present: function() {
18101
- return obj && !obj.is_deleted();
18570
+ return scrivito.editing_context.selected_workspace.is_editable() &&
18571
+ obj && !obj.is_deleted();
18102
18572
  },
18103
18573
 
18104
18574
  disabled: function() {
18105
- if (!scrivito.editing_context.selected_workspace.is_editable()) {
18106
- return scrivito.i18n.translate('commands.revert_obj.published_workspace');
18107
- }
18108
18575
  if (scrivito.editing_context.selected_workspace.is_rtc()) {
18109
- return scrivito.i18n.translate(translations_namespace + '.rtc_workspace');
18576
+ return scrivito.t(translations_namespace + '.rtc_workspace');
18110
18577
  }
18111
18578
  if (!obj.modification()) {
18112
- return scrivito.i18n.translate(translations_namespace + '.not_modified_obj');
18579
+ return scrivito.t(translations_namespace + '.not_modified_obj');
18113
18580
  }
18114
18581
  if (obj.is_new()) {
18115
- return scrivito.i18n.translate(translations_namespace + '.new_obj');
18582
+ return scrivito.t(translations_namespace + '.new_obj');
18116
18583
  }
18117
18584
  },
18118
18585
 
18586
+ update: function() {
18587
+ return obj.update_modification();
18588
+ },
18589
+
18119
18590
  execute: function() {
18120
18591
  return scrivito.confirmation_dialog({
18121
- title: scrivito.i18n.translate(translations_namespace + '.dialog.title'),
18122
- description: scrivito.i18n.translate('commands.revert_obj.dialog.description'),
18592
+ title: scrivito.t(translations_namespace + '.dialog.title'),
18593
+ description: scrivito.t('commands.revert_obj.dialog.description'),
18123
18594
  icon: '&#xf032;',
18124
18595
  color: 'red',
18125
- confirm_button_text: scrivito.i18n.translate('commands.revert_obj.dialog.confirm'),
18596
+ confirm_button_text: scrivito.t('commands.revert_obj.dialog.confirm'),
18126
18597
  confirm_button_color: 'red'
18127
18598
  }).then(function() {
18128
18599
  return scrivito.with_saving_overlay(obj.revert().then(function() {
@@ -18134,12 +18605,57 @@ $(window).on('load', function() {
18134
18605
  }
18135
18606
  });
18136
18607
  }());
18608
+ (function() {
18609
+ $.extend(scrivito, {
18610
+ revert_widget_command: function(widget_element) {
18611
+ var widget = widget_element.widget();
18612
+ return scrivito.command.create_instance({
18613
+ id: 'revert_widget',
18614
+ title: scrivito.i18n.translate('commands.revert_widget.title'),
18615
+ icon: '&#xf032;',
18616
+
18617
+ present: function() {
18618
+ return scrivito.editing_context.selected_workspace.is_editable() && !widget.is_deleted();
18619
+ },
18620
+
18621
+ disabled: function() {
18622
+ if (widget.is_new()) {
18623
+ return scrivito.i18n.translate('commands.revert_widget.is_new');
18624
+ }
18625
+ if (!widget.is_modified()) {
18626
+ return scrivito.i18n.translate('commands.revert_widget.is_not_modified');
18627
+ }
18628
+ },
18629
+
18630
+ update: function() {
18631
+ return widget.update_modification();
18632
+ },
18633
+
18634
+ execute: function() {
18635
+ return scrivito.confirmation_dialog({
18636
+ title: scrivito.i18n.translate('commands.revert_widget.dialog.title'),
18637
+ description: scrivito.i18n.translate('commands.revert_widget.dialog.description'),
18638
+ icon: '&#xf032;',
18639
+ color: 'red',
18640
+ confirm_button_text: scrivito.i18n.translate('commands.revert_obj.dialog.confirm'),
18641
+ confirm_button_color: 'red'
18642
+ }).then(function() {
18643
+ var dom_element = widget_element.dom_element();
18644
+ scrivito.with_element_overlay(dom_element, widget.revert().then(function() {
18645
+ dom_element.trigger('scrivito_reload');
18646
+ }));
18647
+ });
18648
+ }
18649
+ });
18650
+ }
18651
+ });
18652
+ }());
18137
18653
  (function() {
18138
18654
  $.extend(scrivito, {
18139
18655
  save_obj_to_clipboard_command: function(obj) {
18140
18656
  return scrivito.command.create_instance({
18141
18657
  id: 'save_obj_to_clipboard',
18142
- title: scrivito.i18n.translate('commands.save_obj_to_clipboard.title'),
18658
+ title: scrivito.t('commands.save_obj_to_clipboard.title'),
18143
18659
  icon: '&#xf017;',
18144
18660
 
18145
18661
  present: function() {
@@ -18148,7 +18664,7 @@ $(window).on('load', function() {
18148
18664
 
18149
18665
  disabled: function() {
18150
18666
  if (obj.has_children()) {
18151
- return scrivito.i18n.translate('commands.save_obj_to_clipboard.has_children');
18667
+ return scrivito.t('commands.save_obj_to_clipboard.has_children');
18152
18668
  }
18153
18669
  },
18154
18670
 
@@ -18164,7 +18680,7 @@ $(window).on('load', function() {
18164
18680
  save_widget_to_clipboard_command: function(widget_element) {
18165
18681
  return scrivito.command.create_instance({
18166
18682
  id: 'save_widget_to_clipboard',
18167
- title: scrivito.i18n.translate('commands.save_widget_to_clipboard.title'),
18683
+ title: scrivito.t('commands.save_widget_to_clipboard.title'),
18168
18684
  icon: '&#xf017;',
18169
18685
 
18170
18686
  present: function() {
@@ -18178,22 +18694,38 @@ $(window).on('load', function() {
18178
18694
  }
18179
18695
  });
18180
18696
  }());
18697
+ (function() {
18698
+ $.extend(scrivito, {
18699
+ select_workspace_command: function(workspace) {
18700
+ return scrivito.command.create_instance({
18701
+ id: 'select_workspace_' + workspace.id(),
18702
+ title: workspace.title(),
18703
+ icon: workspace.icon(),
18704
+
18705
+ execute: function() {
18706
+ scrivito.with_saving_overlay(
18707
+ scrivito.redirect_to('?_scrivito_workspace_id=' + workspace.id()));
18708
+ }
18709
+ });
18710
+ }
18711
+ });
18712
+ }());
18181
18713
  (function() {
18182
18714
  $.extend(scrivito, {
18183
18715
  sort_items_command: function(child_list_element) {
18184
18716
  return scrivito.command.create_instance({
18185
18717
  id: 'sort_items',
18186
- title: scrivito.i18n.translate('commands.sort_items.title'),
18718
+ title: scrivito.t('commands.sort_items.title'),
18187
18719
  icon: '&#xf03c;',
18188
- tooltip: scrivito.i18n.translate('commands.sort_items.tooltip',
18720
+ tooltip: scrivito.t('commands.sort_items.tooltip',
18189
18721
  child_list_element.obj().description_for_editor()),
18190
18722
 
18191
18723
  disabled: function() {
18192
18724
  if (!child_list_element.has_child_order()) {
18193
- return scrivito.i18n.translate('commands.sort_items.auto_sort');
18725
+ return scrivito.t('commands.sort_items.auto_sort');
18194
18726
  }
18195
18727
  if (child_list_element.children().length < 2) {
18196
- return scrivito.i18n.translate('commands.sort_items.too_less_children');
18728
+ return scrivito.t('commands.sort_items.too_less_children');
18197
18729
  }
18198
18730
  },
18199
18731
 
@@ -18229,18 +18761,19 @@ $(window).on('load', function() {
18229
18761
 
18230
18762
  return scrivito.command.create_instance({
18231
18763
  id: 'switch_to_' + mode + '_mode',
18232
- title: scrivito.i18n.translate('commands.switch_mode.' + mode),
18764
+ title: scrivito.t('commands.switch_mode.' + mode),
18233
18765
  icon: icon,
18234
18766
 
18235
18767
  disabled: function() {
18236
18768
  if (scrivito.editing_context.display_mode === mode) {
18237
- return scrivito.i18n.translate('commands.switch_mode.disabled');
18769
+ return scrivito.t('commands.switch_mode.disabled');
18238
18770
  }
18239
18771
  },
18240
18772
 
18241
18773
  execute: function() {
18242
18774
  if (mode !== 'view' && !scrivito.editing_context.selected_workspace.is_editable()) {
18243
- scrivito.workspace.all_editable().done(function(workspaces) {
18775
+ var fetch_workspaces = scrivito.with_saving_overlay(scrivito.workspace.all_editable());
18776
+ fetch_workspaces.then(function(workspaces) {
18244
18777
  scrivito.editable_workspace_dialog.open(workspaces).done(function(workspace_id) {
18245
18778
  redirect_to(mode, workspace_id);
18246
18779
  });
@@ -18264,26 +18797,31 @@ $(window).on('load', function() {
18264
18797
  (function() {
18265
18798
  $.extend(scrivito, {
18266
18799
  widget_details_command: function(widget_element) {
18800
+ var widget = function() {
18801
+ return widget_element.widget();
18802
+ };
18803
+
18267
18804
  return scrivito.command.create_instance({
18268
18805
  id: 'widget_details',
18269
- title: scrivito.i18n.translate('commands.widget_details.title'),
18806
+ title: scrivito.t('commands.widget_details.title'),
18270
18807
  icon: '&#xf030;',
18271
18808
 
18272
18809
  present: function() {
18273
18810
  return scrivito.editing_context.is_editing_mode() ||
18274
- widget_element.widget().is_modified();
18811
+ widget().is_modified() ||
18812
+ widget().is_placement_modified();
18275
18813
  },
18276
18814
 
18277
18815
  disabled: function() {
18278
18816
  if (!widget_element.has_details_view()) {
18279
- return scrivito.i18n.translate('commands.widget_details.no_details_view');
18817
+ return scrivito.t('commands.widget_details.no_details_view');
18280
18818
  }
18281
18819
  },
18282
18820
 
18283
18821
  execute: function() {
18284
18822
  return scrivito.write_monitor.track_changes(function() {
18285
18823
  return scrivito.details_dialog.open({
18286
- title: widget_element.widget().widget_class_name(),
18824
+ title: scrivito.t('commands.widget_details.dialog.title', widget().widget_class_name()),
18287
18825
  fetch_markup: function() {
18288
18826
  return widget_element.fetch_details_markup();
18289
18827
  }
@@ -18296,21 +18834,32 @@ $(window).on('load', function() {
18296
18834
  }
18297
18835
  });
18298
18836
  }());
18837
+ (function() {
18838
+ $.extend(scrivito, {
18839
+ workspace_changes_command: function() {
18840
+ return scrivito.command.create_instance({
18841
+ id: 'workspace_changes',
18842
+ title: scrivito.t('commands.workspace_changes.title'),
18843
+ icon: '&#xf080;',
18844
+
18845
+ execute: function() {
18846
+ scrivito.changes_dialog.open();
18847
+ }
18848
+ });
18849
+ }
18850
+ });
18851
+ }());
18299
18852
  (function() {
18300
18853
  $.extend(scrivito, {
18301
18854
  workspace_settings_command: function(workspace) {
18302
- var title = scrivito.i18n.translate('commands.workspace_settings.title', workspace.title());
18303
18855
  return scrivito.command.create_instance({
18304
18856
  id: 'workspace_settings',
18305
- title: title,
18857
+ title: scrivito.t('commands.workspace_settings.title'),
18306
18858
  icon: '&#xf030;',
18307
18859
 
18308
- present: function() {
18309
- return workspace.is_editable();
18310
- },
18311
-
18312
18860
  execute: function() {
18313
18861
  workspace.fetch_memberships().then(function(memberships) {
18862
+ var title = scrivito.t('commands.workspace_settings.dialog.title', workspace.title());
18314
18863
  scrivito.workspace_settings_dialog.open(title, memberships).then(function(memberships) {
18315
18864
  scrivito.with_saving_overlay(
18316
18865
  workspace.update({memberships: memberships}).then(function() {
@@ -18357,6 +18906,7 @@ $(window).on('load', function() {
18357
18906
  scrivito.widget_details_command(widget_element),
18358
18907
  scrivito.save_widget_to_clipboard_command(widget_element),
18359
18908
  scrivito.copy_widget_from_clipboard_command(widget_field_element, widget_element),
18909
+ scrivito.revert_widget_command(widget_element),
18360
18910
  scrivito.delete_widget_command(widget_field_element, widget_element)
18361
18911
  ].concat(widget_element.menu()));
18362
18912
  });
@@ -18391,7 +18941,7 @@ $(window).on('load', function() {
18391
18941
  scrivito.inplace_marker.define(function(inplace_marker) {
18392
18942
  if (scrivito.editing_context.is_editing_mode()) {
18393
18943
  _.each(scrivito.child_list_element.all(), function(child_list_element) {
18394
- var description = scrivito.i18n.translate('child_list_menu.description',
18944
+ var description = scrivito.t('child_list_menu.description',
18395
18945
  child_list_element.obj().description_for_editor());
18396
18946
  inplace_marker.activate_for(child_list_element, {description: description});
18397
18947
  });
@@ -18426,10 +18976,10 @@ $(window).on('load', function() {
18426
18976
  if (scrivito.editing_context.selected_workspace.is_editable()) {
18427
18977
  _.each(scrivito.widget_field_element.all(), function(widget_field_element) {
18428
18978
  _.each(widget_field_element.widget_elements(), function(widget_element) {
18429
- var is_modified = widget_element.widget().modification() ||
18430
- widget_element.widget().container_modification();
18979
+ var show_as_modified = widget_element.widget().is_modified() ||
18980
+ widget_element.widget().is_placement_modified();
18431
18981
  if (scrivito.editing_context.is_editing_mode() ||
18432
- scrivito.editing_context.is_comparing_mode() && is_modified) {
18982
+ scrivito.editing_context.is_comparing_mode() && show_as_modified) {
18433
18983
  inplace_marker.activate_for(widget_element,
18434
18984
  inplace_marker_options(widget_element));
18435
18985
  }
@@ -18447,7 +18997,7 @@ $(window).on('load', function() {
18447
18997
  if (scrivito.editing_context.is_comparing_mode()) {
18448
18998
  var tooltip_translation_key;
18449
18999
  var modification = widget_element.widget().modification();
18450
- var container_modification = widget_element.widget().container_modification();
19000
+ var placement_modification = widget_element.widget().placement_modification();
18451
19001
 
18452
19002
  switch (modification) {
18453
19003
  case 'new':
@@ -18460,7 +19010,7 @@ $(window).on('load', function() {
18460
19010
  break;
18461
19011
  case 'edited':
18462
19012
  options.icon = '\uf035';
18463
- switch (container_modification) {
19013
+ switch (placement_modification) {
18464
19014
  case 'new':
18465
19015
  tooltip_translation_key = 'widget_is_edited_and_dragged_here';
18466
19016
  options.css_classes = 'scrivito_widget_moved_icon';
@@ -18475,7 +19025,7 @@ $(window).on('load', function() {
18475
19025
  break;
18476
19026
  default:
18477
19027
  options.icon = '\uf03c';
18478
- switch (container_modification) {
19028
+ switch (placement_modification) {
18479
19029
  case 'new':
18480
19030
  tooltip_translation_key = 'widget_is_dragged_here';
18481
19031
  break;
@@ -18486,7 +19036,7 @@ $(window).on('load', function() {
18486
19036
  }
18487
19037
 
18488
19038
  if (tooltip_translation_key) {
18489
- options.tooltip = scrivito.i18n.translate('widget_marker.' + tooltip_translation_key);
19039
+ options.tooltip = scrivito.t('widget_marker.' + tooltip_translation_key);
18490
19040
  }
18491
19041
  }
18492
19042
 
@@ -18715,14 +19265,14 @@ $(window).on('load', function() {
18715
19265
 
18716
19266
  view.on('focus click', '.scrivito_input_list_of_ws', function(e) {
18717
19267
  create_new_ws = false;
18718
- view.find(".scrivito_confirm").html(scrivito.i18n.translate('editable_ws_dialog.select'));
19268
+ view.find(".scrivito_confirm").html(scrivito.t('editable_ws_dialog.select'));
18719
19269
  view.find(".scrivito_disabled").removeClass("scrivito_disabled");
18720
19270
  view.find(".scrivito_input_new_ws_name label, .scrivito_input_new_ws_name input").addClass("scrivito_disabled");
18721
19271
  });
18722
19272
 
18723
19273
  view.on('focus click drop', '.scrivito_input_new_ws_name', function(e) {
18724
19274
  create_new_ws = true;
18725
- view.find(".scrivito_confirm").html(scrivito.i18n.translate('menu_bar.create'));
19275
+ view.find(".scrivito_confirm").html(scrivito.t('menu_bar.create'));
18726
19276
  view.find(".scrivito_disabled").removeClass("scrivito_disabled");
18727
19277
  view.find(".scrivito_input_list_of_ws label, .scrivito_input_list_of_ws select").addClass("scrivito_disabled");
18728
19278
  });
@@ -18875,9 +19425,9 @@ $(window).on('load', function() {
18875
19425
  }));
18876
19426
  }
18877
19427
  },
18878
- formatNoMatches: scrivito.i18n.translate('workspace_settings_dialog.nothing_found'),
18879
- formatSearching: scrivito.i18n.translate('workspace_settings_dialog.searching'),
18880
- formatInputTooShort: scrivito.i18n.translate('workspace_settings_dialog.too_short')
19428
+ formatNoMatches: scrivito.t('workspace_settings_dialog.nothing_found'),
19429
+ formatSearching: scrivito.t('workspace_settings_dialog.searching'),
19430
+ formatInputTooShort: scrivito.t('workspace_settings_dialog.too_short')
18881
19431
  });
18882
19432
 
18883
19433
  view.find('.scrivito_confirm').on('click', confirm);
@@ -18901,7 +19451,7 @@ $(window).on('load', function() {
18901
19451
  $.extend(scrivito, {
18902
19452
  warn_before_unloading: function() {
18903
19453
  if (scrivito.write_monitor.is_writing()) {
18904
- return scrivito.i18n.translate('warn_before_unloading');
19454
+ return scrivito.t('warn_before_unloading');
18905
19455
  }
18906
19456
  }
18907
19457
  });
@@ -18981,80 +19531,12 @@ $(window).on('load', function() {
18981
19531
  return data || {};
18982
19532
  };
18983
19533
  })();
18984
-
18985
-
18986
-
18987
-
18988
-
18989
-
18990
-
18991
-
18992
-
18993
-
18994
-
18995
-
18996
-
18997
-
18998
-
18999
-
19000
-
19001
-
19002
-
19003
-
19004
-
19005
-
19006
-
19007
-
19008
-
19009
-
19010
-
19011
-
19012
-
19013
-
19014
-
19015
-
19016
-
19017
-
19018
-
19019
-
19020
-
19021
-
19022
-
19023
-
19024
-
19025
-
19026
-
19027
-
19028
-
19029
-
19030
-
19031
-
19032
-
19033
-
19034
-
19035
-
19036
-
19037
-
19038
-
19039
- //
19040
-
19041
- //
19042
-
19043
-
19044
-
19045
- //
19046
-
19047
-
19048
-
19049
- //
19050
-
19051
-
19052
-
19053
-
19054
-
19055
-
19056
-
19057
-
19058
-
19059
-
19060
- ;
19534
+ (function() {
19535
+ $(function() {
19536
+ var config = $('[data-scrivito-private-config]').data('scrivito-private-config');
19537
+ if (config) {
19538
+ scrivito.init(config);
19539
+ scrivito.gui.start();
19540
+ }
19541
+ });
19542
+ }());