Patch #38153 » Make_wiki__Sidebar__localizable.patch
| app/models/wiki.rb (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → app/models/wiki.rb (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
|
# Returns the wiki page that acts as the sidebar content
|
||
|
# or nil if no such page exists
|
||
|
def sidebar
|
||
|
@sidebar ||= find_page('Sidebar', :with_redirect => false)
|
||
|
@sidebar ||= find_page(l(:label_wiki_sidebar), :with_redirect => false)
|
||
|
end
|
||
|
# find the page with the given title
|
||
| app/views/wiki/_sidebar.html.erb (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → app/views/wiki/_sidebar.html.erb (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
|
<% if User.current.allowed_to?(:edit_wiki_pages, @project) &&
|
||
|
(@wiki && @wiki.find_or_new_page('Sidebar').editable_by?(User.current)) %>
|
||
|
(@wiki && @wiki.find_or_new_page(l(:label_wiki_sidebar)).editable_by?(User.current)) %>
|
||
|
<div class="contextual">
|
||
|
<%= link_to l(:button_edit), edit_project_wiki_page_path(@project, 'sidebar'),
|
||
|
<%= link_to l(:button_edit), edit_project_wiki_page_path(@project, l(:label_wiki_sidebar)),
|
||
|
:class => 'icon icon-edit' %>
|
||
|
</div>
|
||
|
<% end -%>
|
||
| config/locales/en.yml (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → config/locales/en.yml (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
|
label_days_to_html: "%{days} days up to %{date}"
|
||
|
label_wiki_content_added: Wiki page added
|
||
|
label_wiki_content_updated: Wiki page updated
|
||
|
label_wiki_sidebar: Sidebar
|
||
|
label_group: Group
|
||
|
label_group_plural: Groups
|
||
|
label_group_new: New group
|
||
| config/locales/fa.yml (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → config/locales/fa.yml (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
|
label_date_from_to: از %{start} تا %{end}
|
||
|
label_wiki_content_added: صفحه دانشنامه افزوده شد
|
||
|
label_wiki_content_updated: صفحه دانشنامه بهروز شد
|
||
|
label_wiki_sidebar: کناره
|
||
|
label_group: گروه
|
||
|
label_group_plural: گروهها
|
||
|
label_group_new: گروه جدید
|
||
| test/functional/wiki_controller_test.rb (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → test/functional/wiki_controller_test.rb (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
|
end
|
||
|
def test_show_with_sidebar
|
||
|
page = Project.find(1).wiki.pages.new(:title => 'Sidebar')
|
||
|
page = Project.find(1).wiki.pages.new(:title => I18n.l(:label_wiki_sidebar))
|
||
|
page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
|
||
|
page.save!
|
||
| ... | ... | |
|
Role.find(1).remove_permission!(:protect_wiki_pages)
|
||
|
@request.session[:user_id] = 2
|
||
|
post :new, :params => {:project_id => 'ecookbook', :title => 'Sidebar'}
|
||
|
post :new, :params => {:project_id => 'ecookbook', :title => I18n.l(:label_wiki_sidebar)}
|
||
|
assert_response :success
|
||
|
assert_select_error /Title/
|
||
|
end
|
||
| test/unit/wiki_test.rb (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → test/unit/wiki_test.rb (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
|
def test_sidebar_should_return_a_wiki_page_if_defined
|
||
|
@wiki = Wiki.find(1)
|
||
|
page = @wiki.pages.new(:title => 'Sidebar')
|
||
|
page = @wiki.pages.new(:title => I18n.l(:label_wiki_sidebar))
|
||
|
page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')
|
||
|
page.save!
|
||
|
assert_kind_of WikiPage, @wiki.sidebar
|
||
|
assert_equal 'Sidebar', @wiki.sidebar.title
|
||
|
assert_equal I18n.l(:label_wiki_sidebar), @wiki.sidebar.title
|
||
|
end
|
||
|
def test_destroy_should_remove_redirects_from_the_wiki
|
||