docbrown/app/dashboards/organization_dashboard.rb
Ben Halpern f073eb5754
Add badges and org cta (#324)
* Make org proof a required field

* Fix color picker and other minor org adjustments

* Add MVP of org add'l sidebar

* Add proof to org factory

* Fix org create action and fix tests

* Add new org fields to admin panel & lint

* Add proof to org edit for backward compatibility

* Add org info to edit preview

* Move preview edit notice to inside article div

* MVP of badge "final" steps

* Add info to user sidebar and clean up badge commit

* Modify sidebar for data

* Add organization decorator

* Add conditional so only users have new swipe nav, not orgs

* Add cloudinary prefix to badges

* Disallow duplicate badges
2018-05-17 18:22:37 -04:00

87 lines
2.2 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,
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,
}
# 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 = [
:profile_image,
:name,
:url,
:twitter_username,
:approved,
]
# 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 = [
:name,
:slug,
:summary,
:tag_line,
:profile_image,
: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,
]
def display_resource(organization)
organization.name
end
end