alchemy_cms 3.0.0.rc5 → 3.0.0.rc6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -5
  3. data/README.md +32 -5
  4. data/alchemy_cms.gemspec +1 -1
  5. data/app/assets/javascripts/alchemy/alchemy.buttons.js.coffee +3 -3
  6. data/app/assets/javascripts/alchemy/alchemy.char_counter.js.coffee +19 -0
  7. data/app/assets/javascripts/alchemy/alchemy.confirm_dialog.js.coffee +5 -0
  8. data/app/assets/javascripts/alchemy/alchemy.dialog.js.coffee +3 -2
  9. data/app/assets/javascripts/alchemy/alchemy.dragndrop.js.coffee +2 -0
  10. data/app/assets/javascripts/alchemy/alchemy.element_editors.js.coffee +1 -1
  11. data/app/assets/javascripts/alchemy/alchemy.elements_window.js.coffee +2 -26
  12. data/app/assets/javascripts/alchemy/alchemy.file_progress.js.coffee +1 -1
  13. data/app/assets/javascripts/alchemy/alchemy.gui.js.coffee +2 -0
  14. data/app/assets/javascripts/alchemy/alchemy.i18n.js.coffee +12 -7
  15. data/app/assets/javascripts/alchemy/alchemy.js +1 -1
  16. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +33 -4
  17. data/app/assets/javascripts/alchemy/alchemy.preview_window.js.coffee +1 -1
  18. data/app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee +2 -13
  19. data/app/assets/javascripts/alchemy/{alchemy.tinymce.js.coffee.erb → alchemy.tinymce.js.coffee} +1 -25
  20. data/app/assets/javascripts/alchemy/alchemy.translations.js.coffee +63 -105
  21. data/app/assets/javascripts/alchemy/alchemy.uploader.js.coffee +3 -3
  22. data/app/assets/stylesheets/alchemy/_extends.scss +2 -8
  23. data/app/assets/stylesheets/alchemy/_mixins.scss +4 -9
  24. data/app/assets/stylesheets/alchemy/base.scss +6 -6
  25. data/app/assets/stylesheets/alchemy/buttons.scss +56 -29
  26. data/app/assets/stylesheets/alchemy/elements.scss +66 -14
  27. data/app/assets/stylesheets/alchemy/form_fields.scss +39 -6
  28. data/app/assets/stylesheets/alchemy/forms.scss +32 -0
  29. data/app/assets/stylesheets/alchemy/frame.scss +44 -44
  30. data/app/assets/stylesheets/alchemy/icons.scss +2 -2
  31. data/app/assets/stylesheets/alchemy/jquery-ui.scss +2 -0
  32. data/app/assets/stylesheets/alchemy/notices.scss +6 -0
  33. data/app/assets/stylesheets/alchemy/selects.scss +10 -0
  34. data/app/assets/stylesheets/alchemy/sitemap.scss +8 -10
  35. data/app/assets/stylesheets/alchemy/toolbar.scss +40 -31
  36. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +11 -22
  37. data/app/controllers/alchemy/admin/base_controller.rb +14 -1
  38. data/app/controllers/alchemy/admin/elements_controller.rb +4 -2
  39. data/app/controllers/alchemy/admin/layoutpages_controller.rb +5 -0
  40. data/app/controllers/alchemy/admin/legacy_page_urls_controller.rb +39 -0
  41. data/app/controllers/alchemy/admin/pages_controller.rb +0 -3
  42. data/app/controllers/alchemy/base_controller.rb +7 -4
  43. data/app/helpers/alchemy/admin/base_helper.rb +33 -3
  44. data/app/helpers/alchemy/pages_helper.rb +1 -1
  45. data/app/models/alchemy/element.rb +6 -4
  46. data/app/models/alchemy/legacy_page_url.rb +5 -1
  47. data/app/models/alchemy/message.rb +2 -2
  48. data/app/models/alchemy/page.rb +8 -9
  49. data/app/models/alchemy/page/{cells.rb → page_cells.rb} +1 -1
  50. data/app/models/alchemy/page/{elements.rb → page_elements.rb} +1 -1
  51. data/app/models/alchemy/page/{naming.rb → page_naming.rb} +33 -18
  52. data/app/models/alchemy/page/{natures.rb → page_natures.rb} +1 -1
  53. data/app/models/alchemy/page/{scopes.rb → page_scopes.rb} +1 -1
  54. data/app/models/alchemy/page/{users.rb → page_users.rb} +13 -1
  55. data/app/views/alchemy/admin/elements/_add_element_button.html.erb +18 -0
  56. data/app/views/alchemy/admin/elements/_add_picture.html.erb +1 -1
  57. data/app/views/alchemy/admin/elements/_element.html.erb +12 -11
  58. data/app/views/alchemy/admin/elements/_new_element_form.html.erb +3 -0
  59. data/app/views/alchemy/admin/elements/create.js.erb +3 -3
  60. data/app/views/alchemy/admin/elements/index.html.erb +19 -4
  61. data/app/views/alchemy/admin/elements/new.html.erb +3 -0
  62. data/app/views/alchemy/admin/elements/trash.js.erb +16 -12
  63. data/app/views/alchemy/admin/layoutpages/_layoutpage.html.erb +1 -1
  64. data/app/views/alchemy/admin/layoutpages/edit.html.erb +11 -0
  65. data/app/views/alchemy/admin/layoutpages/index.html.erb +4 -16
  66. data/app/views/alchemy/admin/legacy_page_urls/_form.html.erb +5 -0
  67. data/app/views/alchemy/admin/legacy_page_urls/_label.html.erb +1 -0
  68. data/app/views/alchemy/admin/legacy_page_urls/_legacy_page_url.html.erb +13 -0
  69. data/app/views/alchemy/admin/legacy_page_urls/_new.html.erb +20 -0
  70. data/app/views/alchemy/admin/legacy_page_urls/create.js.erb +10 -0
  71. data/app/views/alchemy/admin/legacy_page_urls/destroy.js.erb +6 -0
  72. data/app/views/alchemy/admin/legacy_page_urls/update.js.erb +2 -0
  73. data/app/views/alchemy/admin/pages/_form.html.erb +58 -0
  74. data/app/views/alchemy/admin/pages/_internal_link.html.erb +9 -4
  75. data/app/views/alchemy/admin/pages/_legacy_urls.html.erb +23 -0
  76. data/app/views/alchemy/admin/pages/_locked_page.html.erb +21 -0
  77. data/app/views/alchemy/admin/pages/_page.html.erb +2 -2
  78. data/app/views/alchemy/admin/pages/_page_status.html.erb +11 -9
  79. data/app/views/alchemy/admin/pages/_tinymce_custom_config.html.erb +13 -0
  80. data/app/views/alchemy/admin/pages/configure.html.erb +16 -57
  81. data/app/views/alchemy/admin/pages/edit.html.erb +64 -66
  82. data/app/views/alchemy/admin/pages/index.html.erb +9 -19
  83. data/app/views/alchemy/admin/pages/update.js.erb +1 -1
  84. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +7 -12
  85. data/app/views/alchemy/admin/partials/_routes.html.erb +25 -0
  86. data/app/views/alchemy/admin/partials/_search_form.html.erb +10 -12
  87. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +53 -47
  88. data/app/views/alchemy/admin/pictures/index.html.erb +34 -29
  89. data/app/views/alchemy/essences/shared/_essence_picture_tools.html.erb +1 -1
  90. data/app/views/alchemy/navigation/_link.html.erb +9 -9
  91. data/app/views/alchemy/pages/show.rss.builder +2 -2
  92. data/app/views/layouts/alchemy/admin.html.erb +20 -9
  93. data/bin/alchemy +1 -1
  94. data/config/alchemy/config.yml +1 -0
  95. data/config/locales/alchemy.de.yml +15 -1
  96. data/config/locales/alchemy.en.yml +29 -19
  97. data/config/locales/alchemy.nl.yml +11 -1
  98. data/config/routes.rb +2 -1
  99. data/lib/alchemy/errors.rb +2 -2
  100. data/lib/alchemy/permissions.rb +2 -0
  101. data/lib/alchemy/resource.rb +22 -9
  102. data/lib/alchemy/tinymce.rb +13 -7
  103. data/lib/alchemy/version.rb +1 -1
  104. data/spec/controllers/admin/base_controller_spec.rb +39 -0
  105. data/spec/controllers/admin/elements_controller_spec.rb +17 -14
  106. data/spec/controllers/admin/pages_controller_spec.rb +1 -2
  107. data/spec/controllers/pages_controller_spec.rb +7 -3
  108. data/spec/dummy/app/models/dummy_user.rb +12 -2
  109. data/spec/features/admin/dashboard_spec.rb +45 -0
  110. data/spec/features/admin/legacy_page_url_management_spec.rb +62 -0
  111. data/spec/features/admin/page_editing_feature_spec.rb +66 -6
  112. data/spec/features/page_feature_spec.rb +13 -0
  113. data/spec/helpers/admin/base_helper_spec.rb +36 -0
  114. data/spec/libraries/resource_spec.rb +168 -84
  115. data/spec/libraries/tinymce_spec.rb +10 -0
  116. data/spec/models/element_spec.rb +16 -0
  117. data/spec/models/legacy_page_url_spec.rb +21 -0
  118. data/spec/models/message_spec.rb +23 -7
  119. data/spec/models/page_spec.rb +89 -12
  120. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.min.js +1 -0
  121. data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.min.js +1 -0
  122. metadata +96 -75
  123. data/app/assets/javascripts/alchemy/alchemy.routes.js.erb +0 -38
  124. data/spec/models/resource_spec.rb +0 -159
@@ -1,38 +0,0 @@
1
- // This object provides dynamically generated Rails routes in Javascript.
2
- // A little bit hacky, but the best solution so far. ^_^
3
- <% self.class.instance_eval { include Alchemy::Engine.routes.url_helpers } %>
4
-
5
- if (typeof(Alchemy) === 'undefined') {
6
- var Alchemy = {};
7
- }
8
-
9
- (function($) {
10
-
11
- var routes = {};
12
- $.extend(Alchemy, routes);
13
-
14
- Alchemy.routes = {
15
-
16
- admin_picture_path: function(id) {
17
- return '<%= admin_picture_path(:id => 1) %>'.replace(/1/, id);
18
- },
19
-
20
- admin_trash_path: function(page_id) {
21
- var url = '<%= admin_trash_path %>';
22
- if (page_id) url += '?page_id=' + page_id;
23
- return url;
24
- },
25
-
26
- fold_admin_element_path: function(id) {
27
- return '<%= fold_admin_element_path(:id => 1) %>'.replace(/1/, id);
28
- },
29
-
30
- list_admin_elements_path: '<%= list_admin_elements_path %>',
31
- order_admin_contents_path: '<%= order_admin_contents_path %>',
32
- order_admin_elements_path: '<%= order_admin_elements_path %>',
33
- order_admin_pages_path: '<%= order_admin_pages_path %>',
34
- link_admin_pages_path: '<%= link_admin_pages_path %>'
35
-
36
- }
37
-
38
- })(jQuery);
@@ -1,159 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Alchemy
4
- describe Resource do
5
-
6
- def module_definition
7
- {
8
- "name" => "event_list",
9
- "engine_name" => "event_engine",
10
- "navigation" => {
11
- "name" => "modules.event_list",
12
- "controller" => "admin/events",
13
- "action" => "index",
14
- "image" => "/assets/event_list_module.png"
15
- }
16
- }
17
- end
18
-
19
- let(:resource) { Resource.new("admin/events", module_definition) }
20
-
21
- describe "#initialize" do
22
- it "should set an instance variable that holds the controller path" do
23
- resource.instance_variable_get(:@controller_path).should == "admin/events"
24
- end
25
-
26
- it "should set an instance variable that holds the module definition" do
27
- resource.instance_variable_get(:@module_definition).should == module_definition
28
- end
29
-
30
- it "should set the standard database attributes (rails defaults) to be skipped" do
31
- resource.skip_attributes.should == %W[id updated_at created_at creator_id updater_id]
32
- end
33
- end
34
-
35
- describe "#model" do
36
- it "should return the classified and constantized model name" do
37
- resource.model.should == Event
38
- end
39
- end
40
-
41
- describe "#resources_name" do
42
- it "should return the resources name as a string" do
43
- resource.resources_name.should == "events"
44
- end
45
- end
46
-
47
- describe "#resource_name" do
48
- it "should return the model name (singularized and as a string)" do
49
- resource.resource_name.should == "event"
50
- end
51
- end
52
-
53
- describe "#namespace_for_scope" do
54
- it "should return the namespace" do
55
- resource.namespace_for_scope.should == ["admin"]
56
- end
57
- end
58
-
59
- describe "#attributes" do
60
- it "should not return the to-be-skipped attributes" do
61
- resource.class.const_get(:DEFAULT_SKIPPED_ATTRIBUTES).each do |skipped_attr|
62
- resource.attributes.detect { |a| a[:name] == skipped_attr }.should == nil
63
- end
64
- end
65
-
66
- context "when skip_attributes is defined as class-method in the model" do
67
- before do
68
- Event.class_eval do
69
- def self.skip_attributes
70
- %W[hidden_name]
71
- end
72
- end
73
- end
74
- after do
75
- Event.class_eval do
76
- class << self
77
- undef :skip_attributes
78
- end
79
- end
80
- end
81
-
82
- it "should not return the attributes returned by that method" do
83
- resource.attributes.detect { |a| a[:name] == 'hidden_name' }.should be_nil
84
- resource.attributes.detect { |a| a[:name] == 'name' }.should_not be_nil
85
- end
86
- end
87
-
88
- context "when alchemy_resource_relations defined as class-method in the model" do
89
- before do
90
- Event.class_eval do
91
- def self.alchemy_resource_relations
92
- {
93
- :location => {:attr_method => "name", :attr_type => :string}
94
- }
95
- end
96
- end
97
- end
98
-
99
- it "should contain model_association from ActiveRecord::Reflections" do
100
- relation = resource.resource_relations[:location_id]
101
- relation.keys.should include(:model_association)
102
- relation[:model_association].class.should be(ActiveRecord::Reflection::AssociationReflection)
103
- end
104
-
105
- it "should skip default alchemy model associations" do
106
- resource.model_associations.collect(&:name).should_not include(*resource.class.const_get(:DEFAULT_SKIPPED_ASSOCIATIONS).map(&:to_sym))
107
- end
108
-
109
- it "should add _id to relation key" do
110
- resource.resource_relations[:location_id].should_not be_nil
111
- end
112
-
113
- it "should store the relation name" do
114
- relation = resource.resource_relations[:location_id]
115
- relation.keys.should include(:name)
116
- relation[:name].should == 'location'
117
- end
118
-
119
- context "#attributes" do
120
- it "should contain the relation" do
121
- resource.attributes.detect { |a| a[:name] == 'location_id' }.keys.should include(:relation)
122
- end
123
-
124
- it "should have the relation column type as type" do
125
- resource.attributes.detect { |a| a[:name] == "location_id" }[:type].should == :string
126
- end
127
- end
128
-
129
- after do
130
- Event.class_eval do
131
- class << self
132
- undef :alchemy_resource_relations
133
- end
134
- end
135
- end
136
- end
137
-
138
- context "when resource_relation is not defined" do
139
- it "should use the attribute location_id" do
140
- resource.attributes.detect { |a| a[:name] == "location_id" }.should == {:name => "location_id", :type => :integer}
141
- end
142
- end
143
-
144
- end
145
-
146
- describe "#engine_name" do
147
- it "should return the engine name of the module" do
148
- resource.engine_name.should == "event_engine"
149
- end
150
- end
151
-
152
- describe "#in_engine?" do
153
- it "should return true if the module is shipped within an engine" do
154
- resource.in_engine?.should == true
155
- end
156
- end
157
-
158
- end
159
- end