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.
This commit is contained in:
Родитель
c635f6b477
Коммит
395a6f2acf
|
@ -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
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<% @section = 'documentation' %>
|
||||
<% @subsection = 'book' %>
|
||||
|
||||
<div id='main' class='book'>
|
||||
<h1>Index of Commands</h1>
|
||||
<table class="commands">
|
||||
<% @groups.each do |title, commands| %>
|
||||
<tr>
|
||||
<td colspan="10"><h2><%= title %></h2></td>
|
||||
</tr>
|
||||
<% commands.each do |cmd| %>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th><%= cmd %></th>
|
||||
<% if @related[cmd] %>
|
||||
<% count = 0 %>
|
||||
<% @related[cmd].each do |number, slug, score| %>
|
||||
<% count += 1 %>
|
||||
<% if count > 10 %>
|
||||
<% count = 1 %>
|
||||
</tr><tr><th> </th><td></td>
|
||||
<% end %>
|
||||
<td nowrap><a href="/book/en/<%= slug %>"><%= number %></a> <small>(<%= score %>)</small></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
|
@ -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+/
|
||||
|
|
|
@ -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"],
|
||||
|
|
Загрузка…
Ссылка в новой задаче