alchemy_cms 2.4.1 → 2.5.0.b2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. data/.travis.yml +1 -1
  2. data/README.md +18 -17
  3. data/alchemy_cms.gemspec +5 -10
  4. data/app/assets/images/alchemy/icons.png +0 -0
  5. data/app/assets/stylesheets/alchemy/archive.scss +27 -0
  6. data/app/assets/stylesheets/alchemy/base.scss +0 -51
  7. data/app/assets/stylesheets/alchemy/elements.scss +37 -2
  8. data/app/assets/stylesheets/alchemy/icons.scss +4 -0
  9. data/app/assets/stylesheets/alchemy/modules.scss +4 -0
  10. data/app/assets/stylesheets/alchemy/sitemap.scss +1 -1
  11. data/app/assets/stylesheets/alchemy/tables.scss +1 -1
  12. data/app/assets/stylesheets/alchemy/variables.scss +1 -0
  13. data/app/controllers/alchemy/admin/pages_controller.rb +1 -0
  14. data/app/controllers/alchemy/admin/pictures_controller.rb +22 -8
  15. data/app/controllers/alchemy/admin/resources_controller.rb +1 -1
  16. data/app/controllers/alchemy/admin/sites_controller.rb +6 -0
  17. data/app/controllers/alchemy/base_controller.rb +8 -0
  18. data/app/controllers/alchemy/elements_controller.rb +33 -3
  19. data/app/controllers/alchemy/messages_controller.rb +47 -40
  20. data/app/controllers/alchemy/pages_controller.rb +8 -31
  21. data/app/controllers/alchemy/pictures_controller.rb +64 -30
  22. data/app/helpers/alchemy/admin/base_helper.rb +7 -0
  23. data/app/helpers/alchemy/admin/pages_helper.rb +12 -0
  24. data/app/helpers/alchemy/elements_helper.rb +2 -0
  25. data/app/helpers/alchemy/pages_helper.rb +30 -10
  26. data/app/helpers/alchemy/url_helper.rb +1 -0
  27. data/app/models/alchemy/content.rb +1 -2
  28. data/app/models/alchemy/element.rb +47 -2
  29. data/app/models/alchemy/language.rb +27 -14
  30. data/app/models/alchemy/page.rb +1 -1
  31. data/app/models/alchemy/picture.rb +46 -41
  32. data/app/models/alchemy/site.rb +44 -0
  33. data/app/views/alchemy/admin/elements/_element_head.html.erb +1 -0
  34. data/app/views/alchemy/admin/languages/index.html.erb +23 -0
  35. data/app/views/alchemy/admin/pages/edit.html.erb +27 -1
  36. data/app/views/alchemy/admin/pages/fold.js.erb +1 -0
  37. data/app/views/alchemy/admin/partials/_upload_form.html.erb +2 -0
  38. data/app/views/alchemy/admin/pictures/_picture.html.erb +24 -2
  39. data/app/views/alchemy/admin/pictures/_tag_list.html.erb +5 -4
  40. data/app/views/alchemy/admin/pictures/create.js.erb +1 -9
  41. data/app/views/alchemy/admin/pictures/info.html.erb +42 -0
  42. data/app/views/alchemy/admin/resources/_form.html.erb +0 -2
  43. data/app/views/alchemy/admin/resources/_resource.html.erb +2 -1
  44. data/app/views/alchemy/admin/resources/index.html.erb +2 -1
  45. data/app/views/alchemy/elements/show.html.erb +1 -6
  46. data/app/views/alchemy/elements/show.js.erb +4 -10
  47. data/app/views/alchemy/essences/_essence_link_view.html.erb +1 -0
  48. data/app/views/alchemy/search/_form.html.erb +9 -6
  49. data/app/views/alchemy/search/_result.html.erb +1 -1
  50. data/bin/alchemy +13 -120
  51. data/config/alchemy/config.yml +7 -11
  52. data/config/alchemy/modules.yml +24 -12
  53. data/config/authorization_rules.rb +6 -2
  54. data/config/initializers/dragonfly.rb +20 -0
  55. data/config/locales/alchemy.de.yml +57 -28
  56. data/config/locales/alchemy.en.yml +18 -4
  57. data/config/routes.rb +4 -2
  58. data/db/migrate/20121121162313_switch_from_fleximage_to_dragonfly.rb +21 -0
  59. data/db/migrate/20121205155004_create_alchemy_sites.rb +14 -0
  60. data/db/migrate/20121211163003_add_public_to_alchemy_sites.rb +6 -0
  61. data/lib/alchemy/capistrano.rb +7 -2
  62. data/lib/alchemy/ferret_search.rb +84 -0
  63. data/lib/alchemy/picture_attributes.rb +29 -0
  64. data/lib/alchemy/seeder.rb +10 -16
  65. data/lib/alchemy/upgrader.rb +59 -8
  66. data/lib/alchemy/version.rb +1 -1
  67. data/lib/alchemy_cms.rb +7 -4
  68. data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +3 -0
  69. data/lib/rails/generators/alchemy/elements/elements_generator.rb +5 -1
  70. data/lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb +1 -0
  71. data/lib/rails/generators/alchemy/scaffold/files/{pages.html.erb → application.html.erb} +0 -0
  72. data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +11 -20
  73. data/lib/rails/templates/alchemy.rb +1 -7
  74. data/lib/tasks/{database.rake → alchemy/db.rake} +1 -1
  75. data/lib/tasks/{install.rake → alchemy/install.rake} +9 -14
  76. data/lib/tasks/{upgrade.rake → alchemy/upgrade.rake} +1 -1
  77. data/spec/controllers/elements_controller_spec.rb +24 -9
  78. data/spec/controllers/pictures_controller_spec.rb +11 -8
  79. data/{app → spec/dummy/app}/views/alchemy/elements/_article_editor.html.erb +0 -0
  80. data/{app → spec/dummy/app}/views/alchemy/elements/_article_view.html.erb +0 -0
  81. data/{app → spec/dummy/app}/views/alchemy/elements/_headline_view.html.erb +0 -0
  82. data/{app → spec/dummy/app}/views/alchemy/elements/_news_view.html.erb +0 -0
  83. data/{app → spec/dummy/app}/views/alchemy/elements/_searchresult_view.html.erb +0 -0
  84. data/{app → spec/dummy/app}/views/alchemy/page_layouts/_standard.html.erb +0 -0
  85. data/spec/dummy/config/alchemy/elements.yml +86 -0
  86. data/spec/dummy/config/alchemy/page_layouts.yml +26 -0
  87. data/spec/dummy/config/application.rb +1 -1
  88. data/spec/dummy/db/migrate/20121121162313_switch_from_fleximage_to_dragonfly.rb +21 -0
  89. data/spec/dummy/db/migrate/20121205155004_create_alchemy_sites.rb +14 -0
  90. data/spec/dummy/db/migrate/20121211163003_add_public_to_alchemy_sites.rb +6 -0
  91. data/spec/dummy/db/schema.rb +21 -6
  92. data/spec/factories.rb +6 -2
  93. data/spec/integration/translation_integration_spec.rb +4 -18
  94. data/spec/models/element_spec.rb +4 -4
  95. data/spec/models/picture_spec.rb +37 -20
  96. data/spec/models/site_spec.rb +69 -0
  97. data/spec/routing_spec.rb +115 -115
  98. data/spec/spec_helper.rb +1 -3
  99. data/spec/support/alchemy/specs_helpers.rb +4 -4
  100. data/vendor/assets/javascripts/jquery_plugins/jquery.html5uploader.js +1 -1
  101. metadata +72 -96
  102. data/app/assets/stylesheets/alchemy/standard_set.css +0 -440
  103. data/app/views/alchemy/elements/_bild_editor.html.erb +0 -1
  104. data/app/views/alchemy/elements/_bild_text_editor.html.erb +0 -7
  105. data/app/views/alchemy/elements/_bild_text_view.html.erb +0 -9
  106. data/app/views/alchemy/elements/_bild_view.html.erb +0 -9
  107. data/app/views/alchemy/elements/_claim_editor.html.erb +0 -1
  108. data/app/views/alchemy/elements/_claim_view.html.erb +0 -1
  109. data/app/views/alchemy/elements/_contactform_editor.html.erb +0 -4
  110. data/app/views/alchemy/elements/_contactform_view.html.erb +0 -78
  111. data/app/views/alchemy/elements/_download_editor.html.erb +0 -4
  112. data/app/views/alchemy/elements/_download_view.html.erb +0 -7
  113. data/app/views/alchemy/elements/_footnote_editor.html.erb +0 -1
  114. data/app/views/alchemy/elements/_footnote_view.html.erb +0 -5
  115. data/app/views/alchemy/elements/_header_editor.html.erb +0 -1
  116. data/app/views/alchemy/elements/_header_view.html.erb +0 -1
  117. data/app/views/alchemy/elements/_headline_editor.html.erb +0 -1
  118. data/app/views/alchemy/elements/_image_mosaic_editor.html.erb +0 -3
  119. data/app/views/alchemy/elements/_image_mosaic_view.html.erb +0 -14
  120. data/app/views/alchemy/elements/_intro_editor.html.erb +0 -1
  121. data/app/views/alchemy/elements/_intro_image_text_editor.html.erb +0 -3
  122. data/app/views/alchemy/elements/_intro_image_text_view.html.erb +0 -16
  123. data/app/views/alchemy/elements/_intro_view.html.erb +0 -3
  124. data/app/views/alchemy/elements/_news_editor.html.erb +0 -3
  125. data/app/views/alchemy/elements/_searchresult_editor.html.erb +0 -4
  126. data/app/views/alchemy/elements/_sitemap_editor.html.erb +0 -3
  127. data/app/views/alchemy/elements/_sitemap_view.html.erb +0 -38
  128. data/app/views/alchemy/elements/_sitename_editor.html.erb +0 -1
  129. data/app/views/alchemy/elements/_sitename_view.html.erb +0 -1
  130. data/app/views/alchemy/elements/_subheadline_editor.html.erb +0 -1
  131. data/app/views/alchemy/elements/_subheadline_view.html.erb +0 -5
  132. data/app/views/alchemy/elements/_text_editor.html.erb +0 -1
  133. data/app/views/alchemy/elements/_text_view.html.erb +0 -3
  134. data/app/views/alchemy/page_layouts/_contact.html.erb +0 -14
  135. data/app/views/alchemy/page_layouts/_external.html.erb +0 -0
  136. data/app/views/alchemy/page_layouts/_intro.html.erb +0 -14
  137. data/app/views/alchemy/page_layouts/_layout_footer.html.erb +0 -14
  138. data/app/views/alchemy/page_layouts/_layout_header.html.erb +0 -14
  139. data/app/views/alchemy/page_layouts/_news.html.erb +0 -14
  140. data/app/views/alchemy/page_layouts/_newsletter_layout.html.erb +0 -1
  141. data/app/views/alchemy/page_layouts/_search.html.erb +0 -14
  142. data/app/views/alchemy/pictures/show.gif.flexi +0 -19
  143. data/app/views/alchemy/pictures/show.jpg.flexi +0 -19
  144. data/app/views/alchemy/pictures/show.png.flexi +0 -19
  145. data/app/views/alchemy/pictures/thumbnail.png.flexi +0 -13
  146. data/app/views/alchemy/pictures/zoom.jpg.flexi +0 -3
  147. data/app/views/alchemy/pictures/zoom.png.flexi +0 -3
  148. data/app/views/layouts/alchemy/pages.html.erb +0 -51
  149. data/config/alchemy/elements.yml +0 -274
  150. data/config/alchemy/page_layouts.yml +0 -75
  151. data/config/asset_packages.yml +0 -30
  152. data/config/initializers/localeapp.rb +0 -9
  153. data/lib/rails/generators/alchemy/plugin/files/translation.pot +0 -3
  154. data/lib/rails/generators/alchemy/plugin/files/translation_de.po +0 -3
  155. data/lib/rails/generators/alchemy/plugin/files/translation_en.po +0 -3
  156. data/lib/rails/generators/alchemy/plugin/plugin_generator.rb +0 -37
  157. data/lib/rails/generators/alchemy/plugin/templates/authorization_rules.rb +0 -34
  158. data/lib/rails/generators/alchemy/plugin/templates/config.yml +0 -30
  159. data/lib/rails/generators/alchemy/plugin/templates/init.rb +0 -1
  160. data/lib/rails/generators/alchemy/plugin/templates/plugin.rb +0 -0
  161. data/lib/rails/generators/alchemy/plugin/templates/routes.rb +0 -10
  162. data/lib/tasks/fleximage.rake +0 -154
  163. data/spec/dummy/app/views/layouts/.gitkeep +0 -0
@@ -1,9 +0,0 @@
1
- # unless ENV['CI']
2
-
3
- # require 'localeapp/rails'
4
-
5
- # Localeapp.configure do |config|
6
- # config.api_key = 'afwgJCX6Xq40Y2gQSU9sdYFJ2XmQdAhgKmZPd69TOLdsT7e4Sy'
7
- # end
8
-
9
- # end
@@ -1,3 +0,0 @@
1
- # Your plugins translation.
2
- msgid "Hello world"
3
- msgstr ""
@@ -1,3 +0,0 @@
1
- # Your plugins german translation.
2
- msgid "Hello world"
3
- msgstr "Hallo Welt"
@@ -1,3 +0,0 @@
1
- # Your plugins english translation.
2
- msgid "Hello world"
3
- msgstr ""
@@ -1,37 +0,0 @@
1
- require 'rails'
2
-
3
- module Alchemy
4
- module Generators
5
- class PluginGenerator < ::Rails::Generators::Base
6
- desc "This generator generates a Alchemy plugin skeleton for you."
7
- argument :plugin_name, :banner => "your_plugin_name"
8
- source_root File.expand_path('templates', File.dirname(__FILE__))
9
-
10
- def create_directories
11
- @plugin_name = plugin_name.underscore
12
- @plugin_path = Rails.root.join('vendor/plugins', @plugin_name)
13
- empty_directory "#{@plugin_path}/lib/#{@plugin_name}"
14
- empty_directory "#{@plugin_path}/rails"
15
- empty_directory "#{@plugin_path}/app/controllers/admin"
16
- empty_directory "#{@plugin_path}/app/models"
17
- empty_directory "#{@plugin_path}/app/views/admin"
18
- empty_directory "#{@plugin_path}/config/alchemy"
19
- empty_directory "#{@plugin_path}/config/initializers"
20
- empty_directory "#{@plugin_path}/locale/de"
21
- empty_directory "#{@plugin_path}/locale/en"
22
- end
23
-
24
- def create_defaults
25
- copy_file("#{File.dirname(__FILE__)}/files/translation.pot", "#{@plugin_path}/locale/#{@plugin_name}.pot")
26
- copy_file("#{File.dirname(__FILE__)}/files/translation_de.po", "#{@plugin_path}/locale/de/#{@plugin_name}.po")
27
- copy_file("#{File.dirname(__FILE__)}/files/translation_en.po", "#{@plugin_path}/locale/en/#{@plugin_name}.po")
28
- template("config.yml", "#{@plugin_path}/config/alchemy/config.yml")
29
- template("authorization_rules.rb", "#{@plugin_path}/config/authorization_rules.rb")
30
- template("routes.rb", "#{@plugin_path}/config/routes.rb")
31
- template("plugin.rb", "#{@plugin_path}/lib/#{@plugin_name}.rb")
32
- template("init.rb", "#{@plugin_path}/rails/init.rb")
33
- end
34
-
35
- end
36
- end
37
- end
@@ -1,34 +0,0 @@
1
- # Define permissions for your plugin in here.
2
- # See https://github.com/stffn/declarative_authorization for further informations.
3
- authorization do
4
-
5
- role :guest do
6
- has_permission_on :<%= @plugin_name.tableize %>, :to => [:show]
7
- end
8
-
9
- role :registered do
10
- includes :guest
11
- end
12
-
13
- role :author do
14
- includes :registered
15
- end
16
-
17
- role :editor do
18
- includes :author
19
- end
20
-
21
- role :admin do
22
- includes :editor
23
- has_permission_on :admin_<%= @plugin_name.tableize %>, :to => [:manage]
24
- end
25
-
26
- end
27
-
28
- privileges do
29
-
30
- privilege :manage do
31
- includes :index, :new, :create, :show, :edit, :update, :destroy
32
- end
33
-
34
- end
@@ -1,30 +0,0 @@
1
- # This is your plugin configuration file.
2
- # ========================================
3
- #
4
- # Options:
5
- # --------
6
- #
7
- # name: # Name of your plugin [String]
8
- # order: # [Optional] Use this to set the order of plugins in the alchemy navigation, if more then one plugin is loaded. [Integer]
9
- # settings: # [Optional] Put your own settings in YAML format into here. You can access them with plugin_conf('<%= @plugin_name.underscore %>')['settings'] [YAML]
10
- # navigation:
11
- # name: # The name is used in the Alchemy mainnavi. [String]
12
- # controller: # The name of the controller to be called when clicking the mainnavi button. Example usage: 'admin/controllername' [String]
13
- # action: # The name of the action from the controller to be called when clicking the mainnavi button [String]
14
- # icon: # CSS classname for the link in the alchemy mainnavi. [String]
15
- # sub_navigation: # Your plugins sub navigation. Put as much as sub navi entries as you want into here
16
- # - name: # [String]
17
- # controller: # Typically your controller and action you set for mainnavi entry.
18
- # action: # [String]
19
-
20
- name: <%= @plugin_name %>
21
-
22
- navigation:
23
- name: <%= @plugin_name.camelcase %>
24
- controller: admin/<%= @plugin_name.tableize %>
25
- action: index
26
- image: <%= @plugin_name %>/<%= @plugin_name %>.png
27
- sub_navigation:
28
- - name: <%= @plugin_name.camelcase %>
29
- controller: admin/<%= @plugin_name.tableize %>
30
- action: index
@@ -1 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'lib/<%= @plugin_name %>')
@@ -1,10 +0,0 @@
1
- # Put your plugin routes into here.
2
- Rails.application.routes.draw do
3
-
4
- resources :<%= @plugin_name.tableize %>
5
-
6
- namespace :admin do
7
- resources :<%= @plugin_name.tableize %>
8
- end
9
-
10
- end
@@ -1,154 +0,0 @@
1
- namespace :fleximage do
2
-
3
- # Find the model class
4
- def model_class
5
- raise 'You must specify a FLEXIMAGE_CLASS=MyClass' unless ENV['FLEXIMAGE_CLASS']
6
- @model_class ||= ENV['FLEXIMAGE_CLASS'].camelcase.constantize
7
- end
8
-
9
- desc "Populate width and height magic columns from the current image store. Useful when migrating from on old installation."
10
- task :dimensions => :environment do
11
- model_class.find(:all).each do |obj|
12
- if obj.has_image?
13
- img = obj.load_image
14
- obj.update_column :image_width, img.columns if obj.respond_to?(:image_width=)
15
- obj.update_column :image_height, img.rows if obj.respond_to?(:image_height=)
16
- end
17
- end
18
- end
19
-
20
- namespace :convert do
21
-
22
- def convert_directory_format(to_format)
23
- model_class.find(:all).each do |obj|
24
-
25
- # Get the creation date
26
- creation = obj[:created_at] || obj[:created_on] || Date.today
27
-
28
- # Generate both types of file paths
29
- flat_path = "#{RAILS_ROOT}/#{model_class.image_directory}/#{obj.id}.#{model_class.image_storage_format}"
30
- nested_path = "#{RAILS_ROOT}/#{model_class.image_directory}/#{creation.year}/#{creation.month}/#{creation.day}/#{obj.id}.#{model_class.image_storage_format}"
31
-
32
- # Assign old path and new path based on desired directory format
33
- if to_format == :nested
34
- old_path = flat_path
35
- new_path = nested_path
36
- else
37
- old_path = nested_path
38
- new_path = flat_path
39
- end
40
-
41
- # Move the files
42
- if old_path != new_path && File.exists?(old_path)
43
- FileUtils.mkdir_p(File.dirname(new_path))
44
- FileUtils.move old_path, new_path
45
- puts "#{old_path} -> #{new_path}"
46
- end
47
- end
48
- end
49
-
50
- def convert_image_format(to_format)
51
- model_class.find(:all).each do |obj|
52
-
53
- # convert DB stored images
54
- if model_class.db_store?
55
- if obj.image_file_data && obj.image_file_data.any?
56
- begin
57
- image = Magick::Image.from_blob(obj.image_file_data).first
58
- image.format = to_format.to_s.upcase
59
- obj.image_file_data = image.to_blob
60
- obj.save
61
- rescue Exception => e
62
- puts "Could not convert image for #{model_class} with id #{obj.id}\n #{e.class} #{e}\n"
63
- end
64
- end
65
-
66
- # Convert file system stored images
67
- else
68
- # Generate both types of file paths
69
- png_path = obj.file_path.gsub(/\.jpg$/, '.png')
70
- jpg_path = obj.file_path.gsub(/\.png$/, '.jpg')
71
-
72
- # Output stub
73
- output = (to_format == :jpg) ? 'PNG -> JPG' : 'JPG -> PNG'
74
-
75
- # Assign old path and new path based on desired image format
76
- if to_format == :jpg
77
- old_path = png_path
78
- new_path = jpg_path
79
- else
80
- old_path = jpg_path
81
- new_path = png_path
82
- end
83
-
84
- # Perform conversion
85
- if File.exists?(old_path)
86
- image = Magick::Image.read(old_path).first
87
- image.format = to_format.to_s.upcase
88
- image.write(new_path)
89
- File.delete(old_path)
90
-
91
- puts "#{output} : Image #{obj.id}"
92
- end
93
- end
94
- end
95
- end
96
-
97
- def ensure_db_store
98
- col = model_class.columns.find { |c| c.name == 'image_file_data' }
99
- unless col && col.type == :binary
100
- raise "No image_file_data field of type :binary for this model!"
101
- end
102
- end
103
-
104
- desc "Convert a flat images/123.png style image store to a images/2007/11/12/123.png style. Requires FLEXIMAGE_CLASS=ModelName"
105
- task :to_nested => :environment do
106
- convert_directory_format :nested
107
- end
108
-
109
- desc "Convert a nested images/2007/11/12/123.png style image store to a images/123.png style. Requires FLEXIMAGE_CLASS=ModelName"
110
- task :to_flat => :environment do
111
- convert_directory_format :flat
112
- end
113
-
114
- desc "Convert master images stored as JPGs to PNGs"
115
- task :to_png => :environment do
116
- convert_image_format :png
117
- end
118
-
119
- desc "Convert master images stored as PNGs to JPGs"
120
- task :to_jpg => :environment do
121
- convert_image_format :jpg
122
- end
123
-
124
- desc "Convert master image storage to use the database. Loads all file-stored images into the database."
125
- task :to_db => :environment do
126
- ensure_db_store
127
- model_class.find(:all).each do |obj|
128
- if File.exists?(obj.file_path)
129
- File.open(obj.file_path, 'rb') do |f|
130
- obj.image_file_data = f.read
131
- obj.save
132
- end
133
- end
134
- end
135
-
136
- puts "--- All images successfully moved to the database. Check to make sure the transfer worked cleanly before deleting your file system image store."
137
- end
138
-
139
- desc "Convert master image storage to use the file system. Loads all database images into files."
140
- task :to_filestore => :environment do
141
- ensure_db_store
142
- model_class.find(:all).each do |obj|
143
- if obj.image_file_data && obj.image_file_data.any?
144
- File.open(obj.file_path, 'wb+') do |f|
145
- f.write obj.image_file_data
146
- end
147
- end
148
- end
149
-
150
- puts "--- All images successfully moved to the file system. Remember to remove your image_file_data field from your models database table."
151
- end
152
-
153
- end
154
- end
File without changes