The working basics
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
class ConferenceAdminsController < ApplicationController
|
||||
before_action :set_conference_admin, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /conference_admins
|
||||
def index
|
||||
@conference_admins = ConferenceAdmin.all
|
||||
end
|
||||
|
||||
# GET /conference_admins/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /conference_admins/new
|
||||
def new
|
||||
@conference_admin = ConferenceAdmin.new
|
||||
end
|
||||
|
||||
# GET /conference_admins/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /conference_admins
|
||||
def create
|
||||
@conference_admin = ConferenceAdmin.new(conference_admin_params)
|
||||
|
||||
if @conference_admin.save
|
||||
redirect_to @conference_admin, notice: 'Conference admin was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /conference_admins/1
|
||||
def update
|
||||
if @conference_admin.update(conference_admin_params)
|
||||
redirect_to @conference_admin, notice: 'Conference admin was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /conference_admins/1
|
||||
def destroy
|
||||
@conference_admin.destroy
|
||||
redirect_to conference_admins_url, notice: 'Conference admin was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_conference_admin
|
||||
@conference_admin = ConferenceAdmin.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def conference_admin_params
|
||||
params.require(:conference_admin).permit(:conference_id, :user_id)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class ConferenceHostOrganizationsController < ApplicationController
|
||||
before_action :set_conference_host_organization, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /conference_host_organizations
|
||||
def index
|
||||
@conference_host_organizations = ConferenceHostOrganization.all
|
||||
end
|
||||
|
||||
# GET /conference_host_organizations/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /conference_host_organizations/new
|
||||
def new
|
||||
@conference_host_organization = ConferenceHostOrganization.new
|
||||
end
|
||||
|
||||
# GET /conference_host_organizations/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /conference_host_organizations
|
||||
def create
|
||||
@conference_host_organization = ConferenceHostOrganization.new(conference_host_organization_params)
|
||||
|
||||
if @conference_host_organization.save
|
||||
redirect_to @conference_host_organization, notice: 'Conference host organization was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /conference_host_organizations/1
|
||||
def update
|
||||
if @conference_host_organization.update(conference_host_organization_params)
|
||||
redirect_to @conference_host_organization, notice: 'Conference host organization was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /conference_host_organizations/1
|
||||
def destroy
|
||||
@conference_host_organization.destroy
|
||||
redirect_to conference_host_organizations_url, notice: 'Conference host organization was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_conference_host_organization
|
||||
@conference_host_organization = ConferenceHostOrganization.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def conference_host_organization_params
|
||||
params.require(:conference_host_organization).permit(:conference_id, :organization_id, :order)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class ConferenceRegistrationResponsesController < ApplicationController
|
||||
before_action :set_conference_registration_response, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /conference_registration_responses
|
||||
def index
|
||||
@conference_registration_responses = ConferenceRegistrationResponse.all
|
||||
end
|
||||
|
||||
# GET /conference_registration_responses/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /conference_registration_responses/new
|
||||
def new
|
||||
@conference_registration_response = ConferenceRegistrationResponse.new
|
||||
end
|
||||
|
||||
# GET /conference_registration_responses/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /conference_registration_responses
|
||||
def create
|
||||
@conference_registration_response = ConferenceRegistrationResponse.new(conference_registration_response_params)
|
||||
|
||||
if @conference_registration_response.save
|
||||
redirect_to @conference_registration_response, notice: 'Conference registration response was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /conference_registration_responses/1
|
||||
def update
|
||||
if @conference_registration_response.update(conference_registration_response_params)
|
||||
redirect_to @conference_registration_response, notice: 'Conference registration response was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /conference_registration_responses/1
|
||||
def destroy
|
||||
@conference_registration_response.destroy
|
||||
redirect_to conference_registration_responses_url, notice: 'Conference registration response was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_conference_registration_response
|
||||
@conference_registration_response = ConferenceRegistrationResponse.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def conference_registration_response_params
|
||||
params.require(:conference_registration_response).permit(:conference_registration_id, :registration_form_field_id, :data)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class ConferenceRegistrationsController < ApplicationController
|
||||
before_action :set_conference_registration, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /conference_registrations
|
||||
def index
|
||||
@conference_registrations = ConferenceRegistration.all
|
||||
end
|
||||
|
||||
# GET /conference_registrations/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /conference_registrations/new
|
||||
def new
|
||||
@conference_registration = ConferenceRegistration.new
|
||||
end
|
||||
|
||||
# GET /conference_registrations/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /conference_registrations
|
||||
def create
|
||||
@conference_registration = ConferenceRegistration.new(conference_registration_params)
|
||||
|
||||
if @conference_registration.save
|
||||
redirect_to @conference_registration, notice: 'Conference registration was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /conference_registrations/1
|
||||
def update
|
||||
if @conference_registration.update(conference_registration_params)
|
||||
redirect_to @conference_registration, notice: 'Conference registration was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /conference_registrations/1
|
||||
def destroy
|
||||
@conference_registration.destroy
|
||||
redirect_to conference_registrations_url, notice: 'Conference registration was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_conference_registration
|
||||
@conference_registration = ConferenceRegistration.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def conference_registration_params
|
||||
params.require(:conference_registration).permit(:conference_id, :user_id, :is_attending)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class ConferenceRegistratonFormFieldsController < ApplicationController
|
||||
before_action :set_conference_registraton_form_field, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /conference_registraton_form_fields
|
||||
def index
|
||||
@conference_registraton_form_fields = ConferenceRegistratonFormField.all
|
||||
end
|
||||
|
||||
# GET /conference_registraton_form_fields/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /conference_registraton_form_fields/new
|
||||
def new
|
||||
@conference_registraton_form_field = ConferenceRegistratonFormField.new
|
||||
end
|
||||
|
||||
# GET /conference_registraton_form_fields/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /conference_registraton_form_fields
|
||||
def create
|
||||
@conference_registraton_form_field = ConferenceRegistratonFormField.new(conference_registraton_form_field_params)
|
||||
|
||||
if @conference_registraton_form_field.save
|
||||
redirect_to @conference_registraton_form_field, notice: 'Conference registraton form field was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /conference_registraton_form_fields/1
|
||||
def update
|
||||
if @conference_registraton_form_field.update(conference_registraton_form_field_params)
|
||||
redirect_to @conference_registraton_form_field, notice: 'Conference registraton form field was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /conference_registraton_form_fields/1
|
||||
def destroy
|
||||
@conference_registraton_form_field.destroy
|
||||
redirect_to conference_registraton_form_fields_url, notice: 'Conference registraton form field was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_conference_registraton_form_field
|
||||
@conference_registraton_form_field = ConferenceRegistratonFormField.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def conference_registraton_form_field_params
|
||||
params.require(:conference_registraton_form_field).permit(:conference_id, :registration_form_field_id, :order)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class ConferenceTypesController < ApplicationController
|
||||
before_action :set_conference_type, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /conference_types
|
||||
def index
|
||||
@conference_types = ConferenceType.all
|
||||
end
|
||||
|
||||
# GET /conference_types/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /conference_types/new
|
||||
def new
|
||||
@conference_type = ConferenceType.new
|
||||
end
|
||||
|
||||
# GET /conference_types/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /conference_types
|
||||
def create
|
||||
@conference_type = ConferenceType.new(conference_type_params)
|
||||
|
||||
if @conference_type.save
|
||||
redirect_to @conference_type, notice: 'Conference type was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /conference_types/1
|
||||
def update
|
||||
if @conference_type.update(conference_type_params)
|
||||
redirect_to @conference_type, notice: 'Conference type was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /conference_types/1
|
||||
def destroy
|
||||
@conference_type.destroy
|
||||
redirect_to conference_types_url, notice: 'Conference type was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_conference_type
|
||||
@conference_type = ConferenceType.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def conference_type_params
|
||||
params.require(:conference_type).permit(:title, :info)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,140 @@
|
||||
class ConferencesController < ApplicationController
|
||||
before_action :set_conference, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /conferences
|
||||
def index
|
||||
@conferences = Conference.all
|
||||
end
|
||||
|
||||
# GET /conferences/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /conferences/new
|
||||
def new
|
||||
@conference = Conference.new
|
||||
@conference.build_conference_type
|
||||
end
|
||||
|
||||
# GET /conferences/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /conferences
|
||||
def create
|
||||
@conference = Conference.new(conference_params)
|
||||
|
||||
if @conference.save
|
||||
redirect_to @conference, notice: 'Conference was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /conferences/1
|
||||
def update
|
||||
if params[:register]
|
||||
params.each do |key, value|
|
||||
matches = /^field_(\d+)(_(\d+|other))?/.match(key)
|
||||
if matches
|
||||
x
|
||||
end
|
||||
end
|
||||
render action: 'show'
|
||||
elsif @conference.update(conference_params)
|
||||
redirect_to @conference, notice: 'Conference was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def hosts
|
||||
set_conference
|
||||
@conference.conference_host_organizations.build
|
||||
end
|
||||
|
||||
def nonhosts
|
||||
set_conference
|
||||
@available_orgs = Organization.where(["id NOT IN (?)", @conference.organizations.map(&:id) + (params[:added] || [])])
|
||||
html = '<h2>Select an Organization</h2><div id="select-organization-list">'
|
||||
@available_orgs.each do |organization|
|
||||
html += '<a href="#" class="organization-preview" data-id="' + organization.id.to_s + '"><img src="' + (organization.avatar.url :thumb) + '" /><div class="username">' + (organization.name) + '</div></a>'
|
||||
end
|
||||
render :text => (html + '</div>')
|
||||
end
|
||||
|
||||
def registration
|
||||
set_conference
|
||||
@sub_action = 'registration' + (params[:sub_action] ? '_' + params[:sub_action] : '')
|
||||
if params[:sub_action] == 'form'
|
||||
@registration_form_field = RegistrationFormField.new
|
||||
@registration_form_fields = RegistrationFormField.where(["id NOT IN (?)", @conference.registration_form_fields.map(&:id)])
|
||||
end
|
||||
end
|
||||
|
||||
def add_field
|
||||
set_conference
|
||||
field = RegistrationFormField.find(params[:field])
|
||||
@conference.registration_form_fields << field
|
||||
|
||||
@registration_form_fields = RegistrationFormField.where(["id NOT IN (?)", @conference.registration_form_fields.map(&:id)])
|
||||
|
||||
form = render_to_string :partial => 'registration_form_fields/conference_form'
|
||||
list = render_to_string :partial => 'registration_form_fields/list'
|
||||
render json: {form: form, list: list}
|
||||
end
|
||||
|
||||
def remove_field
|
||||
set_conference
|
||||
field = RegistrationFormField.find(params[:field])
|
||||
@conference.registration_form_fields.delete(field)
|
||||
|
||||
@registration_form_fields = RegistrationFormField.where(["id NOT IN (?)", @conference.registration_form_fields.map(&:id)])
|
||||
|
||||
form = render_to_string :partial => 'registration_form_fields/conference_form'
|
||||
list = render_to_string :partial => 'registration_form_fields/list'
|
||||
render json: {form: form, list: list}
|
||||
end
|
||||
|
||||
def reorder
|
||||
set_conference
|
||||
params[:registration_form_field_id].each do |key, value|
|
||||
update_field_position(value.to_i, params[:position][key].to_i)
|
||||
end
|
||||
render json: [].to_json
|
||||
end
|
||||
|
||||
def form
|
||||
set_conference
|
||||
end
|
||||
|
||||
# DELETE /conferences/1
|
||||
def destroy
|
||||
@conference.destroy
|
||||
redirect_to conferences_url, notice: 'Conference was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_conference
|
||||
@conference = Conference.find_by(slug: params[:slug] || params[:conference_slug])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def conference_params
|
||||
params.require(:conference).permit(:title, :slug, :start_date, :end_date, :info, :poster, :cover, :workshop_schedule_published, :registration_open, :meals_provided, :meal_info, :travel_info, :conference_type_id, conference_types: [:id])
|
||||
end
|
||||
|
||||
def update_field_position(field_id, position)
|
||||
#ConferenceRegistrationFormField.where(:conference_id => @conference.id, :registration_form_field_id => field_id).update_all(:position => position)
|
||||
data = []
|
||||
for i in 0..@conference.conference_registration_form_fields.length
|
||||
f = @conference.conference_registration_form_fields[i]
|
||||
if f.registration_form_field_id == field_id
|
||||
data << (f.registration_form_field_id.to_s + ' == ' + field_id.to_s + ' [position: ' + position.to_s + ' == ' + f.position.to_s + ']')
|
||||
f.update_attributes(:position => position)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class LocationsController < ApplicationController
|
||||
before_action :set_location, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /locations
|
||||
def index
|
||||
@locations = Location.all
|
||||
end
|
||||
|
||||
# GET /locations/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /locations/new
|
||||
def new
|
||||
@location = Location.new
|
||||
end
|
||||
|
||||
# GET /locations/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /locations
|
||||
def create
|
||||
@location = Location.new(location_params)
|
||||
|
||||
if @location.save
|
||||
redirect_to @location, notice: 'Location was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /locations/1
|
||||
def update
|
||||
if @location.update(location_params)
|
||||
redirect_to @location, notice: 'Location was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /locations/1
|
||||
def destroy
|
||||
@location.destroy
|
||||
redirect_to locations_url, notice: 'Location was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_location
|
||||
@location = Location.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def location_params
|
||||
params.require(:location).permit(:title, :address, :latitude, :longitude)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class OrganizationStatusesController < ApplicationController
|
||||
before_action :set_organization_status, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /organization_statuses
|
||||
def index
|
||||
@organization_statuses = OrganizationStatus.all
|
||||
end
|
||||
|
||||
# GET /organization_statuses/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /organization_statuses/new
|
||||
def new
|
||||
@organization_status = OrganizationStatus.new
|
||||
end
|
||||
|
||||
# GET /organization_statuses/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /organization_statuses
|
||||
def create
|
||||
@organization_status = OrganizationStatus.new(organization_status_params)
|
||||
|
||||
if @organization_status.save
|
||||
redirect_to @organization_status, notice: 'Organization status was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /organization_statuses/1
|
||||
def update
|
||||
if @organization_status.update(organization_status_params)
|
||||
redirect_to @organization_status, notice: 'Organization status was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /organization_statuses/1
|
||||
def destroy
|
||||
@organization_status.destroy
|
||||
redirect_to organization_statuses_url, notice: 'Organization status was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_organization_status
|
||||
@organization_status = OrganizationStatus.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def organization_status_params
|
||||
params.require(:organization_status).permit(:name, :slug, :info)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,96 @@
|
||||
class OrganizationsController < ApplicationController
|
||||
before_action :set_organization, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
before_filter :require_login, :except => [:index, :show]
|
||||
|
||||
# GET /organizations
|
||||
def index
|
||||
@organizations = Organization.all
|
||||
end
|
||||
|
||||
# GET /organizations/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /organizations/new
|
||||
def new
|
||||
@organization = Organization.new
|
||||
#@organization.location = Location.new
|
||||
@organization.locations.build
|
||||
@organization.locations_organization.build
|
||||
@organization.user_organization_relationships.build
|
||||
end
|
||||
|
||||
# GET /organizations/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /organizations
|
||||
def create
|
||||
@organization = Organization.new(organization_params)
|
||||
params[:organization][:locations_attributes].each do |k, v|
|
||||
@organization.locations << Location.new(locations_organization_params(k))
|
||||
end
|
||||
@organization.user_organization_relationship << UserOrganizationRelationship.new(:user_id => current_user.id, :relationship => UserOrganizationRelationship::Administrator)
|
||||
|
||||
if @organization.save!
|
||||
redirect_to @organization, notice: 'Organization was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /organizations/1
|
||||
def update
|
||||
if @organization.update_attributes(organization_params)
|
||||
redirect_to @organization, notice: 'Organization was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /organizations/1
|
||||
def destroy
|
||||
@organization.destroy
|
||||
redirect_to organizations_url, notice: 'Organization was successfully destroyed.'
|
||||
end
|
||||
|
||||
def members
|
||||
set_organization
|
||||
@organization.user_organization_relationships.build
|
||||
end
|
||||
|
||||
def nonmembers
|
||||
set_organization
|
||||
#puts "\n\tPARAMS: " + params[:addedUsers].to_json.to_s + "\n"
|
||||
@available_users = User.where(["id NOT IN (?)", @organization.users.map(&:id) + (params[:added] || [])])
|
||||
html = '<h2>Select a User</h2><div id="select-user-list">'
|
||||
@available_users.each do |user|
|
||||
html += '<a href="#" class="user-preview" data-id="' + user.id.to_s + '"><img src="' + (user.avatar.url :thumb) + '" /><div class="username">' + (user.username) + '</div></a>'
|
||||
end
|
||||
render :text => (html + '</div>')
|
||||
end
|
||||
|
||||
def identity
|
||||
set_organization
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_organization
|
||||
@organization = Organization.find_by(slug: params[:slug] || params[:organization_slug])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def organization_params
|
||||
params.require(:organization).permit(:name, :slug, :email_address, :url, :year_founded, :info, :logo, :avatar, :cover, :requires_approval, :secret_question, :secret_answer, user_organization_relationships_attributes: [:id, :user_id, :relationship, :_destroy], locations: [:country, :territory, :city, :street, :postal_code])
|
||||
end
|
||||
|
||||
def locations_organization_params(index)
|
||||
params[:organization][:locations_attributes].require(index.to_s).permit(:country, :territory, :city, :street, :postal_code)
|
||||
end
|
||||
|
||||
def user_organization_params(index)
|
||||
params[:organization][:user_organization_relationships_attributes].require(index.to_s).permit(:user_id, :relationship)
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,60 @@
|
||||
require 'rubygems'
|
||||
require 'ruby_drupal_hash'
|
||||
|
||||
include ApplicationHelper
|
||||
|
||||
class PagesController < ApplicationController
|
||||
|
||||
def home
|
||||
@title_img = '/assets/nola.jpg'
|
||||
#password = ""
|
||||
#hash = ""
|
||||
#@testResult = RubyDrupalHash::verify(password, hash)
|
||||
end
|
||||
|
||||
def translate
|
||||
key = params[:translationkey]
|
||||
value = params[:translationvalue]
|
||||
if params[:translationhascount] == '1'
|
||||
['zero', 'one', 'two', 'few', 'many'].each { |c|
|
||||
if params['translationpluralization_' + c]
|
||||
if !value.is_a?(Hash)
|
||||
value = Hash.new
|
||||
end
|
||||
value[c] = params['translationvalue_' + c]
|
||||
else
|
||||
Translation.destroy_all(:locale => params[:translationlang], :key => (key + '.' + c))
|
||||
end
|
||||
}
|
||||
if value.is_a?(Hash)
|
||||
value['other'] = params[:translationvalue]
|
||||
Translation.destroy_all(:locale => params[:translationlang], :key => key)
|
||||
else
|
||||
Translation.destroy_all(:locale => params[:translationlang], :key => (key + '.other'))
|
||||
end
|
||||
end
|
||||
store_translations(params[:translationlang], {key => value}, :escape => false)
|
||||
begin
|
||||
render json: {success: true, key: key, jkey: key.gsub('.', '--'), translation: I18n.translate!(key, {:raise => false})}
|
||||
rescue
|
||||
render json: {error: 'Failed to load translation'}
|
||||
end
|
||||
end
|
||||
|
||||
def location_territories
|
||||
#render json: (Carmen:::RegionCollection.new(Carmen::Country.coded(params[:country])) || []).to_json
|
||||
territories = {}
|
||||
Carmen::Country.coded(params[:country]).subregions.each { |t| territories[t.code] = t.name }
|
||||
render json: territories.to_json
|
||||
end
|
||||
|
||||
private
|
||||
def store_translations(locale, data, options = {})
|
||||
escape = options.fetch(:escape, true)
|
||||
I18n.backend.flatten_translations(locale, data, escape, false).each do |key, value|
|
||||
t = Translation.find_or_create_by!(locale: locale.to_s, key: key.to_s)
|
||||
t.value = value
|
||||
t.save
|
||||
end
|
||||
I18n.backend.reload!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
class RegistrationFormFieldsController < ApplicationController
|
||||
before_action :set_registration_form_field, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /registration_form_fields
|
||||
def index
|
||||
@registration_form_fields = RegistrationFormField.all
|
||||
end
|
||||
|
||||
# GET /registration_form_fields/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /registration_form_fields/new
|
||||
def new
|
||||
@registration_form_field = RegistrationFormField.new
|
||||
end
|
||||
|
||||
# GET /registration_form_fields/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /registration_form_fields
|
||||
def create
|
||||
@registration_form_field = RegistrationFormField.new(registration_form_field_params)
|
||||
ajax_return(@registration_form_field.save)
|
||||
end
|
||||
|
||||
# PATCH/PUT /registration_form_fields/1
|
||||
def update
|
||||
ajax_return(@registration_form_field.update(registration_form_field_params))
|
||||
end
|
||||
|
||||
# DELETE /registration_form_fields/1
|
||||
def destroy
|
||||
@registration_form_field.destroy
|
||||
redirect_to registration_form_fields_url, notice: 'Registration form field was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
def ajax_return(success)
|
||||
@registration_form_fields = RegistrationFormField.all
|
||||
if success
|
||||
@registration_form_field = RegistrationFormField.new
|
||||
end
|
||||
|
||||
form = render_to_string :partial => 'form'
|
||||
list = render_to_string :partial => 'list'
|
||||
render json: {form: form, list: list}
|
||||
end
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_registration_form_field
|
||||
@registration_form_field = RegistrationFormField.find(params[:id])
|
||||
end
|
||||
|
||||
# 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
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class UserOrganizationRelationshipsController < ApplicationController
|
||||
before_action :set_user_organization_relationship, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /user_organization_relationships
|
||||
def index
|
||||
@user_organization_relationships = UserOrganizationRelationship.all
|
||||
end
|
||||
|
||||
# GET /user_organization_relationships/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /user_organization_relationships/new
|
||||
def new
|
||||
@user_organization_relationship = UserOrganizationRelationship.new
|
||||
end
|
||||
|
||||
# GET /user_organization_relationships/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /user_organization_relationships
|
||||
def create
|
||||
@user_organization_relationship = UserOrganizationRelationship.new(user_organization_relationship_params)
|
||||
|
||||
if @user_organization_relationship.save
|
||||
redirect_to @user_organization_relationship, notice: 'User organization relationship was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /user_organization_relationships/1
|
||||
def update
|
||||
if @user_organization_relationship.update(user_organization_relationship_params)
|
||||
redirect_to @user_organization_relationship, notice: 'User organization relationship was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /user_organization_relationships/1
|
||||
def destroy
|
||||
@user_organization_relationship.destroy
|
||||
redirect_to user_organization_relationships_url, notice: 'User organization relationship was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_user_organization_relationship
|
||||
@user_organization_relationship = UserOrganizationRelationship.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def user_organization_relationship_params
|
||||
params.require(:user_organization_relationship).permit(:user_id, :organization_id, :relationship)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
class UserSessionsController < ApplicationController
|
||||
def new
|
||||
session[:return_to] ||= request.referer
|
||||
@user = User.new
|
||||
end
|
||||
|
||||
def create
|
||||
if @user = login(params[:email], params[:password])
|
||||
#redirect_back_or_to(:users, notice: 'Login successful')
|
||||
redirect_to session.delete(:return_to)
|
||||
else
|
||||
flash.now[:alert] = "Login failed"
|
||||
render action: "new"
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
logout
|
||||
redirect_to(:users, notice: 'Logged out!')
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,68 @@
|
||||
include ApplicationHelper
|
||||
|
||||
class UsersController < ApplicationController
|
||||
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /users
|
||||
def index
|
||||
@users = User.all
|
||||
end
|
||||
|
||||
# GET /users/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /users/new
|
||||
def new
|
||||
@user = User.new
|
||||
end
|
||||
|
||||
# GET /users/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /users
|
||||
def create
|
||||
@user = User.new(user_params)
|
||||
|
||||
if @user.save
|
||||
redirect_to @user, notice: 'User was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /users/1
|
||||
def update
|
||||
#if !user_params[:password] || user_params[:password].length < 1
|
||||
# puts "\nNo Password! ( " + @user.to_json.to_s + " \n"
|
||||
# user_params[:password] = user_params[:password_confirmation] = 'Oha1otbt!@#'
|
||||
#end
|
||||
if @user.update(user_params)
|
||||
redirect_to @user, notice: 'User was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /users/1
|
||||
def destroy
|
||||
@user.destroy
|
||||
redirect_to users_url, notice: 'User was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_user
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def session_params
|
||||
params.require(:user).permit(:username, :email, :password, :avatar, :avatar_cache)
|
||||
end
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:username, :email, :password, :password_confirmation, :avatar, :avatar_cache, :remove_avatar)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,2 @@
|
||||
class VersionsController < ApplicationController
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class WorkshopPresentationStylesController < ApplicationController
|
||||
before_action :set_workshop_presentation_style, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /workshop_presentation_styles
|
||||
def index
|
||||
@workshop_presentation_styles = WorkshopPresentationStyle.all
|
||||
end
|
||||
|
||||
# GET /workshop_presentation_styles/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /workshop_presentation_styles/new
|
||||
def new
|
||||
@workshop_presentation_style = WorkshopPresentationStyle.new
|
||||
end
|
||||
|
||||
# GET /workshop_presentation_styles/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /workshop_presentation_styles
|
||||
def create
|
||||
@workshop_presentation_style = WorkshopPresentationStyle.new(workshop_presentation_style_params)
|
||||
|
||||
if @workshop_presentation_style.save
|
||||
redirect_to @workshop_presentation_style, notice: 'Workshop presentation style was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /workshop_presentation_styles/1
|
||||
def update
|
||||
if @workshop_presentation_style.update(workshop_presentation_style_params)
|
||||
redirect_to @workshop_presentation_style, notice: 'Workshop presentation style was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /workshop_presentation_styles/1
|
||||
def destroy
|
||||
@workshop_presentation_style.destroy
|
||||
redirect_to workshop_presentation_styles_url, notice: 'Workshop presentation style was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_workshop_presentation_style
|
||||
@workshop_presentation_style = WorkshopPresentationStyle.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def workshop_presentation_style_params
|
||||
params.require(:workshop_presentation_style).permit(:name, :slug, :info)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class WorkshopResourcesController < ApplicationController
|
||||
before_action :set_workshop_resource, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /workshop_resources
|
||||
def index
|
||||
@workshop_resources = WorkshopResource.all
|
||||
end
|
||||
|
||||
# GET /workshop_resources/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /workshop_resources/new
|
||||
def new
|
||||
@workshop_resource = WorkshopResource.new
|
||||
end
|
||||
|
||||
# GET /workshop_resources/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /workshop_resources
|
||||
def create
|
||||
@workshop_resource = WorkshopResource.new(workshop_resource_params)
|
||||
|
||||
if @workshop_resource.save
|
||||
redirect_to @workshop_resource, notice: 'Workshop resource was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /workshop_resources/1
|
||||
def update
|
||||
if @workshop_resource.update(workshop_resource_params)
|
||||
redirect_to @workshop_resource, notice: 'Workshop resource was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /workshop_resources/1
|
||||
def destroy
|
||||
@workshop_resource.destroy
|
||||
redirect_to workshop_resources_url, notice: 'Workshop resource was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_workshop_resource
|
||||
@workshop_resource = WorkshopResource.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def workshop_resource_params
|
||||
params.require(:workshop_resource).permit(:name, :slug, :info)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,58 @@
|
||||
class WorkshopStreamsController < ApplicationController
|
||||
before_action :set_workshop_stream, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /workshop_streams
|
||||
def index
|
||||
@workshop_streams = WorkshopStream.all
|
||||
end
|
||||
|
||||
# GET /workshop_streams/1
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /workshop_streams/new
|
||||
def new
|
||||
@workshop_stream = WorkshopStream.new
|
||||
end
|
||||
|
||||
# GET /workshop_streams/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /workshop_streams
|
||||
def create
|
||||
@workshop_stream = WorkshopStream.new(workshop_stream_params)
|
||||
|
||||
if @workshop_stream.save
|
||||
redirect_to @workshop_stream, notice: 'Workshop stream was successfully created.'
|
||||
else
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /workshop_streams/1
|
||||
def update
|
||||
if @workshop_stream.update(workshop_stream_params)
|
||||
redirect_to @workshop_stream, notice: 'Workshop stream was successfully updated.'
|
||||
else
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /workshop_streams/1
|
||||
def destroy
|
||||
@workshop_stream.destroy
|
||||
redirect_to workshop_streams_url, notice: 'Workshop stream was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_workshop_stream
|
||||
@workshop_stream = WorkshopStream.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a trusted parameter "white list" through.
|
||||
def workshop_stream_params
|
||||
params.require(:workshop_stream).permit(:name, :slug, :info)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user