aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/shared
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/shared')
-rw-r--r--app/views/shared/_search.html.haml4
-rw-r--r--app/views/shared/_sidebar_i.html.haml12
-rw-r--r--app/views/shared/_sidebar_main.html.haml1
-rw-r--r--app/views/shared/_sidebar_search.html.haml12
-rw-r--r--app/views/shared/_sidebar_users.html.haml41
-rw-r--r--app/views/shared/_tweet.html.haml44
-rw-r--r--app/views/shared/_tweet.json.jbuilder26
-rw-r--r--app/views/shared/partial/_search.html.haml4
-rw-r--r--app/views/shared/partial/_tweet.html.haml44
-rw-r--r--app/views/shared/partial/_tweet.json.jbuilder24
-rw-r--r--app/views/shared/partial/_user.json.jbuilder (renamed from app/views/shared/_user.json.jbuilder)0
-rw-r--r--app/views/shared/sidebar/_i.html.haml12
-rw-r--r--app/views/shared/sidebar/_main.html.haml1
-rw-r--r--app/views/shared/sidebar/_search.html.haml12
-rw-r--r--app/views/shared/sidebar/_users.html.haml41
-rw-r--r--app/views/shared/tweets.html.haml16
-rw-r--r--app/views/shared/tweets.json.jbuilder2
-rw-r--r--app/views/shared/user_ranking.html.haml17
-rw-r--r--app/views/shared/user_ranking.json.jbuilder (renamed from app/views/shared/users.json.jbuilder)2
-rw-r--r--app/views/shared/users.html.haml18
20 files changed, 165 insertions, 168 deletions
diff --git a/app/views/shared/_search.html.haml b/app/views/shared/_search.html.haml
deleted file mode 100644
index 2eeb390..0000000
--- a/app/views/shared/_search.html.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-.search
- = form_tag({:controller => "search", :action => "search"}, {:method => :get}) do
- = text_field_tag :query, params[:query]
- = submit_tag "search", :name => nil
diff --git a/app/views/shared/_sidebar_i.html.haml b/app/views/shared/_sidebar_i.html.haml
deleted file mode 100644
index 098b35c..0000000
--- a/app/views/shared/_sidebar_i.html.haml
+++ /dev/null
@@ -1,12 +0,0 @@
-%ul.nav.nav-tabs.nav-stacked
- %li
- = link_to "about", :controller => "main", :action => "about"
- %li
- = link_to "api", :controller => "main", :action => "api"
-%ul.nav.nav-tabs.nav-stacked
- %li
- = link_to "best", :controller => "i", :action => "best"
- %li
- = link_to "recent", :controller => "i", :action => "recent"
- %li
- = link_to "timeline", :controller => "i", :action => "timeline"
diff --git a/app/views/shared/_sidebar_main.html.haml b/app/views/shared/_sidebar_main.html.haml
deleted file mode 100644
index dcc2630..0000000
--- a/app/views/shared/_sidebar_main.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 098b35c..0000000
--- a/app/views/shared/_sidebar_search.html.haml
+++ /dev/null
@@ -1,12 +0,0 @@
-%ul.nav.nav-tabs.nav-stacked
- %li
- = link_to "about", :controller => "main", :action => "about"
- %li
- = link_to "api", :controller => "main", :action => "api"
-%ul.nav.nav-tabs.nav-stacked
- %li
- = link_to "best", :controller => "i", :action => "best"
- %li
- = link_to "recent", :controller => "i", :action => "recent"
- %li
- = link_to "timeline", :controller => "i", :action => "timeline"
diff --git a/app/views/shared/_sidebar_users.html.haml b/app/views/shared/_sidebar_users.html.haml
deleted file mode 100644
index c5475ce..0000000
--- a/app/views/shared/_sidebar_users.html.haml
+++ /dev/null
@@ -1,41 +0,0 @@
-.sidebar
- .avatar
- = link_to_user_page @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)
- - if @user.registered?
- %ul.records
- %li
- %span favorited
- %span.data= @user.stats[:favorited_count]
- %li
- %span retweeted
- %span.data= @user.stats[:retweeted_count]
- %li
- %span avg. fav
- %span.data= ((@user.stats[:favorited_count] + 0.0) / @user.stats[:tweets_count]).round(2)
- %li
- %span joined
- %span.data= format_date_ago(@user.created_at)
- - else
- .alert.alert-info
- = "@#{@user.screen_name} has never signed in to aclog"
- .user_nav
- %ul.nav.nav-tabs.nav-stacked
- - if @user.registered?
- %li
- = link_to "info", :controller => "users", :action => "info", :screen_name => @user.screen_name
- %li
- = link_to "best", :controller => "users", :action => "best", :screen_name => @user.screen_name
- %li
- = link_to "timeline", :controller => "users", :action => "timeline", :screen_name => @user.screen_name
- %li
- = link_to "discovered", :controller => "users", :action => "discovered", :screen_name => @user.screen_name
- %li
- = link_to "favorited by", :controller => "users", :action => "favorited_by", :screen_name => @user.screen_name
- %li
- = link_to "retweeted by", :controller => "users", :action => "retweeted_by", :screen_name => @user.screen_name
- %li
- = link_to "given favorites", :controller => "users", :action => "given_favorites_to", :screen_name => @user.screen_name
- %li
- = link_to "given retweets", :controller => "users", :action => "given_retweets_to", :screen_name => @user.screen_name
diff --git a/app/views/shared/_tweet.html.haml b/app/views/shared/_tweet.html.haml
deleted file mode 100644
index c8c3a09..0000000
--- a/app/views/shared/_tweet.html.haml
+++ /dev/null
@@ -1,44 +0,0 @@
-.item
- .tweet
- .left
- .avatar
- = link_to image_tag(item.user.profile_image_url, :alt => item.user.screen_name, :title => item.user.name), :controller => "users", :action => "best", :screen_name => item.user.screen_name
- %ul.inline.actions
- %li.twitter
- = link_to image_tag("reply.png", :alt => "reply"), "https://twitter.com/intent/tweet?in_reply_to=#{item.id}"
- = link_to image_tag("retweet.png", :alt => "retweet"), "https://twitter.com/intent/retweet?tweet_id=#{item.id}"
- = link_to image_tag("favorite.png", :alt => "favorite"), "https://twitter.com/intent/favorite?tweet_id=#{item.id}"
- .tweet_content_fix
- .tweet_content
- .user
- %span.name
- = link_to_user_page item.user.screen_name do
- = item.user.name
- %span.screen_name= link_to_user_page item.user.screen_name
- .text{:class => item.stolen_tweet ? "copied" : nil}
- = raw format_tweet_text(item.text)
- .meta.clearfix
- %span.twitter_bird
- = link_to image_tag("bird_gray_16.png", :alt => "Twitter"), twitter_status_url(item), :target => "_blank"
- %span.created_at
- = link_to format_time(item.tweeted_at), :controller => "users", :action => "show", :id => item.id
- - if item.stolen_tweet
- %span.copied
- = link_to "original", :controller => "users", :action => "show", :id => item.original.id
- %span.source
- = raw format_source_text(item.source)
- .stats
- - [["favs", item.favoriters], ["retweets", item.retweeters]].select{|m| m[1].count > 0}.each do |type, actions|
- %dl.dl-horizontal
- %dt
- %span.count= actions.count
- %span.type= type
- - if user_limit && params[:action] == "show"
- %span.full
- = link_to "show full", params.merge(:full => true)
- %dd
- %ul.inline
- - actions.take(user_limit || actions.count).each do |m|
- %li
- = link_to_user_page m.screen_name do
- = image_tag m.profile_image_url, :alt => m.screen_name, :title => m.name
diff --git a/app/views/shared/_tweet.json.jbuilder b/app/views/shared/_tweet.json.jbuilder
deleted file mode 100644
index 15dae1b..0000000
--- a/app/views/shared/_tweet.json.jbuilder
+++ /dev/null
@@ -1,26 +0,0 @@
-json.(item, :id, :text, :source, :tweeted_at, :favorites_count, :retweets_count)
-
-json.user do
- json.id item.user_id
- if @include_user
- json.partial! "shared/user", :user => item.user
- end
-end
-
-render_actions = -> name, data, render_id do
- n = 0
- json.__send__(name, data) do |action|
- json.id action.id if render_id
- json.user do
- json.id action.user_id
- if @include_user && (!user_limit || n < user_limit)
- json.partial! "shared/user", :user => action.user
- end
- end
- n += 1
- end
-end
-
-render_actions.call(:favorites, item.favorites.includes(:user), false)
-render_actions.call(:retweets, item.retweets.includes(:user), true)
-
diff --git a/app/views/shared/partial/_search.html.haml b/app/views/shared/partial/_search.html.haml
new file mode 100644
index 0000000..14a15d1
--- /dev/null
+++ b/app/views/shared/partial/_search.html.haml
@@ -0,0 +1,4 @@
+.search
+ = form_tag({controller: "search", action: "search"}, {method: :get}) do
+ = text_field_tag :query, params[:query]
+ = submit_tag "search", name: nil
diff --git a/app/views/shared/partial/_tweet.html.haml b/app/views/shared/partial/_tweet.html.haml
new file mode 100644
index 0000000..a1b3c7a
--- /dev/null
+++ b/app/views/shared/partial/_tweet.html.haml
@@ -0,0 +1,44 @@
+.item
+ .tweet
+ .left
+ .avatar
+ = link_to user_path(item.user.screen_name) do
+ = image_tag item.user.profile_image_url, alt: item.user.screen_name, title: item.user.name
+ %ul.inline.actions
+ %li.twitter
+ = link_to image_tag("reply.png", alt: "reply"), "https://twitter.com/intent/tweet?in_reply_to=#{item.id}"
+ = link_to image_tag("retweet.png", alt: "retweet"), "https://twitter.com/intent/retweet?tweet_id=#{item.id}"
+ = link_to image_tag("favorite.png", alt: "favorite"), "https://twitter.com/intent/favorite?tweet_id=#{item.id}"
+ .tweet_content_fix
+ .tweet_content
+ .user
+ %span.nam= link_to item.user.name, user_path(item.user.screen_name)
+ %span.screen_name= link_to item.user.screen_name, user_path(item.user.screen_name)
+ .text{class: item.stolen_tweet ? "copied" : nil}
+ = raw format_tweet_text(item.text)
+ .meta.clearfix
+ %span.twitter_bird
+ = link_to image_tag("bird_gray_16.png", alt: "Twitter"), twitter_status_url(item), target: "_blank"
+ %span.created_at
+ = link_to format_time(item.tweeted_at), tweet_path(item.id)
+ - if params[:action] == "show"
+ %span.full
+ = link_to "full", params.merge(limit: -1)
+ - if item.stolen_tweet
+ %span.copied
+ = link_to "original", tweet_path(item.original.id)
+ %span.source
+ = raw format_source_text(item.source)
+ .stats
+ - [["favs", item.favoriters], ["retweets", item.retweeters]].each do |type, actions|
+ - if actions.count > 0
+ %dl.dl-horizontal
+ %dt
+ %span.count= actions.count
+ %span.type= type
+ %dd
+ %ul.inline
+ - actions.limit(user_limit).each do |m|
+ %li
+ = link_to user_path(m.screen_name) do
+ = image_tag m.profile_image_url, alt: m.screen_name, title: m.name
diff --git a/app/views/shared/partial/_tweet.json.jbuilder b/app/views/shared/partial/_tweet.json.jbuilder
new file mode 100644
index 0000000..eb15878
--- /dev/null
+++ b/app/views/shared/partial/_tweet.json.jbuilder
@@ -0,0 +1,24 @@
+json.(item, :id, :text, :source, :tweeted_at, :favorites_count, :retweets_count)
+
+json.user do
+ json.id item.user_id
+ if include_user?
+ json.partial! "shared/partial/user", user: item.user
+ end
+end
+
+render_actions = -> name, data, render_id do
+ json.__send__(name, data.includes(:user).limit(user_limit).load) do |action|
+ json.id action.id if render_id
+ json.user do
+ json.id action.user_id
+ if include_user?
+ json.partial! "shared/partial/user", user: action.user
+ end
+ end
+ end
+end
+
+render_actions.call(:favorites, item.favorites, false)
+render_actions.call(:retweets, item.retweets, true)
+
diff --git a/app/views/shared/_user.json.jbuilder b/app/views/shared/partial/_user.json.jbuilder
index fe64d8d..fe64d8d 100644
--- a/app/views/shared/_user.json.jbuilder
+++ b/app/views/shared/partial/_user.json.jbuilder
diff --git a/app/views/shared/sidebar/_i.html.haml b/app/views/shared/sidebar/_i.html.haml
new file mode 100644
index 0000000..fe298ac
--- /dev/null
+++ b/app/views/shared/sidebar/_i.html.haml
@@ -0,0 +1,12 @@
+%ul.nav.nav-tabs.nav-stacked
+ %li
+ = link_to "about", controller: "main", action: "about"
+ %li
+ = link_to "api", controller: "main", action: "api"
+%ul.nav.nav-tabs.nav-stacked
+ %li
+ = link_to "best", controller: "i", action: "best"
+ %li
+ = link_to "recent", controller: "i", action: "recent"
+ %li
+ = link_to "timeline", controller: "i", action: "timeline"
diff --git a/app/views/shared/sidebar/_main.html.haml b/app/views/shared/sidebar/_main.html.haml
new file mode 100644
index 0000000..774d930
--- /dev/null
+++ b/app/views/shared/sidebar/_main.html.haml
@@ -0,0 +1 @@
+= render "shared/sidebar/i"
diff --git a/app/views/shared/sidebar/_search.html.haml b/app/views/shared/sidebar/_search.html.haml
new file mode 100644
index 0000000..fe298ac
--- /dev/null
+++ b/app/views/shared/sidebar/_search.html.haml
@@ -0,0 +1,12 @@
+%ul.nav.nav-tabs.nav-stacked
+ %li
+ = link_to "about", controller: "main", action: "about"
+ %li
+ = link_to "api", controller: "main", action: "api"
+%ul.nav.nav-tabs.nav-stacked
+ %li
+ = link_to "best", controller: "i", action: "best"
+ %li
+ = link_to "recent", controller: "i", action: "recent"
+ %li
+ = link_to "timeline", controller: "i", action: "timeline"
diff --git a/app/views/shared/sidebar/_users.html.haml b/app/views/shared/sidebar/_users.html.haml
new file mode 100644
index 0000000..eaba8b1
--- /dev/null
+++ b/app/views/shared/sidebar/_users.html.haml
@@ -0,0 +1,41 @@
+.sidebar
+ .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)
+ - if @user.registered?
+ %ul.records
+ %li
+ %span favorited
+ %span.data= @user.stats[:favorited_count]
+ %li
+ %span retweeted
+ %span.data= @user.stats[:retweeted_count]
+ %li
+ %span avg. fav
+ %span.data= ((@user.stats[:favorited_count] + 0.0) / @user.stats[:tweets_count]).round(2)
+ %li
+ %span joined
+ %span.data= format_date_ago(@user.created_at)
+ - else
+ .alert.alert-info
+ = "@#{@user.screen_name} has never signed in to aclog"
+ .user_nav
+ %ul.nav.nav-tabs.nav-stacked
+ - if @user.registered?
+ %li
+ = link_to "info", info_path(@user.screen_name)
+ %li
+ = link_to "best", user_path(@user.screen_name)
+ %li
+ = link_to "timeline", timeline_path(@user.screen_name)
+ %li
+ = link_to "discovered", discovered_path(@user.screen_name)
+ %li
+ = link_to "favorited by", favorited_by_path(@user.screen_name)
+ %li
+ = link_to "retweeted by", retweeted_by_path(@user.screen_name)
+ %li
+ = link_to "given favorites", given_favorites_to_path(@user.screen_name)
+ %li
+ = link_to "given retweets", given_retweets_to_path(@user.screen_name)
diff --git a/app/views/shared/tweets.html.haml b/app/views/shared/tweets.html.haml
index 55e8e42..04fb985 100644
--- a/app/views/shared/tweets.html.haml
+++ b/app/views/shared/tweets.html.haml
@@ -1,11 +1,11 @@
- if params[:action] == "search"
- = render :partial => "shared/search"
+ = render partial: "shared/partial/search"
.items
- = render :partial => "shared/tweet", :collection => @items, :as => :item
+ = render partial: "shared/partial/tweet", collection: @items, as: :item
.loading
- = image_tag "loading.gif", :alt => "loading...", :title => nil
-- if /offset/i =~ @items.to_sql
- = paginate(@items)
-- elsif @items.last
- .pagination
- = link_to raw("Next &#8250;"), params.merge(:max_id => @items.last.id - 1), :rel => :next
+ = image_tag "loading.gif", alt: "loading...", title: nil
+.pagination
+ - if page
+ = link_to raw("Next &#8250;"), params.merge(page: (page || 1) + 1), rel: :next
+ - elsif @items.last
+ = link_to raw("Next &#8250;"), params.merge(max_id: @items.last.id - 1), rel: :next
diff --git a/app/views/shared/tweets.json.jbuilder b/app/views/shared/tweets.json.jbuilder
index d2637d3..b623a1e 100644
--- a/app/views/shared/tweets.json.jbuilder
+++ b/app/views/shared/tweets.json.jbuilder
@@ -1,4 +1,4 @@
json.array! @items do |json, item|
- json.partial! "shared/tweet", :item => item
+ json.partial! "shared/partial/tweet", item: item
end
diff --git a/app/views/shared/user_ranking.html.haml b/app/views/shared/user_ranking.html.haml
new file mode 100644
index 0000000..c7e1a63
--- /dev/null
+++ b/app/views/shared/user_ranking.html.haml
@@ -0,0 +1,17 @@
+.users
+ %ul.inline
+ - @usermap.take(50).each do |user_id, count|
+ - user = User.cached(user_id)
+ %li
+ - if user
+ .avatar
+ = link_to user_path(user.screen_name) do
+ = image_tag user.profile_image_url, alt: user.screen_name, title: user.name
+ .data
+ = link_to url_for(params.merge(screen_name_b: user.screen_name)) do
+ .count= count
+ - else
+ .avatar= image_tag "missing_profile_image.png", alt: "Missing User: #{user_id}", title: "Missing User: #{user_id}"
+ .data
+ .count= count
+
diff --git a/app/views/shared/users.json.jbuilder b/app/views/shared/user_ranking.json.jbuilder
index d58c584..8bbdd42 100644
--- a/app/views/shared/users.json.jbuilder
+++ b/app/views/shared/user_ranking.json.jbuilder
@@ -3,7 +3,7 @@ json.array! @usermap do |json, u|
json.user do |json|
json.id u[0]
if @include_user
- json.partial! "shared/user", :user => User.cached(u[0])
+ json.partial! "shared/partial/user", user: User.cached(u[0])
end
end
end
diff --git a/app/views/shared/users.html.haml b/app/views/shared/users.html.haml
deleted file mode 100644
index 22085f3..0000000
--- a/app/views/shared/users.html.haml
+++ /dev/null
@@ -1,18 +0,0 @@
-.users
- %ul.inline
- - @usermap.take(50).each do |user_id, count|
- - user = User.cached(user_id)
- %li
- - if user
- = link_to_user_page user.screen_name do
- .avatar= image_tag user.profile_image_url, :alt => user.screen_name, :title => user.name
- .data
- = link_to url_for(params.merge(:screen_name_b => user.screen_name)) do
- .count= count
- .type= @event_type
- - else
- .avatar= image_tag asset_path("missing_profile_image.png"), :alt => "Missing User: #{user_id}", :title => "Missing User: #{user_id}"
- .data
- .count= count
- .type= @event_type
-