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
 | 
			
		||||
	- info 	: text
 | 
			
		||||
 | 
			
		||||
event
 | 
			
		||||
*event
 | 
			
		||||
	- title			: string
 | 
			
		||||
	- slug			: string
 | 
			
		||||
	- conference 	: [conference]
 | 
			
		||||
@ -66,18 +66,12 @@ event
 | 
			
		||||
	- other_option	: *boolean
 | 
			
		||||
	- retired		: boolean
 | 
			
		||||
 | 
			
		||||
request
 | 
			
		||||
	- comment	: text
 | 
			
		||||
	- object	: Nto1[object]
 | 
			
		||||
	- is_invite	: boolean
 | 
			
		||||
	- state		: list(string)
 | 
			
		||||
 | 
			
		||||
*user_organization_relationship
 | 
			
		||||
	- user			: [user]
 | 
			
		||||
	- organization	: [organization]
 | 
			
		||||
	- relationship	: string
 | 
			
		||||
 | 
			
		||||
workshop
 | 
			
		||||
*workshop
 | 
			
		||||
	- title					: string
 | 
			
		||||
	- slug					: string
 | 
			
		||||
	- info					: text
 | 
			
		||||
@ -106,7 +100,3 @@ workshop
 | 
			
		||||
	- slug	: string
 | 
			
		||||
	- 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 'turbolinks'
 | 
			
		||||
gem 'uglifier', '>= 1.3.0'
 | 
			
		||||
#gem 'bcrypt-ruby', git: 'https://github.com/codahale/bcrypt-ruby.git'
 | 
			
		||||
gem 'sorcery', '>= 0.8.1'
 | 
			
		||||
gem 'oauth2', '~> 0.8.0'
 | 
			
		||||
gem 'ruby-drupal-hash'
 | 
			
		||||
 | 
			
		||||
@ -113,7 +113,6 @@ updateFormFieldList = () ->
 | 
			
		||||
			(json) ->
 | 
			
		||||
				$('#conference-form').html(json.form)
 | 
			
		||||
				$('#registration-form-field-list').html(json.list)
 | 
			
		||||
				#console.log json
 | 
			
		||||
				updateFormFieldList()
 | 
			
		||||
				return
 | 
			
		||||
	$('#conference-form .remove-form-field').click () ->
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,10 @@ class RegistrationFormFieldsController < ApplicationController
 | 
			
		||||
 | 
			
		||||
	private
 | 
			
		||||
		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
 | 
			
		||||
				@registration_form_field = RegistrationFormField.new
 | 
			
		||||
			end
 | 
			
		||||
@ -54,13 +57,11 @@ class RegistrationFormFieldsController < ApplicationController
 | 
			
		||||
 | 
			
		||||
		# Only allow a trusted parameter "white list" through.
 | 
			
		||||
		def registration_form_field_params
 | 
			
		||||
			#type = params[:type]
 | 
			
		||||
			#allowed = RegistrationFormField::Types[type]
 | 
			
		||||
			#allowed << 'field_type'
 | 
			
		||||
			rff_params = params.require(:registration_form_field)
 | 
			
		||||
			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[:options] = RegistrationFormField::GetOptions(rff_params[:field_type], rff_params).to_json.to_s
 | 
			
		||||
			p[:field_type] = rff_params[:field_type]
 | 
			
		||||
			p
 | 
			
		||||
		end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
@ -201,7 +201,7 @@ module ApplicationHelper
 | 
			
		||||
		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)
 | 
			
		||||
			param = type
 | 
			
		||||
@ -226,7 +226,7 @@ module ApplicationHelper
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
		select_prompt = nil
 | 
			
		||||
		show_label = true
 | 
			
		||||
		show_label = !(/^hidden_field/.match(type.to_s))
 | 
			
		||||
		label_after = true
 | 
			
		||||
		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)")
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
		if label === false
 | 
			
		||||
		if label === false || !show_label
 | 
			
		||||
			label_html = ''
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
@ -354,7 +354,9 @@ module ApplicationHelper
 | 
			
		||||
				end
 | 
			
		||||
			end
 | 
			
		||||
			form_html += (html_options || '')
 | 
			
		||||
			puts "\n\t" + form_html + "\n"
 | 
			
		||||
			if required
 | 
			
		||||
				form_html += ', :required => true'
 | 
			
		||||
			end
 | 
			
		||||
			form_html = eval(form_html)
 | 
			
		||||
			if root
 | 
			
		||||
				form_html = "<#{root}>" + form_html + "</#{root}>"
 | 
			
		||||
@ -474,9 +476,8 @@ module ApplicationHelper
 | 
			
		||||
 | 
			
		||||
	def form_field(f, response = nil)
 | 
			
		||||
		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)
 | 
			
		||||
		if f.field_type == 'multiple'
 | 
			
		||||
			if f.help
 | 
			
		||||
@ -490,25 +491,17 @@ module ApplicationHelper
 | 
			
		||||
			end
 | 
			
		||||
 | 
			
		||||
			val = response ? ActiveSupport::JSON.decode(response.data) : Hash.new
 | 
			
		||||
			#val = nil
 | 
			
		||||
 | 
			
		||||
			if f.repeats?
 | 
			
		||||
				is_array = f.is_array?
 | 
			
		||||
				opts.each do |key, value|
 | 
			
		||||
					#html += self.send(options['selection_type'] + '_tag', 'field-' + id)
 | 
			
		||||
					#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)
 | 
			
		||||
					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)
 | 
			
		||||
				end
 | 
			
		||||
			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
 | 
			
		||||
			#html += collection_check_boxes nil, nil, opts, nil, :key
 | 
			
		||||
		else
 | 
			
		||||
			#x
 | 
			
		||||
			html += field(id.to_sym, options['input_type'] + '_tag', label: false, placeholder: f.help, value: response ? ActiveSupport::JSON.decode(response.data) : nil)
 | 
			
		||||
			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)
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
		html.html_safe
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,8 @@
 | 
			
		||||
			%ul
 | 
			
		||||
				- @registration_form_field.errors.full_messages.each do |msg|
 | 
			
		||||
					%li= msg
 | 
			
		||||
 | 
			
		||||
	- if @conference
 | 
			
		||||
		= field :conference_id, :hidden_field_tag, value: @conference.id
 | 
			
		||||
	= field f, :field_type, :select, RegistrationFormField::Types.keys
 | 
			
		||||
	- RegistrationFormField::Fields.each do |key, value|
 | 
			
		||||
		- classes = RegistrationFormField::TypesForField(key.to_sym).collect{|v| 'field-type-' + v.to_s}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user