Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Merge master #73

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: lfzawacki
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ config/settings.yml
config/piwik.yml

vendor/external_projects/*

config/deploy*.rb
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Helping to catalog, preserve and free the artifacts you need to produce music.

[![Donate via Paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=A5956UYMW6QKJ&lc=US&item_name=Musical%20Artifacts&item_number=musart¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted) [Donate via Paypal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=A5956UYMW6QKJ&lc=US&item_name=Musical%20Artifacts&item_number=musart¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted)

[![Donate via Bitcoin](https://musical-artifacts.com/uploads/static/bitcoin_donate.png)](bitcoin:1Q6cYSxkKybi4we5joaMFbcKAMxxvCcJkr) [Donate via Bitcoin](bitcoin:1Q6cYSxkKybi4we5joaMFbcKAMxxvCcJkr)

[![Travis Build](https://travis-ci.org/lfzawacki/musical-artifacts.svg?branch=master)](https://travis-ci.org/lfzawacki/musical-artifacts) [![Code Climate](https://codeclimate.com/github/lfzawacki/musical-artifacts/badges/gpa.svg)](https://codeclimate.com/github/lfzawacki/musical-artifacts) [![Test Coverage](https://codeclimate.com/github/lfzawacki/musical-artifacts/badges/coverage.svg)](https://codeclimate.com/github/lfzawacki/musical-artifacts/coverage) [![Security Checks](https://hakiri.io/github/lfzawacki/musical-artifacts/master.svg)](https://hakiri.io/github/lfzawacki/musical-artifacts/master) [![Docs](http://inch-ci.org/github/lfzawacki/musical-artifacts.svg?branch=master)](https://inch-ci.org/github/lfzawacki/musical-artifacts)

[Read the wiki](https://github.com/lfzawacki/musical-artifacts/wiki)
Expand Down
Binary file removed app/assets/images/icons/coinhive-icon.png
Binary file not shown.
Binary file removed app/assets/images/music/cover.jpg
Binary file not shown.
22 changes: 22 additions & 0 deletions app/assets/javascripts/artifacts.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

MAX_FILE_UPLOAD = 500

artifact_search_fields = ['apps', 'tags', 'license', 'hash', 'formats']

# Make tag text editable after it's deleted
Expand Down Expand Up @@ -156,6 +158,25 @@ initialize_wayback_links = ->

e.preventDefault()

bytesToMB = (bytes) ->
bytes / (1000*1000)

initialize_validations = ->
$('input[type="submit"]').on 'click', (e) ->
file_form = $("#artifact_file")[0]

if typeof(file_form.files) != 'undefined'
size = bytesToMB(file_form.files[0].size)

if size > MAX_FILE_UPLOAD
$("#filesize_error").show()
return false
else
$("#filesize_error").hide()
return true

return true

# Load juvia comments
# TODO: Document this hacky mess PLZ
initialize_comments = ->
Expand Down Expand Up @@ -348,6 +369,7 @@ $(document).on 'page:change', ->
initialize_select '#artifact_tag_list', '/searches/tags'
initialize_select '#artifact_software_list', '/searches/apps'
initialize_select '#artifact_file_format_list', '/searches/file_formats'
initialize_validations()

if $('#artifact_license_id')[0]
$('#artifact_license_id').select2
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,10 @@ footer {
outline: 0;
}

#filesize_error {
display: none;
}

#static_notification_space {
.banner {
margin: 0 auto;
Expand Down
21 changes: 3 additions & 18 deletions app/assets/stylesheets/donations.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#donations {
h1 {
text-transform: none;
font-weight: bold;
font-size: 1.5em;
}

Expand All @@ -9,7 +9,7 @@
}

ul {
padding: 1em 0 0.5em 0;
padding: 1em 0 1em 0;
display: inline;
}

Expand All @@ -18,24 +18,9 @@
margin-right: 1em;
}

.my-music {
margin-top: 1em;

a {
font-weight: bold;
}

img {
display: block;
margin: 0 auto 0.5em auto;
}
figcaption {
text-align: center;
}
}

.description {
font-size: 1.1em;
margin-top: 1em;
margin-bottom: 1em;
}

Expand Down
2 changes: 1 addition & 1 deletion app/views/artifacts/_artifact_links.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- mirrors = @artifact.mirrors
/ Add our download file as the first mirror
- if @artifact.file.present? && @artifact.downloadable?
- mirrors.unshift(download_url(@artifact))
- mirrors.push(download_url(@artifact))

%ul#mirrors.link-list
- mirrors.each do |mirror|
Expand Down
6 changes: 5 additions & 1 deletion app/views/artifacts/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
.form-group.col-xs-12.floating-label-form-group.controls
= f.label :file

-if @artifact.file.present?
- if @artifact.file.present?
= @artifact.file.file.identifier

= f.file_field :file, class: 'btn btn-default btn-file form-control', placeholder: true
Expand Down Expand Up @@ -81,4 +81,8 @@

.row.pad-top
.form-group.col-xs-12

#filesize_error.alert.alert-danger
= t('.filesize_error')

= f.submit class: 'btn btn-new btn-lg btn-group-justified'
21 changes: 11 additions & 10 deletions app/views/artifacts/_side_buttons.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,23 @@
%i.fa.fa-star
.small-label= t('.favorite')

- if can?(:download, artifact) && artifact.file.try(:url)
= download_link(artifact, class: 'btn-download') do
%span.side-button.download-count.btn.btn-default
= number_with_delimiter(artifact.download_count)
%i.fa.fa-download
.small-label
= t('.download')
= "(#{number_to_human_size(artifact.file.file.size)})"

- elsif artifact.mirrors.present?
- if artifact.mirrors.present?
- mirror = artifact.mirrors.first
= external_link_to mirror, class: '' do
= external_link_to mirror, class: 'btn-mirror' do
%span.side-button.download-count.btn.btn-default
%i.fa.fa-external-link-square
%i.fa.fa-download
.small-label
= t('.download_mirror')
%br
= domain_from_link(mirror)

- elsif can?(:download, artifact) && artifact.file.try(:url)
= download_link(artifact, class: 'btn-download') do
%span.side-button.download-count.btn.btn-default
= number_with_delimiter(artifact.download_count)
%i.fa.fa-download
.small-label
= t('.download')
= "(#{number_to_human_size(artifact.file.file.size)})"
20 changes: 13 additions & 7 deletions app/views/info/_donations.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
.description
= t('.description')

%ul.donation-progress
- donations = Rails.application.secrets.donations['streamelements']

- if donations
%iframe{src: donations['iframe'], width: '360px', height: '90px', style: 'border: 0; overflow: hidden;', scrolling: 'no'}

%ul.donation-methods
- ['paypal', 'bitcoin'].each do |method|
- Rails.application.secrets.donations['active'].each do |method|
%li{class: method}
= link_to Rails.application.secrets.donations[method]['url'], target: '_blank' do
= image_tag Rails.application.secrets.donations[method]['shield'], alt: t(".#{method}_alt")
= method.capitalize
= t(".#{method}_name")

%figure.my-music
= link_to 'https://open.spotify.com/track/3qnFY1AiKIVF07c5wuPbHI', target: '_blank' do
= image_tag 'music/cover.jpg', width: 150, id: 'cover-image'
%figcaption
= t('.extra_my_music_html')
.description
= t('.more_details')

.description
= t('.more_details_html')
12 changes: 9 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ en:
free_licenses: Free Licenses
new_artifact_help_html: "Need tips on how to create a good artifact? <a target=\"_blank\" href=\"%{link}\">Read this!</a>"
non_free_licenses: Non-Free Licenses
filesize_error: File sizes bigger than 500mb are not supported, use a mirror for your file.

show:
no_description: "(No description available)"
Expand Down Expand Up @@ -364,14 +365,19 @@ en:

donations:
call_to_action: Help us by donating!
description: "Musical Artifacts is an open source web app helping musicians to find, share and preserve the artifacts they use for producing their music."
more_details_html: "This project is worked on by volunteers in their free time. Donations cover the hosting costs and accelerate the development of new features. To contribute without donating money, see <a href=\"https://github.com/lfzawacki/musical-artifacts/wiki/How-To-Contribute\">this page</a>"
extra_my_music_html: "If you want to support my music, my newest release <strong>Hear My Words</strong> is on <a target=\"_blank\" href=\"https://open.spotify.com/track/3qnFY1AiKIVF07c5wuPbHI\">Spotify</a> and <a target=\"_blank\" href=\"https://mortticia.rocks/music/\">several other platforms</a> !"
description: "Musical Artifacts is an open source web app helping musicians to find, share and preserve the artifacts they use for music production. It's worked on by volunteers in their free time."
more_details: "As it grows, so do hosting and bandwidth costs. We don't track you or show ads, so we need donations to keep the website up and maintain download speeds."
more_details_html: "To contribute without donating money, see <a href=\"https://github.com/lfzawacki/musical-artifacts/wiki/How-To-Contribute\">this page</a>"

bitcoin_name: Bitcoin
bitcoin_alt: Donate Bitcoin

paypal_name: Paypal
paypal_alt: Donate via Paypal

streamelements_alt: Donate via Paypal
streamelements_name: Paypal

optout:
title: Opt-out from Traffic Analytics
description_html: "For more information about the website's data collection policies read <a href=\"https://github.com/lfzawacki/musical-artifacts/wiki/Terms-and-Conditions#privacy-policy-and-data-collection-clause\">this page</a>."
Expand Down
6 changes: 5 additions & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,16 @@ fr:
call_to_action: Aidez-nous en donnant !
description: "Musical Artifacts est une application web à source ouverte qui aide les musiciens à trouver, partager, et préserver les artéfacts qu'ils utilisent pour produire leur musique."
more_details_html: "Ce projet est fait par des volontaires sur leur temps libre. Les dons couvrent les coûts d'hébergement du site web et accélérent le développement de nouvelles fonctionnalités. Pour contribuer sans donner d'argent, consultez <a href=\"https://github.com/lfzawacki/musical-artifacts/wiki/How-To-Contribute\">cette page</a> (en anglais)."
extra_my_music_html: "Hé ! J'ai fait du <strong>heavy metal</strong>, vous pouvez écouter ça <a target=\"_blank\" href=\"https://mortticia.rocks/music/\">ICI</a> !"

bitcoin_name: Bitcoin
bitcoin_alt: Donate Bitcoin

paypal_name: Paypal
paypal_alt: Donate via Paypal

streamelements_alt: Donate via Paypal
streamelements_name: Paypal

optout:
title: Empêcher les analyses de traffic
description_html: "Pour davantage d'information à propos des pratiques de collection des données de ce site, lisez <a href=\"https://github.com/lfzawacki/musical-artifacts/wiki/Terms-and-Conditions#privacy-policy-and-data-collection-clause\">cette page</a>."
Expand Down
12 changes: 9 additions & 3 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ pt-BR:
free_licenses: Licenças Livres
new_artifact_help_html: "Precisa de dicas para criar um bom artefato? <a target=\"_blank\" href=\"%{link}\">Leia isto!</a>"
non_free_licenses: Licenças não livres
filesize_error: Arquivos maiores que 500mb não são suportados, use um espelho para seu arquivo.

wayback_links:
broken: Links externos estão quebrados? Clique aqui para tentar links do Arquivo da Internet.
Expand Down Expand Up @@ -385,14 +386,19 @@ pt-BR:

donations:
call_to_action: Ajude-nos com uma doação!
description: "Musical Artifacts é um app de código livre que ajuda músicos a encontrar, compartilhar e preservar os artefatos usados para produzir sua música."
more_details_html: "Este projeto é desenvolvido por voluntários em seu tempo livre. Doações são usadas para pagar os custos de hospedagem e acelerar o desenvolvimento de novas funcionalidades. Existem muitas outras maneiras de ajudar além de doações de dinheiro. Veja <a href=\"https://github.com/lfzawacki/musical-artifacts/wiki/How-To-Contribute\">esta página</a>"
extra_my_music_html: "Se você quiser apoiar a minha música, a minha nova canção <strong>Hear My Words</strong> está no <a target=\"_blank\" href=\"https://open.spotify.com/track/3qnFY1AiKIVF07c5wuPbHI\">Spotify</a> e <a target=\"_blank\" href=\"https://mortticia.rocks/music/\">várias outras plataformas</a> !"
description: "Musical Artifacts é um app de código livre que ajuda músicos a encontrar, compartilhar e preservar os artefatos que usam para produzir. Ele é desenvolvido por voluntários em seu tempo livre."
more_details: "Com seu crescimento também crescem os custos de banda e hospedagem. Não mostramos propagandas ou te rastreamos, então necessitamos de doações para mantê-lo em pé e com boas velocidades."
more_details_html: "Existem outras maneiras de ajudar além de doações de dinheiro. Veja <a href=\"https://github.com/lfzawacki/musical-artifacts/wiki/How-To-Contribute\">esta página</a>"

bitcoin_name: Bitcoin
bitcoin_alt: Doar Bitcoin

paypal_name: Paypal
paypal_alt: Doar via Paypal

streamelements_alt: Doar via Paypal
streamelements_name: Paypal

optout:
title: Opt-out da análise de tráfego
description_html: "Para mais informações sobre a política de coleta de dados do website leia <a href=\"https://github.com/lfzawacki/musical-artifacts/wiki/Terms-and-Conditions#privacy-policy-and-data-collection-clause\">esta página</a>."
Expand Down
9 changes: 5 additions & 4 deletions test/features/show_artifact_info_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ class ShowArtifactInfoTest < Capybara::Rails::TestCase
assert_link I18n.t('artifacts.side_buttons.download_mirror')
end

test "see download button, but not for mirror if file is present" do
test "see mirror link but not if file is present" do
@artifact.update_attributes(file: fixture_file('example.gx'), mirrors: 'https://validmirror.com')

visit artifact_path(@artifact)
assert_link I18n.t('artifacts.side_buttons.download')
assert_no_link I18n.t('artifacts.side_buttons.download_mirror') + ' validmirror.com'

assert_no_css ".btn-download"
assert_css ".btn-mirror"
assert_link I18n.t('artifacts.side_buttons.download_mirror') + ' validmirror.com'
end

test "see favorite icon and number in artifact when logged out" do
Expand Down Expand Up @@ -303,7 +305,6 @@ class ShowArtifactInfoTest < Capybara::Rails::TestCase
visit artifacts_path

assert_css '.license'
assert_link '', artifacts_path(license: license.short_name)
end

end
Expand Down