Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
diaspora
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Gigadoc 2
diaspora
Commits
1028632a
Unverified
Commit
1028632a
authored
Jan 22, 2017
by
flaburgan
Committed by
Benjamin Neff
Jan 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Liberapay button in the donate section
closes #7290
parent
8f95e973
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
93 additions
and
13 deletions
+93
-13
Changelog.md
Changelog.md
+1
-0
app/assets/images/buttons/liberapay-button.svg
app/assets/images/buttons/liberapay-button.svg
+10
-0
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+6
-0
app/views/shared/_donatepod.html.haml
app/views/shared/_donatepod.html.haml
+26
-12
app/views/streams/main_stream.html.haml
app/views/streams/main_stream.html.haml
+1
-1
config/defaults.yml
config/defaults.yml
+1
-0
config/diaspora.yml.example
config/diaspora.yml.example
+4
-0
config/locales/diaspora/en.yml
config/locales/diaspora/en.yml
+1
-0
features/desktop/donations.feature
features/desktop/donations.feature
+7
-0
features/step_definitions/custom_web_steps.rb
features/step_definitions/custom_web_steps.rb
+8
-0
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+28
-0
No files found.
Changelog.md
View file @
1028632a
...
...
@@ -7,6 +7,7 @@
*
Update comment in database example config
[
#7282
](
https://github.com/diaspora/diaspora/pull/7282
)
## Features
*
Add support for
[
Liberapay
](
https://liberapay.com
)
donations
[
#7290
](
https://github.com/diaspora/diaspora/pull/7290
)
# 0.6.3.0
...
...
app/assets/images/buttons/liberapay-button.svg
0 → 100644
View file @
1028632a
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"83"
height=
"30"
>
<rect
id=
"back"
fill=
"#f6c915"
x=
"1"
y=
".5"
width=
"82"
height=
"29"
rx=
"4"
/>
<svg
viewBox=
"0 0 80 80"
height=
"16"
width=
"16"
x=
"7"
y=
"7"
>
<g
transform=
"translate(-78.37-208.06)"
fill=
"#1a171b"
>
<path
d=
"m104.28 271.1c-3.571 0-6.373-.466-8.41-1.396-2.037-.93-3.495-2.199-4.375-3.809-.88-1.609-1.308-3.457-1.282-5.544.025-2.086.313-4.311.868-6.675l9.579-40.05 11.69-1.81-10.484 43.44c-.202.905-.314 1.735-.339 2.489-.026.754.113 1.421.415 1.999.302.579.817 1.044 1.546 1.395.729.353 1.747.579 3.055.679l-2.263 9.278"
/>
<path
d=
"m146.52 246.14c0 3.671-.604 7.03-1.811 10.07-1.207 3.043-2.879 5.669-5.01 7.881-2.138 2.213-4.702 3.935-7.693 5.167-2.992 1.231-6.248 1.848-9.767 1.848-1.71 0-3.42-.151-5.129-.453l-3.394 13.651h-11.162l12.52-52.19c2.01-.603 4.311-1.143 6.901-1.622 2.589-.477 5.393-.716 8.41-.716 2.815 0 5.242.428 7.278 1.282 2.037.855 3.708 2.024 5.02 3.507 1.307 1.484 2.274 3.219 2.904 5.205.627 1.987.942 4.11.942 6.373m-27.378 15.461c.854.202 1.91.302 3.167.302 1.961 0 3.746-.364 5.355-1.094 1.609-.728 2.979-1.747 4.111-3.055 1.131-1.307 2.01-2.877 2.64-4.714.628-1.835.943-3.858.943-6.071 0-2.161-.479-3.998-1.433-5.506-.956-1.508-2.615-2.263-4.978-2.263-1.61 0-3.118.151-4.525.453l-5.28 21.948"
/>
</g>
</svg>
<text
fill=
"#1a171b"
text-anchor=
"middle"
font-family=
"Helvetica Neue,Helvetica,Arial,sans-serif"
font-weight=
"700"
font-size=
"14"
x=
"50"
y=
"20"
>
Donate
</text>
</svg>
app/helpers/application_helper.rb
View file @
1028632a
...
...
@@ -23,6 +23,12 @@ module ApplicationHelper
AppConfig
.
settings
.
source_url
.
presence
||
"
#{
root_path
.
chomp
(
'/'
)
}
/source.tar.gz"
end
def
donations_enabled?
AppConfig
.
settings
.
paypal_donations
.
enable?
||
AppConfig
.
settings
.
liberapay_username
.
present?
||
AppConfig
.
bitcoin_donation_address
.
present?
end
def
timeago
(
time
,
options
=
{})
timeago_tag
(
time
,
options
.
merge
(
:class
=>
'timeago'
,
:title
=>
time
.
iso8601
,
:force
=>
true
))
if
time
end
...
...
app/views/shared/_donatepod.html.haml
View file @
1028632a
-
if
AppConfig
.
settings
.
paypal_donations
.
enable?
PayPal:
%form
{
action:
"https://www.paypal.com/cgi-bin/webscr"
,
method:
"post"
,
target:
"_blank"
}
%input
{
name:
"cmd"
,
type:
"hidden"
,
value:
"_s-xclick"
}
-
if
AppConfig
.
settings
.
paypal_donations
.
paypal_hosted_button_id
.
present?
%input
{
name:
"hosted_button_id"
,
type:
"hidden"
,
value:
AppConfig
.
settings
.
paypal_donations
.
paypal_hosted_button_id
}
-
if
AppConfig
.
settings
.
paypal_donations
.
paypal_unhosted_button_encrypted
.
present?
%input
{
name:
"encrypted"
,
type:
"hidden"
,
value:
AppConfig
.
settings
.
paypal_donations
.
paypal_unhosted_button_encrypted
}
%input
{
name:
"currency_code"
,
type:
"hidden"
,
value:
AppConfig
.
settings
.
paypal_donations
.
currency
}
%input
{
name:
"submit"
,
type:
"submit"
,
value:
t
(
"aspects.index.donate"
),
class:
"btn btn-default"
}
%p
PayPal:
%br
%form
{
action:
"https://www.paypal.com/cgi-bin/webscr"
,
method:
"post"
,
target:
"_blank"
}
%input
{
name:
"cmd"
,
type:
"hidden"
,
value:
"_s-xclick"
}
-
if
AppConfig
.
settings
.
paypal_donations
.
paypal_hosted_button_id
.
present?
%input
{
name:
"hosted_button_id"
,
type:
"hidden"
,
value:
AppConfig
.
settings
.
paypal_donations
.
paypal_hosted_button_id
}
-
if
AppConfig
.
settings
.
paypal_donations
.
paypal_unhosted_button_encrypted
.
present?
%input
{
name:
"encrypted"
,
type:
"hidden"
,
value:
AppConfig
.
settings
.
paypal_donations
.
paypal_unhosted_button_encrypted
}
%input
{
name:
"currency_code"
,
type:
"hidden"
,
value:
AppConfig
.
settings
.
paypal_donations
.
currency
}
%input
.btn.btn-default
{
name:
"submit"
,
type:
"submit"
,
value:
t
(
"aspects.index.donate"
)}
-
if
AppConfig
.
bitcoin_donation_address
Bitcoin:
%input
{
type:
"text"
,
id:
"bitcoin_address"
,
value:
AppConfig
.
bitcoin_donation_address
,
readonly:
true
}
-
if
AppConfig
.
settings
.
liberapay_username
.
present?
%p
Liberapay:
%br
%a
{
id:
"liberapay-button"
,
href:
"https://liberapay.com/#{AppConfig.settings.liberapay_username}/donate"
}
=
image_tag
"buttons/liberapay-button.svg"
,
alt:
t
(
"aspects.index.donate"
),
title:
t
(
"aspects.index.donate_liberapay"
)
-
if
AppConfig
.
bitcoin_donation_address
%p
Bitcoin:
%br
%input
{
type:
"text"
,
id:
"bitcoin_address"
,
value:
AppConfig
.
bitcoin_donation_address
,
readonly:
true
}
app/views/streams/main_stream.html.haml
View file @
1028632a
...
...
@@ -124,7 +124,7 @@
.content
!=
t
(
"bookmarklet.explanation"
,
link:
link_to
(
t
(
"bookmarklet.post_something"
),
bookmarklet_code
))
-
if
AppConfig
.
settings
.
paypal_donations
.
enable?
||
AppConfig
.
bitcoin_donation_address
-
if
donations_enabled?
.section.collapsed
.title
%h5
.title-header
...
...
config/defaults.yml
View file @
1028632a
...
...
@@ -105,6 +105,7 @@ defaults:
currency
:
USD
paypal_hosted_button_id
:
paypal_unhosted_button_encrypted
:
liberapay_username
:
bitcoin_address
:
bitcoin_wallet_id
:
# DEPRECATED: Remove with 0.6
community_spotlight
:
...
...
config/diaspora.yml.example
View file @
1028632a
...
...
@@ -430,6 +430,10 @@ configuration: ## Section
## OR encrypted key of unhosted button
#paypal_unhosted_button_encrypted: "-----BEGIN PKCS7-----"
## Liberapay.com is a free platform which allow donations like patreon
## Set your username to include your liberapay button
# liberapay_username: "change_me"
## Bitcoin donations
## You can provide a bitcoin address here to allow your users to provide
## donations towards the running of their pod.
...
...
config/locales/diaspora/en.yml
View file @
1028632a
...
...
@@ -194,6 +194,7 @@ en:
index
:
donate
:
"
Donate"
keep_pod_running
:
"
Keep
%{pod}
running
fast
and
buy
servers
their
coffee
fix
with
a
monthly
donation!"
donate_liberapay
:
"
Donate
to
liberapay"
welcome_to_diaspora
:
"
Welcome
to
diaspora*,
%{name}!"
introduce_yourself
:
"
This
is
your
stream.
Jump
in
and
introduce
yourself."
...
...
features/desktop/donations.feature
View file @
1028632a
...
...
@@ -16,3 +16,10 @@ Feature: donations
Then
I should see
"Donate"
within
".info-bar"
And
I click on
"Donate"
navbar title
Then
I should see the Bitcoin address
Scenario
:
Liberapay donations
Given
I have configured a Liberapay username
And
I go to the home page
Then
I should see
"Donate"
within
".info-bar"
And
I click on
"Donate"
navbar title
Then
I should see the Liberapay donate button
features/step_definitions/custom_web_steps.rb
View file @
1028632a
...
...
@@ -288,6 +288,14 @@ Then /^I should see the Bitcoin address$/ do
find
(
"#bitcoin_address"
)[
'value'
].
should
==
"AAAAAA"
end
Given
/^I have configured a Liberapay username$/
do
AppConfig
.
settings
.
liberapay_username
=
"BBBBBB"
end
Then
/^I should see the Liberapay donate button$/
do
find
(
"#liberapay-button"
)[
"href"
].
should
==
"https://liberapay.com/BBBBBB/donate"
end
Given
/^"([^"]*)" is hidden$/
do
|
selector
|
page
.
should
have_selector
(
selector
,
visible:
false
)
page
.
should_not
have_selector
(
selector
)
...
...
spec/helpers/application_helper_spec.rb
View file @
1028632a
...
...
@@ -68,6 +68,34 @@ describe ApplicationHelper, :type => :helper do
end
end
describe
"#donations_enabled?"
do
it
"returns false when nothing is set"
do
expect
(
helper
.
donations_enabled?
).
to
be
false
end
it
"returns true when the paypal donations is enabled"
do
AppConfig
.
settings
.
paypal_donations
.
enable
=
true
expect
(
helper
.
donations_enabled?
).
to
be
true
end
it
"returns true when the liberapay username is set"
do
AppConfig
.
settings
.
liberapay_username
=
"foo"
expect
(
helper
.
donations_enabled?
).
to
be
true
end
it
"returns true when the bitcoin_address is set"
do
AppConfig
.
settings
.
bitcoin_address
=
"bar"
expect
(
helper
.
donations_enabled?
).
to
be
true
end
it
"returns true when all the donations are enabled"
do
AppConfig
.
settings
.
paypal_donations
.
enable
=
true
AppConfig
.
settings
.
liberapay_username
=
"foo"
AppConfig
.
settings
.
bitcoin_address
=
"bar"
expect
(
helper
.
donations_enabled?
).
to
be
true
end
end
describe
"#changelog_url"
do
let
(
:changelog_url_setting
)
{
double
.
tap
{
|
double
|
allow
(
AppConfig
).
to
receive
(
:settings
).
and_return
(
double
(
changelog_url:
double
))
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment