diff --git a/.gitignore b/.gitignore index dad5cea5e..0f868376b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /db/*.sqlite3-journal /log/* /tmp/* +/public/assets/ diff --git a/.ruby-version b/.ruby-version index 197c4d5c2..ff365e06b 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.4.0 +3.1.3 diff --git a/Gemfile b/Gemfile index c9e10f31e..da0f0b5c0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -ruby '2.4.0' +ruby '3.1.3' source 'https://rubygems.org' git_source(:github) do |repo_name| @@ -6,13 +6,13 @@ git_source(:github) do |repo_name| "https://github.com/#{repo_name}.git" end -gem 'rails', '~> 5.0.1' +gem 'rails', '6.1.7.3' gem 'acts-as-taggable-on' gem 'authlogic' -gem 'aws-sdk' -gem 'coffee-rails', '~> 4.2' -gem 'dynamic_form' +gem 'aws-sdk-s3' +gem 'coffee-rails' +gem 'dynamic_form', git: 'https://github.com/payrollhero/dynamic_form.git', ref: '7f90400' gem 'exception_notification' gem 'exception_notification-rake' gem 'foreman' @@ -23,16 +23,17 @@ gem 'paperclip' gem 'pg' gem 'pg_search' gem 'public_activity' -gem 'puma', '~> 3.0' +gem 'puma' gem 'rack-cors', :require => 'rack/cors' gem 'rails_admin' gem 'redcarpet' gem 'responders' gem 'rmagick' gem 'sanitize' -gem 'sass-rails', '~> 5.0' +gem 'sass-rails' +gem 'scrypt' gem 'sidekiq' -gem 'uglifier', '>= 1.3.0' +gem "webrick", "~> 1.7" gem 'whenever' gem 'will_paginate' @@ -60,3 +61,4 @@ end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] +gem 'sassc-rails' diff --git a/Gemfile.lock b/Gemfile.lock index ef2cf487b..2a357849b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,287 +1,337 @@ +GIT + remote: https://github.com/payrollhero/dynamic_form.git + revision: 7f904005f6001a0b908dd879c34547b0e87a34e7 + ref: 7f90400 + specs: + dynamic_form (1.1.4) + GEM remote: https://rubygems.org/ specs: - actioncable (5.0.1) - actionpack (= 5.0.1) - nio4r (~> 1.2) - websocket-driver (~> 0.6.1) - actionmailer (5.0.1) - actionpack (= 5.0.1) - actionview (= 5.0.1) - activejob (= 5.0.1) + actioncable (6.1.7.3) + actionpack (= 6.1.7.3) + activesupport (= 6.1.7.3) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.7.3) + actionpack (= 6.1.7.3) + activejob (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) + mail (>= 2.7.1) + actionmailer (6.1.7.3) + actionpack (= 6.1.7.3) + actionview (= 6.1.7.3) + activejob (= 6.1.7.3) + activesupport (= 6.1.7.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.1) - actionview (= 5.0.1) - activesupport (= 5.0.1) - rack (~> 2.0) - rack-test (~> 0.6.3) + actionpack (6.1.7.3) + actionview (= 6.1.7.3) + activesupport (= 6.1.7.3) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.1) - activesupport (= 5.0.1) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.7.3) + actionpack (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) + nokogiri (>= 1.8.5) + actionview (6.1.7.3) + activesupport (= 6.1.7.3) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (5.0.1) - activesupport (= 5.0.1) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.7.3) + activesupport (= 6.1.7.3) globalid (>= 0.3.6) - activemodel (5.0.1) - activesupport (= 5.0.1) - activerecord (5.0.1) - activemodel (= 5.0.1) - activesupport (= 5.0.1) - arel (~> 7.0) - activesupport (5.0.1) + activemodel (6.1.7.3) + activesupport (= 6.1.7.3) + activemodel-serializers-xml (1.0.2) + activemodel (> 5.x) + activesupport (> 5.x) + builder (~> 3.1) + activerecord (6.1.7.3) + activemodel (= 6.1.7.3) + activesupport (= 6.1.7.3) + activestorage (6.1.7.3) + actionpack (= 6.1.7.3) + activejob (= 6.1.7.3) + activerecord (= 6.1.7.3) + activesupport (= 6.1.7.3) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (6.1.7.3) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) - minitest (~> 5.1) - tzinfo (~> 1.1) - acts-as-taggable-on (4.0.0) - activerecord (>= 4.0) - arel (7.1.4) - authlogic (3.5.0) - activerecord (>= 3.2, < 5.1) - activesupport (>= 3.2, < 5.1) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + acts-as-taggable-on (9.0.1) + activerecord (>= 6.0, < 7.1) + authlogic (6.4.2) + activemodel (>= 5.2, < 7.1) + activerecord (>= 5.2, < 7.1) + activesupport (>= 5.2, < 7.1) request_store (~> 1.0) - scrypt (>= 1.2, < 4.0) - aws-sdk (2.7.9) - aws-sdk-resources (= 2.7.9) - aws-sdk-core (2.7.9) - aws-sigv4 (~> 1.0) + aws-eventstream (1.0.3) + aws-partitions (1.263.0) + aws-sdk-core (3.89.1) + aws-eventstream (~> 1.0, >= 1.0.2) + aws-partitions (~> 1, >= 1.239.0) + aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-resources (2.7.9) - aws-sdk-core (= 2.7.9) - aws-sigv4 (1.0.0) - builder (3.2.3) + aws-sdk-kms (1.27.0) + aws-sdk-core (~> 3, >= 3.71.0) + aws-sigv4 (~> 1.1) + aws-sdk-s3 (1.60.1) + aws-sdk-core (~> 3, >= 3.83.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.1) + aws-sigv4 (1.1.0) + aws-eventstream (~> 1.0, >= 1.0.2) + bindex (0.8.1) + builder (3.2.4) byebug (9.0.6) chronic (0.10.2) - climate_control (0.1.0) - cocaine (0.5.8) - climate_control (>= 0.0.3, < 1.0) - coffee-rails (4.2.1) + climate_control (0.2.0) + coffee-rails (5.0.0) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.2.x) + railties (>= 5.2.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.0.4) - connection_pool (2.2.1) - crass (1.0.2) - debug_inspector (0.0.2) - dotenv (2.2.0) - dotenv-rails (2.2.0) - dotenv (= 2.2.0) - railties (>= 3.2, < 5.1) - dynamic_form (1.1.4) - erubis (2.7.0) - exception_notification (4.2.1) - actionmailer (>= 4.0, < 6) - activesupport (>= 4.0, < 6) - exception_notification-rake (0.3.0) - exception_notification (~> 4.2.0) + concurrent-ruby (1.2.2) + connection_pool (2.2.5) + crass (1.0.6) + date (3.3.1) + dotenv (2.8.1) + dotenv-rails (2.8.1) + dotenv (= 2.8.1) + railties (>= 3.2) + erubi (1.11.0) + exception_notification (4.5.0) + actionmailer (>= 5.2, < 8) + activesupport (>= 5.2, < 8) + exception_notification-rake (0.3.1) + exception_notification (~> 4.3) rake (>= 0.9.0) execjs (2.7.0) - factory_girl (4.8.0) + factory_girl (4.9.0) activesupport (>= 3.0.0) - factory_girl_rails (4.8.0) - factory_girl (~> 4.8.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) railties (>= 3.0.0) - ffi (1.9.17) + ffi (1.15.5) ffi-compiler (1.0.1) ffi (>= 1.0.0) rake - font-awesome-rails (4.7.0.1) - railties (>= 3.2, < 5.1) - foreman (0.83.0) - thor (~> 0.19.1) - globalid (0.3.7) - activesupport (>= 4.1.0) - haml (4.0.7) + foreman (0.87.2) + globalid (1.1.0) + activesupport (>= 5.0) + haml (6.1.1) + temple (>= 0.8.2) + thor tilt - haml-rails (0.9.0) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) - haml (>= 4.0.6, < 5.0) - html2haml (>= 1.0.1) - railties (>= 4.0.1) - html2haml (2.1.0) - erubis (~> 2.7.0) - haml (~> 4.0) - nokogiri (>= 1.6.0) - ruby_parser (~> 3.5) - i18n (0.8.0) - jmespath (1.3.1) - jquery-rails (4.2.2) - rails-dom-testing (>= 1, < 3) - railties (>= 4.2.0) - thor (>= 0.14, < 2.0) - jquery-ui-rails (5.0.5) - railties (>= 3.2.16) - kaminari (0.17.0) - actionpack (>= 3.0.0) - activesupport (>= 3.0.0) + haml-rails (2.1.0) + actionpack (>= 5.1) + activesupport (>= 5.1) + haml (>= 4.0.6) + railties (>= 5.1) + i18n (1.13.0) + concurrent-ruby (~> 1.0) + jmespath (1.6.1) + kaminari (1.2.2) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) + actionview + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) + activerecord + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - loofah (2.0.3) + loofah (2.19.1) + crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.4) - mime-types (>= 1.16, < 4) + mail (2.8.0) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) memoist (0.15.0) metaclass (0.0.4) - method_source (0.8.2) - mime-types (3.1) + method_source (1.0.0) + mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mimemagic (0.3.2) - mini_portile2 (2.1.0) - minitest (5.10.1) + mime-types-data (3.2023.0218.1) + mimemagic (0.3.10) + nokogiri (~> 1) + rake + mini_mime (1.1.2) + mini_portile2 (2.8.1) + minitest (5.18.0) mocha (1.2.1) metaclass (~> 0.0.1) nested_form (0.3.2) - nio4r (1.2.1) - nokogiri (1.7.0.1) - mini_portile2 (~> 2.1.0) - nokogumbo (1.4.10) - nokogiri - paperclip (5.1.0) + net-imap (0.3.2) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.1) + timeout + net-smtp (0.3.3) + net-protocol + nio4r (2.5.8) + nokogiri (1.14.3) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) + paperclip (6.1.0) activemodel (>= 4.2.0) activesupport (>= 4.2.0) - cocaine (~> 0.5.5) mime-types mimemagic (~> 0.3.0) - pg (0.19.0) - pg_search (2.0.1) - activerecord (>= 4.2) - activesupport (>= 4.2) - arel (>= 6) - public_activity (1.5.0) - actionpack (>= 3.0.0) - activerecord (>= 3.0) + terrapin (~> 0.6.0) + pg (1.4.5) + pg_search (2.3.6) + activerecord (>= 5.2) + activesupport (>= 5.2) + public_activity (2.0.2) + actionpack (>= 5.0.0) + activerecord (>= 5.0) i18n (>= 0.5.0) - railties (>= 3.0.0) - puma (3.7.0) - rack (2.0.1) - rack-cors (0.4.1) - rack-pjax (1.0.0) - nokogiri (~> 1.5) - rack (>= 1.1) - rack-protection (1.5.3) + railties (>= 5.0.0) + puma (4.3.12) + nio4r (~> 2.0) + racc (1.6.2) + rack (2.2.6.4) + rack-cors (1.1.1) + rack (>= 2.0.0) + rack-protection (2.2.0) rack - rack-test (0.6.3) - rack (>= 1.0) - rails (5.0.1) - actioncable (= 5.0.1) - actionmailer (= 5.0.1) - actionpack (= 5.0.1) - actionview (= 5.0.1) - activejob (= 5.0.1) - activemodel (= 5.0.1) - activerecord (= 5.0.1) - activesupport (= 5.0.1) - bundler (>= 1.3.0, < 2.0) - railties (= 5.0.1) + rack-test (2.0.2) + rack (>= 1.3) + rails (6.1.7.3) + actioncable (= 6.1.7.3) + actionmailbox (= 6.1.7.3) + actionmailer (= 6.1.7.3) + actionpack (= 6.1.7.3) + actiontext (= 6.1.7.3) + actionview (= 6.1.7.3) + activejob (= 6.1.7.3) + activemodel (= 6.1.7.3) + activerecord (= 6.1.7.3) + activestorage (= 6.1.7.3) + activesupport (= 6.1.7.3) + bundler (>= 1.15.0) + railties (= 6.1.7.3) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.1) - actionpack (~> 5.x) - actionview (~> 5.x) - activesupport (~> 5.x) - rails-dom-testing (2.0.2) - activesupport (>= 4.2.0, < 6.0) - nokogiri (~> 1.6) - rails-html-sanitizer (1.0.3) - loofah (~> 2.0) - rails_admin (1.1.1) - builder (~> 3.1) - coffee-rails (~> 4.0) - font-awesome-rails (>= 3.0, < 5) - haml (~> 4.0) - jquery-rails (>= 3.0, < 5) - jquery-ui-rails (~> 5.0) - kaminari (~> 0.14) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.4.4) + loofah (~> 2.19, >= 2.19.1) + rails_admin (3.1.2) + activemodel-serializers-xml (>= 1.0) + kaminari (>= 0.14, < 2.0) nested_form (~> 0.3) - rack-pjax (>= 0.7) - rails (>= 4.0, < 6) - remotipart (~> 1.3) - sass-rails (>= 4.0, < 6) - railties (5.0.1) - actionpack (= 5.0.1) - activesupport (= 5.0.1) + rails (>= 6.0, < 8) + turbo-rails (~> 1.0) + railties (6.1.7.3) + actionpack (= 6.1.7.3) + activesupport (= 6.1.7.3) method_source - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (12.0.0) + rake (>= 12.2) + thor (~> 1.0) + rake (13.0.6) rb-fsevent (0.9.8) rb-inotify (0.9.8) ffi (>= 0.5.0) - redcarpet (3.4.0) - redis (3.3.3) - remotipart (1.3.1) + redcarpet (3.5.1) + redis (4.5.1) request_store (1.3.2) - responders (2.3.0) - railties (>= 4.2.0, < 5.1) - rmagick (2.16.0) - ruby_parser (3.8.4) - sexp_processor (~> 4.1) - sanitize (4.4.0) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rmagick (4.0.0) + sanitize (6.0.1) crass (~> 1.0.2) - nokogiri (>= 1.4.4) - nokogumbo (~> 1.4.1) - sass (3.4.23) - sass-rails (5.0.6) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - scrypt (3.0.3) - ffi-compiler (>= 1.0.0) - rake - sexp_processor (4.8.0) - shoulda (3.5.0) + nokogiri (>= 1.12.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + scrypt (3.0.7) + ffi-compiler (>= 1.0, < 2.0) + shoulda (3.6.0) shoulda-context (~> 1.0, >= 1.0.1) - shoulda-matchers (>= 1.4.1, < 3.0) + shoulda-matchers (~> 3.0) shoulda-context (1.2.2) - shoulda-matchers (2.8.0) - activesupport (>= 3.0.0) - sidekiq (4.2.9) - concurrent-ruby (~> 1.0) - connection_pool (~> 2.2, >= 2.2.0) + shoulda-matchers (3.1.3) + activesupport (>= 4.0.0) + sidekiq (5.2.10) + connection_pool (~> 2.2, >= 2.2.2) + rack (~> 2.0) rack-protection (>= 1.5.0) - redis (~> 3.2, >= 3.2.1) - spring (2.0.1) - activesupport (>= 4.2) + redis (~> 4.5, < 4.6.0) + spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (3.7.1) + sprockets (4.1.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.0) - actionpack (>= 4.0) - activesupport (>= 4.0) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) - thor (0.19.4) - thread_safe (0.3.5) - tilt (2.0.6) - tzinfo (1.2.2) - thread_safe (~> 0.1) - uglifier (3.0.4) - execjs (>= 0.3.0, < 3) - web-console (3.4.0) - actionview (>= 5.0) - activemodel (>= 5.0) - debug_inspector - railties (>= 5.0) - websocket-driver (0.6.5) + temple (0.9.1) + terrapin (0.6.0) + climate_control (>= 0.0.3, < 1.0) + thor (1.2.1) + tilt (2.0.11) + timeout (0.3.1) + turbo-rails (1.4.0) + actionpack (>= 6.0.0) + activejob (>= 6.0.0) + railties (>= 6.0.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + web-console (4.2.0) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) + bindex (>= 0.4.0) + railties (>= 6.0.0) + webrick (1.7.0) + websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) + websocket-extensions (0.1.5) whenever (0.9.7) chronic (>= 0.6.3) - will_paginate (3.1.5) + will_paginate (3.3.1) + zeitwerk (2.6.7) PLATFORMS ruby @@ -289,11 +339,11 @@ PLATFORMS DEPENDENCIES acts-as-taggable-on authlogic - aws-sdk + aws-sdk-s3 byebug - coffee-rails (~> 4.2) + coffee-rails dotenv-rails - dynamic_form + dynamic_form! exception_notification exception_notification-rake factory_girl_rails @@ -307,28 +357,30 @@ DEPENDENCIES pg pg_search public_activity - puma (~> 3.0) + puma rack-cors - rails (~> 5.0.1) + rails (= 6.1.7.3) rails-controller-testing rails_admin redcarpet responders rmagick sanitize - sass-rails (~> 5.0) + sass-rails + sassc-rails + scrypt shoulda sidekiq spring spring-watcher-listen (~> 2.0.0) tzinfo-data - uglifier (>= 1.3.0) web-console (>= 3.3.0) + webrick (~> 1.7) whenever will_paginate RUBY VERSION - ruby 2.4.0p0 + ruby 3.1.3p185 BUNDLED WITH - 1.14.3 + 2.3.26 diff --git a/README.md b/README.md index 41c3c6b17..797cbc029 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Things you may want to cover: * Ruby version - * 2.4.0 + * 2.4.9 * System dependencies @@ -54,8 +54,28 @@ If you're on OSX Sierra, you'll need to force an older version of ImageMagick Install all the project's dependencies with `bundle install` +## Ubuntu Setup + +```bash +sudo apt-get install -y build-essential patch ruby-dev zlib1g-dev liblzma-dev imagemagick libmagickwand-dev postgresql libpq-dev +``` + +```bash +sudo service postgresql start +sudo su - postgres +createuser --interactive --createdb $USER +exit +``` + ## First time configuration Create your development database `bundle exec rake db:setup` + +## Syncing your local db with prod + +1. Install the Heroku CLI +2. Log in to the CLI +3. Make sure you have added the heroku remote for this project +4. Run script/sync-db-with-prod diff --git a/app/assets/stylesheets/_card.sass b/app/assets/stylesheets/_card.sass index 82bd7ec13..f2495e000 100644 --- a/app/assets/stylesheets/_card.sass +++ b/app/assets/stylesheets/_card.sass @@ -1,12 +1,21 @@ +@import "variables" + card min-width: 256px display: inline-block margin: 1em vertical-align: top - sprites > & + sprites > &, tunes > & width: 256px + @include small + margin: 1em 0 0 + width: 100% + + &:first-child + margin-top: 0 + > .outline box-shadow: $item-shadow border-radius: 4px diff --git a/app/assets/stylesheets/_creator.sass b/app/assets/stylesheets/_creator.sass index 0d623c210..625d5a71b 100644 --- a/app/assets/stylesheets/_creator.sass +++ b/app/assets/stylesheets/_creator.sass @@ -1,3 +1,5 @@ +@import "variables" + creator display: block diff --git a/app/assets/stylesheets/animations.sass b/app/assets/stylesheets/animations.sass new file mode 100644 index 000000000..a7c791af7 --- /dev/null +++ b/app/assets/stylesheets/animations.sass @@ -0,0 +1,11 @@ +@import "variables" + +@keyframes slide-in-and-out-from-left + 0% + right: 110% + 12.5% + right: -1em + 87.5% + right: -1em + 100% + right: 110% diff --git a/app/assets/stylesheets/base.sass b/app/assets/stylesheets/base.sass index 7b6ec0632..6eb4e6a3f 100644 --- a/app/assets/stylesheets/base.sass +++ b/app/assets/stylesheets/base.sass @@ -1,3 +1,5 @@ +@import "variables" + * box-sizing: border-box @@ -18,6 +20,7 @@ body > content display: block padding: 0 1em + position: relative &#fullscreen overflow: hidden diff --git a/app/assets/stylesheets/button.sass b/app/assets/stylesheets/button.sass index fceb84cf4..24e827af5 100644 --- a/app/assets/stylesheets/button.sass +++ b/app/assets/stylesheets/button.sass @@ -1,3 +1,5 @@ +@import "variables" + button, .button background-color: white border-radius: 4px @@ -41,4 +43,3 @@ actions &:last-child margin-right: 0 - diff --git a/app/assets/stylesheets/comments.sass b/app/assets/stylesheets/comments.sass index c9c3ec8b9..8fa594dfe 100644 --- a/app/assets/stylesheets/comments.sass +++ b/app/assets/stylesheets/comments.sass @@ -1,3 +1,5 @@ +@import "variables" + comments display: block max-width: 400px diff --git a/app/assets/stylesheets/errors.sass b/app/assets/stylesheets/errors.sass new file mode 100644 index 000000000..a9448ebc3 --- /dev/null +++ b/app/assets/stylesheets/errors.sass @@ -0,0 +1,8 @@ +@import "variables" + +#errorExplanation + border-radius: 4px + border: 2px solid red + box-shadow: $item-shadow + color: red + padding: 0 1em diff --git a/app/assets/stylesheets/flash.sass b/app/assets/stylesheets/flash.sass new file mode 100644 index 000000000..753de712c --- /dev/null +++ b/app/assets/stylesheets/flash.sass @@ -0,0 +1,22 @@ +@import "variables" + +#flash + display: flex + left: 0 + overflow: hidden + padding: 1em + pointer-events: none + position: absolute + top: -1em + + > * + animation-duration: 5s + animation-name: slide-in-and-out-from-left + background-color: white + border-radius: 4px + border: 1px solid green + box-shadow: $item-shadow + color: green + right: 110% + padding: 1em + position: relative diff --git a/app/assets/stylesheets/form.sass b/app/assets/stylesheets/form.sass index f0356e4a6..daf08f975 100644 --- a/app/assets/stylesheets/form.sass +++ b/app/assets/stylesheets/form.sass @@ -1,3 +1,5 @@ +@import "variables" + input, textarea color: inherit padding: 3px 4px @@ -20,7 +22,7 @@ form display: block margin-bottom: 1em - > input[type="text"] + > input[type="text"], > input[type="password"] width: 100% > textarea @@ -99,6 +101,14 @@ form.primary > h1 color: $primary-color font-size: 2em + margin-top: 0 + + @include small + margin-left: 0 + width: 100% + + > button.cta + width: 100% label > h3 display: inline @@ -117,3 +127,6 @@ input &::-webkit-color-swatch border: none padding: 0 + +input.error + border: 2px solid red diff --git a/app/assets/stylesheets/header.sass b/app/assets/stylesheets/header.sass index 33c2be4ca..0e9ac76c9 100644 --- a/app/assets/stylesheets/header.sass +++ b/app/assets/stylesheets/header.sass @@ -1,3 +1,5 @@ +@import "variables" + body > header background-color: $primary-color display: flex @@ -34,3 +36,20 @@ body > header & > img margin-left: 0.5em + + @include small + flex-direction: column + height: auto + width: 100% + + > a + width: 100% + + &:nth-child(n + 2) + padding: 0.5em 2em + + &:nth-child(1), + &:nth-child(2), + &:nth-child(4), + &:nth-child(6) + display: none diff --git a/app/assets/stylesheets/invites.sass b/app/assets/stylesheets/invites.sass index 8e6bce9d2..2cc454a42 100644 --- a/app/assets/stylesheets/invites.sass +++ b/app/assets/stylesheets/invites.sass @@ -1,3 +1,5 @@ +@import "variables" + section.invite-sample margin-bottom: 2em margin-left: calc(58px - 0.5em) diff --git a/app/assets/stylesheets/navigation.sass b/app/assets/stylesheets/navigation.sass index 8f1d17293..1c97b6901 100644 --- a/app/assets/stylesheets/navigation.sass +++ b/app/assets/stylesheets/navigation.sass @@ -1,5 +1,10 @@ +@import "variables" + content > nav display: flex > * margin-right: 1em + + @include small + flex-direction: column diff --git a/app/assets/stylesheets/pagination.sass b/app/assets/stylesheets/pagination.sass index c345cf55d..8ae91a172 100644 --- a/app/assets/stylesheets/pagination.sass +++ b/app/assets/stylesheets/pagination.sass @@ -1,3 +1,5 @@ +@import "variables" + .pagination display: flex margin: 1em 1em 1em 0 @@ -10,11 +12,12 @@ border: 1px solid $primary-color border-left-width: 0 color: $primary-color - flex: none + flex: 0 1 auto font-weight: bold line-height: 34px padding: 0 14px text-decoration: none + white-space: nowrap &:first-child border-bottom-left-radius: 3px @@ -33,5 +36,14 @@ color: white background: $primary-color + @include small + display: none + + &:first-child, &:last-child + display: block + & > ul padding: 0 + + @include small + margin: 1em 0 0 diff --git a/app/assets/stylesheets/screen.sass b/app/assets/stylesheets/screen.sass index 42867c733..5421cc690 100644 --- a/app/assets/stylesheets/screen.sass +++ b/app/assets/stylesheets/screen.sass @@ -3,10 +3,13 @@ @import variables @import base +@import animations @import button @import card @import creator @import comments +@import errors +@import flash @import form @import header @import image diff --git a/app/assets/stylesheets/sprites.sass b/app/assets/stylesheets/sprites.sass index c89f900dd..9cc328822 100644 --- a/app/assets/stylesheets/sprites.sass +++ b/app/assets/stylesheets/sprites.sass @@ -1,3 +1,5 @@ +@import "variables" + sprites display: block min-height: 100px diff --git a/app/assets/stylesheets/tags.sass b/app/assets/stylesheets/tags.sass index 07b8ccb2e..a401e2a9e 100644 --- a/app/assets/stylesheets/tags.sass +++ b/app/assets/stylesheets/tags.sass @@ -1,23 +1,38 @@ +@import "variables" + tags align-items: center display: flex flex-wrap: wrap - margin-bottom: 1em + margin-bottom: 1rem - > tag - align-items: center - display: flex + > * + margin: 0 0.25rem - > a - background-color: $secondary-accent-color - border-radius: 4px - color: $light-text-color - font-size: 0.8em - font-weight: bold - padding: 1px 7px + &:first-child + margin-left: 0 - > * - margin: 0 0.25em 0.25em 0 + > a + background-color: $secondary-accent-color + color: $light-text-color + font-size: 0.8rem + font-weight: bold + padding: 1px 7px 1px 9px + position: relative + + &:before, &:after + content: "" + position: absolute + border-right: 6px solid transparent + left: 0 + + &:before + border-top: 6px solid white + top: 0 + + &:after + border-bottom: 6px solid white + bottom: 0 > form display: flex diff --git a/app/assets/stylesheets/tunes.sass b/app/assets/stylesheets/tunes.sass index d30a8505d..063fe4d30 100644 --- a/app/assets/stylesheets/tunes.sass +++ b/app/assets/stylesheets/tunes.sass @@ -1,3 +1,5 @@ +@import "variables" + tunes display: block min-height: 100px diff --git a/app/assets/stylesheets/user.sass b/app/assets/stylesheets/user.sass index 83743bce2..52ac6f578 100644 --- a/app/assets/stylesheets/user.sass +++ b/app/assets/stylesheets/user.sass @@ -1,3 +1,5 @@ +@import "variables" + section.profile overflow: hidden diff --git a/app/assets/stylesheets/variables.sass b/app/assets/stylesheets/variables.sass index 3b05c8f4c..f1b79683e 100644 --- a/app/assets/stylesheets/variables.sass +++ b/app/assets/stylesheets/variables.sass @@ -16,3 +16,7 @@ $light-divider-color: rgba(255, 255, 255, 0.12) $item-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5) $control-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5) + +@mixin small + @media (max-width: 767px) + @content diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6ceb0d9cd..ac354746a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -21,7 +21,7 @@ def current_user def require_user unless current_user store_location - redirect_to sign_in_path, :notice => "You must be logged in to access this page" + redirect_to sign_in_path, :notice => "You must log in to access this page" return false end end @@ -29,7 +29,7 @@ def require_user def require_no_user if current_user store_location - redirect_to root_url, :notice => "You must be logged out to access this page" + redirect_to root_url, :notice => "You must log out to access this page" end end @@ -95,7 +95,11 @@ def save_sprites_to_user(user) end def store_location - session[:return_to] = request.fullpath + if request.method == "GET" + session[:return_to] = request.fullpath + else + session[:return_to]= request.referer + end end def redirect_back_or_default(default) diff --git a/app/controllers/sprites_controller.rb b/app/controllers/sprites_controller.rb index 359a39f1b..ca78d8cec 100644 --- a/app/controllers/sprites_controller.rb +++ b/app/controllers/sprites_controller.rb @@ -84,6 +84,11 @@ def index end def show + @title = sprite.display_name + @meta_description = sprite.description + @meta_keywords = sprite.tag_list.join(",") + @meta_author = sprite.creator_name + respond_with(sprite) do |format| format.json { render :json } end @@ -102,7 +107,7 @@ def destroy def update @sprite = Sprite.find(params[:id]) - @sprite.update_attributes(sprite_params) + @sprite.update(sprite_params) respond_with(@sprite) end @@ -123,7 +128,7 @@ def import @sprite = Sprite.new @sprite.user = current_user - if @sprite.update_attributes(params[:sprite]) + if @sprite.update(params[:sprite]) redirect_to @sprite else # Errors @@ -195,7 +200,8 @@ def collection items = items .order(order) .where(["sprites.created_at > '%s'", recency]) - .includes(:taggings) + .where.not(user_id: nil) + .includes(:taggings, :user) .search(params[:search]) .page(params[:page]) .per_page(per_page) @@ -204,7 +210,9 @@ def collection t.taggings_count >= 5 end - logger.info @tag_counts + @meta_keywords = @tag_counts.join(",") + @meta_author = "Various" + @meta_description = items.map(&:title).compact.join(" ") @collection = items diff --git a/app/controllers/tunes_controller.rb b/app/controllers/tunes_controller.rb index 3d52ad3d4..1e2a79fd2 100644 --- a/app/controllers/tunes_controller.rb +++ b/app/controllers/tunes_controller.rb @@ -84,7 +84,7 @@ def destroy def update @tune = Tune.find(params[:id]) - @tune.update_attributes(tune_params) + @tune.update(tune_params) respond_with(@tune) end diff --git a/app/controllers/user_sessions_controller.rb b/app/controllers/user_sessions_controller.rb index dd9875448..d047f079d 100644 --- a/app/controllers/user_sessions_controller.rb +++ b/app/controllers/user_sessions_controller.rb @@ -5,7 +5,7 @@ def new def create if params[:user_session][:login] == "yes" # Default to remember me - @user_session = UserSession.new(user_session_params.merge(:remember_me => true)) + @user_session = UserSession.new(user_session_params.to_h.merge(:remember_me => true)) @user_session.save do |result| if result new_user = @user_session.user.login_count == 1 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e83dfd085..4978158be 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -114,7 +114,9 @@ def create end def show - @title = "#{user.display_name} - PixieEngine Game Creation Toolset" + @title = user.display_name + @meta_author = user.display_name + @meta_description = user.profile if user == current_user @activity_updates = user.activity_updates @@ -125,13 +127,15 @@ def show end @sprites = Sprite.for_user(user).order("id DESC").page(params[:page]).per_page(32) + + @meta_keywords = @sprites.tag_counts.join(",") end def edit end def update - user.update_attributes(user_params) + user.update(user_params) respond_with user end @@ -167,7 +171,7 @@ def do_unsubscribe private def user_params - params[:user].permit([:avatar, :display_name, :email, :password, :profile, :favorite_color, :forum_notifications, :site_notifications, :help_tips]) + params[:user].permit([:avatar, :display_name, :email, :password, :profile, :favorite_color, :site_notifications]) end def collection diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bc664f0d0..a36c2f20a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -26,7 +26,7 @@ def markdown(text) end def tag_link(tag) - render :partial => "sprites/tag", :object => tag + link_to tag, action: :index, tagged: tag end def display_comments(commentable) diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 1fcba2344..dae5960ca 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,5 +1,7 @@ class ApplicationMailer < ActionMailer::Base - add_template_helper(ApplicationHelper) + helper ApplicationHelper + + default_url_options[:host] = ENV["HTTP_HOST"] default from: 'Pixie ' layout 'mailer' diff --git a/app/models/concerns/oauthable.rb b/app/models/concerns/oauthable.rb index 7b9fbb731..f20d88176 100644 --- a/app/models/concerns/oauthable.rb +++ b/app/models/concerns/oauthable.rb @@ -14,6 +14,6 @@ def token_for(provider) def update_oauth(provider, token) oauth_tokens .find_or_initialize_by_provider(provider) - .update_attributes(token: token) + .update(token: token) end end diff --git a/app/models/invite.rb b/app/models/invite.rb index 2500c03cd..c8b184e9d 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -3,7 +3,7 @@ class Invite < ActiveRecord::Base validates_presence_of :user, :token, :email, :to - validates_format_of :email, :with => Authlogic::Regex.email + validates_format_of :email, :with => URI::MailTo::EMAIL_REGEXP validates_format_of :to, :with => /\A[A-Za-z0-9 ]*\Z/, :message => "should have a more personalized name" after_commit on: :create do diff --git a/app/models/sprite.rb b/app/models/sprite.rb index 6102580b8..09910b905 100644 --- a/app/models/sprite.rb +++ b/app/models/sprite.rb @@ -58,6 +58,14 @@ class Sprite < ActiveRecord::Base end } + def creator_name + if user + user.display_name + else + "Anonymous" + end + end + def display_name if title.blank? "Sprite #{id}" @@ -127,10 +135,6 @@ def replay_path "#{base_path}replays/#{id}.json" end - def meta_desc - "#{tag_list.join(' ')} #{title} #{dimension_list.join(' ')} #{description}" - end - def migrate_image_attachment update_attribute(:image, File.open(file_path)) end diff --git a/app/models/uploader.rb b/app/models/uploader.rb index cc09d095e..d2d6c05b7 100644 --- a/app/models/uploader.rb +++ b/app/models/uploader.rb @@ -1,4 +1,4 @@ -require 'aws-sdk' +require "aws-sdk-s3" module Uploader def self.logger diff --git a/app/models/user.rb b/app/models/user.rb index 2c3e05323..eb80cc3bf 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,14 +1,18 @@ class User < ActiveRecord::Base validates :display_name, - :format => { :with => /\A[A-Za-z0-9_-]+\Z/ }, - :presence => true, - :uniqueness => true + format: { :with => /\A[A-Za-z0-9_-]+\Z/ }, + presence: true, + uniqueness: { case_sensitive: false }, + length: { maximum: 45 } + + validates :email, + length: { maximum: 254 }, + format: { with: URI::MailTo::EMAIL_REGEXP } acts_as_authentic do |config| - config.validate_email_field :no_connected_sites? - config.validate_password_field :no_connected_sites? + # config.validate_password_field :no_connected_sites? config.require_password_confirmation = false - config.validates_length_of_password_field_options :minimum => 4, :if => :require_password? + # config.validates_length_of_password_field_options :minimum => 4, :if => :require_password? config.transition_from_crypto_providers = [Authlogic::CryptoProviders::Sha512] config.crypto_provider = Authlogic::CryptoProviders::SCrypt @@ -23,7 +27,7 @@ class User < ActiveRecord::Base } ) - validates_attachment_content_type :avatar, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"] + validates_attachment_content_type :avatar, :content_type => [/\Aimage\/.*\Z/] include Commentable @@ -51,8 +55,6 @@ class User < ActiveRecord::Base has_many :authored_comments, :class_name => "Comment", :foreign_key => "commenter_id" - # attr_accessible :avatar, :display_name, :email, :password, :profile, :favorite_color, :forum_notifications, :site_notifications, :help_tips - scope :online_now, lambda { where("last_request_at >= ?", Time.zone.now - 15.minutes) } diff --git a/app/views/layouts/application.haml b/app/views/layouts/application.haml index 5af718bc4..3df1c92fa 100644 --- a/app/views/layouts/application.haml +++ b/app/views/layouts/application.haml @@ -1,13 +1,14 @@ %html - = render :partial => "shared/head" + = render partial: "shared/head" - body_id = @fullscreen ? "fullscreen" : nil %body(id=body_id eventCategory="Body")>< - = render :partial => "shared/header" + = render partial: "shared/header" - event_category = "#{controller.controller_name} #{controller.action_name}" %content(eventCategory=event_category)>< = yield - = render :partial => "shared/footer" + = render partial: "shared/flash" + = render partial: "shared/footer" diff --git a/app/views/notifier/forgot_password.haml b/app/views/notifier/forgot_password.haml new file mode 100644 index 000000000..335430658 --- /dev/null +++ b/app/views/notifier/forgot_password.haml @@ -0,0 +1,8 @@ +%p + A request to reset your password has been made. To reset your password click the link below: + +%p + = link_to "Reset Password", edit_password_reset_url(@user.perishable_token) + +%p + If you did not make this request you can safely ignore this email. diff --git a/app/views/notifier/forgot_password.text.haml b/app/views/notifier/forgot_password.text.haml deleted file mode 100644 index 842cd4733..000000000 --- a/app/views/notifier/forgot_password.text.haml +++ /dev/null @@ -1,8 +0,0 @@ -A request to reset your password has been made. -If you did not make this request, simply ignore this email. -If you did make this request just click the link below: - -= edit_password_reset_url(@user.perishable_token) - -If the above URL does not work try copying and pasting it into your browser. -If you continue to have problem please feel free to contact us. diff --git a/app/views/password_resets/edit.haml b/app/views/password_resets/edit.haml index 716614a25..419a53dbc 100644 --- a/app/views/password_resets/edit.haml +++ b/app/views/password_resets/edit.haml @@ -1,4 +1,4 @@ -= form_for @user, :html => { :class => "module" }, :url => password_reset_path, :method => :put do |form| += form_for @user, html: { class: "primary" }, url: password_reset_path, method: :put do |form| = form.error_messages %h1 Change Password @@ -7,4 +7,4 @@ %h3 New Password = form.password_field :password - %button.full Update my Password + %button.cta Update my Password diff --git a/app/views/password_resets/new.haml b/app/views/password_resets/new.haml index e57cea2bd..a2837c914 100644 --- a/app/views/password_resets/new.haml +++ b/app/views/password_resets/new.haml @@ -1,4 +1,4 @@ -=form_tag password_resets_path, :class => "module" do +=form_tag password_resets_path, class: "primary" do %h1 Forgot Password %p Enter your email address and instructions on how to reset your password will be mailed to you. @@ -7,4 +7,4 @@ %h3 Email = text_field_tag :email - %button.btn.full Reset my password + %button.cta Reset my password diff --git a/app/views/shared/_flashes.haml b/app/views/shared/_flash.haml similarity index 85% rename from app/views/shared/_flashes.haml rename to app/views/shared/_flash.haml index e46363cbf..a0abdd5c0 100644 --- a/app/views/shared/_flashes.haml +++ b/app/views/shared/_flash.haml @@ -1,3 +1,3 @@ -#flashes> +#flash - flash.each do |key, msg| %div{ :class => key }= msg diff --git a/app/views/shared/_footer.haml b/app/views/shared/_footer.haml index 3f6f125cc..4e7faabda 100644 --- a/app/views/shared/_footer.haml +++ b/app/views/shared/_footer.haml @@ -1,4 +1,3 @@ -%footer.navbar.navbar-fixed-bottom +%footer = render :partial => "/shared/feedback" - = render :partial => "/shared/javascripts" diff --git a/app/views/shared/_head.haml b/app/views/shared/_head.haml index 080e464bd..3d03e0c13 100644 --- a/app/views/shared/_head.haml +++ b/app/views/shared/_head.haml @@ -4,9 +4,11 @@ = @title Pixie Engine - Create! %meta{ 'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8' } - %meta{ :name => "description", :content => (@meta_desc || "This free online pixel editor is amazingly simple. Build on the work of others and share your creations, or start fresh and create something new.") } + %meta{ :name => "description", :content => (@meta_description || "This free online pixel editor is amazingly simple. Build on the work of others and share your creations, or start fresh and create something new.") } + %meta{ :name => "keywords", :content => (@meta_keywords || "online, pixel, editor, sprite, free, games") } + %meta{ :name => "author", :content => (@meta_author || "Daniel X. Moore") } - + = csrf_meta_tag = stylesheet_link_tag 'screen', :media => 'screen, projection' diff --git a/app/views/shared/_javascripts.haml b/app/views/shared/_javascripts.haml index eef179dd1..5fa70ea47 100644 --- a/app/views/shared/_javascripts.haml +++ b/app/views/shared/_javascripts.haml @@ -11,9 +11,6 @@ document.write(unescape('%3Cscript src="/assets/jquery/jquery-ui.min.js"%3E%3C/script%3E')); } -/[if lt IE 9] - = javascript_include_tag "excanvas.compiled" - :coffeescript window.railsEnv = #{Rails.env.to_json} diff --git a/app/views/sprites/_tag.haml b/app/views/sprites/_tag.haml deleted file mode 100644 index dc1eea463..000000000 --- a/app/views/sprites/_tag.haml +++ /dev/null @@ -1,2 +0,0 @@ -%tag - = link_to tag, action: :index, tagged: tag diff --git a/app/views/sprites/pixie.haml b/app/views/sprites/pixie.haml index c3d8267d4..b63ca4528 100644 --- a/app/views/sprites/pixie.haml +++ b/app/views/sprites/pixie.haml @@ -4,7 +4,7 @@ - width = @width || 64 - height = @height || 64 -%iframe#editor(src="https://danielx.net/pixel-editor/pixie3/" sandbox="allow-scripts allow-modals") +%iframe#editor(src="https://danielx.net/pixel-editor/pixie3/" sandbox="allow-scripts allow-modals allow-downloads") :sass html diff --git a/app/views/sprites/show.haml b/app/views/sprites/show.haml index 873ab6db9..e9aeeada5 100644 --- a/app/views/sprites/show.haml +++ b/app/views/sprites/show.haml @@ -1,6 +1,3 @@ -- @title = sprite.display_name -- @meta_desc = sprite.meta_desc - %section.derivation = render :partial => sprite, :locals => {link_path: load_sprite_path(sprite)} diff --git a/app/views/tunes/_tune.haml b/app/views/tunes/_tune.haml index 30eb52ece..6faacdb6a 100644 --- a/app/views/tunes/_tune.haml +++ b/app/views/tunes/_tune.haml @@ -7,9 +7,6 @@ .title= link_to tune.display_title, link_path .description= markdown tune.description .actions - %a(href="#{link_path}") - = pluralize(tune.score, "Reax") - 👍 %a(href="#{link_path}") = pluralize(tune.comments_count, "Comment") 💬 diff --git a/app/views/tunes/show.haml b/app/views/tunes/show.haml index d10eb85e8..017953880 100644 --- a/app/views/tunes/show.haml +++ b/app/views/tunes/show.haml @@ -13,6 +13,9 @@ %button(type='submit') Add Tag %actions + %a.button(href="#{editor_tune_path(tune)}") + ⬆️️ Load in Editor + - if current_user - if current_user.favorite?(tune) = button_to remove_favorite_tune_path(tune) do @@ -22,8 +25,6 @@ 💝 Add Favorite - if owner_or_admin? - %a.button(href="#{editor_tune_path(tune)}") - ⬆️️ Load in Editor %a.button(href="#{edit_tune_path(tune)}") 📝 Edit Details %a.button(href="#{tune_path(tune)}" data-method="delete") diff --git a/app/views/users/new.haml b/app/views/users/new.haml index 06a641cc7..c1e337fdc 100644 --- a/app/views/users/new.haml +++ b/app/views/users/new.haml @@ -31,9 +31,9 @@ unless newVal is val $this.val(newVal) -= form_for user, :html => { :class => "module" } do |form| += form_for user, html: { class: "primary" } do |form| = form.error_messages - %h2 Sign up for Pixie! + %h1 Sign up for Pixie! %label %h3 Display Name @@ -45,4 +45,4 @@ %h3 Password = form.password_field :password - %button.btn.full Sign Up + %button.cta Sign Up diff --git a/app/views/users/show.haml b/app/views/users/show.haml index 2f2f420b5..3eeb69aee 100644 --- a/app/views/users/show.haml +++ b/app/views/users/show.haml @@ -1,15 +1,3 @@ -- unless user.profile.blank? - - @meta_desc = user.profile.html_safe - -:sass - body > .content - padding: 0.5em 2em - padding-top: 40px - - .sprites_gallery - .header - padding-top: 0 - %section.profile>< %h1>< = user.display_name diff --git a/config/cable.yml b/config/cable.yml index 0bbde6f74..22dcab221 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -6,4 +6,4 @@ test: production: adapter: redis - url: redis://localhost:6379/1 + url: <%= ENV["REDIS_URL"] %> diff --git a/config/environments/production.rb b/config/environments/production.rb index 30a364bac..a5868ba15 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -19,7 +19,7 @@ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier + config.assets.js_compressor = nil # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. diff --git a/config/initializers/customize_errors.rb b/config/initializers/customize_errors.rb new file mode 100644 index 000000000..a21e2796c --- /dev/null +++ b/config/initializers/customize_errors.rb @@ -0,0 +1,9 @@ +ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| + class_attr_index = html_tag.index 'class="' + + if class_attr_index + html_tag.insert class_attr_index+7, 'error ' + else + html_tag.insert html_tag.index('>'), ' class="error"' + end +end diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index 671abb69a..eed4ff36f 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -18,7 +18,7 @@ Rails.application.config.active_record.belongs_to_required_by_default = true # Do not halt callback chains when a callback returns false. Previous versions had true. -ActiveSupport.halt_callback_chains_on_return_false = false +# ActiveSupport.halt_callback_chains_on_return_false = false # Configure SSL options to enable HSTS with subdomains. Previous versions had false. Rails.application.config.ssl_options = { hsts: { subdomains: true } } diff --git a/config/initializers/rails_admin.rb b/config/initializers/rails_admin.rb index 357a41ddc..416a932d7 100644 --- a/config/initializers/rails_admin.rb +++ b/config/initializers/rails_admin.rb @@ -1,4 +1,34 @@ +# citext support https://github.com/sferik/rails_admin/issues/2177 +require 'rails_admin/config/fields/base' + +module RailsAdmin + + + # Allow for searching/filtering of `citext` fields. + module Adapters + module ActiveRecord + module CitextStatement + private + + def build_statement_for_type + if @type == :citext + return build_statement_for_string_or_text + else + super + end + end + end + + class StatementBuilder < RailsAdmin::AbstractModel::StatementBuilder + prepend CitextStatement + end + end + end +end + + RailsAdmin.config do |config| + config.asset_source = :sprockets config.parent_controller = "::ApplicationController" diff --git a/config/initializers/uri_escape.rb b/config/initializers/uri_escape.rb new file mode 100644 index 000000000..b55f8f8d9 --- /dev/null +++ b/config/initializers/uri_escape.rb @@ -0,0 +1,22 @@ +require 'uri' + +# Hack since Paperclip uses URI.escape but it was removed in Ruby 3.0 +module URI + class << self + def escape(str) + alpha = "a-zA-Z" + alnum = "#{alpha}\\d" + unreserved = "\\-_.!~*'()#{alnum}" + reserved = ";/?:@&=+$,\\[\\]" + unsafe = Regexp.new("[^#{unreserved}#{reserved}]") + str.gsub(unsafe) do + us = $& + tmp = '' + us.each_byte do |uc| + tmp << sprintf('%%%02X', uc) + end + tmp + end.force_encoding(Encoding::US_ASCII) + end + end +end diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 000000000..695f17bd3 --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,7 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> diff --git a/db/migrate/20170305171646_update_users_table.rb b/db/migrate/20170305171646_update_users_table.rb new file mode 100644 index 000000000..0f80164bb --- /dev/null +++ b/db/migrate/20170305171646_update_users_table.rb @@ -0,0 +1,50 @@ +class UpdateUsersTable < ActiveRecord::Migration[5.0] + def change + enable_extension 'citext' + + User.delete([ + 9, + 10, + 98, + 757, + 842, + 1102, + 1103, + 1113, + 1194, + 1496, + 1627, + 1707, + 1745, + 3341, + 4569, + ]) + + duplicate_names = User.select("LOWER(display_name) AS disp").group("LOWER(display_name)").having("count(*) > 1").map(&:disp) + User.select("LOWER(display_name) AS disp", :id, :display_name).where(["LOWER(display_name) in (?)", duplicate_names]).group_by do |u| + u.display_name.downcase + end.map do |name, user_set| + user_set.sort_by(&:id) + end.each do |user_set| + # First guy gets to keep + user_set.shift + # Rest get a suffix + user_set.each do |user| + user.update_column(:display_name, "#{user.display_name}-#{user.id}") + end + end + + remove_column :users, "paying", :boolean, default: false, null: false + remove_column :users, "forem_admin", :boolean, default: false, null: false + remove_column :users, "forum_notifications", :booloan, default: true, null: false + remove_column :users, "help_tips", :boolean, default: true, null: false + remove_column :users, "spreedly_token", :string, limit: 255 + + change_column :users, :email, :citext, null: false + change_column :users, :display_name, :citext, null: false + + add_index :users, :email, unique: true + add_index :users, :perishable_token, unique: true + + end +end diff --git a/db/schema.rb b/db/schema.rb index 593a441de..af23e1497 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,10 +10,11 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170218165816) do +ActiveRecord::Schema.define(version: 20170305171646) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" + enable_extension "citext" create_table "activities", force: :cascade do |t| t.integer "trackable_id" @@ -183,7 +184,7 @@ end create_table "users", force: :cascade do |t| - t.string "email", limit: 255 + t.citext "email", null: false t.string "crypted_password", limit: 255 t.string "password_salt", limit: 255 t.string "persistence_token", limit: 255, null: false @@ -198,7 +199,7 @@ t.string "last_login_ip", limit: 255 t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.string "display_name", limit: 255 + t.citext "display_name", null: false t.integer "referrer_id" t.string "oauth_secret", limit: 255 t.integer "active_token_id" @@ -211,17 +212,14 @@ t.datetime "avatar_updated_at" t.boolean "subscribed", default: true, null: false t.string "favorite_color", limit: 255 - t.boolean "paying", default: false, null: false - t.boolean "forem_admin", default: false, null: false - t.boolean "forum_notifications", default: true, null: false t.boolean "site_notifications", default: true, null: false - t.boolean "help_tips", default: true, null: false - t.string "spreedly_token", limit: 255 t.datetime "last_contacted", default: '2011-12-29 01:37:27', null: false t.datetime "last_surveyed", default: '2009-12-29 02:38:45', null: false t.integer "followers_count", default: 0, null: false t.integer "following_count", default: 0, null: false t.index ["display_name"], name: "index_users_on_display_name", unique: true, using: :btree + t.index ["email"], name: "index_users_on_email", unique: true, using: :btree + t.index ["perishable_token"], name: "index_users_on_perishable_token", unique: true, using: :btree end add_foreign_key "tunes", "users" diff --git a/script/sync-db-with-prod b/script/sync-db-with-prod new file mode 100755 index 000000000..1a739ea32 --- /dev/null +++ b/script/sync-db-with-prod @@ -0,0 +1,5 @@ +#!/bin/bash + +heroku pg:backups:download +pg_restore --clean --no-owner --dbname pixie_api_development < latest.dump +rm latest.dump diff --git a/test/mailers/previews/notifier_preview.rb b/test/mailers/previews/notifier_preview.rb index 44225b450..278014223 100644 --- a/test/mailers/previews/notifier_preview.rb +++ b/test/mailers/previews/notifier_preview.rb @@ -11,4 +11,8 @@ def invite def comment Notifier.comment(Comment.last) end + + def forgot + Notifier.forgot_password(User.first) + end end