feat(nonprofit): add strong params
This commit is contained in:
parent
0cf21bb1c9
commit
70b1095083
2 changed files with 101 additions and 51 deletions
|
@ -50,12 +50,12 @@ class NonprofitsController < ApplicationController
|
||||||
|
|
||||||
def create
|
def create
|
||||||
current_user ||= User.find(params[:user_id])
|
current_user ||= User.find(params[:user_id])
|
||||||
json_saved Nonprofit.register(current_user, params[:nonprofit])
|
json_saved Nonprofit.register(current_user, nonprofit_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
flash[:notice] = 'Update successful!'
|
flash[:notice] = 'Update successful!'
|
||||||
current_nonprofit.update_attributes params[:nonprofit].except(:verification_status)
|
current_nonprofit.update_attributes nonprofit_params.except(:verification_status)
|
||||||
json_saved current_nonprofit
|
json_saved current_nonprofit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -142,4 +142,56 @@ class NonprofitsController < ApplicationController
|
||||||
all_countries.map { |code, name| [code.upcase, name] }.sort_by { |a| a[1] }
|
all_countries.map { |code, name| [code.upcase, name] }.sort_by { |a| a[1] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def nonprofit_params
|
||||||
|
params.require(:nonprofit).permit(
|
||||||
|
:name,
|
||||||
|
:stripe_account_id,
|
||||||
|
:summary,
|
||||||
|
:tagline,
|
||||||
|
:email,
|
||||||
|
:phone,
|
||||||
|
:main_image,
|
||||||
|
:second_image,
|
||||||
|
:third_image,
|
||||||
|
:background_image,
|
||||||
|
:remove_background_image,
|
||||||
|
:logo,
|
||||||
|
:zip_code,
|
||||||
|
:website,
|
||||||
|
:categories,
|
||||||
|
:achievements,
|
||||||
|
:full_description,
|
||||||
|
:state_code,
|
||||||
|
:statement,
|
||||||
|
:city,
|
||||||
|
:slug,
|
||||||
|
:city_slug,
|
||||||
|
:state_code_slug,
|
||||||
|
:ein,
|
||||||
|
:published,
|
||||||
|
:vetted,
|
||||||
|
:verification_status,
|
||||||
|
:latitude,
|
||||||
|
:longitude,
|
||||||
|
:timezone,
|
||||||
|
:address,
|
||||||
|
:thank_you_note,
|
||||||
|
:referrer,
|
||||||
|
:no_anon,
|
||||||
|
:roles_attributes,
|
||||||
|
:brand_font,
|
||||||
|
:brand_color,
|
||||||
|
:hide_activity_feed,
|
||||||
|
:tracking_script,
|
||||||
|
:facebook,
|
||||||
|
:twitter,
|
||||||
|
:youtube,
|
||||||
|
:instagram,
|
||||||
|
:blog,
|
||||||
|
:card_failure_message_top,
|
||||||
|
:card_failure_message_bottom,
|
||||||
|
:autocomplete_supporter_address
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,55 +4,53 @@
|
||||||
class Nonprofit < ApplicationRecord
|
class Nonprofit < ApplicationRecord
|
||||||
Categories = ['Public Benefit', 'Human Services', 'Education', 'Civic Duty', 'Human Rights', 'Animals', 'Environment', 'Health', 'Arts, Culture, Humanities', 'International', 'Children', 'Religion', 'LGBTQ', "Women's Rights", 'Disaster Relief', 'Veterans'].freeze
|
Categories = ['Public Benefit', 'Human Services', 'Education', 'Civic Duty', 'Human Rights', 'Animals', 'Environment', 'Health', 'Arts, Culture, Humanities', 'International', 'Children', 'Religion', 'LGBTQ', "Women's Rights", 'Disaster Relief', 'Veterans'].freeze
|
||||||
|
|
||||||
# TODO
|
# :name, # str
|
||||||
# attr_accessible \
|
# :stripe_account_id, # str
|
||||||
# :name, # str
|
# :summary, # text: paragraph-sized organization summary
|
||||||
# :stripe_account_id, # str
|
# :tagline, # str
|
||||||
# :summary, # text: paragraph-sized organization summary
|
# :email, # str: public organization contact email
|
||||||
# :tagline, # str
|
# :phone, # str: public org contact phone
|
||||||
# :email, # str: public organization contact email
|
# :main_image, # str: url of featured image - first image in profile carousel
|
||||||
# :phone, # str: public org contact phone
|
# :second_image, # str: url of 2nd image in carousel
|
||||||
# :main_image, # str: url of featured image - first image in profile carousel
|
# :third_image, # str: url of 3rd image in carousel
|
||||||
# :second_image, # str: url of 2nd image in carousel
|
# :background_image, # str: url of large profile background
|
||||||
# :third_image, # str: url of 3rd image in carousel
|
# :remove_background_image, #bool carrierwave
|
||||||
# :background_image, # str: url of large profile background
|
# :logo, # str: small logo image url for searching
|
||||||
# :remove_background_image, #bool carrierwave
|
# :zip_code, # int
|
||||||
# :logo, # str: small logo image url for searching
|
# :website, # str: their own website url
|
||||||
# :zip_code, # int
|
# :categories, # text [str]: see the constant Categories
|
||||||
# :website, # str: their own website url
|
# :achievements, # text [str]: highlights about this org
|
||||||
# :categories, # text [str]: see the constant Categories
|
# :full_description, # text
|
||||||
# :achievements, # text [str]: highlights about this org
|
# :state_code, # str: two-letter state code (eg. CA)
|
||||||
# :full_description, # text
|
# :statement, # str: bank statement for donations towards the nonprofit
|
||||||
# :state_code, # str: two-letter state code (eg. CA)
|
# :city, # str
|
||||||
# :statement, # str: bank statement for donations towards the nonprofit
|
# :slug, # str
|
||||||
# :city, # str
|
# :city_slug, #str
|
||||||
# :slug, # str
|
# :state_code_slug, #str
|
||||||
# :city_slug, #str
|
# :ein, # str: employee identification number
|
||||||
# :state_code_slug, #str
|
# :published, # boolean; whether to display this profile
|
||||||
# :ein, # str: employee identification number
|
# :vetted, # bool: Whether a super admin (one of CommitChange's employees) have approved this org
|
||||||
# :published, # boolean; whether to display this profile
|
# :verification_status, # str (either 'pending', 'unverified', 'escalated', 'verified' -- whether the org has submitted the identity verification form and it has been approved)
|
||||||
# :vetted, # bool: Whether a super admin (one of CommitChange's employees) have approved this org
|
# :latitude, # float: geocoder gem
|
||||||
# :verification_status, # str (either 'pending', 'unverified', 'escalated', 'verified' -- whether the org has submitted the identity verification form and it has been approved)
|
# :longitude, # float: geocoder gem
|
||||||
# :latitude, # float: geocoder gem
|
# :timezone, # str
|
||||||
# :longitude, # float: geocoder gem
|
# :address, # text
|
||||||
# :timezone, # str
|
# :thank_you_note, # text
|
||||||
# :address, # text
|
# :referrer, # str
|
||||||
# :thank_you_note, # text
|
# :no_anon, # bool: whether to allow anonymous donations
|
||||||
# :referrer, # str
|
# :roles_attributes,
|
||||||
# :no_anon, # bool: whether to allow anonymous donations
|
# :brand_font, #string (lowercase key eg. 'helvetica')
|
||||||
# :roles_attributes,
|
# :brand_color, #string (hex color value)
|
||||||
# :brand_font, #string (lowercase key eg. 'helvetica')
|
# :hide_activity_feed, # bool
|
||||||
# :brand_color, #string (hex color value)
|
# :tracking_script,
|
||||||
# :hide_activity_feed, # bool
|
# :facebook, #string (url)
|
||||||
# :tracking_script,
|
# :twitter, #string (url)
|
||||||
# :facebook, #string (url)
|
# :youtube, #string (url)
|
||||||
# :twitter, #string (url)
|
# :instagram, #string (url)
|
||||||
# :youtube, #string (url)
|
# :blog, #string (url)
|
||||||
# :instagram, #string (url)
|
# :card_failure_message_top, # text
|
||||||
# :blog, #string (url)
|
# :card_failure_message_bottom, # text
|
||||||
# :card_failure_message_top, # text
|
# :autocomplete_supporter_address # boolean
|
||||||
# :card_failure_message_bottom, # text
|
|
||||||
# :autocomplete_supporter_address # boolean
|
|
||||||
|
|
||||||
has_many :payouts
|
has_many :payouts
|
||||||
has_many :charges
|
has_many :charges
|
||||||
|
|
Loading…
Reference in a new issue