Merge branch 'master' into remove_gmail
This commit is contained in:
commit
5cbffca6d3
88 changed files with 2348 additions and 610 deletions
2
Gemfile
2
Gemfile
|
@ -145,4 +145,4 @@ gem 'grape-swagger'
|
||||||
gem 'grape-swagger-entity'
|
gem 'grape-swagger-entity'
|
||||||
gem 'grape_url_validator'
|
gem 'grape_url_validator'
|
||||||
gem 'grape_logging'
|
gem 'grape_logging'
|
||||||
gem 'grape_devise', git: 'https://github.com/ericschultz/grape_devise.git'
|
gem 'grape_devise', path: 'gems/grape_devise'
|
||||||
|
|
17
Gemfile.lock
17
Gemfile.lock
|
@ -8,15 +8,6 @@ GIT
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
stripe (>= 1.31.0, <= 1.58.0)
|
stripe (>= 1.31.0, <= 1.58.0)
|
||||||
|
|
||||||
GIT
|
|
||||||
remote: https://github.com/ericschultz/grape_devise.git
|
|
||||||
revision: f1cdf2576476f0f9bf0b4f5c3e7cf07295933871
|
|
||||||
specs:
|
|
||||||
grape_devise (0.1.1)
|
|
||||||
devise (>= 2.2.8, < 4)
|
|
||||||
grape (> 0.7)
|
|
||||||
rails (> 3.2, < 5)
|
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/ruby-grape/grape-entity.git
|
remote: https://github.com/ruby-grape/grape-entity.git
|
||||||
revision: 0e04aa561373b510c2486282979085eaef2ae663
|
revision: 0e04aa561373b510c2486282979085eaef2ae663
|
||||||
|
@ -26,6 +17,14 @@ GIT
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
multi_json (>= 1.3.2)
|
multi_json (>= 1.3.2)
|
||||||
|
|
||||||
|
PATH
|
||||||
|
remote: gems/grape_devise
|
||||||
|
specs:
|
||||||
|
grape_devise (0.1.1)
|
||||||
|
devise (>= 2.2.8, < 5)
|
||||||
|
grape (> 0.7)
|
||||||
|
rails (> 3.2, < 6)
|
||||||
|
|
||||||
PATH
|
PATH
|
||||||
remote: gems/ruby-param-validation
|
remote: gems/ruby-param-validation
|
||||||
specs:
|
specs:
|
||||||
|
|
|
@ -160,7 +160,7 @@ This generator creates a basic Typescript module along with a test file.
|
||||||
**Note: This is not legal advice and provides a suggestion which may be compliant. You should talk with your legal counsel if you have
|
**Note: This is not legal advice and provides a suggestion which may be compliant. You should talk with your legal counsel if you have
|
||||||
questions or concerns with how to comply with the various licenses of Houdini**
|
questions or concerns with how to comply with the various licenses of Houdini**
|
||||||
|
|
||||||
Providing the complete, corresponding source code (CCS) of your project is a requirement of some of the licensed used by Houdini. There are two methods for doing so right now:
|
Providing the complete, corresponding source code (CCS) of your project is a requirement of some of the licenses used by Houdini. There are two methods for doing so right now:
|
||||||
|
|
||||||
1. Providing a tarball of the current running code
|
1. Providing a tarball of the current running code
|
||||||
2. Providing a link to Github where the code is pulled from
|
2. Providing a link to Github where the code is pulled from
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
/* License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later */
|
/* License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later */
|
||||||
$paper: url('/assets/patterns/paper.png');
|
$paper: url('/assets/patterns/paper.png');
|
||||||
$photo-collage: url('/assets/patterns/npo-collage.jpg');
|
|
||||||
$mosaic: url('/assets/patterns/color-mosaic.png');
|
$mosaic: url('/assets/patterns/color-mosaic.png');
|
||||||
$zigzag: url('/assets/patterns/zigzag.svg');
|
|
||||||
|
|
||||||
$tri-green: url('/assets/graphics/triangle-green.svg');
|
|
||||||
$radial: url('/assets/graphics/white-radial.png');
|
|
|
@ -1,46 +0,0 @@
|
||||||
/* License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later */
|
|
||||||
// // Onboarding modal
|
|
||||||
|
|
||||||
// .onboardModal label {
|
|
||||||
// display: block;
|
|
||||||
// margin: 0 auto 4px auto;
|
|
||||||
// font-size: 16px;
|
|
||||||
// font-weight: bold;
|
|
||||||
// color: #666;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .onboardModal .modal-body { padding: 0; }
|
|
||||||
|
|
||||||
// .onboardModal .cc-btn.large {
|
|
||||||
// width: 60%;
|
|
||||||
// margin: 0 auto;
|
|
||||||
// display: block;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .onboardModal form {
|
|
||||||
// margin: 0 auto;
|
|
||||||
// padding: 10px 0 30px 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .onboardModal {
|
|
||||||
// form input, form textarea {
|
|
||||||
// width: 94%;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .onboardModal .field {
|
|
||||||
// margin-top: 10px;
|
|
||||||
// margin-bottom: 10px;
|
|
||||||
// overflow: hidden;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// .onboardModal .step--user {
|
|
||||||
|
|
||||||
// form {
|
|
||||||
// width: 50%;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// input.user-name-input {
|
|
||||||
// width: 114px;
|
|
||||||
// }
|
|
||||||
// }
|
|
|
@ -2,15 +2,9 @@
|
||||||
@import 'common/colors';
|
@import 'common/colors';
|
||||||
@import 'common/backgrounds';
|
@import 'common/backgrounds';
|
||||||
|
|
||||||
|
|
||||||
// COMMON EFFECTS:
|
// COMMON EFFECTS:
|
||||||
|
|
||||||
$box-5: 0 0 5px 0 rgba(0,0,0,0.3);
|
|
||||||
$cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
$cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
||||||
|
|
||||||
@mixin glow{
|
|
||||||
@include box-shadow(0 0 20px 0px rgba(white, 0.3));
|
|
||||||
}
|
|
||||||
@mixin background-size($val) {
|
@mixin background-size($val) {
|
||||||
-webkit-background-size: $val;
|
-webkit-background-size: $val;
|
||||||
-moz-background-size: $val;
|
-moz-background-size: $val;
|
||||||
|
@ -90,42 +84,6 @@ $cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin skrim-grad-top($color, $height) {
|
|
||||||
&:before {
|
|
||||||
position: absolute;
|
|
||||||
content: '';
|
|
||||||
width: 100%;
|
|
||||||
height: $height;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
@include gradient(top, $color, $trans);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin skrim-grad-top--out($color, $height) {
|
|
||||||
&:before {
|
|
||||||
position: absolute;
|
|
||||||
content: '';
|
|
||||||
width: 100%;
|
|
||||||
height: $height;
|
|
||||||
left: 0;
|
|
||||||
top: - $height;
|
|
||||||
@include gradient(bottom, $color, $trans);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin skrim-grad-bottom($color, $height) {
|
|
||||||
&:before {
|
|
||||||
position: absolute;
|
|
||||||
content: '';
|
|
||||||
width: 100%;
|
|
||||||
height: $height;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
@include gradient(bottom, $color, $trans);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin cornerHoles--bottom($size, $color) {
|
@mixin cornerHoles--bottom($size, $color) {
|
||||||
&:before {
|
&:before {
|
||||||
content: '';
|
content: '';
|
||||||
|
@ -183,31 +141,6 @@ $cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@mixin drop-cap {
|
|
||||||
&:first-letter {
|
|
||||||
@include bitter;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 180%;
|
|
||||||
}
|
|
||||||
&:first-line {
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin after-gradient {
|
|
||||||
position: relative;
|
|
||||||
&:after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
@include gradient(top, $trans, #fff);
|
|
||||||
width: 100%;
|
|
||||||
height: 50px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin mosaic($topBottomOrBoth, $height){
|
@mixin mosaic($topBottomOrBoth, $height){
|
||||||
&:after {
|
&:after {
|
||||||
content: '';
|
content: '';
|
||||||
|
@ -234,169 +167,6 @@ $cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin border-topBottom($properties...) {
|
|
||||||
border-top: $properties;
|
|
||||||
border-bottom: $properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin border-leftRight($properties...) {
|
|
||||||
border-left: $properties;
|
|
||||||
border-right: $properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin flag($color, $height, $boolean){
|
|
||||||
$halfHeight: $height/2;
|
|
||||||
$lightColor: lighten($color, 3%);
|
|
||||||
$isLink: $boolean;
|
|
||||||
background: $color;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&:before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
left: -$halfHeight;
|
|
||||||
border-top: $halfHeight solid $color;
|
|
||||||
border-left: $halfHeight solid transparent;
|
|
||||||
border-bottom: $halfHeight solid $color;
|
|
||||||
}
|
|
||||||
@if $isLink {
|
|
||||||
&:hover {
|
|
||||||
background: $lightColor;
|
|
||||||
&:before {
|
|
||||||
border-top: $halfHeight solid $lightColor;
|
|
||||||
border-left: $halfHeight solid transparent;
|
|
||||||
border-bottom: $halfHeight solid $lightColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin flag-right($color, $height, $boolean){
|
|
||||||
$halfHeight: $height/2;
|
|
||||||
$lightColor: lighten($color, 3%);
|
|
||||||
$isLink: $boolean;
|
|
||||||
background: $color;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&:before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
right: -$halfHeight;
|
|
||||||
border-top: $halfHeight solid $color;
|
|
||||||
border-right: $halfHeight solid transparent;
|
|
||||||
border-bottom: $halfHeight solid $color;
|
|
||||||
}
|
|
||||||
@if $isLink {
|
|
||||||
&:hover {
|
|
||||||
background: $lightColor;
|
|
||||||
&:before {
|
|
||||||
border-top: $halfHeight solid $lightColor;
|
|
||||||
border-right: $halfHeight solid transparent;
|
|
||||||
border-bottom: $halfHeight solid $lightColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin banner($color, $height){
|
|
||||||
$halfHeight: $height/2;
|
|
||||||
background: $color;
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
&:before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
left: -$halfHeight;
|
|
||||||
border-top: $halfHeight solid $color;
|
|
||||||
border-left: $halfHeight solid transparent;
|
|
||||||
border-bottom: $halfHeight solid $color;
|
|
||||||
};
|
|
||||||
|
|
||||||
&:after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
right: -$halfHeight;
|
|
||||||
border-top: $halfHeight solid $color;
|
|
||||||
border-right: $halfHeight solid transparent;
|
|
||||||
border-bottom: $halfHeight solid $color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@mixin burst($color, $size){
|
|
||||||
background: $color;
|
|
||||||
width: $size;
|
|
||||||
height: $size;
|
|
||||||
position: relative;
|
|
||||||
text-align: center;
|
|
||||||
display: inline-block;
|
|
||||||
|
|
||||||
&:before, &:after {
|
|
||||||
content: "";
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
height: $size;
|
|
||||||
width: $size;
|
|
||||||
background: $color;
|
|
||||||
}
|
|
||||||
&:before {
|
|
||||||
@include rotate(30deg)
|
|
||||||
}
|
|
||||||
&:after {
|
|
||||||
@include rotate(60deg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@mixin tooltip-color($color) {
|
|
||||||
.tooltip.top .tooltip-arrow{
|
|
||||||
border-top:5px solid $color
|
|
||||||
}
|
|
||||||
.tooltip.left .tooltip-arrow{
|
|
||||||
border-left:5px solid $color
|
|
||||||
}
|
|
||||||
.tooltip.bottom .tooltip-arrow{
|
|
||||||
border-bottom:5px solid $color
|
|
||||||
}
|
|
||||||
|
|
||||||
.tooltip.right .tooltip-arrow{
|
|
||||||
border-right:5px solid $color
|
|
||||||
}
|
|
||||||
.tooltip-inner{
|
|
||||||
background-color: $color
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin vertically-center {
|
|
||||||
position: relative;
|
|
||||||
top: 50%;
|
|
||||||
-webkit-transform: translateY(-50%);
|
|
||||||
-moz-transform: translateY(-50%);
|
|
||||||
-ms-transform: translateY(-50%);
|
|
||||||
transform: translateY(-50%);
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin vertically-center-flex {
|
|
||||||
display: -webkit-flex;
|
|
||||||
-webkit-align-items: center;
|
|
||||||
-webkit-justify-content: center;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin logo($px, $color, $is_showing_logo, $should_be_limited){
|
@mixin logo($px, $color, $is_showing_logo, $should_be_limited){
|
||||||
.commitchangeLogo {
|
.commitchangeLogo {
|
||||||
|
@ -437,13 +207,6 @@ $cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
||||||
transition: $properties;
|
transition: $properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin basic-transition($property) {
|
|
||||||
-webkit-transition: $property 0.25s ease-in-out;
|
|
||||||
-moz-transition: $property 0.25s ease-in-out;
|
|
||||||
-ms-transition: $property 0.25s ease-in-out;
|
|
||||||
transition: $property 0.25s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin border-radius($val) {
|
@mixin border-radius($val) {
|
||||||
@if $val == 50% {
|
@if $val == 50% {
|
||||||
-webkit-border-radius: 1000px;
|
-webkit-border-radius: 1000px;
|
||||||
|
@ -454,13 +217,6 @@ $cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
||||||
border-radius: $val;
|
border-radius: $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin border-radius-indiv($a, $b, $c, $d) {
|
|
||||||
-webkit-border-radius: $a $b $c $d;
|
|
||||||
-moz-border-radius: $a $b $c $d;
|
|
||||||
-ms-border-radius: $a $b $c $d;
|
|
||||||
border-radius: $a $b $c $d;
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin box-shadow($a) {
|
@mixin box-shadow($a) {
|
||||||
-webkit-box-shadow: $a;
|
-webkit-box-shadow: $a;
|
||||||
-moz-box-shadow: $a;
|
-moz-box-shadow: $a;
|
||||||
|
@ -475,13 +231,6 @@ $cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
||||||
opacity: $val;
|
opacity: $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin backface-visibility($val) {
|
|
||||||
-webkit-backface-visibility: $val;
|
|
||||||
-moz-backface-visibility: $val;
|
|
||||||
-ms-backface-visibility: $val;
|
|
||||||
backface-visibility: $val;
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin open-sans {
|
@mixin open-sans {
|
||||||
font-family: 'Open Sans', 'Helvetica Neue', Arial, Verdana, 'Droid Sans', sans-serif;
|
font-family: 'Open Sans', 'Helvetica Neue', Arial, Verdana, 'Droid Sans', sans-serif;
|
||||||
}
|
}
|
||||||
|
@ -495,13 +244,6 @@ $cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
||||||
font-family: 'Bitter', serif;
|
font-family: 'Bitter', serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin placeholder {
|
|
||||||
&.placeholder { @content }
|
|
||||||
&::-webkit-input-placeholder { @content }
|
|
||||||
&:-moz-placeholder { @content }
|
|
||||||
&:-ms-placeholder { @content }
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin gradient($dir, $from, $to) {
|
@mixin gradient($dir, $from, $to) {
|
||||||
$ie-hex-from: ie-hex-str($from);
|
$ie-hex-from: ie-hex-str($from);
|
||||||
$ie-hex-to: ie-hex-str($to);
|
$ie-hex-to: ie-hex-str($to);
|
||||||
|
@ -516,13 +258,6 @@ $cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=#{$gradientType},startColorstr='#{$ie-hex-from}', endColorstr='#{$ie-hex-to}');
|
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=#{$gradientType},startColorstr='#{$ie-hex-from}', endColorstr='#{$ie-hex-to}');
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin basic-animation($name) {
|
|
||||||
-webkit-animation: $name ease-in-out;
|
|
||||||
-moz-animation: $name ease-in-out;
|
|
||||||
-ms-animation: $name ease-in-out;
|
|
||||||
animation: $name 2s ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin columns($amount) {
|
@mixin columns($amount) {
|
||||||
width: $amount * 8.3333333333333%;
|
width: $amount * 8.3333333333333%;
|
||||||
clear: left;
|
clear: left;
|
||||||
|
@ -541,14 +276,6 @@ $cubic_bevier: cubic-bezier(.5,1.2,.6,1);
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// General-purpose float-left columns
|
|
||||||
@mixin cols($n) {
|
|
||||||
vertical-align: top;
|
|
||||||
width: $n * 8.3333333333333%;
|
|
||||||
float: left;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin no-select {
|
@mixin no-select {
|
||||||
-webkit-touch-callout: none;
|
-webkit-touch-callout: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
|
|
|
@ -9,14 +9,19 @@ class CampaignsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@nonprofit = current_nonprofit
|
@nonprofit = current_nonprofit
|
||||||
@campaigns = @nonprofit.campaigns.includes(:nonprofit).not_deleted.order('created_at desc')
|
if (current_nonprofit_user?)
|
||||||
|
@campaigns = @nonprofit.campaigns.includes(:nonprofit).not_deleted.order('created_at desc')
|
||||||
|
@deleted_campaigns = @nonprofit.campaigns.includes(:nonprofit).deleted.order('created_at desc')
|
||||||
|
else
|
||||||
|
@campaigns = @nonprofit.campaigns.includes(:nonprofit).not_deleted.not_a_child.order('created_at desc')
|
||||||
|
@deleted_campaigns = @nonprofit.campaigns.includes(:nonprofit).deleted.not_a_child.order('created_at desc')
|
||||||
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
@active_campaigns = @campaigns.active
|
@active_campaigns = @campaigns.active
|
||||||
@past_campaigns = @campaigns.past
|
@past_campaigns = @campaigns.past
|
||||||
@unpublished_campaigns = @campaigns.unpublished
|
@unpublished_campaigns = @campaigns.unpublished
|
||||||
@deleted_campaigns = @nonprofit.campaigns.deleted.order('created_at desc')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
@profiles = @nonprofit.profiles.order('total_raised DESC').limit(5).includes(:user).uniq
|
@profiles = @nonprofit.profiles.order('total_raised DESC').limit(5).includes(:user).uniq
|
||||||
|
|
||||||
events = @nonprofit.events.not_deleted.order('start_datetime desc')
|
events = @nonprofit.events.not_deleted.order('start_datetime desc')
|
||||||
campaigns = @nonprofit.campaigns.not_deleted.order('created_at desc')
|
campaigns = @nonprofit.campaigns.not_deleted.not_a_child.order('created_at desc')
|
||||||
|
|
||||||
@events = events.upcoming
|
@events = events.upcoming
|
||||||
@any_past_events = events.past.any?
|
@any_past_events = events.past.any?
|
||||||
|
|
|
@ -6,4 +6,10 @@ class CampaignMailer < BaseMailer
|
||||||
@campaign = campaign
|
@campaign = campaign
|
||||||
mail(:to => @creator_profile.user.email, :subject => "Get your new campaign rolling! (via #{Settings.general.name})")
|
mail(:to => @creator_profile.user.email, :subject => "Get your new campaign rolling! (via #{Settings.general.name})")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def federated_creation_followup(campaign)
|
||||||
|
@creator_profile = campaign.profile
|
||||||
|
@campaign = campaign
|
||||||
|
mail(:to => @creator_profile.user.email, :subject => "Get your new campaign rolling! (via #{Settings.general.name})")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -76,6 +76,7 @@ class Campaign < ActiveRecord::Base
|
||||||
scope :unpublished, -> {where(:published => [nil, false])}
|
scope :unpublished, -> {where(:published => [nil, false])}
|
||||||
scope :not_deleted, -> {where(deleted: [nil, false])}
|
scope :not_deleted, -> {where(deleted: [nil, false])}
|
||||||
scope :deleted, -> {where(deleted: true)}
|
scope :deleted, -> {where(deleted: true)}
|
||||||
|
scope :not_a_child, -> {where(parent_campaign_id: nil)}
|
||||||
|
|
||||||
before_validation do
|
before_validation do
|
||||||
if self.goal_amount_dollars.present?
|
if self.goal_amount_dollars.present?
|
||||||
|
@ -100,7 +101,12 @@ class Campaign < ActiveRecord::Base
|
||||||
after_create do
|
after_create do
|
||||||
user = self.profile.user
|
user = self.profile.user
|
||||||
Role.create(name: :campaign_editor, user_id: user.id, host: self)
|
Role.create(name: :campaign_editor, user_id: user.id, host: self)
|
||||||
CampaignMailer.delay.creation_followup(self)
|
if child_campaign?
|
||||||
|
CampaignMailer.delay.federated_creation_followup(self)
|
||||||
|
else
|
||||||
|
CampaignMailer.delay.creation_followup(self)
|
||||||
|
end
|
||||||
|
|
||||||
NonprofitAdminMailer.delay.supporter_fundraiser(self) unless QueryRoles.is_nonprofit_user?(user.id, self.nonprofit_id)
|
NonprofitAdminMailer.delay.supporter_fundraiser(self) unless QueryRoles.is_nonprofit_user?(user.id, self.nonprofit_id)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>
|
||||||
|
<% campaign_url = Format::Url.concat(root_url, @campaign.url) %>
|
||||||
|
|
||||||
|
<p>Dear <%= @creator_profile.name.blank? ? @creator_profile.user.email : @creator_profile.name %>,</p>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<p>Congratulations on creating your campaign to support <%= @campaign.nonprofit.name %>!</p>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<p>You can visit it here: <strong><a href='<%= campaign_url %>'><%= campaign_url %></a></strong>.</p>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<p>Before you share your campaign with the world, we recommend you personalize
|
||||||
|
your campaign by including a testimonial in your words about why
|
||||||
|
you launched your campaign. You can also set a goal amount to inspire you and your donors.
|
||||||
|
To edit your campaign, <strong><a href="<%= "#{profile_url(@creator_profile)}/fundraisers" %>">visit your fundraisers dashboard</a></strong> (you may be asked to login)
|
||||||
|
and select <strong><a href='<%= campaign_url %>'><%= @campaign.name%></a></strong>.</p>
|
||||||
|
<br>
|
||||||
|
<p>Make sure to tell your friends and family why they should support your cause and how their contributions will make a difference. Your words and your passion can make a big difference.
|
||||||
|
Share your fundraiser on:</p>
|
||||||
|
<ul>
|
||||||
|
<%- if ENV['FACEBOOK_APP_ID'] -%>
|
||||||
|
<li><%= link_to("Facebook", "https://www.facebook.com/dialog/feed?app_id=#{ENV['FACEBOOK_APP_ID']}&display=popup&caption=#{url_encode(@campaign.name)}&link=#{campaign_url}") %></li>
|
||||||
|
<%- end -%>
|
||||||
|
<li><%= link_to("Twitter", "https://twitter.com/intent/tweet?url=#{campaign_url}&via=#{Settings.general.name}&text=#{url_encode("Join me in supporting: #{@campaign.name}")}") %></li>
|
||||||
|
<li>Or copy and paste the link above into an email to your friends and family</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>If you need some help getting your campaign up and running, don't hesitate to contact <strong><%= Settings.devise.mailer_sender %></strong>.</p>
|
||||||
|
|
||||||
|
<%= render 'emails/sig' %>
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
<%= render 'common/modal_header', title: 'Campaign Settings' %>
|
<%= render 'common/modal_header', title: 'Campaign Settings' %>
|
||||||
|
|
||||||
<form class='form--flatFields' autosubmit action='/nonprofits/<%=@nonprofit.id%>/campaigns/<%=@campaign.id%>' method='put' data-reload parsley-validate>
|
<form class='form--flatFields' autosubmit action='/nonprofits/<%=@nonprofit.id%>/campaigns/<%=@campaign.id%>' method='put' data-reload-with-slug parsley-validate>
|
||||||
|
|
||||||
<% if @campaign.child_campaign? %>
|
<% if @campaign.child_campaign? %>
|
||||||
<div class='modal-body'>
|
<div class='modal-body'>
|
||||||
<div class='u-margin--auto'>
|
<div class='u-margin--auto'>
|
||||||
|
|
|
@ -150,9 +150,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p>
|
<% if @child_campaign.deleted %>
|
||||||
Seems like you already have a campaign for that cause! <%= link_to "Click here to see it", @child_campaign.url %>.
|
<p>
|
||||||
</p>
|
Seems like you already have a campaign for that cause! <%= link_to "Click here to reactivate your campaign", "javascript:appl.undelete_p2p(\"/nonprofits/#{@child_campaign.nonprofit_id}/campaigns/#{@child_campaign.id}\")" %>
|
||||||
|
</p>
|
||||||
|
<% else %>
|
||||||
|
<p>
|
||||||
|
Seems like you already have a campaign for that cause! <%= link_to "Click here to see it", @child_campaign.url %>.
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
|
<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>
|
||||||
|
<%- @location_array = []
|
||||||
|
@location_array.push(profile.city) if profile.city.present?
|
||||||
|
@location_array.push(profile.state_code) if profile.state_code.present?
|
||||||
|
-%>
|
||||||
<section class='box' style="font-style: italic">
|
<section class='box' style="font-style: italic">
|
||||||
<div class="well" style="padding-left:16px;">
|
<div class="well" style="padding-left:16px;">
|
||||||
<h4><%= profile.name %> <% if profile.state_code || profile.city -%>
|
<h4><%= profile.name %><%- if @location_array.any? -%>
|
||||||
<small>(<% if profile.state_code && profile.city -%><%= profile.city %>, <%= profile.state_code -%>
|
<small>(<%= @location_array.join(', ') %>)</small><%- end -%>
|
||||||
<% elsif profile.city -%>
|
|
||||||
<%= profile.city -%>
|
|
||||||
<% else -%>
|
|
||||||
<%= profile.state_code -%>
|
|
||||||
<% end -%>)</small><% end -%>
|
|
||||||
</h4>
|
</h4>
|
||||||
<blockquote><p>"<%= reason_for_supporting %>"</p></blockquote></div>
|
<blockquote><p>"<%= reason_for_supporting %>"</p></blockquote></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
- Donor Fundraisers (P2P)
|
- Donor Fundraisers (P2P)
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :javascripts do %>
|
|
||||||
<%= IncludeAsset.js '/client/js/profiles/fundraisers/page.js' %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% content_for(:footer_hidden) {'hidden'} %>
|
<% content_for(:footer_hidden) {'hidden'} %>
|
||||||
|
|
||||||
<% content_for :stylesheets do %>
|
<% content_for :stylesheets do %>
|
||||||
|
@ -28,8 +24,6 @@
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class='container u-padding--15 u-marginBottom--50'>
|
<div class='container u-padding--15 u-marginBottom--50'>
|
||||||
<h3 class='u-centered u-marginTop--20 u-marginBottom--30'>Managed Events</h3>
|
|
||||||
<div id='js-eventsListing'></div>
|
|
||||||
|
|
||||||
<h3 class='u-centered u-marginTop--30'>Managed Campaigns</h3>
|
<h3 class='u-centered u-marginTop--30'>Managed Campaigns</h3>
|
||||||
<% if @edited_campaigns.any? %>
|
<% if @edited_campaigns.any? %>
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
- Donor Profile
|
- Donor Profile
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :javascripts do %>
|
|
||||||
<%= IncludeAsset.js '/client/js/profiles/show/page.js' %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% content_for :stylesheets do %>
|
<% content_for :stylesheets do %>
|
||||||
<%= stylesheet_link_tag 'profiles/show/page' %>
|
<%= stylesheet_link_tag 'profiles/show/page' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -5,6 +5,19 @@ require('../../common/image_uploader')
|
||||||
|
|
||||||
var request = require("../../common/client")
|
var request = require("../../common/client")
|
||||||
|
|
||||||
|
appl.def('undelete_p2p', function (url){
|
||||||
|
appl.def('loading', true)
|
||||||
|
request.put(url + '/soft_delete', {delete: false}).end(function(err, resp) {
|
||||||
|
if (err) {
|
||||||
|
appl.def('loading', false)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
window.location = url
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
// setting up some default values
|
// setting up some default values
|
||||||
appl.def('is_signing_up', true)
|
appl.def('is_signing_up', true)
|
||||||
.def('selected_result_index', -1)
|
.def('selected_result_index', -1)
|
||||||
|
|
|
@ -33,7 +33,9 @@ function submit_form(form_el, on_success) {
|
||||||
contentType: false
|
contentType: false
|
||||||
})
|
})
|
||||||
.done(function(d) {
|
.done(function(d) {
|
||||||
if(form_el.hasAttribute('data-reload'))
|
if(form_el.hasAttribute('data-reload-with-slug'))
|
||||||
|
window.location = d['url']
|
||||||
|
else if(form_el.hasAttribute('data-reload'))
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
else if(form_el.hasAttribute('data-redirect')) {
|
else if(form_el.hasAttribute('data-redirect')) {
|
||||||
var redirect = form_el.getAttribute('data-redirect')
|
var redirect = form_el.getAttribute('data-redirect')
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
// License: LGPL-3.0-or-later
|
|
||||||
var renderListings = require('../../events/listings')
|
|
||||||
renderListings(`/profiles/${app.profile_id}/events`)
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
// License: LGPL-3.0-or-later
|
|
||||||
|
|
10
gems/grape_devise/.gitignore
vendored
Normal file
10
gems/grape_devise/.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
.bundle/
|
||||||
|
log/*.log
|
||||||
|
pkg/
|
||||||
|
spec/dummy/db/*.sqlite3
|
||||||
|
spec/dummy/db/*.sqlite3-journal
|
||||||
|
spec/dummy/log/*.log
|
||||||
|
spec/dummy/tmp/
|
||||||
|
spec/dummy/.sass-cache
|
||||||
|
.idea
|
||||||
|
*.iml
|
4
gems/grape_devise/.travis.yml
Normal file
4
gems/grape_devise/.travis.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
language: ruby
|
||||||
|
rvm:
|
||||||
|
- 2.1.0
|
||||||
|
sudo: false
|
14
gems/grape_devise/Gemfile
Normal file
14
gems/grape_devise/Gemfile
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
# Declare your gem's dependencies in grape_devise.gemspec.
|
||||||
|
# Bundler will treat runtime dependencies like base dependencies, and
|
||||||
|
# development dependencies will be added by default to the :development group.
|
||||||
|
gemspec
|
||||||
|
|
||||||
|
# Declare any dependencies that are still in development here instead of in
|
||||||
|
# your gemspec. These might include edge Rails or gems from your path or
|
||||||
|
# Git. Remember to move these dependencies to your gemspec before releasing
|
||||||
|
# your gem to rubygems.org.
|
||||||
|
|
||||||
|
# To use debugger
|
||||||
|
# gem 'debugger'
|
176
gems/grape_devise/Gemfile.lock
Normal file
176
gems/grape_devise/Gemfile.lock
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
PATH
|
||||||
|
remote: .
|
||||||
|
specs:
|
||||||
|
grape_devise (0.1.1)
|
||||||
|
devise (>= 2.2.8, < 4)
|
||||||
|
grape (~> 0.7)
|
||||||
|
rails (> 3.2, < 5)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
actionmailer (4.1.6)
|
||||||
|
actionpack (= 4.1.6)
|
||||||
|
actionview (= 4.1.6)
|
||||||
|
mail (~> 2.5, >= 2.5.4)
|
||||||
|
actionpack (4.1.6)
|
||||||
|
actionview (= 4.1.6)
|
||||||
|
activesupport (= 4.1.6)
|
||||||
|
rack (~> 1.5.2)
|
||||||
|
rack-test (~> 0.6.2)
|
||||||
|
actionview (4.1.6)
|
||||||
|
activesupport (= 4.1.6)
|
||||||
|
builder (~> 3.1)
|
||||||
|
erubis (~> 2.7.0)
|
||||||
|
activemodel (4.1.6)
|
||||||
|
activesupport (= 4.1.6)
|
||||||
|
builder (~> 3.1)
|
||||||
|
activerecord (4.1.6)
|
||||||
|
activemodel (= 4.1.6)
|
||||||
|
activesupport (= 4.1.6)
|
||||||
|
arel (~> 5.0.0)
|
||||||
|
activerecord-nulldb-adapter (0.3.1)
|
||||||
|
activerecord (>= 2.0.0)
|
||||||
|
activesupport (4.1.6)
|
||||||
|
i18n (~> 0.6, >= 0.6.9)
|
||||||
|
json (~> 1.7, >= 1.7.7)
|
||||||
|
minitest (~> 5.1)
|
||||||
|
thread_safe (~> 0.1)
|
||||||
|
tzinfo (~> 1.1)
|
||||||
|
arel (5.0.1.20140414130214)
|
||||||
|
axiom-types (0.1.1)
|
||||||
|
descendants_tracker (~> 0.0.4)
|
||||||
|
ice_nine (~> 0.11.0)
|
||||||
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
|
bcrypt (3.1.11)
|
||||||
|
builder (3.2.2)
|
||||||
|
capybara (2.4.1)
|
||||||
|
mime-types (>= 1.16)
|
||||||
|
nokogiri (>= 1.3.3)
|
||||||
|
rack (>= 1.0.0)
|
||||||
|
rack-test (>= 0.5.4)
|
||||||
|
xpath (~> 2.0)
|
||||||
|
coercible (1.0.0)
|
||||||
|
descendants_tracker (~> 0.0.1)
|
||||||
|
concurrent-ruby (1.0.5)
|
||||||
|
descendants_tracker (0.0.4)
|
||||||
|
thread_safe (~> 0.3, >= 0.3.1)
|
||||||
|
devise (3.5.10)
|
||||||
|
bcrypt (~> 3.0)
|
||||||
|
orm_adapter (~> 0.1)
|
||||||
|
railties (>= 3.2.6, < 5)
|
||||||
|
responders
|
||||||
|
thread_safe (~> 0.1)
|
||||||
|
warden (~> 1.2.3)
|
||||||
|
diff-lcs (1.2.5)
|
||||||
|
equalizer (0.0.11)
|
||||||
|
erubis (2.7.0)
|
||||||
|
factory_girl (4.4.0)
|
||||||
|
activesupport (>= 3.0.0)
|
||||||
|
grape (0.19.1)
|
||||||
|
activesupport
|
||||||
|
builder
|
||||||
|
hashie (>= 2.1.0)
|
||||||
|
multi_json (>= 1.3.2)
|
||||||
|
multi_xml (>= 0.5.2)
|
||||||
|
mustermann-grape (~> 0.4.0)
|
||||||
|
rack (>= 1.3.0)
|
||||||
|
rack-accept
|
||||||
|
virtus (>= 1.0.0)
|
||||||
|
hashie (3.5.5)
|
||||||
|
i18n (0.6.11)
|
||||||
|
ice_nine (0.11.2)
|
||||||
|
json (1.8.1)
|
||||||
|
mail (2.6.4)
|
||||||
|
mime-types (>= 1.16, < 4)
|
||||||
|
mime-types (2.3)
|
||||||
|
mini_portile (0.6.0)
|
||||||
|
minitest (5.4.1)
|
||||||
|
multi_json (1.12.1)
|
||||||
|
multi_xml (0.6.0)
|
||||||
|
mustermann (0.4.0)
|
||||||
|
tool (~> 0.2)
|
||||||
|
mustermann-grape (0.4.0)
|
||||||
|
mustermann (= 0.4.0)
|
||||||
|
nokogiri (1.6.3.1)
|
||||||
|
mini_portile (= 0.6.0)
|
||||||
|
orm_adapter (0.5.0)
|
||||||
|
rack (1.5.2)
|
||||||
|
rack-accept (0.4.5)
|
||||||
|
rack (>= 0.4)
|
||||||
|
rack-test (0.6.2)
|
||||||
|
rack (>= 1.0)
|
||||||
|
rails (4.1.6)
|
||||||
|
actionmailer (= 4.1.6)
|
||||||
|
actionpack (= 4.1.6)
|
||||||
|
actionview (= 4.1.6)
|
||||||
|
activemodel (= 4.1.6)
|
||||||
|
activerecord (= 4.1.6)
|
||||||
|
activesupport (= 4.1.6)
|
||||||
|
bundler (>= 1.3.0, < 2.0)
|
||||||
|
railties (= 4.1.6)
|
||||||
|
sprockets-rails (~> 2.0)
|
||||||
|
railties (4.1.6)
|
||||||
|
actionpack (= 4.1.6)
|
||||||
|
activesupport (= 4.1.6)
|
||||||
|
rake (>= 0.8.7)
|
||||||
|
thor (>= 0.18.1, < 2.0)
|
||||||
|
rake (10.3.2)
|
||||||
|
responders (1.1.2)
|
||||||
|
railties (>= 3.2, < 4.2)
|
||||||
|
rspec (2.99.0)
|
||||||
|
rspec-core (~> 2.99.0)
|
||||||
|
rspec-expectations (~> 2.99.0)
|
||||||
|
rspec-mocks (~> 2.99.0)
|
||||||
|
rspec-collection_matchers (1.0.0)
|
||||||
|
rspec-expectations (>= 2.99.0.beta1)
|
||||||
|
rspec-core (2.99.2)
|
||||||
|
rspec-expectations (2.99.2)
|
||||||
|
diff-lcs (>= 1.1.3, < 2.0)
|
||||||
|
rspec-mocks (2.99.2)
|
||||||
|
rspec-rails (2.99.0)
|
||||||
|
actionpack (>= 3.0)
|
||||||
|
activemodel (>= 3.0)
|
||||||
|
activesupport (>= 3.0)
|
||||||
|
railties (>= 3.0)
|
||||||
|
rspec-collection_matchers
|
||||||
|
rspec-core (~> 2.99.0)
|
||||||
|
rspec-expectations (~> 2.99.0)
|
||||||
|
rspec-mocks (~> 2.99.0)
|
||||||
|
sprockets (3.7.1)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
rack (> 1, < 3)
|
||||||
|
sprockets-rails (2.3.3)
|
||||||
|
actionpack (>= 3.0)
|
||||||
|
activesupport (>= 3.0)
|
||||||
|
sprockets (>= 2.8, < 4.0)
|
||||||
|
sqlite3 (1.3.9)
|
||||||
|
thor (0.19.1)
|
||||||
|
thread_safe (0.3.4)
|
||||||
|
tool (0.2.3)
|
||||||
|
tzinfo (1.2.2)
|
||||||
|
thread_safe (~> 0.1)
|
||||||
|
virtus (1.0.5)
|
||||||
|
axiom-types (~> 0.1)
|
||||||
|
coercible (~> 1.0)
|
||||||
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
||||||
|
equalizer (~> 0.0, >= 0.0.9)
|
||||||
|
warden (1.2.7)
|
||||||
|
rack (>= 1.0)
|
||||||
|
xpath (2.0.0)
|
||||||
|
nokogiri (~> 1.3)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
activerecord-nulldb-adapter (~> 0.3.1)
|
||||||
|
capybara (~> 2.4.1)
|
||||||
|
factory_girl (~> 4.4.0)
|
||||||
|
grape_devise!
|
||||||
|
rspec (~> 2.99.0)
|
||||||
|
rspec-rails (~> 2.99.0)
|
||||||
|
sqlite3
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
1.14.5
|
21
gems/grape_devise/MIT-LICENSE
Normal file
21
gems/grape_devise/MIT-LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
Copyright 2014 justinm
|
||||||
|
Copyright 2018 CommitChange
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
39
gems/grape_devise/README.md
Normal file
39
gems/grape_devise/README.md
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Grape::Devise
|
||||||
|
|
||||||
|
Grape::Devise adds support for devise helpers from inside Grape::APIs.
|
||||||
|
|
||||||
|
NOTE: this project was originally at https://github.com/justinm/grape_devise
|
||||||
|
but is not longer supported so we moved it into our repo.
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
Installing is simple. Just add the grape_devise gem to your Gemfile, run
|
||||||
|
```bundle install``` and it's ready to go.
|
||||||
|
|
||||||
|
```
|
||||||
|
gem 'grape_devise'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The devise API can now be accessed from inside of Grape request blocks.
|
||||||
|
|
||||||
|
```
|
||||||
|
class MyAPI < Grape::API
|
||||||
|
get "/requires-authentication" do
|
||||||
|
authenticate_user!
|
||||||
|
end
|
||||||
|
|
||||||
|
get "/who-am-i" do
|
||||||
|
current_user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
|
||||||
|
####Can I use this with rails
|
||||||
|
Yes you can! Grape::Devise works with your existing rails sessions to provide
|
||||||
|
seamless authentication between your rails app and grape APIs.
|
||||||
|
|
25
gems/grape_devise/Rakefile
Normal file
25
gems/grape_devise/Rakefile
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
begin
|
||||||
|
require 'bundler/setup'
|
||||||
|
rescue LoadError
|
||||||
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
||||||
|
end
|
||||||
|
|
||||||
|
require 'rdoc/task'
|
||||||
|
|
||||||
|
RDoc::Task.new(:rdoc) do |rdoc|
|
||||||
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
|
rdoc.title = 'GrapeDevise'
|
||||||
|
rdoc.options << '--line-numbers'
|
||||||
|
rdoc.rdoc_files.include('README.rdoc')
|
||||||
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
|
end
|
||||||
|
|
||||||
|
require 'rspec/core/rake_task'
|
||||||
|
|
||||||
|
RSpec::Core::RakeTask.new(:spec)
|
||||||
|
|
||||||
|
|
||||||
|
Bundler::GemHelper.install_tasks
|
||||||
|
|
||||||
|
|
||||||
|
task default: :spec
|
32
gems/grape_devise/grape_devise.gemspec
Normal file
32
gems/grape_devise/grape_devise.gemspec
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
$:.push File.expand_path("../lib", __FILE__)
|
||||||
|
|
||||||
|
# Maintain your gem's version:
|
||||||
|
require "grape_devise/version"
|
||||||
|
|
||||||
|
# Describe your gem and declare its dependencies:
|
||||||
|
Gem::Specification.new do |s|
|
||||||
|
s.name = "grape_devise"
|
||||||
|
s.version = GrapeDevise::VERSION
|
||||||
|
s.authors = ["Justin McCormick"]
|
||||||
|
s.email = ["me@justinmccormick.com"]
|
||||||
|
s.homepage = "http://github.com/justinm/grape_devise"
|
||||||
|
s.summary = "Adds support for devise in grape applications"
|
||||||
|
s.description = "This gem provides access to devise helpers inside of "
|
||||||
|
"Grape applications."
|
||||||
|
|
||||||
|
s.licenses = [ 'MIT' ]
|
||||||
|
|
||||||
|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE ", "Rakefile", "README.rdoc"]
|
||||||
|
s.test_files = Dir["test/**/*"]
|
||||||
|
|
||||||
|
s.add_development_dependency "rspec", "~> 2.99.0"
|
||||||
|
s.add_development_dependency "rspec-rails", "~> 2.99.0"
|
||||||
|
s.add_development_dependency "capybara", "~> 2.4.1"
|
||||||
|
s.add_development_dependency "factory_girl", "~> 4.4.0"
|
||||||
|
s.add_development_dependency "activerecord-nulldb-adapter", "~> 0.3.1"
|
||||||
|
s.add_development_dependency "sqlite3"
|
||||||
|
|
||||||
|
s.add_dependency "devise", ">= 2.2.8", "< 5"
|
||||||
|
s.add_dependency "grape", "> 0.7"
|
||||||
|
s.add_dependency "rails", "> 3.2", "< 6"
|
||||||
|
end
|
9
gems/grape_devise/lib/grape_devise.rb
Normal file
9
gems/grape_devise/lib/grape_devise.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module GrapeDevise
|
||||||
|
end
|
||||||
|
|
||||||
|
require "devise"
|
||||||
|
require "grape"
|
||||||
|
require "grape_devise/api"
|
||||||
|
|
||||||
|
Devise.helpers << GrapeDevise::API
|
||||||
|
Grape::Endpoint.send :include, GrapeDevise::API
|
37
gems/grape_devise/lib/grape_devise/api.rb
Normal file
37
gems/grape_devise/lib/grape_devise/api.rb
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
require 'devise'
|
||||||
|
|
||||||
|
module GrapeDevise::API
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
include Devise::Controllers::SignInOut
|
||||||
|
|
||||||
|
def self.define_helpers mapping
|
||||||
|
mapping = mapping.name.to_s
|
||||||
|
|
||||||
|
class_eval <<-METHODS, __FILE__, __LINE__ + 1
|
||||||
|
def warden
|
||||||
|
env["warden"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def authenticate_#{mapping}!(opts={})
|
||||||
|
opts[:scope] = :#{mapping}
|
||||||
|
env["devise.allow_params_authentication"] = true
|
||||||
|
if opts.delete(:force) || current_#{mapping}.nil?
|
||||||
|
error!("401 Forbidden", 401) unless warden.authenticate(opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def #{mapping}_signed_in?
|
||||||
|
!!current_#{mapping}
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_#{mapping}
|
||||||
|
@current_#{mapping} ||= warden.authenticate(scope: :#{mapping})
|
||||||
|
end
|
||||||
|
|
||||||
|
def #{mapping}_session
|
||||||
|
current_#{mapping} && warden.session(:#{mapping})
|
||||||
|
end
|
||||||
|
METHODS
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
3
gems/grape_devise/lib/grape_devise/version.rb
Normal file
3
gems/grape_devise/lib/grape_devise/version.rb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
module GrapeDevise
|
||||||
|
VERSION = "0.1.1"
|
||||||
|
end
|
28
gems/grape_devise/spec/dummy/README.rdoc
Normal file
28
gems/grape_devise/spec/dummy/README.rdoc
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
== README
|
||||||
|
|
||||||
|
This README would normally document whatever steps are necessary to get the
|
||||||
|
application up and running.
|
||||||
|
|
||||||
|
Things you may want to cover:
|
||||||
|
|
||||||
|
* Ruby version
|
||||||
|
|
||||||
|
* System dependencies
|
||||||
|
|
||||||
|
* Configuration
|
||||||
|
|
||||||
|
* Database creation
|
||||||
|
|
||||||
|
* Database initialization
|
||||||
|
|
||||||
|
* How to run the test suite
|
||||||
|
|
||||||
|
* Services (job queues, cache servers, search engines, etc.)
|
||||||
|
|
||||||
|
* Deployment instructions
|
||||||
|
|
||||||
|
* ...
|
||||||
|
|
||||||
|
|
||||||
|
Please feel free to use a different markup language if you do not plan to run
|
||||||
|
<tt>rake doc:app</tt>.
|
9
gems/grape_devise/spec/dummy/Rakefile
Normal file
9
gems/grape_devise/spec/dummy/Rakefile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
|
require File.expand_path('../config/application', __FILE__)
|
||||||
|
|
||||||
|
require 'rspec/core/rake_task'
|
||||||
|
RSpec::Core::RakeTask.new(:spec)
|
||||||
|
|
||||||
|
Dummy::Application.load_tasks
|
18
gems/grape_devise/spec/dummy/app/api/api.rb
Normal file
18
gems/grape_devise/spec/dummy/app/api/api.rb
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
require "grape_devise"
|
||||||
|
|
||||||
|
class API < Grape::API
|
||||||
|
format :json
|
||||||
|
|
||||||
|
get "me" do
|
||||||
|
authenticate_user!
|
||||||
|
current_user
|
||||||
|
end
|
||||||
|
|
||||||
|
get "authorized" do
|
||||||
|
user_signed_in?
|
||||||
|
end
|
||||||
|
|
||||||
|
post "signin" do
|
||||||
|
authenticate_user!
|
||||||
|
end
|
||||||
|
end
|
0
gems/grape_devise/spec/dummy/app/assets/images/.keep
Normal file
0
gems/grape_devise/spec/dummy/app/assets/images/.keep
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
||||||
|
// listed below.
|
||||||
|
//
|
||||||
|
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
||||||
|
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
||||||
|
//
|
||||||
|
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||||
|
// compiled file.
|
||||||
|
//
|
||||||
|
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
||||||
|
// about supported directives.
|
||||||
|
//
|
||||||
|
//= require_tree .
|
|
@ -0,0 +1,13 @@
|
||||||
|
/*
|
||||||
|
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||||
|
* listed below.
|
||||||
|
*
|
||||||
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||||
|
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
||||||
|
*
|
||||||
|
* 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_tree .
|
||||||
|
*/
|
|
@ -0,0 +1,5 @@
|
||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
# Prevent CSRF attacks by raising an exception.
|
||||||
|
# For APIs, you may want to use :null_session instead.
|
||||||
|
protect_from_forgery with: :exception
|
||||||
|
end
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ApplicationHelper
|
||||||
|
end
|
0
gems/grape_devise/spec/dummy/app/mailers/.keep
Normal file
0
gems/grape_devise/spec/dummy/app/mailers/.keep
Normal file
0
gems/grape_devise/spec/dummy/app/models/.keep
Normal file
0
gems/grape_devise/spec/dummy/app/models/.keep
Normal file
0
gems/grape_devise/spec/dummy/app/models/concerns/.keep
Normal file
0
gems/grape_devise/spec/dummy/app/models/concerns/.keep
Normal file
5
gems/grape_devise/spec/dummy/app/models/user.rb
Normal file
5
gems/grape_devise/spec/dummy/app/models/user.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
class User < ActiveRecord::Base
|
||||||
|
# Include default devise modules. Others available are:
|
||||||
|
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||||
|
devise :database_authenticatable
|
||||||
|
end
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Dummy</title>
|
||||||
|
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
||||||
|
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
3
gems/grape_devise/spec/dummy/bin/bundle
Executable file
3
gems/grape_devise/spec/dummy/bin/bundle
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||||
|
load Gem.bin_path('bundler', 'bundle')
|
4
gems/grape_devise/spec/dummy/bin/rails
Executable file
4
gems/grape_devise/spec/dummy/bin/rails
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||||
|
require_relative '../config/boot'
|
||||||
|
require 'rails/commands'
|
4
gems/grape_devise/spec/dummy/bin/rake
Executable file
4
gems/grape_devise/spec/dummy/bin/rake
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require_relative '../config/boot'
|
||||||
|
require 'rake'
|
||||||
|
Rake.application.run
|
4
gems/grape_devise/spec/dummy/config.ru
Normal file
4
gems/grape_devise/spec/dummy/config.ru
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# This file is used by Rack-based servers to start the application.
|
||||||
|
|
||||||
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
|
run Rails.application
|
14
gems/grape_devise/spec/dummy/config/application.rb
Normal file
14
gems/grape_devise/spec/dummy/config/application.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
require File.expand_path('../boot', __FILE__)
|
||||||
|
|
||||||
|
require 'rails/all'
|
||||||
|
#require '../..app/models/user'
|
||||||
|
|
||||||
|
Bundler.require(*Rails.groups)
|
||||||
|
|
||||||
|
module Dummy
|
||||||
|
class Application < Rails::Application
|
||||||
|
config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
|
||||||
|
config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
5
gems/grape_devise/spec/dummy/config/boot.rb
Normal file
5
gems/grape_devise/spec/dummy/config/boot.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Set up gems listed in the Gemfile.
|
||||||
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
||||||
|
|
||||||
|
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
||||||
|
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
25
gems/grape_devise/spec/dummy/config/database.yml
Normal file
25
gems/grape_devise/spec/dummy/config/database.yml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# SQLite version 3.x
|
||||||
|
# gem install sqlite3
|
||||||
|
#
|
||||||
|
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||||
|
# gem 'sqlite3'
|
||||||
|
development:
|
||||||
|
adapter: sqlite3
|
||||||
|
database: db/development.sqlite3
|
||||||
|
pool: 5
|
||||||
|
timeout: 5000
|
||||||
|
|
||||||
|
# Warning: The database defined as "test" will be erased and
|
||||||
|
# re-generated from your development database when you run "rake".
|
||||||
|
# Do not set this db to the same as development or production.
|
||||||
|
test:
|
||||||
|
adapter: nulldb
|
||||||
|
database: db/test.sqlite3
|
||||||
|
pool: 5
|
||||||
|
timeout: 5000
|
||||||
|
|
||||||
|
production:
|
||||||
|
adapter: sqlite3
|
||||||
|
database: db/production.sqlite3
|
||||||
|
pool: 5
|
||||||
|
timeout: 5000
|
5
gems/grape_devise/spec/dummy/config/environment.rb
Normal file
5
gems/grape_devise/spec/dummy/config/environment.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Load the Rails application.
|
||||||
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
|
# Initialize the Rails application.
|
||||||
|
Dummy::Application.initialize!
|
|
@ -0,0 +1,29 @@
|
||||||
|
Dummy::Application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
|
# In the development environment your application's code is reloaded on
|
||||||
|
# every request. This slows down response time but is perfect for development
|
||||||
|
# since you don't have to restart the web server when you make code changes.
|
||||||
|
config.cache_classes = false
|
||||||
|
|
||||||
|
# Do not eager load code on boot.
|
||||||
|
config.eager_load = false
|
||||||
|
|
||||||
|
# Show full error reports and disable caching.
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Don't care if the mailer can't send.
|
||||||
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Print deprecation notices to the Rails logger.
|
||||||
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
# Raise an error on page load if there are pending migrations
|
||||||
|
config.active_record.migration_error = :page_load
|
||||||
|
|
||||||
|
# Debug mode disables concatenation and preprocessing of assets.
|
||||||
|
# This option may cause significant delays in view rendering with a large
|
||||||
|
# number of complex assets.
|
||||||
|
config.assets.debug = true
|
||||||
|
end
|
|
@ -0,0 +1,80 @@
|
||||||
|
Dummy::Application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
|
# Code is not reloaded between requests.
|
||||||
|
config.cache_classes = true
|
||||||
|
|
||||||
|
# Eager load code on boot. This eager loads most of Rails and
|
||||||
|
# your application in memory, allowing both thread web servers
|
||||||
|
# and those relying on copy on write to perform better.
|
||||||
|
# Rake tasks automatically ignore this option for performance.
|
||||||
|
config.eager_load = true
|
||||||
|
|
||||||
|
# Full error reports are disabled and caching is turned on.
|
||||||
|
config.consider_all_requests_local = false
|
||||||
|
config.action_controller.perform_caching = true
|
||||||
|
|
||||||
|
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
||||||
|
# Add `rack-cache` to your Gemfile before enabling this.
|
||||||
|
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
||||||
|
# config.action_dispatch.rack_cache = true
|
||||||
|
|
||||||
|
# Disable Rails's static asset server (Apache or nginx will already do this).
|
||||||
|
config.serve_static_assets = false
|
||||||
|
|
||||||
|
# Compress JavaScripts and CSS.
|
||||||
|
config.assets.js_compressor = :uglifier
|
||||||
|
# config.assets.css_compressor = :sass
|
||||||
|
|
||||||
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
||||||
|
config.assets.compile = false
|
||||||
|
|
||||||
|
# Generate digests for assets URLs.
|
||||||
|
config.assets.digest = true
|
||||||
|
|
||||||
|
# Version of your assets, change this if you want to expire all your assets.
|
||||||
|
config.assets.version = '1.0'
|
||||||
|
|
||||||
|
# Specifies the header that your server uses for sending files.
|
||||||
|
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||||
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||||
|
|
||||||
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
||||||
|
# config.force_ssl = true
|
||||||
|
|
||||||
|
# Set to :debug to see everything in the log.
|
||||||
|
config.log_level = :info
|
||||||
|
|
||||||
|
# Prepend all log lines with the following tags.
|
||||||
|
# config.log_tags = [ :subdomain, :uuid ]
|
||||||
|
|
||||||
|
# Use a different logger for distributed setups.
|
||||||
|
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
||||||
|
|
||||||
|
# Use a different cache store in production.
|
||||||
|
# config.cache_store = :mem_cache_store
|
||||||
|
|
||||||
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
||||||
|
# config.action_controller.asset_host = "http://assets.example.com"
|
||||||
|
|
||||||
|
# Precompile additional assets.
|
||||||
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||||
|
# config.assets.precompile += %w( search.js )
|
||||||
|
|
||||||
|
# Ignore bad email addresses and do not raise email delivery errors.
|
||||||
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||||
|
# config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||||
|
# the I18n.default_locale when a translation can not be found).
|
||||||
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
|
# Send deprecation notices to registered listeners.
|
||||||
|
config.active_support.deprecation = :notify
|
||||||
|
|
||||||
|
# Disable automatic flushing of the log to improve performance.
|
||||||
|
# config.autoflush_log = false
|
||||||
|
|
||||||
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||||
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
|
end
|
36
gems/grape_devise/spec/dummy/config/environments/test.rb
Normal file
36
gems/grape_devise/spec/dummy/config/environments/test.rb
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
Dummy::Application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
|
# The test environment is used exclusively to run your application's
|
||||||
|
# test suite. You never need to work with it otherwise. Remember that
|
||||||
|
# your test database is "scratch space" for the test suite and is wiped
|
||||||
|
# and recreated between test runs. Don't rely on the data there!
|
||||||
|
config.cache_classes = true
|
||||||
|
|
||||||
|
# Do not eager load code on boot. This avoids loading your whole application
|
||||||
|
# just for the purpose of running a single test. If you are using a tool that
|
||||||
|
# preloads Rails for running tests, you may have to set it to true.
|
||||||
|
config.eager_load = false
|
||||||
|
|
||||||
|
# Configure static asset server for tests with Cache-Control for performance.
|
||||||
|
config.serve_static_assets = true
|
||||||
|
config.static_cache_control = "public, max-age=3600"
|
||||||
|
|
||||||
|
# Show full error reports and disable caching.
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Raise exceptions instead of rendering exception templates.
|
||||||
|
config.action_dispatch.show_exceptions = false
|
||||||
|
|
||||||
|
# Disable request forgery protection in test environment.
|
||||||
|
config.action_controller.allow_forgery_protection = false
|
||||||
|
|
||||||
|
# Tell Action Mailer not to deliver emails to the real world.
|
||||||
|
# The :test delivery method accumulates sent emails in the
|
||||||
|
# ActionMailer::Base.deliveries array.
|
||||||
|
config.action_mailer.delivery_method = :spec
|
||||||
|
|
||||||
|
# Print deprecation notices to the stderr.
|
||||||
|
config.active_support.deprecation = :stderr
|
||||||
|
end
|
|
@ -0,0 +1,7 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
||||||
|
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
||||||
|
|
||||||
|
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
||||||
|
# Rails.backtrace_cleaner.remove_silencers!
|
260
gems/grape_devise/spec/dummy/config/initializers/devise.rb
Normal file
260
gems/grape_devise/spec/dummy/config/initializers/devise.rb
Normal file
|
@ -0,0 +1,260 @@
|
||||||
|
require 'devise'
|
||||||
|
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||||
|
# Many of these configuration options can be set straight in your model.
|
||||||
|
Devise.setup do |config|
|
||||||
|
# The secret key used by Devise. Devise uses this key to generate
|
||||||
|
# random tokens. Changing this key will render invalid all existing
|
||||||
|
# confirmation, reset password and unlock tokens in the database.
|
||||||
|
config.secret_key = 'd5ee28e76818649f112d6f0fc8b20f9aa72e2bd83273f28b14b48ef8804f8e9cafa8ca4c9e4811a563bf4782b7908461189b6b45e9d85a97092453221a25ac3a'
|
||||||
|
|
||||||
|
# ==> Mailer Configuration
|
||||||
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||||
|
# note that it will be overwritten if you use your own mailer class
|
||||||
|
# with default "from" parameter.
|
||||||
|
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
||||||
|
|
||||||
|
# Configure the class responsible to send e-mails.
|
||||||
|
# config.mailer = 'Devise::Mailer'
|
||||||
|
|
||||||
|
# ==> ORM configuration
|
||||||
|
# Load and configure the ORM. Supports :active_record (default) and
|
||||||
|
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
||||||
|
# available as additional gems.
|
||||||
|
require 'devise/orm/active_record'
|
||||||
|
|
||||||
|
# ==> Configuration for any authentication mechanism
|
||||||
|
# Configure which keys are used when authenticating a user. The default is
|
||||||
|
# just :email. You can configure it to use [:username, :subdomain], so for
|
||||||
|
# authenticating a user, both parameters are required. Remember that those
|
||||||
|
# parameters are used only when authenticating and not when retrieving from
|
||||||
|
# session. If you need permissions, you should implement that in a before filter.
|
||||||
|
# You can also supply a hash where the value is a boolean determining whether
|
||||||
|
# or not authentication should be aborted when the value is not present.
|
||||||
|
# config.authentication_keys = [ :email ]
|
||||||
|
|
||||||
|
# Configure parameters from the request object used for authentication. Each entry
|
||||||
|
# given should be a request method and it will automatically be passed to the
|
||||||
|
# find_for_authentication method and considered in your model lookup. For instance,
|
||||||
|
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
||||||
|
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
||||||
|
# config.request_keys = []
|
||||||
|
|
||||||
|
# Configure which authentication keys should be case-insensitive.
|
||||||
|
# These keys will be downcased upon creating or modifying a user and when used
|
||||||
|
# to authenticate or find a user. Default is :email.
|
||||||
|
config.case_insensitive_keys = [ :email ]
|
||||||
|
|
||||||
|
# Configure which authentication keys should have whitespace stripped.
|
||||||
|
# These keys will have whitespace before and after removed upon creating or
|
||||||
|
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||||
|
config.strip_whitespace_keys = [ :email ]
|
||||||
|
|
||||||
|
# Tell if authentication through request.params is enabled. True by default.
|
||||||
|
# It can be set to an array that will enable params authentication only for the
|
||||||
|
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
||||||
|
# enable it only for database (email + password) authentication.
|
||||||
|
# config.params_authenticatable = true
|
||||||
|
|
||||||
|
# Tell if authentication through HTTP Auth is enabled. False by default.
|
||||||
|
# It can be set to an array that will enable http authentication only for the
|
||||||
|
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
||||||
|
# enable it only for database authentication. The supported strategies are:
|
||||||
|
# :database = Support basic authentication with authentication key + password
|
||||||
|
# config.http_authenticatable = false
|
||||||
|
|
||||||
|
# If http headers should be returned for AJAX requests. True by default.
|
||||||
|
# config.http_authenticatable_on_xhr = true
|
||||||
|
|
||||||
|
# The realm used in Http Basic Authentication. 'Application' by default.
|
||||||
|
# config.http_authentication_realm = 'Application'
|
||||||
|
|
||||||
|
# It will change confirmation, password recovery and other workflows
|
||||||
|
# to behave the same regardless if the e-mail provided was right or wrong.
|
||||||
|
# Does not affect registerable.
|
||||||
|
# config.paranoid = true
|
||||||
|
|
||||||
|
# By default Devise will store the user in session. You can skip storage for
|
||||||
|
# particular strategies by setting this option.
|
||||||
|
# Notice that if you are skipping storage for all authentication paths, you
|
||||||
|
# may want to disable generating routes to Devise's sessions controller by
|
||||||
|
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
||||||
|
config.skip_session_storage = [:http_auth]
|
||||||
|
|
||||||
|
# By default, Devise cleans up the CSRF token on authentication to
|
||||||
|
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
||||||
|
# requests for sign in and sign up, you need to get a new CSRF token
|
||||||
|
# from the server. You can disable this option at your own risk.
|
||||||
|
# config.clean_up_csrf_token_on_authentication = true
|
||||||
|
|
||||||
|
# ==> Configuration for :database_authenticatable
|
||||||
|
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
||||||
|
# using other encryptors, it sets how many times you want the password re-encrypted.
|
||||||
|
#
|
||||||
|
# Limiting the stretches to just one in testing will increase the performance of
|
||||||
|
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
||||||
|
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
||||||
|
# encryptor), the cost increases exponentially with the number of stretches (e.g.
|
||||||
|
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
||||||
|
config.stretches = Rails.env.test? ? 1 : 10
|
||||||
|
|
||||||
|
# Setup a pepper to generate the encrypted password.
|
||||||
|
# config.pepper = '5a21421a82d405edec88445a0b72552d60fca3c2b8c2e8f98356f84638a729c94081c43abb9f5b4a1391ce7a15f4cc4b3d919f19a0fc478e766245372a14df00'
|
||||||
|
|
||||||
|
# ==> Configuration for :confirmable
|
||||||
|
# A period that the user is allowed to access the website even without
|
||||||
|
# confirming their account. For instance, if set to 2.days, the user will be
|
||||||
|
# able to access the website for two days without confirming their account,
|
||||||
|
# access will be blocked just in the third day. Default is 0.days, meaning
|
||||||
|
# the user cannot access the website without confirming their account.
|
||||||
|
# config.allow_unconfirmed_access_for = 2.days
|
||||||
|
|
||||||
|
# A period that the user is allowed to confirm their account before their
|
||||||
|
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
||||||
|
# their account within 3 days after the mail was sent, but on the fourth day
|
||||||
|
# their account can't be confirmed with the token any more.
|
||||||
|
# Default is nil, meaning there is no restriction on how long a user can take
|
||||||
|
# before confirming their account.
|
||||||
|
# config.confirm_within = 3.days
|
||||||
|
|
||||||
|
# If true, requires any email changes to be confirmed (exactly the same way as
|
||||||
|
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||||
|
# db field (see migrations). Until confirmed, new email is stored in
|
||||||
|
# unconfirmed_email column, and copied to email column on successful confirmation.
|
||||||
|
config.reconfirmable = true
|
||||||
|
|
||||||
|
# Defines which key will be used when confirming an account
|
||||||
|
# config.confirmation_keys = [ :email ]
|
||||||
|
|
||||||
|
# ==> Configuration for :rememberable
|
||||||
|
# The time the user will be remembered without asking for credentials again.
|
||||||
|
# config.remember_for = 2.weeks
|
||||||
|
|
||||||
|
# Invalidates all the remember me tokens when the user signs out.
|
||||||
|
config.expire_all_remember_me_on_sign_out = true
|
||||||
|
|
||||||
|
# If true, extends the user's remember period when remembered via cookie.
|
||||||
|
# config.extend_remember_period = false
|
||||||
|
|
||||||
|
# Options to be passed to the created cookie. For instance, you can set
|
||||||
|
# secure: true in order to force SSL only cookies.
|
||||||
|
# config.rememberable_options = {}
|
||||||
|
|
||||||
|
# ==> Configuration for :validatable
|
||||||
|
# Range for password length.
|
||||||
|
config.password_length = 8..128
|
||||||
|
|
||||||
|
# Email regex used to validate email formats. It simply asserts that
|
||||||
|
# one (and only one) @ exists in the given string. This is mainly
|
||||||
|
# to give user feedback and not to assert the e-mail validity.
|
||||||
|
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
||||||
|
|
||||||
|
# ==> Configuration for :timeoutable
|
||||||
|
# The time you want to timeout the user session without activity. After this
|
||||||
|
# time the user will be asked for credentials again. Default is 30 minutes.
|
||||||
|
# config.timeout_in = 30.minutes
|
||||||
|
|
||||||
|
# If true, expires auth token on session timeout.
|
||||||
|
# config.expire_auth_token_on_timeout = false
|
||||||
|
|
||||||
|
# ==> Configuration for :lockable
|
||||||
|
# Defines which strategy will be used to lock an account.
|
||||||
|
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
||||||
|
# :none = No lock strategy. You should handle locking by yourself.
|
||||||
|
# config.lock_strategy = :failed_attempts
|
||||||
|
|
||||||
|
# Defines which key will be used when locking and unlocking an account
|
||||||
|
# config.unlock_keys = [ :email ]
|
||||||
|
|
||||||
|
# Defines which strategy will be used to unlock an account.
|
||||||
|
# :email = Sends an unlock link to the user email
|
||||||
|
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
||||||
|
# :both = Enables both strategies
|
||||||
|
# :none = No unlock strategy. You should handle unlocking by yourself.
|
||||||
|
# config.unlock_strategy = :both
|
||||||
|
|
||||||
|
# Number of authentication tries before locking an account if lock_strategy
|
||||||
|
# is failed attempts.
|
||||||
|
# config.maximum_attempts = 20
|
||||||
|
|
||||||
|
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
||||||
|
# config.unlock_in = 1.hour
|
||||||
|
|
||||||
|
# Warn on the last attempt before the account is locked.
|
||||||
|
# config.last_attempt_warning = false
|
||||||
|
|
||||||
|
# ==> Configuration for :recoverable
|
||||||
|
#
|
||||||
|
# Defines which key will be used when recovering the password for an account
|
||||||
|
# config.reset_password_keys = [ :email ]
|
||||||
|
|
||||||
|
# Time interval you can reset your password with a reset password key.
|
||||||
|
# Don't put a too small interval or your users won't have the time to
|
||||||
|
# change their passwords.
|
||||||
|
config.reset_password_within = 6.hours
|
||||||
|
|
||||||
|
# ==> Configuration for :encryptable
|
||||||
|
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
||||||
|
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
||||||
|
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
||||||
|
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
||||||
|
# REST_AUTH_SITE_KEY to pepper).
|
||||||
|
#
|
||||||
|
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
||||||
|
# config.encryptor = :sha512
|
||||||
|
|
||||||
|
# ==> Scopes configuration
|
||||||
|
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
||||||
|
# "users/sessions/new". It's turned off by default because it's slower if you
|
||||||
|
# are using only default views.
|
||||||
|
# config.scoped_views = false
|
||||||
|
|
||||||
|
# Configure the default scope given to Warden. By default it's the first
|
||||||
|
# devise role declared in your routes (usually :user).
|
||||||
|
# config.default_scope = :user
|
||||||
|
|
||||||
|
# Set this configuration to false if you want /users/sign_out to sign out
|
||||||
|
# only the current scope. By default, Devise signs out all scopes.
|
||||||
|
# config.sign_out_all_scopes = true
|
||||||
|
|
||||||
|
# ==> Navigation configuration
|
||||||
|
# Lists the formats that should be treated as navigational. Formats like
|
||||||
|
# :html, should redirect to the sign in page when the user does not have
|
||||||
|
# access, but formats like :xml or :json, should return 401.
|
||||||
|
#
|
||||||
|
# If you have any extra navigational formats, like :iphone or :mobile, you
|
||||||
|
# should add them to the navigational formats lists.
|
||||||
|
#
|
||||||
|
# The "*/*" below is required to match Internet Explorer requests.
|
||||||
|
# config.navigational_formats = ['*/*', :html]
|
||||||
|
|
||||||
|
# The default HTTP method used to sign out a resource. Default is :delete.
|
||||||
|
config.sign_out_via = :delete
|
||||||
|
|
||||||
|
# ==> OmniAuth
|
||||||
|
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
||||||
|
# up on your models and hooks.
|
||||||
|
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
||||||
|
|
||||||
|
# ==> Warden configuration
|
||||||
|
# If you want to use other strategies, that are not supported by Devise, or
|
||||||
|
# change the failure app, you can configure them inside the config.warden block.
|
||||||
|
#
|
||||||
|
# config.warden do |manager|
|
||||||
|
# manager.intercept_401 = false
|
||||||
|
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
||||||
|
# end
|
||||||
|
|
||||||
|
# ==> Mountable engine configurations
|
||||||
|
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
||||||
|
# is mountable, there are some extra configurations to be taken into account.
|
||||||
|
# The following options are available, assuming the engine is mounted as:
|
||||||
|
#
|
||||||
|
# mount MyEngine, at: '/my_engine'
|
||||||
|
#
|
||||||
|
# The router that invoked `devise_for`, in the example above, would be:
|
||||||
|
# config.router_name = :my_engine
|
||||||
|
#
|
||||||
|
# When using omniauth, Devise cannot automatically set Omniauth path,
|
||||||
|
# so you need to do it manually. For the users scope, it would be:
|
||||||
|
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Configure sensitive parameters which will be filtered from the log file.
|
||||||
|
Rails.application.config.filter_parameters += [:password]
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new inflection rules using the following format. Inflections
|
||||||
|
# are locale specific, and you may define rules for as many different
|
||||||
|
# locales as you wish. All of these examples are active by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
# inflect.plural /^(ox)$/i, '\1en'
|
||||||
|
# inflect.singular /^(ox)en/i, '\1'
|
||||||
|
# inflect.irregular 'person', 'people'
|
||||||
|
# inflect.uncountable %w( fish sheep )
|
||||||
|
# end
|
||||||
|
|
||||||
|
# These inflection rules are supported but not enabled by default:
|
||||||
|
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
# inflect.acronym 'RESTful'
|
||||||
|
# end
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Add new mime types for use in respond_to blocks:
|
||||||
|
# Mime::Type.register "text/richtext", :rtf
|
||||||
|
# Mime::Type.register_alias "text/html", :iphone
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Your secret key is used for verifying the integrity of signed cookies.
|
||||||
|
# If you change this key, all old signed cookies will become invalid!
|
||||||
|
|
||||||
|
# Make sure the secret is at least 30 characters and all random,
|
||||||
|
# no regular words or you'll be exposed to dictionary attacks.
|
||||||
|
# You can use `rake secret` to generate a secure secret key.
|
||||||
|
|
||||||
|
# Make sure your secret_key_base is kept private
|
||||||
|
# if you're sharing your code publicly.
|
||||||
|
Dummy::Application.config.secret_key_base = 'ec3f72391ec6c746cd3ab309163423262b262963beedd29a521f7651da3fafcc13ce7635758c118402d5cdcf006fc7142a46484c6384ba6b45cecd86f318eddc'
|
||||||
|
Dummy::Application.config.secret_key = '792518f023a032d868890eba6d50deb422e5afbe4affd3e9ee32943c5948b13ee54b9292875694cd7e8232663ffb0d0731278e9ae189a21acbb99d8263e4a819'
|
|
@ -0,0 +1,3 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# This file contains settings for ActionController::ParamsWrapper which
|
||||||
|
# is enabled by default.
|
||||||
|
|
||||||
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
||||||
|
ActiveSupport.on_load(:action_controller) do
|
||||||
|
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
||||||
|
end
|
||||||
|
|
||||||
|
# To enable root element in JSON for ActiveRecord objects.
|
||||||
|
# ActiveSupport.on_load(:active_record) do
|
||||||
|
# self.include_root_in_json = true
|
||||||
|
# end
|
60
gems/grape_devise/spec/dummy/config/locales/devise.en.yml
Normal file
60
gems/grape_devise/spec/dummy/config/locales/devise.en.yml
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
|
||||||
|
|
||||||
|
en:
|
||||||
|
devise:
|
||||||
|
confirmations:
|
||||||
|
confirmed: "Your email address has been successfully confirmed."
|
||||||
|
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||||
|
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||||
|
failure:
|
||||||
|
already_authenticated: "You are already signed in."
|
||||||
|
inactive: "Your account is not activated yet."
|
||||||
|
invalid: "Invalid email or password."
|
||||||
|
locked: "Your account is locked."
|
||||||
|
last_attempt: "You have one more attempt before your account is locked."
|
||||||
|
not_found_in_database: "Invalid email address or password."
|
||||||
|
timeout: "Your session expired. Please sign in again to continue."
|
||||||
|
unauthenticated: "You need to sign in or sign up before continuing."
|
||||||
|
unconfirmed: "You have to confirm your email address before continuing."
|
||||||
|
mailer:
|
||||||
|
confirmation_instructions:
|
||||||
|
subject: "Confirmation instructions"
|
||||||
|
reset_password_instructions:
|
||||||
|
subject: "Reset password instructions"
|
||||||
|
unlock_instructions:
|
||||||
|
subject: "Unlock instructions"
|
||||||
|
omniauth_callbacks:
|
||||||
|
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
||||||
|
success: "Successfully authenticated from %{kind} account."
|
||||||
|
passwords:
|
||||||
|
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
||||||
|
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
||||||
|
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||||
|
updated: "Your password has been changed successfully. You are now signed in."
|
||||||
|
updated_not_active: "Your password has been changed successfully."
|
||||||
|
registrations:
|
||||||
|
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
|
||||||
|
signed_up: "Welcome! You have signed up successfully."
|
||||||
|
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
||||||
|
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
||||||
|
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
||||||
|
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
|
||||||
|
updated: "Your account has been updated successfully."
|
||||||
|
sessions:
|
||||||
|
signed_in: "Signed in successfully."
|
||||||
|
signed_out: "Signed out successfully."
|
||||||
|
already_signed_out: "Signed out successfully."
|
||||||
|
unlocks:
|
||||||
|
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
|
||||||
|
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
||||||
|
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
||||||
|
errors:
|
||||||
|
messages:
|
||||||
|
already_confirmed: "was already confirmed, please try signing in"
|
||||||
|
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
||||||
|
expired: "has expired, please request a new one"
|
||||||
|
not_found: "not found"
|
||||||
|
not_locked: "was not locked"
|
||||||
|
not_saved:
|
||||||
|
one: "1 error prohibited this %{resource} from being saved:"
|
||||||
|
other: "%{count} errors prohibited this %{resource} from being saved:"
|
23
gems/grape_devise/spec/dummy/config/locales/en.yml
Normal file
23
gems/grape_devise/spec/dummy/config/locales/en.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# Files in the config/locales directory are used for internationalization
|
||||||
|
# and are automatically loaded by Rails. If you want to use locales other
|
||||||
|
# than English, add the necessary files in this directory.
|
||||||
|
#
|
||||||
|
# To use the locales, use `I18n.t`:
|
||||||
|
#
|
||||||
|
# I18n.t 'hello'
|
||||||
|
#
|
||||||
|
# In views, this is aliased to just `t`:
|
||||||
|
#
|
||||||
|
# <%= t('hello') %>
|
||||||
|
#
|
||||||
|
# To use a different locale, set it with `I18n.locale`:
|
||||||
|
#
|
||||||
|
# I18n.locale = :es
|
||||||
|
#
|
||||||
|
# This would use the information in config/locales/es.yml.
|
||||||
|
#
|
||||||
|
# To learn more, please read the Rails Internationalization guide
|
||||||
|
# available at http://guides.rubyonrails.org/i18n.html.
|
||||||
|
|
||||||
|
en:
|
||||||
|
hello: "Hello world"
|
7
gems/grape_devise/spec/dummy/config/routes.rb
Normal file
7
gems/grape_devise/spec/dummy/config/routes.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
require "devise"
|
||||||
|
|
||||||
|
Dummy::Application.routes.draw do
|
||||||
|
|
||||||
|
devise_for :users
|
||||||
|
mount API => '/'
|
||||||
|
end
|
|
@ -0,0 +1,42 @@
|
||||||
|
class DeviseCreateUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table(:users) do |t|
|
||||||
|
## Database authenticatable
|
||||||
|
t.string :email, null: false, default: ""
|
||||||
|
t.string :encrypted_password, null: false, default: ""
|
||||||
|
|
||||||
|
## Recoverable
|
||||||
|
t.string :reset_password_token
|
||||||
|
t.datetime :reset_password_sent_at
|
||||||
|
|
||||||
|
## Rememberable
|
||||||
|
t.datetime :remember_created_at
|
||||||
|
|
||||||
|
## Trackable
|
||||||
|
t.integer :sign_in_count, default: 0, null: false
|
||||||
|
t.datetime :current_sign_in_at
|
||||||
|
t.datetime :last_sign_in_at
|
||||||
|
t.string :current_sign_in_ip
|
||||||
|
t.string :last_sign_in_ip
|
||||||
|
|
||||||
|
## Confirmable
|
||||||
|
# t.string :confirmation_token
|
||||||
|
# t.datetime :confirmed_at
|
||||||
|
# t.datetime :confirmation_sent_at
|
||||||
|
# t.string :unconfirmed_email # Only if using reconfirmable
|
||||||
|
|
||||||
|
## Lockable
|
||||||
|
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
||||||
|
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
||||||
|
# t.datetime :locked_at
|
||||||
|
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :users, :email, unique: true
|
||||||
|
add_index :users, :reset_password_token, unique: true
|
||||||
|
# add_index :users, :confirmation_token, unique: true
|
||||||
|
# add_index :users, :unlock_token, unique: true
|
||||||
|
end
|
||||||
|
end
|
34
gems/grape_devise/spec/dummy/db/schema.rb
Normal file
34
gems/grape_devise/spec/dummy/db/schema.rb
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# encoding: UTF-8
|
||||||
|
# This file is auto-generated from the current state of the database. Instead
|
||||||
|
# of editing this file, please use the migrations feature of Active Record to
|
||||||
|
# incrementally modify your database, and then regenerate this schema definition.
|
||||||
|
#
|
||||||
|
# Note that this schema.rb definition is the authoritative source for your
|
||||||
|
# database schema. If you need to create the application database on another
|
||||||
|
# system, you should be using db:schema:load, not running all the migrations
|
||||||
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||||
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||||
|
#
|
||||||
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
|
ActiveRecord::Schema.define(version: 20140913043018) do
|
||||||
|
|
||||||
|
create_table "users", force: true do |t|
|
||||||
|
t.string "email", default: "", null: false
|
||||||
|
t.string "encrypted_password", default: "", null: false
|
||||||
|
t.string "reset_password_token"
|
||||||
|
t.datetime "reset_password_sent_at"
|
||||||
|
t.datetime "remember_created_at"
|
||||||
|
t.integer "sign_in_count", default: 0, null: false
|
||||||
|
t.datetime "current_sign_in_at"
|
||||||
|
t.datetime "last_sign_in_at"
|
||||||
|
t.string "current_sign_in_ip"
|
||||||
|
t.string "last_sign_in_ip"
|
||||||
|
t.datetime "created_at"
|
||||||
|
t.datetime "updated_at"
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
||||||
|
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||||
|
|
||||||
|
end
|
0
gems/grape_devise/spec/dummy/lib/assets/.keep
Normal file
0
gems/grape_devise/spec/dummy/lib/assets/.keep
Normal file
58
gems/grape_devise/spec/dummy/public/404.html
Normal file
58
gems/grape_devise/spec/dummy/public/404.html
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>The page you were looking for doesn't exist (404)</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
color: #2E2F30;
|
||||||
|
text-align: center;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog {
|
||||||
|
width: 25em;
|
||||||
|
margin: 4em auto 0 auto;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #BBB;
|
||||||
|
border-top: #B00100 solid 4px;
|
||||||
|
border-top-left-radius: 9px;
|
||||||
|
border-top-right-radius: 9px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 7px 4em 0 4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 100%;
|
||||||
|
color: #730E15;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
body > p {
|
||||||
|
width: 33em;
|
||||||
|
margin: 0 auto 1em;
|
||||||
|
padding: 1em 0;
|
||||||
|
background-color: #F7F7F7;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-top-color: #DADADA;
|
||||||
|
color: #666;
|
||||||
|
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/404.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<h1>The page you were looking for doesn't exist.</h1>
|
||||||
|
<p>You may have mistyped the address or the page may have moved.</p>
|
||||||
|
</div>
|
||||||
|
<p>If you are the application owner check the logs for more information.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
58
gems/grape_devise/spec/dummy/public/422.html
Normal file
58
gems/grape_devise/spec/dummy/public/422.html
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>The change you wanted was rejected (422)</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
color: #2E2F30;
|
||||||
|
text-align: center;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog {
|
||||||
|
width: 25em;
|
||||||
|
margin: 4em auto 0 auto;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #BBB;
|
||||||
|
border-top: #B00100 solid 4px;
|
||||||
|
border-top-left-radius: 9px;
|
||||||
|
border-top-right-radius: 9px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 7px 4em 0 4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 100%;
|
||||||
|
color: #730E15;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
body > p {
|
||||||
|
width: 33em;
|
||||||
|
margin: 0 auto 1em;
|
||||||
|
padding: 1em 0;
|
||||||
|
background-color: #F7F7F7;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-top-color: #DADADA;
|
||||||
|
color: #666;
|
||||||
|
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/422.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<h1>The change you wanted was rejected.</h1>
|
||||||
|
<p>Maybe you tried to change something you didn't have access to.</p>
|
||||||
|
</div>
|
||||||
|
<p>If you are the application owner check the logs for more information.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
57
gems/grape_devise/spec/dummy/public/500.html
Normal file
57
gems/grape_devise/spec/dummy/public/500.html
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>We're sorry, but something went wrong (500)</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #EFEFEF;
|
||||||
|
color: #2E2F30;
|
||||||
|
text-align: center;
|
||||||
|
font-family: arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.dialog {
|
||||||
|
width: 25em;
|
||||||
|
margin: 4em auto 0 auto;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-left-color: #999;
|
||||||
|
border-bottom-color: #BBB;
|
||||||
|
border-top: #B00100 solid 4px;
|
||||||
|
border-top-left-radius: 9px;
|
||||||
|
border-top-right-radius: 9px;
|
||||||
|
background-color: white;
|
||||||
|
padding: 7px 4em 0 4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 100%;
|
||||||
|
color: #730E15;
|
||||||
|
line-height: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
body > p {
|
||||||
|
width: 33em;
|
||||||
|
margin: 0 auto 1em;
|
||||||
|
padding: 1em 0;
|
||||||
|
background-color: #F7F7F7;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-right-color: #999;
|
||||||
|
border-bottom-color: #999;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-top-color: #DADADA;
|
||||||
|
color: #666;
|
||||||
|
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- This file lives in public/500.html -->
|
||||||
|
<div class="dialog">
|
||||||
|
<h1>We're sorry, but something went wrong.</h1>
|
||||||
|
</div>
|
||||||
|
<p>If you are the application owner check the logs for more information.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
0
gems/grape_devise/spec/dummy/public/favicon.ico
Normal file
0
gems/grape_devise/spec/dummy/public/favicon.ico
Normal file
7
gems/grape_devise/spec/factories.rb
Normal file
7
gems/grape_devise/spec/factories.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :user do
|
||||||
|
email "john.doe@example.com"
|
||||||
|
password "12345"
|
||||||
|
password_confirmation "12345"
|
||||||
|
end
|
||||||
|
end
|
52
gems/grape_devise/spec/requests/user_spec.rb
Normal file
52
gems/grape_devise/spec/requests/user_spec.rb
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
require 'warden/test/helpers'
|
||||||
|
|
||||||
|
RSpec.describe API, :type => :request do
|
||||||
|
include Warden::Test::Helpers
|
||||||
|
|
||||||
|
let(:user) { build(:user) }
|
||||||
|
|
||||||
|
after{ Warden.test_reset! }
|
||||||
|
|
||||||
|
it "should return the current user" do
|
||||||
|
login_as user, scope: :user
|
||||||
|
|
||||||
|
get "/me"
|
||||||
|
|
||||||
|
response.body.should eq(user.to_json)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should return an error if not logged in" do
|
||||||
|
login_as nil, scope: :user
|
||||||
|
|
||||||
|
get "/me"
|
||||||
|
|
||||||
|
response.code.should eq("401")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should return true if logged in" do
|
||||||
|
login_as user, scope: :user
|
||||||
|
|
||||||
|
get "/authorized"
|
||||||
|
|
||||||
|
response.body.should eq("true")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should return false if logged out" do
|
||||||
|
login_as nil, scope: :user
|
||||||
|
|
||||||
|
get "/authorized"
|
||||||
|
|
||||||
|
response.body.should eq("false")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should log in the user" do
|
||||||
|
User.stub :find_for_database_authentication do
|
||||||
|
user
|
||||||
|
end
|
||||||
|
post "/signin", { user: { email: user.email, password: user.password } }
|
||||||
|
|
||||||
|
response.code.should eq("201")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
36
gems/grape_devise/spec/spec_helper.rb
Normal file
36
gems/grape_devise/spec/spec_helper.rb
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# Configure Rails Environment
|
||||||
|
ENV["RAILS_ENV"] = "test"
|
||||||
|
|
||||||
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
||||||
|
require 'rspec'
|
||||||
|
require 'rspec/rails'
|
||||||
|
require 'factory_girl'
|
||||||
|
require 'warden'
|
||||||
|
require 'devise'
|
||||||
|
require 'capybara/dsl'
|
||||||
|
require 'factories'
|
||||||
|
require 'nulldb/rails'
|
||||||
|
Warden.test_mode!
|
||||||
|
|
||||||
|
Rails.backtrace_cleaner.remove_silencers!
|
||||||
|
|
||||||
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
|
# in spec/support/ and its subdirectories.
|
||||||
|
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
# == Mock Framework
|
||||||
|
#
|
||||||
|
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||||
|
#
|
||||||
|
# config.mock_with :mocha
|
||||||
|
# config.mock_with :flexmock
|
||||||
|
# config.mock_with :rr
|
||||||
|
config.mock_with :rspec
|
||||||
|
config.use_transactional_fixtures = true
|
||||||
|
config.infer_spec_type_from_file_location!
|
||||||
|
|
||||||
|
config.include Capybara::DSL, type: :request
|
||||||
|
config.include FactoryGirl::Syntax::Methods
|
||||||
|
config.include Devise::TestHelpers, :type => :controller
|
||||||
|
end
|
|
@ -2,37 +2,73 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import AriaModal = require('react-aria-modal');
|
import AriaModal = require('react-aria-modal');
|
||||||
|
import { VelocityTransitionGroup } from 'velocity-react';
|
||||||
|
import 'velocity-animate';
|
||||||
|
import 'velocity-animate/velocity.ui';
|
||||||
|
|
||||||
export interface ModalProps
|
export interface ModalProps {
|
||||||
{
|
|
||||||
onClose?: () => void // if you want your modal to close, this needs to set modalActive to false
|
onClose?: () => void // if you want your modal to close, this needs to set modalActive to false
|
||||||
modalActive?: boolean
|
modalActive?: boolean
|
||||||
titleText?: string
|
titleText?: string
|
||||||
focusDialog?:boolean
|
focusDialog?: boolean
|
||||||
dialogStyle?:any
|
dialogStyle?: any
|
||||||
childGenerator:() => any
|
childGenerator: () => any
|
||||||
}
|
}
|
||||||
|
|
||||||
class Modal extends React.Component<ModalProps, {}> {
|
class Modal extends React.Component<ModalProps, {}> {
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
dialogStyle: {minWidth:'768px'}
|
dialogStyle: { minWidth: '768px' }
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const modal = this.props.modalActive ?
|
|
||||||
<AriaModal mounted={this.props.modalActive} titleText={this.props.titleText} focusDialog={this.props.focusDialog}
|
|
||||||
onExit={this.props.onClose} dialogStyle={this.props.dialogStyle}>
|
|
||||||
<header className='modal-header'>
|
|
||||||
<h4 className='modal-header-title'>{this.props.titleText}</h4>
|
|
||||||
</header>
|
|
||||||
<div className="modal-body">
|
|
||||||
{this.props.childGenerator()}
|
|
||||||
</div>
|
|
||||||
</AriaModal> : false;
|
|
||||||
|
|
||||||
return modal
|
const innerModal = this.props.modalActive ? <AriaModal mounted={this.props.modalActive} titleText={this.props.titleText} focusDialog={this.props.focusDialog}
|
||||||
|
onExit={this.props.onClose} dialogStyle={this.props.dialogStyle}>
|
||||||
|
<header className='modal-header'>
|
||||||
|
<h4 className='modal-header-title'>{this.props.titleText}</h4>
|
||||||
|
</header>
|
||||||
|
<div className="modal-body">
|
||||||
|
{this.props.childGenerator()}
|
||||||
|
</div>
|
||||||
|
</AriaModal> : false
|
||||||
|
|
||||||
|
const modal =
|
||||||
|
<VelocityTransitionGroup
|
||||||
|
enter={
|
||||||
|
{
|
||||||
|
animation: 'fadeIn',
|
||||||
|
/* These styles are needed because, for some reason, we're
|
||||||
|
not able to cover the sidebar otherwise. Why? *shrug*
|
||||||
|
*/
|
||||||
|
style: {
|
||||||
|
position: 'fixed',
|
||||||
|
top: '0px',
|
||||||
|
left: '0px',
|
||||||
|
zIndex: '5000'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
leave={
|
||||||
|
{
|
||||||
|
animation: 'fadeOut',
|
||||||
|
style: {
|
||||||
|
position: 'fixed',
|
||||||
|
top: '0px',
|
||||||
|
left: '0px',
|
||||||
|
zIndex: '5000'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
runOnMount={true}>
|
||||||
|
{innerModal}
|
||||||
|
</VelocityTransitionGroup>;
|
||||||
|
|
||||||
|
return modal
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default observer(Modal)
|
export default observer(Modal)
|
||||||
|
|
|
@ -1,32 +1,104 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`Modal active modal displays 1`] = `
|
exports[`Modal active modal displays 1`] = `
|
||||||
<Displaced
|
<VelocityTransitionGroup
|
||||||
dialogStyle={
|
enter={
|
||||||
Object {
|
Object {
|
||||||
"minWidth": "768px",
|
"animation": "fadeIn",
|
||||||
|
"style": Object {
|
||||||
|
"left": "0px",
|
||||||
|
"position": "fixed",
|
||||||
|
"top": "0px",
|
||||||
|
"zIndex": "5000",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
focusDialog={true}
|
enterHideStyle={
|
||||||
mounted={true}
|
Object {
|
||||||
onExit={[Function]}
|
"display": "none",
|
||||||
titleText="title text"
|
}
|
||||||
|
}
|
||||||
|
enterShowStyle={
|
||||||
|
Object {
|
||||||
|
"display": "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
leave={
|
||||||
|
Object {
|
||||||
|
"animation": "fadeOut",
|
||||||
|
"style": Object {
|
||||||
|
"left": "0px",
|
||||||
|
"position": "fixed",
|
||||||
|
"top": "0px",
|
||||||
|
"zIndex": "5000",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
runOnMount={true}
|
||||||
>
|
>
|
||||||
<header
|
<Displaced
|
||||||
className="modal-header"
|
dialogStyle={
|
||||||
|
Object {
|
||||||
|
"minWidth": "768px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
focusDialog={true}
|
||||||
|
mounted={true}
|
||||||
|
onExit={[Function]}
|
||||||
|
titleText="title text"
|
||||||
>
|
>
|
||||||
<h4
|
<header
|
||||||
className="modal-header-title"
|
className="modal-header"
|
||||||
>
|
>
|
||||||
title text
|
<h4
|
||||||
</h4>
|
className="modal-header-title"
|
||||||
</header>
|
>
|
||||||
<div
|
title text
|
||||||
className="modal-body"
|
</h4>
|
||||||
>
|
</header>
|
||||||
<div />
|
<div
|
||||||
</div>
|
className="modal-body"
|
||||||
</Displaced>
|
>
|
||||||
|
<div />
|
||||||
|
</div>
|
||||||
|
</Displaced>
|
||||||
|
</VelocityTransitionGroup>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`Modal nothing displayed if inactive 1`] = `""`;
|
exports[`Modal nothing displayed if inactive 1`] = `
|
||||||
|
<VelocityTransitionGroup
|
||||||
|
enter={
|
||||||
|
Object {
|
||||||
|
"animation": "fadeIn",
|
||||||
|
"style": Object {
|
||||||
|
"left": "0px",
|
||||||
|
"position": "fixed",
|
||||||
|
"top": "0px",
|
||||||
|
"zIndex": "5000",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enterHideStyle={
|
||||||
|
Object {
|
||||||
|
"display": "none",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enterShowStyle={
|
||||||
|
Object {
|
||||||
|
"display": "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
leave={
|
||||||
|
Object {
|
||||||
|
"animation": "fadeOut",
|
||||||
|
"style": Object {
|
||||||
|
"left": "0px",
|
||||||
|
"position": "fixed",
|
||||||
|
"top": "0px",
|
||||||
|
"zIndex": "5000",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
runOnMount={true}
|
||||||
|
/>
|
||||||
|
`;
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SlugP2pCampaignNamingAlgorithm < CopyNamingAlgorithm
|
||||||
|
|
||||||
def get_already_used_name_entities(base_name)
|
def get_already_used_name_entities(base_name)
|
||||||
end_name = "\\_\\d{3}"
|
end_name = "\\_\\d{3}"
|
||||||
Campaign.where('slug SIMILAR TO ? AND nonprofit_id = ? AND (deleted IS NULL OR deleted = false)', base_name + end_name, nonprofit_id).select('slug')
|
Campaign.where('slug SIMILAR TO ? AND nonprofit_id = ?', base_name + end_name, nonprofit_id).select('slug')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
784
package-lock.json
generated
784
package-lock.json
generated
File diff suppressed because it is too large
Load diff
10
package.json
10
package.json
|
@ -48,8 +48,8 @@
|
||||||
"copy-webpack-plugin": "^4.5.1",
|
"copy-webpack-plugin": "^4.5.1",
|
||||||
"css-loader": "^0.28.10",
|
"css-loader": "^0.28.10",
|
||||||
"cssnano": "3.10.0",
|
"cssnano": "3.10.0",
|
||||||
"enzyme": "^3.4.2",
|
"enzyme": "^3.8.0",
|
||||||
"enzyme-adapter-react-16": "^1.1.1",
|
"enzyme-adapter-react-16": "^1.9.1",
|
||||||
"enzyme-to-json": "^3.3.3",
|
"enzyme-to-json": "^3.3.3",
|
||||||
"exports-loader": "^0.7.0",
|
"exports-loader": "^0.7.0",
|
||||||
"expose-loader": "^0.7.5",
|
"expose-loader": "^0.7.5",
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
"jsdom": "^11.10.0",
|
"jsdom": "^11.10.0",
|
||||||
"less": "^3.0.4",
|
"less": "^3.0.4",
|
||||||
"less-loader": "^4.1.0",
|
"less-loader": "^4.1.0",
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.11",
|
||||||
"node-sass": "^4.11.0",
|
"node-sass": "^4.11.0",
|
||||||
"phantomjs-prebuilt": "^2.1.16",
|
"phantomjs-prebuilt": "^2.1.16",
|
||||||
"postcss-cssnext": "^2.9.0",
|
"postcss-cssnext": "^2.9.0",
|
||||||
|
@ -83,8 +83,9 @@
|
||||||
"webpack-sweet-entry": "^1.1.4"
|
"webpack-sweet-entry": "^1.1.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/velocity-animate": "^1.2.33",
|
||||||
"attr-binder": "0.3.1",
|
"attr-binder": "0.3.1",
|
||||||
"aws-sdk": "2.2.39",
|
"aws-sdk": "^2.402.0",
|
||||||
"chart.js": "2.1.4",
|
"chart.js": "2.1.4",
|
||||||
"color": "0.11.3",
|
"color": "0.11.3",
|
||||||
"colors": "1.1.2",
|
"colors": "1.1.2",
|
||||||
|
@ -146,6 +147,7 @@
|
||||||
"uuid": "2.0.2",
|
"uuid": "2.0.2",
|
||||||
"validator": "^9.4.1",
|
"validator": "^9.4.1",
|
||||||
"vdom-thunk": "3.0.0",
|
"vdom-thunk": "3.0.0",
|
||||||
|
"velocity-react": "^1.4.1",
|
||||||
"view-script": "0.3.6",
|
"view-script": "0.3.6",
|
||||||
"virtual-dom": "2.1.1",
|
"virtual-dom": "2.1.1",
|
||||||
"vvvview": "0.4.3"
|
"vvvview": "0.4.3"
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
if [ ! -e .bin/swagger-codegen-cli.jar ]
|
if [ ! -e .bin/swagger-codegen-cli.jar ]
|
||||||
then
|
then
|
||||||
curl https://oss.sonatype.org/content/repositories/releases/io/swagger/swagger-codegen-cli/2.3.1/swagger-codegen-cli-2.3.1.jar -o .bin/swagger-codegen-cli.jar --create-dirs
|
curl -L https://repo1.maven.org/content/repositories/releases/io/swagger/swagger-codegen-cli/2.3.1/swagger-codegen-cli-2.3.1.jar -o .bin/swagger-codegen-cli.jar --create-dirs
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe SlugP2pCampaignNamingAlgorithm do
|
||||||
|
|
||||||
|
|
||||||
describe 'campaigns' do
|
describe 'campaigns' do
|
||||||
let(:campaign) {force_create(:campaign, :slug => @name, nonprofit: nonprofit)}
|
let(:campaign) {force_create(:campaign, :slug => @name, nonprofit: nonprofit, deleted:true)}
|
||||||
let(:campaign2) {force_create(:campaign, :slug => @name2, nonprofit:nonprofit)}
|
let(:campaign2) {force_create(:campaign, :slug => @name2, nonprofit:nonprofit)}
|
||||||
let(:campaigns_at_max_copies) { (0..999).collect{|i|
|
let(:campaigns_at_max_copies) { (0..999).collect{|i|
|
||||||
force_create(:campaign, slug: "#{@copy_base}_#{"%03d" % i}", nonprofit:nonprofit)
|
force_create(:campaign, slug: "#{@copy_base}_#{"%03d" % i}", nonprofit:nonprofit)
|
||||||
|
|
26
spec/models/campaign_spec.rb
Normal file
26
spec/models/campaign_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Campaign, type: :model do
|
||||||
|
describe 'sends correct email based on type of campaign' do
|
||||||
|
let(:nonprofit) { force_create(:nonprofit)}
|
||||||
|
let(:parent_campaign) { force_create(:campaign, name: 'Parent campaign', nonprofit: nonprofit) }
|
||||||
|
let(:child_campaign) do
|
||||||
|
force_create(:campaign,
|
||||||
|
name: 'Child campaign',
|
||||||
|
parent_campaign_id: parent_campaign.id,
|
||||||
|
slug: "twehotiheiotheiofnieoth",
|
||||||
|
goal_amount_dollars: "1000", nonprofit: nonprofit )
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'parent campaign sends out general campaign email' do
|
||||||
|
expect { parent_campaign }.to change { ActionMailer::Base.deliveries.count }.by(1)
|
||||||
|
expect(ActionMailer::Base.deliveries.last.body.include?("Create one-time or recurring")).to be_truthy
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'child campaign sends out federated campaign email' do
|
||||||
|
expect { child_campaign}.to change { ActionMailer::Base.deliveries.count }.by(2)
|
||||||
|
expect(ActionMailer::Base.deliveries.last.body.include?("including a testimonial")).to be_truthy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
3
tslint.json
Normal file
3
tslint.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"indent": [true, "spaces"]
|
||||||
|
}
|
38
types/velocity-react/index.d.ts
vendored
Normal file
38
types/velocity-react/index.d.ts
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// License: LGPL-3.0-or-later
|
||||||
|
declare module "velocity-react"
|
||||||
|
import * as React from 'react'
|
||||||
|
import * as Velocity from 'velocity-animate'
|
||||||
|
import 'velocity-animate/velocity.ui'
|
||||||
|
|
||||||
|
type Animation = object|string
|
||||||
|
type TargetQuerySelector = "children" | string
|
||||||
|
interface VelocityComponentProps
|
||||||
|
{
|
||||||
|
animation: Animation
|
||||||
|
runOnMount?: boolean
|
||||||
|
targetQuerySelector?: TargetQuerySelector
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export declare class VelocityComponent extends React.Component<VelocityComponentProps, {}>
|
||||||
|
{
|
||||||
|
runAnimation():void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface VelocityTransitionGroupProps {
|
||||||
|
enter: Animation
|
||||||
|
leave?: Animation
|
||||||
|
runOnMount?: boolean
|
||||||
|
style?: CSSProperties
|
||||||
|
}
|
||||||
|
|
||||||
|
export declare class VelocityTransitionGroup extends React.Component<VelocityTransitionGroupProps, {}> {
|
||||||
|
static disabledForTest: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export declare namespace velocityHelpers {
|
||||||
|
declare function registerEffect(animation:Animation)
|
||||||
|
declare function registerEffect(suffix:string, animation:Animation)
|
||||||
|
}
|
Loading…
Reference in a new issue