Skip to content

Commit

Permalink
Merge pull request comfy#223 from lis2/polish
Browse files Browse the repository at this point in the history
Polish
  • Loading branch information
GBH committed Sep 24, 2012
2 parents dd9a465 + 6d5f4bb commit 236ac1c
Show file tree
Hide file tree
Showing 10 changed files with 285 additions and 10 deletions.
3 changes: 3 additions & 0 deletions app/views/cms_admin/hooks/_index_branch.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
<%= hook.first %>
</div>
12 changes: 12 additions & 0 deletions app/views/cms_admin/hooks/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<h1><%= t('.title') %></h1>

<% @hooks.each do |hook| %>
<ul class='list sortable'>
<li>
<div class="item">
<p><strong><%= hook.first %></strong></p>
<%= render :partial => 'index_branch', :collection => hook.last, :as => :hook %>
</div>
</li>
</ul>
<% end %>
3 changes: 3 additions & 0 deletions app/views/layouts/cms_admin/_left.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<li><%= active_link_to t('cms_admin.base.pages'), cms_admin_site_pages_path(@site) %></li>
<li><%= active_link_to t('cms_admin.base.snippets'), cms_admin_site_snippets_path(@site) %></li>
<li><%= active_link_to t('cms_admin.base.files'), cms_admin_site_files_path(@site) %></li>
<% if ComfortableMexicanSofa::ViewHooks.hooks.any? %>
<li><%= active_link_to t('cms_admin.base.hooks'), cms_admin_site_hooks_path(@site) %></li>
<% end %>
<% end %>
<%= cms_hook :navigation %>
</ul>
2 changes: 1 addition & 1 deletion config/initializers/comfortable_mexican_sofa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@
# should be rendered into the following areas:
# ComfortableMexicanSofa::ViewHooks.add(:navigation, '/layouts/admin/navigation')
# ComfortableMexicanSofa::ViewHooks.add(:html_head, '/layouts/admin/html_head')
# ComfortableMexicanSofa::ViewHooks.add(:page_form, '/layouts/admin/page_form')
# ComfortableMexicanSofa::ViewHooks.add(:page_form, '/layouts/admin/page_form')
6 changes: 5 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ en:
pages: Pages
snippets: Snippets
files: Files
hooks: Hooks

sites:
index:
Expand Down Expand Up @@ -232,4 +233,7 @@ en:
insert: Insert Image
link:
create: Create Link


hooks:
index:
title: Hooks
239 changes: 239 additions & 0 deletions config/locales/pl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
# encoding: utf-8
en:
# -- Models ---------------------------------------------------------------
attributes:
label: Tytuł
slug: Ścieżka
parent_id: Rodzic
content: Zawartość
identifier: Identyfikator
activerecord:
models:
cms/site: Witryna
cms/layout: Szablin
cms/page: Strona
cms/snippet: Snippet
cms/file: Plik
attributes:
cms/site:
identifier: Identyfikator
hostname: Nazwa hosta
path: Ścieżka
locale: Język
is_mirrored: Mirror
cms/layout:
identifier: Identyfikator
label: Nazwa layout'u
app_layout: Nazwa aplikacji
parent_id: Rodzic
css: Style
js: Javascript
cms/page:
label: Tytuł
layout_id: Identyfikator szablonu
slug: Ścieżka
target_page_id: Przekieruj do strony
is_published: Opublikowana
cms/file:
file: Plik
description: Opis
cms/snippet:
identifier: Identyfikator

# -- Controllers ----------------------------------------------------------
cms:
base:
site_not_found: Strona nie została znaleziona
fixtures_enabled: Fikstury CMS są włączone. Wszystkie zmiany zpisane tutaj nie będą uwzględnione.

sites:
created: Witryna została utworzona
creation_failure: Błąd przy tworzeniu witryny
updated: Witryna została uaktulaniona
update_failure: Błąd przy uaktualnianiu witryny
deleted: Witryna została usunięta
not_found: Nie znaleziono witryny

layouts:
created: Szablon został utworzony
creation_failure: Błąd przy tworzeniu layoutu
updated: Szanlon został uaktualniony
update_failure: Błąd przy uaktualnianiu layoutu
deleted: Szablon został usunięty
not_found: Nie znaleziono layoutu

pages:
created: Strona została utworzona
creation_failure: Błąd przy tworzeniu strony
updated: Strona została uaktualniona
update_failure: Błąd przy uaktualnianiu strony
deleted: Strona została usunięta
not_found: Nie znaleziono strony
layout_not_found: Brakuje layoutu. Proszę utworzyć

snippets:
created: Snippet został utworzony
creation_failure: Błąd przy tworzeniu snippeta
updated: Snippet został uaktualniony
update_failure: Błąd przy uaktualnianiu snippeta
deleted: Snippet został usunięty
not_found: Nie znaleziono snippeta

revisions:
reverted: Zawartość zostala przywrócona
record_not_found: Wpis nie został znaleziony
not_found: Wersja nie została znaleziona

files:
created: Plik wrzucony na serwer
creation_failure: Błąd przy wrzucaniu pliku
updated: Plik został uaktualniony
update_failure: Błąd przy uaktualnianiu pliku
deleted: Plik został usunięty
not_found: Plik nie został znaleziony

content:
site_not_found: Witryna nie została znaleziona
layout_not_found: Szablon nie został znaleziony
page_not_found: Strona nie została znaleziona

# -- Views ----------------------------------------------------------------
cms_admin:
base:
sites: Witryny
layouts: Szablony
pages: Pages
snippets: Snippets
files: Files
hooks: Hooks

sites:
index:
title: Witryny
new_link: Utwórz nowa witrynę
select: Wybierz witrynę
edit: Edytuj
delete: Usuń
are_you_sure: Jesteś pewien, że chce usunąć tą witrynę?
new:
title: Nowa witryna
edit:
title: Edytuj witrynę
form:
create: Utwórz witrynę
update: Uaktualnij witrynę

layouts:
index:
title: Szablony
new_link: Utwórz nowy szablon
index_branch:
add_child_layout: Dodaj podszablon
edit: Edytuj
delete: Usuń
are_you_sure: Jesteś pewien?
new:
title: Nowy szablon
edit:
title: Edytuj szablon
revision: Wersje
form:
select_parent_layout: Wybierz szablon rodzic
select_app_layout: Wybierz szablon aplikacji
create: Stwórz szablon
update: Uaktualnij szablon

pages:
index:
title: Strony
new_link: Utwórz nową stronę
index_branch:
toggle: Przełącz
add_child_page: Dodaj podstronę
edit: Edytuj
delete: Usuń
are_you_sure: Jesteś pewien?
new:
title: Nowa strona
edit:
title: Edytuj stronę
revision: Wersje
form:
select_target_page: Bez przekierowania
preview: Podgląd
create: Utwórz stronę
update: Uaktualnij stronę
form_blocks:
no_tags: |-
Szablon nie ma zdefiniowanych tagów<br/>
Wyedytuj treść aby dodać stronę lub pole np. <code>{{cms:page:content}}</code>
snippets:
index:
title: Snippets
new_link: Utwórz nowy snippet
edit: Edytuj
delete: Usuń
are_you_sure: Jesteś pewien?
new:
title: Nowy snippet
edit:
title: Edytuj snippet
revision: Wersje
form:
create: Utwórz snippet
update: Uaktualnij snippet

revisions:
show:
title: Wersje dla
revision: Wersja
full_path: Pełna ścieżka
slug: Ścieżka
update: Uaktualnij do tej wersji
current: Aktualna

files:
index:
title: Pliki
new_link: Wrzuć nowy plik
edit: Edytuj
delete: Usuń
are_you_sure: Jesteś pewien?
button: Wrzuć plik
new:
title: Nowy plik
edit:
title: Edytuj plik
form:
current_file: Aktualny plik
create: Wrzuć plik
update: Uaktualnij plik
page_form:
are_you_sure: Jesteś pewien?
file:
are_you_sure: Jesteś pewien?

categories:
index:
label: Kategorie
edit: Edytuj
done: Zrobione
all: Wszystko
add: Dodaj
show:
are_you_sure: Jesteś pewien?
edit:
save: Zapisz
form:
label: Tytuł

dialogs:
image:
insert: Dodaj obrazek
link:
create: Utwórz link

hooks:
index:
title: Hooks
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
end
end
resources :categories
resources :hooks
get 'dialog/:type' => 'dialogs#show', :as => 'dialog'
end
end unless ComfortableMexicanSofa.config.admin_route_prefix.blank?
Expand Down
3 changes: 2 additions & 1 deletion lib/comfortable_mexican_sofa/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def initialize
'zh-CN' => '简体中文',
'ja' => '日本語',
'sv' => 'Svenska',
'ru' => 'Русский'
'ru' => 'Русский',
'pl' => 'Polski'
}
@admin_locale = nil
@database_config = nil
Expand Down
12 changes: 7 additions & 5 deletions lib/comfortable_mexican_sofa/view_hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ def self.hooks
def self.render(name, template, options = {})
out = ''
(self.hooks[name.to_sym] || []).each do |path|
out += template.render({:partial => path}.merge(options))
out += template.render({:partial => path.first}.merge(options))
end
return out.html_safe
end

# Will declare a partial that will be rendered for this hook
# Example:
# ComfortableMexicanSofa::ViewHooks.add(:navigation, 'shared/navigation')
def self.add(name, partial_path)
def self.add(name, partial_path, position = 0)
self.hooks[name.to_sym] ||= []
self.hooks[name.to_sym] << partial_path
self.hooks[name.to_sym] << [partial_path, position]
self.hooks[name.to_sym].sort_by! { |hook| hook.last }
end


# Removing previously declared hook
def self.remove(name)
self.hooks.delete(name)
end
end

end
14 changes: 12 additions & 2 deletions test/integration/view_hooks_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ def test_hooks_rendering_with_multiples
assert_match /hook_content/, response.body
assert_match /<hook_content_2>/, response.body
end

def test_hooks_rendering_with_proper_order
CmsAdmin::SitesController.append_view_path(File.expand_path('../fixtures/views', File.dirname(__FILE__)))
ComfortableMexicanSofa::ViewHooks.add(:navigation, '/nav_hook_2', 0)
ComfortableMexicanSofa::ViewHooks.add(:navigation, '/nav_hook', 1)

http_auth :get, cms_admin_sites_path
assert_response :success
assert_match /<hook_content_2>hook_content/, response.body
end

def test_hooks_rendering_with_no_hook
ComfortableMexicanSofa::ViewHooks.remove(:navigation)
Expand All @@ -29,5 +39,5 @@ def test_hooks_rendering_with_no_hook
assert_response :success
assert_no_match /hook_content/, response.body
end
end

end

0 comments on commit 236ac1c

Please sign in to comment.