From 99a48dc242834d164b81e07cc7bf3bf08b6820ef Mon Sep 17 00:00:00 2001 From: albert Date: Mon, 14 Nov 2011 17:55:53 -0500 Subject: [PATCH] removed /m/ codepath, added mobile override stylesheet --- app/assets/stylesheets/mobile.css.scss | 6 +- .../stylesheets/mobile/page_header.css.scss | 16 ++ .../stylesheets/mobile/paginator.css.scss | 41 ++--- app/assets/stylesheets/mobile/posts.css.scss | 146 +++--------------- .../stylesheets/mobile/sesssions.css.scss | 10 -- app/controllers/m/posts_controller.rb | 14 -- app/controllers/m/sessions_controller.rb | 26 ---- app/presenters/tag_set_presenter.rb | 2 +- app/views/layouts/default.html.erb | 1 + app/views/m/posts/_header.html.erb | 16 -- app/views/m/posts/_tags.html.erb | 3 - app/views/m/posts/index.html.erb | 21 --- app/views/m/posts/show.html.erb | 11 -- app/views/m/sessions/new.html.erb | 33 ---- .../partials/common/_secondary_links.html.erb | 8 +- config/routes.rb | 5 - 16 files changed, 56 insertions(+), 303 deletions(-) create mode 100644 app/assets/stylesheets/mobile/page_header.css.scss delete mode 100644 app/assets/stylesheets/mobile/sesssions.css.scss delete mode 100644 app/controllers/m/posts_controller.rb delete mode 100644 app/controllers/m/sessions_controller.rb delete mode 100644 app/views/m/posts/_header.html.erb delete mode 100644 app/views/m/posts/_tags.html.erb delete mode 100644 app/views/m/posts/index.html.erb delete mode 100644 app/views/m/posts/show.html.erb delete mode 100644 app/views/m/sessions/new.html.erb diff --git a/app/assets/stylesheets/mobile.css.scss b/app/assets/stylesheets/mobile.css.scss index be24c506b..e36b70df8 100644 --- a/app/assets/stylesheets/mobile.css.scss +++ b/app/assets/stylesheets/mobile.css.scss @@ -1,7 +1,7 @@ /* + *= require "smoothness/jquery-ui-1.8.5.custom.css" *= require_self - *= require "./common/010_reset" - *= require "./common/020_base" - *= require "./common/030_links" + *= require_tree "./common" + *= require_tree "./specific" *= require_tree "./mobile" */ diff --git a/app/assets/stylesheets/mobile/page_header.css.scss b/app/assets/stylesheets/mobile/page_header.css.scss new file mode 100644 index 000000000..4b9f56974 --- /dev/null +++ b/app/assets/stylesheets/mobile/page_header.css.scss @@ -0,0 +1,16 @@ +@import "../common/000_vars.css.scss"; + +header#top { + h1 { + font-size: 2.5em; + margin: 5px 30px 0 30px; + } + + menu { + font-size: $h2_size; + + li.nonessential { + display: none; + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/mobile/paginator.css.scss b/app/assets/stylesheets/mobile/paginator.css.scss index 75f62d1d2..3a8f6b6dd 100644 --- a/app/assets/stylesheets/mobile/paginator.css.scss +++ b/app/assets/stylesheets/mobile/paginator.css.scss @@ -1,38 +1,15 @@ +@import "../common/000_vars.css.scss"; + div.paginator { - display: block; - padding: 2em 0 1em 0; - font-size: 2em; - text-align: center; + font-size: $h2_size; font-weight: bold; - clear: both; + + li { + margin: 1em 0; + } - a { - margin: 0 0.25em; - padding: 0 0.5em; + a, span { + padding: 0.5em 1em; font-weight: bold; - border: 1px solid #EAEAEA; - } - - a.arrow { - border: none; - } - - a.arrow:hover { - background: white; - color: #9093FF; - } - - a.current { - border: 1px solid #AAA; - } - - a:hover { - background: rgb(60, 60, 220); - color: white; - } - - span { - margin: 0 3px; - padding: 2px 6px; } } diff --git a/app/assets/stylesheets/mobile/posts.css.scss b/app/assets/stylesheets/mobile/posts.css.scss index bd7f06635..0fa6cd8cd 100644 --- a/app/assets/stylesheets/mobile/posts.css.scss +++ b/app/assets/stylesheets/mobile/posts.css.scss @@ -1,135 +1,33 @@ @import "../common/000_vars.css.scss"; -$default_font_size: 30pt; - -div#main { - max-width: 960px; -} - -header { - background: #eee; - height: 50px; - padding: 0 10px; - overflow: hidden; - - div { - height: 50px; - vertical-align: middle; - } - - div#search-item { - float: right; - - input { - margin-top: 10%; - font-size: $default_font_size; - } +div#c-posts { + section#mode-box { + display: none; } - div#sign-in-item { - float: left; - font-size: $default_font_size; - font-weight: bold; - margin-top: 15px; - } -} - -footer { - div.paginator { - overflow: visible; - font-size: $default_font_size; - - li { - a { - border: none; + section#tag-box { + ul { + font-size: $h2_size; + font-weight: bold; + + li { + margin: 0.5em 0; } } - li:first-child { - float: left; + a.search-tag { } - li:last-child { - float: right; + a.search-inc-tag { + display: none; + } + + a.search-exl-tag { + display: none; + } + + span.post-count { + display: none; } } -} - -div#posts { - overflow: visible; - clear: both; - padding-top: 10px; -} - -div.post-previews { - overflow: visible; -} - -article.post-preview { - height: 188px; - width: 188px; - float: left; - text-align: center; - vertical-align: middle; - @include inline-block; -} - -article.post-preview.blacklisted-active { - display: none; -} - -article.post-preview img { - border: 3px solid transparent; -} - -article.post-preview.post-status-has-parent img { - border: 3px solid #CC0; -} - -article.post-preview.post-status-has-children img { - border: 3px solid #0F0; -} - -article.post-preview.post-status-pending img { - border: 3px solid #00F; -} - -article.post-preview.post-status-flagged img { - border: 3px solid #F00; -} - -img#image { - margin: 10px; -} - -div#tag-list { - padding: 10px; - - li { - margin: 2.5em 0.5em; - @include inline-block; - - a { - background: #eee; - font-size: $default_font_size; - font-weight: bold; - padding: 0.2em 0.5em; - border: 1px solid #666; - @include border-radius(0.5em); - } - } -} - -div#c-posts { - li.category-1 a { - color: #A00; - } - - li.category-3 a { - color: #A0A; - } - - li.category-4 a { - color: #0A0; - } -} +} \ No newline at end of file diff --git a/app/assets/stylesheets/mobile/sesssions.css.scss b/app/assets/stylesheets/mobile/sesssions.css.scss deleted file mode 100644 index 84cc7aee7..000000000 --- a/app/assets/stylesheets/mobile/sesssions.css.scss +++ /dev/null @@ -1,10 +0,0 @@ -@import "../common/000_vars.css.scss"; -@import "../common/simple_form.css.scss"; - -div#main { - max-width: 960px; -} - -div#c-m-sessions { - margin: 10px; -} \ No newline at end of file diff --git a/app/controllers/m/posts_controller.rb b/app/controllers/m/posts_controller.rb deleted file mode 100644 index 81a266d0a..000000000 --- a/app/controllers/m/posts_controller.rb +++ /dev/null @@ -1,14 +0,0 @@ -module M - class PostsController < ApplicationController - layout "mobile" - - def index - @post_set = PostSets::Post.new(params[:tags], params[:page]) - @posts = @post_set.posts - end - - def show - @post = Post.find(params[:id]) - end - end -end diff --git a/app/controllers/m/sessions_controller.rb b/app/controllers/m/sessions_controller.rb deleted file mode 100644 index 7792577ed..000000000 --- a/app/controllers/m/sessions_controller.rb +++ /dev/null @@ -1,26 +0,0 @@ -module M - class SessionsController < ApplicationController - layout "mobile" - - def new - @user = User.new - end - - def create - session_creator = SessionCreator.new(session, cookies, params[:name], params[:password], params[:remember]) - - if session_creator.authenticate - redirect_to(params[:url] || session[:previous_uri] || m_posts_path) - else - redirect_to(new_m_session_path, :notice => "Password was incorrect.") - end - end - - def destroy - session.delete(:user_id) - cookies.delete(:cookie_password_hash) - cookies.delete(:user_name) - redirect_to(m_posts_path, :notice => "You are now logged out.") - end - end -end diff --git a/app/presenters/tag_set_presenter.rb b/app/presenters/tag_set_presenter.rb index cad95173e..d6a728fa5 100644 --- a/app/presenters/tag_set_presenter.rb +++ b/app/presenters/tag_set_presenter.rb @@ -51,7 +51,7 @@ private humanized_tag = tag.tr("_", " ") path = options[:path_prefix] || "/posts" - html << %{#{h(humanized_tag)} } + html << %{#{h(humanized_tag)} } unless options[:name_only] html << %{} + counts[tag].to_s + %{} diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 9ce46e125..34bb2a239 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -17,6 +17,7 @@ <%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %> <%= stylesheet_link_tag "application", :media => "screen" %> + <%= stylesheet_link_tag "mobile", :media => "handheld" %> <%= javascript_include_tag "application" %> <%= Danbooru.config.custom_html_header_content %> <%= yield :html_header %> diff --git a/app/views/m/posts/_header.html.erb b/app/views/m/posts/_header.html.erb deleted file mode 100644 index 5a7724257..000000000 --- a/app/views/m/posts/_header.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -
-
- <%= link_to Danbooru.config.app_name, posts_path %> - - <% if CurrentUser.is_anonymous? %> - – <%= link_to "Sign in", new_m_session_path(:url => request.fullpath) %> - <% else %> - – <%= link_to "Sign out", m_session_path, :remote => true, :method => :delete %> - <% end %> -
-
- <%= form_tag(m_posts_path, :method => :get) do %> - <%= search_field_tag :tags, params[:tags], :placeholder => "Search" %> - <% end %> -
-
diff --git a/app/views/m/posts/_tags.html.erb b/app/views/m/posts/_tags.html.erb deleted file mode 100644 index fb6a8f7bf..000000000 --- a/app/views/m/posts/_tags.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -
- <%= post.presenter.tag_list_html(self, :name_only => true, :path_prefix => "/m/posts") %> -
diff --git a/app/views/m/posts/index.html.erb b/app/views/m/posts/index.html.erb deleted file mode 100644 index 941096f5a..000000000 --- a/app/views/m/posts/index.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -
- <%= render "header" %> - -
- <% @post_set.posts.each do |post| %> - <%= PostPresenter.preview(post, :path_prefix => "/m/posts") %> - <% end %> -
- -
- <%= sequential_paginator(@post_set.posts) %> -
-
- -<% content_for(:page_title) do %> - <% if params[:tags].present? %> - <%= params[:tags] %> - <%= Danbooru.config.app_name %> - <% else %> - <%= Danbooru.config.app_name %> - <% end %> -<% end %> diff --git a/app/views/m/posts/show.html.erb b/app/views/m/posts/show.html.erb deleted file mode 100644 index 94caf5df4..000000000 --- a/app/views/m/posts/show.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -
- <%= render "header" %> - - <%= image_tag(@post.large_file_url, :width => @post.large_image_width, :height => @post.large_image_height, :id => "image") %> - - <%= render "tags", :post => @post %> -
- -<% content_for(:page_title) do %> - <%= @post.tag_string %> - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/m/sessions/new.html.erb b/app/views/m/sessions/new.html.erb deleted file mode 100644 index 64ecf4ecf..000000000 --- a/app/views/m/sessions/new.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -
-
-
-

Sign in

- <%= form_tag(session_path, :class => "simple_form") do %> - <%= hidden_field_tag "url", params[:url] %> - -
- - <%= text_field_tag :name %> -
- -
- - <%= password_field_tag :password %> -
- -
- - <%= check_box_tag :remember %> -
- -
- <%= submit_tag "Submit" %> -
- <% end %> -
-
-
- -<% content_for(:page_title) do %> - Sign in - <%= Danbooru.config.app_name %> -<% end %> diff --git a/app/views/posts/partials/common/_secondary_links.html.erb b/app/views/posts/partials/common/_secondary_links.html.erb index 2d957251b..67a1ebe3e 100644 --- a/app/views/posts/partials/common/_secondary_links.html.erb +++ b/app/views/posts/partials/common/_secondary_links.html.erb @@ -1,17 +1,17 @@ <% content_for(:secondary_links) do %>
  • <%= link_to "Listing", posts_path %>
  • -
  • <%= link_to "Upload", new_upload_path %>
  • +
  • <%= link_to "Upload", new_upload_path %>
  • <%= link_to "Popular", popular_explore_posts_path %>
  • <%= link_to "Hot", posts_path(:tags => "order:rank") %>
  • <% unless CurrentUser.is_anonymous? %>
  • <%= link_to "Favorites", favorites_path %>
  • <%= link_to "Subscriptions", posts_tag_subscription_path(CurrentUser.id) %>
  • <% end %> -
  • <%= link_to "Changes", post_versions_path %>
  • +
  • <%= link_to "Changes", post_versions_path %>
  • <% if CurrentUser.is_janitor? %> -
  • <%= link_to "Moderate", moderator_post_queue_path %>
  • +
  • <%= link_to "Moderate", moderator_post_queue_path %>
  • <% end %> -
  • <%= link_to "Help", wiki_pages_path(:title => "help:posts") %>
  • +
  • <%= link_to "Help", wiki_pages_path(:title => "help:posts") %>
  • <% end %> diff --git a/config/routes.rb b/config/routes.rb index 7381dc48e..f69848b73 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -163,11 +163,6 @@ Danbooru::Application.routes.draw do end resources :wiki_page_versions, :only => [:index, :show] - namespace :m do - resources :posts - resource :session - end - # aliases resources :wpages, :controller => "wiki_pages" resources :ftopics, :controller => "forum_topics"