Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove br tags and css cleanup #129

Merged
merged 13 commits into from
Oct 21, 2017
14 changes: 9 additions & 5 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ AMAZON_CLIENT_SECRET=YOURSECRETHERE
AWS_ACCESS_KEY=YOUR_ACCESS_KEY_GOES_HERE
AWS_SECRET_KEY=YOUR_SECRET_KEY_GOES_HERE
AWS_ASSOCIATES_TAG=playtim009-20
FORCE_AMAZON_LOGIN=false

RACK_ENV=development # defaults to development if blank
PORT=3000 # defaults to 3000 if blank
# defaults to development if blank
RACK_ENV=development
# defaults to 3000 if blank
PORT=3000

ADMIN_NAME=YOUR_NAME
ADMIN_AMAZON_EMAIL=YOUR_EMAIL # The email associated with your amazon account.
# This will let you log in as an admin using
# Amazon authentication.
# The email associated with your amazon account.
# This will let you log in as an admin using
# Amazon authentication.
ADMIN_AMAZON_EMAIL=YOUR_EMAIL
File renamed without changes.
12 changes: 12 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Resolves #

Make sure you've covered the following bases in your PR. They won't all be
needed for every PR (ex. fixing a straightforward rubocop issue might have no
tradeoffs and add no dependencies).

- [ ] Did you fill in the `Resolves #<issue number>` in the first line?
- [ ] Is this a work in progress? If so, put "WIP" in the title.
- [ ] What were the main changes/goals of this PR?
- [ ] Did you need to make any tradeoffs? Why did you make the choice you made?
- [ ] Did you add any dependencies?
- [ ] Anything else we should know about?
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![Playtime Project Logo](doc/logo.png)][HCPP]

# Homeless Children's Playtime Project
[![Build Status](https://api.travis-ci.org/rubyforgood/playtime.svg?branch=master)](https://travis-ci.org/rubyforgood/playtime)

*The mission of the [Homeless Children's Playtime Project][HCPP] is to nurture
healthy child development and reduce the effects of trauma among children
Expand Down Expand Up @@ -59,7 +60,7 @@ on Slack ([get an invite][slack-invite]).
[@micahbales]: https://github.com/micahbales
[slack-channel]: https://rubyforgood.slack.com/messages/playtime
[slack-invite]: https://rubyforgood.herokuapp.com/
[CONTRIBUTING]: CONTRIBUTING.md
[CONTRIBUTING]: .github/CONTRIBUTING.md

### Getting Started

Expand All @@ -74,7 +75,7 @@ You need:
- Ruby 2.4.1
- Rails 5.1
- Postgres >=9.1
- A javascript runtime, we recommend node.js
- A JavaScript runtime, we recommend Node.js

You will need Node.js (which comes bundled with NPM) and it is easiest to
install on Mac, Windows, or Linux [with your favorite package manager][node-pkg]
Expand All @@ -83,19 +84,19 @@ or by downloading directly from [nodejs.org][node-direct].
[node-pkg]: https://nodejs.org/en/download/package-manager/
[node-direct]: https://nodejs.org/en/download/

You will also need git, ruby, rails, and PostgreSQL. If you have git and
postgres in some version or another you're probably set. But:
You will also need Git, Ruby, Rails, and PostgreSQL. If you have Git and
Postgres in some version or another you're probably set. But:

- If you're working on **a fresh Windows machine**, you're best off installing
ruby and rails with the [Rails Installer]. For PostgreSQL, you'll want to
Ruby and Rails with the [Rails Installer]. For PostgreSQL, you'll want to
install [EnterpriseDB].

- If you have **a fresh Mac OS X machine**, just follow these
[directions][Go Rails] (if you're running a different OS version, switch to
the correct version). These instructions include PostgreSQL.

- If you are using **Ubuntu Linux**, use this [Rails Apps Guide] to get set
up with ruby, rails, and node.js and this guide to
up with Ruby, Rails, and Node.js and this guide to
[install PostgreSQL][Postgres Ubuntu].

- Otherwise, Google for instructions for your OS of choice. Let us know if
Expand All @@ -121,7 +122,7 @@ Navigate to your desired working directory. Then from a command prompt:

Then navigate to `http://localhost:3000` in your browser to view the app.

#### Getting Amazon OAuth Working Locally
#### Getting Amazon OAuth Working Locally (Optional)

By the end of this section, you should be able to create an account/login to
the app on your local machine.
Expand Down Expand Up @@ -165,7 +166,7 @@ account or login locally:

You can also change your user role by using `rails console`.

5. Start your rails app with `rails server`. You're ready to OAuth!
5. Start your Rails app with `rails server`. You're ready to OAuth!

[Amazon OAuth Instructions]: https://github.com/wingrunr21/omniauth-amazon#prereqs

Expand Down Expand Up @@ -256,6 +257,10 @@ For changes to `.env` to take effect, you'll need to restart your server.
AWS_ACCESS_KEY="your aws access key"
AWS_SECRET_KEY="your aws secret key"

# If you want to force Amazon login instead of developer in development environment
# set it to true.
FORCE_AMAZON_LOGIN=false

# Code for generating affiliate links from search (same for everyone)
AWS_ASSOCIATES_TAG="playtim009-20"

Expand Down
10 changes: 5 additions & 5 deletions app/assets/stylesheets/playtime.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
@import "playtime/social-share";

body {
color: #333333;
color: $light-gray;
font-family: 'PT Sans', Helvetica, Arial, Lucida, sans-serif;
line-height: 1.25rem;
}

a{
a {
text-decoration: underline;
color: $teal;
}

h2{
h2 {
margin-top: 25px;
padding-bottom: 15px;
border-bottom: 1px solid rgba(0, 0, 0, 0.125);
Expand All @@ -27,7 +27,7 @@ h3 {
font-size: 1.25em;
}
.item_title a {
color: #fff;
color: $white;
}

.container {
Expand Down Expand Up @@ -79,7 +79,7 @@ h3 {
}

.btn-primary {
color: #fff;
color: $white;
background-color: $purple;
border-color: $purple;

Expand Down
6 changes: 3 additions & 3 deletions app/assets/stylesheets/playtime/primary-nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
}

.navbar-nav a, .user-greeting, .nav-item {
color: #fff;
color: $white;
}

.primary-nav .user-greeting {
a {
color: #fff;
color: $white;
text-decoration: underline;
}
}
Expand All @@ -58,7 +58,7 @@ a.nav-link, a.navlink.dropdown-toggle {

.tagline {
font-size: 16px;
color: #fff;
color: $white;
text-align: center;
}

Expand Down
8 changes: 4 additions & 4 deletions app/assets/stylesheets/playtime/social-share.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
}

.submit {
color: #fff;
background-color: #0084ad;
color: $white;
background-color: $teal;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! 👍

}

.row-headers {
Expand All @@ -31,11 +31,11 @@
}

.user-details-table {
background-color: lightyellow;
background-color: $light-yellow;
}

.pledges-table {
background-color: lightblue;
background-color: $light-blue;
}

.form.center-form {
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
$purple: #9b347d;
$purple-transparent: rgba(155, 52, 125, .75);
$teal: #0084ad;
$white: #fff;
$light-gray: #333;
$light-yellow: #ffffe0;
$light-blue: #add8e6;

/* Screen Sizes */
$sm: 576px;
Expand Down
11 changes: 11 additions & 0 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
class SessionsController < ApplicationController
before_action :skip_authorization
skip_before_action :verify_authenticity_token, if: :should_skip_csrf_check?

def new
if current_user.logged_in?
redirect_to '/'
elsif development_login_enabled?
redirect_to '/auth/developer'
else
redirect_to '/auth/amazon'
end
Expand Down Expand Up @@ -32,4 +35,12 @@ def failure
def auth_hash
request.env['omniauth.auth']
end

def should_skip_csrf_check?
Rails.env.development? && params[:provider] == 'developer'
end

def development_login_enabled?
Rails.env.development? && ENV['FORCE_AMAZON_LOGIN'] != 'true'
end
end
2 changes: 2 additions & 0 deletions app/views/partials/_primary_nav.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
<li class="nav-item">
<% if current_user.logged_in? %>
<%= link_to "Log Out", signout_path, class: "nav-link" %>
<% elsif Rails.env.development? && ENV['FORCE_AMAZON_LOGIN'] != 'true' %>
<%= link_to "Log In (Development)", signin_path, class: "nav-link" %>
<% else %>
<%= link_to "Log In", signin_path, class: "nav-link" %>
<% end %>
Expand Down
9 changes: 5 additions & 4 deletions app/views/pledges/_pledge.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@
<dd class="col-md-9">
<%= display_date pledge.created_at %>
<% if pledge.edited? %>
<small>
<br />
<%= icon 'pencil', "last updated #{display_date pledge.updated_at}" %>
</small>
<div>
<small>
<%= icon 'pencil', "last updated #{display_date pledge.updated_at}" %>
</small>
</div>
<% end %>
</dd>
</dl>
Expand Down
14 changes: 8 additions & 6 deletions app/views/pledges/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@

<%= render 'form', pledge: @pledge %>

<br />
<%= link_to 'Show Pledge', @pledge %> |
<%= link_to 'Unpledge item', pledge_path(@pledge),
method: :delete,
class: 'text-danger',
data: { confirm: 'Are you sure you want to unpledge this item?' } %>
<div class="my-4">
<%= link_to 'Show Pledge', @pledge %> |
<%= link_to 'Unpledge item', pledge_path(@pledge),
method: :delete,
class: 'text-danger',
data: { confirm: 'Are you sure you want to unpledge this item?' } %>
</div>

</div>
30 changes: 15 additions & 15 deletions app/views/pledges/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
"<%= @pledge.wishlist_item.name %>"
</h2>

<p class="lead">
<% if @pledge.anonymous? %>
Thank you for being a Hero of Play! ♥
</p>
<p class="lead">
But wait, we don't know who you are! By logging in, you make it much
easier for us to track donations. Sign up/log in with Amazon <%= link_to "here", signin_path %>.
<% else %>
Thanks for being a Hero of Play! On behalf of the children and families we serve, thank you! ♥
<% end %>
</p>
<div class="my-4">
<p class="lead">
<% if @pledge.anonymous? %>
Thank you for being a Hero of Play! ♥
</p>
<p class="lead">
But wait, we don't know who you are! By logging in, you make it much
easier for us to track donations. Sign up/log in with Amazon <%= link_to "here", signin_path %>.
<% else %>
Thanks for being a Hero of Play! On behalf of the children and families we serve, thank you! ♥
<% end %>
</p>
</div>

<%= render @pledge %>

<br /><br />

<% if @pledge.anonymous? && current_user.logged_in? %>
<div class="row align-items-center unpledge">
<div class="row align-items-center unpledge my-4">
<div class="col">
<h4>Did you make this pledge?
<%= link_to 'Claim pledge', pledge_claim_path(@pledge),
Expand All @@ -32,7 +32,7 @@
</div>
<% end %>

<div class="row align-items-center unpledge">
<div class="row align-items-center unpledge my-4">
<div class="col">
<h4>Didn't mean to pledge?
<%= link_to 'Unpledge item', pledge_path(@pledge),
Expand Down
22 changes: 12 additions & 10 deletions app/views/wishlists/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,27 @@
</div>

<%= form.fields_for :user do |user_form| %>
<div class="form-group" id="wishlist_users">

<p>
<strong>Admins:</strong> (can manage all wishlists)
<div class="form-group" id="wishlist-admins">
<strong>Admins:</strong> (can manage all wishlists)
<div>
<% User.admin.each do |admin| %>
<input type="checkbox" checked disabled readonly />
<%= admin.display_name %>
<% end %>
</p>
</div>
</div>

<p>
<strong>Site Managers:</strong><br />
<%= form.collection_check_boxes :user_ids, User.all, :id, :display_name do |b|
<div class="form-group" id="wishlist-site-managers">
<strong>Site Managers:</strong>
<div>
<%=
form.collection_check_boxes :user_ids, User.all, :id, :display_name do |b|
b.label(class: "checkbox-inline") {
b.check_box(id: "user-#{b.object.id}") + b.text
}
end
%>
<br />
%>
</div>
</p>
</div>
<% end %>
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
{
:scope => 'profile postal_code' # default scope
}

provider :developer if Rails.env.development?
end
3 changes: 2 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
end

# Users
resources :users, only: [:new, :create, :show, :index, :edit, :update, :destroy]
resources :users

# OAuth
controller :sessions do
get '/auth/:provider/callback', action: :create
post '/auth/:provider/callback', action: :create
get '/auth/failure', action: :failure

get '/signin', action: :new, as: :signin
Expand Down
Loading