-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
Star Rating #3967
Merged
Star Rating #3967
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
1637cc4
add tab
octavioamu da6716d
change tabs
octavioamu 96b6f71
add stars
octavioamu 2159d4f
refactor rating
octavioamu 0593efa
style rating card
octavioamu 2fd1923
mock data
octavioamu ba31302
start BE
octavioamu f141915
Adds detailed star ratings for the modal
SaptakS 4c17a3e
Serves unrated bounties
SaptakS 9fd438d
Merge branch 'master' into rating
SaptakS 8f041ed
Fixes font-family default in rating.css
SaptakS db22813
Fixes linting issues
SaptakS 3fa8019
add modal
octavioamu 6631cb5
send data
octavioamu 31f0542
change funder
octavioamu f00b006
Merge branch 'master' into rating
octavioamu 1aadcb2
Merge branch 'master' into rating
octavioamu 56b4754
migrations and rating in payout
octavioamu c820782
clean
octavioamu 4d129fd
fix fetch data and user in modal
octavioamu 4b65feb
Filter feedback based on feedbackType
SaptakS c050817
fix logic
octavioamu d706ae1
lot of changes in rating
octavioamu aef821d
Merge branch 'master' into rating
SaptakS b8c638b
Merge branch 'master' into rating
octavioamu 260ae9c
fix lint errors
octavioamu 06a852e
Fixes linting issues
SaptakS 206e484
Merge branch 'rating' of github.com:gitcoinco/web into rating
SaptakS 1032925
address review
octavioamu 2791e1c
address review
octavioamu a24b0a6
Merge branch 'rating' of https://github.com/gitcoinco/web into rating
octavioamu b394b59
Merge branch 'master' into rating
octavioamu 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
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,88 @@ | ||
/* stylelint-disable no-descending-specificity */ | ||
.card-rating { | ||
color: #0d003c; | ||
background-color: #fff; | ||
border-radius: 4px; | ||
position: relative; | ||
margin: 1rem 0.6rem; | ||
scroll-snap-align: none start; | ||
transition: .45s all ease-in-out; | ||
flex-wrap: nowrap; | ||
flex-direction: row; | ||
flex: 0 0 24.2%; | ||
max-width: 24.2%; | ||
align-items: center; | ||
font-size: 12px; | ||
min-width: 230px; | ||
box-shadow: 0 2px 2px 1px rgba(0, 0, 0, 0.1); | ||
} | ||
.card-rating .tag { | ||
font-weight: 700; | ||
} | ||
.card-rating__title { | ||
color: #000; | ||
font-weight: 600; | ||
font-size: 0.9rem; | ||
display: -webkit-box; | ||
-webkit-line-clamp: 2; | ||
-webkit-box-orient: vertical; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
margin-bottom: 6px; | ||
} | ||
|
||
.card-rating__avatar { | ||
flex-shrink: 0; | ||
} | ||
|
||
.card-rating__header { | ||
display: flex; | ||
background-color: #F8F9FA; | ||
padding: 1rem .5em; | ||
border-radius: 4px 4px 0 0; | ||
} | ||
|
||
.rating { | ||
direction: rtl; | ||
} | ||
|
||
.rating--small .rating-star { | ||
font-size: 0.6rem; | ||
} | ||
|
||
.rating > input { display: none; } | ||
.rating > .rating-star:before { | ||
margin: 1px; | ||
font-size: 2.35em; | ||
font-family: 'Font Awesome\ 5 Free', sans-serif; | ||
display: inline-block; | ||
content: "\f005"; | ||
} | ||
|
||
.rating > .half:before { | ||
content: "\f089"; | ||
position: absolute; | ||
} | ||
|
||
.rating > .rating-star { | ||
color: #ddd; | ||
margin-bottom: 0; | ||
} | ||
|
||
.rating > input:checked ~ .rating-star, | ||
fieldset:not(:disabled) .rating:not(:checked) > .rating-star:hover, | ||
fieldset:not(:disabled) .rating:not(:checked) > .rating-star:hover ~ .rating-star { | ||
color: #25E899; | ||
font-weight: 800; | ||
} | ||
|
||
fieldset:not(:disabled) .rating > input:checked + .rating-star:hover, | ||
fieldset:not(:disabled) .rating > input:checked ~ .rating-star:hover, | ||
fieldset:not(:disabled) .rating > .rating-star:hover ~ input:checked ~ .rating-star, | ||
fieldset:not(:disabled) .rating > input:checked ~ .rating-star:hover ~ .rating-star { | ||
color: rgb(11, 253, 156); | ||
} | ||
|
||
fieldset:disabled .rating { | ||
filter: grayscale(1); | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,13 @@ const round = function(num, decimals) { | |
return Math.round(num * 10 ** decimals) / 10 ** decimals; | ||
}; | ||
|
||
|
||
const rateUser = (elem) => { | ||
let userSelected = $(elem).select2('data')[0].text; | ||
|
||
$(elem).parents('.new-user').next().find('[data-open-rating]').data('openUsername', userSelected.trim()); | ||
}; | ||
|
||
const normalizeUsername = function(username) { | ||
if (username.indexOf('@') != 0) { | ||
return '@' + username; | ||
|
@@ -36,7 +43,8 @@ $(document).ready(function($) { | |
|
||
$(document).on('click', '.remove', function(event) { | ||
event.preventDefault(); | ||
$(this).parents('tr').remove(); | ||
$(this).parents('.new-user').next('tr').remove(); | ||
$(this).parents('.new-user').remove(); | ||
$(this).focus(); | ||
update_registry(); | ||
}); | ||
|
@@ -156,25 +164,52 @@ $(document).ready(function($) { | |
}; | ||
|
||
var add_row = function() { | ||
var num_rows = $('#payout_table tbody').find('tr').length; | ||
let bountyId = $('#bountyId').val(); | ||
var num_rows = $('#payout_table tbody').find('tr.new-user').length; | ||
var percent = num_rows <= 1 ? 100 : ''; | ||
var denomination = $('#token_name').text(); | ||
var amount = get_amount(percent); | ||
let username = ''; | ||
var html = ` | ||
<tr> | ||
<tr class="new-user"> | ||
<td class="pl-0 pb-0"> | ||
<div class="pl-0"> | ||
<select onchange="update_registry()" class="username-search custom-select w-100 ml-auto mr-auto"></select> | ||
</div> | ||
</td> | ||
<td class="pb-0"><div class="percent" contenteditable="true">` + percent + `</div></td> | ||
<td class="pb-0"><div class="amount"><span class=amount>` + amount + '</span> <span class=denomination>' + denomination + `</span></div></td> | ||
<td class="pb-0"><div class="percent" contenteditable="true">${percent}</div></td> | ||
<td class="pb-0"><div class="amount"><span class=amount>${amount}</span> <span class=denomination>${denomination}</span></div></td> | ||
<td class="pb-0"><a class=remove href=#><i class="fas fa-times mt-2"></i></a> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td> | ||
<fieldset class="" id="${num_rows}-${bountyId}" > | ||
<label for="" class="form__label">Rate contributor</label> | ||
<div class="rating" data-open-rating=${bountyId} data-open-username=${username}> | ||
<input type="radio" id="${num_rows}-${bountyId}-5" name="${num_rows}${bountyId}" value="5" /> | ||
<label class ="rating-star full" for="${num_rows}-${bountyId}-5" data-toggle="tooltip" title="It was great - 5 stars"></label> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra space after |
||
<input type="radio" id="${num_rows}-${bountyId}-4" name="${num_rows}${bountyId}" value="4" /> | ||
<label class ="rating-star full" for="${num_rows}-${bountyId}-4" data-toggle="tooltip" title="It was good - 4 stars"></label> | ||
<input type="radio" id="${num_rows}-${bountyId}-3" name="${num_rows}${bountyId}" value="3" /> | ||
<label class ="rating-star full" for="${num_rows}-${bountyId}-3" data-toggle="tooltip" title="It was okay - 3 stars"></label> | ||
<input type="radio" id="${num_rows}-${bountyId}-2" name="${num_rows}${bountyId}" value="2" /> | ||
<label class ="rating-star full" for="${num_rows}-${bountyId}-2" data-toggle="tooltip" title="It was bad - 2 stars"></label> | ||
<input type="radio" id="${num_rows}-${bountyId}-1" name="${num_rows}${bountyId}" value="1" /> | ||
<label class ="rating-star full" for="${num_rows}-${bountyId}-1" data-toggle="tooltip" title="It was terrible - 1 star"></label> | ||
</div> | ||
</fieldset> | ||
</td> | ||
</tr>`; | ||
|
||
$('#payout_table tbody').append(html); | ||
userSearch('.username-search:last', true); | ||
$('body .username-search').each(function() { | ||
$(this).on('select2:select', event => { | ||
rateUser($(this)); | ||
}); | ||
}); | ||
|
||
$(this).focus(); | ||
}; | ||
|
||
|
@@ -185,11 +220,12 @@ $(document).ready(function($) { | |
$('.add_another').on('click', function() { | ||
add_row(); | ||
}); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra newline here |
||
}); | ||
}); | ||
|
||
var get_total_cost = function() { | ||
var rows = $('#payout_table tbody tr'); | ||
var rows = $('#payout_table tbody tr.new-user'); | ||
var total = 0; | ||
|
||
for (i = 0; i < rows.length; i += 1) { | ||
|
@@ -213,20 +249,20 @@ var update_registry = function(coinbase) { | |
}); | ||
return; | ||
} | ||
var num_rows = $('#payout_table tbody').find('tr').length; | ||
|
||
var num_rows = $('#payout_table tbody').find('tr.new-user').length; | ||
var tc = round(get_total_cost(), 2); | ||
var denomination = $('#token_name').text(); | ||
var original_amount = $('#original_amount').val(); | ||
var net = round(original_amount - tc, 2); | ||
var over = round((original_amount - get_total_cost()) * -1, 4); | ||
var addr = coinbase.substring(38); | ||
var pay_with_bounty = $('#pay_with_bounty').is(':checked'); | ||
|
||
$('#total_cost').html(tc + ' ' + denomination); | ||
|
||
let transactions = []; | ||
|
||
first_transaction = { | ||
'id': 0, | ||
'type': 'cancel', | ||
|
@@ -269,7 +305,7 @@ var update_registry = function(coinbase) { | |
|
||
for (let j = 1; j <= num_rows; j++) { | ||
|
||
var $row = $('#payout_table tbody').find('tr:nth-child(' + j + ')'); | ||
var $row = $('#payout_table tbody').find('.new-user:nth-child(' + j + ')'); | ||
var amount = parseFloat($row.find('.amount').text()); | ||
var username = $row.find('.username-search').text(); | ||
|
||
|
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
Oops, something went wrong.
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.
Should we switch these
var
declarations tolet
? I don't think theres a difference since they are both in the function scope