refinerycms 0.9.8 → 0.9.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. data/Gemfile +6 -6
  2. data/app/controllers/application_controller.rb +2 -1
  3. data/bin/refinerycms +36 -32
  4. data/changelog.md +471 -0
  5. data/config/environments/production.rb +1 -1
  6. data/db/migrate/20100606135207_change_thumbnail_sizes_for_dragonfly.rb +4 -4
  7. data/db/migrate/20100826232810_move_inquiry_settings_to_refinery_settings.rb +2 -2
  8. data/db/migrate/20100831122919_move_page_to_nested_set.rb +28 -0
  9. data/db/schema.rb +7 -1
  10. data/db/seeds/refinery_settings.rb +2 -4
  11. data/license.md +21 -0
  12. data/readme.md +97 -0
  13. data/todo.md +61 -0
  14. data/vendor/refinerycms/authentication/app/views/admin/users/index.html.erb +5 -13
  15. data/vendor/refinerycms/authentication/app/views/layouts/login.html.erb +1 -1
  16. data/vendor/refinerycms/authentication/config/locales/de.yml +53 -56
  17. data/vendor/refinerycms/authentication/config/locales/en.yml +1 -2
  18. data/vendor/refinerycms/authentication/config/locales/lv.yml +38 -38
  19. data/vendor/refinerycms/authentication/config/locales/pt-BR.yml +21 -48
  20. data/vendor/refinerycms/authentication/features/lost_password.feature +40 -0
  21. data/vendor/refinerycms/authentication/features/manage_users.feature +57 -0
  22. data/vendor/refinerycms/authentication/features/step_definitions/lost_password.rb +8 -0
  23. data/vendor/refinerycms/authentication/features/step_definitions/user_steps.rb +32 -0
  24. data/vendor/refinerycms/authentication/features/support/factories.rb +17 -0
  25. data/vendor/refinerycms/authentication/features/support/paths.rb +24 -0
  26. data/vendor/refinerycms/authentication/lib/authenticated_system.rb +1 -1
  27. data/vendor/refinerycms/authentication/lib/authentication.rb +1 -1
  28. data/vendor/refinerycms/core/app/views/admin/_head.html.erb +4 -4
  29. data/vendor/refinerycms/core/app/views/admin/_menu_tab.html.erb +2 -2
  30. data/vendor/refinerycms/core/app/views/layouts/admin.html.erb +1 -1
  31. data/vendor/refinerycms/core/app/views/layouts/admin_dialog.html.erb +1 -1
  32. data/vendor/refinerycms/core/app/views/shared/_footer.html.erb +1 -1
  33. data/vendor/refinerycms/core/app/views/shared/_google_analytics.html.erb +1 -1
  34. data/vendor/refinerycms/core/app/views/shared/_header.html.erb +1 -1
  35. data/vendor/refinerycms/core/app/views/shared/_menu.html.erb +5 -2
  36. data/vendor/refinerycms/core/app/views/shared/_menu_branch.html.erb +6 -3
  37. data/vendor/refinerycms/core/app/views/shared/_site_bar.html.erb +11 -15
  38. data/vendor/refinerycms/core/app/views/shared/admin/_form_actions.html.erb +1 -0
  39. data/vendor/refinerycms/core/app/views/shared/admin/_image_picker.html.erb +3 -3
  40. data/vendor/refinerycms/core/app/views/shared/admin/_make_sortable.html.erb +2 -1
  41. data/vendor/refinerycms/core/app/views/shared/admin/_resource_picker.html.erb +24 -17
  42. data/vendor/refinerycms/core/app/views/wymiframe.html.erb +1 -1
  43. data/vendor/refinerycms/core/config/locales/de.yml +50 -51
  44. data/vendor/refinerycms/core/config/locales/en.yml +5 -2
  45. data/vendor/refinerycms/core/config/locales/lv.yml +6 -3
  46. data/vendor/refinerycms/core/config/locales/pt-BR.yml +34 -38
  47. data/vendor/refinerycms/core/crud.md +12 -12
  48. data/vendor/refinerycms/core/features/engine_generator.feature +27 -0
  49. data/vendor/refinerycms/core/features/search.feature +56 -0
  50. data/vendor/refinerycms/core/features/site_bar.feature +24 -0
  51. data/vendor/refinerycms/core/features/step_definitions/core_steps.rb +61 -0
  52. data/vendor/refinerycms/core/features/step_definitions/engine_generator_steps.rb +19 -0
  53. data/vendor/refinerycms/core/features/step_definitions/generator_steps.rb +11 -0
  54. data/vendor/refinerycms/core/features/support/paths.rb +14 -0
  55. data/vendor/refinerycms/core/features/uploads/beach.jpeg +0 -0
  56. data/vendor/refinerycms/core/features/uploads/refinery_is_awesome.txt +1 -0
  57. data/vendor/refinerycms/core/lib/core.rb +52 -53
  58. data/vendor/refinerycms/core/lib/generators/refinery_engine/refinery_engine_generator.rb +14 -3
  59. data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/controllers/admin/plural_name_controller.rb +3 -1
  60. data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/models/singular_name.rb +4 -3
  61. data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/views/admin/plural_name/_form.html.erb +2 -1
  62. data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/views/admin/plural_name/_singular_name.html.erb +6 -2
  63. data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/views/plural_name/index.html.erb +3 -1
  64. data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/views/plural_name/show.html.erb +7 -3
  65. data/vendor/refinerycms/core/lib/refinery/application_controller.rb +85 -75
  66. data/vendor/refinerycms/core/lib/refinery/application_helper.rb +10 -190
  67. data/vendor/refinerycms/core/lib/refinery/crud.rb +283 -0
  68. data/vendor/refinerycms/core/lib/refinery/{form_helpers.rb → helpers/form_helper.rb} +0 -0
  69. data/vendor/refinerycms/core/lib/refinery/helpers/html_truncation_helper.rb +26 -0
  70. data/vendor/refinerycms/core/lib/refinery/helpers/image_helper.rb +37 -0
  71. data/vendor/refinerycms/core/lib/refinery/helpers/menu_helper.rb +38 -0
  72. data/vendor/refinerycms/core/lib/refinery/helpers/meta_helper.rb +67 -0
  73. data/vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb +36 -0
  74. data/vendor/refinerycms/core/lib/refinery/helpers/site_bar_helper.rb +26 -0
  75. data/vendor/refinerycms/core/lib/refinery/helpers/tag_helper.rb +19 -0
  76. data/vendor/refinerycms/core/lib/refinery/helpers/translation_helper.rb +17 -0
  77. data/vendor/refinerycms/core/lib/refinery/plugin.rb +3 -3
  78. data/vendor/refinerycms/core/lib/tasks/refinery.rake +4 -3
  79. data/vendor/refinerycms/core/public/javascripts/refinery/admin.js +93 -101
  80. data/vendor/refinerycms/core/public/javascripts/refinery/core.js +3 -0
  81. data/vendor/refinerycms/core/public/javascripts/refinery/nestedsortables.js +164 -0
  82. data/vendor/refinerycms/core/public/javascripts/refinery/serializelist.js +66 -0
  83. data/vendor/refinerycms/core/public/stylesheets/refinery/refinery.css +11 -73
  84. data/vendor/refinerycms/dashboard/config/locales/de.yml +6 -6
  85. data/vendor/refinerycms/dashboard/config/locales/pt-BR.yml +3 -5
  86. data/vendor/refinerycms/dashboard/features/dashboard.feature +54 -0
  87. data/vendor/refinerycms/dashboard/features/support/paths.rb +14 -0
  88. data/vendor/refinerycms/images/app/controllers/admin/images_controller.rb +6 -6
  89. data/vendor/refinerycms/images/app/helpers/admin/images_helper.rb +1 -1
  90. data/vendor/refinerycms/images/app/views/admin/images/_existing_image.html.erb +15 -13
  91. data/vendor/refinerycms/images/app/views/admin/images/_grid_view.html.erb +1 -1
  92. data/vendor/refinerycms/images/app/views/admin/images/_list_view_image.html.erb +1 -1
  93. data/vendor/refinerycms/images/config/locales/de.yml +21 -25
  94. data/vendor/refinerycms/images/config/locales/pt-BR.yml +13 -23
  95. data/vendor/refinerycms/images/features/manage_images.feature +48 -0
  96. data/vendor/refinerycms/images/features/step_definitions/image_steps.rb +37 -0
  97. data/vendor/refinerycms/images/features/support/paths.rb +17 -0
  98. data/vendor/refinerycms/images/features/uploads/beach.jpeg +0 -0
  99. data/vendor/refinerycms/images/features/uploads/id-rather-be-here.jpg +0 -0
  100. data/vendor/refinerycms/images/features/uploads/refinery_is_awesome.txt +1 -0
  101. data/vendor/refinerycms/images/lib/images.rb +6 -0
  102. data/vendor/refinerycms/images/readme.md +12 -36
  103. data/vendor/refinerycms/pages/app/controllers/admin/pages_controller.rb +4 -42
  104. data/vendor/refinerycms/pages/app/controllers/pages_controller.rb +1 -1
  105. data/vendor/refinerycms/pages/app/models/page.rb +3 -4
  106. data/vendor/refinerycms/pages/app/sweepers/page_sweeper.rb +18 -0
  107. data/vendor/refinerycms/pages/app/views/admin/pages/_form_advanced_options.html.erb +1 -1
  108. data/vendor/refinerycms/pages/app/views/admin/pages/_page.html.erb +6 -5
  109. data/vendor/refinerycms/pages/config/locales/de.yml +66 -36
  110. data/vendor/refinerycms/pages/config/locales/pt-BR.yml +29 -57
  111. data/vendor/refinerycms/pages/features/manage_pages.feature +45 -0
  112. data/vendor/refinerycms/pages/features/step_definitions/page_steps.rb +29 -0
  113. data/vendor/refinerycms/pages/features/support/paths.rb +18 -0
  114. data/vendor/refinerycms/pages/lib/pages.rb +5 -0
  115. data/vendor/refinerycms/pages/spec/models/page_spec.rb +13 -0
  116. data/vendor/refinerycms/refinery.rb +1 -1
  117. data/vendor/refinerycms/resources/app/views/admin/resources/_existing_resource.html.erb +2 -2
  118. data/vendor/refinerycms/resources/config/locales/de.yml +16 -17
  119. data/vendor/refinerycms/resources/config/locales/pt-BR.yml +15 -17
  120. data/vendor/refinerycms/resources/features/manage_files.feature +39 -0
  121. data/vendor/refinerycms/resources/features/step_definitions/file_steps.rb +21 -0
  122. data/vendor/refinerycms/resources/features/support/paths.rb +17 -0
  123. data/vendor/refinerycms/resources/features/uploads/beach.jpeg +0 -0
  124. data/vendor/refinerycms/resources/features/uploads/refinery_is_awesome.txt +1 -0
  125. data/vendor/refinerycms/resources/lib/resources.rb +17 -1
  126. data/vendor/refinerycms/settings/app/models/refinery_setting.rb +82 -64
  127. data/vendor/refinerycms/settings/config/locales/de.yml +36 -16
  128. data/vendor/refinerycms/settings/config/locales/pt-BR.yml +32 -34
  129. data/vendor/refinerycms/settings/features/manage_refinery_settings.feature +5 -0
  130. data/vendor/refinerycms/settings/lib/settings.rb +1 -1
  131. metadata +86 -53
  132. data/vendor/refinerycms/core/lib/crud.rb +0 -265
  133. data/vendor/refinerycms/core/lib/refinery/html_truncation_helper.rb +0 -22
  134. data/vendor/refinerycms/core/public/javascripts/jquery/jquery.nestedsortables.js +0 -186
@@ -1,23 +1,20 @@
1
1
  pt-BR:
2
2
  plugins:
3
- images:
4
- title: Imagens
5
3
  refinery_images:
6
4
  title: Imagens
7
- no_file_chosen: Você deve escolher um arquivo para enviar
8
- image_should_be_smaller_than_max_image_size: Arquivos devem possuir menos de %{max_image_size} de tamanho
9
- image_must_be_these_formats: Sua imagem deve ser uma JPG, PNG ou GIF
5
+ description: Gerenciar imagens
6
+ image_specify_for_upload: Você deve escolher uma imagem para enviar
7
+ image_should_be_smaller_than_max_image_size: "Imagem deve possuir menos de %{max_image_size} de tamanho"
8
+ image_must_be_these_formats: 'Sua imagem deve ser uma JPG, PNG ou GIF'
10
9
  admin:
11
10
  images:
12
- image:
13
- delete:
14
- message: Você tem certeza que quer remover '%{title}'?
15
- title: Remover esta imagem para sempre
11
+ delete: Remover esta imagem para sempre
12
+ edit: Editar esta imagem
16
13
  form:
17
14
  image: Imagem
18
15
  use_current_image: Usar imagem atual
19
16
  or: ou
20
- replace_image: Substituir por esta...
17
+ replace_image: " substituir por esta..."
21
18
  current_image: Imagem atual
22
19
  maximum_image_size: "O tamanho máximo permitido é de %{megabytes} megabytes."
23
20
  index:
@@ -27,22 +24,15 @@ pt-BR:
27
24
  switch_to: Trocar para visão em %{view_name}
28
25
  list: lista
29
26
  grid: grade
30
- search:
31
- results_for: Resultados da busca por %{query}
32
27
  grid_view:
33
- edit: Editar esta imagem
34
- view_live: "Clique para ver a imagem<br/><em>Abre em uma nova janela</em>"
35
- list_view_image:
36
- edit_this_image: Editar esta imagem
28
+ view_live: "Ver esta imagem<br/><em>Abre em uma nova janela</em>"
37
29
  existing_image:
38
- submit_insert: Inserir
39
- resize_image: "Redimencionar a imagem? <em>(Recomendado)</em>"
30
+ button_text: Inserir
31
+ resize_image: "Redimencionar a imagem?"
40
32
  size: Tamanho
41
33
  insert:
42
34
  existing_image: Do Arquivo
43
35
  new_image: Nova Imagem
44
- previous: Anterior
45
- next: Próxima
46
- submit_insert: Inserir
47
- or: ou
48
- cancel: Cancelar
36
+ activerecord:
37
+ models:
38
+ image: Imagem
@@ -0,0 +1,48 @@
1
+ @images @images-manage
2
+ Feature: Manage Images
3
+ In order to control the content on my website
4
+ As an administrator
5
+ I want to create and manage images
6
+
7
+ Background:
8
+ Given I am a logged in refinery user
9
+ And I have no images
10
+
11
+ @images-create
12
+ Scenario: Create Valid Image
13
+ When I go to the list of images
14
+ And I follow "Create New Image"
15
+ And I attach the image at "beach.jpeg"
16
+ And I press "Save"
17
+ Then the image "beach.jpeg" should have uploaded successfully
18
+ And I should have 1 image
19
+ And the image should have size "254718"
20
+ And the image should have width "500"
21
+ And the image should have height "375"
22
+ And the image should have mime_type "image/jpeg"
23
+
24
+ Scenario: Create Invalid Image (format)
25
+ When I go to the list of images
26
+ And I follow "Create New Image"
27
+ And I attach the image at "refinery_is_awesome.txt"
28
+ And I press "Save"
29
+ Then I should not see "successfully created"
30
+ And I should have 0 images
31
+
32
+ @images-edit
33
+ Scenario: Edit Existing Image
34
+ When I upload the image at "beach.jpeg"
35
+ And I go to the list of images
36
+ And I follow "Edit this image"
37
+ And I attach the image at "id-rather-be-here.jpg"
38
+ And I press "Save"
39
+ Then I should see "'Id Rather Be Here' was successfully updated."
40
+ And I should have 1 image
41
+
42
+ @images-delete
43
+ Scenario: Delete Image
44
+ When I upload the image at "beach.jpeg"
45
+ When I go to the list of images
46
+ And I follow "Remove this image forever"
47
+ Then I should see "'Beach' was successfully destroyed. "
48
+ And I should have 0 images
@@ -0,0 +1,37 @@
1
+ Given /^I have no images$/ do
2
+ Image.delete_all
3
+ end
4
+
5
+ When /^I attach the image at "([^"]*)"$/ do |file_path|
6
+ attach_file('image[image]', File.join(File.expand_path('../../uploads/', __FILE__), file_path))
7
+ end
8
+
9
+ Then /^the image "([^"]*)" should have uploaded successfully$/ do |file_name|
10
+ Image.find_by_image_name(file_name).nil?.should == false
11
+ end
12
+
13
+ Then /^the image should have size "([^"]*)"$/ do |size|
14
+ Image.first.size.should == size.to_i
15
+ end
16
+
17
+ Then /^the image should have width "([^"]*)"$/ do |width|
18
+ Image.first.width.should == width.to_i
19
+ end
20
+
21
+ Then /^the image should have height "([^"]*)"$/ do |height|
22
+ Image.first.height.should == height.to_i
23
+ end
24
+
25
+ Then /^the image should have mime_type "([^"]*)"$/ do |mime_type|
26
+ Image.first.mime_type.should == mime_type.to_s
27
+ end
28
+
29
+ Then /^I should have ([0-9]+) images?$/ do |number|
30
+ Image.count.should == number.to_i
31
+ end
32
+
33
+ When /^I upload the image at "([^"]*)"$/ do |file_path|
34
+ visit new_admin_image_path
35
+ attach_file('image[image]', File.join(File.expand_path('../../uploads/', __FILE__), file_path))
36
+ click_button 'Save'
37
+ end
@@ -0,0 +1,17 @@
1
+ module NavigationHelpers
2
+ module Refinery
3
+ module Images
4
+ def path_to(page_name)
5
+ case page_name
6
+ when /the list of images/
7
+ admin_images_path
8
+
9
+ when /the new image form/
10
+ new_admin_image_path
11
+ else
12
+ nil
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1 @@
1
+ http://www.refineryhq.com/
@@ -22,6 +22,12 @@ module Refinery
22
22
  app_images.analyser.register(Dragonfly::Analysis::RMagickAnalyser)
23
23
  app_images.analyser.register(Dragonfly::Analysis::FileCommandAnalyser)
24
24
 
25
+ # This little eval makes it so that dragonfly urls work in traditional
26
+ # situations where the filename and extension are required, e.g. lightbox.
27
+ # What this does is takes the url that is about to be produced e.g.
28
+ # /system/images/BAhbB1sHOgZmIiMyMDEwLzA5LzAxL1NTQ19DbGllbnRfQ29uZi5qcGdbCDoGcDoKdGh1bWIiDjk0MngzNjAjYw
29
+ # and adds the filename onto the end (say the image was 'refinery_is_awesome.jpg')
30
+ # /system/images/BAhbB1sHOgZmIiMyMDEwLzA5LzAxL1NTQ19DbGllbnRfQ29uZi5qcGdbCDoGcDoKdGh1bWIiDjk0MngzNjAjYw/refinery_is_awesome.jpg
25
31
  app_images.instance_eval %{
26
32
  def url_for(job, *args)
27
33
  image_url = nil
@@ -4,51 +4,27 @@
4
4
 
5
5
  ## About
6
6
 
7
- All Refinery's images are stored in one place, the images plugin. You can customise what sized thumbnails are generated when an image is uploaded.
7
+ All Refinery's images are stored in one place, the images plugin.
8
8
 
9
- Images and other file uploads are handled using [attachment_fu](http://github.com/technoweenie/attachment_fu)
10
-
11
- ## Generating Thumbnails
12
-
13
- Refinery lets you generate a range of thumbnails when an image is uploaded so you can output this on a page in an appropriate size.
14
-
15
- To specify the sizes of your thumbnails edit the "Image Thumbnails" setting.
16
-
17
- This setting is stored as a serialized hash and is directly passed to [attachment_fu](http://github.com/technoweenie/attachment_fu)
18
-
19
- Here's what the default looks like
20
-
21
- ---
22
- :dialog_thumb: c106x106
23
- :preview: c96x96
24
- :medium: 225x255>
25
- :large: 450x450>
26
- :small: 110x110>
27
- :grid: c135x135
28
-
29
- Refinery requires some of these, so you won't want to delete any, but add new ones to meet your design needs. Each thumbnail is not just a size guide but a [RMagick geometry string](http://www.imagemagick.org/RMagick/doc/imusage.html#geometry) that allows you to define min and max size too.
30
-
31
- Refinery also extends the [geometry string](http://www.imagemagick.org/RMagick/doc/imusage.html#geometry) support to allow cropping. Here's some examples
32
-
33
- :grid: c135x135
34
-
35
- This will crop (_that's what the "c" stands for_) the grid thumbnail down to ``135x135`` exactly, without stretching the image.
36
-
37
- _Note: you will have to restart your web server after changing this setting for the changes to take effect._
9
+ Images and other file uploads are handled using [Dragonfly](http://github.com/markevans/dragonfly)
38
10
 
39
11
  ## Using a Thumbnail Size in Your View
40
12
 
41
- Take the default thumbnails above to use the ``:large`` thumbnail I would collect that image out of the database and apply it like this in my view:
13
+ Say I want to have a thumbnail of size 400x300 I would collect that image out of the database and apply it like this in my view:
42
14
 
43
- <%= image_fu @image, :large %>
15
+ <%= image_fu @image, '400x300' %>
44
16
 
45
- ``image_fu`` is a command we have created that automatically adds width and height attributes to the generated image so that web browsers render your pages more smoothly as they know in advance how big an image is going to be before it is fully downloaded.
17
+ ``image_fu`` is a command we have created that automatically adds width and height attributes to the
18
+ generated image so that web browsers render your pages more smoothly as they know in advance how big
19
+ an image is going to be before it is fully downloaded.
46
20
 
47
- If I wanted to replace all the images inside a content section without the user having to resize images in the editor then I would use the built in ``content_fu`` command like this in my view:
21
+ If I wanted to replace all the images inside a content section without the user having to resize images
22
+ in the editor then I would use the built in ``content_fu`` command like this in my view:
48
23
 
49
- <%= content_fu @page[:body], :large %>
24
+ <%= content_fu @page[:body], '400x300' %>
50
25
 
51
- ``content_fu`` is a command we have created that automatically changes all images with the url /system/images to use a particular thumbnail size. This makes it easy to protect your pages from having gigantic images inserted into them that blow out the design.
26
+ ``content_fu`` is a command we have created that automatically changes all images with the url /system/images to use a particular size.
27
+ This makes it easy to protect your pages from having gigantic images inserted into them that blow out the design.
52
28
 
53
29
  ## Related Settings
54
30
 
@@ -1,16 +1,15 @@
1
1
  class Admin::PagesController < Admin::BaseController
2
2
 
3
3
  crudify :page,
4
- :conditions => "parent_id IS NULL",
5
- :order => "position ASC",
4
+ :conditions => "pages.parent_id IS NULL",
5
+ :order => "lft ASC",
6
6
  :include => [:parts, :slugs, :children, :parent],
7
7
  :paging => false
8
8
 
9
- before_filter :find_pages_for_parents_list, :only => [:new, :create, :edit, :update]
10
- after_filter :expire_caching, :only => [:create, :update, :destroy, :update_positions]
11
-
12
9
  rescue_from FriendlyId::ReservedError, :with => :show_errors_for_reserved_slug
13
10
 
11
+ cache_sweeper :page_sweeper, :only => [:create, :update, :destroy, :update_positions]
12
+
14
13
  def new
15
14
  @page = Page.new
16
15
  Page.default_parts.each_with_index do |page_part, index|
@@ -19,43 +18,6 @@ class Admin::PagesController < Admin::BaseController
19
18
  end
20
19
 
21
20
  protected
22
- def expire_caching
23
- expire_menu_fragment_caching
24
- expire_action_caching
25
- end
26
-
27
- def expire_menu_fragment_caching
28
- Rails.cache.delete("#{Refinery.base_cache_key}_menu_pages")
29
- expire_fragment %r{#{RefinerySetting.find_or_set(:refinery_menu_cache_action_suffix, "site_menu")}}
30
- end
31
-
32
- def expire_action_caching
33
- expire_fragment %r{.*/pages/.*}
34
- end
35
-
36
- # This finds all of the pages that could possibly be assigned as the current page's parent.
37
- def find_pages_for_parents_list
38
- @pages_for_parents_list = []
39
- Page.find_all_by_parent_id(nil, :order => "position ASC").each do |page|
40
- @pages_for_parents_list << page
41
- @pages_for_parents_list += add_pages_branch_to_parents_list(page)
42
- end
43
- @pages_for_parents_list.flatten.compact!
44
-
45
- # We need to remove all references to the current page or any of its decendants or we get a nightmare.
46
- @pages_for_parents_list.reject! do |page|
47
- page.id == @page.id or @page.descendants.include?(page)
48
- end unless @page.nil? or @page.new_record?
49
- end
50
-
51
- def add_pages_branch_to_parents_list(page)
52
- list = []
53
- page.children.each do |child|
54
- list << child
55
- list += add_pages_branch_to_parents_list(child) if child.children.any?
56
- end
57
- list
58
- end
59
21
 
60
22
  def show_errors_for_reserved_slug(exception)
61
23
  flash[:error] = "Sorry, but that title is a reserved system word."
@@ -1,7 +1,7 @@
1
1
  class PagesController < ApplicationController
2
2
 
3
3
  caches_action :home, :show,
4
- :cache_path => Proc.new { |c| "#{c.request.host_with_port}/views/pages/#{c.params[:path]}" },
4
+ :cache_path => Proc.new { |c| "#{Refinery.base_cache_key}/#{c.request.host_with_port}/views/pages/#{c.params[:path]}" },
5
5
  :if => Proc.new { |c|
6
6
  c.send(:logged_in?) == false and
7
7
  (!RefinerySetting.table_exists? ||
@@ -1,8 +1,7 @@
1
1
  class Page < ActiveRecord::Base
2
2
  validates :title, :presence => true
3
3
 
4
- acts_as_tree :order => "position ASC",
5
- :include => [:children, :slugs]
4
+ acts_as_nested_set
6
5
 
7
6
  # Docs for friendly_id http://github.com/norman/friendly_id
8
7
  has_friendly_id :title, :use_slug => true,
@@ -190,8 +189,8 @@ class Page < ActiveRecord::Base
190
189
  end
191
190
 
192
191
  # Returns all the top level pages, usually to render the top level navigation.
193
- def top_level(include_children = false)
194
- where(:show_in_menu => true, :draft => false).order('position ASC').includes(:slugs, :children, :parent, :parts)
192
+ def top_level
193
+ self.roots.where(:show_in_menu => true, :draft => false)
195
194
  end
196
195
  end
197
196
 
@@ -0,0 +1,18 @@
1
+ class PageSweeper < ActionController::Caching::Sweeper
2
+ observe Page
3
+
4
+ def after_save(page)
5
+ expire_caching(page)
6
+ end
7
+
8
+ def after_destroy(page)
9
+ expire_caching(page)
10
+ end
11
+
12
+ protected
13
+ def expire_caching(page)
14
+ expire_fragment %r{.*#{Refinery.base_cache_key}_?#{RefinerySetting.find_or_set(:refinery_menu_cache_action_suffix, "site_menu")}.*}
15
+ expire_fragment %r{.*/pages/.*}
16
+ end
17
+
18
+ end
@@ -17,7 +17,7 @@
17
17
  <%= f.label :parent_id, t('.parent_page') %>
18
18
  <%= refinery_help_tag t('.parent_page_help') %>
19
19
  </span>
20
- <%= f.collection_select :parent_id, @pages_for_parents_list, :id, :indented_title, {:include_blank => true}, :class => 'widest' %>
20
+ <%= f.select :parent_id, nested_set_options(Page, @page) {|i| "#{'-' * i.level} #{i.title}" }, :include_blank => true %>
21
21
  </div>
22
22
  <div class='field'>
23
23
  <span class='label_with_help'>
@@ -1,14 +1,15 @@
1
1
  <%
2
- branch = if (!page.parent_id.nil? and page === page.self_and_siblings.last) or (page != @pages.first and page === @pages.last)
3
- "branch_end"
4
- elsif page === @pages.first
2
+ branch = if page.parent_id.nil? and page.right_sibling.present? and page.left_sibling.nil?
5
3
  "branch_start"
4
+ elsif page.right_sibling.nil?
5
+ "branch_end"
6
6
  end
7
+
7
8
  title = page.title
8
9
  title << " <em>(#{t('.hidden')})</em>" unless page.show_in_menu?
9
10
  title << " <em>(#{t('.draft')})</em>" if page.draft?
10
11
  -%>
11
- <li class='clearfix record<%= " #{branch}" %>' id="<%= dom_id(page) -%>">
12
+ <li class='clearfix record<%= " #{branch}" if branch.present? %>' id="<%= dom_id(page) -%>">
12
13
  <div class='clearfix'>
13
14
  <span class='title'><%= title.html_safe %></span>
14
15
 
@@ -21,7 +22,7 @@
21
22
  <%= link_to refinery_icon_tag('delete.png'), admin_page_url(page),
22
23
  :class => "cancel confirm-delete",
23
24
  :title => t('admin.pages.delete'),
24
- :'data-confirm' => t('shared.admin.delete.message', :title => page.title.gsub(/<\/?em>/, "")),
25
+ :'data-confirm' => t('shared.admin.delete.message', :title => title.gsub(/\ ?<em>.*<\/em>/, "")),
25
26
  :'data-method' => "delete" if page.deletable? %>
26
27
  </span>
27
28
  </div>
@@ -2,52 +2,82 @@ de:
2
2
  plugins:
3
3
  refinery_pages:
4
4
  title: Seiten
5
+ description: Verwaltet Inhaltsseiten
5
6
  admin:
7
+ pages_dialogs:
8
+ page_link:
9
+ link_to_this_page: Link zu dieser Seite
10
+ link_to:
11
+ insert: Einfügen
12
+ your_page:
13
+ tab_name: Ihre Seite
14
+ web_address:
15
+ tab_name: Webseite
16
+ location: Zieladresse
17
+ new_window: Neues Fenster
18
+ new_window_label: Link in einem neuen Fenster öffnen
19
+ not_sure: Nicht sicher, was in das Feld oben rein soll?
20
+ step1: Finden Sie die Seite im Web, die Sie verlinken möchten.
21
+ step2: Kopieren Sie die Adresse aus der Adressleiste ihres Browsers und fügen Sie diese in das Feld oben ein.
22
+ email_address:
23
+ tab_name: E-Mail-Adresse
24
+ subject_line_optional: Optionaler Betreff
25
+ body_optional: Optionaler Inhaltstext
26
+ not_sure: Nicht sicher, was in Felder oben rein soll?
27
+ step1: Schreiben oder kopieren Sie die E-Mail-Adresse (z.B. aus Ihrem Adressbuch) die verlinkt werden soll in das Feld "E-Mail-Adresse".
28
+ step2: Verwenden Sie das Feld '<strong>Optionaler Betreff</strong>', wenn der Betreff schon <strong>vorher mit einer Zeile verfasst</strong> werden soll.
29
+ step3: Verwenden Sie das Feld '<strong>Optionaler Inhaltstext</strong>', wenn die E-Mail bereits <strong>mit einem Text verfasst</strong> werden soll.
30
+ your_resource:
31
+ tab_name: Ihre Datei
32
+ link_to_this_resource: Link zu dieser Datei
6
33
  pages:
7
- form_advanced_options:
34
+ delete: Diese Seite für immer löschen
35
+ edit: Diese Seite bearbeiten
36
+ page:
37
+ view_live: Diese Seite live betrachten <br/><em>(öffnet sich in einem neuen Fenster)</em>
38
+ hidden: Versteckt
39
+ draft: Entwurf
40
+ form_new_page_parts:
8
41
  title: Titel
9
- create_content_section: Inhaltsbereich erstellen
10
- delete_content_section: Inhaltsbereich löschen
42
+ form_page_parts:
43
+ create_content_section: Inhaltsabschnitt anlegen
44
+ delete_content_section: Inhaltsabschnitt löschen
45
+ form_advanced_options:
46
+ toggle_advanced_options: Klicken Sie hier, um die erweiterten Optionen anzuzeigen
47
+ page_options: Seitenoptionen
48
+ parent_page: Übergeordnete Seite
11
49
  advanced_options: Erweiterte Optionen
12
- explain_page_different_title: "Geben Sie hier einen Seitentitel ein, wenn Sie nicht möchten, dass der Menü- und Browsertitel als Seitentitel verwendet wird."
13
- redirect_to_first_child: "Checken Sie diese Box, wenn der Besucher zur ersten Unterseite dieser Seite weitergeleitet werden soll, wenn diese SEite aufgerufen wird."
14
- parent_id_title: Übergeordnet
15
- custom_title: Eigener Titel
16
- title_type: "Typ:"
50
+ custom_title: Angepasster Titel
17
51
  title_types:
18
- none: Keiner
52
+ none: Keinen
19
53
  text: Text
20
- image: Bild
21
- custom_url: Eigene URL
22
- custom_url_explanation: "Geben Sie eine URL ein, wenn diese Seite zu einer externen Seite oder einer bereits existierenden Ressource (z.B. eine Kontaktseite) verlinken soll.<br />Hinweis: Diese URL muss zu einem bereits existierenden Ort verlinken, eine neue Seite wird nicht angelegt."
23
- draft: Entwurf
24
54
  show_in_menu_title: Im Menü anzeigen
25
- show_in_menu_description: "Checken Sie diese Box, wenn diese Seite im Seitenmenü angezeigt werden soll."
26
- draft: Entwurf
55
+ show_in_menu_description: Zeigt diese Seite im Seitenmenü an
56
+ show_in_menu_help: Entfernen Sie diesen Haken, wenn die Seite nicht im Menü erscheinen soll. Dies kann praktisch sein, wenn Sie eine Seite direkt verlinken möchten aber nicht im Menü anzeigen lassen wollen.
27
57
  save_as_draft: Als Entwurf speichern
28
- save: Speichern
29
- cancel: Abbrechen
58
+ skip_to_first_child: Überspringen der obersten Ebene
59
+ skip_to_first_child_label: Auf erste untergeordnete Seite weiterleiten
60
+ skip_to_first_child_help: Diese Option verlinkt die Seite zu der ersten untergeordneten Seite. Dies kann nützlich sein, wenn Seiten gruppiert werden.
61
+ link_url: Diese Seite auf eine andere Seite weiterleiten
62
+ link_url_help: Wenn diese Seite zu einer anderen Seite weitergeleitet werden soll, geben Sie hier eine Adresse an, sonst lassen Sie dieses Feld leer.
63
+ parent_page_help: Sie können eine Seite einer anderen unterordnen, indem Sie diese aus der Liste wählen. Soll die Seite auf die oberste Ebene, lassen Sie dieses Feld leer.
64
+ custom_title_help: Wenn die Seite einen anderen Titel haben soll als der im Menü angezeigte, wählen Sie "Text" und geben Sie ihn hier ein.
30
65
  form_advanced_options_seo:
31
- seo: Suchmaschinen-Optimierung
32
- seo_override_title: Browser Titel
33
- seo_override_title_help: Hier können Sie den Standard-Browser-Titel überschreiben.
34
- meta_keywords_title: Meta keywords
35
- meta_description_help: Geben Sie 5-10 Schlüsselbegriffe mit Bezug zu dieser Seite ein. Trennen Sie Schlüsselbegriffe mit Kommas.
36
- meta_description_title: Meta description
37
- meta_description_help: Geben Sie zwei bis drei kurze Sätze über den Inhalt dieser Seite ein.
38
- js:
39
- content_section:
40
- create: Inhaltsbereich erstellen.
41
- already_exists: Ein Inhaltsbereich mit diesem Titel existiert bereits. Bitte wählen Sie einen anderen Titel.
42
- title_empty: Sie haben keinen Titel für den Inhaltsbereich eingegeben. Bitte geben Sie einen Titel ein.
43
- confirm_delete: "Der Inhaltsbereich %{section_name} und alle darin enthaltenen Inhalte werden gelöscht, wenn diese Seite gespeichert wird. Sind Sie sicher?"
66
+ seo: Suchmaschinenoptimierung
67
+ seo_override_title: Browsertitel
68
+ seo_override_title_help: Geben Sie einen 5-10 Wörter langen Titel an, den der Inhalt der Seite beschreibt.
69
+ meta_keywords_title: Meta-Schlüsselwörter
70
+ meta_keywords_help: Geben Sie 5-10 Schlüsselwörter für diese Seite an. Trennen Sie Schlüsselwörter mit einem Komma.
71
+ meta_description_title: Meta-Beschreibung
72
+ meta_description_help: Beschreiben Sie in knappen zwei oder drei Sätzen, um was es sich bei dieser Seite handelt.
44
73
  index:
45
- create_new_page: Neue Seite erstellen
46
- reorder_pages: Seiten neu anordnen
47
- reorder_pages_done: Seitenanordnung speichern
48
- sorry_no_results: Entschuldigung! Es wurden keine Suchergebnisse gefunden.
49
- no_pages_yet: Es wurden noch keine Seiten erstellt. Klicken Sie auf "Neue Seite erstellen" um Ihre erste Seite zu erstellen..
74
+ create_new_page: Neue Seite anlegen
75
+ reorder_pages: Seiten umsortieren
76
+ reorder_pages_done: Umsortieren erledigt
77
+ no_pages_yet: Es sind noch keine Seiten vorhanden. Klicken Sie auf "Neue Seite anlegen", um Ihre erste Seite zu erzeugen.
50
78
  activerecord:
79
+ models:
80
+ page: Seite
51
81
  attributes:
52
82
  page:
53
- skip_to_first_child: "Direkt zum ersten Kindes?"
83
+ title: Titel