Remove unused giveaways code (#4989) [deploy]
This commit is contained in:
parent
ac8865b92b
commit
247833a952
3 changed files with 0 additions and 139 deletions
|
|
@ -1,89 +0,0 @@
|
|||
class GiveawaysController < ApplicationController
|
||||
def new
|
||||
@user = current_user
|
||||
@errors = []
|
||||
end
|
||||
|
||||
def update
|
||||
prevent_request_if_requested_twice
|
||||
@user = current_user
|
||||
@user.assign_attributes(user_params)
|
||||
@errors = []
|
||||
confirm_presence
|
||||
respond_to do |format|
|
||||
if @invalid_form
|
||||
render :edit
|
||||
return
|
||||
end
|
||||
|
||||
now = Time.current
|
||||
@user.onboarding_package_requested_again = true if @user.onboarding_package_requested
|
||||
@user.onboarding_package_requested = true
|
||||
@user.onboarding_package_form_submmitted_at = now
|
||||
@user.personal_data_updated_at = now
|
||||
@user.shipping_validated_at = now if user_params[:shipping_validated] == "1"
|
||||
if @user.save!
|
||||
format.html { redirect_to "/freestickers/edit" }
|
||||
format.json { render :show, status: :ok, location: @user }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @user.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Never trust parameters from the scary internet, only allow a subset to go through.
|
||||
def user_params
|
||||
accessible = %i[
|
||||
email
|
||||
shipping_name
|
||||
shipping_company
|
||||
shipping_address
|
||||
shipping_address_line_2
|
||||
shipping_city
|
||||
shipping_state
|
||||
shipping_country
|
||||
shipping_postal_code
|
||||
shipping_validated
|
||||
top_languages
|
||||
experience_level
|
||||
specialty
|
||||
tabs_or_spaces
|
||||
onboarding_package_requested
|
||||
onboarding_package_form_submmitted_at
|
||||
personal_data_updated_at
|
||||
shirt_size
|
||||
shirt_gender
|
||||
]
|
||||
params.require(:user).permit(accessible)
|
||||
end
|
||||
|
||||
def confirm_presence
|
||||
if user_params[:shipping_name].blank?
|
||||
@errors << "You need a shipping name"
|
||||
@invalid_form = true
|
||||
end
|
||||
if user_params[:shipping_address].blank?
|
||||
@errors << "You need a shipping address"
|
||||
@invalid_form = true
|
||||
end
|
||||
if user_params[:shipping_city].blank?
|
||||
@errors << "You need a shipping city"
|
||||
@invalid_form = true
|
||||
end
|
||||
if user_params[:shipping_country].blank?
|
||||
@errors << "You need a shipping country"
|
||||
@invalid_form = true
|
||||
end
|
||||
return if user_params[:top_languages].present?
|
||||
|
||||
@errors << "You need to include your favorite languages. It's a spam filter."
|
||||
@invalid_form = true
|
||||
end
|
||||
|
||||
def prevent_request_if_requested_twice
|
||||
return if current_user.onboarding_package_requested_again
|
||||
end
|
||||
end
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<% title "FREE STICKERS - dev.to" %>
|
||||
|
||||
<%= content_for :page_meta do %>
|
||||
<link rel="canonical" href="https://dev.to/freestickers" />
|
||||
<meta name="description" content="Free dev stickers!">
|
||||
<meta name="keywords" content="software development,engineering,rails,javascript,ruby">
|
||||
|
||||
<meta property="og:type" content="site" />
|
||||
<meta property="og:url" content="https://dev.to/freestickers" />
|
||||
<meta property="og:title" content="Free Sticker Giveaway by The Practical Dev" />
|
||||
<meta property="og:description" content="Every developer gets free stickers!" />
|
||||
<meta property="og:site_name" content="The Practical Dev" />
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:site" content="@<%= ApplicationConfig["SITE_TWITTER_HANDLE"] %>">
|
||||
<meta name="twitter:title" content="FREE STICKERS - dev.to">
|
||||
<meta name="twitter:description" content="Every developer gets free stickers!">
|
||||
<meta property="og:image" content="https://res.cloudinary.com/practicaldev/image/upload/c_scale,f_auto,fl_progressive,q_80,w_1000/v1487774090/stickers_e0antp.png" />
|
||||
<meta name="twitter:image:src" content="https://res.cloudinary.com/practicaldev/image/upload/c_scale,f_auto,fl_progressive,q_80,w_1000/v1487774090/stickers_e0antp.png">
|
||||
|
||||
<% end %>
|
||||
|
||||
<style>
|
||||
<% cache("giveaways-page-cache", expires_in: 30.minutes) do %>
|
||||
<%= Rails.application.assets["giveaways.css"].to_s.html_safe %>
|
||||
<% end %>
|
||||
</style>
|
||||
|
||||
<div class="giveaway-header" style="background-image:url(https://res.cloudinary.com/practicaldev/image/upload/c_scale,f_auto,fl_progressive,q_80,w_1000/v1487774090/stickers_e0antp.png)">
|
||||
</div>
|
||||
<div class="giveaway-container">
|
||||
<center>
|
||||
<p>* * *</p>
|
||||
<h2>
|
||||
Thank you for the support!
|
||||
</h2>
|
||||
<p>
|
||||
After six months and 100,000 stickers, dev.to's sticker give-away campaign is officially over. If you got here a little late, we promise that we'll be running more events like this in the future, so you will have a chance to get your hands on some DEV gear.
|
||||
</p>
|
||||
<p>If you're curious about how exactly all those stickers made it from our office to the far corners of the world, we did
|
||||
<a href="https://dev.to/thepracticaldev/sending-100-thousand-stickers">a write-up of the process</a>.</p>
|
||||
<p>And if you already requested stickers and didn't get any,
|
||||
<a href="/freestickers/edit">click here to revalidate your address</a> so we can send you some more.</p>
|
||||
<p>
|
||||
❤️<br />
|
||||
Ben & Jess
|
||||
</p>
|
||||
</center>
|
||||
</div>
|
||||
|
|
@ -160,7 +160,6 @@ Rails.application.routes.draw do
|
|||
resources :organizations, only: %i[update create]
|
||||
resources :followed_articles, only: [:index]
|
||||
resources :follows, only: %i[show create update]
|
||||
resources :giveaways, only: %i[new edit update]
|
||||
resources :image_uploads, only: [:create]
|
||||
resources :blocks
|
||||
resources :notifications, only: [:index]
|
||||
|
|
@ -286,7 +285,6 @@ Rails.application.routes.draw do
|
|||
post "articles/preview" => "articles#preview"
|
||||
post "comments/preview" => "comments#preview"
|
||||
get "/stories/warm_comments/:username/:slug" => "stories#warm_comments"
|
||||
get "/freestickers" => "giveaways#new"
|
||||
get "/shop", to: redirect("https://shop.dev.to/")
|
||||
get "/mod" => "moderations#index", :as => :mod
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue