Merge 5fe99dd041 into d14297712f
This commit is contained in:
commit
31b9c0ca1a
26 changed files with 352 additions and 130 deletions
|
|
@ -1,23 +1,57 @@
|
||||||
module Admin
|
module Admin
|
||||||
class LodgingsController < ApplicationController
|
class LodgingsController < ApplicationController
|
||||||
before_filter :verify_organizer
|
before_filter :verify_organizer
|
||||||
|
before_action :set_lodging, only: [:edit, :update, :destroy]
|
||||||
|
before_action :set_venue, only: [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@venue = @conference.venue
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def new
|
||||||
|
@lodging = @conference.venue.lodgings.build
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@lodging = @conference.venue.lodgings.build(lodging_params)
|
||||||
|
|
||||||
|
if @lodging.save
|
||||||
|
redirect_to admin_conference_lodgings_path(@conference.short_title), notice: 'Lodging was successfully created.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "A error prohibited this Lodging from being saved: #{@lodging.errors.full_messages.join('. ')}."
|
||||||
|
render :new
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@venue = @conference.venue
|
if @lodging.update_attributes(lodging_params)
|
||||||
if @venue.update_attributes(params[:venue])
|
|
||||||
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
|
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
|
||||||
notice: 'Lodgings were successfully updated.')
|
notice: 'Lodging was successfully updated.')
|
||||||
else
|
else
|
||||||
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
|
flash[:alert] = "A error prohibited this Lodging from being saved: #{@venue.errors.full_messages.join('. ')}."
|
||||||
notice: 'Updating lodgings failed!')
|
render :edit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@lodging.destroy
|
||||||
|
redirect_to admin_conference_lodgings_path, notice: 'Lodging was successfully destroyed.'
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_lodging
|
||||||
|
@lodging = Lodging.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_venue
|
||||||
|
@venue = @conference.venue
|
||||||
|
end
|
||||||
|
|
||||||
|
def lodging_params
|
||||||
|
params[:lodging]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,54 @@
|
||||||
class Admin::RoomsController < ApplicationController
|
class Admin::RoomsController < ApplicationController
|
||||||
before_filter :verify_organizer
|
before_action :set_room, only: [:edit, :update, :destroy]
|
||||||
|
before_action :set_conference
|
||||||
|
|
||||||
def show
|
def index
|
||||||
render :rooms_list
|
@rooms = @conference.rooms
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@room = @conference.rooms.build
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@room = @conference.rooms.build(room_params)
|
||||||
|
|
||||||
|
if @room.save
|
||||||
|
redirect_to admin_conference_rooms_path(@conference.short_title), notice: 'Room was successfully created.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "A error prohibited this Rooms from being saved: #{@room.errors.full_messages.join('. ')}."
|
||||||
|
render :new
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @conference.update_attributes(params[:conference])
|
if @room.update(room_params)
|
||||||
redirect_to(admin_conference_rooms_path(
|
redirect_to admin_conference_rooms_path(@conference.short_title), notice: 'Room was successfully updated.'
|
||||||
conference_id: @conference.short_title),
|
|
||||||
notice: 'Rooms were successfully updated.')
|
|
||||||
else
|
else
|
||||||
redirect_to(admin_conference_rooms_path(
|
flash[:alert] = "A error prohibited this Rooms from being saved: #{@room.errors.full_messages.join('. ')}."
|
||||||
conference_id: @conference.short_title),
|
render :edit
|
||||||
notice: 'Room update failed.')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@room.destroy
|
||||||
|
redirect_to admin_conference_rooms_path, notice: 'Room was successfully destroyed.'
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_conference
|
||||||
|
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_room
|
||||||
|
@room = Room.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def room_params
|
||||||
|
params[:room]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,34 @@
|
||||||
class Admin::VenueController < ApplicationController
|
class Admin::VenuesController < ApplicationController
|
||||||
before_filter :verify_organizer
|
before_filter :verify_organizer
|
||||||
|
before_action :set_venue, only: [:update, :edit]
|
||||||
def index
|
|
||||||
end
|
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@venue = @conference.venue
|
@venue.assign_attributes(venue_params)
|
||||||
@venue.assign_attributes(params[:venue])
|
|
||||||
venue_notify = (@venue.name_changed? || @venue.address_changed?) &&
|
venue_notify = (@venue.name_changed? || @venue.address_changed?) &&
|
||||||
(!@venue.name.blank? && !@venue.address.blank?) &&
|
(!@venue.name.blank? && !@venue.address.blank?) &&
|
||||||
(@conference.email_settings.send_on_venue_update &&
|
(@conference.email_settings.send_on_venue_update &&
|
||||||
!@conference.email_settings.venue_update_subject.blank? &&
|
!@conference.email_settings.venue_update_subject.blank? &&
|
||||||
@conference.email_settings.venue_update_template)
|
@conference.email_settings.venue_update_template)
|
||||||
|
|
||||||
if @venue.update_attributes(params[:venue])
|
if @venue.save
|
||||||
Mailbot.delay.send_email_on_venue_update(@conference) if venue_notify
|
Mailbot.delay.send_email_on_venue_update(@conference) if venue_notify
|
||||||
redirect_to(admin_conference_venue_info_path(conference_id: @conference.short_title),
|
redirect_to(:back, notice: 'Venue was successfully updated.')
|
||||||
notice: 'Venue was successfully updated.')
|
|
||||||
else
|
else
|
||||||
redirect_to(admin_conference_venue_info_path(conference_id: @conference.short_title),
|
redirect_to(:back,
|
||||||
notice: 'Venue Updation Failed!')
|
notice: 'Venue Updation Failed!')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def venue_params
|
||||||
|
params[:venue]
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_venue
|
||||||
@venue = @conference.venue
|
@venue = @conference.venue
|
||||||
render :venue_info
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
= link_to 'Set up call for papers', admin_conference_callforpapers_path(conference_progress['short_title'])
|
= link_to 'Set up call for papers', admin_conference_callforpapers_path(conference_progress['short_title'])
|
||||||
%li{'class'=>class_for_todo(conference_progress['venue'])}
|
%li{'class'=>class_for_todo(conference_progress['venue'])}
|
||||||
%span{'class'=>icon_for_todo(conference_progress['venue'])}
|
%span{'class'=>icon_for_todo(conference_progress['venue'])}
|
||||||
= link_to 'Add venue', admin_conference_venue_info_path(conference_progress['short_title'])
|
= link_to 'Add venues', edit_admin_conference_venue_path(conference_progress['short_title'])
|
||||||
%li{'class'=>class_for_todo(conference_progress['rooms'])}
|
%li{'class'=>class_for_todo(conference_progress['rooms'])}
|
||||||
%span{'class'=>icon_for_todo(conference_progress['rooms'])}
|
%span{'class'=>icon_for_todo(conference_progress['rooms'])}
|
||||||
= link_to 'Add rooms', admin_conference_rooms_path(conference_progress['short_title'])
|
= link_to 'Add rooms', admin_conference_rooms_path(conference_progress['short_title'])
|
||||||
|
|
|
||||||
8
app/views/admin/lodgings/_form.html.haml
Normal file
8
app/views/admin/lodgings/_form.html.haml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
= f.inputs do
|
||||||
|
= f.input :name
|
||||||
|
= f.input :description, :input_html => {:rows => 2, data: { provide: "markdown-editable" } }, hint: markdown_hint("Write about the hotel/place, of what they are offering, about types of rooms, prices and address.")
|
||||||
|
= image_tag f.object.photo(:thumb) if !f.object.photo.blank?
|
||||||
|
= f.input :photo
|
||||||
|
= f.input :website_link
|
||||||
|
.actions
|
||||||
|
= f.button 'Save Lodging', class: 'btn btn-primary'
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
<div class="nested-fields">
|
|
||||||
<%= f.inputs do %>
|
|
||||||
<%= f.input :name %>
|
|
||||||
<%= f.input :description, :input_html => {:rows => 2, data: { provide: "markdown-editable" } }, hint: markdown_hint("Write about the hotel/place, of what they are offering, about types of rooms, prices and address.") %>
|
|
||||||
<%= image_tag f.object.photo(:thumb) if !f.object.photo.blank? %>
|
|
||||||
<%= f.input :photo %>
|
|
||||||
<%= f.input :website_link %>
|
|
||||||
<%= remove_association_link :lodging, f %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
6
app/views/admin/lodgings/edit.html.haml
Normal file
6
app/views/admin/lodgings/edit.html.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
%h1 Editing Lodging
|
||||||
|
|
||||||
|
= semantic_form_for @lodging, url: admin_conference_lodging_path(conference_id: @conference.short_title, id: @lodging.id) do |f|
|
||||||
|
= render 'form', f: f
|
||||||
|
|
||||||
|
= link_to 'Back', admin_conference_lodgings_path
|
||||||
|
|
@ -1,6 +1,37 @@
|
||||||
.row
|
.row
|
||||||
.col-md-8
|
.col-md-8
|
||||||
= semantic_form_for(@venue, :url => admin_conference_lodging_path(@conference.short_title, @conference.venue.lodgings), :html => {:multipart => true}) do |f|
|
= semantic_form_for(@venue, :url => admin_conference_venue_path(@conference.short_title, @conference.venue)) do |f|
|
||||||
= f.input :include_lodgings_in_splash, hint: 'On setting this true you will enable the lodgings to be displayed on the splash page'
|
= f.input :include_lodgings_in_splash, hint: 'On setting this true you will enable the lodgings to be displayed on the splash page'
|
||||||
= dynamic_association :lodgings, "Lodgings", f
|
|
||||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||||
|
%hr
|
||||||
|
|
||||||
|
- @venue.lodgings.each_slice(3) do |slice|
|
||||||
|
.row.row-flex.row-flex-wrap
|
||||||
|
- slice.each do |lodging|
|
||||||
|
.col-md-4
|
||||||
|
.thumbnail.flex-col
|
||||||
|
%h3.text-center
|
||||||
|
= lodging.name
|
||||||
|
- unless lodging.photo.blank?
|
||||||
|
= image_tag(lodging.photo(:large), class: 'img-responsive')
|
||||||
|
-else
|
||||||
|
%h4.text-center
|
||||||
|
Not set!
|
||||||
|
.caption.flex-grow
|
||||||
|
.caption
|
||||||
|
%p
|
||||||
|
%dl.dl-horizontal
|
||||||
|
%dt
|
||||||
|
Description
|
||||||
|
%dd
|
||||||
|
= markdown(lodging.description) unless lodging.description.blank?
|
||||||
|
%dt
|
||||||
|
Website
|
||||||
|
%dd
|
||||||
|
= lodging.website_link
|
||||||
|
%p
|
||||||
|
= link_to 'Edit', edit_admin_conference_lodging_path(@conference.short_title, lodging.id), class: 'btn btn-primary'
|
||||||
|
= link_to 'Delete', admin_conference_lodging_path(@conference.short_title, lodging.id),
|
||||||
|
method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger'
|
||||||
|
|
||||||
|
= link_to 'New Lodging', new_admin_conference_lodging_path(@conference.short_title), class: 'btn btn-primary'
|
||||||
|
|
|
||||||
6
app/views/admin/lodgings/new.html.haml
Normal file
6
app/views/admin/lodgings/new.html.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
%h1 New Lodging
|
||||||
|
|
||||||
|
= semantic_form_for @lodging, url: admin_conference_lodgings_path(conference_id: @conference.short_title) do |f|
|
||||||
|
= render 'form', f: f
|
||||||
|
|
||||||
|
= link_to 'Back', admin_conference_lodgings_path
|
||||||
6
app/views/admin/rooms/_form.html.haml
Normal file
6
app/views/admin/rooms/_form.html.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
= f.inputs do
|
||||||
|
= f.input :name
|
||||||
|
= f.input :size, input_html: { size: 5 }
|
||||||
|
= f.input :public, as: :boolean
|
||||||
|
.actions
|
||||||
|
= f.button 'Save Room', class: 'btn btn-primary'
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
<div class="nested-fields">
|
|
||||||
<%= f.inputs do %>
|
|
||||||
<%= f.input :name %>
|
|
||||||
<%= f.input :size, :input_html => {:size => 5} %>
|
|
||||||
<%= f.input :public, :as => :boolean %>
|
|
||||||
<%= remove_association_link :room, f %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
6
app/views/admin/rooms/edit.html.haml
Normal file
6
app/views/admin/rooms/edit.html.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
%h1 Editing Room
|
||||||
|
|
||||||
|
= semantic_form_for @room, url: admin_conference_room_path(conference_id: @conference.short_title, id: @room.id) do |f|
|
||||||
|
= render 'form', f: f
|
||||||
|
|
||||||
|
= link_to 'Back', admin_conference_rooms_path
|
||||||
|
|
@ -1,5 +1,23 @@
|
||||||
.row
|
%h1 Rooms
|
||||||
.col-md-8
|
|
||||||
= semantic_form_for(@conference, :url => admin_conference_room_path(@conference.short_title, @conference.rooms)) do |f|
|
%table.table
|
||||||
= dynamic_association :rooms, "Rooms", f
|
%thead
|
||||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
%tr
|
||||||
|
%th Name
|
||||||
|
%th Size
|
||||||
|
%th Public
|
||||||
|
%th Delete
|
||||||
|
|
||||||
|
- @rooms.each do |room|
|
||||||
|
%tr
|
||||||
|
%td= link_to room.name, edit_admin_conference_room_path(@conference.short_title, room.id)
|
||||||
|
%td= room.size
|
||||||
|
%td
|
||||||
|
- if room.public
|
||||||
|
%span.fa.fa-check{'style'=>'color: green;'}
|
||||||
|
-else
|
||||||
|
%span.fa.fa-times{'style'=>'color: red;'}
|
||||||
|
%td= link_to 'Delete', admin_conference_room_path(@conference.short_title, room.id),
|
||||||
|
method: :delete, data: { confirm: 'Are you sure?' }
|
||||||
|
|
||||||
|
= link_to 'New Room', new_admin_conference_room_path(@conference.short_title), class: 'btn btn-primary'
|
||||||
|
|
|
||||||
6
app/views/admin/rooms/new.html.haml
Normal file
6
app/views/admin/rooms/new.html.haml
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
%h1 New Room
|
||||||
|
|
||||||
|
= semantic_form_for @room, url: admin_conference_rooms_path(conference_id: @conference.short_title) do |f|
|
||||||
|
= render 'form', f: f
|
||||||
|
|
||||||
|
= link_to 'Back', admin_conference_rooms_path
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
.row
|
.row
|
||||||
.col-md-8
|
.col-md-8
|
||||||
= semantic_form_for(@venue, :url => admin_conference_venue_update_path(@conference.short_title),:html => {:multipart => true}) do |f|
|
= semantic_form_for(@venue, :url => admin_conference_venue_path(@conference.short_title),:html => {:multipart => true}) do |f|
|
||||||
= f.input :include_venue_in_splash, hint: 'On setting this true you will enable the venue to be displayed on the splash page'
|
= f.input :include_venue_in_splash, hint: 'On setting this true you will enable the venue to be displayed on the splash page'
|
||||||
= f.input :name, :input_html => {:rows => 1}
|
= f.input :name, :input_html => {:rows => 1}
|
||||||
= f.input :address, :input_html => {:rows => 1}
|
= f.input :address, :input_html => {:rows => 1}
|
||||||
44
app/views/admin/venues/_show.html.haml
Normal file
44
app/views/admin/venues/_show.html.haml
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
%dl.dl-horizontal
|
||||||
|
%dt
|
||||||
|
Name
|
||||||
|
%dd
|
||||||
|
- unless @conference.venue.name.blank?
|
||||||
|
= @conference.venue.name
|
||||||
|
- else
|
||||||
|
Not set!
|
||||||
|
%dt
|
||||||
|
Address
|
||||||
|
%dd
|
||||||
|
- unless @conference.venue.name.blank?
|
||||||
|
= @conference.venue.address
|
||||||
|
- else
|
||||||
|
Not set!
|
||||||
|
%dt
|
||||||
|
Website
|
||||||
|
%dd
|
||||||
|
- unless @conference.venue.name.blank?
|
||||||
|
= @conference.venue.website
|
||||||
|
- else
|
||||||
|
Not set!
|
||||||
|
%dt
|
||||||
|
Description
|
||||||
|
%dd
|
||||||
|
- unless @conference.venue.name.blank?
|
||||||
|
= markdown(@conference.venue.description)
|
||||||
|
- else
|
||||||
|
Not set!
|
||||||
|
.thumbnail
|
||||||
|
%h3.text-center
|
||||||
|
Venue Photo
|
||||||
|
- if @conference.venue.photo?
|
||||||
|
= image_tag(@conference.venue.photo(:large), class: 'img-responsive')
|
||||||
|
.caption
|
||||||
|
%p
|
||||||
|
%dl.dl-horizontal
|
||||||
|
%dt
|
||||||
|
Filename
|
||||||
|
%dd
|
||||||
|
= @conference.venue.photo_file_name
|
||||||
|
-else
|
||||||
|
%h4.text-center
|
||||||
|
Not set!
|
||||||
16
app/views/admin/venues/edit.html.haml
Normal file
16
app/views/admin/venues/edit.html.haml
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%ul.nav.nav-tabs{'role'=>'tablist'}
|
||||||
|
%li.active
|
||||||
|
%a{'href'=> '#show', 'role'=>'tab', 'data-toggle'=>'tab'}
|
||||||
|
Show
|
||||||
|
%li
|
||||||
|
%a{'href'=> '#edit', 'role'=>'tab', 'data-toggle'=>'tab'}
|
||||||
|
Edit
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.tab-content
|
||||||
|
.tab-pane.active#show
|
||||||
|
= render partial: 'show'
|
||||||
|
.tab-pane#edit
|
||||||
|
= render partial: 'edit'
|
||||||
|
|
@ -22,8 +22,22 @@
|
||||||
%hr
|
%hr
|
||||||
%li{:class=> "#{active_nav_li(admin_conference_path(@conference.short_title))} nav-header nav-header-bigger"}
|
%li{:class=> "#{active_nav_li(admin_conference_path(@conference.short_title))} nav-header nav-header-bigger"}
|
||||||
= link_to(admin_conference_path(@conference.short_title)) do
|
= link_to(admin_conference_path(@conference.short_title)) do
|
||||||
%span.glyphicon.glyphicon-dashboard
|
%span.fa.fa-tachometer
|
||||||
Manage
|
Dashboard
|
||||||
|
%li{ class: active_nav_li(edit_admin_conference_venue_path(@conference.short_title)) }
|
||||||
|
= link_to(edit_admin_conference_venue_path(@conference.short_title)) do
|
||||||
|
%span.fa.fa-building
|
||||||
|
Venue
|
||||||
|
%ul
|
||||||
|
%li{ class: active_nav_li(admin_conference_rooms_path(@conference.short_title)) }
|
||||||
|
= link_to(admin_conference_rooms_path(@conference.short_title)) do
|
||||||
|
%span.fa.fa-flag
|
||||||
|
Rooms
|
||||||
|
%li{ class: active_nav_li(admin_conference_lodgings_path(@conference.short_title)) }
|
||||||
|
= link_to(admin_conference_lodgings_path(@conference.short_title)) do
|
||||||
|
%span.fa.fa-institution
|
||||||
|
Lodgings
|
||||||
|
%hr
|
||||||
%li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))}
|
%li{:class=> active_nav_li(admin_conference_events_path(@conference.short_title))}
|
||||||
= link_to(admin_conference_events_path(@conference.short_title)) do
|
= link_to(admin_conference_events_path(@conference.short_title)) do
|
||||||
%span.glyphicon.glyphicon-comment
|
%span.glyphicon.glyphicon-comment
|
||||||
|
|
@ -49,16 +63,6 @@
|
||||||
= link_to(admin_conference_targets_path(@conference.short_title)) do
|
= link_to(admin_conference_targets_path(@conference.short_title)) do
|
||||||
%span.glyphicon.glyphicon-flag
|
%span.glyphicon.glyphicon-flag
|
||||||
Targets
|
Targets
|
||||||
%li{:class=> "#{active_nav_li(admin_conference_venue_info_path(@conference.short_title))} myAccordion"}
|
|
||||||
= link_to(admin_conference_venue_info_path(@conference.short_title)) do
|
|
||||||
%span.glyphicon.glyphicon-road
|
|
||||||
Venue
|
|
||||||
%span.small.glyphicon.glyphicon-chevron-right
|
|
||||||
%ul.nav.nav-stacked.nav-pills.small.collapse.subNav
|
|
||||||
%li{:class=> active_nav_li(admin_conference_rooms_path(@conference.short_title))}
|
|
||||||
= link_to 'Rooms', admin_conference_rooms_path(@conference.short_title)
|
|
||||||
%li{ class: active_nav_li(admin_conference_lodgings_path(@conference.short_title)) }
|
|
||||||
= link_to 'Lodgings', admin_conference_lodgings_path(@conference.short_title)
|
|
||||||
%li{:class=> "#{active_nav_li(admin_conference_sponsorship_levels_path(@conference.short_title))} myAccordion" }
|
%li{:class=> "#{active_nav_li(admin_conference_sponsorship_levels_path(@conference.short_title))} myAccordion" }
|
||||||
= link_to(admin_conference_sponsorship_levels_path(@conference.short_title)) do
|
= link_to(admin_conference_sponsorship_levels_path(@conference.short_title)) do
|
||||||
%span.glyphicon.glyphicon-star
|
%span.glyphicon.glyphicon-star
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,8 @@ Osem::Application.routes.draw do
|
||||||
resources :people
|
resources :people
|
||||||
resources :conference do
|
resources :conference do
|
||||||
resource :schedule, only: [:show, :update]
|
resource :schedule, only: [:show, :update]
|
||||||
|
resource :venue, only: [:edit, :update]
|
||||||
get '/stats' => 'stats#index'
|
get '/stats' => 'stats#index'
|
||||||
get '/venue' => 'venue#show', as: 'venue_info'
|
|
||||||
patch '/venue' => 'venue#update', as: 'venue_update'
|
|
||||||
get '/dietary_choices' => 'dietchoices#show', as: 'dietary_list'
|
get '/dietary_choices' => 'dietchoices#show', as: 'dietary_list'
|
||||||
patch '/dietary_choices' => 'dietchoices#update', as: 'dietary_update'
|
patch '/dietary_choices' => 'dietchoices#update', as: 'dietary_update'
|
||||||
get '/volunteers_list' => 'volunteers#show'
|
get '/volunteers_list' => 'volunteers#show'
|
||||||
|
|
@ -23,7 +22,7 @@ Osem::Application.routes.draw do
|
||||||
|
|
||||||
resources :difficulty_levels, only: [:show, :update, :index]
|
resources :difficulty_levels, only: [:show, :update, :index]
|
||||||
|
|
||||||
resources :rooms, only: [:show, :update, :index]
|
resources :rooms, except: [:show]
|
||||||
|
|
||||||
resources :tracks, only: [:show, :update, :index]
|
resources :tracks, only: [:show, :update, :index]
|
||||||
|
|
||||||
|
|
@ -31,7 +30,7 @@ Osem::Application.routes.draw do
|
||||||
|
|
||||||
resources :sponsors, only: [:show, :update, :index]
|
resources :sponsors, only: [:show, :update, :index]
|
||||||
|
|
||||||
resources :lodgings, only: [:show, :update, :index]
|
resources :lodgings, except: [:show]
|
||||||
|
|
||||||
resources :targets, only: [:update, :index]
|
resources :targets, only: [:update, :index]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,51 +8,58 @@ feature Lodging do
|
||||||
|
|
||||||
shared_examples 'lodgings' do |user|
|
shared_examples 'lodgings' do |user|
|
||||||
scenario 'adds and updates lodgings', feature: true, js: true do
|
scenario 'adds and updates lodgings', feature: true, js: true do
|
||||||
path = "#{Rails.root}/app/assets/images/rails.png"
|
expected_count = Lodging.count + 1
|
||||||
conference = create(:conference)
|
conference = create(:conference)
|
||||||
conference.venue = create(:venue)
|
conference.venue = create(:venue)
|
||||||
sign_in create(user)
|
sign_in create(user)
|
||||||
|
|
||||||
visit admin_conference_lodgings_path(
|
visit admin_conference_lodgings_path(
|
||||||
conference_id: conference.short_title)
|
conference_id: conference.short_title)
|
||||||
|
|
||||||
# Add lodging
|
# Add lodging
|
||||||
click_link 'Add lodging'
|
click_link 'New Lodging'
|
||||||
expect(page.all('div.nested-fields').count == 1).to be true
|
fill_in 'lodging_name', with: 'Lodging1000'
|
||||||
page.
|
fill_in 'lodging_description', with: 'Lorem ipsum dolorem'
|
||||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
attach_file('lodging_photo', Rails.root + 'spec/fixtures/suse.jpg')
|
||||||
set('Example Hotel')
|
fill_in 'lodging_website_link', with: 'http://www.suse.com'
|
||||||
|
click_button 'Save Lodging'
|
||||||
page.
|
|
||||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
|
||||||
set('Lorem Ipsum Dolor')
|
|
||||||
|
|
||||||
attach_file 'Photo', path
|
|
||||||
|
|
||||||
page.
|
|
||||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input').
|
|
||||||
set('http://www.example.com')
|
|
||||||
|
|
||||||
click_button 'Update Venue'
|
|
||||||
|
|
||||||
# Validations
|
# Validations
|
||||||
expect(flash).to eq('Lodgings were successfully updated.')
|
expect(Lodging.count).to eq(expected_count)
|
||||||
|
expect(flash).to eq('Lodging was successfully created.')
|
||||||
|
expect(page.has_content?('Lodging1000')).to be true
|
||||||
|
expect(page.has_content?('Lorem ipsum dolorem')).to be true
|
||||||
|
expect(page.has_content?('http://www.suse.com')).to be true
|
||||||
|
|
||||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
# Update room
|
||||||
value).to eq('Example Hotel')
|
click_link 'Edit'
|
||||||
|
fill_in 'lodging_name', with: 'Lodging2000'
|
||||||
|
fill_in 'lodging_description', with: 'Lorem ipsum dolorem...'
|
||||||
|
attach_file('lodging_photo', Rails.root + 'spec/fixtures/suse_pinguin.png')
|
||||||
|
fill_in 'lodging_website_link', with: 'http://www.opensuse.com'
|
||||||
|
click_button 'Save Lodging'
|
||||||
|
|
||||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) textarea').
|
# Validations
|
||||||
value).to eq('Lorem Ipsum Dolor')
|
expect(Lodging.count).to eq(expected_count)
|
||||||
|
expect(flash).to eq('Lodging was successfully updated.')
|
||||||
expect(page).to have_selector("img[src*='rails.png']")
|
expect(page.has_content?('Lodging2000')).to be true
|
||||||
|
expect(page.has_content?('Lorem ipsum dolorem...')).to be true
|
||||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(4) input').
|
expect(page.has_content?('http://www.opensuse.com')).to be true
|
||||||
value).to eq('http://www.example.com')
|
|
||||||
|
|
||||||
# Remove room
|
# Remove room
|
||||||
click_link 'Remove lodging'
|
click_link 'Delete'
|
||||||
expect(page.all('div.nested-fields').count == 0).to be true
|
|
||||||
|
# Validations
|
||||||
|
expect(Lodging.count).to eq(expected_count - 1)
|
||||||
|
expect(flash).to eq('Lodging was successfully destroyed.')
|
||||||
|
expect(page.has_content?('Lodging2000')).to be false
|
||||||
|
expect(page.has_content?('Lorem ipsum dolorem...')).to be false
|
||||||
|
expect(page.has_content?('http://www.opensuse.com')).to be false
|
||||||
|
|
||||||
|
# Enable lodgings for splash page
|
||||||
|
check('venue_include_lodgings_in_splash')
|
||||||
click_button 'Update Venue'
|
click_button 'Update Venue'
|
||||||
expect(flash).to eq('Lodgings were successfully updated.')
|
expect(flash).to eq('Venue was successfully updated.')
|
||||||
expect(page.all('div.nested-fields').count == 0).to be true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,37 +9,45 @@ feature Room do
|
||||||
shared_examples 'rooms' do |user|
|
shared_examples 'rooms' do |user|
|
||||||
scenario 'adds and updates rooms', feature: true, js: true do
|
scenario 'adds and updates rooms', feature: true, js: true do
|
||||||
conference = create(:conference)
|
conference = create(:conference)
|
||||||
|
expected_count = Room.count + 1
|
||||||
sign_in create(user)
|
sign_in create(user)
|
||||||
visit admin_conference_rooms_path(
|
visit admin_conference_rooms_path(
|
||||||
conference_id: conference.short_title)
|
conference_id: conference.short_title)
|
||||||
|
|
||||||
# Add room
|
# Add room
|
||||||
click_link 'Add room'
|
click_link 'New Room'
|
||||||
expect(page.all('div.nested-fields').count == 1).to be true
|
fill_in 'room_name', with: 'Room1000'
|
||||||
|
fill_in 'room_size', with: '500'
|
||||||
page.
|
check('room_public')
|
||||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
click_button 'Save Room'
|
||||||
set('Example room')
|
|
||||||
|
|
||||||
page.
|
|
||||||
find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) input').
|
|
||||||
set('100')
|
|
||||||
|
|
||||||
click_button 'Update Conference'
|
|
||||||
|
|
||||||
# Validations
|
# Validations
|
||||||
expect(flash).to eq('Rooms were successfully updated.')
|
expect(Room.count).to eq(expected_count)
|
||||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(1) input').
|
expect(flash).to eq('Room was successfully created.')
|
||||||
value).to eq('Example room')
|
expect(page.has_content?('Room1000')).to be true
|
||||||
expect(find('div.nested-fields:nth-of-type(1) div:nth-of-type(2) input').
|
expect(page.has_content?('500')).to be true
|
||||||
value).to eq('100')
|
|
||||||
|
# Update room
|
||||||
|
click_link 'Room1000'
|
||||||
|
fill_in 'room_name', with: 'Room2000'
|
||||||
|
fill_in 'room_size', with: '600'
|
||||||
|
check('room_public')
|
||||||
|
click_button 'Save Room'
|
||||||
|
|
||||||
|
# Validations
|
||||||
|
expect(Room.count).to eq(expected_count)
|
||||||
|
expect(flash).to eq('Room was successfully updated.')
|
||||||
|
expect(page.has_content?('Room2000')).to be true
|
||||||
|
expect(page.has_content?('600')).to be true
|
||||||
|
|
||||||
# Remove room
|
# Remove room
|
||||||
click_link 'Remove room'
|
click_link 'Delete'
|
||||||
expect(page.all('div.nested-fields').count == 0).to be true
|
|
||||||
click_button 'Update Conference'
|
# Validations
|
||||||
expect(flash).to eq('Rooms were successfully updated.')
|
expect(Room.count).to eq(expected_count - 1)
|
||||||
expect(page.all('div.nested-fields').count == 0).to be true
|
expect(flash).to eq('Room was successfully destroyed.')
|
||||||
|
expect(page.has_content?('Room2000')).to be false
|
||||||
|
expect(page.has_content?('600')).to be false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,12 +12,14 @@ feature Conference do
|
||||||
conference = create(:conference)
|
conference = create(:conference)
|
||||||
|
|
||||||
sign_in create(user)
|
sign_in create(user)
|
||||||
visit admin_conference_venue_info_path(
|
visit edit_admin_conference_venue_path(
|
||||||
conference_id: conference.short_title)
|
conference_id: conference.short_title)
|
||||||
|
|
||||||
expect(page.find("//*[@id='venue_submit_action']").
|
expect(page.find("//*[@id='venue_submit_action']").
|
||||||
text).to eq('Update Venue')
|
text).to eq('Update Venue')
|
||||||
|
|
||||||
|
click_link 'Edit'
|
||||||
|
|
||||||
fill_in 'venue_name', with: 'Example University'
|
fill_in 'venue_name', with: 'Example University'
|
||||||
fill_in 'venue_address', with: 'Example Street 42 \n' +
|
fill_in 'venue_address', with: 'Example Street 42 \n' +
|
||||||
'12345 Example City \n Germany'
|
'12345 Example City \n Germany'
|
||||||
|
|
|
||||||
BIN
spec/fixtures/suse.jpg
vendored
Normal file
BIN
spec/fixtures/suse.jpg
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 189 KiB |
BIN
spec/fixtures/suse_pinguin.png
vendored
Normal file
BIN
spec/fixtures/suse_pinguin.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
|
|
@ -3,6 +3,7 @@ describe 'admin/rooms/index' do
|
||||||
|
|
||||||
it 'renders rooms list' do
|
it 'renders rooms list' do
|
||||||
@room = create(:room)
|
@room = create(:room)
|
||||||
|
assign :rooms, [@room]
|
||||||
assign :conference, @room.conference
|
assign :conference, @room.conference
|
||||||
render
|
render
|
||||||
expect(rendered).to include('Example Room')
|
expect(rendered).to include('Example Room')
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'admin/venue/venue_info' do
|
describe 'admin/venues/edit' do
|
||||||
|
|
||||||
it 'renders venue#show' do
|
it 'renders venue#edit' do
|
||||||
@conference = create(:conference)
|
@conference = create(:conference)
|
||||||
@venue = @conference.venue
|
@venue = @conference.venue
|
||||||
@venue.name = 'Croatia'
|
@venue.name = 'Croatia'
|
||||||
@venue.description = 'Lorem ipsum dolsum'
|
@venue.description = 'Lorem ipsum dolsum'
|
||||||
@venue.save!
|
@venue.save!
|
||||||
assign :conference, @conference
|
assign :conference, @conference
|
||||||
assign :venue, @venue
|
|
||||||
render
|
render
|
||||||
expect(rendered).to include('Croatia')
|
expect(rendered).to include('Croatia')
|
||||||
expect(rendered).to include('Lorem ipsum dolsum')
|
expect(rendered).to include('Lorem ipsum dolsum')
|
||||||
Loading…
Add table
Add a link
Reference in a new issue