aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrhenium <rhenium@rhe.jp>2015-04-05 15:58:03 +0900
committerrhenium <rhenium@rhe.jp>2015-04-05 15:58:03 +0900
commita1812b253efdc1b06dba4ef59b6c3dcc8ef22c54 (patch)
tree558bb10f0bdf4b0b7b50916a5c3aa5c5e80db21c
parente3d1ef82877f8bbeb6c2e9d6499fdd5ecbc40c94 (diff)
downloadaclog-a1812b253efdc1b06dba4ef59b6c3dcc8ef22c54.tar.gz
web: reorganize views
-rw-r--r--app/assets/javascripts/tweets.coffee.erb22
-rw-r--r--app/assets/stylesheets/base.scss4
-rw-r--r--app/assets/stylesheets/sidebar.scss12
-rw-r--r--app/controllers/about_controller.rb1
-rw-r--r--app/controllers/application_controller.rb13
-rw-r--r--app/controllers/concerns/controller_error_handling.rb13
-rw-r--r--app/controllers/settings_controller.rb2
-rw-r--r--app/controllers/tweets_controller.rb125
-rw-r--r--app/controllers/users_controller.rb18
-rw-r--r--app/helpers/application_helper.rb38
-rw-r--r--app/helpers/tweets_helper.rb26
-rw-r--r--app/models/tweet.rb13
-rw-r--r--app/views/about/index.html.haml2
-rw-r--r--app/views/apidocs/endpoint.html.haml69
-rw-r--r--app/views/apidocs/index.html.haml51
-rw-r--r--app/views/errors/common_error.html.haml21
-rw-r--r--app/views/errors/user_forbidden_error.html.haml6
-rw-r--r--app/views/layouts/_base.html.haml68
-rw-r--r--app/views/layouts/apidocs.html.haml13
-rw-r--r--app/views/layouts/application.html.haml68
-rw-r--r--app/views/layouts/index.html.haml2
-rw-r--r--app/views/settings/confirm_deactivation.html.haml11
-rw-r--r--app/views/settings/deactivate.html.haml6
-rw-r--r--app/views/settings/index.html.haml20
-rw-r--r--app/views/shared/sidebar/_all.html.haml11
-rw-r--r--app/views/shared/sidebar/_all_with_thresholds.html.haml8
-rw-r--r--app/views/shared/sidebar/_reactions_thresholds.html.haml8
-rw-r--r--app/views/shared/sidebar/_recent_thresholds.html.haml8
-rw-r--r--app/views/shared/sidebar/_user.html.haml41
-rw-r--r--app/views/shared/sidebar/_user_with_thresholds.html.haml7
-rw-r--r--app/views/shared/sidebar/parts/_all_menu_items.html.haml2
-rw-r--r--app/views/shared/sidebar/parts/_thresholds.html.haml7
-rw-r--r--app/views/shared/sidebar/parts/_user_menu_items.html.haml10
-rw-r--r--app/views/shared/sidebar/parts/_user_stats.html.haml25
-rw-r--r--app/views/tweets/all_best.html.haml7
-rw-r--r--app/views/tweets/all_timeline.atom.builder2
-rw-r--r--app/views/tweets/all_timeline.html.haml7
-rw-r--r--app/views/tweets/filter.html.haml22
-rw-r--r--app/views/tweets/show.html.haml24
-rw-r--r--app/views/tweets/tweets.atom.builder (renamed from app/views/tweets/_tweets.atom.builder)6
-rw-r--r--app/views/tweets/tweets.html.haml8
-rw-r--r--app/views/tweets/tweets.json.jbuilder15
-rw-r--r--app/views/tweets/user_best.html.haml8
-rw-r--r--app/views/tweets/user_favorited_by.atom.builder2
-rw-r--r--app/views/tweets/user_favorited_by.html.haml12
-rw-r--r--app/views/tweets/user_favorites.atom.builder2
-rw-r--r--app/views/tweets/user_favorites.html.haml8
-rw-r--r--app/views/tweets/user_timeline.atom.builder2
-rw-r--r--app/views/tweets/user_timeline.html.haml8
-rw-r--r--app/views/users/discovered_by.html.haml31
-rw-r--r--app/views/users/discovered_users.html.haml31
51 files changed, 463 insertions, 483 deletions
diff --git a/app/assets/javascripts/tweets.coffee.erb b/app/assets/javascripts/tweets.coffee.erb
index 670f04a..3da1ab8 100644
--- a/app/assets/javascripts/tweets.coffee.erb
+++ b/app/assets/javascripts/tweets.coffee.erb
@@ -5,6 +5,8 @@ Views.tweets =
data:
statuses: []
loading: false
+ next: null
+ prev: null
methods:
failProfileImage: (e) ->
e.target.src = '<%= image_path("profile_image_missing.png") %>'
@@ -18,7 +20,7 @@ Views.tweets =
autolinked = twttr.txt.autoLink(str, { suppressLists: true, usernameIncludeSymbol: true, usernameUrlBase: "/" })
autolinked.replace(/\r?\n/g, "<br />\n")
- loadJSON = (url, callback) ->
+ loadJSON = (url) ->
vm.loading = true
superagent
.get url
@@ -38,16 +40,14 @@ Views.tweets =
status.loading = false
vm.statuses = vm.statuses.concat(json.statuses)
vm.loading = false
- if callback
- callback()
+ vm.next = json.next
+ vm.prev = json.prev
loadJSON(window.location.toString())
- if (link = $("link[rel=next]")).length
- content = $(".statuses")
- $(window).scroll ->
- if vm.loading || !link.attr("href")
- return
- if (content.offset().top + content.height()) - ($(document).scrollTop() + $(window).height()) < 100
- loadJSON link.attr("href"), ->
- link.attr("href", json.next)
+ content = $(".statuses")
+ $(window).scroll ->
+ if vm.loading || !vm.next
+ return
+ if (content.offset().top + content.height()) - ($(document).scrollTop() + $(window).height()) < 100
+ loadJSON vm.next
diff --git a/app/assets/stylesheets/base.scss b/app/assets/stylesheets/base.scss
index 6f3f602..a97e0bd 100644
--- a/app/assets/stylesheets/base.scss
+++ b/app/assets/stylesheets/base.scss
@@ -169,7 +169,7 @@ a.list-group-item {
border-color: #cecac7;
}
-div.loading-box {
+.loading-box {
margin: 30px 0;
text-align: center;
}
@@ -179,7 +179,7 @@ img.loading-image {
width: 16px !important;
}
-div.refresh-box {
+.refresh-box {
margin: 30px 0;
text-align: center;
}
diff --git a/app/assets/stylesheets/sidebar.scss b/app/assets/stylesheets/sidebar.scss
index c6b7b2d..349d08b 100644
--- a/app/assets/stylesheets/sidebar.scss
+++ b/app/assets/stylesheets/sidebar.scss
@@ -2,6 +2,7 @@
@import "bootstrap/mixins";
.sidebar {
+ @include clearfix;
h1 {
margin-top: 0;
font-size: 32px;
@@ -55,7 +56,14 @@
}
}
- .sidebar-list {
- margin-left: 0;
+ .list-group {
+ @media (max-width: 768px) {
+ float: left;
+ width: 50%;
+ padding-right: 15px;
+ &:last-child {
+ padding-right: 0;
+ }
+ }
}
}
diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb
index 72b767f..6b7d79e 100644
--- a/app/controllers/about_controller.rb
+++ b/app/controllers/about_controller.rb
@@ -1,6 +1,5 @@
class AboutController < ApplicationController
def index
- render layout: "index"
end
def status
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 4bd1112..1718bfa 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,6 +1,6 @@
class ApplicationController < ActionController::Base
#include SecurityHeaders
- include ControllerErrorHandling if Rails.env.production?
+ include ControllerErrorHandling
protect_from_forgery with: :exception
@@ -32,8 +32,15 @@ class ApplicationController < ActionController::Base
(logged_in? && current_user.permitted_to_see?(user))
end
- def authorize_to_show_user!(user)
- authorized_to_show_user?(user) || raise(Aclog::Exceptions::UserProtected, user)
+ def authorize!(object)
+ if object.is_a? User
+ authorized_to_show_user?(object) || raise(Aclog::Exceptions::UserProtected, object)
+ elsif object.is_a? Tweet
+ authorize! object.user
+ else
+ raise ArgumentError, "parameter `object` must be a User or a Tweet"
+ end
+ object
end
private
diff --git a/app/controllers/concerns/controller_error_handling.rb b/app/controllers/concerns/controller_error_handling.rb
index cd912af..520fe80 100644
--- a/app/controllers/concerns/controller_error_handling.rb
+++ b/app/controllers/concerns/controller_error_handling.rb
@@ -7,6 +7,7 @@ module ControllerErrorHandling
message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
message << " " << exception.backtrace.join("\n ")
logger.fatal("#{message}\n\n")
+ @details = message if Rails.env.development?
@message = "#{t("error.internal_error")}: #{request.uuid}"
render "errors/common_error", status: 500, formats: :html
@@ -26,13 +27,13 @@ module ControllerErrorHandling
Aclog::Exceptions::Forbidden,
Twitter::Error::Unauthorized,
Twitter::Error::Forbidden do |exception|
- @message = t("error.forbidden")
+ if @user
+ @message = t("error.forbidden")
+ @sidebars = [:user]
+ else
+ @message = t("error.forbidden")
+ end
render "errors/common_error", status: 403, formats: :html
end
-
- rescue_from Aclog::Exceptions::UserProtected do |exception|
- @message = t("error.forbidden")
- render "errors/user_forbidden_error", status: 403, formats: :html
- end
end
end
diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb
index 0b5093d..ba83ee4 100644
--- a/app/controllers/settings_controller.rb
+++ b/app/controllers/settings_controller.rb
@@ -25,7 +25,7 @@ class SettingsController < ApplicationController
private
def set_account
- redirect_to "/i/login" unless logged_in?
+ return redirect_to "/i/login" unless logged_in?
@account = current_user.account
end
end
diff --git a/app/controllers/tweets_controller.rb b/app/controllers/tweets_controller.rb
index 5b0fed4..a20493a 100644
--- a/app/controllers/tweets_controller.rb
+++ b/app/controllers/tweets_controller.rb
@@ -1,124 +1,101 @@
class TweetsController < ApplicationController
def show
@tweet = Tweet.find(params[:id])
- @user = @tweet.user
- authorize_to_show_user! @user
+ authorize! @user = @tweet.user
+
+ @sidebars = [:user]
+ @title = "\"#{view_context.truncate(CGI.unescapeHTML(@tweet.text))}\" from #{@user.name} (@#{@user.screen_name})"
+ @header = "@#{@user.screen_name}'s Tweet"
rescue ActiveRecord::RecordNotFound
import
end
- def responses
- show
- end
-
def import
- tweet = Tweet.find_by(id: params[:id])
-
- if tweet && tweet.user.registered?
- account = tweet.user.account
- elsif logged_in?
- account = current_user.account
- else
- account = nil
- end
-
- tweet = Tweet.import_from_twitter(params[:id], account)
+ tweet = Tweet.import_from_twitter(params[:id], current_user)
redirect_to tweet
end
+ def responses
+ authorize! @tweet = Tweet.find(params[:id])
+ end
+
def user_index
- @user = require_user
- authorize_to_show_user! @user
+ authorize! @user = User.find(screen_name: params[:screen_name])
if @user.registered?
user_best
- render :user_best
else
user_timeline
- render :user_timeline
end
end
def user_best
- @user = require_user
- authorize_to_show_user! @user
+ authorize! @user ||= User.find(screen_name: params[:screen_name])
+ @tweets = @user.tweets.reacted.parse_recent(params[:recent]).order_by_reactions.paginate(page: params[:page])
- @tweets = paginate_with_page_number @user.tweets.reacted.parse_recent(params[:recent]).order_by_reactions
+ @sidebars = [:user, :recent_thresholds]
+ @title = "@#{@user.screen_name}'s Best Tweets"
end
def user_timeline
- @user = require_user
- authorize_to_show_user! @user
- @tweets = paginate @user.tweets.reacted(params[:reactions]).order_by_id
+ authorize! @user ||= User.find(screen_name: params[:screen_name])
+ @tweets = @user.tweets.reacted(params[:reactions]).order_by_id.paginate(params.permit(:page, :since_id, :max_id))
+
+ @sidebars = [:user, :reactions_thresholds]
+ @title = "@#{@user.screen_name}'s Timeline"
end
def user_favorites
- @user = require_user
- authorize_to_show_user! @user
- @tweets = paginate_with_page_number Tweet.reacted(params[:reactions]).favorited_by(@user).order("`favorites`.`id` DESC").eager_load(:user)
+ authorize! @user = User.find(screen_name: params[:screen_name])
+ @tweets = Tweet.reacted(params[:reactions]).favorited_by(@user).order("`favorites`.`id` DESC").eager_load(:user).paginate(page: params[:page])
+
+ @sidebars = [:user, :reactions_thresholds]
+ @title = "@#{@user.screen_name}'s Favorites"
end
def user_favorited_by
- @user = require_user
- authorize_to_show_user! @user
- @source_user = User.find(id: params[:source_user_id], screen_name: params[:source_screen_name])
- authorize_to_show_user! @source_user
- @tweets = paginate @user.tweets.reacted(params[:reactions]).favorited_by(@source_user).order_by_id.eager_load(:user)
+ authorize! @user = User.find(screen_name: params[:screen_name])
+ authorize! @source_user = User.find(screen_name: params[:source_screen_name])
+ @tweets = @user.tweets.reacted(params[:reactions]).favorited_by(@source_user).order_by_id.eager_load(:user).paginate(params.permit(:page, :since_id, :max_id))
+
+ @sidebars = [:user, :reactions_thresholds]
+ @title = "@#{@user.screen_name}'s Tweets favorited by @#{@source_user.screen_name}"
end
def all_best
- @tweets = paginate_with_page_number Tweet.reacted.parse_recent(params[:recent]).order_by_reactions.eager_load(:user)
+ @tweets = Tweet.reacted.parse_recent(params[:recent]).order_by_reactions.eager_load(:user).paginate(page: params[:page])
+
+ @sidebars = [:all, :recent_thresholds]
+ @title = "Top Tweets"
end
def all_timeline
- @tweets = paginate Tweet.reacted(params[:reactions]).order_by_id.eager_load(:user)
+ @tweets = Tweet.reacted(params[:reactions]).order_by_id.eager_load(:user).paginate(params.permit(:page, :since_id, :max_id))
+
+ @sidebars = [:all, :reactions_thresholds]
+ @title = "Public Timeline"
end
def filter
- @tweets = paginate Tweet.recent((params[:period] || 7).days).filter_by_query(params[:q].to_s).order_by_id.eager_load(:user)
+ @tweets = Tweet.recent((params[:period] || 7).days).filter_by_query(params[:q].to_s).order_by_id.eager_load(:user).paginate(params.permit(:page, :since_id, :max_id))
+
+ @sidebars = [:all]
+ @title = "Filter"
end
private
- def require_user
- User.find(id: params[:user_id], screen_name: params[:screen_name])
- end
+ def render(*args)
+ return super(*args) if args.size > 0
- def paginate(tweets)
- if params[:page]
- paginate_with_page_number tweets
+ #raise StandardError, request.formats
+ if template_exists?(params[:action], params[:controller], true, [], formats: request.formats)
+ super
else
- tweets.limit(params_count).max_id(params[:max_id]).since_id(params[:since_id])
- end
- end
-
- def paginate_with_page_number(tweets)
- @page = (params[:page] || 1).to_i
- tweets.page(@page, params_count)
- end
-
- def params_count
- [(params[:count] || Settings.tweets.count.default).to_i, Settings.tweets.count.max].min
- end
-
- def render(*args)
- if @tweets && @tweets.length > 0
- if @page
- @prev_url = @page == 1 ? nil : url_for(params.merge(page: @page - 1))
- @next_url = url_for(params.merge(page: @page + 1))
+ if @tweets
+ super("tweets")
else
- @prev_url = url_for(params.tap {|h| h.delete(:max_id) }.merge(since_id: @tweets.first.id))
- @next_url = url_for(params.tap {|h| h.delete(:since_id) }.merge(max_id: @tweets.last.id - 1))
+ super # bug
end
end
-
- if request.format == :json
- if !template_exists?(params[:action], params[:controller], true)
- if @tweets
- return super("tweets")
- end
- end
- end
-
- super
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index b43ad0e..fa0de47 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,33 +1,31 @@
class UsersController < ApplicationController
def discovered_by
- @user = require_user
+ authorize! @user = User.find(screen_name: params[:screen_name])
@user.require_registered!
@result = @user.count_discovered_by.take(Settings.users.count)
@cached_users = User.find(@result.map(&:first)).map {|user| [user.id, user] }.to_h
+
+ @sidebars = [:user]
end
def discovered_users
- @user = require_user
+ authorize! @user = User.find(screen_name: params[:screen_name])
@user.require_registered!
@result = @user.count_discovered_users.take(Settings.users.count)
@cached_users = User.find(@result.map(&:first)).map {|user| [user.id, user] }.to_h
+
+ @sidebars = [:user]
end
def i_suggest_screen_name
- sleep 2 if Rails.env.development?
+ sleep 1 if Rails.env.development?
users = User.suggest_screen_name(params[:head].to_s).limit(10)
filtered = users.map {|user| { name: user.name, screen_name: user.screen_name, profile_image_url: user.profile_image_url(:mini) } }
render json: filtered
end
def stats
- sleep 2 if Rails.env.development?
- user = require_user
+ user = User.find(screen_name: params[:screen_name])
render json: user.stats.to_h
end
-
- private
- def require_user
- User.find(screen_name: params[:screen_name])
- end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 7508780..0c61d34 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,12 +1,6 @@
module ApplicationHelper
include Twitter::Autolink
- def title(*args)
- content_for :title do
- (args.compact).join(" - ")
- end
- end
-
def register_view_part(name)
(@view_parts ||= []) << name
end
@@ -22,6 +16,15 @@ module ApplicationHelper
}
end
+ def title(name = nil, suffix = false)
+ if name
+ @title = name
+ title
+ else
+ ["aclog", @title].compact.join(" - ")
+ end
+ end
+
def link_to_with_active(name, options = {}, html_options = {}, &block)
if current_page?(options)
html_options[:class] = (html_options[:class].to_s + " active").strip
@@ -39,6 +42,29 @@ module ApplicationHelper
end
end
+ def render_sidebars
+ str = ""
+ if @sidebars
+ @sidebars.each do |sidebar|
+ case sidebar
+ when :user
+ str << render("shared/sidebar/user")
+ when :all
+ str << render("shared/sidebar/all")
+ when :reactions_thresholds
+ str << render("shared/sidebar/reactions_thresholds")
+ when :recent_thresholds
+ str << render("shared/sidebar/recent_thresholds")
+ end
+ end
+ end
+ str.html_safe
+ end
+
+ def sidebar?
+ @sidebars && @sidebars.size > 0
+ end
+
# utf8, form
def utf8_enforcer_tag; raw "" end
end
diff --git a/app/helpers/tweets_helper.rb b/app/helpers/tweets_helper.rb
index 18c6097..749d795 100644
--- a/app/helpers/tweets_helper.rb
+++ b/app/helpers/tweets_helper.rb
@@ -1,23 +1,9 @@
module TweetsHelper
- def favorites_truncate_count
- params[:full] == "true" ? Settings.tweets.favorites.max : Settings.tweets.favorites.default
- end
-
- def favorites_truncated?(tweet)
- (favorites_truncate_count || Float::INFINITY) < [tweet.favorites_count, tweet.retweets_count].max
- end
-
- def format_tweet_text(text)
- text = sanitize(text)
- text = auto_link(text, suppress_lists: true, username_include_symbol: true, username_url_base: "/")
- text.gsub(/\r\n|\r|\n/, "<br />").html_safe
- end
-
- def link_to_source_text(source, *args)
- if /^<a href="(.+?)" rel="nofollow">(.+?)<\/a>/ =~ source
- link_to $2, $1, *args
- else
- source
- end
+ def header
+ orig = @header || @title
+ orig
+ .sub(/@\w{1,20}'s/) {|t| "<small>#{t.delete("@")}</small>" }
+ .sub(/\w+ by @\w{1,20}/) {|t| "<small>#{t.delete("@")}</small>" }
+ .html_safe
end
end
diff --git a/app/models/tweet.rb b/app/models/tweet.rb
index 5b58c07..9877d5a 100644
--- a/app/models/tweet.rb
+++ b/app/models/tweet.rb
@@ -24,6 +24,15 @@ class Tweet < ActiveRecord::Base
scope :favorited_by, ->(user) { joins(:favorites).where(favorites: { user: user }) }
+ scope :paginate, ->(params) {
+ page_per = [(params[:count] || Settings.tweets.count.default).to_i, Settings.tweets.count.max].min
+ if params[:page]
+ page([params[:page].to_i, 1].max, page_per)
+ else
+ limit(page_per).max_id(params[:max_id]).since_id(params[:since_id])
+ end
+ }
+
class << self
# Builds a new instance of Tweet and initialize with JSON data from Twitter API.
# @note This method just builds an instance, doesn't save it.
@@ -73,8 +82,8 @@ class Tweet < ActiveRecord::Base
# @param [Integer] id Target status ID.
# @param [Account] client The Twitter::REST::Client to be used.
# @return [Tweet] The Tweet instance imported.
- def import_from_twitter(id, account = nil)
- client = (account || Account.random).client
+ def import_from_twitter(id, current_user = nil)
+ client = (current_user ? current_user.account : Account.random).client
st = client.status(id)
st = st.retweeted_status if st.retweet?
diff --git a/app/views/about/index.html.haml b/app/views/about/index.html.haml
index 5ddc158..106e181 100644
--- a/app/views/about/index.html.haml
+++ b/app/views/about/index.html.haml
@@ -1,4 +1,4 @@
-- title "aclog: Twitter 分析サービス"
+- title "Twitter 分析サービス"
.front-hero
.container
%p<
diff --git a/app/views/apidocs/endpoint.html.haml b/app/views/apidocs/endpoint.html.haml
index e3f956a..8770b57 100644
--- a/app/views/apidocs/endpoint.html.haml
+++ b/app/views/apidocs/endpoint.html.haml
@@ -1,30 +1,41 @@
- title "aclog API: #{format_endpoint_name(@endpoint)}"
-%h1= format_endpoint_name(@endpoint)
-%p= @endpoint.route_description
-%h2 Resource URL
-%p= root_url + "api" + @endpoint.route_path # TODO
-%h2 Parameters
-%table.table.api-params
- %tbody
- - @endpoint.route_params.each do |name, options|
- %tr
- %th
- = name
- - if options[:required]
- %small required
- - else
- %small optional
- %td
- %p= options[:desc]
- %p
- %b> Type
- \:
- = options[:type]
-- if @example_request_uri
- %h2 Example Request
- %p
- %span= @endpoint.route_method
- %code#example_request_uri= @example_request_uri
- %pre
- %code
- #example_request_loading= image_tag "loading.gif", alt: "loading..."
+.container
+ .row
+ .col-sm-3.sidebar
+ %h1 aclog API
+ .sidebar-list
+ .list-group.list-group-scroll
+ - @routes.values.inject(:merge).each do |namespace, endpoints|
+ %span.list-group-head= namespace.titleize
+ - endpoints.reject {|_, e| e.route_nodoc || e.route_deprecated }.each do |path, endpoint|
+ = link_to_with_active format_endpoint_name(endpoint), about_api_endpoint_path(endpoint.route_method.downcase, namespace, path), class: "list-group-item"
+ .col-sm-9
+ %h1= format_endpoint_name(@endpoint)
+ %p= @endpoint.route_description
+ %h2 Resource URL
+ %p= root_url + "api" + @endpoint.route_path # TODO
+ %h2 Parameters
+ %table.table.api-params
+ %tbody
+ - @endpoint.route_params.each do |name, options|
+ %tr
+ %th
+ = name
+ - if options[:required]
+ %small required
+ - else
+ %small optional
+ %td
+ %p= options[:desc]
+ %p
+ %b> Type
+ \:
+ = options[:type]
+ - if @example_request_uri
+ %h2 Example Request
+ %p
+ %span= @endpoint.route_method
+ %code#example_request_uri= @example_request_uri
+ %pre
+ %code
+ #example_request_loading= image_tag "loading.gif", alt: "loading..."
diff --git a/app/views/apidocs/index.html.haml b/app/views/apidocs/index.html.haml
index 1bfb197..b011faf 100644
--- a/app/views/apidocs/index.html.haml
+++ b/app/views/apidocs/index.html.haml
@@ -1,21 +1,32 @@
- title "aclog API"
-%h2 OAuth
-%p ツイートを非公開にしているアカウントの情報にアクセスするには本人であるか、対象のアカウントをフォローしている必要があります。Aclog API では、その認証に OAuth Echo を使用します。
-%p OAuth Echo を使用するには以下のリクエストヘッダを使用します。
-%pre
- %code
- :preserve
- X-Auth-Service-Provider: https://api.twitter.com/1.1/account/verify_credentials.json
- X-Verify-Credentials-Authorization: OAuth rea...
-OAuth Echo の詳細については
-%a{href: "#"} Twitter のドキュメント
-を参照してください。
-%h2 Endpoints
-- @routes.values.inject(:merge).each do |namespace, endpoints|
- %h3= namespace.titleize
- %table.table
- %tbody
- - endpoints.reject {|_, e| e.route_nodoc }.each do |path, endpoint|
- %tr
- %td= link_to format_endpoint_name(endpoint), about_api_endpoint_path(endpoint.route_method.downcase, namespace, path), class: (endpoint.route_deprecated ? "deprecated" : nil)
- %td= endpoint.route_description
+.container
+ .row
+ .col-sm-3.sidebar
+ %h1 aclog API
+ .sidebar-list
+ .list-group.list-group-scroll
+ - @routes.values.inject(:merge).each do |namespace, endpoints|
+ %span.list-group-head= namespace.titleize
+ - endpoints.reject {|_, e| e.route_nodoc || e.route_deprecated }.each do |path, endpoint|
+ = link_to_with_active format_endpoint_name(endpoint), about_api_endpoint_path(endpoint.route_method.downcase, namespace, path), class: "list-group-item"
+ .col-sm-9
+ %h2 OAuth
+ %p ツイートを非公開にしているアカウントの情報にアクセスするには本人であるか、対象のアカウントをフォローしている必要があります。Aclog API では、その認証に OAuth Echo を使用します。
+ %p OAuth Echo を使用するには以下のリクエストヘッダを使用します。
+ %pre
+ %code
+ :preserve
+ X-Auth-Service-Provider: https://api.twitter.com/1.1/account/verify_credentials.json
+ X-Verify-Credentials-Authorization: OAuth rea...
+ OAuth Echo の詳細については
+ %a{href: "#"} Twitter のドキュメント
+ を参照してください。
+ %h2 Endpoints
+ - @routes.values.inject(:merge).each do |namespace, endpoints|
+ %h3= namespace.titleize
+ %table.table
+ %tbody
+ - endpoints.reject {|_, e| e.route_nodoc }.each do |path, endpoint|
+ %tr
+ %td= link_to format_endpoint_name(endpoint), about_api_endpoint_path(endpoint.route_method.downcase, namespace, path), class: (endpoint.route_deprecated ? "deprecated" : nil)
+ %td= endpoint.route_description
diff --git a/app/views/errors/common_error.html.haml b/app/views/errors/common_error.html.haml
index f5dcc29..9889e33 100644
--- a/app/views/errors/common_error.html.haml
+++ b/app/views/errors/common_error.html.haml
@@ -1,4 +1,19 @@
- title "#{response.status}: #{@message}"
-.container.error-page
- %h1= response.status
- %p= @message
+.container
+ - if sidebar?
+ .row
+ .col-sm-3.col-md-offset-1
+ .sidebar
+ = render_sidebars
+ .col-sm-9.col-md-7.col-lg-6
+ .error-page
+ %h1= response.status
+ %p= @message
+ - if @details
+ %pre= @details
+ - else
+ .error-page
+ %h1= response.status
+ %p= @message
+ - if @details
+ %pre= @details
diff --git a/app/views/errors/user_forbidden_error.html.haml b/app/views/errors/user_forbidden_error.html.haml
deleted file mode 100644
index a107478..0000000
--- a/app/views/errors/user_forbidden_error.html.haml
+++ /dev/null
@@ -1,6 +0,0 @@
-- title "#{response.status}: #{@message}"
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/user", user: @user
-.col-sm-9.col-md-7.col-lg-6.error-page
- %h1= response.status
- %p= @message
diff --git a/app/views/layouts/_base.html.haml b/app/views/layouts/_base.html.haml
deleted file mode 100644
index 32ce935..0000000
--- a/app/views/layouts/_base.html.haml
+++ /dev/null
@@ -1,68 +0,0 @@
-%html{xmlns: "http://www.w3.org/1999/xhtml"}
- %head
- %title= yield :title
- %meta{name: "viewport", content: "width=device-width"}
- %meta{"http-equiv" => "X-UA-Compatible", content: "IE=edge,chrome=1"}
- %link{rel: "shortcut icon", href: image_path("favicon.ico")}
- %link{rel: "apple-touch-icon-precomposed", href: image_path("apple-touch-icon-precomposed.png")}
- %meta{name: "msapplication-TileImage", content: image_path("tile-image.png")}
- %meta{name: "msapplication-TileColor", content: "#f0eadb"}
- %meta{name: "twitter:widgets:csp", content: "on"}
- = stylesheet_link_tag "application", media: nil
- = javascript_include_tag "application"
- = csrf_meta_tags
- - if @next_url
- %link{rel: "next", href: @next_url}
- - if @prev_url
- %link{rel: "prev", href: @prev_url}
- %body{data: meta_info}
- %nav.navbar.navbar-static-top
- .container
- .nav.navbar-nav.navbar-left
- = link_to root_path, class: "navbar-brand" do
- aclog
- - if Rails.env.development?
- (dev)
- %ul.nav.navbar-nav.navbar-right
- %li.dropdown.omittable
- %a.dropdown-toggle{href: "#", data: { toggle: "dropdown" }}<
- All
- %span.caret/
- %ul.dropdown-menu
- %li= link_to "Best", best_path
- %li= link_to "Timeline", timeline_path
- %li.dropdown.omittable#user-jump-dropdown
- %a.dropdown-toggle{href: "#", data: { toggle: "dropdown", "v-on" => "click: focus" }}<
- User
- %span.caret/
- %ul.dropdown-menu
- %li
- %form{autocomplete: "off", data: {"v-on" => "submit: submit"}}
- .input-group
- %input.form-control{type: "text", placeholder: "Username", data: {"v-model" => "enteredUserName"}}
- %span.input-group-btn
- %button.btn{type: "submit"} Go
- %template{data: {"v-repeat" => "users"}}
- %li.user-jump-suggestion
- %a{href: user_path("dummy").sub("dummy", "{{screen_name}}"), title: "{{name}} (@{{screen_name}})"}<
- %img.twitter-icon{src: "{{profile_image_url}}", alt: "@{{screen_name}}", data: {"v-on" => "error: failProfileImage"}}
- %span @{{screen_name}}
- %li{data: {"v-if" => "loading"}}
- %img.loading-image{src: image_path("loading.gif")}
- - if logged_in?
- %li.dropdown
- %a.dropdown-toggle{href: "#", data: { toggle: "dropdown" }}<
- = profile_image_tag current_user, :mini
- %span.caret/
- %ul.dropdown-menu
- %li= link_to "Best", user_path(current_user.screen_name)
- %li= link_to "Timeline", user_timeline_path(current_user.screen_name)
- %li= link_to "Favorites", user_favorites_path(current_user.screen_name)
- %li= link_to "Discovered by", user_discovered_by_path(current_user.screen_name)
- %li= link_to "Discovered users", user_discovered_users_path(current_user.screen_name)
- %li.divider
- %li= link_to "Settings", settings_path
- %li= link_to "Sign out", logout_path
- - else
- %li= link_to "Sign in", "/i/login?redirect_after_login=" + CGI.escape(request.fullpath), method: :post, class: "signup"
- = yield
diff --git a/app/views/layouts/apidocs.html.haml b/app/views/layouts/apidocs.html.haml
deleted file mode 100644
index 50de975..0000000
--- a/app/views/layouts/apidocs.html.haml
+++ /dev/null
@@ -1,13 +0,0 @@
-= render layout: "layouts/base" do
- .container
- .row
- .col-sm-3.sidebar
- %h1 aclog API
- .sidebar-list
- .list-group.list-group-scroll
- - @routes.values.inject(:merge).each do |namespace, endpoints|
- %span.list-group-head= namespace.titleize
- - endpoints.reject {|_, e| e.route_nodoc || e.route_deprecated }.each do |path, endpoint|
- = link_to_with_active format_endpoint_name(endpoint), about_api_endpoint_path(endpoint.route_method.downcase, namespace, path), class: "list-group-item"
- .col-sm-9
- = yield
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
index f1f149e..10cfdce 100644
--- a/app/views/layouts/application.html.haml
+++ b/app/views/layouts/application.html.haml
@@ -1,4 +1,64 @@
-= render layout: "layouts/base" do
- .container
- .row
- = yield
+%html{xmlns: "http://www.w3.org/1999/xhtml"}
+ %head
+ %title= title
+ %meta{name: "viewport", content: "width=device-width"}
+ %meta{"http-equiv" => "X-UA-Compatible", content: "IE=edge,chrome=1"}
+ %link{rel: "shortcut icon", href: image_path("favicon.ico")}
+ %link{rel: "apple-touch-icon-precomposed", href: image_path("apple-touch-icon-precomposed.png")}
+ %meta{name: "msapplication-TileImage", content: image_path("tile-image.png")}
+ %meta{name: "msapplication-TileColor", content: "#f0eadb"}
+ %meta{name: "twitter:widgets:csp", content: "on"}
+ = stylesheet_link_tag "application", media: nil
+ = javascript_include_tag "application"
+ = csrf_meta_tags
+ %body{data: meta_info}
+ %nav.navbar.navbar-static-top
+ .container
+ .nav.navbar-nav.navbar-left
+ = link_to root_path, class: "navbar-brand" do
+ aclog
+ - if Rails.env.development?
+ (dev)
+ %ul.nav.navbar-nav.navbar-right
+ %li.dropdown.omittable
+ %a.dropdown-toggle{href: "#", data: { toggle: "dropdown" }}<
+ All
+ %span.caret/
+ %ul.dropdown-menu
+ %li= link_to "Best", best_path
+ %li= link_to "Timeline", timeline_path
+ %li.dropdown.omittable#user-jump-dropdown
+ %a.dropdown-toggle{href: "#", data: { toggle: "dropdown", "v-on" => "click: focus" }}<
+ User
+ %span.caret/
+ %ul.dropdown-menu
+ %li
+ %form{autocomplete: "off", data: {"v-on" => "submit: submit"}}
+ .input-group
+ %input.form-control{type: "text", placeholder: "Username", data: {"v-model" => "enteredUserName"}}
+ %span.input-group-btn
+ %button.btn{type: "submit"} Go
+ %template{data: {"v-repeat" => "users"}}
+ %li.user-jump-suggestion
+ %a{href: user_path("dummy").sub("dummy", "{{screen_name}}"), title: "{{name}} (@{{screen_name}})"}<
+ %img.twitter-icon{src: "{{profile_image_url}}", alt: "@{{screen_name}}", data: {"v-on" => "error: failProfileImage"}}
+ %span @{{screen_name}}
+ %li.loading-box{data: {"v-if" => "loading"}}
+ %img.loading-image{src: image_path("loading.gif")}
+ - if logged_in?
+ %li.dropdown
+ %a.dropdown-toggle{href: "#", data: { toggle: "dropdown" }}<
+ = profile_image_tag current_user, :mini
+ %span.caret/
+ %ul.dropdown-menu
+ %li= link_to "Best", user_path(current_user.screen_name)
+ %li= link_to "Timeline", user_timeline_path(current_user.screen_name)
+ %li= link_to "Favorites", user_favorites_path(current_user.screen_name)
+ %li= link_to "Discovered by", user_discovered_by_path(current_user.screen_name)
+ %li= link_to "Discovered users", user_discovered_users_path(current_user.screen_name)
+ %li.divider
+ %li= link_to "Settings", settings_path
+ %li= link_to "Sign out", logout_path
+ - else
+ %li= link_to "Sign in", "/i/login?redirect_after_login=" + CGI.escape(request.fullpath), method: :post, class: "signup"
+ = yield
diff --git a/app/views/layouts/index.html.haml b/app/views/layouts/index.html.haml
deleted file mode 100644
index f56cabd..0000000
--- a/app/views/layouts/index.html.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-= render layout: "layouts/base" do
- = yield
diff --git a/app/views/settings/confirm_deactivation.html.haml b/app/views/settings/confirm_deactivation.html.haml
index 6eb1e4d..6be54a0 100644
--- a/app/views/settings/confirm_deactivation.html.haml
+++ b/app/views/settings/confirm_deactivation.html.haml
@@ -1,6 +1,7 @@
- title "Account Deactivation"
-%h1 Deactivation
-= form_tag "/i/settings/deactivate", method: :post do
- = link_to "Cancel", action: "index"
- = submit_tag
-
+.container
+ .row
+ %h1 Deactivation
+ = 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 f1ec1ed..821afa0 100644
--- a/app/views/settings/deactivate.html.haml
+++ b/app/views/settings/deactivate.html.haml
@@ -1,3 +1,5 @@
- title "Account Deactivation"
-%h1 Deactivation
-ご利用ありがとうございました。記録を停止されますが、データは削除されません。もう一度ログインをすると記録が再開されます。
+.container
+ .row
+ %h1 Deactivation
+ ご利用ありがとうございました。記録を停止されますが、データは削除されません。もう一度ログインをすると記録が再開されます。
diff --git a/app/views/settings/index.html.haml b/app/views/settings/index.html.haml
index 89bd0a1..d0a4f53 100644
--- a/app/views/settings/index.html.haml
+++ b/app/views/settings/index.html.haml
@@ -1,10 +1,12 @@
- title "Settings"
-%h1.col-sm-3.col-md-offset-1.setting Settings
-.col-sm-9.col-md-7.col-lg-6
- = form_tag "/i/settings/update", method: :post do
- .checkbox
- = check_box_tag :notification_enabled, true, @account.notification_enabled
- = label_tag :notification_enabled, t("views.settings.enable_notification")
- .form-group
- = submit_tag "Submit", class: "btn btn-default"
- = link_to t("views.settings.confirm_deactivation"), { controller: "settings", action: "confirm_deactivation" }, class: "btn btn-link"
+.container
+ .row
+ %h1.col-sm-3.col-md-offset-1.setting Settings
+ .col-sm-9.col-md-7.col-lg-6
+ = form_tag "/i/settings/update", method: :post do
+ .checkbox
+ = check_box_tag :notification_enabled, true, @account.notification_enabled
+ = label_tag :notification_enabled, t("views.settings.enable_notification")
+ .form-group
+ = submit_tag "Submit", class: "btn btn-default"
+ = link_to t("views.settings.confirm_deactivation"), { controller: "settings", action: "confirm_deactivation" }, class: "btn btn-link"
diff --git a/app/views/shared/sidebar/_all.html.haml b/app/views/shared/sidebar/_all.html.haml
index 51d67e0..d5497fc 100644
--- a/app/views/shared/sidebar/_all.html.haml
+++ b/app/views/shared/sidebar/_all.html.haml
@@ -1,6 +1,5 @@
-.sidebar
- %h1 All
- .sidebar-list
- .list-group
- = render partial: "shared/sidebar/parts/all_menu_items"
-
+%h1 All
+.sidebar-list
+ .list-group
+ = link_to_with_active "Best", best_path, class: "list-group-item"
+ = link_to_with_active "Timeline", timeline_path, class: "list-group-item"
diff --git a/app/views/shared/sidebar/_all_with_thresholds.html.haml b/app/views/shared/sidebar/_all_with_thresholds.html.haml
deleted file mode 100644
index 5cf31c4..0000000
--- a/app/views/shared/sidebar/_all_with_thresholds.html.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-.sidebar
- %h1 All
- .sidebar-list.row
- .list-group.col-xs-6.col-sm-12
- = render partial: "shared/sidebar/parts/all_menu_items"
- .list-group.col-xs-6.col-sm-12
- = render partial: "shared/sidebar/parts/thresholds", locals: thresholds
-
diff --git a/app/views/shared/sidebar/_reactions_thresholds.html.haml b/app/views/shared/sidebar/_reactions_thresholds.html.haml
new file mode 100644
index 0000000..460da81
--- /dev/null
+++ b/app/views/shared/sidebar/_reactions_thresholds.html.haml
@@ -0,0 +1,8 @@
+.list-group
+ - [0, 1, 3, 10, 50, 100].each_slice(2).to_a.transpose.each do |ns|
+ .list-group-col
+ - ns.each do |n|
+ - if n.to_s == (params[:reactions] || 1).to_s
+ = link_to n, params, class: "list-group-item active"
+ - else
+ = link_to n, params.merge(reactions: (n == 1 ? nil : n)), class: "list-group-item"
diff --git a/app/views/shared/sidebar/_recent_thresholds.html.haml b/app/views/shared/sidebar/_recent_thresholds.html.haml
new file mode 100644
index 0000000..c7599ba
--- /dev/null
+++ b/app/views/shared/sidebar/_recent_thresholds.html.haml
@@ -0,0 +1,8 @@
+.list-group
+ - ["All Time", "1d", "1w", "1m", "3m", "1y"].each_slice(2).to_a.transpose.each do |ns|
+ .list-group-col
+ - ns.each do |n|
+ - if n.to_s == (params[:recent] || "All Time").to_s
+ = link_to n, params, class: "list-group-item active"
+ - else
+ = link_to n, params.merge(recent: (n == "All Time" ? nil : n)), class: "list-group-item"
diff --git a/app/views/shared/sidebar/_user.html.haml b/app/views/shared/sidebar/_user.html.haml
index b83db19..94eb0c2 100644
--- a/app/views/shared/sidebar/_user.html.haml
+++ b/app/views/shared/sidebar/_user.html.haml
@@ -1,5 +1,36 @@
-.sidebar
- = render partial: "shared/sidebar/parts/user_stats", locals: { user: user }
- .sidebar-list
- .list-group
- = render partial: "shared/sidebar/parts/user_menu_items", locals: { user: user }
+- register_view_part :sidebar_user_stats
+%p<
+ = profile_image_tag @user, :original, class: "img-rounded", width: 64, height: 64
+%p= "@" + @user.screen_name
+%p<
+ %a.aclogicon.aclogicon-twitter{href: @user.twitter_url}
+.user-stats
+ %template{data: {"v-if" => "stats"}}
+ %template{data: {"v-if" => "stats.registered"}}
+ %ul.records
+ %li<
+ %span> Received
+ %span.data {{stats.reactions_count}}
+ %li<
+ %span> Average
+ %span.data {{average}}
+ %li<
+ %span> Joined
+ %span.data>
+ {{stats.since_join}}
+ %span> d ago
+ %template{data: {"v-if" => "!stats.registered"}}
+ .alert.alert-aclog @{{screen_name}} は aclog に登録していません
+ .loading-box{data: {"v-if" => "loading"}}
+ %img.loading-image{src: image_path("loading.gif")}
+.list-group
+ - if @user.registered?
+ = link_to_with_active "Best", user_path(@user.screen_name), class: "list-group-item"
+ = link_to_with_active "Timeline", user_timeline_path(@user.screen_name), class: "list-group-item"
+ - else
+ = link_to_with_active "Best", user_best_path(@user.screen_name), class: "list-group-item"
+ = link_to_with_active "Timeline", user_path(@user.screen_name), class: "list-group-item"
+ = link_to_with_active "Favorites", user_favorites_path(@user.screen_name), class: "list-group-item"
+ - if @user.registered?
+ = link_to_with_active "Discovered by", user_discovered_by_path(@user.screen_name), class: "list-group-item"
+ = link_to_with_active "Discovered users", user_discovered_users_path(@user.screen_name), class: "list-group-item"
diff --git a/app/views/shared/sidebar/_user_with_thresholds.html.haml b/app/views/shared/sidebar/_user_with_thresholds.html.haml
deleted file mode 100644
index 347b6f1..0000000
--- a/app/views/shared/sidebar/_user_with_thresholds.html.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-.sidebar
- = render partial: "shared/sidebar/parts/user_stats", locals: { user: user }
- .sidebar-list.row
- .list-group.col-xs-6.col-sm-12
- = render partial: "shared/sidebar/parts/user_menu_items", locals: { user: user }
- .list-group.col-xs-6.col-sm-12
- = render partial: "shared/sidebar/parts/thresholds", locals: thresholds
diff --git a/app/views/shared/sidebar/parts/_all_menu_items.html.haml b/app/views/shared/sidebar/parts/_all_menu_items.html.haml
deleted file mode 100644
index 64f62e9..0000000
--- a/app/views/shared/sidebar/parts/_all_menu_items.html.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-= link_to_with_active "Best", best_path, class: "list-group-item"
-= link_to_with_active "Timeline", timeline_path, class: "list-group-item"
diff --git a/app/views/shared/sidebar/parts/_thresholds.html.haml b/app/views/shared/sidebar/parts/_thresholds.html.haml
deleted file mode 100644
index 05bdb4a..0000000
--- a/app/views/shared/sidebar/parts/_thresholds.html.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-- counts.each_slice(2).to_a.transpose.each do |ns|
- .list-group-col
- - ns.each do |n|
- - if n.to_s == (params[param] || default).to_s
- = link_to n, params, class: "list-group-item active"
- - else
- = link_to n, params.merge(param => (n == default ? nil : n)), class: "list-group-item"
diff --git a/app/views/shared/sidebar/parts/_user_menu_items.html.haml b/app/views/shared/sidebar/parts/_user_menu_items.html.haml
deleted file mode 100644
index 843f1b0..0000000
--- a/app/views/shared/sidebar/parts/_user_menu_items.html.haml
+++ /dev/null
@@ -1,10 +0,0 @@
-- if user.registered?
- = link_to_with_active "Best", user_path(user.screen_name), class: "list-group-item"
- = link_to_with_active "Timeline", user_timeline_path(user.screen_name), class: "list-group-item"
-- else
- = link_to_with_active "Best", user_best_path(user.screen_name), class: "list-group-item"
- = link_to_with_active "Timeline", user_path(user.screen_name), class: "list-group-item"
-= link_to_with_active "Favorites", user_favorites_path(user.screen_name), class: "list-group-item"
-- if user.registered?
- = link_to_with_active "Discovered by", user_discovered_by_path(user.screen_name), class: "list-group-item"
- = link_to_with_active "Discovered users", user_discovered_users_path(user.screen_name), class: "list-group-item"
diff --git a/app/views/shared/sidebar/parts/_user_stats.html.haml b/app/views/shared/sidebar/parts/_user_stats.html.haml
deleted file mode 100644
index 71e8b0d..0000000
--- a/app/views/shared/sidebar/parts/_user_stats.html.haml
+++ /dev/null
@@ -1,25 +0,0 @@
-- register_view_part :sidebar_user_stats
-%p<
- = profile_image_tag user, :original, class: "img-rounded", width: 64, height: 64
-%p= "@" + user.screen_name
-%p<
- %a.aclogicon.aclogicon-twitter{href: user.twitter_url}
-.user-stats
- %template{data: {"v-if" => "stats"}}
- %template{data: {"v-if" => "stats.registered"}}
- %ul.records
- %li<
- %span> Received
- %span.data {{stats.reactions_count}}
- %li<
- %span> Average
- %span.data {{average}}
- %li<
- %span> Joined
- %span.data>
- {{stats.since_join}}
- %span> d ago
- %template{data: {"v-if" => "!stats.registered"}}
- .alert.alert-aclog @{{screen_name}} は aclog に登録していません
- .loading-box{data: {"v-if" => "loading"}}
- %img.loading-image{src: image_path("loading.gif")}
diff --git a/app/views/tweets/all_best.html.haml b/app/views/tweets/all_best.html.haml
deleted file mode 100644
index 5a702c8..0000000
--- a/app/views/tweets/all_best.html.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-- title "Top Tweets"
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/all_with_thresholds", thresholds: { param: :recent, default: "All Time", counts: ["All Time", "1d", "1w", "1m", "6m", "1y"] }
-.col-sm-9.col-md-7.col-lg-6
- %h1
- Top Tweets
- .statuses= render "tweets_template"
diff --git a/app/views/tweets/all_timeline.atom.builder b/app/views/tweets/all_timeline.atom.builder
deleted file mode 100644
index 2031ab4..0000000
--- a/app/views/tweets/all_timeline.atom.builder
+++ /dev/null
@@ -1,2 +0,0 @@
-title "Public Timeline"
-xml << render("tweets")
diff --git a/app/views/tweets/all_timeline.html.haml b/app/views/tweets/all_timeline.html.haml
deleted file mode 100644
index 9b91777..0000000
--- a/app/views/tweets/all_timeline.html.haml
+++ /dev/null
@@ -1,7 +0,0 @@
-- title "Public Timeline"
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/all_with_thresholds", thresholds: { param: :reactions, default: 1, counts: [1, 10, 50, 100, 500, 1000] }
-.col-sm-9.col-md-7.col-lg-6
- %h1
- Public Timeline
- .statuses= render "tweets_template"
diff --git a/app/views/tweets/filter.html.haml b/app/views/tweets/filter.html.haml
index 81b9c83..314cb2b 100644
--- a/app/views/tweets/filter.html.haml
+++ b/app/views/tweets/filter.html.haml
@@ -1,10 +1,12 @@
-- title "Filter"
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/all"
-.col-sm-9.col-md-7.col-lg-6
- .search
- = form_tag({}, method: "get", class: "form-inline") do
- = field_set_tag do
- = text_field_tag :q, params[:q]
- = submit_tag "filter", class: "btn", name: nil
- .statuses= render "tweets_template"
+.container
+ .row
+ .col-sm-3.col-md-offset-1
+ .sidebar
+ = render_sidebars
+ .col-sm-9.col-md-7.col-lg-6
+ .search
+ = form_tag({}, method: "get", class: "form-inline") do
+ = field_set_tag do
+ = text_field_tag :q, params[:q]
+ = submit_tag "filter", class: "btn", name: nil
+ .statuses= render "tweets_template"
diff --git a/app/views/tweets/show.html.haml b/app/views/tweets/show.html.haml
index b17900f..03e205e 100644
--- a/app/views/tweets/show.html.haml
+++ b/app/views/tweets/show.html.haml
@@ -1,12 +1,12 @@
-- title "\"#{CGI.unescapeHTML(strip_tags(format_tweet_text(@tweet.text)))}\" from #{@user.name} (@#{@user.screen_name})"
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/user", user: @user
-.col-sm-9.col-md-7.col-lg-6
- %h1
- %small #{@user.screen_name}'s
- Tweet
- .statuses
- = render "tweets_template"
- .refresh-box<
- = link_to import_path(@tweet.id), method: :post, title: "Refresh tweet" do
- %span.glyphicon.glyphicon-refresh/
+.container
+ .row
+ .col-sm-3.col-md-offset-1
+ .sidebar
+ = render_sidebars
+ .col-sm-9.col-md-7.col-lg-6
+ %h1= header
+ .statuses
+ = render "tweets_template"
+ .refresh-box<
+ = link_to import_path(@tweet.id), method: :post, title: "Refresh tweet" do
+ %span.glyphicon.glyphicon-refresh/
diff --git a/app/views/tweets/_tweets.atom.builder b/app/views/tweets/tweets.atom.builder
index bb98dbf..c426bf1 100644
--- a/app/views/tweets/_tweets.atom.builder
+++ b/app/views/tweets/tweets.atom.builder
@@ -1,11 +1,11 @@
atom_feed do |feed|
- feed.title yield :title
- feed.subtitle yield :title
+ feed.title title
+ feed.subtitle title
feed.updated DateTime.now
@tweets.each do |tweet|
feed.entry(tweet) do |entry|
- entry.title "#{tweet.favorites_count}/#{tweet.retweets_count}: #{CGI.unescapeHTML(strip_tags(format_tweet_text(tweet.text)))}"
+ entry.title "#{tweet.favorites_count}/#{tweet.retweets_count}: #{CGI.unescapeHTML(tweet.text)}"
entry.updated Time.now.iso8601
entry.summary "Has been favorited by #{tweet.favorites_count} #{tweet.favorites_count != 1 ? "people" : "person"}, " +
"retweeted by #{tweet.retweets_count} #{tweet.retweets_count != 1 ? "people" : "person"}."
diff --git a/app/views/tweets/tweets.html.haml b/app/views/tweets/tweets.html.haml
new file mode 100644
index 0000000..08ab782
--- /dev/null
+++ b/app/views/tweets/tweets.html.haml
@@ -0,0 +1,8 @@
+.container
+ .row
+ .col-sm-3.col-md-offset-1
+ .sidebar
+ = render_sidebars
+ .col-sm-9.col-md-7.col-lg-6
+ %h1= header
+ .statuses= render "tweets_template"
diff --git a/app/views/tweets/tweets.json.jbuilder b/app/views/tweets/tweets.json.jbuilder
index 619c84d..930266e 100644
--- a/app/views/tweets/tweets.json.jbuilder
+++ b/app/views/tweets/tweets.json.jbuilder
@@ -1,4 +1,15 @@
-json.next @next_url
-json.prev @prev_url
+if @tweets.length > 0
+ if params[:page] || @tweets.order_values.all? {|o| !o.is_a?(String) && o.expr.name == :id }
+ json.prev url_for(params.tap {|h| h.delete(:max_id) }.merge(since_id: @tweets.first.id))
+ json.next url_for(params.tap {|h| h.delete(:since_id) }.merge(max_id: @tweets.last.id - 1))
+ else
+ page = [params[:page].to_i, 1].max
+ json.prev page == 1 ? nil : url_for(params.merge(page: page - 1))
+ json.next url_for(params.merge(page: page + 1))
+ end
+else
+ json.prev nil
+ json.next nil
+end
json.statuses @tweets, partial: "tweet", as: :tweet
diff --git a/app/views/tweets/user_best.html.haml b/app/views/tweets/user_best.html.haml
deleted file mode 100644
index 8cfbf3a..0000000
--- a/app/views/tweets/user_best.html.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-- title "@#{@user.screen_name}'s Best Tweets"
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/user_with_thresholds", user: @user, thresholds: { param: :recent, default: "All Time", counts: ["All Time", "1d", "1w", "1m", "6m", "1y"] }
-.col-sm-9.col-md-7.col-lg-6
- %h1
- %small #{@user.screen_name}'s
- Best Tweets
- .statuses= render "tweets_template"
diff --git a/app/views/tweets/user_favorited_by.atom.builder b/app/views/tweets/user_favorited_by.atom.builder
deleted file mode 100644
index fc3140b..0000000
--- a/app/views/tweets/user_favorited_by.atom.builder
+++ /dev/null
@@ -1,2 +0,0 @@
-title "@#{@user.screen_name}'s Tweets Favorited By @#{@source_user.screen_name}"
-xml << render("tweets")
diff --git a/app/views/tweets/user_favorited_by.html.haml b/app/views/tweets/user_favorited_by.html.haml
deleted file mode 100644
index c3f93b9..0000000
--- a/app/views/tweets/user_favorited_by.html.haml
+++ /dev/null
@@ -1,12 +0,0 @@
-- title "@#{@user.screen_name}'s Tweets Favorited By @#{@source_user.screen_name}"
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/user_with_thresholds", user: @user, thresholds: { param: :reactions, default: 1, counts: [0, 1, 3, 10, 50, 100] }
-.col-sm-9.col-md-7.col-lg-6
- %h1
- %small #{@user.screen_name}'s
- Tweets
- %small>
- Favorited By
- %a{href: user_path(@source_user.screen_name), title: "#{@source_user.name} (@#{@source_user.screen_name})"}
- = @source_user.screen_name
- .statuses= render "tweets_template"
diff --git a/app/views/tweets/user_favorites.atom.builder b/app/views/tweets/user_favorites.atom.builder
deleted file mode 100644
index 3b7c1fa..0000000
--- a/app/views/tweets/user_favorites.atom.builder
+++ /dev/null
@@ -1,2 +0,0 @@
-title "@#{@user.screen_name}'s Favorites"
-xml << render("tweets")
diff --git a/app/views/tweets/user_favorites.html.haml b/app/views/tweets/user_favorites.html.haml
deleted file mode 100644
index e97670c..0000000
--- a/app/views/tweets/user_favorites.html.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-- title "@#{@user.screen_name}'s Favorites"
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/user_with_thresholds", user: @user, thresholds: { param: :reactions, default: 1, counts: [0, 1, 3, 10, 50, 100] }
-.col-sm-9.col-md-7.col-lg-6
- %h1
- %small #{@user.screen_name}'s
- Favorites
- .statuses= render "tweets_template"
diff --git a/app/views/tweets/user_timeline.atom.builder b/app/views/tweets/user_timeline.atom.builder
deleted file mode 100644
index 4f02a6a..0000000
--- a/app/views/tweets/user_timeline.atom.builder
+++ /dev/null
@@ -1,2 +0,0 @@
-title "@#{@user.screen_name}'s Timeline"
-xml << render("tweets")
diff --git a/app/views/tweets/user_timeline.html.haml b/app/views/tweets/user_timeline.html.haml
deleted file mode 100644
index 3ac1077..0000000
--- a/app/views/tweets/user_timeline.html.haml
+++ /dev/null
@@ -1,8 +0,0 @@
-- title "@#{@user.screen_name}'s Timeline"
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/user_with_thresholds", user: @user, thresholds: { param: :reactions, default: 1, counts: [0, 1, 3, 10, 50, 100] }
-.col-sm-9.col-md-7.col-lg-6
- %h1
- %small #{@user.screen_name}'s
- Timeline
- .statuses= render "tweets_template"
diff --git a/app/views/users/discovered_by.html.haml b/app/views/users/discovered_by.html.haml
index 3001cbb..8240c8a 100644
--- a/app/views/users/discovered_by.html.haml
+++ b/app/views/users/discovered_by.html.haml
@@ -1,15 +1,18 @@
- title "@#{@user.screen_name} is Discovered By ..."
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/user", user: @user
-.col-sm-9.col-md-7.col-lg-6
- %h1
- %small #{@user.screen_name} is
- Discovered By ...
- .users
- %ul.user-list
- - @result.each do |user_id, *counts|
- - user = @cached_users[user_id]
- %li
- %a{href: user_favorited_by_user_path(screen_name: @user.screen_name, source_screen_name: user.screen_name), title: "#{user.name} (@#{user.screen_name})"}
- = profile_image_tag user
- %span= counts.sum
+.container
+ .row
+ .col-sm-3.col-md-offset-1
+ .sidebar
+ = render_sidebars
+ .col-sm-9.col-md-7.col-lg-6
+ %h1
+ %small #{@user.screen_name} is
+ Discovered By ...
+ .users
+ %ul.user-list
+ - @result.each do |user_id, *counts|
+ - user = @cached_users[user_id]
+ %li
+ %a{href: user_favorited_by_user_path(screen_name: @user.screen_name, source_screen_name: user.screen_name), title: "#{user.name} (@#{user.screen_name})"}
+ = profile_image_tag user
+ %span= counts.sum
diff --git a/app/views/users/discovered_users.html.haml b/app/views/users/discovered_users.html.haml
index f8b7f78..f0d0c99 100644
--- a/app/views/users/discovered_users.html.haml
+++ b/app/views/users/discovered_users.html.haml
@@ -1,15 +1,18 @@
- title "@#{@user.screen_name} is Discovering..."
-.col-sm-3.col-md-offset-1
- = render "shared/sidebar/user", user: @user
-.col-sm-9.col-md-7.col-lg-6
- %h1
- %small #{@user.screen_name} is
- Discovering ...
- .users
- %ul.user-list
- - @result.each do |user_id, *counts|
- - user = @cached_users[user_id]
- %li
- %a{href: user_favorited_by_user_path(screen_name: user.screen_name, source_screen_name: @user.screen_name), title: "#{user.name} (@#{user.screen_name})"}
- = profile_image_tag user
- %span= counts.sum
+.container
+ .row
+ .col-sm-3.col-md-offset-1
+ .sidebar
+ = render_sidebars
+ .col-sm-9.col-md-7.col-lg-6
+ %h1
+ %small #{@user.screen_name} is
+ Discovering ...
+ .users
+ %ul.user-list
+ - @result.each do |user_id, *counts|
+ - user = @cached_users[user_id]
+ %li
+ %a{href: user_favorited_by_user_path(screen_name: user.screen_name, source_screen_name: @user.screen_name), title: "#{user.name} (@#{user.screen_name})"}
+ = profile_image_tag user
+ %span= counts.sum