From fbcf16638a8d7b5319be4eab94d93312ca0a1f9f Mon Sep 17 00:00:00 2001 From: albert Date: Fri, 10 Feb 2012 17:46:06 -0500 Subject: [PATCH] css fixes --- .../stylesheets/specific/posts.css.scss | 6 ++-- app/controllers/mobile/posts_controller.rb | 35 ------------------- app/helpers/pagination_helper.rb | 2 +- app/presenters/post_presenter.rb | 8 ++++- app/views/layouts/default.html.erb | 1 - app/views/mobile/posts/index.html.erb | 14 -------- config/routes.rb | 6 ---- 7 files changed, 12 insertions(+), 60 deletions(-) delete mode 100644 app/controllers/mobile/posts_controller.rb delete mode 100644 app/views/mobile/posts/index.html.erb diff --git a/app/assets/stylesheets/specific/posts.css.scss b/app/assets/stylesheets/specific/posts.css.scss index 5950187d8..283ac1852 100644 --- a/app/assets/stylesheets/specific/posts.css.scss +++ b/app/assets/stylesheets/specific/posts.css.scss @@ -10,10 +10,12 @@ article.post-preview { margin-right: 20px; margin-bottom: 20px; float: left; - text-align: center; - vertical-align: middle; overflow: hidden; @include inline-block; + + img.wide { + margin: 0 -25%; + } } article.post-preview.blacklisted-active { diff --git a/app/controllers/mobile/posts_controller.rb b/app/controllers/mobile/posts_controller.rb deleted file mode 100644 index 08d8abd51..000000000 --- a/app/controllers/mobile/posts_controller.rb +++ /dev/null @@ -1,35 +0,0 @@ -module Mobile - class PostsController < ApplicationController - before_filter :member_only, :except => [:show, :index] - respond_to :html - rescue_from PostSets::SearchError, :with => :search_error - layout "mobile" - - def index - @post_set = PostSets::Post.new(tag_query, params[:page]) - @posts = @post_set.posts - end - - def show - @post = Post.find(params[:id]) - end - - private - def search_error(exception) - @exception = exception - render :action => "error" - end - - def tag_query - params[:tags] || (params[:post] && params[:post][:tags]) - end - - def save_recent_tags - if tag_query - tags = Tag.scan_tags(tag_query) - tags = TagAlias.to_aliased(tags) + Tag.scan_tags(session[:recent_tags]) - session[:recent_tags] = tags.uniq.slice(0, 40).join(" ") - end - end - end -end diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb index 5e80668f5..8a6541462 100644 --- a/app/helpers/pagination_helper.rb +++ b/app/helpers/pagination_helper.rb @@ -15,7 +15,7 @@ module PaginationHelper end def use_sequential_paginator?(records) - params[:page] =~ /[ab]/ || records.current_page > Danbooru.config.max_numbered_pages + params[:page] =~ /[ab]/ || records.current_page >= Danbooru.config.max_numbered_pages end def numbered_paginator(records, switch_to_sequential = true) diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index eaee3fdea..3f1e27f45 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -13,7 +13,13 @@ class PostPresenter < Presenter html = %{
} html << %{} - html << %{#{h(post.tag_string)}} + + if post.image_width > post.image_height + klass = "wide" + else + klass = "tall" + end + html << %{#{h(post.tag_string)}} html << %{} html << %{
} html.html_safe diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index e3a1372d5..bc69f0274 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -17,7 +17,6 @@ <%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %> <%= stylesheet_link_tag "application", :media => "screen" %> - <%#= stylesheet_link_tag "mobile", :media => "only screen and (max-width: 480px), only screen and (max-device-width: 480px)" %> <%= javascript_include_tag "application" %> <%= Danbooru.config.custom_html_header_content %> <%= yield :html_header %> diff --git a/app/views/mobile/posts/index.html.erb b/app/views/mobile/posts/index.html.erb deleted file mode 100644 index 50063525f..000000000 --- a/app/views/mobile/posts/index.html.erb +++ /dev/null @@ -1,14 +0,0 @@ -
-
- <%= render "posts/partials/index/posts", :post_set => @post_set %> - <%= render "posts/partials/common/secondary_links" %> -
-
- -<% content_for(:page_title) do %> - <% if @post_set.tag_string.present? %> - <%= @post_set.tag_string %> - <%= Danbooru.config.app_name %> - <% else %> - <%= Danbooru.config.app_name %> - <% end %> -<% end %> diff --git a/config/routes.rb b/config/routes.rb index 523dc2331..f51fc018e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -176,12 +176,6 @@ Danbooru::Application.routes.draw do end resources :wiki_page_versions, :only => [:index, :show] - namespace :mobile do - resources :posts - resource :session - resources :favorites - end - # aliases resources :wpages, :controller => "wiki_pages" resources :ftopics, :controller => "forum_topics"