scrivito_sdk 0.66.0.rc1 → 0.66.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5732dd6aaddb2791e2954b68935774f065b3a51
4
- data.tar.gz: 49de2acf02301e6724538cca010850dc1110a9f6
3
+ metadata.gz: 50aa821e2e4ac823b30dbec2ba6f43bef68c28f9
4
+ data.tar.gz: 2334008ac34e85b9f1487a3f014512a77ac62a29
5
5
  SHA512:
6
- metadata.gz: ef22bbee7de80d523322d9d0caa469f8eb93f77fef5568ba57e88ce0187fcc0bda1087b1eaba9304e1e28123e7b8323b854e35493526deb4b06bc729b325fb7c
7
- data.tar.gz: 249d37a58feb21f1b9cc660d691b4e904957cab119fefc49133c1ab9a54345fadb6eb97677c5befd71eb3ad2e3b94a4dee36cafd825185f632820cf0cf1946ba
6
+ metadata.gz: 75a5ab9b2baccd4503b16de702d500a6bf6e7e7ed02930503930cdadc03843f5922db642139b56673b12ebe387e037120ae07d0c378341130581bef71fd5402c
7
+ data.tar.gz: 8b48fb63714fc247c91745f4b86d8169d1352502623e6c0a54101eadf62fe98580aee449466c04e8fd74ae8dfd3e5b535288ac801e286c69b9aaa351077ddf95
@@ -57,6 +57,12 @@ class WebserviceController < ActionController::Base
57
57
  def render_empty_json
58
58
  render 'scrivito/webservice/empty', formats: :json
59
59
  end
60
+
61
+ def can_user_read_workspace?(workspace)
62
+ can_user_access_workspace?(:read, workspace)
63
+ end
64
+
65
+ helper_method :can_user_read_workspace?
60
66
  end
61
67
 
62
68
  end
@@ -6,9 +6,7 @@ module Scrivito
6
6
  around_action :authorize_current_workspace_publish, only: [:check, :publish]
7
7
 
8
8
  def index
9
- @workspaces = Workspace.all.select do |workspace|
10
- can_user_access_workspace?(:read, workspace)
11
- end
9
+ @workspaces = Workspace.all.select(&method(:can_user_read_workspace?))
12
10
  render :workspaces
13
11
  end
14
12
 
@@ -1,5 +1,8 @@
1
1
  json.extract! workspace, :id, :title
2
+
2
3
  json.memberships workspace.memberships do |membership|
3
4
  json.extract! membership, :user_id, :role
4
5
  json.description membership.user.description
5
6
  end
7
+
8
+ json.is_accessible can_user_read_workspace?(workspace)
data/config/ca-bundle.crt CHANGED
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  ## Bundle of CA Root Certificates
3
3
  ##
4
- ## Certificate data from Mozilla as of: Fri Jul 3 13:41:22 2015
4
+ ## Certificate data from Mozilla as of: Mon Jul 13 11:31:35 2015
5
5
  ##
6
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
@@ -27718,7 +27718,8 @@ $.i18n().load({
27718
27718
  'commands.sort_items.too_less_children': 'Die Navigation kann nicht sortiert werden, weil sie weniger als zwei Elemente enthält.',
27719
27719
 
27720
27720
  'commands.select_workspace.x_and_1_owner': '$1 und 1 weiterer Besitzer',
27721
- 'commands.select_workspace.x_and_y_owners': '$1 und $2 weitere Besitzer',
27721
+ 'commands.select_workspace.x_and_n_owners': '$1 und $2 weitere Besitzer',
27722
+ 'commands.select_workspace.disabled': 'Diese Arbeitskopie kann aufgrund fehlender Benutzerrechte nicht ausgewählt werden',
27722
27723
 
27723
27724
  'commands.choose_and_create_widget.title': 'Widget einfügen',
27724
27725
  'commands.choose_and_create_widget.disabled': 'Sie können hier keine Widgets einfügen.',
@@ -27976,7 +27977,8 @@ $.i18n().load({
27976
27977
  'commands.sort_items.too_less_children': 'This navigation cannot be sorted because it consists of less than two items.',
27977
27978
 
27978
27979
  'commands.select_workspace.x_and_1_owner': '$1 and 1 other owner',
27979
- 'commands.select_workspace.x_and_y_owners': '$1 and $2 other owners',
27980
+ 'commands.select_workspace.x_and_n_owners': '$1 and $2 other owners',
27981
+ 'commands.select_workspace.disabled': 'This working copy can not be selected due to missing user permissions.',
27980
27982
 
27981
27983
  'commands.choose_and_create_widget.title': 'Insert widget',
27982
27984
  'commands.choose_and_create_widget.disabled': 'You cannot insert any widgets here.',
@@ -29491,75 +29493,100 @@ var scrivito = {};
29491
29493
  });
29492
29494
  }());
29493
29495
  (function() {
29496
+ var render, current_page;
29497
+
29494
29498
  _.extend(scrivito, {
29495
29499
  menu_bar_conflict_indicator: {
29496
29500
  init: function() {
29497
29501
  scrivito.menu_bar.register_item_renderer(function(menu_bar) {
29498
- var conflict_warning = $(scrivito.template.render('menu_bar_conflict_indicator'))
29499
- .appendTo(menu_bar.find('#scrivito_menu_bar_conflict_indicator'));
29500
-
29501
- var render_icon_and_menu = function(icon_color, menu_commands) {
29502
- conflict_warning.show();
29503
- conflict_warning.find('.scrivito_icon').addClass('scrivito_' + icon_color);
29504
- conflict_warning.on('click', function() {
29505
- scrivito.static_menus.toggle(conflict_warning, menu_commands);
29506
- });
29502
+ render = function(color, commands) {
29503
+ var target = $(scrivito.template.render('menu_bar_conflict_indicator'))
29504
+ .appendTo(menu_bar.find('#scrivito_menu_bar_conflict_indicator'));
29505
+ target.show();
29506
+ target.find('.scrivito_icon').addClass('scrivito_'+color);
29507
+ target.on('click', function() { scrivito.static_menus.toggle(target, commands); });
29507
29508
  };
29508
29509
 
29509
- var current_page = scrivito.application_document().page();
29510
+ current_page = scrivito.application_document().page();
29510
29511
  if (current_page) {
29511
- if (current_page.has_conflict()) {
29512
- var conflict_commands = [{
29513
- id: function() { return 'scrivito.menu_bar_conflict_indicator.header'; },
29514
- render: function() {
29515
- return scrivito.template.render('menu_bar_conflict_indicator/conflict');
29516
- }
29517
- }];
29518
- render_icon_and_menu('red', conflict_commands);
29519
- } else {
29520
- if (scrivito.in_editable_view()) {
29521
- current_page.is_outdated().done(function(result) {
29522
- if (!!result) {
29523
- var outdated_commands = [{
29524
- id: function() { return 'scrivito.menu_bar_conflict_indicator.header'; },
29525
- render: function() {
29526
- return scrivito.template.render('menu_bar_conflict_indicator/warn', {
29527
- headline_color: 'red',
29528
- headline: scrivito.t('menu_bar_conflict_indicator.outdated_headline'),
29529
- description: scrivito.t('menu_bar_conflict_indicator.outdated_description')
29530
- });
29531
- }
29532
- }].concat([
29533
- scrivito.rebase_workspace_command(scrivito.editing_context.selected_workspace)
29534
- ]);
29535
- render_icon_and_menu('red', outdated_commands);
29536
- } else {
29537
- current_page.conflicting_workspaces().done(function(workspaces) {
29538
- if (workspaces.length) {
29539
- var warn_commands = [{
29540
- id: function() { return 'scrivito.menu_bar_conflict_indicator.header'; },
29541
- render: function() {
29542
- return scrivito.template.render('menu_bar_conflict_indicator/warn', {
29543
- headline_color: 'yellow',
29544
- headline: scrivito.t('menu_bar_conflict_indicator.warn_headline'),
29545
- description: scrivito.t('menu_bar_conflict_indicator.warn_description')
29546
- });
29547
- }
29548
- }].concat(_.map(workspaces, function(ws) {
29549
- return scrivito.select_workspace_command(ws);
29550
- }));
29551
- render_icon_and_menu('yellow', warn_commands);
29552
- }
29553
- });
29554
- }
29555
- });
29556
- }
29557
- }
29512
+ check_conflict(function() {
29513
+ check_uptodate(function() {
29514
+ check_potential_conflicts();
29515
+ });
29516
+ });
29558
29517
  }
29559
29518
  });
29560
29519
  }
29561
29520
  }
29562
29521
  });
29522
+
29523
+ var check_conflict = function(next) {
29524
+ if (current_page.has_conflict()) {
29525
+ render_conflict();
29526
+ } else {
29527
+ next();
29528
+ }
29529
+ };
29530
+
29531
+ var check_uptodate = function(next) {
29532
+ if (scrivito.in_editable_view()) {
29533
+ current_page.is_outdated().done(function(is_outdated) {
29534
+ if (is_outdated) {
29535
+ render_outdated();
29536
+ } else {
29537
+ next();
29538
+ }
29539
+ });
29540
+ }
29541
+ };
29542
+
29543
+ var check_potential_conflicts = function() {
29544
+ current_page.conflicting_workspaces().done(function(workspaces) {
29545
+ if (workspaces.length) {
29546
+ render_potential_conflicts(workspaces);
29547
+ }
29548
+ });
29549
+ };
29550
+
29551
+ var render_conflict = function() {
29552
+ render('red', [{
29553
+ id: function() { return 'scrivito.menu_bar_conflict_indicator.header'; },
29554
+ render: function() {
29555
+ return scrivito.template.render('menu_bar_conflict_indicator/conflict');
29556
+ }
29557
+ }]);
29558
+ };
29559
+
29560
+ var render_outdated = function() {
29561
+ render('red', [
29562
+ {
29563
+ id: function() { return 'scrivito.menu_bar_conflict_indicator.header'; },
29564
+ render: function() {
29565
+ return scrivito.template.render('menu_bar_conflict_indicator/warn', {
29566
+ headline_color: 'red',
29567
+ headline: scrivito.t('menu_bar_conflict_indicator.outdated_headline'),
29568
+ description: scrivito.t('menu_bar_conflict_indicator.outdated_description')
29569
+ });
29570
+ }
29571
+ },
29572
+ scrivito.rebase_workspace_command(scrivito.editing_context.selected_workspace)
29573
+ ]);
29574
+ };
29575
+
29576
+ var render_potential_conflicts = function(workspaces) {
29577
+ render('yellow', [{
29578
+ id: function() { return 'scrivito.menu_bar_conflict_indicator.header'; },
29579
+ render: function() {
29580
+ return scrivito.template.render('menu_bar_conflict_indicator/warn', {
29581
+ headline_color: 'yellow',
29582
+ headline: scrivito.t('menu_bar_conflict_indicator.warn_headline'),
29583
+ description: scrivito.t('menu_bar_conflict_indicator.warn_description')
29584
+ });
29585
+ }
29586
+ }].concat(_.map(workspaces, function(ws) {
29587
+ return scrivito.select_workspace_command(ws);
29588
+ })));
29589
+ };
29563
29590
  }());
29564
29591
  (function() {
29565
29592
  _.extend(scrivito, {
@@ -31141,6 +31168,10 @@ var scrivito = {};
31141
31168
  var that = {
31142
31169
  id: function() {
31143
31170
  return params.id;
31171
+ },
31172
+
31173
+ description: function() {
31174
+ return params.description;
31144
31175
  }
31145
31176
  };
31146
31177
 
@@ -31566,6 +31597,19 @@ var scrivito = {};
31566
31597
  var promise = $.Deferred();
31567
31598
  return size === 0 ? promise.reject() : promise.resolve();
31568
31599
  });
31600
+ },
31601
+
31602
+ owners: function() {
31603
+ return _.map(_.where(that.memberships(), {role: 'owner'}), function(membership) {
31604
+ return scrivito.user.create_instance({
31605
+ id: membership.user_id,
31606
+ description: membership.description
31607
+ });
31608
+ });
31609
+ },
31610
+
31611
+ is_accessible: function() {
31612
+ return data.id === 'published' || data.is_accessible;
31569
31613
  }
31570
31614
  };
31571
31615
 
@@ -33509,39 +33553,35 @@ var scrivito = {};
33509
33553
  icon: workspace.icon(),
33510
33554
  subtitle: subtitle(workspace),
33511
33555
 
33556
+ disabled: function() {
33557
+ if (!workspace.is_accessible()) {
33558
+ return scrivito.t('commands.select_workspace.disabled');
33559
+ }
33560
+ },
33561
+
33512
33562
  execute: function() {
33513
- var promise = scrivito.change_editing_context({workspace_id: workspace.id()});
33514
- scrivito.with_saving_overlay(promise);
33563
+ scrivito.with_saving_overlay(
33564
+ scrivito.change_editing_context({workspace_id: workspace.id()}));
33515
33565
  }
33516
33566
  });
33517
33567
  }
33518
33568
  });
33519
33569
 
33520
33570
  var subtitle = function(workspace) {
33521
- var owner_names = workspace_owner_names(workspace);
33522
- var first_owner = _.first(owner_names);
33523
-
33524
- switch (owner_names.length) {
33571
+ var owners = workspace.owners();
33572
+ var owner = owners[0];
33573
+ switch (owners.length) {
33525
33574
  case 0:
33526
33575
  return undefined;
33527
33576
  case 1:
33528
- return first_owner;
33577
+ return owner.description();
33529
33578
  case 2:
33530
- return scrivito.t('commands.select_workspace.x_and_1_owner', first_owner);
33579
+ return scrivito.t('commands.select_workspace.x_and_1_owner', owner.description());
33531
33580
  default:
33532
- var others = owner_names.length - 1;
33533
- return scrivito.t('commands.select_workspace.x_and_y_owners', first_owner, others);
33581
+ return scrivito.t('commands.select_workspace.x_and_n_owners', owner.description(),
33582
+ owners.length - 1);
33534
33583
  }
33535
33584
  };
33536
-
33537
- var workspace_owner_names = function(workspace) {
33538
- var owners = _.select(workspace.memberships(), function(user) {
33539
- return user.role === 'owner';
33540
- });
33541
- return _.map(owners, function(owner) {
33542
- return owner.description;
33543
- });
33544
- };
33545
33585
  }());
33546
33586
  (function() {
33547
33587
  _.extend(scrivito, {