added responsive css

This commit is contained in:
SundaySalsa
2015-01-31 13:35:09 +03:00
committed by r888888888
parent c900816b3e
commit a6233f297e
8 changed files with 285 additions and 8 deletions

View File

@@ -0,0 +1,8 @@
// Whoever did the rest of js files, he/she did it in some other way
// Hope this is not very wrong
$(document).ready(function() {
$("#maintoggle").click(function(){
$('#nav').toggle();
$('#maintoggle').toggleClass('toggler-active');
});
});

View File

@@ -1,5 +1,9 @@
@import "000_vars.css.scss";
#maintoggle {
display: none;
}
header#top {
h1 {
font-size: 2.5em;

View File

@@ -0,0 +1,254 @@
/* Content */
/* i. e. the images in posts */
img#image {
/* Images in posts are called in such form:
@post.presenter.image_html(self)
I have no idea what that 'presenter' method means
This gives them fixed width
It causes window to overextend on smaller screens
*/
max-width: 95%;
height: auto;
margin: auto;
}
@media screen and (max-width: 660px) {
#maintoggle {
display: inline;
background-color: #70599A;
padding: 0.5em 1em 0.7em 1em;
border-radius: 20% 20% 0 0;
font-weight: bold;
color: #fff;
}
#maintoggle.toggler-active {
background-color: #D3CBE0;
color: #000;
}
h1 {
font-size: 1.2em;
}
input[type=text], input[type=submit] {
font-size: 18pt;
}
div#page section#content {
margin-left: 0em;
}
/* Sidebar */
#sidebar {
display: none;
}
/* paginator */
div.paginator {
font-size: 16pt;
font-weight: bold;
text-align: left;
background-color: #F7F7FF;
border-radius: 15%;
padding: 3pt;
li {
display: inline;
line-height: 1.4em;
a, span {
padding: 3px 18px;
margin: 0 3px;
display: inline-block;
border-radius: 15%;
}
}
}
/* posts/index */
article.post-preview {
margin: 15px 0;
width: 150px;
text-align: center;
vertical-align: middle;
display: inline-block;
a {
width: 150px;
display: block;
margin: 0 auto;
}
img {
margin: 0 auto;
}
}
/* posts/show */
img#image {
margin-top: 5px;
}
div#options {
margin-top: 10px;
font-size: 24pt;
font-weight: bold;
}
div#tags {
margin-top: 30px;
li {
margin: 10px 0;
}
a.search-tag {
font-size: 24pt;
font-weight: bold;
}
}
/* tag list */
section#responsive-tag-list {
display: block;
h1 {
font-size: 1em;
}
}
/* comments */
//Comments themselves
div#page {
div.comments-for-post div.list-of-comments article.comment div.content {
clear: both;
margin-left: 0;
margin: 0 0 0 0;
}
}
/**********************************
HEADER
***********************************/
nav {
background: none;
float: right;
font-size: 1.125em;
width: 100%;
}
#nav {
display: none;
}
header#top menu.main {
background-color: #d3cbe0;
}
header#top menu {
width: 100%;
}
#logo {
/* There is logo? */
}
h1 {
font-size: 2em;
}
h2 {
font-size: 0.825em;
margin-bottom: 20px;
}
header {
border-bottom: 5px solid #70599a;
text-align: center;
line-height: 2em;
h1 {
display: inline; //Needed for menu button
}
}
/* Body */
div#page {
margin: 0 3%;
}
#posts {
img {
width: 100%;
}
article.post-preview a {
width: 100%;
}
}
}
@media screen and (max-width: 440px) {
body {
width: 100%;
}
#post-sections {
font-size: 1em;
}
div article.post-preview {
max-width: 45%;
width: 100%;
height: 100%;
overflow: visible;
}
input {
max-width: 100%;
}
}
/* Dashboard */
div#page {
div#c-moderator-dashboards {
div#col1 {
width: 100%;
}
div#col2 {
width: 100%;
clear: both;
}
}
}
/* Artist search */
table.search {
clear: both;
}
input#search-name {
max-width: 100%;
}
/* Site map */
div#c-static div#a-site-map section {
clear: both;
}
/* Warnings & notices */
#tos-notice {
display: none;
}

View File

@@ -10,4 +10,8 @@ div#c-tags {
width: 40em;
}
}
}
}
#mobile-tag-list {
display: none;
}

View File

@@ -9,15 +9,11 @@ class SavedSearch < ActiveRecord::Base
before_validation :normalize
def self.tagged(tags)
where(:tag_query => SavedSearch.normalize(tags)).first
end
def self.normalize(tag_query)
Tag.scan_query(tag_query).join(" ")
where(:tag_query => tags).first
end
def normalize
self.tag_query = SavedSearch.normalize(tag_query)
self.tag_query = Tag.scan_query(tag_query).join(" ")
end
def validate_count

View File

@@ -35,7 +35,8 @@
<%= render "news_updates/listing" %>
<h1><%= link_to Danbooru.config.app_name, "/" %></h1>
<nav>
<span id="maintoggle"> ☰ </span> <!-- Maybe icon would be better, I'm not sure -->
<nav id="nav">
<%= render "layouts/main_links" %>
<%= yield :secondary_links %>
</nav>

View File

@@ -32,6 +32,11 @@
<%= render "posts/partials/index/excerpt", :post_set => @post_set %>
<%= render "posts/partials/index/posts", :post_set => @post_set %>
</section>
<section id="responsive-tag-list">
<%= render "posts/partials/common/search", :path => posts_path, :tags => params[:tags] %>
<%= @post_set.presenter.tag_list_html(self) %>
</section>
<% content_for(:page_title) do %>
<% if @post_set.tag_string.present? %>

View File

@@ -65,6 +65,11 @@
<li><a href="#share">Share</a></li>
</menu>
<section id="responsive-tag-list">
<%= render "posts/partials/common/search", :path => posts_path, :tags => params[:tags] %>
<%= @post.presenter.split_tag_list_html(self) %>
</section>
<section id="comments">
<% if !CurrentUser.user.is_builder? %>
<h2>Before commenting, read the <%= link_to "how to comment guide", wiki_pages_path(:search => {:title => "howto:comment"}) %>.</h2>