# HG changeset patch # User nanaya # Date 1433612112 -32400 # Node ID 2ad092e60975a85d647d82d9e18ab676c255e160 # Parent e84276bf344ab319f2957d2f187eea0a7d019049 [mq]: new-design diff -r e84276bf344a -r 2ad092e60975 Gemfile --- 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 diff -r e84276bf344a -r 2ad092e60975 Gemfile.lock --- 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 diff -r e84276bf344a -r 2ad092e60975 app/assets/javascripts/application.coffee --- 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 diff -r e84276bf344a -r 2ad092e60975 app/assets/javascripts/boot.coffee --- 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() diff -r e84276bf344a -r 2ad092e60975 app/assets/stylesheets/_components.scss --- /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; +} diff -r e84276bf344a -r 2ad092e60975 app/assets/stylesheets/_layout.scss --- /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; +} diff -r e84276bf344a -r 2ad092e60975 app/assets/stylesheets/_new-paste.scss --- /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; + } + } + } + } + } +} diff -r e84276bf344a -r 2ad092e60975 app/assets/stylesheets/_variables.scss --- /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; diff -r e84276bf344a -r 2ad092e60975 app/assets/stylesheets/alert.scss --- 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; -} diff -r e84276bf344a -r 2ad092e60975 app/assets/stylesheets/app_bootstrap.scss --- 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; -} diff -r e84276bf344a -r 2ad092e60975 app/assets/stylesheets/application.scss --- 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"; diff -r e84276bf344a -r 2ad092e60975 app/assets/stylesheets/pastes.scss --- 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; -} diff -r e84276bf344a -r 2ad092e60975 app/assets/stylesheets/sticky_footer.scss --- 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; -} diff -r e84276bf344a -r 2ad092e60975 app/assets/stylesheets/tabs.scss --- 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; } -} diff -r e84276bf344a -r 2ad092e60975 app/models/paste.rb --- 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| diff -r e84276bf344a -r 2ad092e60975 app/views/layouts/_alerts.html.erb --- /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] %> +
+ Info: + <%= params[:notice] %> +
+<% end %> + +<% if @paste && @paste.errors.any? %> +
+ Error: + <%= @paste.errors.full_messages.to_sentence %> +
+<% end %> diff -r e84276bf344a -r 2ad092e60975 app/views/layouts/application.html.erb --- 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" %> - -
-
- <%= yield %> -
-
+
+

<%= content_for :title %>

+

+ Zeropaste. + Source. + <%= link_to 'Donate', 'https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=me%40myconan%2enet&lc=ID&item_name=Zeropaste%20development¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_subscribe_LG%2egif%3aNonHosted' %>. +

+
- +
+ <%= yield %> +
<%= javascript_include_tag "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" %> <%= javascript_include_tag "application" %> diff -r e84276bf344a -r 2ad092e60975 app/views/pastes/_form.html.erb --- 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| %> -
- <%= f.text_area :paste, :rows => 10, :class => "form-control" %> + <%= render "shared/filter_spam" %> +
+ <%= f.text_area :paste, :rows => 10, :autofocus => true %>
-
- <%= f.label :key, "Deletion key", class: "control-label" %> -
- <%= f.text_field :key, :class => "form-control" %> -
+
+
+ +
+ <%= f.label :key, "Deletion key", :class => "form-label" %> + <%= f.text_field :key %> +
+ +
+
Privacy
+ + + +
+
+ +
+ <%= f.button %> + + <%= button_tag "Clear", :type => "button", :id => "reset_paste" %> +
- <%= render 'shared/filter_spam' %> -
- <%= f.label :is_private do %> - <%= f.check_box :is_private %> - Private - <% end %> -
- <%= f.button :class => 'btn btn-primary' %> - <%= link_to 'Clear', root_path, :class => 'btn btn-danger', :id => 'reset_paste' %> <% end %> diff -r e84276bf344a -r 2ad092e60975 app/views/pastes/new.html.erb --- 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 @@
<% end %> - - <%= render 'form' %>