Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Commit

Permalink
fix atom feed, allow users to create requests
Browse files Browse the repository at this point in the history
  • Loading branch information
patbl committed Feb 20, 2014
1 parent 9703fbc commit 9e84678
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 40 deletions.
3 changes: 2 additions & 1 deletion app/controllers/proposals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class ProposalsController < ApplicationController
def index
respond_to do |format|
format.html do
@proposals = Proposal.recent.filter_by_tag(params[:category]).page(params[:page]).per(30).decorate
klass = params[:type].constantize
@proposals = klass.recent.filter_by_tag(params[:category]).page(params[:page]).per(30).decorate
end

format.atom do
Expand Down
28 changes: 0 additions & 28 deletions app/views/offers/_offer.html.haml

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/shared/_footer.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
%li.icon= link_to(fa_tag("twitter"), "https://twitter.com/Skillshare_im")
%li.icon= link_to(fa_tag("github"), "https://github.com/patbl/ea-skillshare")
%li.icon= mail_to("pbrinichlanglois@gmail.com", fa_tag("envelope"), target: "_blank")
%li.icon= link_to(fa_tag("rss"), offers_atom_url(format: "atom"))
%li.icon= link_to(fa_tag("rss"), proposals_atom_url(format: "atom"))
%li
%div.fb-like{"data-action" => "like", "data-href" => "http://skillshare.im/", "data-layout" => "button_count", "data-share" => "false", "data-show-faces" => "true" }
%li
Expand Down
21 changes: 15 additions & 6 deletions app/views/shared/_header.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,27 @@
.logos
.icons
= link_to raw('<i rel="tooltip" title="Offers" class="fa fa-gift"></i>'), :offers, class: active?(offers_path)
= link_to raw('<i rel="tooltip" title="Wanteds" class="fa fa-share"></i>'), :wanteds, class: active?(wanteds_path)
= link_to raw('<i rel="tooltip" title="Users" class="fa fa-group"></i>'), :users, class: active?(users_path)
= link_to raw('<i rel="tooltip" title="Map" class="fa fa-globe"></i>'), :map, class: active?(map_path)

.col-sm-3
.right
.btn-group
- if signed_in?
%button.btn.btn-default.dropdown-toggle{"data-toggle" => "dropdown", type: "button"}
<i rel="tooltip" title="Profile" class="fa fa-user"></i>
%ul.pull-right.dropdown-menu{role: "menu"}
%li= link_to(current_user.name, current_user)
%li= link_to "Sign Out", sign_out_path, id: "sign_out"
= link_to raw('<i rel="tooltip" title="Create Offer" class="fa fa-plus"></i>'), new_user_offer_path(current_user), class: "new-offer-btn"
%ul.nav.navbar-nav
%li
%button.btn.btn-default.dropdown-toggle{"data-toggle" => "dropdown", type: "button"}
<i rel="tooltip" title="New" class="fa fa-plus"></i>
%ul.dropdown-menu{role: "menu"}
%li= link_to "New offer", new_user_offer_path(current_user)
%li= link_to "New wanted", new_user_wanted_path(current_user)
%li
%button.btn.btn-default.dropdown-toggle{"data-toggle" => "dropdown", type: "button"}
<i rel="tooltip" title="Profile" class="fa fa-user"></i>
%ul.pull-right.dropdown-menu{role: "menu"}
%li= link_to(current_user.name, current_user)
%li= link_to "Sign Out", sign_out_path, id: "sign_out"
- else
= link_to "Sign in or sign up", sign_in_path, class: "btn btn-primary btn-lg sign-in-btn", role: "button"
2 changes: 1 addition & 1 deletion app/views/users/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
%th Location
%th Type
%tbody
= render @proposals
= render partial: "proposals/proposal", collection: @proposals
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
root 'proposals#index', type: "Proposal"
root 'proposals#index', type: "Proposal", as: 'proposals'
get 'map' => 'users#map'
get 'offers' => 'proposals#index', type: "Proposal", as: 'offers_atom'
get 'proposals' => 'proposals#index', type: "Proposal", as: 'proposals_atom'

get 'offers' => 'proposals#index', type: "Offer"
get 'wanteds' => 'proposals#index', type: "Wanted"
Expand Down
12 changes: 12 additions & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
User.delete_all

dalai_lama = User.create!(
facebook_url: "http://www.facebook.com/DalaiLama",
name: "His Holiness the Dalai Lama",
Expand Down Expand Up @@ -44,6 +46,16 @@

shakira = User.last

100.times do |n|
Wanted.create!(
title: "#{n} new songs",
description: "&c., &c.",
location: "Anywhere",
category_list: "services",
user: shakira,
)
end

Offer.create!(
title: "Hips Don't Lie",
description: %{"Hips Don't Lie" is a song by Colombian singer-songwriter Shakira featuring Haitian rapper Wyclef Jean for the reissue of Shakira's sixth studio album, Oral Fixation, Vol. 2. It was released on February 28, 2006, by Epic Records as the third single from the album. The song was written and produced by Shakira, Jean, and Jerry 'Wonder' Duplessis, and LaTravia Parker. "Hips Don't Lie" is a salsa and reggaeton song, which heavily incorporates samples from Jean's earlier single "Dance Like This" and "Amores Como el Nuestro" written by Omar Alfanno.
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion spec/controllers/proposals_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
end

it "renders the Atom feed" do
get :index, format: "atom", type: "Wanted"
get :index, format: "atom", type: "Proposal"
expect(response).to render_template(:index)
expect(response.content_type).to eq("application/atom+xml")
expect(assigns(:updated_at)).to be_same_second_as @wanted.updated_at
Expand Down

0 comments on commit 9e84678

Please sign in to comment.