alchemy_cms 3.0.0.rc7 → 3.0.0.rc8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/README.md +1 -1
- data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +0 -2
- data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +26 -2
- data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +1 -1
- data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +22 -0
- data/app/assets/stylesheets/alchemy/base.scss +1 -5
- data/app/assets/stylesheets/alchemy/elements.scss +11 -61
- data/app/assets/stylesheets/alchemy/frame.scss +1 -1
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +1 -1
- data/app/controllers/alchemy/admin/attachments_controller.rb +1 -1
- data/app/controllers/alchemy/admin/base_controller.rb +7 -13
- data/app/controllers/alchemy/admin/clipboard_controller.rb +15 -10
- data/app/controllers/alchemy/admin/elements_controller.rb +15 -11
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +8 -1
- data/app/controllers/alchemy/admin/pages_controller.rb +95 -22
- data/app/controllers/alchemy/admin/tags_controller.rb +1 -1
- data/app/controllers/alchemy/pictures_controller.rb +33 -32
- data/app/helpers/alchemy/admin/base_helper.rb +3 -16
- data/app/models/alchemy/element.rb +1 -1
- data/app/models/alchemy/page/page_naming.rb +4 -2
- data/app/models/alchemy/page/page_natures.rb +1 -1
- data/app/models/alchemy/page.rb +20 -1
- data/app/models/alchemy/picture.rb +1 -0
- data/app/models/alchemy/tree_node.rb +4 -0
- data/app/views/alchemy/admin/contents/destroy.js.erb +4 -0
- data/app/views/alchemy/admin/dashboard/index.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element.html.erb +11 -12
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +0 -3
- data/app/views/alchemy/admin/elements/create.js.erb +3 -3
- data/app/views/alchemy/admin/elements/index.html.erb +4 -19
- data/app/views/alchemy/admin/elements/new.html.erb +0 -3
- data/app/views/alchemy/admin/elements/trash.js.erb +12 -16
- data/app/views/alchemy/admin/pages/_page.html.erb +1 -1
- data/app/views/alchemy/admin/pages/edit.html.erb +36 -30
- data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +1 -1
- data/app/views/alchemy/admin/trash/clear.js.erb +4 -0
- data/config/locales/alchemy.de.yml +56 -84
- data/config/locales/alchemy.en.yml +326 -105
- data/config/locales/alchemy.fr.yml +942 -0
- data/config/locales/alchemy.nl.yml +111 -137
- data/config/locales/simple_form.fr.yml +26 -0
- data/lib/alchemy/engine.rb +7 -1
- data/lib/alchemy/i18n.rb +7 -1
- data/lib/alchemy/middleware/rescue_old_cookies.rb +27 -0
- data/lib/alchemy/permissions.rb +1 -1
- data/lib/alchemy/version.rb +1 -1
- data/spec/controllers/admin/clipboard_controller_spec.rb +16 -19
- data/spec/controllers/admin/elements_controller_spec.rb +20 -23
- data/spec/controllers/admin/essence_pictures_controller_spec.rb +22 -6
- data/spec/controllers/admin/pages_controller_spec.rb +94 -5
- data/spec/controllers/pictures_controller_spec.rb +44 -3
- data/spec/features/admin/link_overlay_spec.rb +1 -0
- data/spec/features/admin/locale_select_feature_spec.rb +22 -0
- data/spec/libraries/i18n_spec.rb +30 -0
- data/spec/libraries/permissions_spec.rb +1 -1
- data/spec/models/element_spec.rb +5 -4
- data/spec/models/page_spec.rb +137 -8
- data/spec/spec_helper.rb +23 -19
- data/vendor/assets/javascripts/jquery_plugins/jquery.ui.nestedSortable.js +9 -3
- metadata +12 -10
- data/app/models/alchemy/clipboard.rb +0 -74
- data/app/views/alchemy/admin/contents/destroy.js.coffee +0 -4
- data/app/views/alchemy/admin/elements/_add_element_button.html.erb +0 -18
- data/app/views/alchemy/admin/trash/clear.js.coffee +0 -4
- data/spec/models/clipboard_spec.rb +0 -111
- data/spec/support/phantomjs_mavericks_fix.rb +0 -32
@@ -1,74 +0,0 @@
|
|
1
|
-
module Alchemy
|
2
|
-
|
3
|
-
# The Clipboard holds element ids and page ids
|
4
|
-
#
|
5
|
-
# It is stored inside the session.
|
6
|
-
#
|
7
|
-
# Each entry can has an action keyword that describes what to do after pasting the item.
|
8
|
-
#
|
9
|
-
# The keyword can be one of 'copy' or 'cut'
|
10
|
-
class Clipboard
|
11
|
-
|
12
|
-
attr_accessor :items
|
13
|
-
|
14
|
-
def initialize
|
15
|
-
@items = self.class.empty_clipboard
|
16
|
-
end
|
17
|
-
|
18
|
-
# Returns all items of the collection from category (+:elements+ or +:pages+)
|
19
|
-
def all(item_type)
|
20
|
-
@items.fetch(item_type.to_sym)
|
21
|
-
end
|
22
|
-
alias_method :[], :all
|
23
|
-
|
24
|
-
# Returns the item from collection of category (+:elements+ or +:pages+)
|
25
|
-
def get(item_type, item_id)
|
26
|
-
all(item_type).detect { |item| item[:id].to_i == item_id.to_i }
|
27
|
-
end
|
28
|
-
|
29
|
-
# Returns true if the id is already in the collection of category (+:elements+ or +:pages+)
|
30
|
-
def contains?(item_type, item_id)
|
31
|
-
all(item_type).collect { |item| item[:id].to_i }.include?(item_id.to_i)
|
32
|
-
end
|
33
|
-
|
34
|
-
# Insert an item into the collection of category (+:elements+ or +:pages+)
|
35
|
-
def push(item_type, item)
|
36
|
-
all(item_type).push(normalized(item))
|
37
|
-
end
|
38
|
-
|
39
|
-
def replace(item_type, item)
|
40
|
-
all(item_type).replace(item.is_a?(Array) ? item : [item])
|
41
|
-
end
|
42
|
-
alias_method :[]=, :replace
|
43
|
-
|
44
|
-
def remove(item_type, item_id)
|
45
|
-
all(item_type).delete_if { |item| item[:id].to_i == item_id.to_i }
|
46
|
-
end
|
47
|
-
|
48
|
-
def clear(item_type = nil)
|
49
|
-
if item_type
|
50
|
-
all(item_type).clear
|
51
|
-
else
|
52
|
-
@items = self.class.empty_clipboard
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def empty?
|
57
|
-
@items == self.class.empty_clipboard
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def normalized(item)
|
63
|
-
item[:id] = item[:id].to_i
|
64
|
-
item
|
65
|
-
end
|
66
|
-
|
67
|
-
protected
|
68
|
-
|
69
|
-
def self.empty_clipboard
|
70
|
-
{:elements => [], :pages => []}
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<%= link_to_dialog new_admin_element_path(
|
2
|
-
page_id: @page.id,
|
3
|
-
insert_after: local_assigns[:element_before].try(:id)
|
4
|
-
),
|
5
|
-
{
|
6
|
-
title: _t("New Element"),
|
7
|
-
size: '320x125'
|
8
|
-
},
|
9
|
-
{
|
10
|
-
class: "#{local_assigns[:expanded] ? 'expanded ' : ''}insert-element-button",
|
11
|
-
id: local_assigns[:id],
|
12
|
-
title: _t("New Element")
|
13
|
-
} do %>
|
14
|
-
<%= render_icon 'create' %>
|
15
|
-
<label>
|
16
|
-
<%= _t('New Element') %>
|
17
|
-
</label>
|
18
|
-
<% end %>
|
@@ -1,111 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
module Alchemy
|
4
|
-
describe Clipboard do
|
5
|
-
|
6
|
-
let(:clipboard) { Clipboard.new }
|
7
|
-
|
8
|
-
describe "#new" do
|
9
|
-
it "should be a hash with empty elements and pages collections" do
|
10
|
-
clipboard[:elements].should == []
|
11
|
-
clipboard[:pages].should == []
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#push' do
|
16
|
-
it "should add item to clipboard category" do
|
17
|
-
clipboard.push :elements, {:id => 1}
|
18
|
-
clipboard[:elements].should == [{:id => 1}]
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#replace' do
|
23
|
-
|
24
|
-
it "should replace the category items with new item" do
|
25
|
-
clipboard.replace(:elements, {:id => 1})
|
26
|
-
clipboard[:elements].should == [{:id => 1}]
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should replace the category items with new item collection" do
|
30
|
-
clipboard.replace(:elements, [{:id => 1}])
|
31
|
-
clipboard[:elements].should == [{:id => 1}]
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should be aliased with []= " do
|
35
|
-
clipboard[:elements] = [{:id => 1}]
|
36
|
-
clipboard[:elements].should == [{:id => 1}]
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
describe '#empty?' do
|
42
|
-
it "should return true if clipboard is empty" do
|
43
|
-
clipboard.empty?.should be_true
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context "full clipboard" do
|
48
|
-
|
49
|
-
before do
|
50
|
-
clipboard[:elements] = [{:id => 1}, {:id => 2}]
|
51
|
-
clipboard[:pages] = [{:id => 2}, {:id => 3}]
|
52
|
-
end
|
53
|
-
|
54
|
-
describe "#all" do
|
55
|
-
|
56
|
-
context "with :elements as parameter" do
|
57
|
-
it "should return all element items in clipboard" do
|
58
|
-
clipboard[:elements].should == [{:id => 1}, {:id => 2}]
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context "with :pages as parameter" do
|
63
|
-
it "should return all page items in clipboard" do
|
64
|
-
clipboard[:pages].should == [{:id => 2}, {:id => 3}]
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#contains?' do
|
71
|
-
it "should return true if elements id is in collection" do
|
72
|
-
clipboard.contains?(:elements, 1).should be_true
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe '#remove' do
|
77
|
-
it "should remove item from category collection" do
|
78
|
-
clipboard.remove(:elements, 1)
|
79
|
-
clipboard[:elements].should == [{:id => 2}]
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe '#clear' do
|
84
|
-
|
85
|
-
context "passing a category" do
|
86
|
-
it "should clear the category collection" do
|
87
|
-
clipboard.clear(:elements)
|
88
|
-
clipboard[:elements].should be_empty
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
context "passing no category" do
|
93
|
-
it "should clear the complete clipboard" do
|
94
|
-
clipboard.clear
|
95
|
-
clipboard.should be_empty
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
describe '#get' do
|
102
|
-
it "should return element from collection" do
|
103
|
-
clipboard[:elements] = [{:id => 1}]
|
104
|
-
clipboard.get(:elements, 1).should == {:id => 1}
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
111
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Capybara::Poltergeist
|
2
|
-
class Client
|
3
|
-
private
|
4
|
-
def redirect_stdout
|
5
|
-
prev = STDOUT.dup
|
6
|
-
prev.autoclose = false
|
7
|
-
$stdout = @write_io
|
8
|
-
STDOUT.reopen(@write_io)
|
9
|
-
|
10
|
-
prev = STDERR.dup
|
11
|
-
prev.autoclose = false
|
12
|
-
$stderr = @write_io
|
13
|
-
STDERR.reopen(@write_io)
|
14
|
-
yield
|
15
|
-
ensure
|
16
|
-
STDOUT.reopen(prev)
|
17
|
-
$stdout = STDOUT
|
18
|
-
STDERR.reopen(prev)
|
19
|
-
$stderr = STDERR
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
module Alchemy
|
25
|
-
class WarningSuppressor
|
26
|
-
class << self
|
27
|
-
def write(message)
|
28
|
-
if message =~ /QFont::setPixelSize: Pixel size <= 0/ || message =~/CoreText performance note:/ then 0 else puts(message);1;end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|