scrivito_sdk 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/scrivito/objs_controller.rb +0 -27
- data/app/helpers/scrivito/cms_tag_helper.rb +1 -5
- data/app/views/scrivito/default_cms/show_widget.html.erb +1 -1
- data/app/views/scrivito/objs/copy_widget.html.erb +1 -1
- data/app/views/scrivito/objs/create_widget.html.erb +1 -1
- data/config/ca-bundle.crt +1 -1
- data/lib/assets/javascripts/scrivito_editing.js +173 -48
- data/lib/assets/stylesheets/scrivito.css +10 -1
- data/lib/assets/stylesheets/scrivito_editing.css +133 -7
- data/lib/generators/cms/widget/templates/details.html.erb +2 -0
- data/lib/generators/cms/widget/templates/migration.erb +15 -0
- data/lib/generators/cms/widget/templates/model.erb +2 -0
- data/lib/generators/cms/widget/templates/show.html.erb +2 -0
- data/lib/generators/cms/widget/templates/thumbnail.html.erb +2 -0
- data/lib/generators/cms/widget/widget_generator.rb +30 -0
- data/lib/scrivito/basic_obj.rb +5 -21
- data/lib/scrivito/basic_widget.rb +25 -4
- data/lib/scrivito/cms_accessible.rb +1 -1
- data/lib/scrivito/content_state_caching.rb +2 -2
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abac40ae69e81dc3a8ecf001f3a66513a901b015
|
4
|
+
data.tar.gz: 41b484f12f8c90c59f2a7a0c36c7926f2545a07b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa5bf142baaf78af044daf72e8ee08f7787ca994ba6aed1ca9047cbe9790ea39c6240f3d3efe3f61b59921d830134630aeb0b55a98e6255b61c40bc1a3897c20
|
7
|
+
data.tar.gz: c5e24dae5899d8b36f4e2c761aac54ffd46cefea2518bf8263c5161e6a34ea36b37e78fc16a29be0546a4aeed22698c0109a7f93454d1b6767b3a98425f6cda3
|
@@ -92,33 +92,6 @@ module Scrivito
|
|
92
92
|
render json: widgets_classes
|
93
93
|
end
|
94
94
|
|
95
|
-
def create_widget
|
96
|
-
load_object
|
97
|
-
widget_pool_id = BasicObj.generate_widget_pool_id
|
98
|
-
|
99
|
-
task_unaware_request(:put, "workspaces/#{Workspace.current.id}/objs/#{params[:id]}",
|
100
|
-
{obj: {_widget_pool: {widget_pool_id => {_obj_class: params[:obj_class]}}}})
|
101
|
-
|
102
|
-
Workspace.reload
|
103
|
-
@obj.reload
|
104
|
-
|
105
|
-
@widget = @obj.widget_from_pool(widget_pool_id)
|
106
|
-
|
107
|
-
render json: {markup: render_to_string(layout: false)}
|
108
|
-
end
|
109
|
-
|
110
|
-
def copy_widget
|
111
|
-
load_object
|
112
|
-
new_widget_id = @obj.copy_widget_from(params[:src_obj_id], params[:src_widget_id])
|
113
|
-
|
114
|
-
Workspace.reload
|
115
|
-
@obj.reload
|
116
|
-
|
117
|
-
@widget = @obj.widget_from_pool(new_widget_id)
|
118
|
-
|
119
|
-
render json: {markup: render_to_string(layout: false)}
|
120
|
-
end
|
121
|
-
|
122
95
|
def search
|
123
96
|
in_selected_workspace do
|
124
97
|
query = MultiJson.decode(params[:query]).with_indifferent_access
|
@@ -188,11 +188,7 @@ module Scrivito
|
|
188
188
|
content_tag(tag_name, inner_html, options)
|
189
189
|
end
|
190
190
|
|
191
|
-
def render_widget(widget,
|
192
|
-
container_modification = nil,
|
193
|
-
obj = @obj,
|
194
|
-
field_name = widget.container_field_name,
|
195
|
-
container = widget.container)
|
191
|
+
def render_widget(widget, container_modification = nil)
|
196
192
|
options = {}
|
197
193
|
|
198
194
|
if inplace_editing_allowed?
|
@@ -1 +1 @@
|
|
1
|
-
<%= render_widget(widget
|
1
|
+
<%= render_widget(widget) %>
|
@@ -1 +1 @@
|
|
1
|
-
<%= render_widget(@widget
|
1
|
+
<%= render_widget(@widget) %>
|
@@ -1 +1 @@
|
|
1
|
-
<%= render_widget(@widget
|
1
|
+
<%= render_widget(@widget) %>
|
data/config/ca-bundle.crt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##
|
2
2
|
## /mnt/dcc/Scrival_SDK__Kris__117/repos/scrivito/config/ca-bundle.crt -- Bundle of CA Root Certificates
|
3
3
|
##
|
4
|
-
## Converted at:
|
4
|
+
## Converted at: Wed May 28 09:37:50 2014 UTC
|
5
5
|
##
|
6
6
|
## This is a bundle of X.509 certificates of public Certificate Authorities
|
7
7
|
## (CA). These were automatically extracted from Mozilla's root certificates
|
@@ -9759,8 +9759,18 @@ function program7(depth0,data) {
|
|
9759
9759
|
this.ScrivitoHandlebarsTemplates["inplace_menu_marker"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
9760
9760
|
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
|
9761
9761
|
helpers = helpers || Handlebars.helpers; data = data || {};
|
9762
|
-
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
|
9762
|
+
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
|
9763
9763
|
|
9764
|
+
function program1(depth0,data) {
|
9765
|
+
|
9766
|
+
var buffer = "", stack1;
|
9767
|
+
buffer += "\n <span class=\"scrivito_editing_marker_title\">";
|
9768
|
+
if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9769
|
+
else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9770
|
+
buffer += escapeExpression(stack1)
|
9771
|
+
+ "</span>\n ";
|
9772
|
+
return buffer;
|
9773
|
+
}
|
9764
9774
|
|
9765
9775
|
buffer += "<span class=\"scrivito_editing_marker ";
|
9766
9776
|
if (stack1 = helpers.css_classes) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
@@ -9771,14 +9781,17 @@ helpers = helpers || Handlebars.helpers; data = data || {};
|
|
9771
9781
|
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9772
9782
|
buffer += escapeExpression(stack1)
|
9773
9783
|
+ "\" title=\"";
|
9774
|
-
if (stack1 = helpers.
|
9775
|
-
else { stack1 = depth0.
|
9784
|
+
if (stack1 = helpers.tooltip) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9785
|
+
else { stack1 = depth0.tooltip; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9776
9786
|
buffer += escapeExpression(stack1)
|
9777
9787
|
+ "\">\n <i class=\"scrivito_icon\">";
|
9778
9788
|
if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9779
9789
|
else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9780
9790
|
buffer += escapeExpression(stack1)
|
9781
|
-
+ "</i>\n
|
9791
|
+
+ "</i>\n ";
|
9792
|
+
stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
9793
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
9794
|
+
buffer += "\n</span>\n";
|
9782
9795
|
return buffer;
|
9783
9796
|
});
|
9784
9797
|
return this.ScrivitoHandlebarsTemplates["inplace_menu_marker"];
|
@@ -10279,6 +10292,8 @@ $.i18n().load({
|
|
10279
10292
|
'widget_menus.widget_is_dragged_here': 'Widget wurde hierher gezogen',
|
10280
10293
|
'widget_menus.widget_is_dragged_away': 'Widget wurde von hier weggezogen',
|
10281
10294
|
|
10295
|
+
'child_list_menu.description': 'Elemente von $1',
|
10296
|
+
|
10282
10297
|
'changes_list.menu_item': 'Änderungen von "$1"',
|
10283
10298
|
'changes_list.title': 'Änderungen von "$1"',
|
10284
10299
|
'changes_list.empty_result': 'In dieser Arbeitskopie wurde nichts geändert.',
|
@@ -10426,6 +10441,8 @@ $.i18n().load({
|
|
10426
10441
|
'widget_menus.widget_is_dragged_here': 'Widget has been dragged here',
|
10427
10442
|
'widget_menus.widget_is_dragged_away': 'Widget has been dragged away from here',
|
10428
10443
|
|
10444
|
+
'child_list_menu.description': 'Items of $1',
|
10445
|
+
|
10429
10446
|
'changes_list.menu_item': 'Changes to "$1"',
|
10430
10447
|
'changes_list.title': 'Changes to "$1"',
|
10431
10448
|
'changes_list.empty_result': 'Nothing was changed in this working copy.',
|
@@ -10551,6 +10568,10 @@ var scrivito = {};
|
|
10551
10568
|
});
|
10552
10569
|
},
|
10553
10570
|
|
10571
|
+
run_new_event: function(method) {
|
10572
|
+
scrivito.wait(0).done(method);
|
10573
|
+
},
|
10574
|
+
|
10554
10575
|
// For testing purpose only.
|
10555
10576
|
reload_location: function() {
|
10556
10577
|
window.location.reload();
|
@@ -11007,6 +11028,8 @@ var scrivito = {};
|
|
11007
11028
|
ajax: function(type, path, options) {
|
11008
11029
|
var is_write_request = type === 'PUT' || type === 'POST' || type === 'DELETE';
|
11009
11030
|
if (is_write_request) {
|
11031
|
+
options = options || {};
|
11032
|
+
options.timeout = 15000; // miliseconds
|
11010
11033
|
scrivito.write_monitor.start_write();
|
11011
11034
|
}
|
11012
11035
|
|
@@ -11125,13 +11148,52 @@ var scrivito = {};
|
|
11125
11148
|
},
|
11126
11149
|
|
11127
11150
|
start_write: function() {
|
11128
|
-
|
11151
|
+
if (!scrivito.write_monitor.is_writing()) {
|
11152
|
+
run_callbacks('start_write');
|
11153
|
+
}
|
11129
11154
|
counter += 1;
|
11130
11155
|
},
|
11131
11156
|
|
11132
11157
|
end_write: function() {
|
11133
11158
|
counter -= 1;
|
11134
|
-
|
11159
|
+
if (!scrivito.write_monitor.is_writing()) {
|
11160
|
+
scrivito.run_new_event(function() {
|
11161
|
+
if (!scrivito.write_monitor.is_writing()) {
|
11162
|
+
run_callbacks('end_write');
|
11163
|
+
}
|
11164
|
+
});
|
11165
|
+
}
|
11166
|
+
},
|
11167
|
+
|
11168
|
+
track_changes: function(fn, on_change_callback) {
|
11169
|
+
var has_changes = false;
|
11170
|
+
var changes_finished = false;
|
11171
|
+
|
11172
|
+
var start_token = scrivito.write_monitor.on('start_write', function() {
|
11173
|
+
has_changes = true;
|
11174
|
+
changes_finished = false;
|
11175
|
+
});
|
11176
|
+
var end_token = scrivito.write_monitor.on('end_write', function() {
|
11177
|
+
changes_finished = true;
|
11178
|
+
});
|
11179
|
+
|
11180
|
+
return fn().done(function() {
|
11181
|
+
scrivito.write_monitor.off(start_token);
|
11182
|
+
scrivito.write_monitor.off(end_token);
|
11183
|
+
if (has_changes) {
|
11184
|
+
if (changes_finished) {
|
11185
|
+
on_change_callback();
|
11186
|
+
} else {
|
11187
|
+
var saving_promise = $.Deferred();
|
11188
|
+
var final_end_token = scrivito.write_monitor.on('end_write', function() {
|
11189
|
+
scrivito.write_monitor.off(final_end_token);
|
11190
|
+
saving_promise.resolve();
|
11191
|
+
on_change_callback();
|
11192
|
+
});
|
11193
|
+
scrivito.with_saving_overlay(saving_promise);
|
11194
|
+
}
|
11195
|
+
}
|
11196
|
+
});
|
11135
11197
|
},
|
11136
11198
|
|
11137
11199
|
// For test purpose only.
|
@@ -11885,12 +11947,19 @@ $(function() {
|
|
11885
11947
|
}
|
11886
11948
|
}
|
11887
11949
|
|
11888
|
-
var
|
11889
|
-
|
11950
|
+
var request_promise = $.Deferred();
|
11951
|
+
|
11952
|
+
var to_be_saved = to_be_saved_data() || {};
|
11953
|
+
to_be_saved.value = content;
|
11954
|
+
to_be_saved.promises = to_be_saved.promises || [];
|
11955
|
+
to_be_saved.promises.push(request_promise);
|
11956
|
+
to_be_saved_data(to_be_saved);
|
11890
11957
|
|
11891
|
-
|
11892
|
-
|
11893
|
-
|
11958
|
+
if (!currently_saving()) {
|
11959
|
+
next_save_request();
|
11960
|
+
}
|
11961
|
+
|
11962
|
+
return request_promise.then(function(model_data) {
|
11894
11963
|
return model_data[that.field_name()];
|
11895
11964
|
});
|
11896
11965
|
},
|
@@ -11920,6 +11989,63 @@ $(function() {
|
|
11920
11989
|
}
|
11921
11990
|
};
|
11922
11991
|
|
11992
|
+
var next_save_request = function() {
|
11993
|
+
currently_saving(true);
|
11994
|
+
var to_be_saved = to_be_saved_data();
|
11995
|
+
remove_to_be_saved();
|
11996
|
+
|
11997
|
+
var changes = {};
|
11998
|
+
changes[that.field_name()] = to_be_saved.value;
|
11999
|
+
|
12000
|
+
var widget = that.widget();
|
12001
|
+
var save_promise = widget ? widget.save(changes) : that.obj().save(changes);
|
12002
|
+
|
12003
|
+
save_promise.done(function(result) {
|
12004
|
+
_.each(to_be_saved.promises, function(succeeding_promise) {
|
12005
|
+
succeeding_promise.resolve(result);
|
12006
|
+
});
|
12007
|
+
|
12008
|
+
if (to_be_saved_data()) {
|
12009
|
+
next_save_request();
|
12010
|
+
} else {
|
12011
|
+
remove_currently_saving();
|
12012
|
+
}
|
12013
|
+
}).fail(function(error_message) {
|
12014
|
+
var new_promises = (to_be_saved_data() || {}).promises;
|
12015
|
+
var failing_promises = to_be_saved.promises.concat(new_promises || []);
|
12016
|
+
_.each(failing_promises, function(failing_promise) {
|
12017
|
+
failing_promise.reject(error_message);
|
12018
|
+
});
|
12019
|
+
|
12020
|
+
remove_to_be_saved();
|
12021
|
+
remove_currently_saving();
|
12022
|
+
});
|
12023
|
+
};
|
12024
|
+
|
12025
|
+
var to_be_saved_data = function(new_to_be_saved) {
|
12026
|
+
if (new_to_be_saved) {
|
12027
|
+
return that.dom_element().data('scrivito-to-be-saved', new_to_be_saved);
|
12028
|
+
} else {
|
12029
|
+
return that.dom_element().data('scrivito-to-be-saved');
|
12030
|
+
}
|
12031
|
+
};
|
12032
|
+
|
12033
|
+
var remove_to_be_saved = function() {
|
12034
|
+
that.dom_element().removeData('scrivito-to-be-saved');
|
12035
|
+
};
|
12036
|
+
|
12037
|
+
var currently_saving = function(new_currently_saving) {
|
12038
|
+
if (new_currently_saving) {
|
12039
|
+
return that.dom_element().data('scrivito-currently-saving', new_currently_saving);
|
12040
|
+
} else {
|
12041
|
+
return that.dom_element().data('scrivito-currently-saving');
|
12042
|
+
}
|
12043
|
+
};
|
12044
|
+
|
12045
|
+
var remove_currently_saving = function() {
|
12046
|
+
that.dom_element().removeData('scrivito-currently-saving');
|
12047
|
+
};
|
12048
|
+
|
11923
12049
|
return that;
|
11924
12050
|
}
|
11925
12051
|
}
|
@@ -12102,19 +12228,13 @@ $(function() {
|
|
12102
12228
|
var url = 'objs/'+that.id()+'/copy';
|
12103
12229
|
|
12104
12230
|
return scrivito.ajax('POST', url, post_attr).then(function(new_data) {
|
12105
|
-
return scrivito.obj.
|
12106
|
-
id: new_data.id,
|
12107
|
-
obj_class_name: new_data._obj_class
|
12108
|
-
});
|
12231
|
+
return scrivito.obj.create_instance_from_server_data(new_data);
|
12109
12232
|
});
|
12110
12233
|
},
|
12111
12234
|
|
12112
12235
|
duplicate: function() {
|
12113
12236
|
return scrivito.ajax('POST', 'objs/'+that.id()+'/duplicate').then(function(new_data) {
|
12114
|
-
return scrivito.obj.
|
12115
|
-
id: new_data.id,
|
12116
|
-
obj_class_name: new_data._obj_class
|
12117
|
-
});
|
12237
|
+
return scrivito.obj.create_instance_from_server_data(new_data);
|
12118
12238
|
});
|
12119
12239
|
}
|
12120
12240
|
};
|
@@ -12140,13 +12260,17 @@ $(function() {
|
|
12140
12260
|
return that;
|
12141
12261
|
},
|
12142
12262
|
|
12263
|
+
create_instance_from_server_data: function(create_params) {
|
12264
|
+
return scrivito.obj.create_instance({
|
12265
|
+
id: (create_params.id || create_params._id),
|
12266
|
+
obj_class_name: create_params._obj_class
|
12267
|
+
});
|
12268
|
+
},
|
12269
|
+
|
12143
12270
|
create: function(data) {
|
12144
12271
|
return prepare_attributes(data).then(function(attributes) {
|
12145
12272
|
return scrivito.ajax('POST', 'objs', {data: {obj: attributes}}).then(function(new_data) {
|
12146
|
-
return scrivito.obj.
|
12147
|
-
id: new_data.id,
|
12148
|
-
obj_class_name: new_data._obj_class
|
12149
|
-
});
|
12273
|
+
return scrivito.obj.create_instance_from_server_data(new_data);
|
12150
12274
|
});
|
12151
12275
|
});
|
12152
12276
|
}
|
@@ -13357,6 +13481,10 @@ $(function() {
|
|
13357
13481
|
$(dom_element).attr('data-scrivito-private-menu-description', description);
|
13358
13482
|
},
|
13359
13483
|
|
13484
|
+
set_tooltip: function(dom_element, tooltip) {
|
13485
|
+
$(dom_element).attr('data-scrivito-private-menu-tooltip', tooltip);
|
13486
|
+
},
|
13487
|
+
|
13360
13488
|
set_css_classes: function(dom_element, css_classes) {
|
13361
13489
|
$(dom_element).attr('data-scrivito-private-menu-css-classes', css_classes);
|
13362
13490
|
}
|
@@ -13381,6 +13509,7 @@ $(function() {
|
|
13381
13509
|
|
13382
13510
|
var icon = dom_element.attr('data-scrivito-private-menu-icon') || '\uf000';
|
13383
13511
|
var description = dom_element.attr('data-scrivito-private-menu-description');
|
13512
|
+
var tooltip = dom_element.attr('data-scrivito-private-menu-tooltip');
|
13384
13513
|
var css_classes = dom_element.attr('data-scrivito-private-menu-css-classes');
|
13385
13514
|
var commands = dom_element.data('scrivito-private-menu-commands');
|
13386
13515
|
|
@@ -13388,6 +13517,7 @@ $(function() {
|
|
13388
13517
|
id: marker_id,
|
13389
13518
|
icon: icon,
|
13390
13519
|
description: description,
|
13520
|
+
tooltip: tooltip,
|
13391
13521
|
css_classes: css_classes
|
13392
13522
|
}));
|
13393
13523
|
|
@@ -13776,20 +13906,15 @@ $(window).on('load', function() {
|
|
13776
13906
|
},
|
13777
13907
|
|
13778
13908
|
execute: function() {
|
13779
|
-
var has_changes = false;
|
13780
|
-
var token = scrivito.write_monitor.on('start_write', function() {
|
13781
|
-
has_changes = true;
|
13782
|
-
});
|
13783
|
-
|
13784
13909
|
var title = scrivito.i18n.translate('current_page');
|
13785
13910
|
var fetch_markup = function() {
|
13786
13911
|
return obj.fetch_details_markup();
|
13787
13912
|
};
|
13788
|
-
|
13789
|
-
|
13790
|
-
|
13791
|
-
|
13792
|
-
|
13913
|
+
|
13914
|
+
return scrivito.write_monitor.track_changes(function() {
|
13915
|
+
return scrivito.details_dialog.open(title, fetch_markup, '');
|
13916
|
+
}, function() {
|
13917
|
+
return scrivito.with_saving_overlay(scrivito.reload());
|
13793
13918
|
});
|
13794
13919
|
}
|
13795
13920
|
});
|
@@ -13961,21 +14086,15 @@ $(window).on('load', function() {
|
|
13961
14086
|
},
|
13962
14087
|
|
13963
14088
|
execute: function() {
|
13964
|
-
var has_changes = false;
|
13965
|
-
var token = scrivito.write_monitor.on('start_write', function() {
|
13966
|
-
has_changes = true;
|
13967
|
-
});
|
13968
|
-
|
13969
14089
|
var dialog_title = widget_element.widget().widget_class_name();
|
13970
14090
|
var fetch_markup = function() {
|
13971
14091
|
return widget_element.fetch_details_markup();
|
13972
14092
|
};
|
13973
14093
|
|
13974
|
-
return scrivito.
|
13975
|
-
scrivito.
|
13976
|
-
|
13977
|
-
|
13978
|
-
}
|
14094
|
+
return scrivito.write_monitor.track_changes(function() {
|
14095
|
+
return scrivito.details_dialog.open(dialog_title, fetch_markup);
|
14096
|
+
}, function() {
|
14097
|
+
widget_element.dom_element().trigger('scrivito_reload');
|
13979
14098
|
});
|
13980
14099
|
}
|
13981
14100
|
});
|
@@ -14009,12 +14128,15 @@ $(window).on('load', function() {
|
|
14009
14128
|
menu.add_item(widget_dom_element, command);
|
14010
14129
|
});
|
14011
14130
|
|
14131
|
+
var description = widget_element.widget().widget_class_name();
|
14132
|
+
menu.set_description(widget_dom_element, description);
|
14133
|
+
|
14012
14134
|
if (widget_element.has_details_view() &&
|
14013
14135
|
scrivito.editing_context.is_comparing_mode()) {
|
14014
14136
|
var options = menu_options(widget_element);
|
14015
14137
|
if (options) {
|
14016
|
-
var
|
14017
|
-
menu.
|
14138
|
+
var tooltip = scrivito.i18n.translate('widget_menus.' + options.key);
|
14139
|
+
menu.set_tooltip(widget_dom_element, tooltip);
|
14018
14140
|
menu.set_icon(widget_dom_element, options.icon);
|
14019
14141
|
menu.set_css_classes(widget_dom_element, options.css_class);
|
14020
14142
|
}
|
@@ -14235,6 +14357,9 @@ $(window).on('load', function() {
|
|
14235
14357
|
scrivito.editing_context.is_editing_mode()) {
|
14236
14358
|
_.each(scrivito.child_list_element.all(), function(child_list_element) {
|
14237
14359
|
var dom_element = child_list_element.dom_element();
|
14360
|
+
var description = child_list_element.obj().description_for_editor();
|
14361
|
+
menu.set_description(dom_element,
|
14362
|
+
scrivito.i18n.translate('child_list_menu.description', description));
|
14238
14363
|
_.each([
|
14239
14364
|
scrivito.add_subpage_command(child_list_element),
|
14240
14365
|
scrivito.copy_page_from_clipboard_command(child_list_element),
|
@@ -14319,12 +14444,12 @@ $(window).on('load', function() {
|
|
14319
14444
|
return scrivito.create_obj({blob: file, _path: path, _obj_class: 'Image'});
|
14320
14445
|
};
|
14321
14446
|
|
14322
|
-
scrivito.with_saving_overlay(create_image(file).then(function(
|
14447
|
+
scrivito.with_saving_overlay(create_image(file).then(function(obj) {
|
14323
14448
|
var field_value;
|
14324
14449
|
if (field_type === 'reference') {
|
14325
|
-
field_value =
|
14450
|
+
field_value = obj.id;
|
14326
14451
|
} else if (field_type === 'linklist') {
|
14327
|
-
field_value = [{obj_id:
|
14452
|
+
field_value = [{obj_id: obj.id}];
|
14328
14453
|
} else {
|
14329
14454
|
$.error('Field type must be "reference" or "linklist".');
|
14330
14455
|
}
|
@@ -155,8 +155,14 @@ body.scrivito_widget_dragging_active[data-scrivito-display-mode="editing"] *[dat
|
|
155
155
|
.scrivito_editing_marker:hover,
|
156
156
|
.scrivito_editing_marker:active { background: #439439; background: rgba(67, 148, 57, 1); }
|
157
157
|
|
158
|
+
[data-scrivito-display-mode="editing"] [data-scrivito-private-child-list-path]:hover .scrivito_editing_marker,
|
159
|
+
[data-scrivito-display-mode="editing"] [data-scrivito-widget-obj-class]:hover .scrivito_editing_marker {
|
160
|
+
background: #439439; background: rgba(67, 148, 57, 1);
|
161
|
+
}
|
162
|
+
|
158
163
|
/* scrivito_editing_marker edited/new/deleted colors */
|
159
164
|
[data-scrivito-private-widget-modification="edited"] .scrivito_editing_marker,
|
165
|
+
[data-scrivito-private-widget-modification="edited"] .scrivito_editing_marker .scrivito_editing_marker_title,
|
160
166
|
[data-scrivito-field-modification="edited"] .scrivito_editing_marker,
|
161
167
|
[data-scrivito-private-widget-modification="edited"][data-scrivito-private-widget-container-modification="new"] .scrivito_editing_marker,
|
162
168
|
[data-scrivito-private-widget-modification="edited"][data-scrivito-private-widget-container-modification="deleted"] .scrivito_editing_marker {
|
@@ -164,17 +170,20 @@ body.scrivito_widget_dragging_active[data-scrivito-display-mode="editing"] *[dat
|
|
164
170
|
}
|
165
171
|
|
166
172
|
[data-scrivito-private-widget-modification="new"] .scrivito_editing_marker,
|
173
|
+
[data-scrivito-private-widget-modification="new"] .scrivito_editing_marker .scrivito_editing_marker_title,
|
167
174
|
[data-scrivito-field-modification="new"] .scrivito_editing_marker,
|
168
175
|
[data-scrivito-private-widget-modification="new"][data-scrivito-private-widget-container-modification="new"] .scrivito_editing_marker {
|
169
176
|
background: #4c8c07;
|
170
177
|
}
|
171
178
|
[data-scrivito-private-widget-modification="deleted"] .scrivito_editing_marker,
|
179
|
+
[data-scrivito-private-widget-modification="deleted"] .scrivito_editing_marker .scrivito_editing_marker_title,
|
172
180
|
[data-scrivito-field-modification="deleted"] .scrivito_editing_marker,
|
173
181
|
[data-scrivito-private-widget-modification="deleted"][data-scrivito-private-widget-container-modification="deleted"] .scrivito_editing_marker {
|
174
182
|
background: #ff1f01;
|
175
183
|
}
|
176
184
|
|
177
185
|
/* scrivito_editing_marker colors for unmodified but moved widgets */
|
178
|
-
[data-scrivito-private-widget-container-modification="deleted"] .scrivito_editing_marker
|
186
|
+
:not([data-scrivito-private-widget-modification])[data-scrivito-private-widget-container-modification="deleted"] .scrivito_editing_marker,
|
187
|
+
:not([data-scrivito-private-widget-modification])[data-scrivito-private-widget-container-modification="deleted"] .scrivito_editing_marker .scrivito_editing_marker_title {
|
179
188
|
background: #808080;
|
180
189
|
}
|
@@ -462,6 +462,9 @@ html.scrivito_bottombar_on {
|
|
462
462
|
color: #696969!important;
|
463
463
|
cursor: help;
|
464
464
|
}
|
465
|
+
body.scrivito_editing_active {
|
466
|
+
padding-top: 45px;
|
467
|
+
}
|
465
468
|
.scrivito_topbar * {
|
466
469
|
-webkit-box-sizing: border-box;
|
467
470
|
-moz-box-sizing: border-box;
|
@@ -915,15 +918,12 @@ html.scrivito_bottombar_on {
|
|
915
918
|
color: #fff;
|
916
919
|
font-size: 13px;
|
917
920
|
line-height: 14px;
|
921
|
+
height: 25px;
|
918
922
|
text-align: center;
|
919
923
|
padding: 5px 8px;
|
920
924
|
margin: -2px 0 0 -2px;
|
921
925
|
vertical-align: middle;
|
922
|
-
|
923
|
-
min-height: 14px;
|
924
|
-
background: #111;
|
925
|
-
background: #ffa500;
|
926
|
-
background: rgba(255, 165, 0, 0.5);
|
926
|
+
background: rgba(67, 148, 57, 0.5);
|
927
927
|
z-index: 11111;
|
928
928
|
-webkit-border-radius: 3px;
|
929
929
|
-moz-border-radius: 3px;
|
@@ -941,7 +941,7 @@ html.scrivito_bottombar_on {
|
|
941
941
|
.scrivito_editing_marker:hover,
|
942
942
|
.scrivito_editing_marker:active {
|
943
943
|
cursor: pointer;
|
944
|
-
background: #
|
944
|
+
background: #439439;
|
945
945
|
-webkit-transition: background ease-in-out .2s;
|
946
946
|
-moz-transition: background ease-in-out .2s;
|
947
947
|
-o-transition: background ease-in-out .2s;
|
@@ -951,7 +951,6 @@ html.scrivito_bottombar_on {
|
|
951
951
|
padding: 0;
|
952
952
|
font-size: 12px;
|
953
953
|
line-height: 8px;
|
954
|
-
padding-bottom: 2px;
|
955
954
|
color: #fff;
|
956
955
|
}
|
957
956
|
.scrivito_editing_marker .scrivito_icon:hover {
|
@@ -976,6 +975,94 @@ html.scrivito_bottombar_on {
|
|
976
975
|
.ui-sortable:not(.scrivito_empty_widget_field) .scrivito_editing_marker .scrivito_icon:hover {
|
977
976
|
cursor: move;
|
978
977
|
}
|
978
|
+
.scrivito_editing_marker .scrivito_editing_marker_title {
|
979
|
+
display: block;
|
980
|
+
position: absolute;
|
981
|
+
top: 0;
|
982
|
+
right: 29px;
|
983
|
+
color: #fff;
|
984
|
+
font-size: 11px;
|
985
|
+
line-height: 14px;
|
986
|
+
height: 25px;
|
987
|
+
text-align: center;
|
988
|
+
padding: 5px 10px;
|
989
|
+
margin: 0;
|
990
|
+
white-space: nowrap;
|
991
|
+
background: #439439;
|
992
|
+
opacity: 0;
|
993
|
+
-webkit-border-radius: 3px;
|
994
|
+
-moz-border-radius: 3px;
|
995
|
+
border-radius: 3px;
|
996
|
+
-webkit-transition: opacity ease-in-out .6s;
|
997
|
+
-moz-transition: opacity ease-in-out .6s;
|
998
|
+
-o-transition: opacity ease-in-out .6s;
|
999
|
+
transition: opacity ease-in-out .6s;
|
1000
|
+
}
|
1001
|
+
.scrivito_editing_marker:hover .scrivito_editing_marker_title,
|
1002
|
+
.scrivito_editing_marker:active .scrivito_editing_marker_title {
|
1003
|
+
cursor: pointer;
|
1004
|
+
}
|
1005
|
+
[data-scrivito-display-mode="editing"] [data-scrivito-private-child-list-path]:hover .scrivito_editing_marker .scrivito_editing_marker_title,
|
1006
|
+
[data-scrivito-display-mode="editing"] [data-scrivito-widget-obj-class]:hover .scrivito_editing_marker .scrivito_editing_marker_title,
|
1007
|
+
[data-scrivito-display-mode="diff"] [data-scrivito-widget-obj-class]:hover .scrivito_editing_marker .scrivito_editing_marker_title,
|
1008
|
+
[data-scrivito-display-mode="added"] [data-scrivito-widget-obj-class]:hover .scrivito_editing_marker .scrivito_editing_marker_title,
|
1009
|
+
[data-scrivito-display-mode="deleted"] [data-scrivito-widget-obj-class]:hover .scrivito_editing_marker .scrivito_editing_marker_title {
|
1010
|
+
opacity: 1;
|
1011
|
+
-webkit-transition: opacity ease-in-out .5s;
|
1012
|
+
-moz-transition: opacity ease-in-out .5s;
|
1013
|
+
-o-transition: opacity ease-in-out .5s;
|
1014
|
+
transition: opacity ease-in-out .5s;
|
1015
|
+
}
|
1016
|
+
.scrivito_structure_marker {
|
1017
|
+
display: block;
|
1018
|
+
position: absolute;
|
1019
|
+
color: #fff;
|
1020
|
+
font-size: 13px;
|
1021
|
+
line-height: 14px;
|
1022
|
+
text-align: center;
|
1023
|
+
padding: 0 8px;
|
1024
|
+
margin: -2px 0 0 0;
|
1025
|
+
vertical-align: middle;
|
1026
|
+
min-height: 10px;
|
1027
|
+
background: #111;
|
1028
|
+
background: #ffa500;
|
1029
|
+
background: rgba(255, 165, 0, 0.4);
|
1030
|
+
z-index: 11111;
|
1031
|
+
-webkit-border-radius: 3px;
|
1032
|
+
-moz-border-radius: 3px;
|
1033
|
+
border-radius: 3px;
|
1034
|
+
-webkit-user-select: none;
|
1035
|
+
-moz-user-select: none;
|
1036
|
+
-ms-user-select: none;
|
1037
|
+
-o-user-select: none;
|
1038
|
+
user-select: none;
|
1039
|
+
-webkit-transition: background ease-in-out .6s;
|
1040
|
+
-moz-transition: background ease-in-out .6s;
|
1041
|
+
-o-transition: background ease-in-out .6s;
|
1042
|
+
transition: background ease-in-out .6s;
|
1043
|
+
}
|
1044
|
+
.scrivito_structure_marker:hover,
|
1045
|
+
.scrivito_structure_marker:active {
|
1046
|
+
cursor: pointer;
|
1047
|
+
background: #ffa500;
|
1048
|
+
-webkit-transition: background ease-in-out .2s;
|
1049
|
+
-moz-transition: background ease-in-out .2s;
|
1050
|
+
-o-transition: background ease-in-out .2s;
|
1051
|
+
transition: background ease-in-out .2s;
|
1052
|
+
}
|
1053
|
+
.scrivito_structure_marker .scrivito_icon {
|
1054
|
+
padding: 0;
|
1055
|
+
font-size: 8px;
|
1056
|
+
line-height: 8px;
|
1057
|
+
color: #fff;
|
1058
|
+
}
|
1059
|
+
.scrivito_structure_marker .scrivito_icon:hover {
|
1060
|
+
cursor: pointer;
|
1061
|
+
}
|
1062
|
+
.scrivito_empty_widget_field > .scrivito_structure_marker,
|
1063
|
+
*[data-scrivito-private-widget-id] > .scrivito_structure_marker {
|
1064
|
+
left: 45%;
|
1065
|
+
}
|
979
1066
|
.scrivito_button {
|
980
1067
|
display: inline-block;
|
981
1068
|
color: #555;
|
@@ -1199,6 +1286,45 @@ a.scrivito_button:active {
|
|
1199
1286
|
-o-animation: rotation 4s infinite linear;
|
1200
1287
|
animation: rotation 4s infinite linear;
|
1201
1288
|
}
|
1289
|
+
.scrivito_glowing {
|
1290
|
+
-webkit-animation: glow 4s infinite linear;
|
1291
|
+
-moz-animation: glow 4s infinite linear;
|
1292
|
+
-o-animation: glow 4s infinite linear;
|
1293
|
+
animation: glow 4s infinite linear;
|
1294
|
+
}
|
1295
|
+
@-webkit-keyframes glow {
|
1296
|
+
0% {
|
1297
|
+
box-shadow: 0 0 2px 2px rgba(255, 165, 0, 0.2);
|
1298
|
+
}
|
1299
|
+
50% {
|
1300
|
+
box-shadow: 0 0 2px 4px #ffa500;
|
1301
|
+
}
|
1302
|
+
100% {
|
1303
|
+
box-shadow: 0 0 2px 2px rgba(255, 165, 0, 0.2);
|
1304
|
+
}
|
1305
|
+
}
|
1306
|
+
@-moz-keyframes glow {
|
1307
|
+
0% {
|
1308
|
+
box-shadow: 0 0 2px 2px rgba(255, 165, 0, 0.2);
|
1309
|
+
}
|
1310
|
+
50% {
|
1311
|
+
box-shadow: 0 0 2px 4px #ffa500;
|
1312
|
+
}
|
1313
|
+
100% {
|
1314
|
+
box-shadow: 0 0 2px 2px rgba(255, 165, 0, 0.2);
|
1315
|
+
}
|
1316
|
+
}
|
1317
|
+
@keyframes glow {
|
1318
|
+
0% {
|
1319
|
+
box-shadow: 0 0 2px 2px rgba(255, 165, 0, 0.2);
|
1320
|
+
}
|
1321
|
+
50% {
|
1322
|
+
box-shadow: 0 0 2px 4px #ffa500;
|
1323
|
+
}
|
1324
|
+
100% {
|
1325
|
+
box-shadow: 0 0 2px 2px rgba(255, 165, 0, 0.2);
|
1326
|
+
}
|
1327
|
+
}
|
1202
1328
|
.scrivito_modal_prompt .scrivito_modal_body form {
|
1203
1329
|
margin: 0;
|
1204
1330
|
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Create<%= class_name %> < ::Scrivito::Migration
|
2
|
+
def up
|
3
|
+
create_obj_class(
|
4
|
+
name: '<%= class_name %>',
|
5
|
+
type: 'publication',
|
6
|
+
title: '<%= class_name.underscore.humanize %>',
|
7
|
+
# attributes: [
|
8
|
+
# {
|
9
|
+
# name: 'example',
|
10
|
+
# type: :string,
|
11
|
+
# },
|
12
|
+
# ]
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Cms
|
2
|
+
module Generators
|
3
|
+
class WidgetGenerator < ::Rails::Generators::NamedBase
|
4
|
+
include ::Rails::Generators::Migration
|
5
|
+
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
def self.next_migration_number(dirname)
|
9
|
+
max = current_migration_number(dirname)
|
10
|
+
Scrivito::Migration.next_migration_number(max)
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_model
|
14
|
+
template('model.erb', "app/models/#{file_name}.rb")
|
15
|
+
end
|
16
|
+
|
17
|
+
def generate_views
|
18
|
+
path = "app/views/#{file_name}"
|
19
|
+
|
20
|
+
template('show.html.erb', "#{path}/show.html.erb")
|
21
|
+
template('details.html.erb', "#{path}/details.html.erb")
|
22
|
+
template('thumbnail.html.erb', "#{path}/thumbnail.html.erb")
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_migration
|
26
|
+
migration_template('migration.erb', "cms/migrate/create_#{file_name}.rb")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/scrivito/basic_obj.rb
CHANGED
@@ -52,9 +52,12 @@ module Scrivito
|
|
52
52
|
# @example Arrays of {String Strings} allow you to set multi enum fields
|
53
53
|
# Obj.create(:tags => ["ruby", "rails"])
|
54
54
|
#
|
55
|
-
# @example Simply pass an Array of {BasicWidget Widgets} to change a widget field
|
55
|
+
# @example Simply pass an Array of {BasicWidget Widgets} to change a widget field. See {BasicWidget#clone Widget#clone} on how to clone a widget.
|
56
56
|
# # Add new widgets
|
57
|
-
# Obj.create(:widgets => [Widget.new(_obj_class: 'TitleWidget',
|
57
|
+
# Obj.create(:widgets => [Widget.new(_obj_class: 'TitleWidget', title: 'My Title')])
|
58
|
+
#
|
59
|
+
# # Add a widget clone
|
60
|
+
# Obj.create(:widgets => [another_obj.widgets.first.clone])
|
58
61
|
#
|
59
62
|
# # Changing a widget field
|
60
63
|
# obj.update(:widgets => [obj.widgets.first])
|
@@ -660,25 +663,6 @@ module Scrivito
|
|
660
663
|
instantiate_widget(widget_id, widget_data) if widget_data
|
661
664
|
end
|
662
665
|
|
663
|
-
def copy_widget_from(src_obj_id, src_widget_id)
|
664
|
-
raise "cannot copy widget, since workspace is not modifiable" if Workspace.current.published?
|
665
|
-
|
666
|
-
src_obj_content = CmsRestApi.get(cms_rest_api_path(src_obj_id))
|
667
|
-
widget_content = src_obj_content["_widget_pool"]["#{src_widget_id}"]
|
668
|
-
|
669
|
-
raise "cannot copy widget, since widget does not exist" unless widget_content
|
670
|
-
|
671
|
-
src_widget = BasicObj.find(src_obj_id).widget_from_pool(src_widget_id)
|
672
|
-
widget_content.delete_if do |attribute_name, _|
|
673
|
-
src_widget.type_of_attribute(attribute_name) == "widget"
|
674
|
-
end
|
675
|
-
widget_pool_id = BasicObj.generate_widget_pool_id
|
676
|
-
|
677
|
-
CmsRestApi.put(cms_rest_api_path, obj: {_widget_pool: {widget_pool_id => widget_content}})
|
678
|
-
|
679
|
-
widget_pool_id
|
680
|
-
end
|
681
|
-
|
682
666
|
# for internal testing purposes only
|
683
667
|
def blob_id
|
684
668
|
find_blob.try(:id)
|
@@ -80,11 +80,32 @@ class BasicWidget
|
|
80
80
|
container.update(container_field_name => new_widget_list)
|
81
81
|
end
|
82
82
|
|
83
|
+
# Clones the {BasicWidget Widget}. The clone gets all
|
84
|
+
# attributes of the original widget except nested widget attributes.
|
85
|
+
# The clone is not attached to an {BasicObj Obj} initially.
|
86
|
+
# It only becomes usable by assigning it to a widget attribute of an Obj.
|
87
|
+
#
|
88
|
+
# @example
|
89
|
+
# # From another_obj, take the first widget in my_widgets,
|
90
|
+
# # and put a clone in obj's my_widgets.
|
91
|
+
# obj.update(my_widgets: [another_obj.my_widgets.first.clone])
|
92
|
+
#
|
93
|
+
# @api public
|
94
|
+
def clone
|
95
|
+
attributes = {}
|
96
|
+
data_from_cms.all_custom_attributes.each do |attr_name|
|
97
|
+
if type_of_attribute(attr_name) != 'widget'
|
98
|
+
attributes[attr_name] = read_attribute(attr_name)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
self.class.new(attributes)
|
102
|
+
end
|
103
|
+
|
83
104
|
def id
|
84
105
|
if @id
|
85
106
|
@id
|
86
107
|
else
|
87
|
-
|
108
|
+
raise_not_persisted_error
|
88
109
|
end
|
89
110
|
end
|
90
111
|
|
@@ -196,7 +217,7 @@ class BasicWidget
|
|
196
217
|
if @obj
|
197
218
|
@obj
|
198
219
|
else
|
199
|
-
|
220
|
+
raise_not_persisted_error
|
200
221
|
end
|
201
222
|
end
|
202
223
|
|
@@ -218,11 +239,11 @@ class BasicWidget
|
|
218
239
|
if persisted?
|
219
240
|
super
|
220
241
|
else
|
221
|
-
|
242
|
+
raise_not_persisted_error
|
222
243
|
end
|
223
244
|
end
|
224
245
|
|
225
|
-
def
|
246
|
+
def raise_not_persisted_error
|
226
247
|
raise ScrivitoError.new('Can not access a new widget before it has been saved')
|
227
248
|
end
|
228
249
|
|
@@ -16,7 +16,7 @@ module Scrivito
|
|
16
16
|
@obj = loaded_obj
|
17
17
|
end
|
18
18
|
|
19
|
-
# Deliver a binary @obj by redirecting to
|
19
|
+
# Deliver a binary @obj by redirecting to its `body_data_url`.
|
20
20
|
# Will respond with 404 if the @obj has no blob.
|
21
21
|
# @api public
|
22
22
|
def deliver_file
|
@@ -3,8 +3,8 @@ module Scrivito
|
|
3
3
|
# This module provides advances auto-invalidating caching mechanism for storing obj data.
|
4
4
|
#
|
5
5
|
# To keep it up-to-date its caches and changes should be updated periodically
|
6
|
-
#
|
7
|
-
#
|
6
|
+
# Its changes should be updated every time a new workspace data has been fetched.
|
7
|
+
# Its caches should be updated every time a new obj data has been fetched.
|
8
8
|
module ContentStateCaching
|
9
9
|
class << self
|
10
10
|
# How deep should a content state chain be inspected. Default depth is 20.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infopark AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -185,6 +185,12 @@ files:
|
|
185
185
|
- lib/generators/cms/migration/USAGE
|
186
186
|
- lib/generators/cms/migration/migration_generator.rb
|
187
187
|
- lib/generators/cms/migration/templates/migration.erb
|
188
|
+
- lib/generators/cms/widget/templates/details.html.erb
|
189
|
+
- lib/generators/cms/widget/templates/migration.erb
|
190
|
+
- lib/generators/cms/widget/templates/model.erb
|
191
|
+
- lib/generators/cms/widget/templates/show.html.erb
|
192
|
+
- lib/generators/cms/widget/templates/thumbnail.html.erb
|
193
|
+
- lib/generators/cms/widget/widget_generator.rb
|
188
194
|
- lib/obj.rb
|
189
195
|
- lib/scrivito/access_denied.rb
|
190
196
|
- lib/scrivito/attribute_content.rb
|