aboutsummaryrefslogtreecommitdiffstats
path: root/config/routes.rb
blob: 0b44a62f2a63bb7dcca4391e098c7231e9fad248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
Aclog::Application.routes.draw do
  root to: "about#index"

  # JSON
  scope "/api", format: "json" do
    get "/users/:action", controller: "users"
    get "/tweets/:action", controller: "tweets"
  end

  # HTML only pages
  scope format: "html" do
    get "/search" =>        "search#search",    as: "search"

    # Internals / SessionsController
    get "/i/import/:id" =>  "i#import",         as: "import"
    get "/i/callback" =>    "sessions#callback"
    get "/i/logout" =>      "sessions#destroy", as: "logout"

    # ReportController
    get "/i/report" => "report#index",          as: "report"

    get "/i/:id" =>         "tweets#show",      as: "tweet", constraints: {id: /\d+/}

    scope "/i/settings", controller: "settings" do
      get "/",                      action: "index", as: "settings"
      post "/update",                     action: "update"
      get "/confirm_deactivation",  action: "confirm_deactivation"
      post "/deactivate",           action: "deactivate"
    end

    scope "/about", controller: "about" do
      get "/",              action: "about",    as: "about"
      get "/api",           action: "api",      as: "about_api"
    end

    scope "/help", controller: "help" do
      get "/search",        action: "search",   as: "help_search"
    end

    # User pages
    scope "/:screen_name", controller: "users" do
      get "/stats",                         action: "stats",            as: "user_stats"
      get "/discovered_by",                 action: "discovered_by",    as: "user_discovered_by"
      get "/discovered_users",              action: "discovered_users", as: "user_discovered_users"
    end

    # Twitter redirect
    get "/:screen_name/status(es)/:id" => redirect("/i/%{id}")
  end

  # HTML or RSS
  scope controller: "tweets", constraints: {format: /(html|rss)/} do
    scope "i" do
      get "/best",      action: "all_best",     as: "best"
      get "/recent",    action: "all_recent",   as: "recent"
      get "/timeline",  action: "all_timeline", as: "timeline"
    end

    # TweetController / Tweets
    scope "/:screen_name" do
      get "/",                              action: "index",         as: "user"
      get "/best",                          action: "best",          as: "user_best"
      get "/favorited",                     action: "favorited",     as: "user_favorited"
      get "/retweeted",                     action: "retweeted",     as: "user_retweeted"
      get "/recent",                        action: "recent",        as: "user_recent"
      get "/timeline",                      action: "timeline",      as: "user_timeline"
      get "/discoveries",                   action: "discoveries",   as: "user_discoveries"
      get "/favorites",                     action: "favorites",     as: "user_favorites"
      get "/retweets",                      action: "retweets",      as: "user_retweets"
      get "/discovered_by/:screen_name_b",  action: "discovered_by", as: "user_discovered_by_user"
    end
  end
end