Permalink
Browse files

Finishded adding day trips motherfuckers

  • Loading branch information...
1 parent c18c1e4 commit 9a684e27ebe207f8b5cca3bf9604c08ddc915cad @safarista committed May 8, 2012
View
@@ -12,6 +12,7 @@
# Ignore all logfiles and tempfiles.
/log/*.log
+/log/*
/tmp
*DS_Store
/public/uploads*
View
@@ -49,7 +49,7 @@ gem 'cancan'
# SEO and text formatting
gem 'friendly_id'
gem 'redcarpet'
-gem 'localeapp'
+# gem 'localeapp'
# File upload management
gem 'carrierwave'
View
@@ -75,7 +75,6 @@ GEM
ruby-hmac
formatador (0.2.1)
friendly_id (4.0.4)
- gli (1.6.0)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
@@ -94,12 +93,6 @@ GEM
actionpack (>= 3.1)
less (~> 2.1.0)
libv8 (3.3.10.4)
- localeapp (0.4.3)
- gli
- i18n
- json
- rest-client
- ya2yaml
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
@@ -145,8 +138,6 @@ GEM
rdoc (3.12)
json (~> 1.4)
redcarpet (2.1.1)
- rest-client (1.6.7)
- mime-types (>= 1.16)
ruby-hmac (0.4.0)
sass (3.1.15)
sass-rails (3.2.5)
@@ -177,7 +168,6 @@ GEM
uglifier (1.2.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
- ya2yaml (0.31)
PLATFORMS
ruby
@@ -191,7 +181,6 @@ DEPENDENCIES
friendly_id
jquery-rails
kaminari
- localeapp
mini_magick
pg
rails (= 3.2.3)
@@ -1,10 +1,24 @@
class WelcomeController < ApplicationController
- def index
- end
def about_us
+ @title = 'About Bless Africa Safaris and Tours'
end
def contact_us
+ @title = 'Contact Us'
+ end
+
+ def index
+ @title = 'Welcome to Bless Africa Safaris and Tours Tanzania'
+ end
+
+ def itineraries
+ @trip_types = [Beach, Safari, Trek, DayTrip]
+ @title = 'Safari, Trekking, Beach and Short day trip itineraries'
+
+ end
+
+ def important_information
+ @title = 'Important information for your safari and comfort'
end
end
View
@@ -1,3 +1,5 @@
class DayTrip < ActiveRecord::Base
attr_accessible :description, :title
+ has_many :destinations, as: :destineable, dependent: :delete_all
+ accepts_nested_attributes_for :destinations, allow_destroy: true, reject_if: :all_blank
end
@@ -2,13 +2,13 @@
<div class="control-group">
<%= f.label :title, :class => 'control-label' %>
<div class="controls">
- <%= f.text_field :title, :class => 'text_field' %>
+ <%= f.text_field :title, required: true, :class => 'span4' %>
</div>
</div>
<div class="control-group">
<%= f.label :description, :class => 'control-label' %>
<div class="controls">
- <%= f.text_area :description, :class => 'text_area' %>
+ <%= f.text_area :description, :class => 'span6', rows: 9 %>
</div>
</div>
@@ -1,36 +1,19 @@
<%- model_class = DayTrip.new.class -%>
-<h1><%=t '.title', :default => model_class.model_name.human.pluralize %></h1>
-<table class="table table-striped">
- <thead>
- <tr>
- <th><%= model_class.human_attribute_name(:id) %></th>
- <th><%= model_class.human_attribute_name(:title) %></th>
- <th><%= model_class.human_attribute_name(:description) %></th>
- <th><%= model_class.human_attribute_name(:created_at) %></th>
- <th><%=t '.actions', :default => t("helpers.actions") %></th>
- </tr>
- </thead>
- <tbody>
- <% @day_trips.each do |day_trip| %>
- <tr>
- <td><%= link_to day_trip.id, day_trip_path(day_trip) %></td>
- <td><%= day_trip.title %></td>
- <td><%= day_trip.description %></td>
- <td><%=l day_trip.created_at %></td>
- <td>
- <%= link_to t('.edit', :default => t("helpers.links.edit")),
- edit_day_trip_path(day_trip), :class => 'btn btn-mini' %>
- <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
- day_trip_path(day_trip),
- :method => :delete,
- :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
- :class => 'btn btn-mini btn-danger' %>
- </td>
- </tr>
- <% end %>
- </tbody>
-</table>
+<h1><%=t '.title', default: 'Day trips offered by Bless Africa Tours and Safaris' %></h1>
+<h3><small>INTRODUCTION</small></h3>
+<p>The team at Bless Africa Tours and Safaris want visitors to Tanzania to be able to experience every facet of Tanzania: the culture, flora, fauna and the unique experiences our beautiful country can offer.
+<p>Moshi, our home, is very fortunate to be set in the foothills of Mount Kilimanjaro. Because of its unique position there is a wealth of day excursions and short trips available within relatively close proximity.
+<p>You do not need to be an athlete to be able to say that you have walked on Mount Kilimanjaro; we can arrange a day hike to the first camp, the Mandara hut, on the Marangu summit route on the mountain.
+<p>There are many beautiful walks within the rainforest incorporating scenic waterfalls and opportunities to view an amazing array of animal and plant life. Further afield the team will be able to offer day and short safaris to the National Parks of Arusha, Taringire, Ngorongoro and Lake Manyara. Lake Chala, set to the east of Kilimanjaro, near the Kenyan border, offers a unique opportunity to explore a crater lake for a day or longer if desired.
+<p>Alongside the outstanding opportunities to view the natural environment there is also a strong cultural heritage belonging to the indigenous people from the area. We can arrange trips to explore the cultural traditions of both the Chagga, who live in the Kilimanjaro region, and the Masai, who live a nomadic life within Tanzania and Kenya.
+<h2>Day Safaris, Treks and Beach trips</h2>
+
+<% @day_trips.each do |day_trip| %>
+ <h3><%= link_to day_trip.title, day_trip_path(day_trip), title: day_trip.title %></h3>
+ <%= markdown day_trip.description.truncate(300) %>
+ <hr>
+<% end %>
<%= link_to t('.new', :default => t("helpers.links.new")),
new_day_trip_path,
- :class => 'btn btn-primary' %>
+ :class => 'btn btn-primary' %>
@@ -1,14 +1,6 @@
<%- model_class = @day_trip.class -%>
-<h1><%=t '.title', :default => model_class.model_name.human %></h1>
-
-<p>
- <strong><%= model_class.human_attribute_name(:title) %>:</strong><br>
- <%= @day_trip.title %>
-</p>
-<p>
- <strong><%= model_class.human_attribute_name(:description) %>:</strong><br>
- <%= @day_trip.description %>
-</p>
+<h1><%=t '.title', :default => @day_trip.title %></h1>
+<%= markdown @day_trip.description %>
<div class="form-actions">
<%= link_to t('.back', :default => t("helpers.links.back")),
@@ -21,3 +13,47 @@
:confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')),
:class => 'btn btn-danger' %>
</div>
+<% if !@day_trip.destinations.blank? %>
+ <h6>Destinations</h6>
+ <hr>
+ <% for dt in @day_trip.destinations %>
+ <h3><%= link_to dt.title, day_trip_destination_path(@day_trip, dt), title: dt.title %></h3>
+ <%= markdown dt.description.truncate(300) %>
+ <p><%= link_to 'Read more...', day_trip_destination_path(@day_trip, dt) %></p>
+ <% end %>
+<% else %>
+ <div class="alert">
+ <h6>Destination Itineraries</h6>
+ <p>There no Itineraries for this trip just yet. Hold it right there, I'm on it.</p>
+ </div>
+<% end %>
+</article>
+<hr>
+<%= form_for [@day_trip, @day_trip.destinations.new], :html => { :class => 'form-horizontal' } do |f| %>
+ <h3 class="page-title">Add a new itinerary</h3>
+ <br>
+ <div class="control-group">
+ <%= f.label :title, 'Destination name', :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :title, :class => 'span3', required: true %>
+ </div>
+ </div>
+ <div class="control-group">
+ <%= f.label :price, 'Price breakdown', :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_area :price, :class => 'span6', rows: 6 %>
+ </div>
+ </div>
+ <div class="control-group">
+ <%= f.label :description, class: 'control-label' %>
+ <div class="controls">
+ <%= f.text_area :description, class: 'span6', rows: 8 %>
+ </div>
+ </div>
+
+ <div class="form-actions">
+ <%= f.submit nil, :class => 'btn btn-primary' %>
+ <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
+ day_trips_path, :class => 'btn' %>
+ </div>
+<% end %>
@@ -34,8 +34,8 @@
<li><%= link_to "Trekking", :treks %></li>
<li><%= link_to "Safaris", :safaris %></li>
<li><%= link_to "Beach Destinations", :beaches %></li>
- <li><%= link_to "Day Trips", '#' %></li>
- <li><%= link_to "Itineraries", '#' %></li>
+ <li><%= link_to "Day Trips", :day_trips %></li>
+ <!-- <li><%= link_to "Itineraries", :itineraries %></li> -->
</ul>
</div><!--/.nav-collapse -->
@@ -55,8 +55,8 @@
<li class="nav-header">Important links</li>
<li><%= link_to "Galleries", :albums %></li>
<li><%= link_to "Accommodation", "#" %></li>
- <li class="active"><%= link_to "Itineraries", "#" %></li>
- <li><%= link_to "Important Information", "#" %></li>
+ <!-- <li><%= link_to "Itineraries", :itineraries %></li> -->
+ <li><%= link_to "Important Information", :important_information %></li>
<li><%= link_to "About Us", :about_us %></li>
<li><%= link_to "Contact Us", :contact_us %></li>
<li><%= link_to "Guides and porters", :guides_and_porters %></li>
@@ -68,7 +68,7 @@
<footer>
<hr>
- <p>&copy; Bless Africa Tours &amp; Safaris 2012 &bull; <a href="#">About us</a> &bull; <a href="#">Contact us</a></p>
+ <p>&copy; Bless Africa Tours &amp; Safaris 2012 &bull; <%= link_to "About us", :about_us %> &bull; <%= link_to "Contact us", :contact_us %></p>
</footer>
</div> <!-- /container -->
@@ -0,0 +1,2 @@
+<h1>Important information</h1>
+<p>coming soon...</p>
@@ -0,0 +1,7 @@
+
+ <% @trip_types.collect do |dest| %>
+ <% aries = Destination.where(destineable_type: dest).order("created_at desc") %>
+ <% for tt in aries %>
+ <h2><small><%= dest.model_name %></small> <%= link_to tt.title, '#' %></h2>
+ <% end %>
+ <% end %>
@@ -1,5 +1,5 @@
-require 'localeapp/rails'
-
-Localeapp.configure do |config|
- config.api_key = '4e4vSe0nE8p1gVHWHtyuhTzHbRppZEyVrhEuDloOt3WkZs5ANm'
-end
+# require 'localeapp/rails'
+#
+# Localeapp.configure do |config|
+# config.api_key = '4e4vSe0nE8p1gVHWHtyuhTzHbRppZEyVrhEuDloOt3WkZs5ANm'
+# end
View
@@ -0,0 +1,10 @@
+en-GB:
+ helpers:
+ actions: Actions
+ links:
+ cancel: Cancel
+ confirm: Are you sure you about this?
+ destroy: Delete
+ edit: Edit %{model}
+ submit:
+ cancel: Cancel
View
@@ -1,6 +1,8 @@
Bats::Application.routes.draw do
- resources :day_trips
+ resources :day_trips do
+ resources :destinations
+ end
resources :albums do
resources :photos
@@ -21,9 +23,11 @@
# resources :destinations
# resources :welcome
- match 'about_us' => 'welcome#about_us', as: :about_us
- match 'contact_us' => 'welcome#contact_us', as: :contact_us
- match 'guides_and_porters' => 'welcome#guides_and_porters', as: :guides_and_porters
+ match 'about_us' => 'welcome#about_us', as: :about_us
+ match 'contact_us' => 'welcome#contact_us', as: :contact_us
+ match 'guides_and_porters' => 'welcome#guides_and_porters', as: :guides_and_porters
+ match 'itineraries' => 'welcome#itineraries', as: :itineraries
+ match 'important_information' => 'welcome#important_information', as: :important_information
# The priority is based upon order of creation:
# first created -> highest priority.
View
@@ -1,3 +1,3 @@
---
-:polled_at: 1336420019
-:updated_at: 1336420019
+:polled_at: 1336485188
+:updated_at: 1336485188

0 comments on commit 9a684e2

Please sign in to comment.