From 395a6f2acf0637d2d45ff7592b935f3290166bb1 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 7 Feb 2018 09:16:51 -0500 Subject: [PATCH] redirect /book/commands to /docs This currently generates a poorly formatted list of commands with no actual links to the manpage. It was originally referenced as part of a command index in a mock-up that went away in the previous commit. Probably nobody links to it, but we can easily just redirect it to our good-looking link-filled command reference page. Note that this lets us drop the redundant list of commands in lib/constants.rb. --- app/controllers/books_controller.rb | 14 -------------- app/views/doc/commands.html.erb | 30 ----------------------------- config/routes.rb | 2 +- lib/constants.rb | 16 --------------- 4 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 app/views/doc/commands.html.erb diff --git a/app/controllers/books_controller.rb b/app/controllers/books_controller.rb index af91690af..ed7b334eb 100644 --- a/app/controllers/books_controller.rb +++ b/app/controllers/books_controller.rb @@ -16,20 +16,6 @@ class BooksController < ApplicationController raise PageNotFound unless @book end - def commands - @related = {} - ri = RelatedItem.where(:content_type => 'reference', :related_type => 'book') - ri.each do |item| - cmd = item.name.gsub('git-', '') - if s = Section.where(:slug => item.related_id).first - @related[cmd] ||= [] - @related[cmd] << [s.cs_number, s.slug, item.score] - @related[cmd].sort! - end - end - @groups = CMD_GROUPS - end - def link link = params[:link] @book = Book.where(:code => params[:lang], :edition => params[:edition]).first diff --git a/app/views/doc/commands.html.erb b/app/views/doc/commands.html.erb deleted file mode 100644 index 02f6142b2..000000000 --- a/app/views/doc/commands.html.erb +++ /dev/null @@ -1,30 +0,0 @@ -<% @section = 'documentation' %> -<% @subsection = 'book' %> - -
-

Index of Commands

- - <% @groups.each do |title, commands| %> - - - - <% commands.each do |cmd| %> - - - - <% if @related[cmd] %> - <% count = 0 %> - <% @related[cmd].each do |number, slug, score| %> - <% count += 1 %> - <% if count > 10 %> - <% count = 1 %> - - <% end %> - - <% end %> - <% end %> - - <% end %> - <% end %> -

<%= title %>

 <%= cmd %>
 <%= number %> (<%= score %>)
-
diff --git a/config/routes.rb b/config/routes.rb index 260f4e3fb..58c619483 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -36,7 +36,7 @@ Gitscm::Application.routes.draw do get "/ch:chapter-:section.html" => "books#chapter" get "/:lang/ch:chapter-:section.html" => "books#chapter" get "/index" => redirect("/book") - get "/commands" => "books#commands" + get "/commands" => redirect("/docs") get "/:lang/v:edition" => "books#show" get "/:lang/v:edition/:slug" => "books#section" get "/:lang/v:edition/:chapter/:link" => "books#link", chapter: /(ch|app)\d+/ diff --git a/lib/constants.rb b/lib/constants.rb index 9a436a831..ad53b31c1 100644 --- a/lib/constants.rb +++ b/lib/constants.rb @@ -7,22 +7,6 @@ TAGLINES = %w{ distributed-is-the-new-centralized } -# DocsController#commands -CMD_GROUPS = [ - ['Setup and Config', [ 'config', 'help' ]], - ['Getting and Creating Projects', [ 'init', 'clone']], - ['Basic Snapshotting', [ 'add', 'status', 'diff', 'commit', 'reset', 'rm', 'mv']], - ['Branching and Merging', [ 'branch', 'checkout', 'merge', 'mergetool', 'log', 'stash', 'tag', 'worktree' ]], - ['Sharing and Updating Projects', [ 'fetch', 'pull', 'push', 'remote', 'submodule' ]], - ['Inspection and Comparison', [ 'show', 'log', 'diff', 'shortlog', 'describe' ]], - ['Patching', ['am', 'apply', 'cherry-pick', 'rebase']], - ['Debugging', [ 'bisect', 'blame' ]], - ['Email', ['am', 'apply', 'format-patch', 'send-email', 'request-pull']], - ['External Systems', ['svn', 'fast-import']], - ['Administration', [ 'clean', 'gc', 'fsck', 'reflog', 'filter-branch', 'instaweb', 'archive' ]], - ['Server Admin', [ 'daemon', 'update-server-info' ]], -] - #DocsControllers#watch VIDEOS = [ [1, "41027679", "Git Basics", "What is Version Control?", "what-is-version-control", "05:59"],