OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Show only one possible option as parent wiki page && correct those entries that have an "0" instead of "nil" as parent_id
Henriette Dinger59aede25128f
diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rbindex 77accdc277b..e7784f383d9 100644--- a/app/helpers/wiki_helper.rb+++ b/app/helpers/wiki_helper.rb@@ -32,7 +32,7 @@ module WikiHelperids: true,placeholder: true)s = if placeholder- ["-- #{t('label_no_parent_page')} --", '']+ [["-- #{t('label_no_parent_page')} --", '']]else[]enddiff --git a/app/views/wiki/index.html.erb b/app/views/wiki/index.html.erbindex 3b2b61934b4..6959a3bd866 100644--- a/app/views/wiki/index.html.erb+++ b/app/views/wiki/index.html.erb@@ -40,7 +40,7 @@ See docs/COPYRIGHT.rdoc for more details.<% html_title t(:label_wiki_toc) %><div class="wiki-content">-<%= render_page_hierarchy(@pages_by_parent_id, nil, timestamp: true) %>+ <%= render_page_hierarchy(@pages_by_parent_id, nil, timestamp: true) %></div><% unless @pages.empty? %>diff --git a/db/migrate/20200115090742_fix_parent_id_for_wiki_pages.rb b/db/migrate/20200115090742_fix_parent_id_for_wiki_pages.rbnew file mode 100644index 00000000000..270fea82fff--- /dev/null+++ b/db/migrate/20200115090742_fix_parent_id_for_wiki_pages.rb@@ -0,0 +1,9 @@+class FixParentIdForWikiPages < ActiveRecord::Migration[6.0]+ class MyWikiPages < ActiveRecord::Base+ self.table_name = "wiki_pages"+ end++ def up+ MyWikiPages.where(parent_id: 0).update_all(parent_id: nil)+ end+end