aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRhenium <rhenium@rhe.jp>2014-02-22 14:06:42 +0900
committerRhenium <rhenium@rhe.jp>2014-02-22 14:06:42 +0900
commit9e2b2fd480c0659ad1fffd4ea6cf2a6ad8c45150 (patch)
treebc5286b5a3aba4bfedc19918dc0b8bc402f774d8
parentc241ae47a6bed0c0ebe9f8e3afa732570fbe7009 (diff)
downloadaclog-9e2b2fd480c0659ad1fffd4ea6cf2a6ad8c45150.tar.gz
fix haml to output clean html
-rw-r--r--app/models/user.rb5
-rw-r--r--app/views/about/index.html.haml14
-rw-r--r--app/views/layouts/_base.html.haml51
-rw-r--r--app/views/shared/_sidebar_user.html.haml22
-rw-r--r--app/views/tweets/_tweet_content.html.haml14
-rw-r--r--app/views/tweets/_tweet_stats.html.haml10
6 files changed, 53 insertions, 63 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 45a9b30..76d7b6b 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -4,6 +4,7 @@ class User < ActiveRecord::Base
has_many :tweets, dependent: :delete_all
has_many :favorites, dependent: :delete_all
has_many :retweets, dependent: :delete_all
+ has_one :account
def twitter_url
"https://twitter.com/#{self.screen_name}"
@@ -58,8 +59,8 @@ class User < ActiveRecord::Base
!user.protected? || user.id == self.id || self.account.try(:following?, user.id) || false
end
- def account
- Account.where(user_id: id).first
+ def profile_image_url_mini
+ profile_image_url.sub(/_normal((?:\.(?:png|jpeg|gif))?)/, "_mini\\1")
end
def profile_image_url_original
diff --git a/app/views/about/index.html.haml b/app/views/about/index.html.haml
index 7d86036..f77d39b 100644
--- a/app/views/about/index.html.haml
+++ b/app/views/about/index.html.haml
@@ -1,15 +1,15 @@
- title "aclog"
.front-hero
.container
- %p
+ %p<
%img{alt: "aclog", src: image_path("logo.png"), height: 200, width: 200}
%h1 aclog
- %p
+ %p<
%a.twitter-share-button{href: "https://twitter.com/share", data: { count: "none", lang: "en" }} ツイート
.front-feature
.container
.row
- .col-sm-6.col-sm-push-6
+ .col-sm-6.col-sm-push-6<
%img{alt: "Collect activities", src: image_path("feature_1.png"), height: 200, width: 400}
.col-sm-6.col-sm-pull-6
%h1 Collect Activities
@@ -17,7 +17,7 @@
.front-feature-right
.container
.row
- .col-sm-6
+ .col-sm-6<
%img{alt: "Discover topics easily", src: image_path("feature_2.png"), height: 200, width: 400}
.col-sm-6
%h1 Discover Topics
@@ -25,7 +25,7 @@
.front-feature
.container
.row
- .col-sm-6.col-sm-push-6
+ .col-sm-6.col-sm-push-6<
%img{alt: "Protected account is OK", src: image_path("feature_3.png"), height: 200, width: 400}
.col-sm-6.col-sm-pull-6
%h1 Protected User Available
@@ -43,12 +43,12 @@
%h1 aclog API
%p
JSON 形式の API を用意。
- = link_to "API ドキュメント", about_api_path
+ %a{href: about_api_path}>< API ドキュメント
をご覧下さい。
.col-sm-3
%h1 OSS
%p aclog は The MIT License のオープンソース・サービスです。
.front-footer
%p
- /%a.aclogicon.aclogicon-twitter{href: "https://twitter.com/aclog3"}
+ %a.aclogicon.aclogicon-twitter{href: "https://twitter.com/aclog_service"}
%a.aclogicon.aclogicon-github{href: "https://github.com/rhenium/aclog"}
diff --git a/app/views/layouts/_base.html.haml b/app/views/layouts/_base.html.haml
index 4c3517d..2e7992a 100644
--- a/app/views/layouts/_base.html.haml
+++ b/app/views/layouts/_base.html.haml
@@ -8,7 +8,7 @@
%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"}
- = stylesheet_link_tag "application", media: "all"
+ = stylesheet_link_tag "application", media: nil
= javascript_include_tag "application"
- if @next_url
%link{rel: "next", href: @next_url}
@@ -21,48 +21,37 @@
= link_to "aclog", root_path, class: "navbar-brand"
%ul.nav.navbar-nav.navbar-right
%li.dropdown.omittable
- %a.dropdown-toggle{href: "#", data: { toggle: "dropdown" }}
+ %a.dropdown-toggle{href: "#", data: { toggle: "dropdown" }}<
All
- %b.caret
+ %span.caret/
%ul.dropdown-menu
- %li
- = link_to "Best", best_path
- %li
- = link_to "Recent", recent_path
- %li
- = link_to "Timeline", timeline_path
+ %li= link_to "Best", best_path
+ %li= link_to "Recent", recent_path
+ %li= link_to "Timeline", timeline_path
%li.dropdown.omittable
- %a.dropdown-toggle#jump_to_dropdown_toggle{href: "#", data: { toggle: "dropdown" }}
+ %a.dropdown-toggle#jump_to_dropdown_toggle{href: "#", data: { toggle: "dropdown" }}<
User
- %b.caret
+ %span.caret/
%form.dropdown-menu#jump_to_form
.input-group
- %input.form-control{id: "jump_to_textbox", type: "text", placeholder: "Username"}
+ %input.form-control#jump_to_textbox{type: "text", placeholder: "Username"}
%span.input-group-btn
%button.btn{type: "submit"} Go
- if logged_in?
%li.dropdown
- %a.dropdown-toggle{href: "#", data: { toggle: "dropdown" }}
- %img{src: current_user.profile_image_url, alt: "@" + current_user.screen_name, height: "24", width: "24"}
- %b.caret
+ %a.dropdown-toggle{href: "#", data: { toggle: "dropdown" }}<
+ %img{src: current_user.profile_image_url_mini, alt: "@" + current_user.screen_name, height: "24", width: "24"}
+ %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 "Discoveries", user_discoveries_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= link_to "Best", user_path(current_user.screen_name)
+ %li= link_to "Timeline", user_timeline_path(current_user.screen_name)
+ %li= link_to "Discoveries", user_discoveries_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 "Setting", settings_path
- %li
- = link_to "API", about_api_path
- %li
- = link_to "Sign out", logout_path
+ %li= link_to "Setting", settings_path
+ %li= link_to "API", about_api_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/shared/_sidebar_user.html.haml b/app/views/shared/_sidebar_user.html.haml
index 3f3776d..cc74ab5 100644
--- a/app/views/shared/_sidebar_user.html.haml
+++ b/app/views/shared/_sidebar_user.html.haml
@@ -1,20 +1,20 @@
.sidebar
- %p
+ %p<
%img.icon.img-rounded{alt: user.screen_name, src: user.profile_image_url_original, height: 64, width: 64}
%p= "@" + user.screen_name
- %p
+ %p<
%a.aclogicon.aclogicon-twitter{href: user.twitter_url}
- if user.registered?
%ul.records
- %li
- %span Reactions
- %span.data= user.stats.reactions_count
- %li
- %span Average
- %span.data= user.stats.average_reactions_count.round(2)
- %li
- %span Joined
- %span.data
+ %li<
+ %span> Reactions
+ %span.data>= user.stats.reactions_count
+ %li<
+ %span> Average
+ %span.data>= user.stats.average_reactions_count.round(2)
+ %li<
+ %span> Joined
+ %span.data>
= user.stats.since_join
%span> d ago
- else
diff --git a/app/views/tweets/_tweet_content.html.haml b/app/views/tweets/_tweet_content.html.haml
index 1106e5b..0bab735 100644
--- a/app/views/tweets/_tweet_content.html.haml
+++ b/app/views/tweets/_tweet_content.html.haml
@@ -1,25 +1,25 @@
- if authorized_to_show_user? tweet.user
.status-tweet
- %a.status-user{href: user_path(tweet.user_screen_name), title: "#{tweet.user_name} (@#{tweet.user_screen_name})"}
- = image_tag tweet.user_profile_image_url, alt: "@" + tweet.user_screen_name, height: 48, width: 48
+ %a.status-user{href: user_path(tweet.user_screen_name), title: "#{tweet.user_name} (@#{tweet.user_screen_name})"}<
+ %img{alt: "@" + tweet.user_screen_name, src: tweet.user_profile_image_url}
.status-content
.status-head
%a.user{href: user_path(tweet.user_screen_name)}
%span= tweet.user_name
%span= "@" + tweet.user_screen_name
- %span.time
- %a{href: tweet_path(tweet), title: "このツイートの詳細を見る"}
+ %span.time<
+ %a{href: tweet_path(tweet), title: "このツイートの詳細を見る"}<
%time{datetime: tweet.tweeted_at.to_datetime.rfc3339}= tweet.tweeted_at
%a.source.aclogicon.aclogicon-twitter{href: tweet.twitter_url, title: "Twitter で見る"}
%p.status-text= format_tweet_text tweet.text
.status-foot
= link_to_source_text(tweet.source, class: "source")
%ul
- %li
+ %li<
%a.aclogicon.aclogicon-fav{href: "https://twitter.com/intent/favorite?tweet_id=#{tweet.id}", title: "お気に入り登録"}
- %li
+ %li<
%a.aclogicon.aclogicon-retweet{href: "https://twitter.com/intent/retweet?tweet_id=#{tweet.id}", title: "リツイート"}
- %li
+ %li<
%a.aclogicon.aclogicon-reply{href: "https://twitter.com/intent/tweet?in_reply_to=#{tweet.id}", title: "返信"}
- else
.status-tweet
diff --git a/app/views/tweets/_tweet_stats.html.haml b/app/views/tweets/_tweet_stats.html.haml
index d25367d..ccefb63 100644
--- a/app/views/tweets/_tweet_stats.html.haml
+++ b/app/views/tweets/_tweet_stats.html.haml
@@ -4,23 +4,23 @@
- if authorized_to_show_user?(tweet.user)
%dl
%dt
- = link_to tweet_path(tweet.id, full: true) do
+ %a{href: tweet_path(tweet.id, full: true), title: "すべて見る"}<
%span>= count
= title
%dd{class: params[:action] != "show" ? "timeline" : ""}
%ul
- users.limit(favorites_truncate_count).each do |m|
- %li
+ %li<
- if !m.protected? || (logged_in? && (m.id == current_user.id || tweet.user.id == current_user.id))
- %a{href: user_path(m.screen_name), title: "#{m.name} (@#{m.screen_name})"}
+ %a{href: user_path(m.screen_name), title: "#{m.name} (@#{m.screen_name})"}<
%img{alt: "@" + m.screen_name, src: m.profile_image_url}
- else
- %a{href: "#", title: "Protected User"}
+ %a{href: "#", title: "Protected User"}<
%img{alt: "Protected User", src: image_path("protected_profile_image.png")}
- else
%dl
%dt
- = link_to "#" do
+ %a{href: "#"}<
%span>= count
= title
%dd{class: params[:action] != "show" ? "timeline" : ""}