forked from OpenNeo/impress
yum, new campaigns
This commit is contained in:
parent
6682bf2d3b
commit
5d2c226357
21 changed files with 134 additions and 84 deletions
BIN
app/assets/images/campaigns/bird.gif
Normal file
BIN
app/assets/images/campaigns/bird.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
BIN
app/assets/images/campaigns/hug.gif
Normal file
BIN
app/assets/images/campaigns/hug.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
2
app/assets/javascripts/campaigns.js
Normal file
2
app/assets/javascripts/campaigns.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -1,7 +1,7 @@
|
|||
@import "partials/icon"
|
||||
@import url(http://fonts.googleapis.com/css?family=Droid+Sans:400,700)
|
||||
@import url(http://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic)
|
||||
@import url(http://fonts.googleapis.com/css?family=Calligraffitti)
|
||||
@import url(//fonts.googleapis.com/css?family=Droid+Sans:400,700)
|
||||
@import url(//fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic)
|
||||
@import url(//fonts.googleapis.com/css?family=Calligraffitti)
|
||||
|
||||
/* Reset
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
@import partials/jquery.jgrowl
|
||||
|
||||
@import broken_image_reports/new
|
||||
@import campaigns/show
|
||||
@import closet_hangers/index
|
||||
@import closet_hangers/petpage
|
||||
@import closet_lists/form
|
||||
|
@ -25,7 +26,6 @@
|
|||
@import outfits/new
|
||||
@import outfits/show
|
||||
@import pets/bulk
|
||||
@import static/donate
|
||||
@import static/image_mode
|
||||
@import static/terms
|
||||
@import swf_assets/links
|
||||
|
|
3
app/assets/stylesheets/campaigns.css.scss
Normal file
3
app/assets/stylesheets/campaigns.css.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the campaigns controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -1,6 +1,7 @@
|
|||
@import "compass/css3/text-shadow"
|
||||
|
||||
@import "partials/campaign-progress"
|
||||
@import "partials/outfit"
|
||||
|
||||
/* TODO: redundant with outfits/index; why is it not in the partial? */
|
||||
$outfit-inner-height: 150px
|
||||
|
@ -9,25 +10,46 @@ $outfit-banner-h-padding: 4px
|
|||
$outfit-banner-v-padding: 2px
|
||||
$outfit-banner-inner-width: $outfit-inner-width - (2 * $outfit-banner-h-padding)
|
||||
|
||||
body.static-donate
|
||||
body.campaigns-show, body.campaigns-current
|
||||
+campaign-progress
|
||||
color: #004
|
||||
|
||||
a
|
||||
color: #004 + #222
|
||||
|
||||
#userbar, #footer
|
||||
color: $text-color
|
||||
a
|
||||
color: $link-color
|
||||
|
||||
#home-link
|
||||
color: $link-color
|
||||
|
||||
#title
|
||||
display: none
|
||||
|
||||
#donation-form
|
||||
+module
|
||||
|
||||
background:
|
||||
image: url(http://images.neopets.com/new_shopkeepers/t_993.gif)
|
||||
position: ($container-width - 150px - 8px) -4px
|
||||
repeat: no-repeat
|
||||
background: $campaign-background-color
|
||||
border-color: $campaign-border-color
|
||||
margin-top: 1em
|
||||
margin-bottom: 1.5em
|
||||
padding-bottom: 32px
|
||||
padding-left: 24px
|
||||
padding-top: 32px
|
||||
|
||||
&[data-campaign-theme="hug"]
|
||||
background:
|
||||
image: url(image_path("campaigns/hug.gif"))
|
||||
position: ($container-width - 150px - 8px) -4px
|
||||
repeat: no-repeat
|
||||
|
||||
&[data-campaign-theme="bird"]
|
||||
background:
|
||||
image: url(image_path("campaigns/bird.gif"))
|
||||
position: ($container-width - 150px - 8px) -4px
|
||||
repeat: no-repeat
|
||||
|
||||
header, div
|
||||
+inline-block
|
||||
|
||||
|
@ -50,6 +72,8 @@ body.static-donate
|
|||
margin-top: .5em
|
||||
|
||||
input[type=text]
|
||||
border-color: #cce
|
||||
color: #004
|
||||
width: 3em
|
||||
|
||||
button
|
||||
|
@ -101,6 +125,11 @@ body.static-donate
|
|||
line-height: 1.5
|
||||
vertical-align: middle
|
||||
|
||||
#last-years-donors
|
||||
font-weight: bold
|
||||
margin-top: 1em
|
||||
text-align: center
|
||||
|
||||
#fine-print
|
||||
font-size: 85%
|
||||
margin-top: 2em
|
|
@ -1,10 +1,13 @@
|
|||
$campaign-border-color: #006
|
||||
$campaign-background-color: #eef
|
||||
|
||||
=campaign-progress
|
||||
.campaign-progress-wrapper
|
||||
+border-radius(8px)
|
||||
background: desaturate(lighten($module-border-color, 30%), 85%)
|
||||
background-image: linear-gradient(color-stops(desaturate(lighten($module-border-color, 50%), 85%), desaturate(lighten($module-border-color, 30%), 85%)))
|
||||
background: desaturate(lighten($campaign-border-color, 30%), 85%)
|
||||
background-image: linear-gradient(color-stops(desaturate(lighten($campaign-border-color, 50%), 85%), desaturate(lighten($campaign-border-color, 30%), 85%)))
|
||||
|
||||
border: 4px solid $module-border-color
|
||||
border: 4px solid $campaign-border-color
|
||||
clear: both
|
||||
margin-bottom: 1em
|
||||
margin-top: .5em
|
||||
|
@ -18,9 +21,9 @@
|
|||
padding: .25em .75em
|
||||
|
||||
.campaign-progress
|
||||
background: $module-border-color
|
||||
background-image: linear-gradient(color-stops($module-border-color + #222, $module-border-color))
|
||||
border-right: 1px solid $module-border-color
|
||||
background: $campaign-border-color
|
||||
background-image: linear-gradient(color-stops($campaign-border-color + #222, $campaign-border-color))
|
||||
border-right: 1px solid $campaign-border-color
|
||||
|
||||
.campaign-progress-wrapper, .campaign-progress
|
||||
height: 2.5em
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
@import "outfits/star"
|
||||
|
||||
=outfit
|
||||
+inline-block
|
||||
+outfit-star
|
||||
|
|
20
app/controllers/campaigns_controller.rb
Normal file
20
app/controllers/campaigns_controller.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
class CampaignsController < ApplicationController
|
||||
def show
|
||||
@campaign = Campaign.find(params[:id])
|
||||
redirect_to(action: :current) if @campaign.active?
|
||||
@donations = find_donations
|
||||
end
|
||||
|
||||
def current
|
||||
@campaign = Campaign.current
|
||||
@donations = find_donations
|
||||
render action: :show
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_donations
|
||||
@donations = @campaign.donations.includes(features: :outfit).
|
||||
order('created_at DESC')
|
||||
end
|
||||
end
|
|
@ -1,7 +1,2 @@
|
|||
class StaticController < ApplicationController
|
||||
def donate
|
||||
@campaign = Campaign.current
|
||||
@donations = @campaign.donations.includes(features: :outfit).
|
||||
order('created_at DESC')
|
||||
end
|
||||
end
|
||||
|
|
2
app/helpers/campaigns_helper.rb
Normal file
2
app/helpers/campaigns_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module CampaignsHelper
|
||||
end
|
|
@ -3,12 +3,13 @@
|
|||
- if @campaign.progress > 0
|
||||
= campaign_progress(@campaign) do
|
||||
We've received #{number_to_currency(@campaign.progress / 100.0)}
|
||||
toward our hosting costs this year.
|
||||
toward #{@campaign.name}.
|
||||
Thanks so much!
|
||||
|
||||
= form_tag donations_path, method: 'POST', id: 'donation-form',
|
||||
'data-checkout-image' => image_path('default_preview.png'),
|
||||
'data-checkout-publishable-key' => Rails.configuration.stripe[:publishable_key] do
|
||||
'data-checkout-publishable-key' => Rails.configuration.stripe[:publishable_key],
|
||||
'data-campaign-theme' => @campaign.theme_id do
|
||||
= hidden_field_tag 'donation[stripe_token]'
|
||||
= hidden_field_tag 'donation[stripe_token_type]'
|
||||
= hidden_field_tag 'donation[donor_email]'
|
||||
|
@ -25,58 +26,7 @@
|
|||
= text_field_tag 'donation[amount]', '10.00'
|
||||
%button{:type => 'submit'} Donate now!
|
||||
|
||||
#success-thanks
|
||||
:markdown
|
||||
**Oh, wow! We've raised enough money for our 2014 hosting costs in less
|
||||
than a week! Thanks a ton!**
|
||||
|
||||
As it happens, we didn't have a fundraiser last year because I didn't have
|
||||
the time or energy to ask for money properly—whoops. So, any further
|
||||
donations will go toward last year's hosting costs that I paid out of
|
||||
pocket, and will therefore help me have enough money to pay for college
|
||||
♥
|
||||
|
||||
And you'll still totally get featured here and on the homepage, too.
|
||||
Thanks again for all your help! We're proud to be your Neopets fix during
|
||||
the downtime
|
||||
<img src="http://images.neopets.com/neoboards/smilies/grin.gif" />
|
||||
|
||||
#description
|
||||
:markdown
|
||||
**Dress to Impress is cool!** We have loads of fancy features: y'all are
|
||||
constantly adding models to our database, making NC trades, and saving your
|
||||
outfits and sharing them across the interwebs.
|
||||
It's pretty sweet, and we're super proud to have a community of users
|
||||
consistently putting our resources to good use.
|
||||
|
||||
**But cool features cost us money—about $800 a year.** We're running on a
|
||||
[4GB Linode server][linode] for $40/mo, and y'all's fancy outfit thumbnails
|
||||
live on [Amazon Web Services][aws] for about $25/mo (it varies by usage),
|
||||
so that leaves us at about $65/mo. Add in $10 for the domain name and $10
|
||||
room to grow (our Amazon usage, and therefore costs, are on the rise), and
|
||||
that comes to an annual budget of $800 USD.
|
||||
|
||||
**So, we're here to ask for help.** If you have some spare change to send
|
||||
our way, we'll gladly accept
|
||||
<img src="http://images.neopets.com/neoboards/smilies/grin.gif" />
|
||||
Thanks for helping Dress to Impress stay online and running smoothly!
|
||||
|
||||
**And, to show our undying gratitude, we'll feature your outfits right
|
||||
here!** Eeyup, for every $5 you send our way, we'll post one of your
|
||||
beautiful outfits right here on the donors list, and feature it on the
|
||||
homepage, too! Personally, I'm looking forward to seeing all your lovely
|
||||
creations, and wishing I could make things even [half as pretty][matts_bat]
|
||||
<img src="http://images.neopets.com/neoboards/smilies/tongue.gif" />
|
||||
(See the fine print at the bottom of the page for details.)
|
||||
|
||||
**Thanks again for all your help.** Dress to Impress runs on you, from our
|
||||
data to our servers. You make this site the great resource that it is, and
|
||||
I'm consistently impressed by this community's generosity. Thanks for
|
||||
all you do!
|
||||
|
||||
[linode]: https://www.linode.com/pricing
|
||||
[aws]: http://aws.amazon.com/
|
||||
[matts_bat]: http://www.neopets.com/petlookup.phtml?pet=matts_bat
|
||||
#description= md @campaign.description
|
||||
|
||||
- if @donations.present?
|
||||
%h2 Thanks to our lovely donors!
|
||||
|
@ -97,6 +47,9 @@
|
|||
|
||||
%header Thanks, #{donation.donor_name.presence || 'Anonymous'}!
|
||||
|
||||
- if @campaign.active?
|
||||
%p#last-years-donors= link_to "Don't forget to check out last year's donors, too!", Campaign.first
|
||||
|
||||
#fine-print
|
||||
%h2 Other ways to donate
|
||||
:markdown
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
%p
|
||||
%strong But enough about us. Let's talk about you!
|
||||
When we brag about you on our #{link_to 'donors list', donate_path},
|
||||
When we brag about you on our #{link_to 'donors list', @donation.campaign},
|
||||
what should we say?
|
||||
(If you'd rather take care of this later, no worries!
|
||||
Check your email for a copy of this URL.)
|
||||
|
|
|
@ -86,6 +86,9 @@ OpenneoImpressItems::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
resources :campaigns, only: [:show], path: '/donate/campaigns'
|
||||
match '/donate' => 'campaigns#current', as: :donate
|
||||
|
||||
match 'users/current-user/closet' => 'closet_hangers#index', :as => :your_items
|
||||
|
||||
match 'users/top-contributors' => 'users#top_contributors', :as => :top_contributors
|
||||
|
@ -94,7 +97,6 @@ OpenneoImpressItems::Application.routes.draw do
|
|||
match '/wardrobe' => 'outfits#edit', :as => :wardrobe
|
||||
match '/start/:color_name/:species_name' => 'outfits#start'
|
||||
|
||||
match '/donate' => 'static#donate', :as => :donate
|
||||
match 'image-mode' => 'static#image_mode', :as => :image_mode
|
||||
match '/terms' => 'static#terms', :as => :terms
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddDescriptionToCampaigns < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :campaigns, :description, :text, null: false, default: ''
|
||||
end
|
||||
end
|
6
db/migrate/20150728195029_add_name_to_campaigns.rb
Normal file
6
db/migrate/20150728195029_add_name_to_campaigns.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
class AddNameToCampaigns < ActiveRecord::Migration
|
||||
def change
|
||||
# TODO: translations?
|
||||
add_column :campaigns, :name, :string, null: false, default: 'our hosting costs this year'
|
||||
end
|
||||
end
|
5
db/migrate/20150802202909_add_theme_id_to_campaigns.rb
Normal file
5
db/migrate/20150802202909_add_theme_id_to_campaigns.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AddThemeIdToCampaigns < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :campaigns, :theme_id, :string, null: false, default: 'hug'
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20150225194522) do
|
||||
ActiveRecord::Schema.define(:version => 20150802202909) do
|
||||
|
||||
create_table "auth_servers", :force => true do |t|
|
||||
t.string "short_name", :limit => 10, :null => false
|
||||
|
@ -39,6 +39,9 @@ ActiveRecord::Schema.define(:version => 20150225194522) do
|
|||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.boolean "advertised", :default => true, :null => false
|
||||
t.text "description", :null => false
|
||||
t.string "name", :default => "our hosting costs this year", :null => false
|
||||
t.string "theme_id", :default => "hug", :null => false
|
||||
end
|
||||
|
||||
create_table "campaigns_old", :force => true do |t|
|
||||
|
|
5
spec/controllers/campaigns_controller_spec.rb
Normal file
5
spec/controllers/campaigns_controller_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe CampaignsController do
|
||||
|
||||
end
|
15
spec/helpers/campaigns_helper_spec.rb
Normal file
15
spec/helpers/campaigns_helper_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'spec_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the CampaignsHelper. For example:
|
||||
#
|
||||
# describe CampaignsHelper do
|
||||
# describe "string concat" do
|
||||
# it "concats two strings with spaces" do
|
||||
# helper.concat_strings("this","that").should == "this that"
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
describe CampaignsHelper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in a new issue