Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Getting there. Added Key Stroke Navigation and more Responsive CSS.

  • Loading branch information...
commit a81ff62b1ba7ddc211008b2f738d0d9ea8924d8e 1 parent 1d9a4d0
@robertmilner authored
Showing with 521 additions and 193 deletions.
  1. +1 −0  app/assets/javascripts/application.js
  2. +33 −1 app/assets/javascripts/global.js
  3. +47 −0 app/assets/stylesheets/alert.css.scss
  4. +3 −1 app/assets/stylesheets/application.css.scss
  5. +0 −4 app/assets/stylesheets/global/_mixins.scss
  6. +0 −1  app/assets/stylesheets/global/footer.css.scss
  7. +10 −6 app/assets/stylesheets/global/forms.css.scss
  8. +20 −0 app/assets/stylesheets/global/global.css.scss
  9. +23 −0 app/assets/stylesheets/global/notice.css.scss
  10. +17 −5 app/assets/stylesheets/global/section.css.scss
  11. +53 −0 app/assets/stylesheets/responsive.css.scss
  12. +28 −8 app/controllers/pages_controller.rb
  13. +0 −2  app/helpers/excuses_helper.rb
  14. +0 −2  app/helpers/favorites_helper.rb
  15. +0 −2  app/helpers/locations_helper.rb
  16. +1 −1  app/helpers/pages_helper.rb
  17. +0 −2  app/helpers/searches_helper.rb
  18. +0 −2  app/helpers/sessions_helper.rb
  19. +0 −2  app/helpers/users_helper.rb
  20. +58 −50 app/models/excuse.rb
  21. +19 −8 app/models/location.rb
  22. +23 −0 app/models/tag.rb
  23. +5 −2 app/views/layouts/_notice.html.haml
  24. +55 −43 app/views/pages/_carousel.html.haml
  25. +0 −1  app/views/pages/_header.html.haml
  26. +2 −2 app/views/pages/_search_box.html.haml
  27. +2 −8 app/views/pages/excuse.html.haml
  28. +1 −0  app/views/pages/favorite.js.erb
  29. +2 −11 app/views/pages/location.html.haml
  30. +10 −0 app/views/pages/robert.html.haml
  31. +2 −9 app/views/pages/search.html.haml
  32. +2 −11 app/views/pages/tag.html.haml
  33. +10 −9 config/routes.rb
  34. +94 −0 vendor/assets/javascripts/bootstrap-alert.js
View
1  app/assets/javascripts/application.js
@@ -1,5 +1,6 @@
//= require jquery
//= require jquery_ujs
+//= require bootstrap-alert
//= require bootstrap-transition
//= require bootstrap-tooltip
//= require bootstrap-carousel
View
34 app/assets/javascripts/global.js
@@ -20,7 +20,7 @@ $(document).ready(function($) {
// Pages - Carousel Partial
$('.carousel').carousel({
- interval: 10000
+ interval: 100000
});
$('.carousel-previous-button').click(function() {
$('.carousel').carousel('prev');
@@ -30,5 +30,37 @@ $(document).ready(function($) {
});
// end
+ // Pages - Carousel Keyboard Navigation
+ // Left and Right Keys on keyup() maybe switch to keypress() or keydown()
+ $(document.documentElement).keyup(function (event) {
+ if (event.keyCode == 37) {
+ $('.carousel').carousel('prev');
+ } else if (event.keyCode == 39) {
+ $('.carousel').carousel('next');
+ }
+ });
+
+
+ $(document.documentElement).keydown(function (event) {
+ if (event.keyCode == 32) {
+ $('.carousel').carousel('next');
+ event.preventDefault();
+ }
+ });
+
+ // Pages - Favorite Buttom
+ $('.btn-favorite').click(function(e) {
+ $('.favorite form').submit();
+ e.preventDefault();
+ });
+ // end
+
+ // This is a cool height fix but fixed positioning with top side and bottom = 0 works better.
+ // // Pages - Carousel Buttons
+ // $(window).resize(function() {
+ // var pageheight = $(window).height();
+ // $('.carousel-previous-button, .carousel-forward-button').height(pageheight);
+ // });
+ // // end
});
View
47 app/assets/stylesheets/alert.css.scss
@@ -0,0 +1,47 @@
+.alert {
+ padding: 8px 35px 8px 14px;
+ margin-bottom: 18px;
+ text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
+ background-color: #fcf8e3;
+ border: 1px solid #fbeed5;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ color: #c09853;
+}
+.alert-heading {
+ color: inherit;
+}
+.alert .close {
+ position: relative;
+ top: -2px;
+ right: -21px;
+ line-height: 18px;
+}
+.alert-success {
+ background-color: #dff0d8;
+ border-color: #d6e9c6;
+ color: #468847;
+}
+.alert-danger,
+.alert-error {
+ background-color: #f2dede;
+ border-color: #eed3d7;
+ color: #b94a48;
+}
+.alert-info {
+ background-color: #d9edf7;
+ border-color: #bce8f1;
+ color: #3a87ad;
+}
+.alert-block {
+ padding-top: 14px;
+ padding-bottom: 14px;
+}
+.alert-block > p,
+.alert-block > ul {
+ margin-bottom: 0;
+}
+.alert-block p + p {
+ margin-top: 5px;
+}
View
4 app/assets/stylesheets/application.css.scss
@@ -9,8 +9,9 @@
* compiled file, but it's generally better to create a new file per style scope.
*
*= require global/reset
- *= require global/fontface
*= require global/global
+ *= require alert
+ *= require global/notice
*= require global/forms
*= require global/header
*= require carousel
@@ -18,4 +19,5 @@
*= require global/section
*= require global/nav
*= require global/footer
+ *= require responsive
*/
View
4 app/assets/stylesheets/global/_mixins.scss
@@ -1,9 +1,5 @@
/* mixins */
-@mixin font_face {
- font-family: "IcoMoonRegular", "Helvetica Neue", Helvetica, Arial, sans-serif;
-}
-
@mixin text_shadow($hor, $vert, $blur, $color) {
-moz-text-shadow: $hor $vert $blur $color;
-webkit-text-shadow: $hor $vert $blur $color;
View
1  app/assets/stylesheets/global/footer.css.scss
@@ -27,7 +27,6 @@ footer {
color: #fff;
display: block;
text-align: center;
- @include font_face;
@include text_shadow(0, 3px, 0, $black);
img {
width: 40%;
View
16 app/assets/stylesheets/global/forms.css.scss
@@ -23,16 +23,17 @@ input[type="submit"] {
cursor: pointer;
-webkit-appearance: button;
}
-.search {
+.space, .search {
+ min-width: 300px;
max-width: 620px;
- width: 100%;
+ width: 80%;
margin-left: auto;
margin-right: auto;
- padding: 3px 0;
-
+ padding-top: 86px;
+ padding-bottom: 40px;
.form-search {
- padding-left: 14px;
- padding-right: 14px;
+ padding-left: 5%;
+ padding-right: 5%;
.search-query {
width: 100%;
@@ -44,6 +45,9 @@ input[type="submit"] {
}
}
}
+.space {
+ padding-bottom: 0;
+}
/*button,
input,
View
20 app/assets/stylesheets/global/global.css.scss
@@ -25,4 +25,24 @@ body {
a {
color: $black;
text-decoration: none;
+}
+.close {
+ float: right;
+ font-size: 20px;
+ font-weight: bold;
+ line-height: 18px;
+ color: #000000;
+ text-shadow: 0 1px 0 #ffffff;
+ opacity: 0.2;
+ filter: alpha(opacity=20);
+ &:hover {
+ color: #000000;
+ text-decoration: none;
+ opacity: 0.4;
+ filter: alpha(opacity=40);
+ cursor: pointer;
+ }
+}
+.clearfix {
+ clear: both;
}
View
23 app/assets/stylesheets/global/notice.css.scss
@@ -0,0 +1,23 @@
+#notice {
+ position: fixed;
+ left: 0;
+ top: 0;
+ right: 0;
+ padding-top: 60px;
+ div {
+ min-width: 320px;
+ max-width: 620px;
+ width: 80%;
+ margin-left: auto;
+ margin-right: auto;
+ }
+ .info {
+
+ }
+ .success {
+
+ }
+ .warning {
+
+ }
+}
View
22 app/assets/stylesheets/global/section.css.scss
@@ -27,6 +27,10 @@ section {
}
}
.carousel-previous-button {
+ position: fixed;
+ top: 0;
+ left: 0;
+ bottom: 0;
background-image: url('/assets/arrow_left_black.png');
background-image: none, url('/assets/arrow_left_black.svg'), url('/assets/arrow_left_black.png');
background-size: 60% auto;
@@ -34,6 +38,10 @@ section {
background-position: center center;
}
.carousel-forward-button {
+ position: fixed;
+ top: 0;
+ right: 0;
+ bottom: 0;
background-image: url('/assets/arrow_right_black.png');
background-image: none, url('/assets/arrow_right_black.svg'), url('/assets/arrow_right_black.png');
background-size: 60% auto;
@@ -41,13 +49,13 @@ section {
background-position: center center;
}
.carousel-inner {
- float: left;
- margin-top: 90px;
- margin-bottom: 5%;
+ margin-left: auto;
+ margin-right: auto;
width: 80%;
.item {
- padding: 5%;
- min-height: 200px;
+ padding: 0 5%;
+ width: 90%;
+ min-height: 300px;
h2 {
font-size: 42px;
line-height: 56px;
@@ -79,6 +87,9 @@ section {
padding-right: 20px;
float: left;
padding: 5px 20px;
+ &:first-child {
+ border-left: 0;
+ }
}
.favorite {
border-left: 0;
@@ -90,6 +101,7 @@ section {
height: auto;
margin-top: -4px;
opacity: 0.2;
+ cursor: pointer;
}
.btn-favorite.true {
opacity: 0.8;
View
53 app/assets/stylesheets/responsive.css.scss
@@ -0,0 +1,53 @@
+@media screen and (max-width: 640px) {
+
+
+ section {
+ #carousel-excuses {
+ .carousel-inner {
+ .item {
+ h2 {
+ font-size: 24px;
+ line-height: 32px;
+ }
+ }
+ }
+ }
+ }
+ .details {
+ div {
+ border-left: 1px solid #ccc;
+ border-right: 1px solid #fff;
+ float: left;
+ &:first-child {
+ border-left: 0;
+ padding-left: 0;
+ }
+ &:last-child {
+ border-right: 0;
+ }
+ }
+ .favorite {
+ border-left: 0;
+ padding-left: 0;
+ form {
+ text-align: left;
+ margin-left: 10px;
+ }
+ }
+ .location {
+ border-right: 0;
+ padding-right: 0;
+ ul {
+ margin-left: 10px;
+ }
+ }
+ .tags {
+ border: 0;
+ padding-left: 0;
+ ul {
+ margin-left: 10px;
+ }
+ }
+ }
+
+}
View
36 app/controllers/pages_controller.rb
@@ -7,25 +7,40 @@ class PagesController < ApplicationController
def excuse
@user = @current_user
# arguments [0] = total number of results
- @excuses = Excuse.random(5)
+ @excuses = Excuse.find_excuses_by_random(5)
end
def search
@user = @current_user
- # arguments [0] = params[:search], [1] = total number of results
- @excuses = Excuse.search(params[:search], 5)
+ if params[:name]
+ @excuses = Excuse.find_excuses_by_named_text(params[:name], 5)
+ elsif params[:search]
+ @excuses = Excuse.search_excuses(params[:search], 5)
+ else
+ @excuses = Excuse.find_excuses_by_random(5)
+ end
end
def location
@user = @current_user
- # arguments [0] = params[:search], [1] = total number of results
- @excuses = Excuse.search_location(params[:search], 5)
+ if params[:name]
+ @excuses = Location.find_excuses_by_named_location(params[:name], 5)
+ elsif params[:search]
+ @excuses = Location.find_excuses_by_searched_locations(params[:search], 5)
+ else
+ @excuses = Excuse.find_excuses_by_random(5)
+ end
end
def tag
@user = @current_user
- # @excuses = Excuse.search_tag(params[:search], 5)
- @excuses = Excuse.limit(5)
+ if params[:name]
+ @excuses = Tag.find_excuses_by_named_tag(params[:name], 5)
+ elsif params[:search]
+ @excuses = Tag.find_excuses_by_searched_tags(params[:search], 5)
+ else
+ @excuses = Excuse.find_excuses_by_random(5)
+ end
end
def favorite
@@ -40,7 +55,12 @@ def favorite
def user
@user = @current_user
- @excuses = @user.excuses
+ @excuses = @user.excuses.limit(5)
@favorites = @user.favorable(:type => :excuse, :delve => :true)
end
+
+ def robert
+ @user = User.find_by_name('Robert Milner')
+ @excuses = @user.excuses.all
+ end
end
View
2  app/helpers/excuses_helper.rb
@@ -1,2 +0,0 @@
-module ExcusesHelper
-end
View
2  app/helpers/favorites_helper.rb
@@ -1,2 +0,0 @@
-module FavoritesHelper
-end
View
2  app/helpers/locations_helper.rb
@@ -1,2 +0,0 @@
-module LocationsHelper
-end
View
2  app/helpers/pages_helper.rb
@@ -3,7 +3,7 @@ module PagesHelper
def favorited_image_tag(excuse, user)
# need to figure out how to check if current excuse is favorited by the current user
# this is currently not working
- if excuse.user == user.favorites
+ if excuse.favorites.map(&:user_id).include?(user.id)
image_tag "heart_red.svg", :class => "btn-favorite true", :alt => ""
else
image_tag "heart_black.svg", :class => "btn-favorite", :alt => ""
View
2  app/helpers/searches_helper.rb
@@ -1,2 +0,0 @@
-module SearchesHelper
-end
View
2  app/helpers/sessions_helper.rb
@@ -1,2 +0,0 @@
-module SessionsHelper
-end
View
2  app/helpers/users_helper.rb
@@ -1,2 +0,0 @@
-module UsersHelper
-end
View
108 app/models/excuse.rb
@@ -17,66 +17,74 @@ class Excuse < ActiveRecord::Base
# callbacks
after_save :assign_tags
- # methods
-
- def tag_names
- @tag_names || tags.map(&:name).join(' ')
- end
-
- # pages_contoller#excuse
- def self.random(total)
- self.find(:all, :order => 'random()', :limit => total)
- end
+ # class methods
+ # pages_controller [:excuse, :search, :location, :tag]
+ def self.find_excuses_by_random(total)
+ limit(total).order('random()')
+ end
+
+ # pages_controller [:search] by params[:text]
+ def self.find_excuses_by_named_text(name, total)
+ where('text LIKE ?', "%#{name}%").limit(total)
+ end
- def self.search(search, total)
- if search
- search_length = search.split.length
- # keyword type search with words in specific order
- # find(:all, :conditions => ['text LIKE ?', "%#{search}%"], :limit => total, :order => 'random()')
+ def self.search_excuses(search, total)
+ if search
+ search_length = search.split.length
+ # keyword type search with words in specific order
+ # find(:all, :conditions => ['text LIKE ?', "%#{search}%"], :limit => total, :order => 'random()')
- # completely fuzzy search, no word order necessary
- find( :all,
- :conditions => [(['text LIKE ?'] * search_length).join(' AND ')] + search.split.map { |name| "%#{name}%" },
- :limit => total,
- :order => 'random()' )
- else
- find(:all, :limit => total, :order => 'random()')
+ # completely fuzzy search, no word order necessary
+ find( :all,
+ :conditions => [(['text LIKE ?'] * search_length).join(' AND ')] + search.split.map { |name| "%#{name}%" },
+ :limit => total,
+ :order => 'random()' )
+ end
end
- end
- # pages_contoller#location
- def self.search_location(search, total)
- if search
- all( :joins => { :location => { } },
- :conditions => { :locations => { :name => search } },
- # { :locations => { :name => "%#{search}%" } },
- # A.find(:all, :conditions => ["b.foo = ?", 25], :joins => {:b =>{}} )
+ # pages_contoller#location
+ def self.search_locations(search, total)
+ if search
+ all( :joins => { :location => { } },
+ :conditions => { :locations => { :name => search } },
+ # { :locations => { :name => "%#{search}%" } },
+ # A.find(:all, :conditions => ["b.foo = ?", 25], :joins => {:b =>{}} )
- # :conditions => { :locations => [(['name LIKE ?'] * search_length).join(' AND ')] + search.split.map { |name| "%#{name}%" },
- # :conditions => { :locations => { :name => search } },
- :limit => total,
- :order => 'random()' )
- else
- find(:all, :limit => total, :order => 'random()')
+ # :conditions => { :locations => [(['name LIKE ?'] * search_length).join(' AND ')] + search.split.map { |name| "%#{name}%" },
+ # :conditions => { :locations => { :name => search } },
+ :limit => total,
+ :order => 'random()' )
+ else
+ find(:all, :limit => total, :order => 'random()')
+ end
+ end
+
+ def self.search_tags(search, total)
+ if search
+ search_terms = search.split
+ search_terms.each do |term|
+ @taggings = Tag.where('name LIKE ?', "%#{term}%")
+ end
+ @taggings.each do |tag|
+ @tagged_excuses = Excuse.where('text LIKE ?', "%#{tag}%")
+ end
+ return @tagged_excuses
+ else
+ find(:all, :limit => total, :order => 'random()')
+ end
end
- end
- def self.search_tag(search, total)
- if search
- all( :joins => { :tags => {} },
- :conditions => { :tags => { :name => search } },
- :limit => total,
- :order => 'random()' )
+ # instance methods
+ def tag_names
+ @tag_names || tags.map(&:name).join(' ')
end
- end
- # pages_contoller#tag
- def assign_tags
- if @tag_names
- self.tags = @tag_names.split.map do |name|
- Tag.find_or_create_by_name(name)
+ def assign_tags
+ if @tag_names
+ self.tags = @tag_names.split.map do |name|
+ Tag.find_or_create_by_name(name)
+ end
end
end
- end
end
View
27 app/models/location.rb
@@ -8,18 +8,29 @@ class Location < ActiveRecord::Base
# callbacks
- # methods
- def self.search(search, total)
+ # class methods
+ def self.find_excuses_by_named_location(name, total)
+ location = where('name LIKE ?', "%#{name}%")
+ if location.empty?
+ []
+ else
+ location.first.excuses.order('random()').limit(total)
+ end
+ end
+
+ def self.find_excuses_by_searched_locations(search, total)
if search
# split the params[:search] query and get length
search_length = search.split.length
# completely fuzzy search, no word order necessary
- find( :all,
- :conditions => [(['name LIKE ?'] * search_length).join(' AND ')] + search.split.map { |name| "%#{name}%" },
- :limit => total,
- :order => 'random()' )
+ locations = find( :all,
+ :conditions => [(['name LIKE ?'] * search_length).join(' OR ')] + search.split.map { |name| "%#{name}%" },
+ :limit => total)
+ excuses = locations.flat_map { |i| i.excuses.limit(total) }
+ return excuses.shuffle
else
- find(:all, :limit => total, :order => 'random()')
+ []
end
end
-end
+
+end
View
23 app/models/tag.rb
@@ -4,4 +4,27 @@ class Tag < ActiveRecord::Base
has_many :taggings, :dependent => :destroy
has_many :excuses, :through => :taggings
+ # class methods
+ def self.find_excuses_by_named_tag(name, total)
+ tag = where('name LIKE ?', "%#{name}%")
+ if tag.empty?
+ []
+ else
+ tag.first.excuses.order('random()').limit(total)
+ end
+ end
+
+ def self.find_excuses_by_searched_tags(search, total)
+ if search
+ search_length = search.split.length
+ tags = find(:all,
+ :conditions => [(['name LIKE ?'] * search_length).join(' OR ')] + search.split.map { |name| "%#{name}%" },
+ :limit => total)
+ excuses = tags.flat_map { |i| i.excuses.limit(total) }
+ return excuses.shuffle
+ else
+ []
+ end
+ end
+
end
View
7 app/views/layouts/_notice.html.haml
@@ -1,2 +1,5 @@
-#notice{ :class => type }
- = notice
+#notice
+ %div{ :class => "alert alert-#{type}" }
+ %a{ :class => "close", "data-dismiss" => "alert", :href => "#" }
+ &times;
+ = notice
View
98 app/views/pages/_carousel.html.haml
@@ -1,46 +1,58 @@
-- if @excuses.count > 0
- - @excuses.each_with_index do |excuse, index|
- - if index == 0
- .item.active
- %h2
- = excuse.text
- .details
- - if @current_user.present?
- .favorite
- %h3 Favorite
- = form_tag favorites_path do
- = hidden_field_tag :excuse, excuse.id
- = favorited_image_tag(excuse, @current_user)
- .location
- %h3 Location
- %ul
- %li= link_to excuse.location.name, "/location/#{excuse.location.name.parameterize}"
- .tags
- %h3 Tags
- %ul
- - excuse.tags.each do |tag|
- %li.tag= link_to tag.name, "/tag/#{tag.name}", :rel => "tag"
+#carousel-excuses.carousel.slide
+
+ .carousel-previous-button
+ .carousel-previous-icon
+
+ .carousel-inner
+
+ - if @excuses.count > 0
+ - @excuses.each_with_index do |excuse, index|
+ - if index == 0
+ .item.active
+ %h2
+ = excuse.text
+ .details
+ - if @current_user.present?
+ .favorite
+ %h3 Favorite
+ = form_tag favorites_path, :remote => true do
+ = hidden_field_tag :excuse, excuse.id
+ = favorited_image_tag(excuse, @current_user)
+ .location
+ %h3 Location
+ %ul
+ %li= link_to excuse.location.name, "/location/#{excuse.location.name.parameterize}"
+ .tags
+ %h3 Tags
+ %ul
+ - excuse.tags.each do |tag|
+ %li.tag= link_to tag.name, "/tag/#{tag.name}", :rel => "tag"
+
+ - else
+ .item
+ %h2
+ = excuse.text
+ .details
+ - if @current_user.present?
+ .favorite
+ %h3 Favorite
+ = form_tag favorites_path, :remote => true do
+ = hidden_field_tag :excuse, excuse.id
+ = favorited_image_tag(excuse, @current_user)
+ .location
+ %h3 Location
+ %ul
+ %li= link_to excuse.location.name, "/location/#{excuse.location.name.parameterize}"
+ .tags
+ %h3 Tags
+ %ul
+ - excuse.tags.each do |tag|
+ %li.tag= link_to tag.name, "/tag/#{tag.name}", :rel => "tag"
- else
- .item
- %h2
- = excuse.text
- .details
- - if @current_user.present?
- .favorite
- %h3 Favorite
- = form_tag favorites_path do
- = hidden_field_tag :excuse, excuse.id
- = favorited_image_tag(excuse, @current_user)
- .location
- %h3 Location
- %ul
- %li= link_to excuse.location.name, "/location/#{excuse.location.name.parameterize}"
- .tags
- %h3 Tags
- %ul
- - excuse.tags.each do |tag|
- %li.tag= link_to tag.name, "/tag/#{tag.name}", :rel => "tag"
+ .item.active There's no excuse for no excuses! There's only an excuse for Oh, Excuses... Why don't you create one?
+
+ .clearfix
-- else
- .item.active There's no excuse for no excuses! There's only an excuse for Oh, Excuses... Why don't you create one?
+ .carousel-forward-button
+ .carousel-forward-icon
View
1  app/views/pages/_header.html.haml
@@ -6,5 +6,4 @@
%li= link_to "", new_excuse_path, :title => "Write an excuse", :class => "btn btn-write"
- else
%ul
- %li= link_to "Sign Up", new_user_path, :title => "Create an account", :class => "btn"
%li= link_to "Login", login_path, :title => "Login to your excuse", :class => "btn"
View
4 app/views/pages/_search_box.html.haml
@@ -1,3 +1,3 @@
.search
- = form_tag form_link, method: 'get', :remote => true, :class => "form-search" do
- = search_field_tag :search, params[:search], placeholder: placeholder, :class => "search-query"
+ = form_tag form_link, method: 'get', :class => "form-search" do
+ = search_field_tag :search, params[:name] || params[:search], placeholder: placeholder, :class => "search-query"
View
10 app/views/pages/excuse.html.haml
@@ -4,13 +4,7 @@
= render 'layouts/notice', :notice => notice, :type => "info"
%section
- #carousel-excuses.carousel.slide
- .carousel-previous-button
- .carousel-previous-icon
+ .space
- .carousel-inner
- = render 'carousel', :excuses => @excuses
-
- .carousel-forward-button
- .carousel-forward-icon
+ = render 'carousel', :excuses => @excuses
View
1  app/views/pages/favorite.js.erb
@@ -0,0 +1 @@
+$(".btn-favorite").fadeOut().attr('src', '/assets/heart_red.svg').fadeIn();
View
13 app/views/pages/location.html.haml
@@ -4,16 +4,7 @@
= render 'layouts/notice', :notice => notice, :type => "info"
%section
- #carousel-excuses.carousel.slide
- .carousel-previous-button
- .carousel-previous-icon
+ = render 'search_box', form_link: app_location_path, placeholder: 'Search by locations'
- .carousel-inner
- = render 'search_box', form_link: app_location_path, placeholder: 'Search by locations'
- = render 'carousel', :excuses => @excuses
-
- .carousel-forward-button
- .carousel-forward-icon
-
-%span Can you believe it? There are no excuses from this location... Yet. Why don't you create one?
+ = render 'carousel', :excuses => @excuses
View
10 app/views/pages/robert.html.haml
@@ -0,0 +1,10 @@
+- provide(:title, 'Oh, Excuses')
+
+- if notice
+ = render 'layouts/notice', :notice => notice, :type => "info"
+
+%section
+
+ .space
+
+ = render 'carousel', :excuses => @excuses
View
11 app/views/pages/search.html.haml
@@ -4,14 +4,7 @@
= render 'layouts/notice', :notice => notice, :type => "info"
%section
- #carousel-excuses.carousel.slide
- .carousel-previous-button
- .carousel-previous-icon
+ = render 'search_box', form_link: app_search_path, placeholder: 'Search by words'
- .carousel-inner
- = render 'search_box', form_link: app_search_path, placeholder: 'Search by words'
- = render 'carousel', :excuses => @excuses
-
- .carousel-forward-button
- .carousel-forward-icon
+ = render 'carousel', :excuses => @excuses
View
13 app/views/pages/tag.html.haml
@@ -4,16 +4,7 @@
= render 'layouts/notice', :notice => notice, :type => "info"
%section
- #carousel-excuses.carousel.slide
- .carousel-previous-button
- .carousel-previous-icon
+ = render 'search_box', form_link: app_tag_path, placeholder: 'Search by tags'
- .carousel-inner
- = render 'search_box', form_link: app_tag_path, placeholder: 'Search by tags'
- = render 'carousel', :excuses => @excuses
-
- .carousel-forward-button
- .carousel-forward-icon
-
-%span Can you believe it? There are no excuses with this tag... Yet. Why don't you create one?
+ = render 'carousel', :excuses => @excuses
View
19 config/routes.rb
@@ -1,15 +1,16 @@
OhExcusesApp2::Application.routes.draw do
# pages_controller
- get '/excuse' => 'pages#excuse', :as => :app_excuse
- get '/search' => 'pages#search', :as => :app_search
- get '/search/:search' => 'pages#search'
- get '/location' => 'pages#location', :as => :app_location
- get '/location/:search' => 'pages#location'
- get '/tag' => 'pages#tag', :as => :app_tag
- get '/tag/:search' => 'pages#tag'
- get '/favorite' => 'pages#favorite', :as => :app_favorite
- get '/user' => 'pages#user', :as => :app_user
+ get '/robert' => 'pages#robert', :as => :app_robert
+ get '/excuse' => 'pages#excuse', :as => :app_excuse
+ get '/search/:name' => 'pages#search'
+ get '/search' => 'pages#search', :as => :app_search
+ get '/location/:name' => 'pages#location'
+ get '/location' => 'pages#location', :as => :app_location
+ get '/tag/:name' => 'pages#tag'
+ get '/tag' => 'pages#tag', :as => :app_tag
+ get '/favorite' => 'pages#favorite', :as => :app_favorite
+ get '/user' => 'pages#user', :as => :app_user
# sessions_controller
get '/login' => 'sessions#new', :as => :login
View
94 vendor/assets/javascripts/bootstrap-alert.js
@@ -0,0 +1,94 @@
+/* ==========================================================
+ * bootstrap-alert.js v2.0.2
+ * http://twitter.github.com/bootstrap/javascript.html#alerts
+ * ==========================================================
+ * Copyright 2012 Twitter, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ========================================================== */
+
+
+!function( $ ){
+
+ "use strict"
+
+ /* ALERT CLASS DEFINITION
+ * ====================== */
+
+ var dismiss = '[data-dismiss="alert"]'
+ , Alert = function ( el ) {
+ $(el).on('click', dismiss, this.close)
+ }
+
+ Alert.prototype = {
+
+ constructor: Alert
+
+ , close: function ( e ) {
+ var $this = $(this)
+ , selector = $this.attr('data-target')
+ , $parent
+
+ if (!selector) {
+ selector = $this.attr('href')
+ selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
+ }
+
+ $parent = $(selector)
+ $parent.trigger('close')
+
+ e && e.preventDefault()
+
+ $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
+
+ $parent
+ .trigger('close')
+ .removeClass('in')
+
+ function removeElement() {
+ $parent
+ .trigger('closed')
+ .remove()
+ }
+
+ $.support.transition && $parent.hasClass('fade') ?
+ $parent.on($.support.transition.end, removeElement) :
+ removeElement()
+ }
+
+ }
+
+
+ /* ALERT PLUGIN DEFINITION
+ * ======================= */
+
+ $.fn.alert = function ( option ) {
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('alert')
+ if (!data) $this.data('alert', (data = new Alert(this)))
+ if (typeof option == 'string') data[option].call($this)
+ })
+ }
+
+ $.fn.alert.Constructor = Alert
+
+
+ /* ALERT DATA-API
+ * ============== */
+
+ $(function () {
+ $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
+ })
+
+}( window.jQuery );
Please sign in to comment.
Something went wrong with that request. Please try again.