diff --git a/Gemfile b/Gemfile index 67878db08a..bd91a229af 100644 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,8 @@ gem 'mini_magick' gem 'letter_opener', group: :development gem 'aasm' gem 'figaro' -gem 'fog' +gem 'carrierwave-qiniu' +gem 'qiniu-rs' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console diff --git a/Gemfile.lock b/Gemfile.lock index 4b5aa2fbff..ca58aac1de 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,68 +1,72 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (2.3.5) aasm (4.11.1) - actioncable (5.0.0) - actionpack (= 5.0.0) + actioncable (5.0.1) + actionpack (= 5.0.1) nio4r (~> 1.2) websocket-driver (~> 0.6.1) - actionmailer (5.0.0) - actionpack (= 5.0.0) - actionview (= 5.0.0) - activejob (= 5.0.0) + actionmailer (5.0.1) + actionpack (= 5.0.1) + actionview (= 5.0.1) + activejob (= 5.0.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.0) - actionview (= 5.0.0) - activesupport (= 5.0.0) + actionpack (5.0.1) + actionview (= 5.0.1) + activesupport (= 5.0.1) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.0) - activesupport (= 5.0.0) + actionview (5.0.1) + activesupport (= 5.0.1) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (5.0.0) - activesupport (= 5.0.0) + activejob (5.0.1) + activesupport (= 5.0.1) globalid (>= 0.3.6) - activemodel (5.0.0) - activesupport (= 5.0.0) - activerecord (5.0.0) - activemodel (= 5.0.0) - activesupport (= 5.0.0) + 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.0) + activesupport (5.0.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.5.0) public_suffix (~> 2.0, >= 2.0.2) - arel (7.1.1) - autoprefixer-rails (6.7.2) + arel (7.1.4) + autoprefixer-rails (6.7.5) execjs bcrypt (3.1.11) bootstrap-sass (3.3.7) autoprefixer-rails (>= 5.2.1) sass (>= 3.3.4) - builder (3.2.2) - byebug (9.0.5) - carrierwave (1.0.0) - activemodel (>= 4.0.0) - activesupport (>= 4.0.0) + builder (3.2.3) + byebug (9.0.6) + carrierwave (0.11.2) + activemodel (>= 3.2.0) + activesupport (>= 3.2.0) + json (>= 1.7) mime-types (>= 1.16) + mimemagic (>= 0.3.0) + carrierwave-qiniu (1.0.1) + carrierwave (~> 0) + qiniu (~> 6.8, >= 6.8.0) coffee-rails (4.2.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.2.x) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.10.0) - concurrent-ruby (1.0.2) + coffee-script-source (1.12.2) + concurrent-ruby (1.0.4) debug_inspector (0.0.2) devise (4.2.0) bcrypt (~> 3.0) @@ -70,155 +74,28 @@ GEM railties (>= 4.1.0, < 5.1) responders warden (~> 1.2.3) + domain_name (0.5.20170223) + unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) - excon (0.55.0) execjs (2.7.0) - ffi (1.9.14) + ffi (1.9.17) figaro (1.1.1) thor (~> 0.14) - fission (0.5.0) - CFPropertyList (~> 2.2) - fog (1.38.0) - fog-aliyun (>= 0.1.0) - fog-atmos - fog-aws (>= 0.6.0) - fog-brightbox (~> 0.4) - fog-cloudatcost (~> 0.1.0) - fog-core (~> 1.32) - fog-dynect (~> 0.0.2) - fog-ecloud (~> 0.1) - fog-google (<= 0.1.0) - fog-json - fog-local - fog-openstack - fog-powerdns (>= 0.1.1) - fog-profitbricks - fog-rackspace - fog-radosgw (>= 0.0.2) - fog-riakcs - fog-sakuracloud (>= 0.0.4) - fog-serverlove - fog-softlayer - fog-storm_on_demand - fog-terremark - fog-vmfusion - fog-voxel - fog-vsphere (>= 0.4.0) - fog-xenserver - fog-xml (~> 0.1.1) - ipaddress (~> 0.5) - fog-aliyun (0.1.0) - fog-core (~> 1.27) - fog-json (~> 1.0) - ipaddress (~> 0.8) - xml-simple (~> 1.1) - fog-atmos (0.1.0) - fog-core - fog-xml - fog-aws (1.2.0) - fog-core (~> 1.38) - fog-json (~> 1.0) - fog-xml (~> 0.1) - ipaddress (~> 0.8) - fog-brightbox (0.11.0) - fog-core (~> 1.22) - fog-json - inflecto (~> 0.0.2) - fog-cloudatcost (0.1.2) - fog-core (~> 1.36) - fog-json (~> 1.0) - fog-xml (~> 0.1) - ipaddress (~> 0.8) - fog-core (1.43.0) - builder - excon (~> 0.49) - formatador (~> 0.2) - fog-dynect (0.0.3) - fog-core - fog-json - fog-xml - fog-ecloud (0.3.0) - fog-core - fog-xml - fog-google (0.1.0) - fog-core - fog-json - fog-xml - fog-json (1.0.2) - fog-core (~> 1.0) - multi_json (~> 1.10) - fog-local (0.3.1) - fog-core (~> 1.27) - fog-openstack (0.1.19) - fog-core (>= 1.40) - fog-json (>= 1.0) - ipaddress (>= 0.8) - fog-powerdns (0.1.1) - fog-core (~> 1.27) - fog-json (~> 1.0) - fog-xml (~> 0.1) - fog-profitbricks (3.0.0) - fog-core (~> 1.42) - fog-json (~> 1.0) - fog-rackspace (0.1.4) - fog-core (>= 1.35) - fog-json (>= 1.0) - fog-xml (>= 0.1) - ipaddress (>= 0.8) - fog-radosgw (0.0.5) - fog-core (>= 1.21.0) - fog-json - fog-xml (>= 0.0.1) - fog-riakcs (0.1.0) - fog-core - fog-json - fog-xml - fog-sakuracloud (1.7.5) - fog-core - fog-json - fog-serverlove (0.1.2) - fog-core - fog-json - fog-softlayer (1.1.4) - fog-core - fog-json - fog-storm_on_demand (0.1.1) - fog-core - fog-json - fog-terremark (0.1.0) - fog-core - fog-xml - fog-vmfusion (0.1.0) - fission - fog-core - fog-voxel (0.1.0) - fog-core - fog-xml - fog-vsphere (1.7.0) - fog-core - rbvmomi (~> 1.9) - fog-xenserver (0.2.3) - fog-core - fog-xml - fog-xml (0.1.2) - fog-core - nokogiri (~> 1.5, >= 1.5.11) font-awesome-rails (4.7.0.1) railties (>= 3.2, < 5.1) - formatador (0.2.5) globalid (0.3.7) activesupport (>= 4.1.0) - i18n (0.7.0) - inflecto (0.0.2) - ipaddress (0.8.3) - jbuilder (2.6.0) - activesupport (>= 3.0.0, < 5.1) + http-cookie (1.0.3) + domain_name (~> 0.5) + i18n (0.8.1) + jbuilder (2.6.3) + activesupport (>= 3.0.0, < 5.2) multi_json (~> 1.2) - jquery-rails (4.1.1) + jquery-rails (4.2.2) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.0.3) + json (1.8.6) launchy (2.4.3) addressable (~> 2.3) letter_opener (1.4.1) @@ -231,60 +108,67 @@ GEM mail (2.6.4) mime-types (>= 1.16, < 4) method_source (0.8.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_magick (4.6.0) + mime-types (2.99.3) + mimemagic (0.3.2) + mini_magick (4.6.1) mini_portile2 (2.1.0) - minitest (5.9.0) + minitest (5.10.1) multi_json (1.12.1) + netrc (0.11.0) nio4r (1.2.1) - nokogiri (1.6.8) + nokogiri (1.7.0.1) mini_portile2 (~> 2.1.0) - pkg-config (~> 1.1.7) orm_adapter (0.5.0) pg (0.19.0) - pkg-config (1.1.7) public_suffix (2.0.5) - puma (3.6.0) + puma (3.7.1) + qiniu (6.8.1) + json (~> 1.8) + mime-types (~> 2.4, >= 2.4.0) + rest-client (~> 2.0, >= 2.0.0) + ruby-hmac (~> 0.4) + qiniu-rs (1.1.0) + json + mime-types + rest-client rack (2.0.1) rack-test (0.6.3) rack (>= 1.0) - rails (5.0.0) - actioncable (= 5.0.0) - actionmailer (= 5.0.0) - actionpack (= 5.0.0) - actionview (= 5.0.0) - activejob (= 5.0.0) - activemodel (= 5.0.0) - activerecord (= 5.0.0) - activesupport (= 5.0.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.0) + railties (= 5.0.1) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.1) + rails-dom-testing (2.0.2) activesupport (>= 4.2.0, < 6.0) - nokogiri (~> 1.6.0) + nokogiri (~> 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (5.0.0) - actionpack (= 5.0.0) - activesupport (= 5.0.0) + railties (5.0.1) + actionpack (= 5.0.1) + activesupport (= 5.0.1) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (11.2.2) - rb-fsevent (0.9.7) - rb-inotify (0.9.7) + rake (12.0.0) + rb-fsevent (0.9.8) + rb-inotify (0.9.8) ffi (>= 0.5.0) - rbvmomi (1.9.4) - builder (~> 3.2) - json (>= 1.8) - nokogiri (~> 1.5) - trollop (~> 2.1) responders (2.3.0) railties (>= 4.2.0, < 5.1) - sass (3.4.22) + rest-client (2.0.1) + http-cookie (>= 1.0.2, < 2.0) + mime-types (>= 1.16, < 4.0) + netrc (~> 0.8) + ruby-hmac (0.4.0) + sass (3.4.23) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) @@ -294,36 +178,37 @@ GEM simple_form (3.4.0) actionpack (> 4, < 5.1) activemodel (> 4, < 5.1) - sprockets (3.7.0) + sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.1.1) + sprockets-rails (3.2.0) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.11) - thor (0.19.1) - thread_safe (0.3.5) - tilt (2.0.5) - trollop (2.1.2) - turbolinks (5.0.0) + sqlite3 (1.3.13) + thor (0.19.4) + thread_safe (0.3.6) + tilt (2.0.6) + turbolinks (5.0.1) turbolinks-source (~> 5) turbolinks-source (5.0.0) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (3.0.1) + uglifier (3.0.4) execjs (>= 0.3.0, < 3) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.2) warden (1.2.7) rack (>= 1.0) - web-console (3.3.1) + web-console (3.4.0) actionview (>= 5.0) activemodel (>= 5.0) debug_inspector railties (>= 5.0) - websocket-driver (0.6.4) + websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) - xml-simple (1.1.5) PLATFORMS ruby @@ -333,10 +218,10 @@ DEPENDENCIES bootstrap-sass byebug carrierwave + carrierwave-qiniu coffee-rails (~> 4.2) devise figaro - fog font-awesome-rails jbuilder (~> 2.5) jquery-rails @@ -345,6 +230,7 @@ DEPENDENCIES mini_magick pg puma (~> 3.0) + qiniu-rs rails (~> 5.0.0) sass-rails (~> 5.0) simple_form diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index ceee63822c..743e255353 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -15,4 +15,5 @@ //= require turbolinks //= require bootstrap/alert //= require bootstrap/dropdown +//= require bootstrap/modal //= require_tree . diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 08eb98d989..4302067aeb 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -16,14 +16,19 @@ // 导航一栏 +// navbar颜色问题修复 +#NavCol { +background-color: #2d2d30; +} + /* Add a dark background color with a little bit see-through */ .navbar { margin-bottom: 0; background-color: #2d2d30; border: 0; font-size: 11px !important; - letter-spacing: 4px; - opacity:0.9; + letter-spacing: 1px; + opacity:0.65; } /* Add a gray color to all navbar links */ @@ -70,10 +75,39 @@ margin: auto; } -.carousel-caption h3 { +/*.carousel-caption { + font-family: SimSun, STFangSong; + color: #fff !important; +} +*/ + +.carousel-caption h2 { + font-weight:bold; + color: #fff !important; + font-size: 40px !important; + font-family: STFangSong !important; +} + +.carousel-caption p { color: #fff !important; + font-size: 20px !important; + font-family: STFangSong !important; } +p.tip span { + //font-weight:bold; + font-family: STFangSong !important; + font-size: 200% !important; + } + +h2.tip span { + //font-weight:bold; + font-family: STFangSong !important; + font-size: 200% !important; + } + + + @media (max-width: 600px) { .carousel-caption { display: none; /* 这三段语句,没起到黑白化图片作用?要再实验.Hide the carousel text when the screen is less than 600 pixels wide */ @@ -86,10 +120,10 @@ .person { border: 10px solid transparent; - margin-bottom: 25px; - width: 80%; /*这两段 person开头的,是用来切换图片用的*/ - height: 80%; - opacity: 0.7; + margin-bottom: 50px; + width: 70%; /*这两段 person开头的,是用来切换图片用的*/ + height: 70%; + opacity: 0.8; } .person:hover { border-color: #f1f1f1; @@ -148,3 +182,103 @@ @import "bootstrap-sprockets"; @import "bootstrap"; @import "font-awesome"; + + + @import url(http://fonts.googleapis.com/css?family=Roboto); + + /****** LOGIN MODAL ******/ + .loginmodal-container { + padding: 30px; + max-width: 350px; + width: 100% !important; + background-color: #F7F7F7; + margin: 0 auto; + border-radius: 2px; + box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3); + overflow: hidden; + font-family: roboto; + background-image: url(http://www.rizi168.com/upload/img/94KOjY5JmIWw3hfPpivZJJDiM91It-tBq3Y0VX4CEREFFM7sODohe1OQJJLL7C-VK/GSFAacnMZnUlV1olJ0EoIp.jpg); + background-size: cover; + } + + .loginmodal-container h1 { + text-align: center; + font-size: 1.8em; + font-family: roboto; + } + + .loginmodal-container input[type=submit] { + width: 100%; + display: block; + margin-bottom: 10px; + position: relative; + } + + .loginmodal-container input[type=text], input[type=password] { + height: 44px; + font-size: 16px; + width: 100%; + margin-bottom: 10px; + -webkit-appearance: none; + background: #fff; + border: 1px solid #d9d9d9; + border-top: 1px solid #c0c0c0; + /* border-radius: 2px; */ + padding: 0 8px; + box-sizing: border-box; + -moz-box-sizing: border-box; + } + + .loginmodal-container input[type=text]:hover, input[type=password]:hover { + border: 1px solid #b9b9b9; + border-top: 1px solid #a0a0a0; + -moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); + -webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); + box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); + } + + .loginmodal { + text-align: center; + font-size: 14px; + font-family: 'Arial', sans-serif; + font-weight: 700; + height: 36px; + padding: 0 8px; + /* border-radius: 3px; */ + /* -webkit-user-select: none; + user-select: none; */ + } + + .loginmodal-submit { + /* border: 1px solid #3079ed; */ + border: 0px; + color: #fff; + text-shadow: 0 1px rgba(0,0,0,0.1); + background-color: #4d90fe; + padding: 17px 0px; + font-family: roboto; + font-size: 14px; + /* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#4787ed)); */ + } + + .loginmodal-submit:hover { + /* border: 1px solid #2f5bb7; */ + border: 0px; + text-shadow: 0 1px rgba(0,0,0,0.3); + background-color: #357ae8; + /* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#357ae8)); */ + } + + .loginmodal-container a { + text-decoration: none; + color: #666; + font-weight: 400; + text-align: center; + display: inline-block; + opacity: 0.6; + transition: opacity ease 0.5s; + } + + .login-help{ + font-size: 12px; + } diff --git a/app/controllers/admin/products_controller.rb b/app/controllers/admin/products_controller.rb index 99a9e6c3d4..e9d02cc79b 100644 --- a/app/controllers/admin/products_controller.rb +++ b/app/controllers/admin/products_controller.rb @@ -1,5 +1,4 @@ class Admin::ProductsController < ApplicationController - layout "admin" before_action :authenticate_user! diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb new file mode 100644 index 0000000000..1126e23aaa --- /dev/null +++ b/app/controllers/users/confirmations_controller.rb @@ -0,0 +1,28 @@ +class Users::ConfirmationsController < Devise::ConfirmationsController + # GET /resource/confirmation/new + # def new + # super + # end + + # POST /resource/confirmation + # def create + # super + # end + + # GET /resource/confirmation?confirmation_token=abcdef + # def show + # super + # end + + # protected + + # The path used after resending confirmation instructions. + # def after_resending_confirmation_instructions_path_for(resource_name) + # super(resource_name) + # end + + # The path used after confirmation. + # def after_confirmation_path_for(resource_name, resource) + # super(resource_name, resource) + # end +end diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb new file mode 100644 index 0000000000..1907e5b1b6 --- /dev/null +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -0,0 +1,28 @@ +class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController + # You should configure your model like this: + # devise :omniauthable, omniauth_providers: [:twitter] + + # You should also create an action method in this controller like this: + # def twitter + # end + + # More info at: + # https://github.com/plataformatec/devise#omniauth + + # GET|POST /resource/auth/twitter + # def passthru + # super + # end + + # GET|POST /users/auth/twitter/callback + # def failure + # super + # end + + # protected + + # The path used when OmniAuth fails + # def after_omniauth_failure_path_for(scope) + # super(scope) + # end +end diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb new file mode 100644 index 0000000000..53cc34e39e --- /dev/null +++ b/app/controllers/users/passwords_controller.rb @@ -0,0 +1,32 @@ +class Users::PasswordsController < Devise::PasswordsController + # GET /resource/password/new + # def new + # super + # end + + # POST /resource/password + # def create + # super + # end + + # GET /resource/password/edit?reset_password_token=abcdef + # def edit + # super + # end + + # PUT /resource/password + # def update + # super + # end + + # protected + + # def after_resetting_password_path_for(resource) + # super(resource) + # end + + # The path used after sending reset password instructions + # def after_sending_reset_password_instructions_path_for(resource_name) + # super(resource_name) + # end +end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb new file mode 100644 index 0000000000..a6c8824e85 --- /dev/null +++ b/app/controllers/users/registrations_controller.rb @@ -0,0 +1,60 @@ +class Users::RegistrationsController < Devise::RegistrationsController +# before_action :configure_sign_up_params, only: [:create] +# before_action :configure_account_update_params, only: [:update] + + # GET /resource/sign_up + # def new + # super + # end + + # POST /resource + # def create + # super + # end + + # GET /resource/edit + # def edit + # super + # end + + # PUT /resource + # def update + # super + # end + + # DELETE /resource + # def destroy + # super + # end + + # GET /resource/cancel + # Forces the session data which is usually expired after sign + # in to be expired now. This is useful if the user wants to + # cancel oauth signing in/up in the middle of the process, + # removing all OAuth session data. + # def cancel + # super + # end + + # protected + + # If you have extra params to permit, append them to the sanitizer. + # def configure_sign_up_params + # devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute]) + # end + + # If you have extra params to permit, append them to the sanitizer. + # def configure_account_update_params + # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute]) + # end + + # The path used after sign up. + # def after_sign_up_path_for(resource) + # super(resource) + # end + + # The path used after sign up for inactive accounts. + # def after_inactive_sign_up_path_for(resource) + # super(resource) + # end +end diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb new file mode 100644 index 0000000000..753ab7afa4 --- /dev/null +++ b/app/controllers/users/sessions_controller.rb @@ -0,0 +1,25 @@ +class Users::SessionsController < Devise::SessionsController +# before_action :configure_sign_in_params, only: [:create] + + # GET /resource/sign_in + # def new + # super + # end + + # POST /resource/sign_in + # def create + # super + # end + + # DELETE /resource/sign_out + # def destroy + # super + # end + + # protected + + # If you have extra params to permit, append them to the sanitizer. + # def configure_sign_in_params + # devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute]) + # end +end diff --git a/app/controllers/users/unlocks_controller.rb b/app/controllers/users/unlocks_controller.rb new file mode 100644 index 0000000000..8b9ef86121 --- /dev/null +++ b/app/controllers/users/unlocks_controller.rb @@ -0,0 +1,28 @@ +class Users::UnlocksController < Devise::UnlocksController + # GET /resource/unlock/new + # def new + # super + # end + + # POST /resource/unlock + # def create + # super + # end + + # GET /resource/unlock?unlock_token=abcdef + # def show + # super + # end + + # protected + + # The path used after sending unlock password instructions + # def after_sending_unlock_instructions_path_for(resource) + # super(resource) + # end + + # The path used after unlocking the resource + # def after_unlock_path_for(resource) + # super(resource) + # end +end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index faf887bad6..9ea72c6055 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -1,3 +1,3 @@ class WelcomeController < ApplicationController - + layout 'welcome' end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be7945c..03001a1953 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,17 @@ module ApplicationHelper + def resource_name + :user + end + + def resource + @resource ||= User.new + end + + def resource_class + User + end + + def devise_mapping + @devise_mapping ||= Devise.mappings[:user] + end end diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb index 0cda920018..0e4b5d3c9b 100644 --- a/app/uploaders/image_uploader.rb +++ b/app/uploaders/image_uploader.rb @@ -7,7 +7,7 @@ class ImageUploader < CarrierWave::Uploader::Base # Choose what kind of storage to use for this uploader: # storage :file # storage :fog - + storage :qiniu # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: def store_dir diff --git a/app/views/carts/index.html.erb b/app/views/carts/index.html.erb index 7155fe1a34..84251ff99e 100644 --- a/app/views/carts/index.html.erb +++ b/app/views/carts/index.html.erb @@ -1,74 +1,108 @@ -
| 商品资讯 | -单价 | -数量 | -操作选项 | -|
|---|---|---|---|---|
|
+
+
+
+
+
+
+
+ Product
+
+
+ Price
+
+
+ Quantity
+
+
+ Opeation
+
+
+ <% current_cart.cart_items.each do |cart_item| %>
+
+
<%= link_to product_path(cart_item.product) do %>
<% if cart_item.product.image.present? %>
- <%= image_tag(cart_item.product.image.thumb.url, class: "thumbnail") %>
+ <%= image_tag(cart_item.product.image.small.url) %>
<% else %>
<%= image_tag("http://placehold.it/200x200&text=No Pic", class: "thumbnail") %>
<% end %>
<% end %>
- |
- - <%= link_to(cart_item.product.title, product_path(cart_item.product)) %> - | -- <%= cart_item.product.price %> - | -
+
+
+
+
+ <%= link_to(cart_item.product.title, product_path(cart_item.product)) %>
+
+
+
+ + + $ <%= cart_item.product.price %> ++
<% cart_item = current_cart.cart_items.find_by(product_id: cart_item.product_id) %>
- <%= form_for cart_item, url: cart_item_path(cart_item.product_id) do |f| %>
- <%= f.select :quantity, 1..cart_item.product.quantity %>
- <%= f.submit "更新", data: { disable_with: "Submiting..." } %>
- <% end %>
- |
-
- <%= link_to cart_item_path(cart_item.product_id), method: :delete do %>
+ <%= form_for cart_item, url: cart_item_path(cart_item.product_id) do |f| %>
+ <%= f.select :quantity, 1..cart_item.product.quantity %>
+ <%= f.submit "Update", :class => 'btn btn-xs btn-primary', data: { disable_with: "Submiting..." } %>
+ <% end %>
+
+
+ <%= link_to cart_item_path(cart_item.product_id), class: "cart-delete-item", method: :delete do %>
<% end %>
- |
-