docbrown/app/dashboards/organization_dashboard.rb
Ben Halpern 4ebfcd8bc0
Self-serve sponsorship options (#3371)
* WIP - Initial work on sponsorship landing page

* Add initial partnership page
2019-07-03 12:04:03 -04:00

102 lines
2.6 KiB
Ruby

require "administrate/base_dashboard"
class OrganizationDashboard < Administrate::BaseDashboard
# ATTRIBUTE_TYPES
# a hash that describes the type of each of the model's fields.
#
# Each different type represents an Administrate::Field object,
# which determines how the attribute is displayed
# on pages throughout the dashboard.
ATTRIBUTE_TYPES = {
id: Field::Number,
name: Field::String,
slug: Field::String,
summary: Field::Text,
tag_line: Field::String,
profile_image: CarrierwaveField,
nav_image: CarrierwaveField,
dark_nav_image: CarrierwaveField,
url: Field::String,
twitter_username: Field::String,
github_username: Field::String,
jobs_url: Field::String,
jobs_email: Field::String,
address: Field::String,
city: Field::String,
state: Field::String,
zip_code: Field::String,
bg_color_hex: Field::String,
text_color_hex: Field::String,
country: Field::String,
created_at: Field::DateTime,
updated_at: Field::DateTime,
users: Field::HasMany,
approved: Field::Boolean,
cta_button_text: Field::String,
cta_button_url: Field::String,
cta_body_markdown: Field::Text,
sponsorship_url: Field::Text,
sponsorship_tagline: Field::Text,
sponsorship_status: Field::Text,
sponsorship_level: Field::Text,
sponsorship_instructions: Field::Text,
sponsorship_blurb_html: Field::Text,
sponsorship_featured_number: Field::Number
}.freeze
# COLLECTION_ATTRIBUTES
# an array of attributes that will be displayed on the model's index page.
#
# By default, it's limited to four items to reduce clutter on index pages.
# Feel free to add, remove, or rearrange items.
COLLECTION_ATTRIBUTES = %i[
profile_image
name
url
twitter_username
approved
].freeze
# SHOW_PAGE_ATTRIBUTES
# an array of attributes that will be displayed on the model's show page.
SHOW_PAGE_ATTRIBUTES = ATTRIBUTE_TYPES.keys
# FORM_ATTRIBUTES
# an array of attributes that will be displayed
# on the model's form (`new` and `edit`) pages.
FORM_ATTRIBUTES = %i[
name
slug
summary
tag_line
profile_image
nav_image
dark_nav_image
url
bg_color_hex
text_color_hex
twitter_username
github_username
jobs_url
jobs_email
address
city
state
zip_code
country
approved
cta_button_text
cta_button_url
cta_body_markdown
sponsorship_url
sponsorship_tagline
sponsorship_blurb_html
sponsorship_level
sponsorship_status
sponsorship_featured_number
].freeze
def display_resource(organization)
organization.name
end
end