Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: shareaprayer/shareaprayer
base: 1d815b56db
...
head fork: shareaprayer/shareaprayer
compare: 9f9af53bbd
  • 10 commits
  • 23 files changed
  • 0 commit comments
  • 2 contributors
9 Gemfile
View
@@ -11,11 +11,18 @@ gem 'mongoid', '>= 2.0.0.beta.19'
# AWS
gem 'aws-sdk'
+# Geolocation
+gem 'geocoder', '~> 1.1.1'
+
+# API
+gem 'rabl', '~> 0.6.11'
+gem 'yajl-ruby', '~> 1.1.0'
+
# Layout & UI
gem 'haml', '>= 3.0.0'
gem 'haml-rails'
gem 'jquery-rails'
-gem 'bootstrap-sass'
+gem 'anjlab-bootstrap-rails', '>= 2.0', :require => 'bootstrap-rails'
gem 'gritter', '1.0.0'
# Gems used only for assets and not required
15 Gemfile.lock
View
@@ -29,6 +29,9 @@ GEM
activesupport (= 3.1.3)
activesupport (3.1.3)
multi_json (~> 1.0)
+ anjlab-bootstrap-rails (2.0.3.2)
+ railties (>= 3.0)
+ sass
ansi (1.4.1)
arel (2.2.1)
aws-sdk (1.2.6)
@@ -36,8 +39,6 @@ GEM
json (~> 1.4)
nokogiri (>= 1.4.4)
uuidtools (~> 2.1)
- bootstrap-sass (1.4.3)
- sass-rails (~> 3.1)
bson (1.5.2)
bson_ext (1.5.2)
bson (= 1.5.2)
@@ -52,6 +53,7 @@ GEM
erubis (2.7.0)
execjs (1.2.13)
multi_json (~> 1.0)
+ geocoder (1.1.1)
gritter (1.0.0)
haml (3.1.4)
haml-rails (0.3.4)
@@ -85,6 +87,9 @@ GEM
nokogiri (1.5.0)
pg (0.12.2)
polyglot (0.3.3)
+ rabl (0.6.11)
+ activesupport (>= 2.3.14)
+ multi_json (~> 1.0)
rack (1.3.6)
rack-cache (1.1)
rack (>= 0.4)
@@ -136,24 +141,28 @@ GEM
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
uuidtools (2.1.2)
+ yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
+ anjlab-bootstrap-rails (>= 2.0)
aws-sdk
- bootstrap-sass
bson_ext
coffee-rails (~> 3.1.1)
execjs
+ geocoder (~> 1.1.1)
gritter (= 1.0.0)
haml (>= 3.0.0)
haml-rails
jquery-rails
mongoid (>= 2.0.0.beta.19)
pg
+ rabl (~> 0.6.11)
rails (= 3.1.3)
sass-rails (~> 3.1.5)
therubyracer
turn (= 0.8.2)
uglifier (>= 1.0.3)
+ yajl-ruby (~> 1.1.0)
2  VERSION
View
@@ -1 +1 @@
-0.1.2
+0.2.0
BIN  app/assets/images/smaloy.png
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 app/assets/javascripts/application.js
View
@@ -11,11 +11,8 @@
//= require_tree .
//= require_self
-$(function () {
- $("a[rel=twipsy]")
- .twipsy({
- live: true,
- placement: "above",
- offset: 5
- })
+$(function() {
+ jQuery("time#timeago").timeago();
+
+ $("a[rel=tooltip]").tooltip()
})
42 app/assets/javascripts/jquery.gravatar.js
View
@@ -1,42 +0,0 @@
-/*
- * jQuery.gravatar 1.0.1 (2009-01-08)
- *
- * Written by Zach Leatherman
- * http://zachleat.com
- *
- * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/)
- *
- * Requires jQuery http://jquery.com (1.2.6 at time of release)
- * Requires http://pajhome.org.uk/crypt/md5/md5.js
- */
-
-(function($)
-{
- $.gravatar = function(emailAddress, overrides)
- {
- var options = $.extend({
- // Defaults are not hardcoded here in case gravatar changes them on their end.
- // integer size: between 1 and 512, default 80 (in pixels)
- size: '',
- // rating: g (default), pg, r, x
- rating: '',
- // url to define a default image (can also be one of: identicon, monsterid, wavatar)
- image: '',
- // secure
- secure: false
- }, overrides);
-
- var baseUrl = options.secure ? 'https://secure.gravatar.com/avatar/' : 'http://www.gravatar.com/avatar/';
-
- return $('<img src="' + baseUrl +
- hex_md5(emailAddress) +
- '.jpg?' +
- (options.size ? 's=' + options.size + '&' : '') +
- (options.rating ? 'r=' + options.rating + '&' : '') +
- (options.image ? 'd=' + encodeURIComponent(options.image) : '') +
- '"/>').bind('error', function()
- {
- $(this).remove();
- });
- };
-})(jQuery);
256 app/assets/javascripts/md5.js
View
@@ -1,256 +0,0 @@
-/*
- * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
- * Digest Algorithm, as defined in RFC 1321.
- * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for more info.
- */
-
-/*
- * Configurable variables. You may need to tweak these to be compatible with
- * the server-side, but the defaults work in most cases.
- */
-var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
-var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
-var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
-
-/*
- * These are the functions you'll usually want to call
- * They take string arguments and return either hex or base-64 encoded strings
- */
-function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));}
-function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));}
-function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
-function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
-function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
-function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
-
-/*
- * Perform a simple self-test to see if the VM is working
- */
-function md5_vm_test()
-{
- return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
-}
-
-/*
- * Calculate the MD5 of an array of little-endian words, and a bit length
- */
-function core_md5(x, len)
-{
- /* append padding */
- x[len >> 5] |= 0x80 << ((len) % 32);
- x[(((len + 64) >>> 9) << 4) + 14] = len;
-
- var a = 1732584193;
- var b = -271733879;
- var c = -1732584194;
- var d = 271733878;
-
- for(var i = 0; i < x.length; i += 16)
- {
- var olda = a;
- var oldb = b;
- var oldc = c;
- var oldd = d;
-
- a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
- d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
- c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
- b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
- a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
- d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
- c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
- b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
- a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
- d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
- c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
- b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
- a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
- d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
- c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
- b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
-
- a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
- d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
- c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
- b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
- a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
- d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
- c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
- b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
- a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
- d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
- c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
- b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
- a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
- d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
- c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
- b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
-
- a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
- d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
- c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
- b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
- a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
- d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
- c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
- b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
- a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
- d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
- c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
- b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
- a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
- d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
- c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
- b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
-
- a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
- d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
- c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
- b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
- a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
- d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
- c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
- b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
- a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
- d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
- c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
- b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
- a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
- d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
- c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
- b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
-
- a = safe_add(a, olda);
- b = safe_add(b, oldb);
- c = safe_add(c, oldc);
- d = safe_add(d, oldd);
- }
- return Array(a, b, c, d);
-
-}
-
-/*
- * These functions implement the four basic operations the algorithm uses.
- */
-function md5_cmn(q, a, b, x, s, t)
-{
- return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
-}
-function md5_ff(a, b, c, d, x, s, t)
-{
- return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
-}
-function md5_gg(a, b, c, d, x, s, t)
-{
- return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
-}
-function md5_hh(a, b, c, d, x, s, t)
-{
- return md5_cmn(b ^ c ^ d, a, b, x, s, t);
-}
-function md5_ii(a, b, c, d, x, s, t)
-{
- return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
-}
-
-/*
- * Calculate the HMAC-MD5, of a key and some data
- */
-function core_hmac_md5(key, data)
-{
- var bkey = str2binl(key);
- if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);
-
- var ipad = Array(16), opad = Array(16);
- for(var i = 0; i < 16; i++)
- {
- ipad[i] = bkey[i] ^ 0x36363636;
- opad[i] = bkey[i] ^ 0x5C5C5C5C;
- }
-
- var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
- return core_md5(opad.concat(hash), 512 + 128);
-}
-
-/*
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally
- * to work around bugs in some JS interpreters.
- */
-function safe_add(x, y)
-{
- var lsw = (x & 0xFFFF) + (y & 0xFFFF);
- var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return (msw << 16) | (lsw & 0xFFFF);
-}
-
-/*
- * Bitwise rotate a 32-bit number to the left.
- */
-function bit_rol(num, cnt)
-{
- return (num << cnt) | (num >>> (32 - cnt));
-}
-
-/*
- * Convert a string to an array of little-endian words
- * If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
- */
-function str2binl(str)
-{
- var bin = Array();
- var mask = (1 << chrsz) - 1;
- for(var i = 0; i < str.length * chrsz; i += chrsz)
- bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
- return bin;
-}
-
-/*
- * Convert an array of little-endian words to a string
- */
-function binl2str(bin)
-{
- var str = "";
- var mask = (1 << chrsz) - 1;
- for(var i = 0; i < bin.length * 32; i += chrsz)
- str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
- return str;
-}
-
-/*
- * Convert an array of little-endian words to a hex string.
- */
-function binl2hex(binarray)
-{
- var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
- var str = "";
- for(var i = 0; i < binarray.length * 4; i++)
- {
- str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
- hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);
- }
- return str;
-}
-
-/*
- * Convert an array of little-endian words to a base-64 string
- */
-function binl2b64(binarray)
-{
- var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var str = "";
- for(var i = 0; i < binarray.length * 4; i += 3)
- {
- var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16)
- | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
- | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
- for(var j = 0; j < 4; j++)
- {
- if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
- else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
- }
- }
- return str;
-}
90 app/assets/stylesheets/app.css.scss
View
@@ -16,33 +16,42 @@ section, header {
> .row {
margin-bottom: 10px; } }
+@media (min-width: 768px) {
+ .container-fluid {
+ width: 620px;
+ }
+}
+
#logo {
- text-align: center; }
+ text-align: center; }
#posted {
display: none; }
-.prayer-link {
- .profile-pic {
- width: 50px;
- margin-right: 10px;
- margin-top: 5px;
- margin-bottom: 10px;
- float: left; }
- .request {
- width: 500px;
- float: left;
- padding-right: 10px; }
- small {
- color: #8d8d8d;
- font-size: 11px; }
- .text {
- font-size: 16px;
- line-height: 20px;
- font-weight: 400; }
- .prayed-for {
- width: 48px;
- float: right; } }
+.request-container {
+ margin-bottom: 15px;
+ font-family: "Lucida Bright", Georgia, serif;
+ font-size: 16px;
+ line-height: 22px;
+ font-weight: 300;
+ > .span8 {
+ a.prayer-link {
+ .request {
+ width: 560px;
+ float: left;
+ padding-right: 10px; }
+
+ .info {
+ color: #8d8d8d;
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-size: 11px;
+ margin-top: 5px;
+ i {
+ opacity: 0.5; } } }
+
+ .prayed-for {
+ width: 48px;
+ float: right; } } }
#about {
h4 {
@@ -55,18 +64,24 @@ section, header {
#home-show {
h2 {
- font-size: 20px;
- line-height: 24px;
- font-weight: 500; }
- small {
+ font-family: "Lucida Bright", Georgia, serif;
+ font-size: 24px;
+ line-height: 30px;
+ font-weight: 300; }
+ .info {
color: #8d8d8d;
- font-size: 11px; }
- img {
- margin-top: 5px; }
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-size: 11px;
+ margin-top: 5px;
+ i {
+ opacity: 0.5; } }
.prayed_for {
font-size: 14px;
font-style: italic; } }
+form p.help-block {
+ color: #9c9c9c; }
+
/* CSS3 Text Selection Color */
::selection {
background: #65BDFC; }
@@ -80,19 +95,18 @@ $gridColumnWidth: 60px;
$gridGutterWidth: 20px;
/* Custom Tabs */
-.tabs {
+ul.nav-tabs {
> li {
- > a {
- &:hover {
- text-decoration: none;
- background-color: #eee;
- border-color: #eee #eee #ddd; } } }
- .active > a, .active > a:hover {
+ > a:hover {
+ text-decoration: none;
+ background-color: #eee;
+ border-color: #eee #eee #ddd; } }
+ li.active > a, a:hover {
background: url(/assets/body_bg.png);
- background-color: #f6f6f6 !important; } }
+ background-color: #f6f6f6 !important; } }
/* Custom Form Actions */
-.actions {
+.form-actions {
background: url(/assets/body_bg.png) !important;
background-color: #f6f6f6 !important; }
2  app/assets/stylesheets/application.css
View
@@ -3,6 +3,8 @@
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
+ *= require bootstrap
+ *= require responsive
*= require gritter
*= require_tree .
*/
18 app/controllers/api/v1/prayers_controller.rb
View
@@ -3,22 +3,18 @@
# @since 0.1.0
# @author Robert Klubenspies
class Api::V1::PrayersController < Api::V1::BaseController
+ respond_to :json, :xml
+
# Retrieves a feed of 10 prayer requests at a time
#
# @since 0.1.0
# @author Robert Klubenspies
def index
# Determine when the oldest prayer's timestamp from params[:last] OR use the current time + 1 second
- last = params[:last].blank? ? Time.now.utc + 1.second : Time.parse(params[:last])
+ @last = params[:last].blank? ? Time.now.utc + 1.second : Time.parse(params[:last])
# Retrieve 10 prayer requests based on the timestamp
- @prayers = Prayer.feed(last)
-
- # Respond to multiple request types
- respond_to do |format|
- format.json { render :json => @prayers } # Render JSON response
- format.xml { render :xml => @prayers } # Render XML response
- end
+ @prayers = Prayer.feed(@last)
end
# Retrieves a single prayer request
@@ -28,12 +24,6 @@ def index
def show
# Retrieve prayer request by params[:id]
@prayer = Prayer.find(params[:id])
-
- # Respond to multiple request types
- respond_to do |format|
- format.json { render :json => @prayer } # Render JSON response
- format.xml { render :xml => @prayer } # Render XML response
- end
end
# Creates a prayer request
26 app/controllers/api/v1/stats_controller.rb
View
@@ -0,0 +1,26 @@
+# The Api:V1:StatsController provides a backend API for requesting statistical information.
+#
+# @since 0.2.0
+# @author Robert Klubenspies
+class Api::V1::StatsController < Api::V1::BaseController
+ http_basic_authenticate_with :name => ENV['STATS_AUTH_USERNAME'], :password => ENV['STATS_AUTH_PASSWORD']
+ respond_to :json, :xml
+
+ # Retrieves statistics about SAP
+ #
+ # @since 0.2.0
+ # @author Robert Klubenspies
+ def index
+ # Retrieve all prayer requests
+ @prayers = Prayer.all.entries
+
+ # Determine total request count
+ @request_count = @prayers.count
+
+ # Set prayers count to zero, then count out total prayers placed
+ @prayers_count = 0
+ @prayers.each do |prayer|
+ @prayers_count = @prayers_count + prayer.times_prayed_for
+ end
+ end
+end
9 app/controllers/prayers_controller.rb
View
@@ -41,8 +41,13 @@ def create
# Create form parameter for User's IP Address
params[:prayer][:ip_address] = request.env['REMOTE_ADDR']
- # Create form parameter for User's Gravater ID (MD5 hash of their email address)
- params[:prayer][:gravatar_id] = Digest::MD5.hexdigest(@email.email.downcase)
+ # Ensure location data is correct
+ if params[:prayer][:location] != "Anonymous"
+ l = Geocoder.search(params[:prayer][:location])
+ params[:prayer][:location] = l[0].address
+ elsif params[:prayer][:location] == "Anonymous"
+ params[:prayer][:location] = nil
+ end
# Intialize Prayer object and "build" it under Email object persisted in @email instance variable
@prayer = @email.prayers.build(params[:prayer])
4 app/models/prayer.rb
View
@@ -22,8 +22,8 @@ class Prayer
# @return [Integer] reported the number of times that the prayer request was reported
field :reported, type: Integer, default: 0
- # @return [String] gravatar_id the MD5 hash of the user's email address, which is used to show their Gravatar
- field :gravatar_id, type: String
+ # @return [String] location the plain-English location (city, state, country, etc.) that a request was posted with
+ field :location, type: String
# Protect the id and times_prayed_for from being mass assigned
attr_protected :id, :times_prayed_for
8 app/views/api/v1/prayers/index.rabl
View
@@ -0,0 +1,8 @@
+# Do not provide default object
+object false
+
+# Node of oldest request - used for pagination
+node(:oldest_request) { |m| @last }
+
+# Prayers collection
+child(@prayers) { extends "api/v1/prayers/show" }
8 app/views/api/v1/prayers/show.rabl
View
@@ -0,0 +1,8 @@
+# Root object is the prayer object
+object @prayer
+
+# Declare the properties to include
+attributes :id, :name, :request, :times_prayed_for, :created_at
+
+# Rewrite reported to times_reported
+attributes :reported => :times_reported
8 app/views/api/v1/stats/index.rabl
View
@@ -0,0 +1,8 @@
+# Do not provide default object
+object false
+
+# Request count
+node(:request_count) { |p| @request_count }
+
+# Total number of prayers placed
+node(:prayers_count) { |p| @prayers_count }
24 app/views/prayers/_prayer.html.haml
View
@@ -1,21 +1,27 @@
-# Create a new row for the prayer request
-.row
+.row.request-container
.span8
-# Encompass everything in a link
%a.prayer-link{:href => prayer_path(prayer)}
- -# Profile picture based on gravatar_id
- .profile-pic
- =image_tag "http://www.gravatar.com/avatar/#{prayer.gravatar_id}?size=50"
-
-# Prayer request
.request
- %span.text "#{prayer.request}"
- %small -#{prayer.name.split(" ")[0]}
+ %span.text &#8220;#{prayer.request}&#8221;
+ .info
+ %small
+ %i.icon-user
+ =prayer.name.split(" ")[0]
+
+ %i.icon-time
+ =timeago prayer.created_at
+
+ -if prayer.location
+ %i.icon-map-marker
+ =prayer.location
-# Prayed for button
.prayed-for
-# If the prayer request was already prayed for show disabled version, otherwise show enabled one
-if already_prayed_for? prayer.id
- =link_to image_tag("prayed_for_icon.png"), "#", :class => "btn disabled", :"data-prayed-for-id" => prayer.id, :rel => "twipsy", :title => prayed_for_number(true, prayer.times_prayed_for)
+ =link_to image_tag("prayed_for_icon.png"), "#", :class => "btn disabled", :"data-prayed-for-id" => prayer.id, :rel => "tooltip", :title => prayed_for_number(true, prayer.times_prayed_for)
-else
- =link_to image_tag("prayed_for_icon.png"), prayed_for_prayer_path(prayer), :remote => true, :class => "btn", :"data-prayed-for-id" => prayer.id, :rel => "twipsy", :title => prayed_for_number(false, prayer.times_prayed_for) + " Click here to pray for this."
+ =link_to image_tag("prayed_for_icon.png"), prayed_for_prayer_path(prayer), :remote => true, :class => "btn", :"data-prayed-for-id" => prayer.id, :rel => "tooltip", :title => prayed_for_number(false, prayer.times_prayed_for) + " Click here to pray for this."
4 app/views/prayers/create.js.erb
View
@@ -15,4 +15,6 @@ $(".prayers").prepend("<div class='page'><%= escape_javascript(render(@prayer))
// Clear each of the form fields
$("#prayer_name").val('')
$("#prayer_email").val('')
-$("#prayer_request").val('')
+$("#prayer_request").val('')
+
+jQuery("time#timeago").timeago();
151 app/views/prayers/index.html.haml
View
@@ -1,13 +1,13 @@
%section#home-index.animated.fadeInDown
.row
.span8
- %ul.tabs{:data => {:tabs => "tabs"}}
+ %ul.nav.nav-tabs
%li.active
- %a{:href => "#prayers"} Prayer Requests
+ %a{:href => "#prayers", :"data-toggle" => "tab"} Prayer Requests
%li
- %a{:href => "#new-prayer"} Submit a Prayer Request
+ %a{:href => "#new-prayer", :"data-toggle" => "tab"} Submit a Prayer Request
%li
- %a{:href => "#about"} About Share a Prayer
+ %a{:href => "#about", :"data-toggle" => "tab"} About Share a Prayer
.tab-content
.tab-pane.active#prayers
@@ -15,93 +15,81 @@
-unless @prayers.blank?
=render @prayers
- #no-more-prayers.alert-message.warning.hide
- %p
- %strong Uh-oh!
- We don't have any more prayer requests to show you right now.
-
+ #no-more-prayers.alert.hide
+ %button.close{:"data-dismiss" => "alert"} ×
+ <strong>Uh-oh!</strong> We don't have any more prayer requests to show you right now.
+
.tab-pane#new-prayer
#new-prayer-result
- #posted-email.alert-message.success.hide{:data => {:alert => "alert"}}
- %a.close{:href => "#"} &times;
- %p
- %strong Request Posted!
- We'll be sure to email you a link to it so that you can share it and comment on it with your friends!
+ #posted-email.alert.alert-success.hide
+ %button.close{:"data-dismiss" => "alert"} ×
+ <strong>Request Posted!</strong> We'll be sure to email you a link to it so that you can share it and comment on it with your friends!
- #posted-no-email.alert-message.success.hide{:data => {:alert => "alert"}}
- %a.close{:href => "#"} &times;
- %p
- %strong Request Posted!
- Per your request, we have not emailed you a link to your prayer request.
+ #posted-no-email.alert.alert-success.hide
+ %button.close{:"data-dismiss" => "alert"} ×
+ <strong>Request Posted!</strong> Per your request, we have not emailed you a link to your prayer request.
- #post-error.alert-message.error.hide{:data => {:alert => "alert"}}
- %a.close{:href => "#"} &times;
- %p
- %strong We encountered an error!
- Please try submitting your prayer request again later. If the problem persists, please email dev@shareaprayer.org.
+ #post-error.alert.alert-error.hide
+ %button.close{:"data-dismiss" => "alert"} ×
+ <strong>We encountered an error!</strong> Please try submitting your prayer request again later. If the problem persists, please email dev@shareaprayer.org.
#new-prayer-assembly
- #spam-for-jerks.alert-message.info{:data => {:alert => "alert"}}
- %a.close{:href => "#"} &times;
- %p
- %strong Spamming is not tolerated at Share a Prayer!
- We're all about creating a community and bringing people together. We believe that spam destroys community and trust. We will never share your email address or spam you. See our #{link_to "privacy policy", privacy_path} for more details.
+ #spam-not-tolerated.alert.alert-info
+ %button.close{:"data-dismiss" => "alert"} ×
+ %h4.alert-heading Spamming is not tolerated at Share a Prayer!
+ We're all about creating a community and bringing people together. We believe that spam destroys community and trust. We will never share your email address or spam you. See our #{link_to "privacy policy", privacy_path} for more details.
%p Want to share a prayer request with the world? Fill out the following form and we'll be sure to put your request online right away.
%br
- =form_for :prayer, :url => { :controller => "prayers", :action => "create" }, :html => { :id => "prayer-form" }, :remote => true do |f|
- .clearfix
- =f.label :name, "First Name"
- .input
- =f.text_field :name, :class => "span2", :placeholder => "Joe", :id => "prayer_name", :required => "required"
- %input.btn#anonymous_name{:type => "button", :value => "I'd prefer to be anonymous"}
- %span.help-block We'll display your first name below your prayer request.
+
+ =form_for :prayer, :url => { :controller => "prayers", :action => "create" }, :html => { :id => "prayer-form", :class => "form-horizontal" }, :remote => true do |f|
+ %fieldset
+ .control-group
+ =f.label :name, "First Name", :class => "control-label"
+ .controls
+ =f.text_field :name, :class => "span2", :placeholder => "Joe", :id => "prayer_name", :required => "required"
+ %input.btn#anonymous_name{:type => "button", :value => "I'd prefer to be anonymous"}
+ %p.help-block We'll display your first name below your prayer request.
+
+ .control-group
+ =f.label :email, "Your Email", :class => "control-label"
+ .controls
+ =f.email_field :email, :class => "span4", :placeholder => "john@example.com", :id => "prayer_email", :required => "required"
+ %p.help-block We will never share your email address or spam you.
- .clearfix
- =f.label :email, "Your Email"
- .input
- =f.email_field :email, :class => "span5", :placeholder => "john@example.com", :id => "prayer_email", :required => "required"
- %span.help-block We will never share your email address or spam you.
-
- .clearfix.hide#form_profile_icon
- %label Profile Icon
- .input
- .alert-message{:data => {:alert => "alert"}}
- %a.close{:href => "#"} &times;
- %p
- %strong This is your profile icon
- that will display next to your prayer request. We use Gravatar to display this image. Gravatar is an online service that provides you with a profile image that you can use all over the internet. If you have a Gravatar you should see it below, otherwise you should see the default big "G" on a blue background. You can get a Gravatar at #{link_to "gravatar.com", "http://gravatar.com/"}.
- %span#prayer_gravatar
- =image_tag "http://www.gravatar.com/avatar/?size=100"
+ .control-group
+ =f.label :location, "Where are you?", :class => "control-label"
+ .controls
+ =f.text_field :location, :value => request.location.city != "" && request.location.state_code != "" ? "#{request.location.city}, #{request.location.state_code}" : "", :class => "span2", :placeholder => "City, State", :id => "prayer_location", :required => "required"
+ %input.btn#no_location{:type => "button", :value => "I do not want to share my location"}
+ %p.help-block We'll display your city and state with your prayer request.
- .clearfix
- =f.label :request, "Prayer Request"
- .input
- =f.text_area :request, :class => "span5", :placeholder => "Mauris iaculis porttitor posuere. Praesent id metus massa.", :id => "prayer_request", :rows => "5", :required => "required", :maxlength => "160"
- %span.help-block Please keep it within 160 characters
+ .control-group
+ =f.label :request, "Prayer Request", :class => "control-label"
+ .controls
+ =f.text_area :request, :class => "span5", :placeholder => "Mauris iaculis porttitor posuere. Praesent id metus massa.", :id => "prayer_request", :rows => "5", :required => "required", :maxlength => "160"
+ %p.help-block Please keep it within 160 characters
- .clearfix
- .input
- %ul.inputs-list
- %li
- %label
- =f.check_box :email_me, {:checked => true}
- %span Yes, please email me a link to my prayer request's page
+ .control-group
+ .controls
+ %label.checkbox
+ =f.check_box :email_me, {:checked => true}
+ Yes, please email me a link to my prayer request's page
- .actions
- %input.btn.primary{:name => "commit", :type => "submit", :value => "Post Request"}
+ .form-actions
+ %input.btn.btn-primary{:name => "commit", :type => "submit", :value => "Post Request"}
%input.btn{:name => "reset", :type => "reset", :value => "Cancel"}
.tab-pane#about
%h3 The Story
- %p Share a Prayer is a simple, minimalistic way to share prayer requests and pray for others. The brainchild of #{link_to "Shane Maloy","http://www.facebok.com/Shaneqmaloy"} and #{link_to "Robert Klubenspies","http://robertklubenspies.com/"}, Share a Prayer started back in the Summer of 2010. A recent influx in interest in the project has sparked active development. The new, redesigned version of Share a Prayer features a bleeding-edge design, an account-less prayer sharing system, and a continuous feed of prayer requests from around the world. The most recent version has been open-sourced under the MIT license so that others may learn from Share a Prayer, or help support continuing development. We hope you that enjoy Share a Prayer and may God be with you in your journey.
+ %p Share a Prayer is a simple, minimalistic way to share prayer requests and pray for others. The brainchild of #{link_to "Shane Maloy","http://www.facebok.com/Shaneqmaloy"} and #{link_to "Robert Klubenspies","http://robertklubenspies.com/"}, Share a Prayer started back in the Summer of 2010. A recent influx in interest in the project has sparked active development. The new, redesigned version of Share a Prayer features a bleeding-edge design, an account-less prayer sharing system, and a continuous feed of prayer requests from around the world. The most recent version has been #{link_to "open-sourced","http://github.com/shareaprayer/shareaprayer"} under the MIT license so that others may learn from Share a Prayer, or help support continuing development. We hope you that enjoy Share a Prayer and share it with your friends.
%br
%h3 The Mission
- %p It is our goal at Share a Prayer to become the premier prayer sharing website. We offer something unique; our minimalistic experience allows users to get straight to what matters most: prayer.
- %p.mission Our mission is to glorify God through providing a universal, minimalistic prayer sharing experience for everyone.
+ %p It is our goal at Share a Prayer to become a community unlike any other. We offer something unique; our minimalistic experience allows users to get straight to what matters most: prayer.
+ %p.mission Our mission is to glorify God by providing a way to connect others with God through prayer.
%br
@@ -116,10 +104,10 @@
.span6
%h4
Robert Klubenspies
- %small Web Application Developer
+ %small Co-Founder
%p
I'm a geek, no doubt. Among other things I'm a rubyist, theorist, idealist, and metaphysicist. I believe that every website or web app that you use should be beautiful, minimalist, and help you accomplish your goals in a fraction of amount of time they would normally consume. Utilizing Ruby, HTML 4/5, CSS 3, and NoSQL data stores, I strive to build beautiful interfaces and web apps for myself and clients.
- %small #{link_to "robertklubenspies.com","http://robertklubenspies.com/"}
+ %small #{link_to "robertklubenspies.com","http://www.robertklubenspies.com/"}
%br
.row
.span2
@@ -127,9 +115,9 @@
.span6
%h4
Shane Maloy
- %small Promoter
+ %small Co-Founder
%p
- I am a 17 year old website designer from Orlando, FL with a passion to glorify God in all that I do. Besides occasional work and dual enrollment at Seminole State College, I enjoy bike rides, working on my car, Starbucks, Chipotle, music, leading worship at my church and photography. I play a 1970’s Gibson SG, a 1983 Fender Stratocaster and a Ibanez Acoustic guitar. I love playing guitar, bass, drums, synth, and even a little keyboard. Overall, I’m just a geek.
+ I'm a 17 year old geek from Orlando, FL. Besides my work as a social media guru and web developer, I am dual enrolled at Seminole State College. I love creating useful tools in Ruby that help make the world a better place. In my spare time, I enjoy playing music, working on my car, drinking Starbucks, eating Chipotle, and photography. Overall I’m just a geek with a passion for web apps, technology, and music.
%small #{link_to "shanemaloy.com","http://shanemaloy.com/"}
=render 'shared/footer'
@@ -141,12 +129,6 @@
#{extend_gritter :fade_in_speed => 2000}
});
- // Blur action for email address field triggers Gravatar load/reload
- $('#prayer_email').blur(function() {
- $('#prayer_gravatar').html($.gravatar($(this).val(), {size: '100'}));
- $('#form_profile_icon').slideDown();
- });
-
// Click action for anonymous button
$('#anonymous_name').click(function() {
$('#prayer_name').val("Anonymous").addClass('uneditable-input').attr('readonly', true);
@@ -154,6 +136,13 @@
$('#prayer_name').nextAll(".help-block").text("Your request will be posted anonymously");
});
+ // Click action for location opt-out button
+ $('#no_location').click(function() {
+ $('#prayer_location').val("Anonymous").addClass('uneditable-input').attr('readonly', true);
+ $('#no_location').val("We will respect your privacy").attr('disabled', 'disabled');
+ $('#prayer_location').nextAll(".help-block").text("Your request will be posted without a location");
+ });
+
// Disable submit button on submit
$('#prayer-form').submit(function(){
$('input[type=submit]', this).attr('disabled', 'disabled');
@@ -174,9 +163,9 @@
$('#prayer-form').validate({
errorClass:'error',
validClass:'success',
- errorElement:'span',
+ errorElement:'p',
highlight: function (element, errorClass, validClass) {
- $(element).parents("div[class='clearfix']").addClass(errorClass).removeClass(validClass);
+ $(element).parents("div[class='control-group']").addClass(errorClass).removeClass(validClass);
},
unhighlight: function (element, errorClass, validClass) {
$(element).parents(".error").removeClass(errorClass).addClass(validClass);
1  app/views/prayers/index.js.erb
View
@@ -2,6 +2,7 @@
<% unless @prayers.blank? %>
$(".prayers").append("<%= escape_javascript(render(@prayers)) %>");
$(".prayers").data('last', '<%=@prayers.last.created_at%>')
+ jQuery("time#timeago").timeago();
<% else %>
// Show the no more prayers notice
$("#no-more-prayers").show();
50 app/views/prayers/show.html.haml
View
@@ -2,15 +2,19 @@
%section#home-show.animated.fadeInLeft
-# Create a new row for the prayer request
.row
- -# Show the Gravatar on the left using the CSS grid
- .span1
- =image_tag "http://www.gravatar.com/avatar/#{@prayer.gravatar_id}?size=70"
-
- -# Show the prayer request on the right using the CSS grid
- .span7
- %h2 "#{@prayer.request}"
- %p
- %small Posted by #{@prayer.name.split(" ")[0]} #{timeago(@prayer.created_at)}
+ -# Show the prayer request using the CSS grid
+ .span8
+ %h2 &#8220;#{@prayer.request}&#8221;
+ .info
+ %i.icon-user
+ =@prayer.name.split(" ")[0]
+
+ %i.icon-time
+ =timeago @prayer.created_at
+
+ -if @prayer.location
+ %i.icon-map-marker
+ =@prayer.location
-# Create a new row for the buttons
.row
@@ -21,19 +25,29 @@
-# Buttons
%p
-# Back button
- =link_to "More Prayer Requests", prayers_path, :class => "btn"
+ %a.btn{:href => url_for(prayers_path)}
+ %i.icon-home
+ More Prayer Requests
-# If the prayer request was already prayed for display the disabled button, otherwise show the enabled one
-if @already_prayed_for
- =link_to "You already prayed for this", "#", :class => "btn success disabled", :id => "home-show-prayed-for"
+ %a.btn.btn-success.disabled#home-show-prayed-for{:href => "#"}
+ %i.icon-ok.icon-white
+ You already prayed for this
-else
- =link_to "I prayed for this", prayed_for_prayer_path(@prayer), :remote => true, :class => "btn success", :id => "home-show-prayed-for"
+ %a.btn.btn-success#home-show-prayed-for{:href => url_for(prayed_for_prayer_path(@prayer)), :"data-remote" => "true"}
+ %i.icon-ok.icon-white
+ I prayed for this
-# If the prayer request was already reported display the disabled button, otherwise show the enabled one
-if @already_reported
- =link_to "You already reported this content", "#", :class => "btn danger disabled", :id => "home-show-report"
+ %a.btn.btn-danger.disabled#home-show-report{:href => "#"}
+ %i.icon-ban-circle.icon-white
+ You already reported this content
-else
- =link_to "Report Inappropriate Content", report_prayer_path(@prayer), :remote => true, :class => "btn danger", :id => "home-show-report"
+ %a.btn.btn-danger#home-show-report{:href => url_for(report_prayer_path(@prayer)), :"data-remote" => "true"}
+ %i.icon-ban-circle.icon-white
+ Report Inappropriate Content
-# Create a new row for comments
.row
@@ -81,10 +95,4 @@
-# Display footer partial in new row
.row
.span8
- =render 'shared/footer'
-
--# Intialize jQuery timeago
-:javascript
- $(document).ready(function(){
- jQuery("time#timeago").timeago();
- });
+ =render 'shared/footer'
5 app/views/shared/_footer.html.haml
View
@@ -1,6 +1,9 @@
-# If in production mode, show Facebook reccomend button
- if Rails.env == "production"
- .fb-like{:data => {:href => "http://shareaprayer.org/", :send => "false", :width => "620", :"show-faces" => "false", :action => "recommend"}}
+ .fb-like{:data => {:href => "https://www.facebook.com/shareaprayer", :send => "false", :layout => "button_count", :width => "50", :"show-faces" => "true"} }
+ %a.twitter-share-button{:href => "https://twitter.com/share", :"data-url" => "http://shareaprayer.org/", :"data-text" => "Check out Share a Prayer: the minimalist way to share prayer requests and pray for others -", :"data-via" => "goshareaprayer"} Tweet
+ :javascript
+ !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
-# Copyright/trademark statement w/ links to policies
%p
1  config/routes.rb
View
@@ -5,6 +5,7 @@
namespace :api do
namespace :v1 do
resources :prayers, :only => [:index, :create, :show]
+ resources :stats, :only => [:index]
end
end

No commit comments for this range

Something went wrong with that request. Please try again.