initialize invites
Invites model,controller and views are initialized. add datepicker and selectize in invites#new calender is added for end date field and selectize is added for emails field to allow multiple emails in field
This commit is contained in:
parent
a96722b3c3
commit
654760c3fc
8 changed files with 77 additions and 2 deletions
|
|
@ -32,6 +32,12 @@ $(function () {
|
||||||
minDate : $("#registration-arrival-datepicker").attr('start_date')
|
minDate : $("#registration-arrival-datepicker").attr('start_date')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#invitation-end-date').datetimepicker({
|
||||||
|
format: 'YYYY-MM-DD',
|
||||||
|
maxDate : $("#invitation-end-date").attr('end_date'),
|
||||||
|
minDate : today
|
||||||
|
});
|
||||||
|
|
||||||
$("#registration-arrival-datepicker").on("dp.change",function (e) {
|
$("#registration-arrival-datepicker").on("dp.change",function (e) {
|
||||||
// departure_date > start_date,arrival_date
|
// departure_date > start_date,arrival_date
|
||||||
if ((new Date(e.date).getTime()) > (new Date($("#registration-arrival-datepicker").attr('start_date')).getTime())){
|
if ((new Date(e.date).getTime()) > (new Date($("#registration-arrival-datepicker").attr('start_date')).getTime())){
|
||||||
|
|
|
||||||
11
app/controllers/admin/invites_controller.rb
Normal file
11
app/controllers/admin/invites_controller.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
module Admin
|
||||||
|
class InvitesController < Admin::BaseController
|
||||||
|
load_and_authorize_resource :conference, find_by: :short_title
|
||||||
|
|
||||||
|
def new
|
||||||
|
@invite = @conference.invites.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create; end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -33,6 +33,7 @@ class Conference < ApplicationRecord
|
||||||
has_many :resources, dependent: :destroy
|
has_many :resources, dependent: :destroy
|
||||||
has_many :booths, dependent: :destroy
|
has_many :booths, dependent: :destroy
|
||||||
has_many :confirmed_booths, -> { where(state: 'confirmed') }, class_name: 'Booth'
|
has_many :confirmed_booths, -> { where(state: 'confirmed') }, class_name: 'Booth'
|
||||||
|
has_many :invites, dependent: :destroy
|
||||||
|
|
||||||
has_many :lodgings, dependent: :destroy
|
has_many :lodgings, dependent: :destroy
|
||||||
has_many :registrations, dependent: :destroy
|
has_many :registrations, dependent: :destroy
|
||||||
|
|
|
||||||
8
app/models/invite.rb
Normal file
8
app/models/invite.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
class Invite < ApplicationRecord
|
||||||
|
attr_accessor :emails
|
||||||
|
belongs_to :conference
|
||||||
|
|
||||||
|
validates :end_date, presence: true
|
||||||
|
validates :invite_for, presence: true
|
||||||
|
validates :user_id, presence: true, uniqueness: { scope: [:invite_for, :conference_id] }
|
||||||
|
end
|
||||||
28
app/views/admin/invites/new.html.haml
Normal file
28
app/views/admin/invites/new.html.haml
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
.row
|
||||||
|
.col-md-offset-1.col-md-8
|
||||||
|
%h1.text-center Late Submission Invitation
|
||||||
|
= semantic_form_for(@invite, url: admin_conference_invites_path, html: { multipart: true }) do |f|
|
||||||
|
= f.input :emails, class: 'form-control', required: true,
|
||||||
|
hint: 'Add emails to invite people to join the app and submit requests after the cfps deadline.'
|
||||||
|
= f.input :invite_for, as: :select, collection: ['Track', (t 'booth').capitalize]
|
||||||
|
= f.input :end_date, as: :string, input_html: { id: 'invitation-end-date', end_date: @conference.end_date }
|
||||||
|
%p.text-right
|
||||||
|
= f.submit 'Submit', class: 'btn btn-success'
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#invite_emails').selectize({
|
||||||
|
plugins: ['remove_button'],
|
||||||
|
delimiter: ',',
|
||||||
|
persist: false,
|
||||||
|
create: function(input) {
|
||||||
|
if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(input)){
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
value: input,
|
||||||
|
text: input
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} )
|
||||||
|
});
|
||||||
|
|
@ -45,7 +45,7 @@ Osem::Application.routes.draw do
|
||||||
get '/volunteers_list' => 'volunteers#show'
|
get '/volunteers_list' => 'volunteers#show'
|
||||||
get '/volunteers' => 'volunteers#index', as: 'volunteers_info'
|
get '/volunteers' => 'volunteers#index', as: 'volunteers_info'
|
||||||
patch '/volunteers' => 'volunteers#update', as: 'volunteers_update'
|
patch '/volunteers' => 'volunteers#update', as: 'volunteers_update'
|
||||||
|
resources :invites
|
||||||
resources :booths do
|
resources :booths do
|
||||||
member do
|
member do
|
||||||
patch :accept
|
patch :accept
|
||||||
|
|
|
||||||
12
db/migrate/20190810082925_create_invites.rb
Normal file
12
db/migrate/20190810082925_create_invites.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
class CreateInvites < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
create_table :invites do |t|
|
||||||
|
t.integer :conference_id
|
||||||
|
t.integer :user_id
|
||||||
|
t.date :end_date
|
||||||
|
t.text :invite_for
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
11
db/schema.rb
11
db/schema.rb
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2019_06_12_161235) do
|
ActiveRecord::Schema.define(version: 2019_08_10_082925) do
|
||||||
|
|
||||||
create_table "answers", force: :cascade do |t|
|
create_table "answers", force: :cascade do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
|
|
@ -264,6 +264,15 @@ ActiveRecord::Schema.define(version: 2019_06_12_161235) do
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "invites", force: :cascade do |t|
|
||||||
|
t.integer "conference_id"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.date "end_date"
|
||||||
|
t.text "invite_for"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "lodgings", force: :cascade do |t|
|
create_table "lodgings", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue