Skip to content

Commit

Permalink
min width for placed votes in bar
Browse files Browse the repository at this point in the history
  • Loading branch information
santisiri committed Oct 27, 2017
1 parent ec40bd4 commit 3c35a55
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions imports/ui/modules/Vote.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ export class Vote {
const MAX_PERCENTAGE_PRECISION = 7;
const barWidth = $(`#voteBar-${this.voteId}`).width();
const placedWidth = $(`#votePlaced-${this.voteId}`).width();
console.log(placedWidth);
const precisionRange = parseInt((MAX_PERCENTAGE_PRECISION * barWidth) / 100, 10);
const precisionValue = parseInt((inputPixels * MAX_VOTES_PRECISION) / precisionRange, 10);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@
<div id="voteHandle-{{_id}}" class="handle"></div>
{{/if}}
</div>
<div id="votePlaced-{{_id}}" class="result-bar vote-bar vote-bar-allocated {{unanimous 'placed'}} {{fixed 'placed'}}" style=" width: {{placed}} "></div>
<div id="votePlaced-{{_id}}" class="result-bar vote-bar vote-bar-allocated {{unanimous 'placed'}} {{fixed 'placed'}}" style=" width: {{placed}}; {{min}}"></div>
</div>
</template>
6 changes: 6 additions & 0 deletions imports/ui/templates/components/decision/liquid/liquid.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@ Template.bar.helpers({
placed() {
return agreement(this._id, this.editable);
},
min() {
if (agreement(this._id, this.editable).toNumber() > 0) {
return 'min-width: 10px;';
}
return '';
},
unanimous(value) {
const quantity = parseInt(Session.get(this._id)[value] - Session.get(this._id).inBallot, 10);
if (quantity === Session.get(this._id).balance) {
Expand Down
1 change: 0 additions & 1 deletion imports/ui/templates/layout/sidebar/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ function getList(db, sort) {
*/
function getDelegates() {
const delegates = _.sortBy(getDelegatesMenu(), (user) => { return parseInt(0 - (user.sent + user.received), 10); });
console.log(delegates);
const delegateList = [];
for (const i in delegates) {
delegateList.push(Meteor.users.find({ _id: delegates[i].userId }).fetch()[0]);
Expand Down

0 comments on commit 3c35a55

Please sign in to comment.