Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ajax added to search pages. No history state yet.

  • Loading branch information...
commit c678362ead82a46aa1a48c9ae93e25ab6595b2f0 1 parent 993f4fd
@robertmilner authored
View
32 app/assets/stylesheets/account.css.scss
@@ -0,0 +1,32 @@
+@import 'global/variables';
+@import 'global/mixins';
+
+#account {
+ min-width: 300px;
+ max-width: 620px;
+ width: 100%;
+ margin-left: auto;
+ margin-right: auto;
+ padding-top: 80px;
+ padding-bottom: 190px;
+ h2 {
+ font-size: 18px;
+ line-height: 24px;
+ text-transform: uppercase;
+ margin: 10px 20px;
+ }
+ ul {
+ background-color: #fff;
+ border: 1px solid #ccc;
+ margin: 0 10px 30px 10px;
+ padding: 0 10px;
+ @include border_radius(10px);
+ li {
+ border-bottom: 1px solid #ccc;
+ padding: 10px;
+ &:last-child {
+ border-bottom: none;
+ }
+ }
+ }
+}
View
1  app/assets/stylesheets/application.css → app/assets/stylesheets/application.css.scss
@@ -14,6 +14,7 @@
*= require global/forms
*= require global/header
*= require carousel
+ *= require account
*= require global/section
*= require global/nav
*= require global/footer
View
6 app/assets/stylesheets/global/header.css.scss
@@ -52,10 +52,10 @@ header {
}
}
a.btn-write {
- height: 26px;
- width: 26px;
+ height: 24px;
+ width: 24px;
display: block;
- padding: 4px;
+ padding: 6px;
background-color: $red_shade;
@include border_radius(10px);
background-image: url('../write.svg');
View
4 app/controllers/pages_controller.rb
@@ -5,21 +5,25 @@ class PagesController < ApplicationController
before_filter :current_user
def excuse
+ @user = @current_user
# arguments [0] = total number of results
@excuses = Excuse.random(5)
end
def search
+ @user = @current_user
# arguments [0] = params[:search], [1] = total number of results
@excuses = Excuse.search(params[:search], 5)
end
def location
+ @user = @current_user
# arguments [0] = params[:search], [1] = total number of results
@excuses = Excuse.search_location(params[:search], 5)
end
def tag
+ @user = @current_user
# @excuses = Excuse.search_tag(params[:search], 5)
@excuses = Excuse.limit(5)
end
View
2  app/views/pages/_search_box.html.haml
@@ -1,3 +1,3 @@
.search
- = form_tag form_link, method: 'get', :class => "form-search" do
+ = form_tag form_link, method: 'get', :remote => true, :class => "form-search" do
= search_field_tag :search, params[:search], placeholder: placeholder, :class => "search-query"
View
1  app/views/pages/location.js.erb
@@ -0,0 +1 @@
+$(".carousel-inner").html("<%= escape_javascript(render('carousel', :excuses => @excuses)) %>");
View
1  app/views/pages/search.js.erb
@@ -0,0 +1 @@
+$(".carousel-inner").html("<%= escape_javascript(render('carousel', :excuses => @excuses)) %>");
View
1  app/views/pages/tag.js.erb
@@ -0,0 +1 @@
+$(".carousel-inner").html("<%= escape_javascript(render('carousel', :excuses => @excuses)) %>");
View
69 app/views/pages/user.html.haml
@@ -1,35 +1,44 @@
- provide(:title, 'Account')
-%h2 Your stats
-%ul
- %li
- = @user.excuses.count
- %span Excuses
- %li
- = @user.favorites.count
- %span Favorites
-
-%h2 Your info
-%ul
- %li= @user.name
- %li= @user.email
- %li= @user.location.name
- %li= link_to "Edit your info", edit_user_path(@user)
-
-%h2 Your excuses
-- if @excuses.count > 0
- %ul
- - @excuses.each do |excuse|
- %li= excuse.text
-- else
- %ul
- %li You haven't created any excuses yet! What's your excuse?
+- if notice
+ = render 'layouts/notice', :notice => notice, :type => "info"
+
+%section#account
+
+ %h2 Your stats
-%h2 Your favorites
-- if @favorites.count > 0
%ul
- - @favorites.each do |excuse|
- %li= excuse.text
-- else
+ %li
+ = @user.excuses.count
+ %span Excuses
+ %li
+ = @user.favorites.count
+ %span Favorites
+
+ %h2 Your info
+
%ul
- %li You don't have any favorite excuses!
+ %li= @user.name
+ %li= @user.email
+ %li= @user.location.name
+ %li= link_to "Edit your info", edit_user_path(@user)
+
+ %h2 Your excuses
+
+ - if @excuses.count > 0
+ %ul
+ - @excuses.each do |excuse|
+ %li= excuse.text
+ - else
+ %ul
+ %li You haven't created any excuses yet! What's your excuse?
+
+ %h2 Your favorites
+
+ - if @favorites.count > 0
+ %ul
+ - @favorites.each do |excuse|
+ %li= excuse.text
+ - else
+ %ul
+ %li You don't have any favorite excuses!
Please sign in to comment.
Something went wrong with that request. Please try again.