Patch #38153 » Make_wiki__Sidebar__localizable.patch
| app/models/wiki.rb (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → app/models/wiki.rb (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
| 40 | 40 | 
    # Returns the wiki page that acts as the sidebar content  | 
| 41 | 41 | 
    # or nil if no such page exists  | 
| 42 | 42 | 
    def sidebar  | 
| 43 | 
        @sidebar ||= find_page('Sidebar', :with_redirect => false)
   | 
|
| 43 | 
        @sidebar ||= find_page(l(:label_wiki_sidebar), :with_redirect => false)
   | 
|
| 44 | 44 | 
    end  | 
| 45 | 45 | |
| 46 | 46 | 
    # 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+) | ||
|---|---|---|
| 1 | 1 | 
    <% if User.current.allowed_to?(:edit_wiki_pages, @project) &&  | 
| 2 | 
          (@wiki && @wiki.find_or_new_page('Sidebar').editable_by?(User.current)) %>
   | 
|
| 2 | 
          (@wiki && @wiki.find_or_new_page(l(:label_wiki_sidebar)).editable_by?(User.current)) %>
   | 
|
| 3 | 3 | 
    <div class="contextual">  | 
| 4 | 
        <%= link_to l(:button_edit), edit_project_wiki_page_path(@project, 'sidebar'),
   | 
|
| 4 | 
        <%= link_to l(:button_edit), edit_project_wiki_page_path(@project, l(:label_wiki_sidebar)),
   | 
|
| 5 | 5 | 
    :class => 'icon icon-edit' %>  | 
| 6 | 6 | 
    </div>  | 
| 7 | 7 | 
    <% end -%>  | 
| config/locales/en.yml (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → config/locales/en.yml (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
| 967 | 967 | 
      label_days_to_html: "%{days} days up to %{date}"
   | 
| 968 | 968 | 
    label_wiki_content_added: Wiki page added  | 
| 969 | 969 | 
    label_wiki_content_updated: Wiki page updated  | 
| 970 | 
    label_wiki_sidebar: Sidebar  | 
|
| 970 | 971 | 
    label_group: Group  | 
| 971 | 972 | 
    label_group_plural: Groups  | 
| 972 | 973 | 
    label_group_new: New group  | 
| config/locales/fa.yml (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → config/locales/fa.yml (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
| 903 | 903 | 
      label_date_from_to: از %{start} تا %{end}
   | 
| 904 | 904 | 
    label_wiki_content_added: صفحه دانشنامه افزوده شد  | 
| 905 | 905 | 
    label_wiki_content_updated: صفحه دانشنامه بهروز شد  | 
| 906 | 
    label_wiki_sidebar: کناره  | 
|
| 906 | 907 | 
    label_group: گروه  | 
| 907 | 908 | 
    label_group_plural: گروهها  | 
| 908 | 909 | 
    label_group_new: گروه جدید  | 
| test/functional/wiki_controller_test.rb (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → test/functional/wiki_controller_test.rb (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
| 112 | 112 | 
    end  | 
| 113 | 113 | |
| 114 | 114 | 
    def test_show_with_sidebar  | 
| 115 | 
        page = Project.find(1).wiki.pages.new(:title => 'Sidebar')
   | 
|
| 115 | 
        page = Project.find(1).wiki.pages.new(:title => I18n.l(:label_wiki_sidebar))
   | 
|
| 116 | 116 | 
    page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')  | 
| 117 | 117 | 
    page.save!  | 
| 118 | 118 | |
| ... | ... | |
| 250 | 250 | 
    Role.find(1).remove_permission!(:protect_wiki_pages)  | 
| 251 | 251 | 
    @request.session[:user_id] = 2  | 
| 252 | 252 | |
| 253 | 
        post :new, :params => {:project_id => 'ecookbook', :title => 'Sidebar'}
   | 
|
| 253 | 
        post :new, :params => {:project_id => 'ecookbook', :title => I18n.l(:label_wiki_sidebar)}
   | 
|
| 254 | 254 | 
    assert_response :success  | 
| 255 | 255 | 
    assert_select_error /Title/  | 
| 256 | 256 | 
    end  | 
| test/unit/wiki_test.rb (revision 41374:587bd15c0af7d26ff2c63f451efe473b200590e2) → test/unit/wiki_test.rb (revision 41374+:587bd15c0af7+) | ||
|---|---|---|
| 104 | 104 | |
| 105 | 105 | 
    def test_sidebar_should_return_a_wiki_page_if_defined  | 
| 106 | 106 | 
    @wiki = Wiki.find(1)  | 
| 107 | 
        page = @wiki.pages.new(:title => 'Sidebar')
   | 
|
| 107 | 
        page = @wiki.pages.new(:title => I18n.l(:label_wiki_sidebar))
   | 
|
| 108 | 108 | 
    page.content = WikiContent.new(:text => 'Side bar content for test_show_with_sidebar')  | 
| 109 | 109 | 
    page.save!  | 
| 110 | 110 | |
| 111 | 111 | 
    assert_kind_of WikiPage, @wiki.sidebar  | 
| 112 | 
        assert_equal 'Sidebar', @wiki.sidebar.title
   | 
|
| 112 | 
        assert_equal I18n.l(:label_wiki_sidebar), @wiki.sidebar.title
   | 
|
| 113 | 113 | 
    end  | 
| 114 | 114 | |
| 115 | 115 | 
    def test_destroy_should_remove_redirects_from_the_wiki  |