alchemy_cms 2.1.beta6 → 2.1.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/Gemfile +10 -2
- data/Guardfile +16 -0
- data/README.md +3 -3
- data/Rakefile +0 -5
- data/alchemy_cms.gemspec +1 -9
- data/app/assets/javascripts/alchemy/alchemy.base.js +5 -4
- data/app/assets/javascripts/alchemy/{alchemy.dragndrop.js.erb → alchemy.dragndrop.js} +0 -0
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js +96 -0
- data/app/assets/javascripts/alchemy/alchemy.image_cropper.js +48 -50
- data/app/assets/javascripts/alchemy/alchemy.jquery_loader.js +41 -0
- data/app/assets/javascripts/alchemy/alchemy.js +2 -0
- data/app/assets/javascripts/alchemy/alchemy.menubar.js +55 -0
- data/app/assets/javascripts/alchemy/alchemy.preview.js +94 -139
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js +98 -0
- data/app/assets/javascripts/alchemy/alchemy.windows.js +1 -174
- data/app/assets/javascripts/alchemy/menubar.js +2 -0
- data/app/assets/javascripts/alchemy/preview.js +2 -1
- data/app/assets/stylesheets/alchemy/_defaults.scss +7 -8
- data/app/assets/stylesheets/alchemy/base.css.scss +29 -33
- data/app/assets/stylesheets/alchemy/elements.css.scss +4 -4
- data/app/assets/stylesheets/alchemy/jquery-ui.alchemy.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery.Jcrop.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/jquery.sb.css.scss +19 -4
- data/app/assets/stylesheets/alchemy/menubar.css.scss +85 -0
- data/app/assets/stylesheets/alchemy/standard_set.css +3 -5
- data/app/assets/stylesheets/alchemy/tinymce_content.css.scss +1 -1
- data/app/assets/stylesheets/alchemy/tinymce_dialog.css.scss +1 -1
- data/app/controllers/alchemy/admin/attachments_controller.rb +2 -18
- data/app/controllers/alchemy/admin/base_controller.rb +1 -1
- data/app/controllers/alchemy/admin/elements_controller.rb +2 -2
- data/app/controllers/alchemy/admin/essence_files_controller.rb +4 -2
- data/app/controllers/alchemy/admin/pictures_controller.rb +6 -20
- data/app/controllers/alchemy/admin/resources_controller.rb +7 -5
- data/app/controllers/alchemy/base_controller.rb +14 -4
- data/app/controllers/alchemy/messages_controller.rb +4 -4
- data/app/controllers/alchemy/pages_controller.rb +51 -32
- data/app/controllers/alchemy/pictures_controller.rb +0 -3
- data/app/controllers/alchemy/user_sessions_controller.rb +1 -1
- data/app/helpers/alchemy/admin/base_helper.rb +6 -4
- data/app/helpers/alchemy/base_helper.rb +26 -0
- data/app/helpers/alchemy/pages_helper.rb +42 -22
- data/app/models/alchemy/attachment.rb +10 -2
- data/app/models/alchemy/cell.rb +1 -0
- data/app/models/alchemy/content.rb +8 -6
- data/app/models/alchemy/element.rb +1 -1
- data/app/models/alchemy/essence_audio.rb +1 -8
- data/app/models/alchemy/essence_date.rb +2 -9
- data/app/models/alchemy/essence_file.rb +1 -8
- data/app/models/alchemy/essence_flash.rb +0 -7
- data/app/models/alchemy/essence_html.rb +1 -8
- data/app/models/alchemy/essence_picture.rb +0 -11
- data/app/models/alchemy/essence_richtext.rb +4 -12
- data/app/models/alchemy/essence_text.rb +1 -13
- data/app/models/alchemy/essence_video.rb +1 -8
- data/app/models/alchemy/page.rb +28 -22
- data/app/models/alchemy/picture.rb +19 -0
- data/app/sweepers/alchemy/pages_sweeper.rb +17 -6
- data/app/sweepers/alchemy/pictures_sweeper.rb +1 -3
- data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/_attachment.html.erb +1 -1
- data/app/views/alchemy/admin/attachments/_file_to_assign.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/_files_list.html.erb +13 -11
- data/app/views/alchemy/admin/attachments/create.js.erb +1 -1
- data/app/views/alchemy/admin/attachments/edit.html.erb +2 -2
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +1 -2
- data/app/views/alchemy/admin/elements/new.html.erb +1 -1
- data/app/views/alchemy/admin/essence_files/edit.html.erb +32 -32
- data/app/views/alchemy/admin/essence_pictures/crop.html.erb +29 -29
- data/app/views/alchemy/admin/essence_pictures/update.js.erb +13 -12
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +4 -1
- data/app/views/alchemy/admin/pages/_new_page_form.html.erb +1 -1
- data/app/views/alchemy/admin/pages/edit.html.erb +8 -8
- data/app/views/alchemy/admin/pages/index.html.erb +1 -1
- data/app/views/alchemy/admin/pages/new.html.erb +1 -1
- data/app/views/alchemy/admin/pages/update.js.erb +19 -12
- data/app/views/alchemy/admin/pictures/_picture.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_pictures_list.html.erb +8 -6
- data/app/views/alchemy/admin/pictures/show_in_window.html.erb +6 -1
- data/app/views/alchemy/admin/resources/_table.html.erb +1 -1
- data/app/views/alchemy/admin/users/_table.html.erb +13 -13
- data/app/views/alchemy/admin/users/_user.html.erb +1 -1
- data/app/views/alchemy/admin/users/index.html.erb +2 -2
- data/app/views/alchemy/elements/_contactform_view.html.erb +78 -78
- data/app/views/alchemy/elements/_download_editor.html.erb +1 -0
- data/app/views/alchemy/elements/_download_view.html.erb +3 -0
- data/app/views/alchemy/essences/_essence_date_editor.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_file_editor.html.erb +1 -0
- data/app/views/alchemy/essences/_essence_file_view.html.erb +6 -2
- data/app/views/alchemy/essences/_essence_picture_editor.html.erb +3 -2
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +1 -1
- data/app/views/alchemy/navigation/_link.html.erb +1 -2
- data/app/views/alchemy/notifications/admin_user_created.text.erb +7 -7
- data/app/views/alchemy/notifications/registered_user_created.text.erb +5 -5
- data/app/views/alchemy/user_sessions/login.html.erb +34 -35
- data/app/views/layouts/alchemy/login.html.erb +3 -8
- data/app/views/layouts/alchemy/pages.html.erb +1 -0
- data/bin/alchemy +43 -75
- data/config/alchemy/config.yml +10 -0
- data/config/alchemy/elements.yml +5 -0
- data/config/alchemy/page_layouts.yml +1 -1
- data/config/locales/alchemy.de.yml +21 -8
- data/config/locales/alchemy.en.yml +20 -4
- data/config/routes.rb +25 -20
- data/db/migrate/{20111116125112_namespace_models.rb → 20111116125112_namespace_alchemy_models.rb} +1 -1
- data/lib/alchemy/capistrano.rb +4 -17
- data/lib/alchemy/engine.rb +2 -0
- data/lib/alchemy/essence.rb +29 -41
- data/lib/alchemy/i18n.rb +1 -1
- data/lib/alchemy/mount_point.rb +10 -0
- data/lib/alchemy/page_layout.rb +7 -7
- data/lib/alchemy/seeder.rb +85 -47
- data/lib/alchemy/upgrader.rb +115 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +4 -3
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +6 -2
- data/lib/tasks/ferret.rake +12 -0
- data/lib/tasks/install.rake +16 -105
- data/lib/tasks/routes.rake +29 -0
- data/lib/tasks/upgrade.rake +5 -67
- data/spec/controllers/admin/pages_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +31 -0
- data/spec/factories.rb +24 -15
- data/spec/helpers/admin/base_helper_spec.rb +0 -7
- data/spec/helpers/pages_helper_spec.rb +54 -29
- data/spec/helpers/url_helpers_spec.rb +40 -0
- data/spec/integration/admin/pages_controller_spec.rb +3 -3
- data/spec/integration/pages_controller_spec.rb +80 -6
- data/spec/integration/security_spec.rb +2 -2
- data/spec/models/content_spec.rb +24 -0
- data/spec/models/page_spec.rb +174 -47
- data/spec/models/picture_spec.rb +54 -0
- data/spec/page_layout_spec.rb +2 -2
- data/spec/routing_spec.rb +205 -1
- data/spec/spec_helper.rb +53 -32
- metadata +51 -46
- data/lib/alchemy/file_utilz.rb +0 -73
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -2,8 +2,6 @@ source "http://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem 'declarative_authorization', :git => 'git://github.com/stffn/declarative_authorization.git'
|
6
|
-
|
7
5
|
group :test do
|
8
6
|
gem 'factory_girl_rails'
|
9
7
|
gem "capybara"
|
@@ -17,3 +15,13 @@ group :assets do
|
|
17
15
|
gem 'sass-rails', '~> 3.1.4'
|
18
16
|
gem 'uglifier', '>= 1.0.3'
|
19
17
|
end
|
18
|
+
|
19
|
+
group :development do
|
20
|
+
if !ENV["CI"]
|
21
|
+
gem 'ruby-debug-base19', '~> 0.11.26', :platform => :ruby_19
|
22
|
+
gem 'linecache19', '~> 0.5.13', :platform => :ruby_19
|
23
|
+
gem 'ruby-debug19', '~> 0.11.6', :require => 'ruby-debug', :platform => :ruby_19
|
24
|
+
gem 'ruby-debug', :platform => :ruby_18
|
25
|
+
gem 'guard-spork'
|
26
|
+
end
|
27
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
|
5
|
+
watch(%r{lib/})
|
6
|
+
watch('spec/dummy/config/application.rb')
|
7
|
+
watch('spec/dummy/config/environment.rb')
|
8
|
+
watch(%r{^spec/dummy/config/environments/.+\.rb$})
|
9
|
+
watch(%r{^spec/dummy/config/initializers/.+\.rb$})
|
10
|
+
watch('Gemfile')
|
11
|
+
watch('Gemfile.lock')
|
12
|
+
watch('spec/factories.rb')
|
13
|
+
watch('spec/spec_helper.rb') { :rspec }
|
14
|
+
watch('test/test_helper.rb') { :test_unit }
|
15
|
+
watch(%r{features/support/}) { :cucumber }
|
16
|
+
end
|
data/README.md
CHANGED
@@ -95,14 +95,14 @@ Add to existing Rails project
|
|
95
95
|
|
96
96
|
In your Gemfile:
|
97
97
|
|
98
|
-
gem 'alchemy_cms', '~> 2.1.
|
98
|
+
gem 'alchemy_cms', '~> 2.1.beta7', :git => 'git://github.com/magiclabs/alchemy_cms.git', :branch => 'next_stable'
|
99
99
|
|
100
100
|
Run in terminal:
|
101
101
|
|
102
102
|
bundle install
|
103
|
-
rake alchemy:
|
103
|
+
rake alchemy:install:migrations
|
104
104
|
rake db:migrate
|
105
|
-
rake db:seed
|
105
|
+
rake alchemy:db:seed
|
106
106
|
|
107
107
|
Tipps
|
108
108
|
-----
|
data/Rakefile
CHANGED
@@ -24,11 +24,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
24
24
|
rdoc.rdoc_files.include('app/**/*.rb')
|
25
25
|
end
|
26
26
|
|
27
|
-
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
28
|
-
|
29
|
-
# uncomment the next line if you want to see all dummy app rake tasks
|
30
|
-
# load 'rails/tasks/engine.rake'
|
31
|
-
|
32
27
|
require 'rspec/core'
|
33
28
|
require 'rspec/core/rake_task'
|
34
29
|
|
data/alchemy_cms.gemspec
CHANGED
@@ -32,15 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_runtime_dependency(%q<jquery-rails>, ["~> 1.0.16"])
|
33
33
|
s.add_runtime_dependency(%q<attachment_magic>, ["~> 0.2.1"])
|
34
34
|
|
35
|
-
s.add_development_dependency(%q<rspec-rails>, ["~> 2.
|
35
|
+
s.add_development_dependency(%q<rspec-rails>, ["~> 2.8"])
|
36
36
|
s.add_development_dependency(%q<sqlite3>)
|
37
37
|
|
38
|
-
if !ENV["CI"]
|
39
|
-
if RUBY_VERSION =~ /^1.9/
|
40
|
-
s.add_development_dependency(%q<ruby-debug19>)
|
41
|
-
else
|
42
|
-
s.add_development_dependency(%q<ruby-debug>)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
38
|
end
|
@@ -127,7 +127,6 @@ if (typeof(Alchemy) === 'undefined') {
|
|
127
127
|
|
128
128
|
resizeFrame : function() {
|
129
129
|
var options = {
|
130
|
-
top: 90,
|
131
130
|
left: 65,
|
132
131
|
right: 0
|
133
132
|
};
|
@@ -135,11 +134,12 @@ if (typeof(Alchemy) === 'undefined') {
|
|
135
134
|
var $topFrame = $('#top_menu');
|
136
135
|
var view_height = $(window).height();
|
137
136
|
var view_width = $(window).width();
|
138
|
-
var
|
139
|
-
var
|
137
|
+
var topFrameHeight = $topFrame.height();
|
138
|
+
var mainFrameHeight = view_height - topFrameHeight;
|
140
139
|
var width = view_width - options.left - options.right;
|
141
140
|
if ($mainFrame.length > 0) {
|
142
141
|
$mainFrame.css({
|
142
|
+
top: topFrameHeight,
|
143
143
|
width: width,
|
144
144
|
height: mainFrameHeight
|
145
145
|
});
|
@@ -216,7 +216,8 @@ if (typeof(Alchemy) === 'undefined') {
|
|
216
216
|
|
217
217
|
getUrlParam : function(name){
|
218
218
|
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
|
219
|
-
|
219
|
+
if (results)
|
220
|
+
return results[1] || 0;
|
220
221
|
}
|
221
222
|
|
222
223
|
});
|
File without changes
|
@@ -0,0 +1,96 @@
|
|
1
|
+
if (typeof(Alchemy) === 'undefined') {
|
2
|
+
var Alchemy = {};
|
3
|
+
}
|
4
|
+
|
5
|
+
(function($) {
|
6
|
+
|
7
|
+
var ElementsWindow = {};
|
8
|
+
$.extend(Alchemy, ElementsWindow);
|
9
|
+
|
10
|
+
Alchemy.ElementsWindow = {
|
11
|
+
|
12
|
+
init : function (path, options, callback) {
|
13
|
+
var $dialog = $('<div style="display: none" id="alchemyElementWindow"></div>');
|
14
|
+
var closeCallback = function() {
|
15
|
+
$dialog.dialog("destroy");
|
16
|
+
$('#alchemyElementWindow').remove();
|
17
|
+
Alchemy.ElementsWindow.button.enable();
|
18
|
+
};
|
19
|
+
$dialog.html(Alchemy.getOverlaySpinner({x: 420, y: 300}));
|
20
|
+
Alchemy.ElementsWindow.currentWindow = $dialog.dialog({
|
21
|
+
modal: false,
|
22
|
+
minWidth: 422,
|
23
|
+
minHeight: 300,
|
24
|
+
height: $(window).height() - 90,
|
25
|
+
title: options.texts.title,
|
26
|
+
show: "fade",
|
27
|
+
hide: "fade",
|
28
|
+
position: [$(window).width() - 428, 84],
|
29
|
+
closeOnEscape: false,
|
30
|
+
create: function() {
|
31
|
+
$dialog.before(Alchemy.ElementsWindow.createToolbar(options.toolbarButtons));
|
32
|
+
},
|
33
|
+
open: function(event, ui) {
|
34
|
+
Alchemy.ElementsWindow.button.disable();
|
35
|
+
$.ajax({
|
36
|
+
url: path,
|
37
|
+
success: function(data, textStatus, XMLHttpRequest) {
|
38
|
+
$dialog.html(data);
|
39
|
+
Alchemy.ButtonObserver('#alchemyElementWindow .button');
|
40
|
+
callback.call();
|
41
|
+
},
|
42
|
+
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
43
|
+
Alchemy.AjaxErrorHandler($dialog, XMLHttpRequest.status, textStatus, errorThrown);
|
44
|
+
}
|
45
|
+
});
|
46
|
+
},
|
47
|
+
beforeClose : function() {
|
48
|
+
if (Alchemy.isPageDirty()) {
|
49
|
+
Alchemy.openConfirmWindow({
|
50
|
+
title: options.texts.dirtyTitle,
|
51
|
+
message: options.texts.dirtyMessage,
|
52
|
+
okLabel: options.texts.okLabel,
|
53
|
+
cancelLabel: options.texts.cancelLabel,
|
54
|
+
okCallback: closeCallback
|
55
|
+
});
|
56
|
+
return false;
|
57
|
+
} else {
|
58
|
+
return true;
|
59
|
+
}
|
60
|
+
},
|
61
|
+
close: closeCallback
|
62
|
+
});
|
63
|
+
},
|
64
|
+
|
65
|
+
button : {
|
66
|
+
enable: function() {
|
67
|
+
$('div#show_element_window').removeClass('disabled');
|
68
|
+
},
|
69
|
+
disable: function() {
|
70
|
+
$('div#show_element_window').addClass('disabled');
|
71
|
+
},
|
72
|
+
toggle: function() {
|
73
|
+
$('div#show_element_window').toggleClass('disabled');
|
74
|
+
}
|
75
|
+
},
|
76
|
+
|
77
|
+
createToolbar : function(buttons) {
|
78
|
+
var $toolbar = $('<div id="overlay_toolbar"></div>'), btn;
|
79
|
+
for (i = 0; i < buttons.length; i++) {
|
80
|
+
btn = buttons[i];
|
81
|
+
$toolbar.append(
|
82
|
+
Alchemy.ToolbarButton({
|
83
|
+
buttonTitle: btn.title,
|
84
|
+
buttonLabel: btn.label,
|
85
|
+
iconClass: btn.iconClass,
|
86
|
+
onClick: btn.onClick,
|
87
|
+
buttonId: btn.buttonId
|
88
|
+
})
|
89
|
+
);
|
90
|
+
}
|
91
|
+
return $toolbar;
|
92
|
+
}
|
93
|
+
|
94
|
+
}
|
95
|
+
|
96
|
+
})(jQuery);
|
@@ -1,56 +1,54 @@
|
|
1
1
|
if (typeof(Alchemy) === 'undefined') {
|
2
|
-
|
2
|
+
var Alchemy = {};
|
3
3
|
}
|
4
4
|
|
5
5
|
(function($) {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
}
|
53
|
-
|
6
|
+
|
7
|
+
var ImageCropper = {};
|
8
|
+
ImageCropper.initialized = false;
|
9
|
+
$.extend(Alchemy, ImageCropper);
|
10
|
+
|
11
|
+
Alchemy.ImageCropper = {
|
12
|
+
|
13
|
+
init : function (box, size_x, size_y, default_box, ratio) {
|
14
|
+
var crop_from_field = $('#essence_picture_crop_from');
|
15
|
+
var crop_size_field = $('#essence_picture_crop_size');
|
16
|
+
var options = {
|
17
|
+
onSelect: function(coords) {
|
18
|
+
crop_from_field.val(coords.x + "x" + coords.y);
|
19
|
+
crop_size_field.val(coords.w + "x" + coords.h);
|
20
|
+
},
|
21
|
+
setSelect: box,
|
22
|
+
aspectRatio: ratio ? ratio : undefined,
|
23
|
+
minSize: [size_x, size_y]
|
24
|
+
};
|
25
|
+
Alchemy.ImageCropper.box = box;
|
26
|
+
Alchemy.ImageCropper.default_box = default_box;
|
27
|
+
Alchemy.ImageCropper.crop_from_field = crop_from_field;
|
28
|
+
Alchemy.ImageCropper.crop_size_field = crop_size_field;
|
29
|
+
|
30
|
+
if (!Alchemy.ImageCropper.initialized) {
|
31
|
+
Alchemy.ImageCropper.api = $.Jcrop('#imageToCrop', options);
|
32
|
+
Alchemy.ImageCropper.initialized = true;
|
33
|
+
}
|
34
|
+
$('.ui-dialog-titlebar-close').click(Alchemy.ImageCropper.destroy);
|
35
|
+
},
|
36
|
+
|
37
|
+
undo : function() {
|
38
|
+
Alchemy.ImageCropper.api.setSelect(Alchemy.ImageCropper.box);
|
39
|
+
},
|
40
|
+
|
41
|
+
reset : function() {
|
42
|
+
Alchemy.ImageCropper.api.setSelect(Alchemy.ImageCropper.default_box);
|
43
|
+
Alchemy.ImageCropper.crop_from_field.val('');
|
44
|
+
Alchemy.ImageCropper.crop_size_field.val('');
|
45
|
+
},
|
46
|
+
|
47
|
+
destroy : function() {
|
48
|
+
Alchemy.ImageCropper.api.destroy();
|
49
|
+
Alchemy.ImageCropper.initialized = false;
|
50
|
+
}
|
51
|
+
|
54
52
|
}
|
55
|
-
|
53
|
+
|
56
54
|
})(jQuery);
|
@@ -0,0 +1,41 @@
|
|
1
|
+
if (typeof(Alchemy) === 'undefined') {
|
2
|
+
var Alchemy = {};
|
3
|
+
}
|
4
|
+
|
5
|
+
// Load jQuery on demand. Use this if jQuery is not present.
|
6
|
+
// Found on http://css-tricks.com/snippets/jquery/load-jquery-only-if-not-present/
|
7
|
+
Alchemy.loadjQuery = function(callback) {
|
8
|
+
|
9
|
+
var thisPageUsingOtherJSLibrary = false;
|
10
|
+
|
11
|
+
if (typeof($) === 'function') {
|
12
|
+
thisPageUsingOtherJSLibrary = true;
|
13
|
+
}
|
14
|
+
|
15
|
+
function getScript(url, success) {
|
16
|
+
var script = document.createElement('script');
|
17
|
+
var head = document.getElementsByTagName('head')[0], done = false;
|
18
|
+
script.src = url;
|
19
|
+
// Attach handlers for all browsers
|
20
|
+
script.onload = script.onreadystatechange = function() {
|
21
|
+
if (!done && (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) {
|
22
|
+
done = true;
|
23
|
+
// callback function provided as param
|
24
|
+
success();
|
25
|
+
script.onload = script.onreadystatechange = null;
|
26
|
+
head.removeChild(script);
|
27
|
+
};
|
28
|
+
};
|
29
|
+
head.appendChild(script);
|
30
|
+
};
|
31
|
+
|
32
|
+
getScript('/assets/jquery.min.js', function() {
|
33
|
+
if (typeof(jQuery) !== 'undefined') {
|
34
|
+
if (thisPageUsingOtherJSLibrary) {
|
35
|
+
jQuery.noConflict();
|
36
|
+
}
|
37
|
+
callback();
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
if (typeof(Alchemy) === 'undefined') {
|
2
|
+
var Alchemy = {};
|
3
|
+
}
|
4
|
+
|
5
|
+
Alchemy.loadAlchemyMenuBar = function (options) {
|
6
|
+
|
7
|
+
Alchemy.Menubar = {
|
8
|
+
|
9
|
+
show: function() {
|
10
|
+
$('body').prepend(Alchemy.Menubar.build());
|
11
|
+
},
|
12
|
+
|
13
|
+
build: function() {
|
14
|
+
var bar = $('<div id="alchemy_menubar"/>')
|
15
|
+
.append('<ul/>');
|
16
|
+
bar.find('ul')
|
17
|
+
.append('<li><a href="'+options.route+'/admin">'+Alchemy.Menubar.t("to_alchemy")+'</a></li>')
|
18
|
+
.append('<li><a href="'+options.route+'/admin/pages/'+options.page_id+'/edit">'+Alchemy.Menubar.t("edit_page")+'</a></li>')
|
19
|
+
.append('<li><a href="'+options.route+'/admin/logout">'+Alchemy.Menubar.t("logout")+'</a></li>');
|
20
|
+
return bar;
|
21
|
+
},
|
22
|
+
|
23
|
+
translations: {
|
24
|
+
'to_alchemy' : {
|
25
|
+
'de' : 'zu Alchemy',
|
26
|
+
'en' : 'To Alchemy'
|
27
|
+
},
|
28
|
+
'edit_page' : {
|
29
|
+
'de' : 'Seite bearbeiten',
|
30
|
+
'en' : 'Edit Page'
|
31
|
+
},
|
32
|
+
'logout' : {
|
33
|
+
'de' : 'abmelden',
|
34
|
+
'en' : 'Log out'
|
35
|
+
}
|
36
|
+
},
|
37
|
+
|
38
|
+
t : function(id) {
|
39
|
+
var translation = Alchemy.Menubar.translations[id];
|
40
|
+
if (translation) {
|
41
|
+
return translation[options.locale];
|
42
|
+
} else {
|
43
|
+
return id;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
};
|
48
|
+
|
49
|
+
if (typeof(jQuery) === 'undefined') {
|
50
|
+
Alchemy.loadjQuery(Alchemy.Menubar.show);
|
51
|
+
} else {
|
52
|
+
Alchemy.Menubar.show();
|
53
|
+
}
|
54
|
+
|
55
|
+
};
|
@@ -1,145 +1,100 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
'-moz-outline-radius' : '4px',
|
26
|
-
'outline-radius' : '4px'
|
27
|
-
},
|
28
|
-
selected : {
|
29
|
-
'outline-width' : '2px',
|
30
|
-
'outline-style' : 'solid',
|
31
|
-
'outline-color' : '#DB694C',
|
32
|
-
'outline-offset' : '4px',
|
33
|
-
'-moz-outline-radius' : '4px',
|
34
|
-
'outline-radius' : '4px'
|
35
|
-
},
|
36
|
-
},
|
37
|
-
|
38
|
-
scrollOffset : 20,
|
39
|
-
|
40
|
-
init : function() {
|
41
|
-
var self = Alchemy.ElementSelector;
|
42
|
-
var $elements = $('[data-alchemy-element]');
|
43
|
-
var styles = self.styles;
|
44
|
-
$elements.bind('mouseover', function(e) {
|
45
|
-
$(this).attr('title', 'Klicken zum bearbeiten');
|
46
|
-
if (!$(this).hasClass('selected'))
|
47
|
-
$(this).css(styles.hover);
|
48
|
-
});
|
49
|
-
$elements.bind('mouseout', function() {
|
50
|
-
$(this).removeAttr('title');
|
51
|
-
if (!$(this).hasClass('selected'))
|
52
|
-
$(this).css(styles.reset);
|
53
|
-
});
|
54
|
-
$elements.bind('Alchemy.SelectElement', self.selectElement);
|
55
|
-
$elements.bind('click', self.clickElement);
|
56
|
-
self.$previewElements = $elements;
|
57
|
-
},
|
58
|
-
|
59
|
-
selectElement : function(e) {
|
60
|
-
var $this = $(this);
|
61
|
-
var self = Alchemy.ElementSelector;
|
62
|
-
var $elements = self.$previewElements;
|
63
|
-
var styles = self.styles;
|
64
|
-
var offset = self.scrollOffset;
|
65
|
-
e.preventDefault();
|
66
|
-
$elements.removeClass('selected').css(styles.reset);
|
67
|
-
$this.addClass('selected').css(styles.selected);
|
68
|
-
$('html, body').animate({
|
69
|
-
scrollTop: $this.offset().top - offset,
|
70
|
-
scrollLeft: $this.offset().left - offset
|
71
|
-
}, 400);
|
1
|
+
if (typeof(Alchemy) === 'undefined') {
|
2
|
+
var Alchemy = {};
|
3
|
+
}
|
4
|
+
|
5
|
+
Alchemy.initAlchemyPreviewMode = function() {
|
6
|
+
|
7
|
+
// Setting jQueryUIs global animation duration
|
8
|
+
$.fx.speeds._default = 400;
|
9
|
+
|
10
|
+
// The Alchemy JavaScript Object contains all Functions
|
11
|
+
$.extend(Alchemy, {
|
12
|
+
|
13
|
+
ElementSelector : {
|
14
|
+
|
15
|
+
// defaults
|
16
|
+
styles : {
|
17
|
+
reset : { outline: '0 none' },
|
18
|
+
hover : {
|
19
|
+
'outline-width' : '2px',
|
20
|
+
'outline-style' : 'solid',
|
21
|
+
'outline-color' : '#98BAD5',
|
22
|
+
'outline-offset' : '4px',
|
23
|
+
'-moz-outline-radius' : '4px',
|
24
|
+
'outline-radius' : '4px'
|
72
25
|
},
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
e.preventDefault();
|
81
|
-
$element_editor.trigger('Alchemy.SelectElementEditor', target_id);
|
82
|
-
if ($elementsWindow.dialog("isOpen")) {
|
83
|
-
$elementsWindow.dialog('moveToTop');
|
84
|
-
} else {
|
85
|
-
$elementsWindow.dialog('open');
|
86
|
-
}
|
87
|
-
$this.trigger('Alchemy.SelectElement');
|
26
|
+
selected : {
|
27
|
+
'outline-width' : '2px',
|
28
|
+
'outline-style' : 'solid',
|
29
|
+
'outline-color' : '#DB694C',
|
30
|
+
'outline-offset' : '4px',
|
31
|
+
'-moz-outline-radius' : '4px',
|
32
|
+
'outline-radius' : '4px'
|
88
33
|
},
|
89
|
-
|
90
34
|
},
|
91
|
-
|
92
|
-
});
|
93
|
-
|
94
|
-
})(jQuery);
|
95
|
-
|
96
|
-
Alchemy.ElementSelector.init();
|
97
|
-
|
98
|
-
}
|
99
35
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
36
|
+
scrollOffset : 20,
|
37
|
+
|
38
|
+
init : function() {
|
39
|
+
var self = Alchemy.ElementSelector;
|
40
|
+
var $elements = $('[data-alchemy-element]');
|
41
|
+
var styles = self.styles;
|
42
|
+
$elements.bind('mouseover', function(e) {
|
43
|
+
$(this).attr('title', 'Klicken zum bearbeiten');
|
44
|
+
if (!$(this).hasClass('selected'))
|
45
|
+
$(this).css(styles.hover);
|
46
|
+
});
|
47
|
+
$elements.bind('mouseout', function() {
|
48
|
+
$(this).removeAttr('title');
|
49
|
+
if (!$(this).hasClass('selected'))
|
50
|
+
$(this).css(styles.reset);
|
51
|
+
});
|
52
|
+
$elements.bind('Alchemy.SelectElement', self.selectElement);
|
53
|
+
$elements.bind('click', self.clickElement);
|
54
|
+
self.$previewElements = $elements;
|
55
|
+
},
|
104
56
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
getScript('/assets/jquery.min.js', function() {
|
133
|
-
if (typeof(jQuery) !== 'undefined') {
|
134
|
-
if (thisPageUsingOtherJSLibrary) {
|
135
|
-
jQuery.noConflict();
|
57
|
+
selectElement : function(e) {
|
58
|
+
var $this = $(this);
|
59
|
+
var self = Alchemy.ElementSelector;
|
60
|
+
var $elements = self.$previewElements;
|
61
|
+
var styles = self.styles;
|
62
|
+
var offset = self.scrollOffset;
|
63
|
+
e.preventDefault();
|
64
|
+
$elements.removeClass('selected').css(styles.reset);
|
65
|
+
$this.addClass('selected').css(styles.selected);
|
66
|
+
$('html, body').animate({
|
67
|
+
scrollTop: $this.offset().top - offset,
|
68
|
+
scrollLeft: $this.offset().left - offset
|
69
|
+
}, 400);
|
70
|
+
},
|
71
|
+
|
72
|
+
clickElement : function(e) {
|
73
|
+
var $this = $(this);
|
74
|
+
var parent$ = window.parent.jQuery;
|
75
|
+
var target_id = $this.attr('data-alchemy-element');
|
76
|
+
var $element_editor = parent$('#element_area .element_editor').closest('[id="element_'+target_id+'"]');
|
77
|
+
var $elementsWindow = parent$('#alchemyElementWindow');
|
78
|
+
e.preventDefault();
|
79
|
+
$element_editor.trigger('Alchemy.SelectElementEditor', target_id);
|
80
|
+
if ($elementsWindow.dialog("isOpen")) {
|
81
|
+
$elementsWindow.dialog('moveToTop');
|
82
|
+
} else {
|
83
|
+
$elementsWindow.dialog('open');
|
136
84
|
}
|
137
|
-
|
138
|
-
}
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
85
|
+
$this.trigger('Alchemy.SelectElement');
|
86
|
+
},
|
87
|
+
|
88
|
+
},
|
89
|
+
|
90
|
+
});
|
91
|
+
|
92
|
+
Alchemy.ElementSelector.init();
|
93
|
+
|
94
|
+
}
|
95
|
+
|
96
|
+
if (typeof(jQuery) === 'undefined') {
|
97
|
+
Alchemy.loadjQuery(Alchemy.initAlchemyPreviewMode);
|
98
|
+
} else {
|
99
|
+
Alchemy.initAlchemyPreviewMode();
|
100
|
+
}
|