Location Component
This commit is contained in:
parent
069cc0eb4c
commit
b1c171cd97
12 changed files with 119 additions and 19 deletions
|
|
@ -83,3 +83,17 @@ body {
|
||||||
.top-submitter img {
|
.top-submitter img {
|
||||||
margin: 0 auto;
|
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;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@ class Admin::VenueController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@venue = @conference.venue
|
@venue = @conference.venue
|
||||||
venue_params = params[:venue]
|
if @venue.update_attributes!(params[:venue])
|
||||||
@venue.name = venue_params[:name]
|
redirect_to(admin_conference_venue_info_path(conference_id: @conference.short_title),
|
||||||
@venue.address= venue_params[:address]
|
notice: 'Venue was successfully updated.')
|
||||||
@venue.website = venue_params[:website]
|
else
|
||||||
@venue.description = venue_params[:description]
|
redirect_to(admin_conference_venue_info_path(conference_id: @conference.short_title),
|
||||||
@venue.save
|
notice: 'Venue Updation Failed!')
|
||||||
redirect_to(admin_conference_venue_info_path(:conference_id => @conference.short_title), :notice => 'Venue was successfully updated.')
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
class Venue < ActiveRecord::Base
|
class Venue < ActiveRecord::Base
|
||||||
|
attr_accessible :name, :description, :website, :address, :photo
|
||||||
has_many :conferences
|
has_many :conferences
|
||||||
before_create :generate_guid
|
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
|
private
|
||||||
|
|
||||||
def generate_guid
|
def generate_guid
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,7 @@
|
||||||
= f.input :address, :input_html => {:rows => 1}
|
= f.input :address, :input_html => {:rows => 1}
|
||||||
= f.input :website
|
= f.input :website
|
||||||
= f.input :description, :input_html => { :rows => 10, :cols => 20 }
|
= 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"}
|
= f.action :submit, :as => :button, :button_html => {:class => "btn btn-primary"}
|
||||||
|
|
|
||||||
36
app/views/conference/_location.html.haml
Normal file
36
app/views/conference/_location.html.haml
Normal 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+')');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -1,9 +1,23 @@
|
||||||
= content_for :brand do
|
= content_for :brand do
|
||||||
= link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand'
|
= link_to @conference.title, conference_url(@conference.short_title), class: 'navbar-brand'
|
||||||
|
|
||||||
%div#program
|
%div#program
|
||||||
= render 'program'
|
= render 'program'
|
||||||
%div#registration
|
%div#registration
|
||||||
= render 'registration'
|
= render 'registration'
|
||||||
%div#callforpapers
|
%div#callforpapers
|
||||||
= render 'call_for_papers'
|
= render 'call_for_papers'
|
||||||
|
%div#location
|
||||||
|
= render 'location'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
:javascript
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#content').removeClass('container');
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,4 +2,4 @@
|
||||||
.col-md-12.page-header
|
.col-md-12.page-header
|
||||||
%h2.text-center Upcoming Conferences
|
%h2.text-center Upcoming Conferences
|
||||||
- @current.each do |conference|
|
- @current.each do |conference|
|
||||||
= render :partial => "conference_details", :locals => {:conference => conference}
|
= render :partial => "conference_details", :locals => {:conference => conference}
|
||||||
|
|
|
||||||
8
db/migrate/20140602140203_add_photo_to_venue.rb
Normal file
8
db/migrate/20140602140203_add_photo_to_venue.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
class AddPhotoToVenue < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :venues, :photo_file_name, :string
|
||||||
|
add_column :venues, :photo_content_type, :string
|
||||||
|
add_column :venues, :photo_file_size, :integer
|
||||||
|
add_column :venues, :photo_updated_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
||||||
25
db/schema.rb
25
db/schema.rb
|
|
@ -50,15 +50,15 @@ ActiveRecord::Schema.define(version: 20140605125153) do
|
||||||
add_index "comments", ["user_id"], name: "index_comments_on_user_id"
|
add_index "comments", ["user_id"], name: "index_comments_on_user_id"
|
||||||
|
|
||||||
create_table "conferences", force: true do |t|
|
create_table "conferences", force: true do |t|
|
||||||
t.string "guid", null: false
|
t.string "guid", null: false
|
||||||
t.string "title", null: false
|
t.string "title", null: false
|
||||||
t.string "short_title", null: false
|
t.string "short_title", null: false
|
||||||
t.string "social_tag"
|
t.string "social_tag"
|
||||||
t.string "contact_email", null: false
|
t.string "contact_email", null: false
|
||||||
t.string "timezone", null: false
|
t.string "timezone", null: false
|
||||||
t.string "html_export_path"
|
t.string "html_export_path"
|
||||||
t.date "start_date", null: false
|
t.date "start_date", null: false
|
||||||
t.date "end_date", null: false
|
t.date "end_date", null: false
|
||||||
t.integer "venue_id"
|
t.integer "venue_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
|
@ -81,6 +81,9 @@ ActiveRecord::Schema.define(version: 20140605125153) do
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.text "registration_description"
|
t.text "registration_description"
|
||||||
t.text "ticket_description"
|
t.text "ticket_description"
|
||||||
|
t.string "facebook_url"
|
||||||
|
t.string "google_url"
|
||||||
|
t.string "twitter_url"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "conferences_questions", id: false, force: true do |t|
|
create_table "conferences_questions", id: false, force: true do |t|
|
||||||
|
|
@ -308,9 +311,9 @@ ActiveRecord::Schema.define(version: 20140605125153) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "tracks", force: true do |t|
|
create_table "tracks", force: true do |t|
|
||||||
t.string "guid", null: false
|
t.string "guid", null: false
|
||||||
t.integer "conference_id"
|
t.integer "conference_id"
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.string "color"
|
t.string "color"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
|
|
@ -363,6 +366,10 @@ ActiveRecord::Schema.define(version: 20140605125153) do
|
||||||
t.string "offline_map_bounds"
|
t.string "offline_map_bounds"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
t.string "photo_file_name"
|
||||||
|
t.string "photo_content_type"
|
||||||
|
t.integer "photo_file_size"
|
||||||
|
t.datetime "photo_updated_at"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "versions", force: true do |t|
|
create_table "versions", force: true do |t|
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,6 @@ FactoryGirl.define do
|
||||||
contact_email 'admin@example.com'
|
contact_email 'admin@example.com'
|
||||||
start_date Date.today
|
start_date Date.today
|
||||||
end_date Date.tomorrow
|
end_date Date.tomorrow
|
||||||
|
venue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,6 @@ FactoryGirl.define do
|
||||||
name 'Suse Office'
|
name 'Suse Office'
|
||||||
address 'Maxfeldstrasse 5 \n90409 Nuremberg'
|
address 'Maxfeldstrasse 5 \n90409 Nuremberg'
|
||||||
website 'www.opensuse.org'
|
website 'www.opensuse.org'
|
||||||
|
description 'Lorem Ipsum Dolor'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,14 @@ describe 'conference/show.html.haml' do
|
||||||
registration_start_date: Date.today,
|
registration_start_date: Date.today,
|
||||||
registration_end_date: Date.tomorrow,
|
registration_end_date: Date.tomorrow,
|
||||||
description: 'Lorem Ipsum')
|
description: 'Lorem Ipsum')
|
||||||
|
@conference.venue = create(:venue)
|
||||||
@conference.call_for_papers = create(:call_for_papers, conference: @conference)
|
@conference.call_for_papers = create(:call_for_papers, conference: @conference)
|
||||||
assign :conference, @conference
|
assign :conference, @conference
|
||||||
render
|
render
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'renders program partial' do
|
it 'renders program partial' do
|
||||||
expect(render).to include("#{@conference.description}")
|
expect(rendered).to include("#{@conference.description}")
|
||||||
expect(view).to render_template(partial: 'conference/_program')
|
expect(view).to render_template(partial: 'conference/_program')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -21,6 +22,15 @@ describe 'conference/show.html.haml' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'renders call_for_papers partial' do
|
it 'renders call_for_papers partial' do
|
||||||
expect(render).to include("#{@conference.call_for_papers.description}")
|
expect(view).to render_template(partial: 'conference/_call_for_papers')
|
||||||
|
expect(rendered).to include("#{@conference.call_for_papers.description}")
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders location partial' do
|
||||||
|
expect(view).to render_template(partial: 'conference/_location')
|
||||||
|
expect(rendered).to include('Suse Office')
|
||||||
|
expect(rendered).to include('Maxfeldstrasse 5 \n90409 Nuremberg')
|
||||||
|
expect(rendered).to include('www.opensuse.org')
|
||||||
|
expect(rendered).to include('Lorem Ipsum Dolor')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue