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.
- data/Gemfile +6 -6
- data/app/controllers/application_controller.rb +2 -1
- data/bin/refinerycms +36 -32
- data/changelog.md +471 -0
- data/config/environments/production.rb +1 -1
- data/db/migrate/20100606135207_change_thumbnail_sizes_for_dragonfly.rb +4 -4
- data/db/migrate/20100826232810_move_inquiry_settings_to_refinery_settings.rb +2 -2
- data/db/migrate/20100831122919_move_page_to_nested_set.rb +28 -0
- data/db/schema.rb +7 -1
- data/db/seeds/refinery_settings.rb +2 -4
- data/license.md +21 -0
- data/readme.md +97 -0
- data/todo.md +61 -0
- data/vendor/refinerycms/authentication/app/views/admin/users/index.html.erb +5 -13
- data/vendor/refinerycms/authentication/app/views/layouts/login.html.erb +1 -1
- data/vendor/refinerycms/authentication/config/locales/de.yml +53 -56
- data/vendor/refinerycms/authentication/config/locales/en.yml +1 -2
- data/vendor/refinerycms/authentication/config/locales/lv.yml +38 -38
- data/vendor/refinerycms/authentication/config/locales/pt-BR.yml +21 -48
- data/vendor/refinerycms/authentication/features/lost_password.feature +40 -0
- data/vendor/refinerycms/authentication/features/manage_users.feature +57 -0
- data/vendor/refinerycms/authentication/features/step_definitions/lost_password.rb +8 -0
- data/vendor/refinerycms/authentication/features/step_definitions/user_steps.rb +32 -0
- data/vendor/refinerycms/authentication/features/support/factories.rb +17 -0
- data/vendor/refinerycms/authentication/features/support/paths.rb +24 -0
- data/vendor/refinerycms/authentication/lib/authenticated_system.rb +1 -1
- data/vendor/refinerycms/authentication/lib/authentication.rb +1 -1
- data/vendor/refinerycms/core/app/views/admin/_head.html.erb +4 -4
- data/vendor/refinerycms/core/app/views/admin/_menu_tab.html.erb +2 -2
- data/vendor/refinerycms/core/app/views/layouts/admin.html.erb +1 -1
- data/vendor/refinerycms/core/app/views/layouts/admin_dialog.html.erb +1 -1
- data/vendor/refinerycms/core/app/views/shared/_footer.html.erb +1 -1
- data/vendor/refinerycms/core/app/views/shared/_google_analytics.html.erb +1 -1
- data/vendor/refinerycms/core/app/views/shared/_header.html.erb +1 -1
- data/vendor/refinerycms/core/app/views/shared/_menu.html.erb +5 -2
- data/vendor/refinerycms/core/app/views/shared/_menu_branch.html.erb +6 -3
- data/vendor/refinerycms/core/app/views/shared/_site_bar.html.erb +11 -15
- data/vendor/refinerycms/core/app/views/shared/admin/_form_actions.html.erb +1 -0
- data/vendor/refinerycms/core/app/views/shared/admin/_image_picker.html.erb +3 -3
- data/vendor/refinerycms/core/app/views/shared/admin/_make_sortable.html.erb +2 -1
- data/vendor/refinerycms/core/app/views/shared/admin/_resource_picker.html.erb +24 -17
- data/vendor/refinerycms/core/app/views/wymiframe.html.erb +1 -1
- data/vendor/refinerycms/core/config/locales/de.yml +50 -51
- data/vendor/refinerycms/core/config/locales/en.yml +5 -2
- data/vendor/refinerycms/core/config/locales/lv.yml +6 -3
- data/vendor/refinerycms/core/config/locales/pt-BR.yml +34 -38
- data/vendor/refinerycms/core/crud.md +12 -12
- data/vendor/refinerycms/core/features/engine_generator.feature +27 -0
- data/vendor/refinerycms/core/features/search.feature +56 -0
- data/vendor/refinerycms/core/features/site_bar.feature +24 -0
- data/vendor/refinerycms/core/features/step_definitions/core_steps.rb +61 -0
- data/vendor/refinerycms/core/features/step_definitions/engine_generator_steps.rb +19 -0
- data/vendor/refinerycms/core/features/step_definitions/generator_steps.rb +11 -0
- data/vendor/refinerycms/core/features/support/paths.rb +14 -0
- data/vendor/refinerycms/core/features/uploads/beach.jpeg +0 -0
- data/vendor/refinerycms/core/features/uploads/refinery_is_awesome.txt +1 -0
- data/vendor/refinerycms/core/lib/core.rb +52 -53
- data/vendor/refinerycms/core/lib/generators/refinery_engine/refinery_engine_generator.rb +14 -3
- data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/controllers/admin/plural_name_controller.rb +3 -1
- data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/models/singular_name.rb +4 -3
- data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/views/admin/plural_name/_form.html.erb +2 -1
- data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/views/admin/plural_name/_singular_name.html.erb +6 -2
- data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/views/plural_name/index.html.erb +3 -1
- data/vendor/refinerycms/core/lib/generators/refinery_engine/templates/app/views/plural_name/show.html.erb +7 -3
- data/vendor/refinerycms/core/lib/refinery/application_controller.rb +85 -75
- data/vendor/refinerycms/core/lib/refinery/application_helper.rb +10 -190
- data/vendor/refinerycms/core/lib/refinery/crud.rb +283 -0
- data/vendor/refinerycms/core/lib/refinery/{form_helpers.rb → helpers/form_helper.rb} +0 -0
- data/vendor/refinerycms/core/lib/refinery/helpers/html_truncation_helper.rb +26 -0
- data/vendor/refinerycms/core/lib/refinery/helpers/image_helper.rb +37 -0
- data/vendor/refinerycms/core/lib/refinery/helpers/menu_helper.rb +38 -0
- data/vendor/refinerycms/core/lib/refinery/helpers/meta_helper.rb +67 -0
- data/vendor/refinerycms/core/lib/refinery/helpers/script_helper.rb +36 -0
- data/vendor/refinerycms/core/lib/refinery/helpers/site_bar_helper.rb +26 -0
- data/vendor/refinerycms/core/lib/refinery/helpers/tag_helper.rb +19 -0
- data/vendor/refinerycms/core/lib/refinery/helpers/translation_helper.rb +17 -0
- data/vendor/refinerycms/core/lib/refinery/plugin.rb +3 -3
- data/vendor/refinerycms/core/lib/tasks/refinery.rake +4 -3
- data/vendor/refinerycms/core/public/javascripts/refinery/admin.js +93 -101
- data/vendor/refinerycms/core/public/javascripts/refinery/core.js +3 -0
- data/vendor/refinerycms/core/public/javascripts/refinery/nestedsortables.js +164 -0
- data/vendor/refinerycms/core/public/javascripts/refinery/serializelist.js +66 -0
- data/vendor/refinerycms/core/public/stylesheets/refinery/refinery.css +11 -73
- data/vendor/refinerycms/dashboard/config/locales/de.yml +6 -6
- data/vendor/refinerycms/dashboard/config/locales/pt-BR.yml +3 -5
- data/vendor/refinerycms/dashboard/features/dashboard.feature +54 -0
- data/vendor/refinerycms/dashboard/features/support/paths.rb +14 -0
- data/vendor/refinerycms/images/app/controllers/admin/images_controller.rb +6 -6
- data/vendor/refinerycms/images/app/helpers/admin/images_helper.rb +1 -1
- data/vendor/refinerycms/images/app/views/admin/images/_existing_image.html.erb +15 -13
- data/vendor/refinerycms/images/app/views/admin/images/_grid_view.html.erb +1 -1
- data/vendor/refinerycms/images/app/views/admin/images/_list_view_image.html.erb +1 -1
- data/vendor/refinerycms/images/config/locales/de.yml +21 -25
- data/vendor/refinerycms/images/config/locales/pt-BR.yml +13 -23
- data/vendor/refinerycms/images/features/manage_images.feature +48 -0
- data/vendor/refinerycms/images/features/step_definitions/image_steps.rb +37 -0
- data/vendor/refinerycms/images/features/support/paths.rb +17 -0
- data/vendor/refinerycms/images/features/uploads/beach.jpeg +0 -0
- data/vendor/refinerycms/images/features/uploads/id-rather-be-here.jpg +0 -0
- data/vendor/refinerycms/images/features/uploads/refinery_is_awesome.txt +1 -0
- data/vendor/refinerycms/images/lib/images.rb +6 -0
- data/vendor/refinerycms/images/readme.md +12 -36
- data/vendor/refinerycms/pages/app/controllers/admin/pages_controller.rb +4 -42
- data/vendor/refinerycms/pages/app/controllers/pages_controller.rb +1 -1
- data/vendor/refinerycms/pages/app/models/page.rb +3 -4
- data/vendor/refinerycms/pages/app/sweepers/page_sweeper.rb +18 -0
- data/vendor/refinerycms/pages/app/views/admin/pages/_form_advanced_options.html.erb +1 -1
- data/vendor/refinerycms/pages/app/views/admin/pages/_page.html.erb +6 -5
- data/vendor/refinerycms/pages/config/locales/de.yml +66 -36
- data/vendor/refinerycms/pages/config/locales/pt-BR.yml +29 -57
- data/vendor/refinerycms/pages/features/manage_pages.feature +45 -0
- data/vendor/refinerycms/pages/features/step_definitions/page_steps.rb +29 -0
- data/vendor/refinerycms/pages/features/support/paths.rb +18 -0
- data/vendor/refinerycms/pages/lib/pages.rb +5 -0
- data/vendor/refinerycms/pages/spec/models/page_spec.rb +13 -0
- data/vendor/refinerycms/refinery.rb +1 -1
- data/vendor/refinerycms/resources/app/views/admin/resources/_existing_resource.html.erb +2 -2
- data/vendor/refinerycms/resources/config/locales/de.yml +16 -17
- data/vendor/refinerycms/resources/config/locales/pt-BR.yml +15 -17
- data/vendor/refinerycms/resources/features/manage_files.feature +39 -0
- data/vendor/refinerycms/resources/features/step_definitions/file_steps.rb +21 -0
- data/vendor/refinerycms/resources/features/support/paths.rb +17 -0
- data/vendor/refinerycms/resources/features/uploads/beach.jpeg +0 -0
- data/vendor/refinerycms/resources/features/uploads/refinery_is_awesome.txt +1 -0
- data/vendor/refinerycms/resources/lib/resources.rb +17 -1
- data/vendor/refinerycms/settings/app/models/refinery_setting.rb +82 -64
- data/vendor/refinerycms/settings/config/locales/de.yml +36 -16
- data/vendor/refinerycms/settings/config/locales/pt-BR.yml +32 -34
- data/vendor/refinerycms/settings/features/manage_refinery_settings.feature +5 -0
- data/vendor/refinerycms/settings/lib/settings.rb +1 -1
- metadata +86 -53
- data/vendor/refinerycms/core/lib/crud.rb +0 -265
- data/vendor/refinerycms/core/lib/refinery/html_truncation_helper.rb +0 -22
- 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
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
13
|
-
|
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:
|
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
|
-
|
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
|
-
|
39
|
-
resize_image: "Redimencionar a imagem?
|
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
|
-
|
45
|
-
|
46
|
-
|
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
|
Binary file
|
Binary file
|
@@ -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.
|
7
|
+
All Refinery's images are stored in one place, the images plugin.
|
8
8
|
|
9
|
-
Images and other file uploads are handled using [
|
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
|
-
|
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,
|
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
|
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
|
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],
|
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
|
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 => "
|
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
|
-
|
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
|
194
|
-
where(:show_in_menu => true, :draft => false)
|
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.
|
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
|
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 =>
|
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
|
-
|
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
|
-
|
10
|
-
|
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
|
-
|
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:
|
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:
|
26
|
-
|
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
|
-
|
29
|
-
|
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:
|
32
|
-
seo_override_title:
|
33
|
-
seo_override_title_help:
|
34
|
-
meta_keywords_title: Meta
|
35
|
-
|
36
|
-
meta_description_title: Meta
|
37
|
-
meta_description_help:
|
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
|
46
|
-
reorder_pages: Seiten
|
47
|
-
reorder_pages_done:
|
48
|
-
|
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
|
-
|
83
|
+
title: Titel
|