refinerycms-core 2.0.10 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/refinery/admin.js.erb +126 -234
- data/app/assets/javascripts/refinery/ajaxy_pagination.js.coffee +1 -1
- data/app/assets/javascripts/refinery/boot_wym.js.erb +4 -8
- data/app/assets/javascripts/refinery/core.js +1 -1
- data/app/assets/javascripts/refinery/interface.js.coffee.erb +3 -16
- data/app/assets/javascripts/refinery/modal_dialogs.js.erb +0 -3
- data/app/assets/javascripts/refinery/nestedsortables.js +312 -312
- data/app/assets/javascripts/refinery/refinery.js.erb +14 -15
- data/app/assets/javascripts/refinery/site_bar.js +3 -9
- data/app/assets/javascripts/refinery/sortable_list.js +145 -0
- data/app/assets/javascripts/refinery/sortable_menu.js.coffee +3 -4
- data/app/assets/javascripts/refinery/submit_continue.js.coffee.erb +1 -2
- data/app/assets/javascripts/refinery/tree.js +3 -3
- data/app/assets/javascripts/refinery/wymeditor.js +6 -6
- data/{public → app/assets/javascripts}/wymeditor/GPL-license.txt +0 -0
- data/{public → app/assets/javascripts}/wymeditor/MIT-license.txt +0 -0
- data/{public → app/assets/javascripts}/wymeditor/README +0 -0
- data/app/assets/javascripts/wymeditor/browsers/mozilla.js.erb +10 -11
- data/app/assets/javascripts/wymeditor/browsers/webkit.js.erb +17 -18
- data/app/assets/javascripts/wymeditor/classes.js.erb +3 -5
- data/app/assets/javascripts/wymeditor/functions.js.erb +5 -1
- data/app/assets/javascripts/wymeditor/prototypes.js.erb +0 -3
- data/app/assets/javascripts/wymeditor/setup.js.erb +5 -5
- data/app/assets/javascripts/wymeditor/skins/refinery/skin.js +1 -4
- data/app/assets/javascripts/wymeditor/validators.js.erb +3 -2
- data/app/assets/stylesheets/{formatting.css.scss → refinery/formatting.css.scss} +0 -0
- data/app/assets/stylesheets/refinery/layout.css.scss +41 -11
- data/app/assets/stylesheets/{theme.css.scss → refinery/theme.css.scss} +0 -0
- data/app/controllers/refinery/sitemap_controller.rb +1 -5
- data/app/helpers/refinery/admin_helper.rb +6 -0
- data/app/helpers/refinery/image_helper.rb +2 -1
- data/app/helpers/refinery/menu_helper.rb +0 -49
- data/app/helpers/refinery/meta_helper.rb +7 -3
- data/app/helpers/refinery/site_bar_helper.rb +3 -15
- data/app/models/refinery/core/base_model.rb +2 -0
- data/{lib → app/presenters}/refinery/base_presenter.rb +1 -2
- data/app/views/layouts/application.html.erb +8 -7
- data/app/views/refinery/_content_page.html.erb +1 -1
- data/app/views/refinery/_google_analytics.html.erb +12 -5
- data/app/views/refinery/_head.html.erb +11 -15
- data/app/views/refinery/_header.html.erb +1 -4
- data/app/views/refinery/_javascripts.html.erb +14 -8
- data/app/views/refinery/_site_bar.html.erb +4 -4
- data/app/views/refinery/admin/_form_advanced_options_menu.html.erb +12 -0
- data/app/views/refinery/admin/_javascripts.html.erb +13 -1
- data/app/views/refinery/admin/_locale_picker.html.erb +11 -0
- data/app/views/refinery/admin/_make_sortable.html.erb +8 -5
- data/app/views/refinery/admin/_search.html.erb +1 -7
- data/app/views/refinery/admin/_search_header.html.erb +1 -0
- data/app/views/refinery/admin/_wysiwyg.html.erb +16 -0
- data/config/initializers/will_paginate_monkeypatch.rb +1 -1
- data/config/locales/bg.yml +5 -1
- data/config/locales/cs.yml +5 -1
- data/config/locales/da.yml +5 -1
- data/config/locales/de.yml +7 -3
- data/config/locales/el.yml +5 -1
- data/config/locales/en.yml +7 -1
- data/config/locales/es.yml +5 -1
- data/config/locales/fi.yml +5 -1
- data/config/locales/fr.yml +5 -1
- data/config/locales/hu.yml +82 -0
- data/config/locales/it.yml +38 -34
- data/config/locales/ja.yml +5 -1
- data/config/locales/ko.yml +5 -1
- data/config/locales/lt.yml +5 -1
- data/config/locales/lv.yml +5 -1
- data/config/locales/nb.yml +5 -1
- data/config/locales/nl.yml +36 -29
- data/config/locales/pl.yml +8 -1
- data/config/locales/pt-BR.yml +7 -3
- data/config/locales/pt.yml +82 -0
- data/config/locales/rs.yml +5 -1
- data/config/locales/ru.yml +5 -1
- data/config/locales/sk.yml +10 -3
- data/config/locales/sl.yml +5 -1
- data/config/locales/sv.yml +5 -1
- data/config/locales/tr.yml +82 -0
- data/config/locales/uk.yml +77 -0
- data/config/locales/vi.yml +5 -1
- data/config/locales/zh-CN.yml +5 -1
- data/config/locales/zh-TW.yml +5 -1
- data/config/routes.rb +3 -3
- data/lib/generators/refinery/cms/cms_generator.rb +29 -0
- data/lib/generators/refinery/cms/templates/.gitignore +1 -0
- data/lib/generators/refinery/cms/templates/app/views/sitemap/index.xml.builder +13 -13
- data/lib/generators/refinery/core/templates/config/initializers/refinery/core.rb.erb +8 -12
- data/lib/generators/refinery/dummy/templates/rails/database.yml +3 -3
- data/lib/generators/refinery/engine/engine_generator.rb +8 -12
- data/lib/generators/refinery/engine/templates/Gemfile +5 -39
- data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb +4 -4
- data/lib/generators/refinery/engine/templates/app/models/refinery/namespace/singular_name.rb.erb +2 -3
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_actions.html.erb +1 -1
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_form.html.erb +31 -33
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_records.html.erb +1 -3
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_singular_name.html.erb +2 -2
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/index.html.erb +1 -1
- data/lib/generators/refinery/engine/templates/config/locales/cs.yml +28 -0
- data/lib/generators/refinery/engine/templates/config/locales/it.yml +28 -0
- data/lib/generators/refinery/engine/templates/config/locales/nl.yml +6 -6
- data/lib/generators/refinery/engine/templates/config/locales/tr.yml +28 -0
- data/lib/generators/refinery/engine/templates/config/routes.rb.erb +2 -2
- data/lib/generators/refinery/engine/templates/db/seeds.rb.erb +1 -1
- data/lib/generators/refinery/engine/templates/lib/generators/refinery/extension_plural_name_generator.rb.erb +1 -1
- data/lib/generators/refinery/engine/templates/lib/refinery/plural_name/engine.rb.erb +1 -1
- data/lib/generators/refinery/engine/templates/spec/{requests → features}/refinery/namespace/admin/plural_name_spec.rb.erb +1 -1
- data/lib/generators/refinery/engine/templates/spec/spec_helper.rb +25 -49
- data/lib/generators/refinery/form/form_generator.rb +1 -13
- data/lib/generators/refinery/form/templates/app/models/refinery/namespace/singular_name.rb.erb +0 -4
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_records.html.erb +2 -2
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/spam.html.erb +7 -6
- data/lib/generators/refinery/form/templates/config/locales/nl.yml +29 -29
- data/lib/generators/refinery/form/templates/config/locales/tr.yml +78 -0
- data/lib/generators/refinery/form/templates/config/routes.rb.erb +1 -1
- data/lib/generators/refinery/form/templates/db/migrate/1_create_plural_name.rb.erb +2 -6
- data/lib/generators/refinery/form/templates/db/seeds.rb.erb +1 -1
- data/lib/generators/refinery/form/templates/lib/refinery/plural_name/engine.rb.erb +1 -1
- data/lib/generators/refinery/form/templates/refinerycms-plural_name.gemspec +2 -5
- data/lib/refinery.rb +191 -0
- data/lib/refinery/admin/base_controller.rb +27 -16
- data/lib/refinery/application_controller.rb +15 -47
- data/lib/refinery/cli.rb +48 -27
- data/lib/refinery/core.rb +7 -183
- data/lib/refinery/core/configuration.rb +17 -9
- data/lib/refinery/core/engine.rb +11 -47
- data/lib/refinery/crud.rb +81 -66
- data/lib/refinery/engine.rb +52 -55
- data/lib/refinery/ext/action_view/helpers/form_builder.rb +2 -0
- data/lib/refinery/extension_generation.rb +208 -110
- data/lib/refinery/menu.rb +16 -7
- data/lib/refinery/menu_item.rb +56 -54
- data/lib/refinery/plugin.rb +11 -3
- data/lib/refinery/plugins.rb +14 -1
- data/lib/refinery/version.rb +3 -3
- data/refinerycms-core.gemspec +11 -10
- data/spec/controllers/refinery/admin/dummy_controller_spec.rb +57 -0
- data/spec/controllers/refinery/admin/refinery_core_controller_spec.rb +3 -4
- data/spec/controllers/refinery/sitemap_controller_spec.rb +1 -14
- data/spec/{requests → features}/refinery/admin/custom_assets_spec.rb +1 -1
- data/spec/{requests → features}/refinery/admin/dialogs_spec.rb +1 -1
- data/spec/features/refinery/admin/xhr_paging_spec.rb +55 -0
- data/spec/features/refinery/application_layout_spec.rb +19 -0
- data/spec/features/refinery/core_spec.rb +14 -0
- data/spec/{requests → features}/refinery/site_bar_spec.rb +1 -1
- data/spec/helpers/refinery/meta_helper_spec.rb +25 -0
- data/spec/lib/generators/refinery/cms/cms_generator_spec.rb +61 -0
- data/spec/lib/generators/refinery/engine/engine_generator_multiple_resources_spec.rb +28 -1
- data/spec/lib/generators/refinery/engine/engine_generator_sanity_check_spec.rb +7 -7
- data/spec/lib/generators/refinery/engine/engine_generator_spec.rb +69 -8
- data/spec/lib/generators/refinery/engine/engine_generator_with_i18n_spec.rb +0 -2
- data/spec/lib/generators/refinery/form/form_generator_spec.rb +9 -1
- data/spec/lib/refinery/application_controller_spec.rb +48 -63
- data/spec/lib/refinery/cli_spec.rb +136 -0
- data/spec/lib/refinery/core/configuration_spec.rb +17 -0
- data/spec/lib/refinery/core_spec.rb +19 -13
- data/spec/lib/refinery/crud_spec.rb +0 -4
- data/spec/lib/refinery/menu_spec.rb +16 -26
- data/spec/support/refinery.rb +6 -1
- data/{app → vendor}/assets/javascripts/jquery/GPL-LICENSE.txt +0 -0
- data/{app → vendor}/assets/javascripts/jquery/MIT-LICENSE.txt +0 -0
- data/vendor/assets/javascripts/jquery/jquery.browser.js +49 -0
- data/{app → vendor}/assets/javascripts/jquery/jquery.html5-placeholder-shim.js +0 -0
- data/{app → vendor}/assets/javascripts/jquery/jquery.jcarousel.js +0 -0
- data/{app → vendor}/assets/javascripts/jquery/jquery.textTruncate.js +0 -0
- data/{app → vendor}/assets/javascripts/jquery/jquery.timers.js +0 -0
- data/{app → vendor}/assets/javascripts/modernizr-min.js +0 -0
- metadata +231 -78
- data/app/assets/images/refinery/resolve_digital_footer_logo.png +0 -0
- data/app/assets/javascripts/dd_belatedpng.js +0 -13
- data/app/assets/javascripts/jquery/jquery.corner.js +0 -345
- data/app/assets/stylesheets/application.css.scss +0 -55
- data/app/assets/stylesheets/home.css.scss +0 -3
- data/app/views/refinery/_ie6check.html.erb +0 -63
- data/app/views/refinery/_menu.html.erb +0 -20
- data/app/views/refinery/_menu_branch.html.erb +0 -19
- data/lib/generators/refinery/engine/templates/Guardfile +0 -27
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_locale_picker.html.erb +0 -11
- data/lib/refinery/catch_all_routes.rb +0 -3
- data/lib/tasks/yard.rake +0 -30
- data/spec/requests/refinery/admin/controller_restriction_spec.rb +0 -27
- data/spec/requests/refinery/search_spec.rb +0 -71
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38344324c8aabdca646f3ffb65e2b68aef94581e
|
4
|
+
data.tar.gz: 93f69f5eced0eb86702cd809e7e2497f03d68d07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f19ca709e8d5fdb4e6f7d6c1d6d463d2358691ff52493a46095b46e6d06d1139444fd93d1995cb519e1fcff07d03555d4b3ee8c9b0f1185c0ae525b2dd63bb97
|
7
|
+
data.tar.gz: 5d30e2fffece107a55468342a0285206ebeac02cb21819dc6e77ebd4b0088b522095ac1371372e1f9eda3ddb17f56ae8f2e587499affee97b6b90813020b6c10
|
@@ -35,7 +35,7 @@ $.fn.paginateTo = function(stateUrl) {
|
|
35
35
|
$(this).attr('href', $(this).attr('href').replace(/\?\_\=[^&]+&/, '?'));
|
36
36
|
})
|
37
37
|
},
|
38
|
-
|
38
|
+
error: function(data) {
|
39
39
|
window.location = popstate_location;
|
40
40
|
}
|
41
41
|
});
|
@@ -77,7 +77,6 @@ init_modal_dialogs = function(){
|
|
77
77
|
+ 'app_dialog=true&dialog=true';
|
78
78
|
|
79
79
|
iframe = $("<iframe id='dialog_iframe' frameborder='0' marginheight='0' marginwidth='0' border='0'></iframe>");
|
80
|
-
if(!$.browser.msie) { iframe.corner('8px'); }
|
81
80
|
iframe.dialog({
|
82
81
|
title: $anchor.data('dialog-title')
|
83
82
|
, modal: true
|
@@ -99,7 +98,7 @@ refinery_dialog_success = function(e) {
|
|
99
98
|
close_dialog();
|
100
99
|
|
101
100
|
$.ajax({
|
102
|
-
url: window.location.pathname,
|
101
|
+
url: window.location.pathname + window.location.search,
|
103
102
|
cache: false,
|
104
103
|
success: function(data) {
|
105
104
|
$('.pagination_container').html(data);
|
@@ -131,20 +130,12 @@ trigger_reordering = function(e, enable) {
|
|
131
130
|
};
|
132
131
|
|
133
132
|
trigger_reordering_content_section = function(e, enable) {
|
134
|
-
$menu = $("#page-tabs");
|
133
|
+
$menu = $("#page-tabs").sortable();
|
135
134
|
e.preventDefault();
|
136
135
|
$('#reorder_page_part, #reorder_page_part_done').toggle();
|
137
|
-
$('#site_bar, #menu, .field:not(:has(#page-tabs)), .page_part, #more_options_field, .form-actions')
|
136
|
+
$('#site_bar, #menu, .field:not(:has(#page-tabs)), .page_part:visible, #more_options_field, .form-actions')
|
138
137
|
.fadeTo(500, enable ? 0.35 : 1);
|
139
138
|
|
140
|
-
if(enable) {
|
141
|
-
$menu.addClass('reordering').find('.tab a').click(function(ev){
|
142
|
-
ev.preventDefault();
|
143
|
-
});
|
144
|
-
} else {
|
145
|
-
$menu.removeClass('reordering').find('.tab a').unbind('click');
|
146
|
-
}
|
147
|
-
|
148
139
|
$menu.sortable(enable ? 'enable' : 'disable').sortable({
|
149
140
|
items: 'li',
|
150
141
|
stop: function(event, ui) {
|
@@ -214,9 +205,6 @@ init_tooltips = function(args){
|
|
214
205
|
$('.tooltip').remove();
|
215
206
|
tooltip = $("<div class='tooltip'><div><span></span></div></div>").appendTo('#tooltip_container');
|
216
207
|
tooltip.find("span").html($(this).attr('tooltip'));
|
217
|
-
if(!$.browser.msie) {
|
218
|
-
tooltip.corner('6px').find('span').corner('6px');
|
219
|
-
}
|
220
208
|
|
221
209
|
tooltip_nib_extension = $.browser.msie ? '.gif' : '.png';
|
222
210
|
nib = $("<img src='<%= asset_path 'refinery/tooltip-nib' %>" + tooltip_nib_extension + "' class='tooltip-nib'/>").appendTo('#tooltip_container');
|
@@ -299,32 +287,40 @@ init_tooltips = function(args){
|
|
299
287
|
};
|
300
288
|
|
301
289
|
var link_tester = {
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
if (!this.initialised) {
|
306
|
-
this.test_url = test_url;
|
307
|
-
this.test_email = test_email;
|
308
|
-
this.initialised = true;
|
309
|
-
}
|
310
|
-
},
|
290
|
+
email_re : new RegExp(/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i),
|
291
|
+
url_re : new RegExp(/^(https?|ftp):\/\/(-\.)?([^\s/?\.#-]+\.?)+(\/[^\s]*)?$/i),
|
292
|
+
page_re : new RegExp('^(https?:\/\/' + document.location.host + '|\/[a-z0-9]+)'),
|
311
293
|
|
312
294
|
email: function(value, callback) {
|
313
295
|
if (value != "") {
|
314
|
-
|
315
|
-
callback(data.result == 'success');
|
316
|
-
});
|
296
|
+
callback(link_tester.email_re.test(value));
|
317
297
|
}
|
318
298
|
},
|
319
299
|
|
320
300
|
url: function(value, callback) {
|
321
301
|
if (value != "") {
|
322
|
-
|
323
|
-
|
324
|
-
}
|
302
|
+
if (link_tester.page_re.test(value)) {
|
303
|
+
link_tester.page(value, callback);
|
304
|
+
} else {
|
305
|
+
callback(link_tester.url_re.test(value));
|
306
|
+
}
|
325
307
|
}
|
326
308
|
},
|
327
309
|
|
310
|
+
page: function(value, callback) {
|
311
|
+
var valid = false;
|
312
|
+
$.ajax({
|
313
|
+
url: value,
|
314
|
+
timeout: 5000,
|
315
|
+
success: function() {
|
316
|
+
valid = true;
|
317
|
+
},
|
318
|
+
complete: function () {
|
319
|
+
callback(valid);
|
320
|
+
}
|
321
|
+
});
|
322
|
+
},
|
323
|
+
|
328
324
|
validate_textbox: function(validation_method, textbox_id, callback) {
|
329
325
|
var icon = '';
|
330
326
|
var loader_img = $("<img id='" + textbox_id.replace('#','') + "_test_loader' src='<%= asset_path 'refinery/ajax-loader.gif' %>' alt='Testing...' style='display: none;'/>");
|
@@ -332,14 +328,13 @@ var link_tester = {
|
|
332
328
|
|
333
329
|
loader_img.insertAfter($(textbox_id));
|
334
330
|
result_span.insertAfter(loader_img);
|
335
|
-
|
336
331
|
$(textbox_id).bind('paste blur',function(){
|
337
332
|
$(textbox_id).stop(true); // Clear the current queue; if we weren't checking yet, cancel it.
|
338
333
|
$(textbox_id + '_test_loader').hide();
|
339
334
|
$(textbox_id + '_test_result').hide();
|
340
335
|
$(textbox_id + '_test_result').removeClass('success_icon').removeClass('failure_icon');
|
341
336
|
|
342
|
-
if (this.value != ""
|
337
|
+
if (this.value != "") {
|
343
338
|
// Wait 300ms before checking.
|
344
339
|
$(textbox_id).delay(300).queue(function () {
|
345
340
|
$(textbox_id + '_test_loader').show();
|
@@ -526,9 +521,7 @@ var page_options = {
|
|
526
521
|
|
527
522
|
if (!this.initialised) {
|
528
523
|
// set the page tabs up, but ensure that all tabs are shown so that when wymeditor loads it has a proper height.
|
529
|
-
page_options.tabs = $('#page-tabs');
|
530
|
-
page_options.tabs.tabs({tabTemplate: '<li><a href="#{href}">#{label}</a></li>'});
|
531
|
-
page_options.tabs.find(' > ul li a').corner('top 5px');
|
524
|
+
page_options.tabs = $('#page-tabs').tabs();
|
532
525
|
|
533
526
|
part_shown = $('#page-tabs .page_part.field').not('.ui-tabs-hide');
|
534
527
|
$('#page-tabs .page_part.field').removeClass('ui-tabs-hide');
|
@@ -541,7 +534,6 @@ var page_options = {
|
|
541
534
|
$(document).ready($.proxy(function(){
|
542
535
|
// hide the tabs that are supposed to be hidden.
|
543
536
|
$('#page-tabs .page_part.field').not(this).addClass('ui-tabs-hide');
|
544
|
-
$('#page-tabs > ul li a').corner('top 5px');
|
545
537
|
}, part_shown));
|
546
538
|
|
547
539
|
if(this.enable_parts){
|
@@ -585,7 +577,7 @@ var page_options = {
|
|
585
577
|
if(part_title.length > 0){
|
586
578
|
var tab_title = part_title.toLowerCase().replace(" ", "_");
|
587
579
|
|
588
|
-
if ($('#
|
580
|
+
if ($('#page_part_' + tab_title).size() === 0) {
|
589
581
|
$.get(page_options.new_part_url, {
|
590
582
|
title: part_title
|
591
583
|
, part_index: $('#new_page_part_index').val()
|
@@ -594,24 +586,21 @@ var page_options = {
|
|
594
586
|
$('#submit_continue_button').remove();
|
595
587
|
// Add a new tab for the new content section.
|
596
588
|
$('#page_part_editors').append(data);
|
597
|
-
page_options.tabs.tabs('add', '#page_part_new_' + $('#new_page_part_index').val(), part_title);
|
598
|
-
page_options.tabs.tabs('select', $('#new_page_part_index').val());
|
599
589
|
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
590
|
+
page_options.tabs.find("ul").append("<li><a href='#page_part_new_"+$('#new_page_part_index').val()+"'>"+part_title+"</a></li>");
|
591
|
+
page_options.tabs.tabs("refresh");
|
592
|
+
|
593
|
+
// this is here because of https://github.com/refinery/refinerycms/issues/2060
|
594
|
+
$("#page-tabs #page_parts li").last().attr("data-index", $('#new_page_part_index').val());
|
595
|
+
|
596
|
+
page_options.tabs.tabs("option", "active", -1);
|
604
597
|
|
605
|
-
// turn the new textarea into a wymeditor.
|
606
|
-
$('#page_part_new_' + $('#new_page_part_index').val()).appendTo('#page_part_editors')
|
607
598
|
WYMeditor.init();
|
608
599
|
|
609
600
|
// Wipe the title and increment the index counter by one.
|
610
601
|
$('#new_page_part_index').val(parseInt($('#new_page_part_index').val(), 10) + 1);
|
611
602
|
$('#new_page_part_title').val('');
|
612
603
|
|
613
|
-
page_options.tabs.find('> ul li a').corner('top 5px');
|
614
|
-
|
615
604
|
$('#new_page_part_dialog').dialog('close');
|
616
605
|
}, 'html'
|
617
606
|
);
|
@@ -632,15 +621,25 @@ var page_options = {
|
|
632
621
|
$('#delete_page_part').click(function(e){
|
633
622
|
e.preventDefault();
|
634
623
|
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
624
|
+
var tabName = page_options.tabs.find(".ui-tabs-active a").text();
|
625
|
+
|
626
|
+
if(confirm("This will remove the content section '" + tabName + "' immediately even if you don't save this page, are you sure?")) {
|
627
|
+
var tabId = page_options.tabs.find('.ui-tabs-active a').attr('id').match(/\d+/)[0] - 1;
|
628
|
+
|
629
|
+
if($('#page_parts_attributes_' + tabId + '_id').length > 0) {
|
630
|
+
$.ajax({
|
631
|
+
url: page_options.del_part_url + '/' + $('#page_parts_attributes_' + tabId + '_id').val(),
|
632
|
+
type: 'DELETE'
|
633
|
+
});
|
634
|
+
}
|
635
|
+
|
636
|
+
page_options.tabs.find(".ui-tabs-active").remove();
|
637
|
+
page_options.tabs.find("#page_part_" + tabName.toLowerCase()).remove();
|
638
|
+
page_options.tabs.find("#page_part_new_" + tabId).remove();
|
639
|
+
$("[id^=page_parts_attributes_" + tabId + "_]").remove();
|
643
640
|
$('#submit_continue_button').remove();
|
641
|
+
|
642
|
+
page_options.tabs.tabs('refresh');
|
644
643
|
}
|
645
644
|
|
646
645
|
});
|
@@ -655,72 +654,85 @@ var page_options = {
|
|
655
654
|
|
656
655
|
};
|
657
656
|
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
657
|
+
// TODO: Need to rewrite WYM to accept multiple images. As it stands, only
|
658
|
+
// the callback is useful when inserting multiple -- helpful for
|
659
|
+
// the page-images and portfolio engines.
|
660
|
+
|
661
|
+
// ImageDialog
|
662
|
+
//
|
663
|
+
// The dialog that opens when choosing to 'Add image' in WYM.
|
664
|
+
//
|
665
|
+
// Options:
|
666
|
+
// callback (null):
|
667
|
+
// a function to execute upon chosing 'submit'. Passed either an
|
668
|
+
// an array or a single image, depending on whether `multiple` is
|
669
|
+
// true.
|
670
|
+
// multiple (false):
|
671
|
+
// if true, enables selection of multiple images. Does not allow
|
672
|
+
// insertion into WYM without manual callback manipulation.
|
673
|
+
function ImageDialog(options) {
|
674
|
+
self = this;
|
675
|
+
this.defaults = {callback: null, multiple: false};
|
676
|
+
this.settings = $.extend({}, this.defaults, options);
|
677
|
+
|
678
|
+
this.create = function() {
|
679
|
+
|
680
|
+
this.callback = this.settings.callback;
|
681
|
+
this.init_tabs();
|
682
|
+
this.init_select();
|
683
|
+
this.init_actions();
|
684
|
+
};
|
685
|
+
|
686
|
+
this.init_tabs = function() {
|
675
687
|
var radios = $('#dialog_menu_left input:radio');
|
676
688
|
var selected = radios.parent().filter(".selected_radio").find('input:radio').first() || radios.first();
|
677
|
-
|
678
|
-
|
679
|
-
link_dialog.switch_area($(this));
|
689
|
+
radios.click(function() {
|
690
|
+
self.switch_area($(this));
|
680
691
|
});
|
681
692
|
|
682
693
|
selected.attr('checked', 'true');
|
683
|
-
|
684
|
-
}
|
694
|
+
self.switch_area(selected);
|
695
|
+
};
|
685
696
|
|
686
|
-
|
697
|
+
this.switch_area = function(radio) {
|
687
698
|
$('#dialog_menu_left .selected_radio').removeClass('selected_radio');
|
688
|
-
|
699
|
+
radio.parent().addClass('selected_radio');
|
689
700
|
$('#dialog_main .dialog_area').hide();
|
690
|
-
$('#' + radio.
|
691
|
-
}
|
701
|
+
$('#' + radio.val() + '_area').show();
|
702
|
+
};
|
692
703
|
|
693
|
-
|
694
|
-
$('#existing_image_area_content ul li img').click(function(){
|
695
|
-
|
704
|
+
this.init_select = function() {
|
705
|
+
$('#existing_image_area_content ul li img').click(function() {
|
706
|
+
self.toggle_image($(this));
|
696
707
|
});
|
697
|
-
|
708
|
+
|
709
|
+
// Select any currently selected, just uploaded...
|
698
710
|
if ((selected_img = $('#existing_image_area_content ul li.selected img')).length > 0) {
|
699
|
-
|
711
|
+
self.toggle_image(selected_img.first());
|
700
712
|
}
|
701
|
-
}
|
713
|
+
};
|
702
714
|
|
703
|
-
|
704
|
-
if (
|
705
|
-
$('#existing_image_area_content ul li.selected').removeClass('selected');
|
715
|
+
this.toggle_image = function(img) {
|
716
|
+
if (img.length > 0) {
|
717
|
+
if (!self.settings.multiple) $('#existing_image_area_content ul li.selected').removeClass('selected');
|
706
718
|
|
707
|
-
|
708
|
-
var imageId =
|
719
|
+
img.parent().toggleClass('selected');
|
720
|
+
var imageId = img.attr('data-id');
|
709
721
|
var geometry = $('#existing_image_size_area li.selected a').attr('data-geometry');
|
710
722
|
var size = $('#existing_image_size_area li.selected a').attr('data-size');
|
711
723
|
var resize = $("#wants_to_resize_image").is(':checked');
|
712
724
|
|
713
|
-
image_url = resize ?
|
725
|
+
image_url = resize ? img.attr('data-' + size) : img.attr('data-original');
|
714
726
|
|
715
727
|
if (parent) {
|
716
728
|
if ((wym_src = parent.document.getElementById('wym_src')) != null) {
|
717
729
|
wym_src.value = image_url;
|
718
730
|
}
|
719
731
|
if ((wym_title = parent.document.getElementById('wym_title')) != null) {
|
720
|
-
wym_title.value =
|
732
|
+
wym_title.value = img.attr('title');
|
721
733
|
}
|
722
734
|
if ((wym_alt = parent.document.getElementById('wym_alt')) != null) {
|
723
|
-
wym_alt.value =
|
735
|
+
wym_alt.value = img.attr('alt');
|
724
736
|
}
|
725
737
|
if ((wym_size = parent.document.getElementById('wym_size')) != null
|
726
738
|
&& typeof(geometry) != 'undefined') {
|
@@ -728,35 +740,37 @@ var image_dialog = {
|
|
728
740
|
}
|
729
741
|
}
|
730
742
|
}
|
731
|
-
}
|
743
|
+
};
|
732
744
|
|
733
|
-
|
745
|
+
this.submit_image_choice = function(e) {
|
734
746
|
e.preventDefault();
|
735
|
-
|
747
|
+
selected_images = $('#existing_image_area_content ul li.selected img');
|
748
|
+
selected_images = self.settings.multiple ? selected_images.get() : selected_images.get(0);
|
749
|
+
|
750
|
+
if(selected_images && $.isFunction(self.callback))
|
736
751
|
{
|
737
|
-
|
752
|
+
self.callback(selected_images);
|
738
753
|
}
|
739
754
|
|
740
755
|
close_dialog(e);
|
741
|
-
}
|
756
|
+
};
|
742
757
|
|
743
|
-
|
744
|
-
var _this = this;
|
758
|
+
this.init_actions = function() {
|
745
759
|
// get submit buttons not inside a wymeditor iframe
|
746
760
|
$('#existing_image_area .form-actions-dialog #submit_button')
|
747
761
|
.not('.wym_iframe_body #existing_image_area .form-actions-dialog #submit_button')
|
748
|
-
.click($.proxy(
|
762
|
+
.click($.proxy(self.submit_image_choice, self));
|
749
763
|
|
750
764
|
// get cancel buttons not inside a wymeditor iframe
|
751
765
|
$('.form-actions-dialog #cancel_button')
|
752
766
|
.not('.wym_iframe_body .form-actions-dialog #cancel_button')
|
753
|
-
.click($.proxy(close_dialog,
|
767
|
+
.click($.proxy(close_dialog, self));
|
754
768
|
|
755
769
|
$('#existing_image_size_area ul li a').click(function(e) {
|
756
770
|
$('#existing_image_size_area ul li').removeClass('selected');
|
757
771
|
$(this).parent().addClass('selected');
|
758
772
|
$('#existing_image_size_area #wants_to_resize_image').attr('checked', 'checked');
|
759
|
-
|
773
|
+
self.toggle_image($('#existing_image_area_content ul li.selected img'));
|
760
774
|
e.preventDefault();
|
761
775
|
});
|
762
776
|
|
@@ -765,7 +779,7 @@ var image_dialog = {
|
|
765
779
|
$('#existing_image_size_area ul li:first a').click();
|
766
780
|
} else {
|
767
781
|
$('#existing_image_size_area ul li').removeClass('selected');
|
768
|
-
|
782
|
+
self.toggle_image($('#existing_image_area_content ul li.selected img'));
|
769
783
|
}
|
770
784
|
});
|
771
785
|
|
@@ -775,130 +789,8 @@ var image_dialog = {
|
|
775
789
|
$(this.document.getElementById('wym_dialog_submit')).click();
|
776
790
|
}, parent));
|
777
791
|
image_area.find('.form-actions a.close_dialog').click(close_dialog);
|
778
|
-
}
|
779
|
-
}
|
780
|
-
|
781
|
-
var list_reorder = {
|
782
|
-
initialised: false
|
783
|
-
, init: function() {
|
784
|
-
|
785
|
-
if (!this.initialised) {
|
786
|
-
$('#reorder_action').click(list_reorder.enable_reordering);
|
787
|
-
$('#reorder_action_done').click(list_reorder.disable_reordering);
|
788
|
-
if(list_reorder.tree === false) {
|
789
|
-
list_reorder.sortable_list.find('li').addClass('no-nest');
|
790
|
-
}
|
791
|
-
list_reorder.sortable_list.nestedSortable({
|
792
|
-
listType: 'ul',
|
793
|
-
disableNesting: 'no-nest',
|
794
|
-
forcePlaceholderSize: true,
|
795
|
-
handle: list_reorder.tree ? 'div' : null,
|
796
|
-
items: 'li',
|
797
|
-
opacity: .6,
|
798
|
-
placeholder: 'placeholder',
|
799
|
-
tabSize: 25,
|
800
|
-
tolerance: 'pointer',
|
801
|
-
toleranceElement: list_reorder.tree ? '> div' : null,
|
802
|
-
disabled: true,
|
803
|
-
start: function () {
|
804
|
-
},
|
805
|
-
change: function () {
|
806
|
-
if (list_reorder.tree) {
|
807
|
-
list_reorder.reset_branch_classes(this);
|
808
|
-
}
|
809
|
-
},
|
810
|
-
stop: function () {
|
811
|
-
if (list_reorder.tree) {
|
812
|
-
list_reorder.reset_branch_classes(this);
|
813
|
-
list_reorder.reset_icon_classes(this);
|
814
|
-
} else {
|
815
|
-
list_reorder.reset_on_off_classes(this);
|
816
|
-
}
|
817
|
-
}
|
818
|
-
});
|
819
|
-
if (list_reorder.tree) {
|
820
|
-
list_reorder.reset_branch_classes(list_reorder.sortable_list);
|
821
|
-
} else {
|
822
|
-
list_reorder.reset_on_off_classes(list_reorder.sortable_list);
|
823
|
-
}
|
824
|
-
this.initialised = true;
|
825
|
-
}
|
826
|
-
}
|
827
|
-
, reset_on_off_classes: function(ul) {
|
828
|
-
$("> li", ul).each(function(i, li) {
|
829
|
-
$(li).removeClass('on off on-hover').addClass(i % 2 === 0 ? 'on' : 'off');
|
830
|
-
});
|
831
|
-
}
|
832
|
-
|
833
|
-
, reset_branch_classes: function (ul) {
|
834
|
-
$("li.ui-sortable-helper", this).removeClass("record").removeClass("branch_start").removeClass("branch_end");
|
835
|
-
$("li", ul).removeClass("branch_start").removeClass("branch_end");
|
836
|
-
|
837
|
-
$("> li:first", ul).addClass("branch_start");
|
838
|
-
$("> li:last", ul).addClass("branch_end");
|
839
|
-
|
840
|
-
var nested_ul = $("ul", ul);
|
841
|
-
$("> li:last", nested_ul).addClass("branch_end");
|
842
|
-
}
|
843
|
-
|
844
|
-
, reset_icon_classes: function(ul) {
|
845
|
-
$('li', ul).each(function() {
|
846
|
-
var $li = $(this);
|
847
|
-
var $icon = $li.find('.icon:first');
|
848
|
-
|
849
|
-
if ($li.find('ul li').size() > 0) {
|
850
|
-
$icon.addClass('toggle expanded');
|
851
|
-
}
|
852
|
-
else if ($icon.hasClass('expanded')){
|
853
|
-
$icon.removeClass('toggle expanded');
|
854
|
-
}
|
855
|
-
});
|
856
|
-
}
|
857
|
-
|
858
|
-
,enable_reordering: function(e) {
|
859
|
-
if(e) { e.preventDefault(); }
|
860
|
-
|
861
|
-
$('#sortable_list, .sortable_list').addClass("reordering");
|
862
|
-
$('#sortable_list .actions, .sortable_list .actions, #site_bar, header > *:not(script)').fadeTo(500, 0.3);
|
863
|
-
$('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul, div')).fadeTo(500, 0.55);
|
864
|
-
|
865
|
-
list_reorder.sortable_list.nestedSortable("enable");
|
866
|
-
|
867
|
-
$('#reorder_action').hide();
|
868
|
-
$('#reorder_action_done').show();
|
869
|
-
}
|
870
|
-
|
871
|
-
, disable_reordering: function(e) {
|
872
|
-
if(e) { e.preventDefault(); }
|
873
|
-
|
874
|
-
if($('#reorder_action_done').hasClass('loading')) { return false; }
|
875
|
-
$('#reorder_action_done').addClass('loading');
|
876
|
-
|
877
|
-
list_reorder.sortable_list.nestedSortable("disable");
|
878
|
-
|
879
|
-
$('#sortable_list, .sortable_list').removeClass("reordering");
|
880
|
-
|
881
|
-
if (list_reorder.update_url !== null) {
|
882
|
-
var serialized = list_reorder.sortable_list.serializelist();
|
883
|
-
|
884
|
-
$.post(list_reorder.update_url, serialized, function(data) {
|
885
|
-
list_reorder.restore_controls(e);
|
886
|
-
});
|
887
|
-
} else {
|
888
|
-
list_reorder.restore_controls(e);
|
889
|
-
}
|
890
|
-
}
|
891
|
-
|
892
|
-
, restore_controls: function(e) {
|
893
|
-
$(list_reorder.sortable_list).removeClass('reordering');
|
894
|
-
|
895
|
-
$('#sortable_list .actions, .sortable_list .actions, #site_bar, header > *:not(script)').fadeTo(250, 1);
|
896
|
-
$('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul, div')).fadeTo(250, 1, function() {
|
897
|
-
$('#reorder_action_done').hide().removeClass('loading');
|
898
|
-
$('#reorder_action').show();
|
899
|
-
});
|
900
|
-
}
|
901
|
-
};
|
792
|
+
};
|
793
|
+
}
|
902
794
|
|
903
795
|
var image_picker = {
|
904
796
|
initialised: false
|
@@ -944,10 +836,10 @@ var image_picker = {
|
|
944
836
|
}
|
945
837
|
|
946
838
|
, toggle_image: function(e) {
|
947
|
-
$(this.container).find(this.options.image_toggler).html(
|
948
|
-
($(this.container).find(options.image_toggler).html() == 'Show' ? 'Hide' : 'Show')
|
839
|
+
$(this.container).find(this.picker.options.image_toggler).html(
|
840
|
+
($(this.container).find(this.picker.options.image_toggler).html() == 'Show' ? 'Hide' : 'Show')
|
949
841
|
);
|
950
|
-
$(this.container).find(this.options.image_container).toggle();
|
842
|
+
$(this.container).find(this.picker.options.image_container).toggle();
|
951
843
|
e.preventDefault();
|
952
844
|
}
|
953
845
|
|