Skip to content

Commit

Permalink
Merge pull request #10 from AndyGauge/feature/bh
Browse files Browse the repository at this point in the history
Feature/bh
  • Loading branch information
AndyGauge committed Dec 8, 2015
2 parents 498919f + 4048a3f commit 45c2daf
Show file tree
Hide file tree
Showing 17 changed files with 154 additions and 47 deletions.
17 changes: 9 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
#gem 'twitter-bootstrap-rails'
gem 'sprockets-rails', :require => 'sprockets/railtie'

#gem 'sprockets-rails', :require => 'sprockets/railtie'
#github.com/twbs/bootstrap-rubygem
source 'https://rails-assets.org' do
gem 'rails-assets-tether', '>= 1.1.0'
end
gem 'bootstrap', '~> 4.0.0.alpha1'
#
gem 'bootstrap_form', '~> 2.3.0'
#source 'https://rails-assets.org' do
# gem 'rails-assets-tether', '>= 1.1.0'
#end
#gem 'bootstrap', '~> 4.0.0.alpha1'

gem 'bh'

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ GEM
coderay (>= 1.0.0)
erubis (>= 2.6.6)
rack (>= 0.9.0)
bh (1.3.4)
actionpack
activesupport
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap (4.0.0.alpha2)
Expand Down Expand Up @@ -173,6 +176,7 @@ PLATFORMS
DEPENDENCIES
bcrypt (~> 3.1.7)
better_errors
bh
binding_of_caller
bootstrap (~> 4.0.0.alpha1)
bootstrap_form (~> 2.3.0)
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# praybook
praybook
--------

## Purpose
praybook is a prayer tracking website. Users are created by signing up and logging in. Email and passwords provide authentication. No email is delivered to the users. Answered prayer is converted into praise.

praybook will become a social network prayer sharing application, allowing users to include each other in their prayers, with information flow allowing those prayed for to indicate the prayer is answered.

## Semantic Versioning
Current version of website is 0.2.0. The website is in pre-alpha development. Most everything does not work. 0.1.0 was launched with support for log in, and 0.2.0 marks the ability to navigate and create prayers.
Current version of website is 0.2.3. The website is in pre-alpha development. Most everything does not work. 0.1.0 was launched with support for log in, and 0.2.0 marks the ability to navigate and create prayers.

### Future version plans:
0.2.1 Prayers allow editing
0.2.2 Prayers can be completed
0.3.0 Render Praise
1.0.0 fully functioning website, launch
2.0.0 fully functioning social website, launch
- 0.2.1 Prayers allow editing
- 0.2.2 Prayers can be completed
- 0.2.3 bootstrap beautification
- 0.3.0 Render Praise
- 1.0.0 fully functioning website, launch
- 2.0.0 fully functioning social website, launch


## Development instance
Not typically running unless development ongoing
http://ec2-52-32-125-93.us-west-2.compute.amazonaws.com:8080/
http://tinyurl.com/praybook
2 changes: 0 additions & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@
//
//= require jquery
//= require jquery_ujs
//= require tether
//= require bootstrap-sprockets
//= require turbolinks
//= require_tree .
1 change: 0 additions & 1 deletion app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@import "*";
@import "bootstrap";

.navbar {
background-color: #70A;
Expand Down
96 changes: 96 additions & 0 deletions app/assets/stylesheets/bootstrap_backport.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*!
* Bootstrap v4.0.0-alpha.2 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/

.navbar-brand:focus, .navbar-brand:hover {
text-decoration: none;
}
.bg-faded {
background-color: #F7F7F9;
}
.navbar-dark .navbar-brand {
color: white;
}

.navbar-dark .navbar-brand:focus, .navbar-dark .navbar-brand:hover {
color: white;
}

.navbar-dark .navbar-nav .nav-link {
color: rgba(255, 255, 255, .5);
}

.navbar-dark .navbar-nav .nav-link:focus, .navbar-dark .navbar-nav .nav-link:hover {
color: rgba(255, 255, 255, .75);
}

.navbar-dark .navbar-nav .open > .nav-link, .navbar-dark .navbar-nav .open > .nav-link:focus, .navbar-dark .navbar-nav .open > .nav-link:hover,
.navbar-dark .navbar-nav .active > .nav-link,
.navbar-dark .navbar-nav .active > .nav-link:focus,
.navbar-dark .navbar-nav .active > .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.open,
.navbar-dark .navbar-nav .nav-link.open:focus,
.navbar-dark .navbar-nav .nav-link.open:hover,
.navbar-dark .navbar-nav .nav-link.active,
.navbar-dark .navbar-nav .nav-link.active:focus,
.navbar-dark .navbar-nav .nav-link.active:hover {
color: white;
}

.navbar-dark .navbar-divider {
background-color: rgba(255, 255, 255, .075);
}
.nav-link {
display: inline-block;
}

.nav-link:focus, .nav-link:hover {
text-decoration: none;
}

.nav-link.disabled {
color: #818a91;
}

.nav-link.disabled, .nav-link.disabled:focus, .nav-link.disabled:hover {
color: #818a91;
cursor: not-allowed;
background-color: transparent;
}

.nav-inline .nav-item {
display: inline-block;
}

.nav-inline .nav-item + .nav-item,
.nav-inline .nav-link + .nav-link {
margin-left: 1rem;
}
.nav-pills .nav-link {
display: block;
padding: .5em 1em;
border-radius: .25rem;
}

.nav-pills .nav-link.active, .nav-pills .nav-link.active:focus, .nav-pills .nav-link.active:hover,
.nav-pills .nav-item.open .nav-link,
.nav-pills .nav-item.open .nav-link:focus,
.nav-pills .nav-item.open .nav-link:hover {
color: #fff;
cursor: default;
background-color: #0275d8;
}
.nav>li>a:hover .nav>li>a:focus {
background-color: default;
}

.nav>li.nav-item>a.pb-navbar-link:hover .nav>li.nav-item>a.pb-navbar-link:focus {
text-decoration:none;
background-color: #70A;
}

.btn-opaque {
opacity: 0.6;
}
4 changes: 0 additions & 4 deletions app/assets/stylesheets/login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

$top-purple: #70A;
$nav-button-text: #408;
body
{
font-size: 100%;

}
.purple-nav
{
background-color: $top-purple;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/navbar.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.pb-navbar-brand {
font-size: 1.5em;
font-size: 24px;
color: #FFF;
letter-spacing: 1px;
text-shadow: 2px 4px #408;
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/logins_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ def show
end

def create
@user = User.find_by_email(params[:email])
if @user && @user.authenticate(params[:password])
@user = User.find_by_email(params[:login][:email])
if @user && @user.authenticate(params[:login][:password])
session[:current_user_id] = @user.id
redirect_to prayers_path

Expand Down
6 changes: 6 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
<html>
<head>
<title>Praybook | <%= yield :page_subtitle %></title>
<%# load bootstrap and then application for override %>
<%= stylesheet_link_tag bootstrap_css %>
<%= stylesheet_link_tag font_awesome_css %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>

<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= javascript_include_tag bootstrap_js %>
<%= csrf_meta_tags %>

</head>
<body>
<div class="container">
Expand Down
2 changes: 1 addition & 1 deletion app/views/logins/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= render 'shared/flash' %>
<%= bootstrap_form_tag url: '/login' do |login_form| %>
<%= form_for :login , url: '/login' do |login_form| %>
<%= login_form.email_field :email %>
<%= login_form.password_field :password %>
<%= login_form.submit "Log in" %>
Expand Down
10 changes: 4 additions & 6 deletions app/views/prayers/_new.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<%= bootstrap_form_for(@prayer, layout: :horizontal, label_col: "col-sm-4", control_col: "col-sm-8") do |prayer_form| %>
<%= prayer_form.text_field :title %>
<%= prayer_form.text_area :body %>
<%= prayer_form.form_group do %>
<%= prayer_form.submit "In Jesus' name", class: "btn btn-primary btn-lg" %>
<% end %>
<%= form_for(@prayer, layout: :horizontal, label_col: "col-sm-4", control_col: "col-sm-8") do |prayer_form| %>
<%= prayer_form.text_field :title, label: 'Prayer' %>
<%= prayer_form.text_area :body, label: 'Detail' %>
<%= prayer_form.submit "In Jesus' name", class: "btn btn-primary btn-lg" %>
<% end %>
18 changes: 13 additions & 5 deletions app/views/prayers/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@
<% end %>
<%= render 'new' %>
<% @prayers.each do |prayer| %>
<%= button_to "\u2714", complete_prayer_path(prayer) %>
<div class="pb-prayer-wrap">
<h3><a href="<%= edit_prayer_path(prayer) %>"><%= prayer.title %></a></h3>
<p><%= prayer.body %></p>
<div class="col-md-2 col-xl-3">
<div class="row">
<%= button_to "\u2714 Complete", complete_prayer_path(prayer), method: :post , class: 'btn btn-danger btn-block'%>
</div>
<div class="row">
<%= link_to edit_prayer_path(prayer), class: 'btn btn-success btn-block', role: 'button' do %>
<%= icon :pencil, library: :font_awesome %> Edit
<% end %>
</div>
</div>
<% end %>
<div class="col-md-10 col-xl-9">
<%= panel prayer.body, heading: prayer.title %>
</div>
<% end %>
4 changes: 2 additions & 2 deletions app/views/shared/nav/_top.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<nav class="navbar navbar-dark">
<a class="navbar-brand pb-navbar-brand" href='/'>PRAYBOOK</a>
<% if @user.guest? %> <%# If new user display login information %>
<%= bootstrap_form_tag url: '/login', layout: :inline, html: {class: "pull-right"} do |login_form| %>
<%= form_for :login, {url: '/login', layout: :inline, html: {class: "navbar-form navbar-right"}} do |login_form| %>
<%= login_form.email_field :email, hide_label: true, placeholder: "email" %>
<%= login_form.password_field :password , skip_label: true, placeholder: "password" %>
<%= login_form.submit "LOG IN", class: "btn btn-default btn-purple" %>
<%= login_form.submit "LOG IN" %>
<% end %> <%# End login_form do block %>
<% else %> <%# If logged on display links %>
<ul class="nav navbar-nav">
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/nav/_top_out.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
PRAYBOOK
</div>
<div class="hidden-xs hidden-sm col-md-2">&nbsp;</div>
<%= bootstrap_form_tag url: '/login', layout: :inline do |login_form| %>
<%= form_for :login, {url: '/login', layout: :inline} do |login_form| %>
<div class="col-sm-3 col-md-2 input-fields">
<%= login_form.email_field :email, hide_label: true, placeholder: "email" %>
</div>
Expand Down
6 changes: 2 additions & 4 deletions app/views/users/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<%= bootstrap_form_for(@user, url: user_path, layout: :horizontal, label_col: "col-md-4", control_col: "col-md-7") do |user_form| %>
<%= form_for(@user, url: user_path, layout: :horizontal, label_col: "col-md-4", control_col: "col-md-7") do |user_form| %>
<%= user_form.text_field :name, wrapper: {class: 'row'} %>
<%= user_form.email_field :email, wrapper: {class: 'row'} %>
<%= user_form.password_field :password, wrapper: {class: 'row'} %>
<%= user_form.password_field :password_confirmation, wrapper: {class: 'row'} %>
<%= user_form.form_group do %>
<%= user_form.submit "Sign Up", class: "btn btn-primary btn-lg" %>
<% end %>
<%= user_form.submit "Sign Up", class: "btn btn-primary btn-lg" %>
<% end %>
6 changes: 3 additions & 3 deletions test/controllers/logins_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ class LoginsControllerTest < ActionController::TestCase
end

test "should fail login with bad attempt" do
post :create, {email: "lrose@gmail.com", password: "fail"}
post :create, login: {email: "lrose@gmail.com", password: "fail"}
assert_not_empty flash[:alert]
assert_redirected_to login_path
end

test "should login successfully" do
post :create, {email: "bob@email.com", password: "password"}
post :create, login: {email: "bob@email.com", password: "password"}
assert_nil flash[:alert]
assert_not_nil session[:current_user_id]
assert_redirected_to prayers_path
end

test "should log out after log in successful and destroyed" do
post :create, {email: "bob@email.com", password: "password"}
post :create, login: {email: "bob@email.com", password: "password"}
assert_nil flash[:alert]
post :destroy
assert_nil session[:current_user_id]
Expand Down

0 comments on commit 45c2daf

Please sign in to comment.