Location Component

This commit is contained in:
Gopesh Tulsyan 2014-06-02 20:48:56 +05:30
parent 069cc0eb4c
commit b1c171cd97
12 changed files with 119 additions and 19 deletions

View file

@ -83,3 +83,17 @@ body {
.top-submitter img {
margin: 0 auto;
}
#location{
background-repeat: no-repeat;
background-position: center center;
width: 100%;
min-height: 500px;
background-size: cover;
-webkit-background-size:cover;
}
#location li{
display: inline-block;
margin-right: 2em;
}

View file

@ -6,13 +6,13 @@ class Admin::VenueController < ApplicationController
def update
@venue = @conference.venue
venue_params = params[:venue]
@venue.name = venue_params[:name]
@venue.address= venue_params[:address]
@venue.website = venue_params[:website]
@venue.description = venue_params[:description]
@venue.save
redirect_to(admin_conference_venue_info_path(:conference_id => @conference.short_title), :notice => 'Venue was successfully updated.')
if @venue.update_attributes!(params[:venue])
redirect_to(admin_conference_venue_info_path(conference_id: @conference.short_title),
notice: 'Venue was successfully updated.')
else
redirect_to(admin_conference_venue_info_path(conference_id: @conference.short_title),
notice: 'Venue Updation Failed!')
end
end
def show

View file

@ -1,7 +1,13 @@
class Venue < ActiveRecord::Base
attr_accessible :name, :description, :website, :address, :photo
has_many :conferences
before_create :generate_guid
has_attached_file :photo,
styles: { thumb: '100x100>', large: '300x300>' }
validates_attachment_content_type :photo,
content_type: [/jpg/, /jpeg/, /png/, /gif/],
size: { in: 0..500.kilobytes }
private
def generate_guid

View file

@ -5,4 +5,7 @@
= f.input :address, :input_html => {:rows => 1}
= f.input :website
= f.input :description, :input_html => { :rows => 10, :cols => 20 }
- if !@venue.photo.blank?
= image_tag @venue.photo(:thumb)
= f.input :photo
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}

View file

@ -0,0 +1,36 @@
= content_for :splash_nav do
%li
%a{ href: '#location' } Location
%div#location
%div.container.text-center
.div.row.col-md-12
- if !@conference.venue.name.blank?
%h1
%strong #{ @conference.venue.name }
- if !@conference.venue.address.blank?
%h2
%strong #{ @conference.venue.address }
- if !@conference.venue.description.blank?
%p
%strong #{ @conference.venue.description }
%ul
- if !@conference.venue.address.blank?
%li
%b
= link_to 'View in Google Maps', "http://maps.google.com/maps?q=#{@conference.venue.address}", target: '_blank'
- if !@conference.venue.website.blank?
%li
%b
= link_to 'Visit Venue Website', @conference.venue.website, target: '_blank'
:javascript
$(document).ready(function(){
var photo = "#{@conference.venue.photo}";
if(photo)
{
$('#location').css('background-image', 'url('+photo+')');
}
});

View file

@ -1,9 +1,23 @@
= content_for :brand do
= link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand'
%div#program
= render 'program'
%div#registration
= render 'registration'
%div#callforpapers
= render 'call_for_papers'
%div#location
= render 'location'
:javascript
$(document).ready(function(){
$('#content').removeClass('container');
});

View file

@ -2,4 +2,4 @@
.col-md-12.page-header
%h2.text-center Upcoming Conferences
- @current.each do |conference|
= render :partial => "conference_details", :locals => {:conference => conference}
= render :partial => "conference_details", :locals => {:conference => conference}