/
page_controller.rb
50 lines (31 loc) · 1.74 KB
/
page_controller.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright (C) 2010 Cykod LLC
class UserProfile::PageController < ParagraphController
editor_header 'User Profile Paragraphs'
editor_for :display_profile, :name => "Display Profile", :feature => :user_profile_page_display_profile, :inputs => { :user_profile => [ [:url, 'User URL', :path]] }, :outputs => [ [ :profile_content, "Profile Entry",:content] ]
editor_for :list_profiles, :name => 'List Profiles', :feature => :user_profile_page_list_profiles
class DisplayProfileOptions < HashModel
# this needs to be set as a paragraph option.. they have to pick which profile they want displayed on the page
attributes :profile_type_id => nil, :default_to_user => true
boolean_options :default_to_user
validates_presence_of :profile_type_id
options_form(fld(:profile_type_id,:select,:options => :profile_type_select_options),
fld(:default_to_user,:yes_no))
def profile_type_select_options
UserProfileType.select_options_with_nil
end
end
class ListProfilesOptions < HashModel
attributes :profile_type_id => nil, :order_by => 'newest', :registered_only => true, :per_page => 20
validates_presence_of :profile_type_id
integer_options :per_page
boolean_options :registered_only
has_options :order_by, [['Newest','newest'],['Updated','updated'],['Alphabetical','alpha']]
options_form(fld(:profile_type_id,:select,:options => :profile_type_select_options),
fld(:order_by,:select, :options => :order_by_select_options),
fld(:per_page,:text_field),
fld(:registered_only,:yes_no,:description => 'Only show registered users (recommended)'))
def profile_type_select_options
UserProfileType.select_options_with_nil
end
end
end