diff options
author | re4k <re4k@re4k.info> | 2013-05-01 18:41:43 +0900 |
---|---|---|
committer | re4k <re4k@re4k.info> | 2013-05-01 18:41:43 +0900 |
commit | 2844d9159d6417f8c8d55e818c2ed6a4e30ea405 (patch) | |
tree | adf46b859a390474fec4028bc17d80efccfa9e5b | |
parent | bcf546c1f5fc305a1b75dfa091630c68668cd590 (diff) | |
download | aclog-2844d9159d6417f8c8d55e818c2ed6a4e30ea405.tar.gz |
change controller: description to caption/title
-rw-r--r-- | app/controllers/application_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/errors_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/main_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/tweets_controller.rb | 37 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 4 | ||||
-rw-r--r-- | app/helpers/application_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/users_helper.rb | 14 | ||||
-rw-r--r-- | app/views/errors/error.html.haml | 2 | ||||
-rw-r--r-- | app/views/errors/error.json.jbuilder | 2 | ||||
-rw-r--r-- | app/views/main/about.html.haml | 36 | ||||
-rw-r--r-- | app/views/main/api.html.haml | 4 | ||||
-rw-r--r-- | app/views/main/index.html.haml | 2 |
12 files changed, 58 insertions, 51 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 66534fa..e1cac88 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base before_filter :set_format after_filter :xhtml + protected def _get_user(id, screen_name) if id User.find_by(id: id) diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index fe3b7b2..4169eab 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -4,6 +4,7 @@ class ErrorsController < ApplicationController def render_error @exception = env["action_dispatch.exception"] @status = ActionDispatch::ExceptionWrapper.new(env, @exception).status_code + @title = "?" case @exception when OAuth::Unauthorized diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index ddeb2d2..218896f 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -9,6 +9,6 @@ class MainController < ApplicationController end def api - @title = "api" + @title = "about api" end end diff --git a/app/controllers/tweets_controller.rb b/app/controllers/tweets_controller.rb index e8c9ed9..aa9a433 100644 --- a/app/controllers/tweets_controller.rb +++ b/app/controllers/tweets_controller.rb @@ -1,12 +1,14 @@ class TweetsController < ApplicationController + before_filter :set_user_limit + # GET /i/:id # GET /api/tweets/show def show tweet_required @user = @tweet.user - @description = "#{@user.screen_name}'s Tweet" text = ApplicationController.helpers.format_tweet_text(@tweet.text)[0...30] + @caption = "#{@user.screen_name}'s Tweet" @title = "\"#{text}\" from #{@user.screen_name}" end @@ -15,7 +17,7 @@ class TweetsController < ApplicationController # GET /api/tweets/best def best user_optional - @description = "Best" + @caption = "Best" @tweets = Tweet.of(@user).reacted.order_by_reactions.list(params, force_page: true) end @@ -23,7 +25,7 @@ class TweetsController < ApplicationController # GET /api/tweets/favorited def favorited user_optional - @description = "Most Favorited" + @caption = "Most Favorited" @tweets = Tweet.of(@user).reacted.order_by_favorites.list(params, force_page: true) end @@ -31,7 +33,7 @@ class TweetsController < ApplicationController # GET /api/tweets/retweeted def retweeted user_optional - @description = "Most Retweeted" + @caption = "Most Retweeted" @tweets = Tweet.of(@user).reacted.order_by_retweets.list(params, force_page: true) end @@ -39,7 +41,7 @@ class TweetsController < ApplicationController # GET /api/tweets/recent def recent user_optional - @description = "Recent Best" + @caption = "Recent Best" @tweets = Tweet.of(@user).recent.reacted.order_by_reactions.list(params, force_page: true) end @@ -48,7 +50,7 @@ class TweetsController < ApplicationController # GET /api/tweets/timeline def timeline user_optional - @description = "Recent" + @caption = "Recent" @tweets = Tweet.of(@user).reacted.order_by_id.list(params) end @@ -56,7 +58,7 @@ class TweetsController < ApplicationController # GET /api/tweets/discoveries def discoveries user_required - @description = "Discoveries" + @caption = "Discoveries" @tweets = Tweet.discovered_by(@user).order_by_id.list(params) end @@ -64,7 +66,7 @@ class TweetsController < ApplicationController # GET /api/tweets/favorites def favorites user_required - @description = "Favorites" + @caption = "Favorites" @tweets = Tweet.favorited_by(@user).order_by_id.list(params) end @@ -72,7 +74,7 @@ class TweetsController < ApplicationController # GET /api/tweets/retweets def retweets user_required - @description = "Retweets" + @caption = "Retweets" @tweets = Tweet.retweeted_by(@user).order_by_id.list(params) end @@ -81,7 +83,7 @@ class TweetsController < ApplicationController def discovered_by user_required user_b_required - @description = "Discovored by #{@user_b.screen_name}" + @caption = "Discovored by #{@user_b.screen_name}" @tweets = Tweet.of(@user).discovered_by(@user_b).order_by_id.list(params) end @@ -116,4 +118,19 @@ class TweetsController < ApplicationController @tweet = Tweet.find_by(id: params[:id]) raise Aclog::Exceptions::TweetNotFound unless @tweet end + + def set_user_limit + if params[:limit] + if params[:limit].to_i == -1 + @user_limit = nil + else + @user_limit = params[:limit].to_i + end + else + @user_limit = 20 + if request.format == :html && params[:action] == "show" + @user_limit = 100 + end + end + end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 287fb96..3448967 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,19 +1,21 @@ class UsersController < ApplicationController def info user_required - @description = "Profile" + @caption = "Profile" @stats = @user.stats(true) end def discovered_by user_required @usermap = @user.count_discovered_by + @caption = "Discovered By" render "shared/user_ranking" end def discovered_of user_required @usermap = @user.count_discovered_of + @caption = "Discovered Of" render "shared/user_ranking" end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f9d4705..0c54ec4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -55,11 +55,11 @@ module ApplicationHelper end def caption - "#{@description}" + "#{@caption}" end def title - "#{@title || @description} - aclog" + "#{@title || @caption} - aclog" end # utf8, form diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 8d16157..2310a24 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,16 +1,2 @@ module UsersHelper - def user_limit - i = params[:limit].to_i - if i > 0 - return i - elsif i == -1 - return nil - else - if params[:action] == "show" - return 100 - else - return 20 - end - end - end end diff --git a/app/views/errors/error.html.haml b/app/views/errors/error.html.haml index 8bc508f..6714aec 100644 --- a/app/views/errors/error.html.haml +++ b/app/views/errors/error.html.haml @@ -12,7 +12,7 @@ - when Aclog::Exceptions::LoginRequired このページの表示にはログインが必要です。 - when ActionController::RoutingError - 不正な URL です。 + このページは存在しません。 - else - if response.status == 404 Not Found (Unknown) diff --git a/app/views/errors/error.json.jbuilder b/app/views/errors/error.json.jbuilder index 8dab39a..87e5f2c 100644 --- a/app/views/errors/error.json.jbuilder +++ b/app/views/errors/error.json.jbuilder @@ -12,7 +12,7 @@ json.error do |json| when Aclog::Exceptions::LoginRequired json.message "このページの表示にはログインが必要です。" when ActionController::RoutingError - json.message "不正な URL です。" + json.message "このページは存在しません。" else if response.status == 404 json.message "Not Found (Unknown)" diff --git a/app/views/main/about.html.haml b/app/views/main/about.html.haml index 3e22840..a1f5d5d 100644 --- a/app/views/main/about.html.haml +++ b/app/views/main/about.html.haml @@ -31,21 +31,21 @@ %dd= link_to "/i/timeline", "/i/timeline" %p Favstar のパスにアクセスされた場合リダイレクトするようになっているはず… -%h3 検索クエリ -%p 半角スペース区切りで、すべて AND 検索になります。OR 検索付けたいけどまだ使えません。 -%p order 以外は先頭に - を付けることで否定になります。 -%dl - %dt ユーザーの - %dd user:cn - %dt 反応数 〜〜以上 - %dd reaction:30 - %dd favorite:30 - %dd retweet:30 - %dt 並び替え - %dd order:old - %dd order:reaction - %dd order:favorite - %dd order:retweet - %dt 期間 - %dd 20130328..20130330 - %dt ツイート本文・クライアント名での検索はできません。クライアント名での検索は付けたいけれど…%p +/%h3 検索クエリ +/%p 半角スペース区切りで、すべて AND 検索になります。OR 検索付けたいけどまだ使えません。 +/%p order 以外は先頭に - を付けることで否定になります。 +/%dl +/ %dt ユーザーの +/ %dd user:cn +/ %dt 反応数 〜〜以上 +/ %dd reaction:30 +/ %dd favorite:30 +/ %dd retweet:30 +/ %dt 並び替え +/ %dd order:old +/ %dd order:reaction +/ %dd order:favorite +/ %dd order:retweet +/ %dt 期間 +/ %dd 20130328..20130330 +/ %dt ツイート本文・クライアント名での検索はできません。クライアント名での検索は付けたいけれど…%p diff --git a/app/views/main/api.html.haml b/app/views/main/api.html.haml index b24834d..92f97fe 100644 --- a/app/views/main/api.html.haml +++ b/app/views/main/api.html.haml @@ -7,9 +7,9 @@ 全部 GET です %dl %dt ツイート表示 - %dd /i/show.json?id=(tweet_id) + %dd /api/tweets/show.json?id=(tweet_id) %dt ツイート一覧 - %dd /users/{best|timeline|discovered}.json + %dd /tweets/{best|recent|timeline|discoveries}.json %dt 他ユーザーが関係してくるもの %dd /users/{favorited_by|retweeted_by|given_favorites_to|given_retweets_to}.json %dt ユーザー情報 diff --git a/app/views/main/index.html.haml b/app/views/main/index.html.haml index a420e34..7176d16 100644 --- a/app/views/main/index.html.haml +++ b/app/views/main/index.html.haml @@ -11,7 +11,7 @@ = link_to "アプリ連携", "https://twitter.com/settings/applications" から不要な "AcLog" と "Aclog2" は解除しても大丈夫です。 %h4 - 今後の予定(2013/04/20) + 今後の予定(2013/05/01) %ul %li ふぁぼ爆撃対策: TLふぁぼり(エタフォ)・ユーザーTLふぁぼり(fav2you)対策 %li 通知を細かく設定できるように |