Add the ability for Rooms to have a URL.

The URL is shown on the schedule and the event/proposal page.
The URL is only when a user is logged in and registered.
This commit is contained in:
Michael Ball 2020-07-10 20:18:10 -07:00
parent 636ad2cebd
commit 7d2135f851
9 changed files with 39 additions and 17 deletions

View file

@ -115,6 +115,9 @@ $(document).ready( function() {
});
function eventClicked(e, element){
if (e.target.href) {
return;
}
var url = $(element).data('url');
if(e.ctrlKey)
window.open(url,'_blank');

View file

@ -48,7 +48,7 @@ module Admin
private
def room_params
params.require(:room).permit(:name, :size)
params.require(:room).permit(:name, :size, :url)
end
end
end

View file

@ -11,5 +11,8 @@
= semantic_form_for(@room, url: (@room.new_record? ? admin_conference_venue_rooms_path : admin_conference_venue_room_path(@conference.short_title, @room))) do |f|
= f.input :name, input_html: { autofocus: true }
= f.input :size, label: 'Capacity', input_html: {size: 5}
= f.input :url, label: 'URL'
%p.small
The URL is only visible to registered attendees.
%p.text-right
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }

View file

@ -12,6 +12,7 @@
%thead
%th Name
%th Capacity
%th URL
%th Actions
%tbody
- @rooms.each_with_index do |room, index|
@ -21,11 +22,13 @@
%td
= room.size
%td
= link_to 'Edit', edit_admin_conference_venue_room_path(@conference.short_title, room.id),
method: :get, class: 'btn btn-primary'
= link_to 'Delete', admin_conference_venue_room_path(@conference.short_title, room.id),
= room.url
%td
= link_to 'Edit', edit_admin_conference_venue_room_path(@conference.short_title, room.id), class: 'btn btn-primary'
= link_to('Delete',
admin_conference_venue_room_path(@conference.short_title, room.id),
method: :delete, class: 'btn btn-danger',
data: { confirm: "Do you really want to delete #{room.name}? Attention: This room will be removed from all Events that have it set"}
data: { confirm: "Do you really want to delete #{room.name}? Attention: This room will be removed from all Events that have it set"})
.row
.col-md-12.text-right
= link_to 'Add Room', new_admin_conference_venue_room_path(@conference.short_title), class: 'btn btn-primary'

View file

@ -8,18 +8,22 @@
%meta{ property: "og:image:secure_url", content: @speakers_ordered.first.gravatar_url }
.container
.row
.col-md-12.page-header
.row.page-header
.col-md-10
%h2
= @event.title
- if @event.subtitle
%br
%small
= @event.subtitle
.btn-group.pull-right
- if can? :update, @event
- if @event.room&.url && @conference.user_registered?(current_user)
%h3
= link_to('Join Event', @event.room.url, target: '_blank')
.col-md-2
%p{style: "margin-top: 20px"}
- if can?(:update, @event) && @event.require_registration?
= link_to 'Registrations', registrations_conference_program_proposal_path(@conference.short_title, @event), class: 'btn btn-mini btn-success'
- if can? :edit, @event
- if can?(:edit, @event)
= link_to "Edit", edit_conference_program_proposal_path(@conference.short_title, @event), class: 'btn btn-mini btn-primary'
- if can? :schedule, @conference
= link_to "Schedule", conference_schedule_path(@conference.short_title), class: 'btn btn-success'

View file

@ -17,6 +17,9 @@
%h4
- if(event.speakers.any?)
presented by #{event.speaker_names}
- if event.room&.url && @conference.user_registered?(current_user)
%p
= link_to('Join Event', event.room.url, target: '_blank')
%p
= markdown(truncate(event.abstract, length: 400))
= link_to 'more', conference_program_proposal_path(@conference.short_title, event.id) if event.abstract.length > 400

View file

@ -0,0 +1,5 @@
class AddUrlToRooms < ActiveRecord::Migration[5.2]
def change
add_column :rooms, :url, :text
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2020_03_31_214534) do
ActiveRecord::Schema.define(version: 2020_07_10_215300) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -406,6 +406,7 @@ ActiveRecord::Schema.define(version: 2020_03_31_214534) do
t.string "name", null: false
t.integer "size"
t.integer "venue_id", null: false
t.text "url"
end
create_table "schedules", force: :cascade do |t|