Adds lodgings controller and view
This commit is contained in:
parent
029281a9ae
commit
e494192ad2
8 changed files with 111 additions and 1 deletions
23
app/controllers/admin/lodgings_controller.rb
Normal file
23
app/controllers/admin/lodgings_controller.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
module Admin
|
||||
class LodgingsController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
|
||||
def index
|
||||
@venue = @conference.venue
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def update
|
||||
@venue = @conference.venue
|
||||
if @venue.update_attributes(params[:venue])
|
||||
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
|
||||
notice: 'Lodgings were successfully updated.')
|
||||
else
|
||||
redirect_to(admin_conference_lodgings_path(conference_id: @conference.short_title),
|
||||
notice: 'Lodgings Updation Failed!')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
class Venue < ActiveRecord::Base
|
||||
attr_accessible :name, :description, :website, :address,:photo, :lodgings_attributes
|
||||
attr_accessible :name, :description, :website, :address, :photo, :lodgings_attributes
|
||||
has_many :conferences
|
||||
has_many :lodgings
|
||||
before_create :generate_guid
|
||||
|
|
|
|||
10
app/views/admin/lodgings/_lodging_fields.html.erb
Normal file
10
app/views/admin/lodgings/_lodging_fields.html.erb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<div class="nested-fields">
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :description, :input_html => {:rows => 2 }, 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 %>
|
||||
<%= remove_association_link :lodging, f %>
|
||||
<% end %>
|
||||
</div>
|
||||
5
app/views/admin/lodgings/index.html.haml
Normal file
5
app/views/admin/lodgings/index.html.haml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@venue, :url => admin_conference_lodging_path(@conference.short_title, @conference.venue.lodgings), :html => {:multipart => true}) do |f|
|
||||
= dynamic_association :lodgings, "Lodgings", f
|
||||
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||
|
|
@ -45,6 +45,8 @@
|
|||
%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" }
|
||||
= link_to(admin_conference_sponsorship_levels_path(@conference.short_title)) do
|
||||
%span.glyphicon.glyphicon-star
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue