diff options
31 files changed, 45 insertions, 27 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 96b2986..61382fc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -27,21 +27,10 @@ module ApplicationHelper end alias format_source_text format_tweet_text - def twitter_status_url(tweet) - "https://twitter.com/#{tweet.user_screen_name}/status/#{tweet.id}" - end - - def twitter_user_url(screen_name) - "https://twitter.com/#{screen_name}" - end - def sidebar_type - if @sidebar - return @sidebar - elsif @user - return "users" - else - params[:controller] + def title(*args) + content_for :title do + (args.compact + ["aclog"]).join(" - ") end end @@ -51,9 +40,9 @@ module ApplicationHelper end end - def title(*args) - content_for :title do - (args.compact + ["aclog"]).join(" - ") + def sidebar(name) + content_for :sidebar do + render "shared/sidebar/#{name}" end end diff --git a/app/models/tweet.rb b/app/models/tweet.rb index 9952d74..78adb2e 100644 --- a/app/models/tweet.rb +++ b/app/models/tweet.rb @@ -32,6 +32,10 @@ class Tweet < ActiveRecord::Base joins("INNER JOIN ((#{un})) reactions ON reactions.tweet_id = tweets.id") } + def twitter_url + "https://twitter.com/#{self.user.screen_name}/status/#{self.id}" + end + def notify_favorite if Settings.notification.enabled Notification.notify_favorite(self) diff --git a/app/models/user.rb b/app/models/user.rb index cfe1ba7..983273e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -5,6 +5,10 @@ class User < ActiveRecord::Base has_many :favorites, dependent: :delete_all has_many :retweets, dependent: :delete_all + def twitter_url + "https://twitter.com/#{self.screen_name}" + end + def self.get(id, screen_name) if id find(id) rescue raise Aclog::Exceptions::UserNotFound diff --git a/app/views/about/about.html.haml b/app/views/about/about.html.haml index ec3f6db..43c699a 100644 --- a/app/views/about/about.html.haml +++ b/app/views/about/about.html.haml @@ -1,4 +1,6 @@ - title "about" +- caption :title +- sidebar :i %p Twitter API の UserStreams というものを使い、登録ユーザーのお気に入り登録・自分のツイートのお気に入り登録され・リツイート・リツイートされをリアルタイムで記録し、集計して表示することができるサービスです。 %p diff --git a/app/views/about/api.html.haml b/app/views/about/api.html.haml index 6097e1e..1c5778b 100644 --- a/app/views/about/api.html.haml +++ b/app/views/about/api.html.haml @@ -1,4 +1,6 @@ - title "API" +- caption :title +- sidebar :i %p **ドキュメントは書き直します** %p diff --git a/app/views/errors/render_error.html.haml b/app/views/errors/render_error.html.haml index 210deed..2d9f713 100644 --- a/app/views/errors/render_error.html.haml +++ b/app/views/errors/render_error.html.haml @@ -1,4 +1,5 @@ - title "Error" +- sidebar :i %h1= response.status .lead = @message diff --git a/app/views/help/search.html.haml b/app/views/help/search.html.haml index 1639ac1..e9d5d3b 100644 --- a/app/views/help/search.html.haml +++ b/app/views/help/search.html.haml @@ -1,4 +1,6 @@ - title "Search Options" +- caption :title +- sidebar :i %h2 search options %table %tr diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index f342955..9c01e3b 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -1,7 +1,7 @@ = render layout: "layouts/base" do .row .col-sm-3 - .sidebar= render partial: "shared/sidebar/#{sidebar_type}" + .sidebar= yield :sidebar .col-sm-9 %h1= yield :caption = yield diff --git a/app/views/settings/confirm_deactivation.html.haml b/app/views/settings/confirm_deactivation.html.haml index 0e4e846..ca605a9 100644 --- a/app/views/settings/confirm_deactivation.html.haml +++ b/app/views/settings/confirm_deactivation.html.haml @@ -1,5 +1,5 @@ - title "Account Deactivation" -%h1 deactivate +- caption :title = form_tag "/i/settings/deactivate", method: :post do = link_to "Cancel", action: "index" = submit_tag diff --git a/app/views/settings/deactivate.html.haml b/app/views/settings/deactivate.html.haml index 7cf44d9..8b006fe 100644 --- a/app/views/settings/deactivate.html.haml +++ b/app/views/settings/deactivate.html.haml @@ -1,4 +1,4 @@ - title "Account Deactivation" -%h1 deactivated +- caption :title ご利用ありがとうございました。記録を停止されますが、データは削除されません。もう一度ログインをすると記録が再開されます。 diff --git a/app/views/settings/index.html.haml b/app/views/settings/index.html.haml index b128b58..09e1856 100644 --- a/app/views/settings/index.html.haml +++ b/app/views/settings/index.html.haml @@ -1,5 +1,5 @@ - title "Account Settings" -%h1 settings +- caption :title = form_tag "/i/settings/update", method: :post do .checkbox = check_box_tag :notification, true, @account.notification diff --git a/app/views/shared/sidebar/_about.html.haml b/app/views/shared/sidebar/_about.html.haml deleted file mode 100644 index 774d930..0000000 --- a/app/views/shared/sidebar/_about.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "shared/sidebar/i" diff --git a/app/views/shared/sidebar/_help.html.haml b/app/views/shared/sidebar/_help.html.haml deleted file mode 100644 index 774d930..0000000 --- a/app/views/shared/sidebar/_help.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "shared/sidebar/i" diff --git a/app/views/shared/sidebar/_search.html.haml b/app/views/shared/sidebar/_search.html.haml deleted file mode 100644 index 774d930..0000000 --- a/app/views/shared/sidebar/_search.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "shared/sidebar/i" diff --git a/app/views/shared/sidebar/_tweets.html.haml b/app/views/shared/sidebar/_tweets.html.haml deleted file mode 100644 index 774d930..0000000 --- a/app/views/shared/sidebar/_tweets.html.haml +++ /dev/null @@ -1 +0,0 @@ -= render "shared/sidebar/i" diff --git a/app/views/shared/sidebar/_users.html.haml b/app/views/shared/sidebar/_users.html.haml index 97ce1a3..9c4c1a9 100644 --- a/app/views/shared/sidebar/_users.html.haml +++ b/app/views/shared/sidebar/_users.html.haml @@ -1,7 +1,7 @@ .avatar = link_to user_path(@user.screen_name) do = image_tag @user.profile_image_url_original, alt: @user.screen_name, width: 64, height: 64, class: "icon img-rounded" -.screen_name= link_to @user.screen_name, twitter_user_url(@user.screen_name) +.screen_name= link_to @user.screen_name, @user.twitter_url - if @user.registered? && @user.account.active? %ul.list-group.records %li diff --git a/app/views/tweets/_tweet.html.haml b/app/views/tweets/_tweet.html.haml index 07af677..37adbe5 100644 --- a/app/views/tweets/_tweet.html.haml +++ b/app/views/tweets/_tweet.html.haml @@ -24,7 +24,7 @@ ユーザーは非公開です .meta.clearfix %span.twitter_bird - = link_to image_tag("bird_gray_16.png", alt: "Twitter"), twitter_status_url(tweet), target: "_blank" + = link_to image_tag("bird_gray_16.png", alt: "Twitter"), tweet.twitter_url, target: "_blank" %span.created_at = link_to format_time(tweet.tweeted_at), tweet_path(tweet.id) - if favorites_truncated?(tweet) diff --git a/app/views/tweets/all_best.html.haml b/app/views/tweets/all_best.html.haml index 2a97d0f..7473321 100644 --- a/app/views/tweets/all_best.html.haml +++ b/app/views/tweets/all_best.html.haml @@ -1,3 +1,4 @@ - title "Top Tweets" - caption :title +- sidebar :i = render "tweets" diff --git a/app/views/tweets/all_recent.html.haml b/app/views/tweets/all_recent.html.haml index 720e42c..25f901d 100644 --- a/app/views/tweets/all_recent.html.haml +++ b/app/views/tweets/all_recent.html.haml @@ -1,3 +1,4 @@ - title "Top Recent Tweets" - caption :title +- sidebar :i = render "tweets" diff --git a/app/views/tweets/all_timeline.html.haml b/app/views/tweets/all_timeline.html.haml index 0792a25..67a56d9 100644 --- a/app/views/tweets/all_timeline.html.haml +++ b/app/views/tweets/all_timeline.html.haml @@ -1,3 +1,4 @@ - title "Newest" - caption :title +- sidebar :i = render "tweets" diff --git a/app/views/tweets/best.html.haml b/app/views/tweets/best.html.haml index 06dd7be..ff1d111 100644 --- a/app/views/tweets/best.html.haml +++ b/app/views/tweets/best.html.haml @@ -1,3 +1,4 @@ - title @user.screen_name + "'s Best Tweets" - caption :title +- sidebar :users = render "tweets" diff --git a/app/views/tweets/discovered_by.html.haml b/app/views/tweets/discovered_by.html.haml index f5302a6..db190b6 100644 --- a/app/views/tweets/discovered_by.html.haml +++ b/app/views/tweets/discovered_by.html.haml @@ -1,3 +1,4 @@ - title @user.screen_name + "'s Discovered by " + @user_b.screen_name - caption :title +- sidebar :users = render "tweets" diff --git a/app/views/tweets/discoveries.html.haml b/app/views/tweets/discoveries.html.haml index 92562ca..07c741e 100644 --- a/app/views/tweets/discoveries.html.haml +++ b/app/views/tweets/discoveries.html.haml @@ -1,3 +1,4 @@ - title @user.screen_name + "'s Discoveries" - caption :title +- sidebar :users = render "tweets" diff --git a/app/views/tweets/favorites.html.haml b/app/views/tweets/favorites.html.haml index 92562ca..07c741e 100644 --- a/app/views/tweets/favorites.html.haml +++ b/app/views/tweets/favorites.html.haml @@ -1,3 +1,4 @@ - title @user.screen_name + "'s Discoveries" - caption :title +- sidebar :users = render "tweets" diff --git a/app/views/tweets/recent.html.haml b/app/views/tweets/recent.html.haml index 39160be..d9b8d28 100644 --- a/app/views/tweets/recent.html.haml +++ b/app/views/tweets/recent.html.haml @@ -1,3 +1,4 @@ - title @user.screen_name + "'s Recent Best Tweets" - caption :title +- sidebar :users = render "tweets" diff --git a/app/views/tweets/retweets.html.haml b/app/views/tweets/retweets.html.haml index 92562ca..07c741e 100644 --- a/app/views/tweets/retweets.html.haml +++ b/app/views/tweets/retweets.html.haml @@ -1,3 +1,4 @@ - title @user.screen_name + "'s Discoveries" - caption :title +- sidebar :users = render "tweets" diff --git a/app/views/tweets/search.html.haml b/app/views/tweets/search.html.haml index 5066822..abf10a2 100644 --- a/app/views/tweets/search.html.haml +++ b/app/views/tweets/search.html.haml @@ -1,4 +1,6 @@ - title "Search" +- caption :title +- sidebar :i .search = form_tag({}, method: "get", class: "form-inline") do = field_set_tag do diff --git a/app/views/tweets/show.html.haml b/app/views/tweets/show.html.haml index 61a79d6..e086f17 100644 --- a/app/views/tweets/show.html.haml +++ b/app/views/tweets/show.html.haml @@ -1,3 +1,4 @@ - title CGI.unescapeHTML(strip_tags(format_tweet_text(@tweet.text))) + " from @" + @user.screen_name - caption @user.screen_name + "'s Tweet" +- sidebar :users .tweets= render @tweet diff --git a/app/views/tweets/timeline.html.haml b/app/views/tweets/timeline.html.haml index 4a78ae5..04769c4 100644 --- a/app/views/tweets/timeline.html.haml +++ b/app/views/tweets/timeline.html.haml @@ -1,3 +1,4 @@ - title @user.screen_name + "'s Newest" - caption :title +- sidebar :users = render "tweets" diff --git a/app/views/users/_user_ranking.html.haml b/app/views/users/_user_ranking.html.haml index 5c27924..2d4021e 100644 --- a/app/views/users/_user_ranking.html.haml +++ b/app/views/users/_user_ranking.html.haml @@ -1,3 +1,6 @@ +- title "User ranking" +- caption :title +- sidebar :users .users %ul.list-inline - @result.each do |user_id, favorites_count, retweets_count| diff --git a/app/views/users/stats.html.haml b/app/views/users/stats.html.haml index b8469f6..285da92 100644 --- a/app/views/users/stats.html.haml +++ b/app/views/users/stats.html.haml @@ -1,4 +1,6 @@ - title "Stats" +- caption :title +- sidebar :users .avatar = image_tag @user.profile_image_url_original, alt: @user.screen_name, width: 128, height: 128 %p profile |