Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'sponsors_page'

* sponsors_page:
  Add Sponsors page
  • Loading branch information...
commit f9a5f1c44fc78ab90d76dba135bde017b9099b38 2 parents 3d38753 + 22926a9
@mathias mathias authored
View
5 app/controllers/sponsors_controller.rb
@@ -0,0 +1,5 @@
+class SponsorsController < ApplicationController
+ def index
+ @sponsors = Sponsor.all
+ end
+end
View
4 app/models/sponsor.rb
@@ -1,4 +1,8 @@
class Sponsor < ActiveRecord::Base
validates_presence_of :name
validates_presence_of :description
+
+ def anchor_name
+ self.name.parameterize
+ end
end
View
7 app/views/home/_sponsor.html.erb
@@ -5,5 +5,10 @@
<%= image_tag sponsor.image_path, :class => 'sponsor-image' %>
</div>
<% end %>
- <p><%= sponsor.description %></p>
+ <p><%= link_to "Website", sponsor.url if sponsor.url %></p>
+ <p><%= truncate(sponsor.description, :length => 260) %></p>
+ <p><%- if sponsor.description.length > 260 %>
+ <%= link_to "More", "sponsors##{sponsor.anchor_name}" %>
+ <%- end %>
+ </p>
</li>
View
1  app/views/speakers/index.html.erb
@@ -1,3 +1,4 @@
+<h1>Speakers</h1>
<ul>
<%= render :partial => 'speaker', :collection => @speakers, :as => :speaker %>
</ul>
View
12 app/views/sponsors/_sponsor.html.erb
@@ -0,0 +1,12 @@
+<li>
+ <a name="<%= sponsor.anchor_name %>">
+ <h2><%= sponsor.name %></h2>
+ </a>
+ <%- if sponsor.image_path? %>
+ <div class="sponsor-image-block">
+ <%= image_tag sponsor.image_path, :class => 'sponsor-image' %>
+ </div>
+ <% end %>
+ <p><%= link_to "Website", sponsor.url if sponsor.url %></p>
+ <p><%= sponsor.description %></p>
+</li>
View
4 app/views/sponsors/index.html.erb
@@ -0,0 +1,4 @@
+<h1>Sponsors</h1>
+<ul>
+ <%= render :partial => 'sponsor', :collection => @sponsors %>
+</ul>
View
4 config/routes.rb
@@ -1,12 +1,14 @@
UXMad::Application.routes.draw do
+
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
resources :speakers, :only => [:index]
+ resources :sponsors, :only => [:index]
# get "/speakers" => 'home#speakers'
- get "/sponsors" => 'home#sponsors'
+# get "/sponsors" => 'home#sponsors'
# get "/schedule" => 'home#schedule'
# get "/travel" => 'home#travel'
get "/register" => 'home#register'

0 comments on commit f9a5f1c

Please sign in to comment.
Something went wrong with that request. Please try again.