VRFS-3359 : Proper setting of experience keys and saving.

This commit is contained in:
Steven Miers 2015-08-31 11:32:20 -05:00
parent e028a604cf
commit 0878c5fd3f
5 changed files with 13 additions and 13 deletions

View File

@ -3,6 +3,7 @@ module JamRuby
include HtmlSanitize
html_sanitize strict: [:name, :organization]
belongs_to :teacher, :class_name => "JamRuby::Teacher"
attr_accessible :name, :experience_type, :organization, :start_year, :end_year
scope :teaching, where(experience_type: 'teaching')
scope :education, where(experience_type: 'education')

View File

@ -25,7 +25,6 @@ logger = context.JK.logger
e.preventDefault()
logger.debug("addExperience", this.props.listItems, this.props)
$form = e.target
formValues = $(":input", $form).formToObject()
this.props.listItems.push {
name: $("[name='title_input']", $form).val()
organization: $("[name='organization_input']", $form).val()

View File

@ -22,9 +22,9 @@ rest = window.JK.Rest()
teacher = changes.teacher
this.setState({
#validate_basics: true,
experience_teaching: teacher.experience_teaching
experience_education: teacher.experience_education
experience_award: teacher.experience_award
experiences_teaching: teacher.experiences_teaching
experiences_education: teacher.experiences_education
experiences_award: teacher.experiences_award
})
captureFormState: (changes) ->
@ -54,7 +54,7 @@ rest = window.JK.Rest()
handleListChange: (listName, listObjects)->
logger.debug("EXPERIENCE handleListChange:", listName, listObjects)
this.setState({
"experience_#{listName}": listObjects
"experiences_#{listName}": listObjects
})
#this.forceUpdate()
@ -66,17 +66,17 @@ rest = window.JK.Rest()
`<div className="TeacherSetupExperience TeacherSetupComponent">
<div className="teacher-third-column">
<label className="sub-caption">TEACHING EXPERIENCE:</label>
<TeacherExperienceEditableList showEndDate="true" experienceType="teaching" onItemChanged={this.handleListChange} listItems={this.state.experience_teaching}/>
<TeacherExperienceEditableList showEndDate="true" experienceType="teaching" onItemChanged={this.handleListChange} listItems={this.state.experiences_teaching}/>
</div>
<div className="teacher-third-column">
<label className="sub-caption">EDUCATION:</label>
<TeacherExperienceEditableList showEndDate="true" experienceType="education" onItemChanged={this.handleListChange} listItems={this.state.experience_education}/>
<TeacherExperienceEditableList showEndDate="true" experienceType="education" onItemChanged={this.handleListChange} listItems={this.state.experiences_education}/>
</div>
<div className="teacher-third-column">
<label className="sub-caption">AWARDS:</label>
<TeacherExperienceEditableList experienceType="award" onItemChanged={this.handleListChange} listItems={this.state.experience_award}/>
<TeacherExperienceEditableList experienceType="award" onItemChanged={this.handleListChange} listItems={this.state.experiences_award}/>
</div>
<TeacherSetupNav handleNav={this.handleNav}> </TeacherSetupNav>

View File

@ -18,7 +18,7 @@ logger = context.JK.logger
for yr in [1901..now]
options.push `<option value={yr}>{yr}</option>`
`<select className="YearSelect react-component" required placeholder="Select">
`<select className="YearSelect react-component" name={this.props.name} required placeholder="Select">
{options}
</select>`
})

View File

@ -48,7 +48,7 @@ node :languages do
@teacher.languages.collect{|o|o.id}
end
node :experience_teaching do
node :experiences_teaching do
@teacher.experiences_teaching.collect do |o|
{
name: o.name,
@ -60,7 +60,7 @@ node :experience_teaching do
end # collect
end
node :experience_education do
node :experiences_education do
@teacher.experiences_education.collect do |o|
{
name: o.name,
@ -72,7 +72,7 @@ node :experience_education do
end # collect
end
node :experience_award do
node :experiences_award do
@teacher.experiences_award.collect do |o|
{
name: o.name,