Fixed some issues with registration
This commit is contained in:
parent
243c47a6e7
commit
55d47180e0
14
DB specs.txt
14
DB specs.txt
@ -22,7 +22,7 @@
|
|||||||
- slug : string
|
- slug : string
|
||||||
- info : text
|
- info : text
|
||||||
|
|
||||||
event
|
*event
|
||||||
- title : string
|
- title : string
|
||||||
- slug : string
|
- slug : string
|
||||||
- conference : [conference]
|
- conference : [conference]
|
||||||
@ -66,18 +66,12 @@ event
|
|||||||
- other_option : *boolean
|
- other_option : *boolean
|
||||||
- retired : boolean
|
- retired : boolean
|
||||||
|
|
||||||
request
|
|
||||||
- comment : text
|
|
||||||
- object : Nto1[object]
|
|
||||||
- is_invite : boolean
|
|
||||||
- state : list(string)
|
|
||||||
|
|
||||||
*user_organization_relationship
|
*user_organization_relationship
|
||||||
- user : [user]
|
- user : [user]
|
||||||
- organization : [organization]
|
- organization : [organization]
|
||||||
- relationship : string
|
- relationship : string
|
||||||
|
|
||||||
workshop
|
*workshop
|
||||||
- title : string
|
- title : string
|
||||||
- slug : string
|
- slug : string
|
||||||
- info : text
|
- info : text
|
||||||
@ -106,7 +100,3 @@ workshop
|
|||||||
- slug : string
|
- slug : string
|
||||||
- info : text
|
- info : text
|
||||||
|
|
||||||
rails g scaffold workshop title:string slug:string info:text conference_id:integer workshop_stream_id:integer workshop_presentation_style:integer min_facilitators:integer location_id:integer start_time:datetime end_time:datetime
|
|
||||||
|
|
||||||
- requested_resources : NtoN[workshop_resource]
|
|
||||||
- facilitators : NtoN[user]
|
|
1
Gemfile
1
Gemfile
@ -48,7 +48,6 @@ gem "compass-rails", "~> 1.1.3"
|
|||||||
gem 'foundation-rails'
|
gem 'foundation-rails'
|
||||||
gem 'turbolinks'
|
gem 'turbolinks'
|
||||||
gem 'uglifier', '>= 1.3.0'
|
gem 'uglifier', '>= 1.3.0'
|
||||||
#gem 'bcrypt-ruby', git: 'https://github.com/codahale/bcrypt-ruby.git'
|
|
||||||
gem 'sorcery', '>= 0.8.1'
|
gem 'sorcery', '>= 0.8.1'
|
||||||
gem 'oauth2', '~> 0.8.0'
|
gem 'oauth2', '~> 0.8.0'
|
||||||
gem 'ruby-drupal-hash'
|
gem 'ruby-drupal-hash'
|
||||||
|
@ -113,7 +113,6 @@ updateFormFieldList = () ->
|
|||||||
(json) ->
|
(json) ->
|
||||||
$('#conference-form').html(json.form)
|
$('#conference-form').html(json.form)
|
||||||
$('#registration-form-field-list').html(json.list)
|
$('#registration-form-field-list').html(json.list)
|
||||||
#console.log json
|
|
||||||
updateFormFieldList()
|
updateFormFieldList()
|
||||||
return
|
return
|
||||||
$('#conference-form .remove-form-field').click () ->
|
$('#conference-form .remove-form-field').click () ->
|
||||||
|
@ -38,7 +38,10 @@ class RegistrationFormFieldsController < ApplicationController
|
|||||||
|
|
||||||
private
|
private
|
||||||
def ajax_return(success)
|
def ajax_return(success)
|
||||||
@registration_form_fields = RegistrationFormField.all
|
if params[:conference_id]
|
||||||
|
@conference = Conference.find(params[:conference_id])
|
||||||
|
@registration_form_fields = RegistrationFormField.where(["id NOT IN (?)", @conference.registration_form_fields.map(&:id)])
|
||||||
|
end
|
||||||
if success
|
if success
|
||||||
@registration_form_field = RegistrationFormField.new
|
@registration_form_field = RegistrationFormField.new
|
||||||
end
|
end
|
||||||
@ -54,13 +57,11 @@ class RegistrationFormFieldsController < ApplicationController
|
|||||||
|
|
||||||
# Only allow a trusted parameter "white list" through.
|
# Only allow a trusted parameter "white list" through.
|
||||||
def registration_form_field_params
|
def registration_form_field_params
|
||||||
#type = params[:type]
|
|
||||||
#allowed = RegistrationFormField::Types[type]
|
|
||||||
#allowed << 'field_type'
|
|
||||||
rff_params = params.require(:registration_form_field)
|
rff_params = params.require(:registration_form_field)
|
||||||
allowed = RegistrationFormField::GetNonOptionKeys(rff_params[:field_type], rff_params)
|
allowed = RegistrationFormField::GetNonOptionKeys(rff_params[:field_type], rff_params)
|
||||||
p = rff_params.send('permit', *allowed)#permit(:title, :help, :required, :field_type, :options, :is_retired)
|
p = rff_params.send('permit', *allowed)#permit(:title, :help, :required, :field_type, :options, :is_retired)
|
||||||
p[:options] = RegistrationFormField::GetOptions(rff_params[:field_type], rff_params).to_json.to_s
|
p[:options] = RegistrationFormField::GetOptions(rff_params[:field_type], rff_params).to_json.to_s
|
||||||
|
p[:field_type] = rff_params[:field_type]
|
||||||
p
|
p
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -201,7 +201,7 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def field(form, name, type = nil, param = nil, html: nil, help: false, attrs: [], classes: nil, label: nil, placeholder: nil, value: nil, checked: nil)
|
def field(form, name, type = nil, param = nil, html: nil, help: false, attrs: [], classes: nil, label: nil, placeholder: nil, value: nil, checked: nil, required: false)
|
||||||
|
|
||||||
if form.is_a?(Symbol) || form.is_a?(String)
|
if form.is_a?(Symbol) || form.is_a?(String)
|
||||||
param = type
|
param = type
|
||||||
@ -226,7 +226,7 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
select_prompt = nil
|
select_prompt = nil
|
||||||
show_label = true
|
show_label = !(/^hidden_field/.match(type.to_s))
|
||||||
label_after = true
|
label_after = true
|
||||||
value_attribute = !form
|
value_attribute = !form
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ module ApplicationHelper
|
|||||||
label_html = eval("(" + (form ? 'form.label' : 'label_tag') + " name, '<span>#{label ? CGI.escapeHTML(label) : name}</span>'.html_safe)")
|
label_html = eval("(" + (form ? 'form.label' : 'label_tag') + " name, '<span>#{label ? CGI.escapeHTML(label) : name}</span>'.html_safe)")
|
||||||
end
|
end
|
||||||
|
|
||||||
if label === false
|
if label === false || !show_label
|
||||||
label_html = ''
|
label_html = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -354,7 +354,9 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
form_html += (html_options || '')
|
form_html += (html_options || '')
|
||||||
puts "\n\t" + form_html + "\n"
|
if required
|
||||||
|
form_html += ', :required => true'
|
||||||
|
end
|
||||||
form_html = eval(form_html)
|
form_html = eval(form_html)
|
||||||
if root
|
if root
|
||||||
form_html = "<#{root}>" + form_html + "</#{root}>"
|
form_html = "<#{root}>" + form_html + "</#{root}>"
|
||||||
@ -474,9 +476,8 @@ module ApplicationHelper
|
|||||||
|
|
||||||
def form_field(f, response = nil)
|
def form_field(f, response = nil)
|
||||||
id = 'field_' + f.id.to_s
|
id = 'field_' + f.id.to_s
|
||||||
html = p(f, 'title')#'<label for="' + id + '">' + f.title + '</label>'
|
html = p(f, 'title')
|
||||||
|
|
||||||
#options = ActiveSupport::JSON.decode(options)#JSON.parse(f.options)
|
|
||||||
options = JSON.parse(f.options)
|
options = JSON.parse(f.options)
|
||||||
if f.field_type == 'multiple'
|
if f.field_type == 'multiple'
|
||||||
if f.help
|
if f.help
|
||||||
@ -490,25 +491,17 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
val = response ? ActiveSupport::JSON.decode(response.data) : Hash.new
|
val = response ? ActiveSupport::JSON.decode(response.data) : Hash.new
|
||||||
#val = nil
|
|
||||||
|
|
||||||
if f.repeats?
|
if f.repeats?
|
||||||
is_array = f.is_array?
|
is_array = f.is_array?
|
||||||
opts.each do |key, value|
|
opts.each do |key, value|
|
||||||
#html += self.send(options['selection_type'] + '_tag', 'field-' + id)
|
html += field((id + (is_array ? ('_' + key) : '')).to_sym, options['selection_type'] + '_tag', label: value, value: is_array ? (val ? val[key] : nil) : key, checked: is_array ? (val[key] == "1" || val[key] == "on") : val.to_s == key.to_s, required: f.required)
|
||||||
#ActiveSupport::JSON.decode(key)
|
|
||||||
if is_array
|
|
||||||
#x
|
|
||||||
end
|
|
||||||
html += field((id + (is_array ? ('_' + key) : '')).to_sym, options['selection_type'] + '_tag', label: value, value: is_array ? (val ? val[key] : nil) : key, checked: is_array ? (val[key] == "1" || val[key] == "on") : val.to_s == key.to_s)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
html += field(id.to_sym, options['selection_type'] + '_tag', opts, value: val)
|
html += field(id.to_sym, options['selection_type'] + '_tag', opts, value: val, required: f.required)
|
||||||
end
|
end
|
||||||
#html += collection_check_boxes nil, nil, opts, nil, :key
|
|
||||||
else
|
else
|
||||||
#x
|
html += field(id.to_sym, options['input_type'] + '_tag', label: false, placeholder: f.help, value: response ? ActiveSupport::JSON.decode(response.data) : nil, required: f.required)
|
||||||
html += field(id.to_sym, options['input_type'] + '_tag', label: false, placeholder: f.help, value: response ? ActiveSupport::JSON.decode(response.data) : nil)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
html.html_safe
|
html.html_safe
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
%ul
|
%ul
|
||||||
- @registration_form_field.errors.full_messages.each do |msg|
|
- @registration_form_field.errors.full_messages.each do |msg|
|
||||||
%li= msg
|
%li= msg
|
||||||
|
- if @conference
|
||||||
|
= field :conference_id, :hidden_field_tag, value: @conference.id
|
||||||
= field f, :field_type, :select, RegistrationFormField::Types.keys
|
= field f, :field_type, :select, RegistrationFormField::Types.keys
|
||||||
- RegistrationFormField::Fields.each do |key, value|
|
- RegistrationFormField::Fields.each do |key, value|
|
||||||
- classes = RegistrationFormField::TypesForField(key.to_sym).collect{|v| 'field-type-' + v.to_s}
|
- classes = RegistrationFormField::TypesForField(key.to_sym).collect{|v| 'field-type-' + v.to_s}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user