-
Notifications
You must be signed in to change notification settings - Fork 157
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
[#2001] Extract c-file-type-checkboxes from Summary, Authorship and Zoom #2173
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
7fcf0af
Setup checkbox file
sopa301 155e368
Try to extract checkboxes
sopa301 9812c3d
Fix style
sopa301 334c911
Fix style
sopa301 1de3ff7
Fix failing test
sopa301 9d7dc8b
Refactor authorship
sopa301 bcd34b2
Merge branch 'master' of https://github.com/sopa301/RepoSense into 20…
sopa301 e5986e9
Fix style
sopa301 ae756ec
Fix style
sopa301 a585f07
Fix style
sopa301 9dfc322
Fix style
sopa301 e68c6e5
Refactor summary
sopa301 f54ab0c
Remove unused function
sopa301 30f2647
Fix style
sopa301 0403af7
Refactor unused functions
sopa301 1675a19
Merge branch 'master' of https://github.com/reposense/RepoSense into …
sopa301 8ae8cfb
Merge branch 'master' of https://github.com/reposense/RepoSense into …
sopa301 4c8246f
Fix style
sopa301 e66ceb5
Merge missed changes
sopa301 4d1884c
Fix bug in element title
sopa301 faa83a4
Refactor code to move away from v-html
sopa301 6623d56
Fix style
sopa301 88ef5df
Merge branch 'master' into 2001-checkbox
sopa301 57a8bfb
Abstract file hashes from checkbox component
sopa301 60b3e6b
Merge branch '2001-checkbox' of https://github.com/sopa301/RepoSense …
sopa301 8c73cdf
Fix naming of emit listeners
sopa301 b271257
Rename checkboxes file
sopa301 192c98d
Fix bug
sopa301 cae363d
Merge branch 'master' into 2001-checkbox
sopa301 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<template lang="pug"> | ||
.checkboxes.mui-form--inline(v-if="fileTypes.length > 0") | ||
label.all-checkbox | ||
input.mui-checkbox--fileType#all(type="checkbox", v-model="isAllChecked", value="all") | ||
span(v-if="allCheckboxLabel", v-bind:title="getTitle(allCheckboxLabel)") | ||
span {{ getLabel(allCheckboxLabel) }} | ||
span(v-else) All | ||
label( | ||
v-for="fileType, index in fileTypes", | ||
v-bind:key="fileType", | ||
v-bind:style="{\ | ||
'background-color': fileTypeColors[fileType],\ | ||
'color': getFontColor(fileTypeColors[fileType])\ | ||
}" | ||
) | ||
input.mui-checkbox--fileType(type="checkbox", v-bind:value="fileType", | ||
v-model="localSelectedFileTypes", v-bind:id="fileType") | ||
span(v-if="fileTypeCheckboxLabels", v-bind:title="getTitle(fileTypeCheckboxLabels[index])") | ||
span {{ getLabel(fileTypeCheckboxLabels[index]) }} | ||
span(v-else) {{ this.fileTypes[index] }} | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, PropType } from 'vue'; | ||
|
||
export default defineComponent({ | ||
name: 'c-file-type-checkboxes', | ||
props: { | ||
fileTypes: { | ||
type: Array as PropType<Array<string>>, | ||
required: true, | ||
}, | ||
fileTypeColors: { | ||
type: Object as PropType<Record<string, string>>, | ||
required: true, | ||
}, | ||
selectedFileTypes: { | ||
type: Array as PropType<Array<string>>, | ||
required: true, | ||
}, | ||
allCheckboxLabel: { | ||
type: Object as PropType<{ | ||
fileTitle: string, | ||
fileType: string, | ||
lineCount: number, | ||
blankLineCount: number, | ||
}>, | ||
default: undefined, | ||
}, | ||
fileTypeCheckboxLabels: { | ||
type: Array as PropType<Array<{ | ||
fileTitle: string, | ||
fileType: string, | ||
lineCount: number, | ||
blankLineCount: number, | ||
}>>, | ||
default: undefined, | ||
}, | ||
}, | ||
emits: ['update:selectedFileTypes', 'select-all-checked'], | ||
computed: { | ||
isAllChecked: { | ||
get(): boolean { | ||
return this.selectedFileTypes.length === this.fileTypes.length; | ||
}, | ||
set(value: boolean): void { | ||
if (value) { | ||
this.localSelectedFileTypes = this.fileTypes.slice(); | ||
} else { | ||
this.localSelectedFileTypes = []; | ||
} | ||
this.$emit('select-all-checked', value); | ||
}, | ||
}, | ||
localSelectedFileTypes: { | ||
get(): Array<string> { | ||
return this.selectedFileTypes; | ||
}, | ||
set(value: Array<string>): void { | ||
this.$emit('update:selectedFileTypes', value); | ||
}, | ||
}, | ||
}, | ||
methods: { | ||
getFontColor(color: string): string { | ||
return window.getFontColor(color); | ||
}, | ||
getTitle(label: { | ||
fileTitle: string, | ||
fileType: string, | ||
lineCount: number, | ||
blankLineCount: number, | ||
}): string { | ||
return `${label.fileTitle}: Blank: ${label.blankLineCount}, ` | ||
+ `Non-Blank: ${label.lineCount - label.blankLineCount}`; | ||
}, | ||
getLabel(label: { | ||
fileTitle: string, | ||
fileType: string, | ||
lineCount: number, | ||
blankLineCount: number, | ||
}): string { | ||
return `${label.fileType}\xA0\xA0` | ||
+ `${label.blankLineCount}\xA0\xA0` | ||
+ `(${label.lineCount - label.blankLineCount})\xA0`; | ||
}, | ||
}, | ||
}); | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.all-checkbox { | ||
background-color: #000000; | ||
color: #ffffff; | ||
} | ||
|
||
.mui-checkbox--fileType { | ||
vertical-align: middle; | ||
} | ||
</style> |
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.
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.
@sopa301 This must be showing "Line count (Line count - blank line count)", but this is "Blank line count (Line count - blank line count)" instead.
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.
Oops, I'll create a PR to fix it!