-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add field for github api token to options page (#330)
* Tweak options layout * Add github token field * Do not track sensitive data * Do request with token * Pull primer-css from npm * Set default token option to empty string. This way, it won't look like it's already filled in, even though it's really just 'undefined'. Screenshot: ![](https://cloud.githubusercontent.com/assets/6473925/24378551/5a5c23d2-1311-11e7-84cc-ee19b371294b.png)
- Loading branch information
1 parent
7c785a5
commit 25b64d9
Showing
12 changed files
with
153 additions
and
40 deletions.
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,12 @@ | ||
body { | ||
user-select: none; | ||
padding: 0 15px; | ||
} | ||
|
||
label { | ||
font-size: 12px; | ||
} | ||
|
||
.form-checkbox input[type=checkbox], .form-checkbox input[type=radio] { | ||
margin-top: 2px; | ||
} |
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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
export default ({ name, label, value, defaultValue }) => { | ||
export default ({ name, label, value, defaultValue, description }) => { | ||
const val = (value === undefined) ? defaultValue : value; | ||
const note = description ? `<p class="note">${description}</p>` : ''; | ||
|
||
return `<section> | ||
return `<div class="form-checkbox"> | ||
<label> | ||
<input type="checkbox" name="${name}" ${val ? 'checked' : ''} /> ${label} | ||
</label> | ||
</section>`; | ||
<input type="checkbox" name="${name}" ${val ? 'checked' : ''}> | ||
${label} | ||
</label>${note} | ||
</div>`; | ||
}; |
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import checkbox from './checkbox'; | ||
import input from './input'; | ||
|
||
export default function ({ type, ...rest }) { | ||
if (type === 'checkbox') { | ||
return checkbox(rest); | ||
} else if (type === 'text' || type === 'password') { | ||
return input({ type, ...rest }); | ||
} | ||
} |
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,9 @@ | ||
export default ({ type, name, label, value, defaultValue, description }) => { | ||
const val = (value === undefined) ? defaultValue : value; | ||
const note = description ? `<p class="note">${description}</p>` : ''; | ||
|
||
return `<dl class="form-group"> | ||
<dt><label>${label}</label></dt> | ||
<dd><input class="form-control" type="${type}" name="${name}" value="${val}">${note}</dd> | ||
</dl>`; | ||
}; |
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 |
---|---|---|
@@ -1,44 +1,45 @@ | ||
export const options = [ | ||
{ | ||
type: 'password', | ||
name: 'githubToken', | ||
label: 'Access token', | ||
sensitiveData: true, | ||
description: 'If you want better <strong>Sass, Less or Haskell support</strong> for private repositories, you\'ll need to <a href="https://github.com/settings/tokens/new?scopes=repo&description=OctoLinker%20browser%20extension">create a token</a> with the repo permissions.', | ||
defaultValue: '', | ||
}, | ||
{ | ||
type: 'checkbox', | ||
name: 'newWindow', | ||
label: 'Open link in new tab', | ||
value: undefined, | ||
label: 'New tab', | ||
description: 'Open link in a new tab.', | ||
defaultValue: false, | ||
}, | ||
{ | ||
type: 'checkbox', | ||
name: 'newWindowActive', | ||
label: 'Focus new tabs', | ||
value: undefined, | ||
label: 'Focus new tab', | ||
description: 'Focus new tab when opening a link.', | ||
defaultValue: true, | ||
}, | ||
{ | ||
type: 'checkbox', | ||
name: 'showLinkIndicator', | ||
label: 'Show indicator if line contains OctoLinker links', | ||
value: undefined, | ||
defaultValue: true, | ||
}, | ||
{ | ||
type: 'checkbox', | ||
name: 'doTrack', | ||
label: 'Send anonymous usage reports to Google Analytics', | ||
value: undefined, | ||
label: 'Line indicator', | ||
description: 'Show an indicator if line contains OctoLinker links.', | ||
defaultValue: true, | ||
}, | ||
{ | ||
type: 'checkbox', | ||
name: 'showUpdateNotification', | ||
label: 'Show update notification', | ||
value: undefined, | ||
label: 'Update notification', | ||
description: 'Show a notification if a new version is available.', | ||
defaultValue: true, | ||
}, | ||
{ | ||
type: 'checkbox', | ||
name: 'debugMode', | ||
label: 'Debug mode', | ||
value: undefined, | ||
defaultValue: false, | ||
name: 'doTrack', | ||
label: 'Usage reports', | ||
description: 'Send anonymous usage reports to Google Analytics.', | ||
defaultValue: true, | ||
}, | ||
]; |
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
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