-
Notifications
You must be signed in to change notification settings - Fork 25
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
Medal Distribution tool #521
Open
coreobs
wants to merge
8
commits into
ozfortress:master
Choose a base branch
from
coreobs:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
853ed09
Small spacing/padding fix
coreobs 77bd84a
Medal Distribution tool added to league pages
coreobs f1acba4
fix lint
seanbudd c81574c
add tests
seanbudd df38e3f
Merge pull request #3 from seanbudd/fix521
coreobs 795d945
Merge branch 'ozfortress:master' into master
coreobs 4c12c91
Update External Links logos
coreobs 043e84e
Replace discord svg with png
coreobs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
- content_for(:title) { "Medal Distribution for #{@league.name}" } | ||
|
||
%h1 Medal Distribution for #{@league.name} | ||
|
||
%p.alert.alert-warning Please Note: We do not provide a way of distributing your promotional items/medals, only a way of downloading lists of SteamID64 IDs for individual teams or divisions. For distribution, we recommend PGrant, or whatever Valve provides when receiving the promotional item IDs for your medals. | ||
|
||
%hr | ||
|
||
.row | ||
.col-md-12 | ||
.panel.panel-container | ||
.panel-body.table-responsive | ||
- @ordered_rosters.each do |div, rosters| | ||
%h3= div.name | ||
%table.table | ||
%tr | ||
%th # | ||
%th Team | ||
%th Points | ||
%th Add to the list | ||
- present_collection(@league.tiebreakers).each do |tiebreaker| | ||
%th= tiebreaker.name_with_tooltip | ||
|
||
- rosters.each_with_index do |roster, rank| | ||
%tr | ||
%th{ scope: 'row' }= rank + 1 | ||
%td | ||
= present(roster).listing | ||
%ul{:class => "steamids", style: "display: none"} | ||
- roster.users.each do |player| | ||
%li | ||
=player.steam_id | ||
%td= roster.points | ||
- @league.tiebreakers.each do |tiebreaker| | ||
%th= tiebreaker.value_for(roster) | ||
%td | ||
%input{:name => "list", :type => "checkbox"} | ||
%button.btn.btn-primary.btn-lg.btn-block{:type => "button", :id => "download"} Download | ||
%br | ||
|
||
:javascript | ||
$(function() { | ||
function download(filename, text) { | ||
var element = document.createElement('a'); | ||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); | ||
element.setAttribute('download', filename); | ||
element.style.display = 'none'; | ||
document.body.appendChild(element); | ||
element.click(); | ||
document.body.removeChild(element); | ||
} | ||
|
||
$("#download").click(function () { | ||
var ids = []; | ||
$("input:checked").each(function () { | ||
list = $(this).parent().parent().find(".steamids > li"); | ||
list.each(function () { | ||
var temp = $(this).html().replace(/(\r\n\t|\n|\r\t)/gm,""); | ||
ids.push(temp); | ||
}); | ||
}); | ||
console.log(ids); | ||
download("MedalSteam64IDs" + Date.now() + ".txt", ids.join("\n")); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the route change this shouldn't be needed.
:medals
shouldn't be excepted from the previousbefore_action
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to find league ID when I removed the exception and those two lines, re-adding them it works as expected.