changeset 379:2ad092e60975

[mq]: new-design
author nanaya <me@myconan.net>
date Sun, 07 Jun 2015 02:35:12 +0900
parents e84276bf344a
children 2ddd61aca2c8
files Gemfile Gemfile.lock app/assets/javascripts/application.coffee app/assets/javascripts/boot.coffee app/assets/stylesheets/_components.scss app/assets/stylesheets/_layout.scss app/assets/stylesheets/_new-paste.scss app/assets/stylesheets/_variables.scss app/assets/stylesheets/alert.scss app/assets/stylesheets/app_bootstrap.scss app/assets/stylesheets/application.scss app/assets/stylesheets/pastes.scss app/assets/stylesheets/sticky_footer.scss app/assets/stylesheets/tabs.scss app/models/paste.rb app/views/layouts/_alerts.html.erb app/views/layouts/application.html.erb app/views/pastes/_form.html.erb app/views/pastes/new.html.erb
diffstat 19 files changed, 193 insertions(+), 170 deletions(-) [+]
line wrap: on
line diff
--- a/Gemfile	Sat Jun 06 22:36:32 2015 +0900
+++ b/Gemfile	Sun Jun 07 02:35:12 2015 +0900
@@ -3,6 +3,7 @@
 gem "rails", "~> 4.2.0"
 gem "jquery-rails"
 gem "coffee-rails", "~> 4.1.0" # Rails 4.2 default
+gem "autoprefixer-rails"
 
 # Bundle edge Rails instead:
 # gem "rails", :git => "git://github.com/rails/rails.git"
@@ -14,7 +15,6 @@
 gem "sass-rails", "~> 5.0" # Rails 4.2 default
 
 gem "uglifier", ">= 1.3.0" # Rails 4.2 default
-gem "bootstrap-sass"
 
 gem "therubyrhino", :platforms => :jruby
 
--- a/Gemfile.lock	Sat Jun 06 22:36:32 2015 +0900
+++ b/Gemfile.lock	Sun Jun 07 02:35:12 2015 +0900
@@ -30,11 +30,6 @@
       activemodel (= 4.2.1)
       activesupport (= 4.2.1)
       arel (~> 6.0)
-    activerecord-jdbc-adapter (1.3.16)
-      activerecord (>= 2.2)
-    activerecord-jdbcpostgresql-adapter (1.3.16)
-      activerecord-jdbc-adapter (~> 1.3.16)
-      jdbc-postgres (>= 9.1)
     activesupport (4.2.1)
       i18n (~> 0.7)
       json (~> 1.7, >= 1.7.7)
@@ -45,9 +40,6 @@
     autoprefixer-rails (5.2.0)
       execjs
       json
-    bootstrap-sass (3.3.4.1)
-      autoprefixer-rails (>= 5.0.0.1)
-      sass (>= 3.2.19)
     builder (3.2.2)
     coffee-rails (4.1.0)
       coffee-script (>= 2.2.0)
@@ -61,14 +53,11 @@
     globalid (0.3.5)
       activesupport (>= 4.1.0)
     i18n (0.7.0)
-    jdbc-postgres (9.4.1200)
     jquery-rails (4.0.3)
       rails-dom-testing (~> 1.0)
       railties (>= 4.2.0)
       thor (>= 0.14, < 2.0)
-    jruby-openssl (0.9.7-java)
     json (1.8.3)
-    json (1.8.3-java)
     loofah (2.0.2)
       nokogiri (>= 1.5.9)
     mail (2.6.3)
@@ -79,7 +68,6 @@
     newrelic_rpm (3.12.0.288)
     nokogiri (1.6.6.2)
       mini_portile (~> 0.6.0)
-    nokogiri (1.6.6.2-java)
     pg (0.18.2)
     quiet_assets (1.1.0)
       railties (>= 3.1, < 5.0)
@@ -124,12 +112,8 @@
       actionpack (>= 3.0)
       activesupport (>= 3.0)
       sprockets (>= 2.8, < 4.0)
-    therubyrhino (2.0.4)
-      therubyrhino_jar (>= 1.7.3)
-    therubyrhino_jar (1.7.6)
     thor (0.19.1)
     thread_safe (0.3.5)
-    thread_safe (0.3.5-java)
     tilt (1.4.1)
     tzinfo (1.2.2)
       thread_safe (~> 0.1)
@@ -138,12 +122,11 @@
       json (>= 1.8.0)
 
 PLATFORMS
-  java
   ruby
 
 DEPENDENCIES
   activerecord-jdbcpostgresql-adapter
-  bootstrap-sass
+  autoprefixer-rails
   coffee-rails (~> 4.1.0)
   jquery-rails
   jruby-openssl
--- a/app/assets/javascripts/application.coffee	Sat Jun 06 22:36:32 2015 +0900
+++ b/app/assets/javascripts/application.coffee	Sun Jun 07 02:35:12 2015 +0900
@@ -1,5 +1,2 @@
 #= require jquery_ujs
-#= require bootstrap/tab
-#= require bootstrap/button
-#= require bootstrap/dropdown
 #= require boot
--- a/app/assets/javascripts/boot.coffee	Sat Jun 06 22:36:32 2015 +0900
+++ b/app/assets/javascripts/boot.coffee	Sun Jun 07 02:35:12 2015 +0900
@@ -1,8 +0,0 @@
-#= require zp.init
-#= require zp.formatter
-#= require zp.hash_magic
-#= require zp.new
-$(document).ready ->
-  zp.formatter.init()
-  zp.hash_magic.init()
-  zp.new.init()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/assets/stylesheets/_components.scss	Sun Jun 07 02:35:12 2015 +0900
@@ -0,0 +1,5 @@
+.input-url1 { display: none; }
+
+input[type=radio] {
+  margin-right: $spacing/2;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/assets/stylesheets/_layout.scss	Sun Jun 07 02:35:12 2015 +0900
@@ -0,0 +1,42 @@
+*, *:before, *:after {
+  position: relative;
+  box-sizing: border-box;
+}
+
+body, h1, input {
+  margin: 0px;
+}
+
+html, body {
+  height: 100%;
+}
+
+body {
+  display: flex;
+  flex-direction: column;
+}
+
+
+header {
+  flex: none;
+  background: #eee;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: $spacing/2 $spacing;
+
+}
+
+main {
+  flex: 1 0 auto;
+  width: 100%;
+
+  display: flex;
+  flex-direction: column;
+  padding: $spacing;
+}
+
+body, button, input {
+  font-family: Segoe UI, Helvetica Neue, Helvetica, Arial, sans-serif;
+  font-size: 12px;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/assets/stylesheets/_new-paste.scss	Sun Jun 07 02:35:12 2015 +0900
@@ -0,0 +1,78 @@
+#new_paste {
+  flex: 1;
+  display: flex;
+  flex-direction: column;
+
+  width: 100%;
+
+  #paste-form {
+    flex: 1 0 auto;
+    display: flex;
+    flex-direction: column;
+    margin-bottom: $spacing;
+
+    textarea {
+      flex: 1 0 auto;
+      resize: none;
+    }
+  }
+
+  #paste-control {
+    flex: none;
+
+    display: flex;
+    align-items: stretch;
+    justify-content: space-between;
+
+    flex-direction: column;
+    @media (min-width: $screen-sm) {
+      flex-direction: row;
+    }
+
+    .radio {
+      display: inline-flex;
+      align-items: center;
+      margin-right: $spacing;
+    }
+    .form-group {
+      display: flex;
+      flex-direction: column;
+    }
+
+    .form-label {
+      display: block;
+      margin-bottom: $spacing/2;
+    }
+
+    .inputs {
+      display: flex;
+      justify-content: space-around;
+      > * {
+        margin-right: $spacing;
+        flex: 1;
+
+        &:last-child {
+          margin-right: 0px;
+        }
+      }
+      &.right {
+        margin-top: $spacing;
+        min-height: $spacing * 4;
+      }
+
+      @media (min-width: $screen-sm) {
+        > * {
+          flex: 1 1 auto;
+        }
+
+        &.right {
+          margin-top: 0px;
+          > * {
+            margin-left: $spacing;
+            margin-right: 0px;
+          }
+        }
+      }
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/assets/stylesheets/_variables.scss	Sun Jun 07 02:35:12 2015 +0900
@@ -0,0 +1,2 @@
+$spacing: 10px;
+$screen-sm: 600px;
--- a/app/assets/stylesheets/alert.scss	Sat Jun 06 22:36:32 2015 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-.alert {
-  margin-top: 20px;
-}
--- a/app/assets/stylesheets/app_bootstrap.scss	Sat Jun 06 22:36:32 2015 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-@import 'bootstrap';
-@import 'sticky_footer';
-
-// Rails support.
-.field_with_errors {
-  @extend .has-error;
-}
--- a/app/assets/stylesheets/application.scss	Sat Jun 06 22:36:32 2015 +0900
+++ b/app/assets/stylesheets/application.scss	Sun Jun 07 02:35:12 2015 +0900
@@ -1,7 +1,5 @@
-@import "app_bootstrap";
-@import "bootstrap-prettify";
+@import "variables";
+@import "components";
+@import "layout";
 
-@import "alert";
-@import "pastes";
-@import "sticky_footer";
-@import "tabs";
+@import "new-paste";
--- a/app/assets/stylesheets/pastes.scss	Sat Jun 06 22:36:32 2015 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-textarea#paste_paste, .mirrored_text {
-  font-family: Monaco, Menlo, Consolas, "Courier New", monospace;
-  resize: none;
-  -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-  -moz-box-sizing: border-box;    /* Firefox, other Gecko */
-  box-sizing: border-box;         /* Opera/IE 8+ */
-}
-
-#pl > pre {
-  word-break: normal;
-}
-
-#paste-show > div,
-#paste-show > ul,
-.edit_paste {
-  margin-bottom: 20px;
-}
-
-#paste_key {
-  border-radius: 4px 0 0 4px;
-}
-
-.input-url1 {
-  display: none;
-}
--- a/app/assets/stylesheets/sticky_footer.scss	Sat Jun 06 22:36:32 2015 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/* Sticky footer styles
--------------------------------------------------- */
-
-html,
-body {
-  height: 100%;
-  /* The html and body elements cannot have any padding or margin. */
-}
-
-/* Wrapper for page content to push down footer */
-#wrap {
-  min-height: 100%;
-  height: auto !important;
-  height: 100%;
-  /* Negative indent footer by its height */
-  margin: 0 auto -60px;
-  /* Pad bottom by footer height + 10 */
-  padding: 0 0 70px;
-}
-
-/* Set the fixed height of the footer here */
-#footer {
-  height: 60px;
-  background-color: #f5f5f5;
-}
-
-
-/* Custom page CSS
--------------------------------------------------- */
-/* Not required for template or sticky footer method. */
-
-.container .credit {
-  margin: 20px 0;
-}
--- a/app/assets/stylesheets/tabs.scss	Sat Jun 06 22:36:32 2015 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-#md {
-  // copypasta from bootstrap's variables.scss
-  $baseFontSize_orig: 14px;
-  $baseLineHeight_orig: 20px;
-
-  // reduce for paste show
-  $baseFontSize: $baseFontSize_orig * 0.8;
-  $baseLineHeight: $baseLineHeight_orig * 0.8;
-
-  .well {
-    background-color: darken(white, 2%);
-  }
-
-  p {
-    margin: 0;
-  }
-
-  // copypasta from bootstrap's type.scss
-  h1,
-  h2,
-  h3 { line-height: $baseLineHeight * 2; }
-
-  // more copypasta from bootstrap's type.scss
-  h1 { font-size: $baseFontSize * 2.75; }
-  h2 { font-size: $baseFontSize * 2.25; }
-  h3 { font-size: $baseFontSize * 1.75; }
-  h4 { font-size: $baseFontSize * 1.25; }
-  h5 { font-size: $baseFontSize; }
-  h6 { font-size: $baseFontSize * 0.85; }
-}
--- a/app/models/paste.rb	Sat Jun 06 22:36:32 2015 +0900
+++ b/app/models/paste.rb	Sun Jun 07 02:35:12 2015 +0900
@@ -1,5 +1,7 @@
 class Paste < ActiveRecord::Base
   attr_accessor :is_private
+  after_initialize :set_privacy, :if => :new_record?
+
   before_validation :paste_limit
   before_validation :convert_newlines
   before_validation :set_paste_hash
@@ -83,6 +85,10 @@
     errors.add :base, :limit if ip_post_recent_count > 100
   end
 
+  def set_privacy
+    self.is_private ||= "0"
+  end
+
   def self.fix_all
     stats = Hash.new(0)
     all.find_each do |p|
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/views/layouts/_alerts.html.erb	Sun Jun 07 02:35:12 2015 +0900
@@ -0,0 +1,13 @@
+<% if params[:notice] %>
+  <div class="alert alert-info">
+    <strong>Info:</strong>
+    <%= params[:notice] %>
+  </div>
+<% end %>
+
+<% if @paste && @paste.errors.any? %>
+  <div class="alert alert-danger">
+    <strong>Error:</strong>
+    <%= @paste.errors.full_messages.to_sentence %>
+  </div>
+<% end %>
--- a/app/views/layouts/application.html.erb	Sat Jun 06 22:36:32 2015 +0900
+++ b/app/views/layouts/application.html.erb	Sun Jun 07 02:35:12 2015 +0900
@@ -7,22 +7,18 @@
     <%= stylesheet_link_tag    "application", :media => "all" %>
   </head>
   <body>
-
-    <div id="wrap">
-      <div class="container">
-        <%= yield %>
-      </div>
-    </div>
+    <header>
+      <h1><%= content_for :title %></h1>
+      <p class="credit">
+       Zeropaste.
+       <a href="https://bitbucket.org/nanaya1/zeropaste">Source</a>.
+       <%= link_to 'Donate', 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=me%40myconan%2enet&lc=ID&item_name=Zeropaste%20development&currency_code=USD&bn=PP%2dDonationsBF%3abtn_subscribe_LG%2egif%3aNonHosted' %>.
+      </p>
+    </header>
 
-    <div id="footer">
-      <div class="container">
-        <p class="text-muted credit">
-         Zeropaste.
-         <a href="https://bitbucket.org/nanaya1/zeropaste">Source</a>.
-         <%= link_to 'Donate', 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=me%40myconan%2enet&lc=ID&item_name=Zeropaste%20development&currency_code=USD&bn=PP%2dDonationsBF%3abtn_subscribe_LG%2egif%3aNonHosted' %>.
-        </p>
-      </div>
-    </div>
+    <main>
+      <%= yield %>
+    </main>
 
     <%= javascript_include_tag "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" %>
     <%= javascript_include_tag "application" %>
--- a/app/views/pastes/_form.html.erb	Sat Jun 06 22:36:32 2015 +0900
+++ b/app/views/pastes/_form.html.erb	Sun Jun 07 02:35:12 2015 +0900
@@ -1,21 +1,35 @@
 <%= form_for @paste do |f| %>
-  <div class="form-group">
-    <%= f.text_area :paste, :rows => 10, :class => "form-control" %>
+  <%= render "shared/filter_spam" %>
+  <div id="paste-form">
+    <%= f.text_area :paste, :rows => 10, :autofocus => true %>
   </div>
 
-  <div class="form-group">
-    <%= f.label :key, "Deletion key", class: "control-label" %>
-    <div class="row"><div class="col-sm-3">
-      <%= f.text_field :key, :class => "form-control" %>
-    </div></div>
+  <div id="paste-control">
+    <div class="inputs left">
+
+      <div class="vertical-flex">
+        <%= f.label :key, "Deletion key", :class => "form-label" %>
+        <%= f.text_field :key %>
+      </div>
+
+      <div class="vertical-flex">
+        <div class="form-label">Privacy</div>
+        <label class="radio">
+          <%= f.radio_button :is_private, "0" %>
+          <span>Public</span>
+        </label>
+
+        <label class="radio">
+          <%= f.radio_button :is_private, "1" %>
+          <span>Private</span>
+        </label>
+      </div>
+    </div>
+
+    <div class="inputs right">
+      <%= f.button %>
+
+      <%= button_tag "Clear", :type => "button", :id => "reset_paste" %>
+    </div>
   </div>
-  <%= render 'shared/filter_spam' %>
-  <div class="checkbox">
-    <%= f.label :is_private do %>
-      <%= f.check_box :is_private %>
-      Private
-    <% end %>
-  </div>
-  <%= f.button :class => 'btn btn-primary' %>
-  <%= link_to 'Clear', root_path, :class => 'btn btn-danger', :id => 'reset_paste' %>
 <% end %>
--- a/app/views/pastes/new.html.erb	Sat Jun 06 22:36:32 2015 +0900
+++ b/app/views/pastes/new.html.erb	Sun Jun 07 02:35:12 2015 +0900
@@ -14,8 +14,4 @@
   </div>
 <% end %>
 
-<div class="page-header">
-  <h1>New Paste</h1>
-</div>
-
 <%= render 'form' %>