Browse Source

Registration form working

development
Godwin 10 years ago
parent
commit
4b79de7a24
  1. 27
      DB specs.txt
  2. 13
      README.md
  3. 18
      app/controllers/conferences_controller.rb
  4. 3
      app/views/conferences/_form.html.haml

27
DB specs.txt

@ -1,4 +1,4 @@
conference
*conference
- title : string
- slug : string
- start_date : datetime
@ -57,7 +57,7 @@ event
- location : [location]
- members : NtoN[user_organization_replationship]
registration_form_field
*registration_form_field
- title : string
- slug : string
- required : boolean
@ -106,25 +106,4 @@ workshop
- slug : string
- info : text
rails g scaffold organization name:string slug:string email_address:string url:string year_founded:integer info:text logo:string avatar:string requires_approval:boolean secret_question:string secret_answer:string location_id:integer user_organization_replationship_id:integer
organization_status:string
user_organization_replationship_id:integer
conference title:string slug:string start_date:datetime end_date:datetime info:text poster:string banner:string workshop_schedule_published:boolean registration_open:boolean meals_provided:boolean meal_info:text travel_info:text conference_type:conference_type_id
conference_hosts_organizations conference_id:integer organization_id:integer
- host_organizations : NtoN[organization]
- locations : *NtoN[location]
- registration_form_fields : *NtoN[registration_form_field]
- workshop_resources : *NtoN[workshop_resource]
registration_form_field
- title : string
- help : text
- required : boolean
- field_type : list(string)
- options : string
- retired : boolean
rails g scaffold

13
README.md

@ -1,12 +1,11 @@
Bike!Bike!
===========
This is the development repository for Bike!Bike!
This is the development repository for Bike!Bike! Progress can currently be seen at [bikebike.herokuapp.com](http://bikebike.herokuapp.com/)
If you're about to get started contributing please contact Godwin: `goodgodwin``@``hotmail.com`. Also try to familiarize yourself with the [technologies](#technologies) we're using, our [collaboration tools](#collaboration-tools), [requirements](#requirements-overview), [coding conventions](#coding-conventions), [style guide](#style-guide).
If you're about to get started contributing please contact Godwin: `goodgodwin``@``hotmail.com`. Also try to familiarize yourself with the [technologies](#technologies) we're using, our [collaboration tools](#collaboration-tools), [requirements](#requirements-overview), [coding conventions](#coding-conventions), [style guide](#style-guide), and [testing practices](#testing-practices).
### Technologies ###
-----
* [Ruby 2.0.0][1]
* [Rails 4.0.0][2]
@ -30,7 +29,6 @@ If you're about to get started contributing please contact Godwin: `goodgodwin``
## Collaboration Tools ##
-----
* [Trello][10]
* [GitHub][11]
@ -42,7 +40,6 @@ If you're about to get started contributing please contact Godwin: `goodgodwin``
## Requirements Overview ##
-----
Bike!Bike! is a conference which is held in and hosted by a different city each year. The conference is specifically for not for profit bicycle collectives (5013c or equivalent status is not required). There are also 'Reginal Bike!Bike!s' which can be hosted by any organization at any time of the year.
@ -116,6 +113,12 @@ If the key does not exist, the previos lines will produce the following respecti
If the user has sufficient rights, these blocks will also be surrounded by the necessary markup to allow them to be selected and edited by the user.
### Style Guide ###
On hold until our design team determines a director for our identity.
## Testing Practices ##
Once tests are set up, we will ensure 100% code coverage. This higher than normal amount is due to the fact that the application will capture all translations, on which pages they occur, and which keys are missing languages in each available language.

18
app/controllers/conferences_controller.rb

@ -34,12 +34,28 @@ class ConferencesController < ApplicationController
# PATCH/PUT /conferences/1
def update
if params[:register]
registration = ConferenceRegistration.find_by(:user_id => current_user.id, :conference_id => @conference.id)
if registration
registration.conference_registration_responses.destroy_all
else
registration = ConferenceRegistration.new(user_id: current_user.id, conference_id: @conference.id, is_attending: params[:is_attending])
end
data = Hash.new
params.each do |key, value|
matches = /^field_(\d+)(_(\d+|other))?/.match(key)
if matches
x
if matches[3] == nil
data[matches[1]] = value
else
data[matches[1]] ||= Hash.new
data[matches[1]][matches[3]] = value
end
end
end
data.each do |key, value|
registration.conference_registration_responses << ConferenceRegistrationResponse.new(registration_form_field_id: key.to_i, data: value.to_json.to_s)
end
registration.save!
render action: 'show'
elsif @conference.update(conference_params)
redirect_to @conference, notice: 'Conference was successfully updated.'

3
app/views/conferences/_form.html.haml

@ -12,8 +12,6 @@
= field f, :poster, :image_field, @conference.poster_url
= field f, :cover, :image_field, @conference.cover_url
.columns.medium-8
=# f.fields_for :conference_type do |c|
=# field c, :id, :text_field
= field f, :conference_type_id, :collection_select, ConferenceType.all, attrs: [:id, :title]
.row
.columns.small-6
@ -21,7 +19,6 @@
.columns.small-6
= field f, :end_date, :date_field
= field f, :workshop_schedule_published, :check_box
=# field f, :registration_open, :check_box
= field f, :meals_provided, :check_box
= field f, :meal_info, :text_area
= field f, :travel_info, :text_area

Loading…
Cancel
Save