├── .editorconfig ├── .eslintrc ├── .gitignore ├── .jscsrc ├── .travis.yml ├── LICENSE ├── README.md ├── gulpfile.babel.js ├── html └── options.html ├── img └── edit.png ├── manifest.json ├── package.json ├── readme-images ├── auto-fill-config.png ├── chrome-extensions-page.png ├── enable-developer-mode.png ├── git-splainin-access-options.png ├── git-splainin-extensions-listing.png ├── icon-on-url-field.png ├── icon-options.png ├── load-template-url.png ├── load-unpacked-extension.png ├── options-page.png ├── select-application-directory.png ├── set-options.png ├── use-git-splainin.png └── verify-application-directory.png ├── src ├── actions │ ├── config.js │ ├── edit-template.js │ └── sync-template.js ├── alt.js ├── background.js ├── components │ ├── config-tab.js │ ├── layout.js │ └── template-tab.js ├── fill-pull-body.js ├── lib │ ├── client.js │ ├── get-content.js │ └── get-error-message.js ├── options.js ├── primed │ ├── README.md │ ├── button.js │ ├── checkbox.js │ ├── menu-item.js │ └── menu.js └── stores │ ├── config.js │ └── template.js ├── style └── options.css ├── vendor ├── octicons │ ├── LICENSE.txt │ ├── octicons.css │ ├── octicons.eot │ ├── octicons.svg │ ├── octicons.ttf │ ├── octicons.woff │ ├── pr128.png │ ├── pr19.png │ ├── pr38.png │ └── pr48.png └── primer │ ├── license.md │ └── primer.css └── webpack.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "ecmaFeatures": { 3 | "jsx": true 4 | }, 5 | "rules": { 6 | "semi": [2, "always"], 7 | "quotes": [2, "single"], 8 | "strict": [2, "global"], 9 | "no-underscore-dangle": 0 10 | }, 11 | "env": { 12 | "es6": true, 13 | "browser": true, 14 | "node": true 15 | }, 16 | "globals": { 17 | "chrome": true 18 | }, 19 | "plugins": [ 20 | "react" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Commenting this out is preferred by some people, see 24 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- 25 | node_modules 26 | 27 | # Users Environment Variables 28 | .lock-wscript 29 | 30 | # Garbage files 31 | .DS_Store 32 | 33 | # Built files 34 | /background.js 35 | /options.js 36 | /fill-pull-body.js 37 | /dist 38 | -------------------------------------------------------------------------------- /.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "preset": "node-style-guide", 3 | "esnext": true, 4 | "esprima": "esprima-fb", 5 | "disallowSpaceAfterKeywords": [ 6 | "if", 7 | "for", 8 | "while" 9 | ], 10 | "disallowSpacesInFunction": { 11 | "beforeOpeningCurlyBrace": true, 12 | "beforeOpeningRoundBrace": true 13 | }, 14 | "maximumLineLength": null, 15 | "requireSpaceAfterKeywords": [ 16 | "else", 17 | "try", 18 | "catch", 19 | "do", 20 | "switch" 21 | ], 22 | "requireSpaceBeforeBlockStatements": null, 23 | "requireSpaceBeforeKeywords": [ 24 | "else", 25 | "catch" 26 | ], 27 | "requireSpacesInFunction": null, 28 | "requireTrailingComma": null 29 | } 30 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - 'iojs' 5 | - '0.12' 6 | - '0.10' 7 | # whenever a tag is pushed, build and push to github releases 8 | before_deploy: npm run release 9 | deploy: 10 | provider: releases 11 | api_key: $GH_TOKEN 12 | file: "dist/git-splainin.zip" 13 | skip_cleanup: true 14 | on: 15 | tags: true 16 | node: '0.10' 17 | all_branches: true 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Iced Development 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # git-splainin 2 | GitHub PR Template Chrome Extension 3 | 4 | It's time to crush the boilerplate text of Github PR templates. This chrome plugin makes it super easy to get your PRs off to a good start. All you'll need is your PR template text or a link to the PR template your team uses, and then... you need to install this extension. And like that you will become Lord of Github PR Maesters. 5 | 6 | Let's Begin. 7 | 8 | ###Download Options: 9 | 1. The **easy-peasy option** is to get the latest published version from the Chrome webstore, [go here](https://chrome.google.com/webstore/detail/git-splainin/adbhpaolgdpdjmejdnpakfncfkdneeea). After installing you will come back here to learn how to [use it right](#use-it-right). 10 | 1. The **quite easy option** is to get the latest release from the project Github repo, [go here](https://github.com/iceddev/git-splainin/releases/latest) for that. You also can get access to prior versions [here](https://github.com/iceddev/git-splainin/releases). Again, after installing you will come back to [install it good](#install-it-good) and [use it right](#use-it-right). 11 | 1. Choose the **advanced developer option** to develop and [build from source](#build-from-source). The following instructions assume you have git, node.js and npm. If you don't have these, you have to [get the tools](#get-tools-if-you-need-them) and do a little set-up: 12 | 13 | 14 | ###Get tools if you need them 15 | * [I need git](http://git-scm.com/book/en/v2/Getting-Started-Installing-Git) 16 | * [I need node.js and npm](https://nodejs.org/download/) 17 | 18 | 19 | ###Build from Source 20 | 1. **Get the Source:** Go to your terminal, navigate to the directory where you want to keep the files. From within this directory enter: 21 | 22 | `git clone git://github.com/iceddev/git-splainin.git` 23 | 24 | 1. **Get into the Project:** Go into the directory and get packages with: 25 | 26 | `cd git-splainin && npm install` 27 | 28 | 1. **Build the Application:** Compile all the source and packages into an application you can install from Chrome. In terminal enter: 29 | 30 | `npm run build` 31 | 32 | OR 33 | 34 | _`npm run serve` -- if you are developing and want a dev server to update automatically with file changes._ 35 | 36 | 1. Feel awesome, the hard part is done. Now to install in Chrome. 37 | 38 | 39 | ###Install it good: 40 | 1. Verify the application is now unpacked in a known directory. 41 | 42 | ![Verify directory](/readme-images/verify-application-directory.png) 43 | 44 | 1. In Chrome, go to the menu --> More Tools --> Extensions 45 | 46 | ![Go to extensions page](/readme-images/chrome-extensions-page.png) 47 | 48 | 1. Enable 'Developer Mode' 49 | 50 | !['developer mode' Checkbox](/readme-images/enable-developer-mode.png) 51 | 52 | 1. Select "Load Unpacked Extension" and select the folder 53 | 54 | ![Load unpacked extension](/readme-images/load-unpacked-extension.png) 55 | 56 | 1. Select application directory 57 | 58 | ![Select application Directory](/readme-images/select-application-directory.png) 59 | 60 | 1. Enjoy! You should have confirmation in two places. 61 | 62 | * When you look in the extension listing 63 | 64 | ![git-splaining in extensions listing](/readme-images/git-splainin-extensions-listing.png) 65 | 66 | * When you go to a Github 'New Pull Request' page. You should see an icon in the url bar. 67 | 68 | ![Github pull request page](/readme-images/icon-on-url-field.png) 69 | 70 | Your life is about to get incrementally easier. There are a couple options you need to set and you will be well on your way. 71 | 72 | 73 | ###Use it right: 74 | 1. **Get to the Options page:** 75 | 76 | * From the extensions listing view 77 | 78 | ![Get to option from the extension listing](/readme-images/git-splainin-access-options.png) 79 | 80 | -- Or -- 81 | 82 | * by right-clicking on the icon in the url bar 83 | 84 | ![Get to options through the icon](/readme-images/icon-options.png) 85 | 86 | 1. **The Options Page:** Simple, no-frills configuration. You can either manually enter the template text or point to a source. 87 | 88 | ![Look at the Options Page](/readme-images/set-options.png) 89 | 90 | 1. **To Point to the Template:** We need to point to the application to the PR template you want to use. You will need to point to HTML, Markdown, or plain text. Github allows you to pull the raw content from the a url, click load and then save, as in the example. 91 | 92 | ![Enter Source URL](/readme-images/load-template-url.png) 93 | 94 | 1. **Use it:** When you go a Github New PR Form, you can simply click on the icon and it will inject your template into the form. Voila! Edit the field as needed and 'Create Pull Request'. 95 | 96 | ![Use Git-Splainin](/readme-images/use-git-splainin.png) 97 | 98 | ###Extra Option: 99 | 1. **Auto-Fill:** You can easily auto-fill anytime you find yourself on a New PR Form. To do that, go to the options page as outlined in [use it right](#use-it-right). Then click on the 'configuration' tab as shown. 100 | 101 | ![Select Config Tab](/readme-images/auto-fill-config.png) 102 | 103 | 104 | -------------------------------------------------------------------------------- /gulpfile.babel.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const del = require('del'); 4 | const gulp = require('gulp'); 5 | const zip = require('gulp-zip'); 6 | const jscs = require('gulp-jscs'); 7 | const gutil = require('gulp-util'); 8 | const webpack = require('webpack'); 9 | const eslint = require('gulp-eslint'); 10 | 11 | const webpackConfig = require('./webpack.config'); 12 | 13 | const files = { 14 | release: [ 15 | 'manifest.json', 16 | 'options.js', 17 | 'fill-pull-body.js', 18 | 'background.js', 19 | 'html/**', 20 | 'img/**', 21 | 'style/**', 22 | 'vendor/**' 23 | ] 24 | }; 25 | 26 | function bundle(callback){ 27 | webpack(webpackConfig, function(err){ 28 | gutil.log('Webpack bundle complete!'); 29 | callback(err); 30 | }); 31 | } 32 | 33 | function lint(){ 34 | return gulp.src('src/**/*.js') 35 | .pipe(eslint()) 36 | .pipe(eslint.format()) 37 | .pipe(jscs()) 38 | .pipe(eslint.failAfterError()); 39 | } 40 | 41 | function postinstall(callback){ 42 | del('node_modules/**/*.pem', callback); 43 | } 44 | 45 | function release(){ 46 | return gulp.src(files.release, { base: __dirname }) 47 | .pipe(zip('git-splainin.zip')) 48 | .pipe(gulp.dest('dist')); 49 | } 50 | 51 | gulp.task(lint); 52 | gulp.task(postinstall); 53 | gulp.task('release', gulp.series(bundle, release)); 54 | gulp.task('default', gulp.parallel(bundle)); 55 | 56 | -------------------------------------------------------------------------------- /html/options.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options 4 | 5 | 6 | 7 | 8 | 9 |
10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /img/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/img/edit.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | 4 | "name": "Git-Splainin", 5 | "description": "You've got some git-splainin' to do", 6 | "version": "1.0.0", 7 | "background": { 8 | "scripts": ["background.js"] 9 | }, 10 | "icons": { 11 | "48": "vendor/octicons/pr48.png", 12 | "128": "vendor/octicons/pr128.png" 13 | }, 14 | "page_action": { 15 | "default_icon": { 16 | "19": "vendor/octicons/pr19.png", 17 | "38": "vendor/octicons/pr38.png" 18 | }, 19 | "default_title": "git-splainin: Git PR template" 20 | }, 21 | "options_ui": { 22 | "page": "html/options.html", 23 | "chrome_style": false, 24 | "open_in_tab": true 25 | }, 26 | "permissions": [ 27 | "http://*/", 28 | "https://*/", 29 | "tabs", 30 | "storage" 31 | ], 32 | "content_scripts": [ 33 | { 34 | "matches": ["https://github.com/*"], 35 | "js": ["fill-pull-body.js"], 36 | "run_at": "document_end" 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "git-splainin", 3 | "version": "1.0.0", 4 | "description": "GitHub PR Template Chrome Extension", 5 | "author": "Blaine Bublitz (http://iceddev.com)", 6 | "contributors": [], 7 | "repository": "iceddev/git-splainin", 8 | "license": "MIT", 9 | "engines": { 10 | "node": ">= 0.10" 11 | }, 12 | "main": "index.js", 13 | "files": [ 14 | "LICENSE", 15 | "index.js" 16 | ], 17 | "scripts": { 18 | "test": "gulp lint", 19 | "build": "gulp", 20 | "postinstall": "gulp postinstall", 21 | "release": "gulp release", 22 | "serve": "webpack-dev-server", 23 | "watch": "gulp --watch" 24 | }, 25 | "dependencies": { 26 | "alt": "^0.16.6", 27 | "chromeback": "^0.1.0", 28 | "classnames": "^2.1.1", 29 | "react": "^0.13.3", 30 | "lodash": "^3.8.0", 31 | "rest": "^1.3.1", 32 | "sovereign": "^0.1.1" 33 | }, 34 | "devDependencies": { 35 | "babel": "^5.5.4", 36 | "babel-core": "^5.3.3", 37 | "babel-loader": "^5.0.0", 38 | "del": "^1.2.0", 39 | "eslint": "^0.21.2", 40 | "eslint-plugin-react": "^2.3.0", 41 | "esprima-fb": "^15001.1.0-dev-harmony-fb", 42 | "gulp": "git://github.com/gulpjs/gulp#4.0", 43 | "gulp-eslint": "^0.12.0", 44 | "gulp-jscs": "^1.6.0", 45 | "gulp-util": "^3.0.4", 46 | "gulp-zip": "^3.0.2", 47 | "webpack": "^1.9.5", 48 | "webpack-dev-server": "^1.8.2", 49 | "when": "^3.7.3" 50 | }, 51 | "keywords": [ 52 | "chrome extension", 53 | "github", 54 | "pull request", 55 | "template" 56 | ] 57 | } 58 | -------------------------------------------------------------------------------- /readme-images/auto-fill-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/auto-fill-config.png -------------------------------------------------------------------------------- /readme-images/chrome-extensions-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/chrome-extensions-page.png -------------------------------------------------------------------------------- /readme-images/enable-developer-mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/enable-developer-mode.png -------------------------------------------------------------------------------- /readme-images/git-splainin-access-options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/git-splainin-access-options.png -------------------------------------------------------------------------------- /readme-images/git-splainin-extensions-listing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/git-splainin-extensions-listing.png -------------------------------------------------------------------------------- /readme-images/icon-on-url-field.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/icon-on-url-field.png -------------------------------------------------------------------------------- /readme-images/icon-options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/icon-options.png -------------------------------------------------------------------------------- /readme-images/load-template-url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/load-template-url.png -------------------------------------------------------------------------------- /readme-images/load-unpacked-extension.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/load-unpacked-extension.png -------------------------------------------------------------------------------- /readme-images/options-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/options-page.png -------------------------------------------------------------------------------- /readme-images/select-application-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/select-application-directory.png -------------------------------------------------------------------------------- /readme-images/set-options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/set-options.png -------------------------------------------------------------------------------- /readme-images/use-git-splainin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/use-git-splainin.png -------------------------------------------------------------------------------- /readme-images/verify-application-directory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iceddev/git-splainin/b4d6cbe4704500e5d4e37a0bac7efa884c10c933/readme-images/verify-application-directory.png -------------------------------------------------------------------------------- /src/actions/config.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const alt = require('../alt'); 4 | 5 | class ConfigActions { 6 | setConfig(settings){ 7 | this.dispatch(settings); 8 | } 9 | } 10 | 11 | module.exports = alt.createActions(ConfigActions); 12 | -------------------------------------------------------------------------------- /src/actions/edit-template.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const alt = require('../alt'); 4 | 5 | class EditTemplateActions { 6 | cancelChanges(){ 7 | this.dispatch(); 8 | } 9 | 10 | setDeltaTemplate(newTemplate){ 11 | this.dispatch(newTemplate); 12 | } 13 | 14 | setDeltaUrl(newUrl){ 15 | this.dispatch(newUrl); 16 | } 17 | } 18 | 19 | module.exports = alt.createActions(EditTemplateActions); 20 | -------------------------------------------------------------------------------- /src/actions/sync-template.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const alt = require('../alt'); 4 | 5 | class SyncTemplateActions { 6 | fetchNewTemplate(settings){ 7 | this.dispatch(settings); 8 | } 9 | 10 | submitTemplate(){ 11 | this.dispatch(); 12 | } 13 | } 14 | 15 | module.exports = alt.createActions(SyncTemplateActions); 16 | -------------------------------------------------------------------------------- /src/alt.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const Alt = require('alt'); 4 | const alt = new Alt(); 5 | 6 | module.exports = alt; 7 | -------------------------------------------------------------------------------- /src/background.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const getContent = require('./lib/get-content'); 4 | 5 | chrome.storage.sync.get(['templateUrl', 'prTemplate', 'autoFill'], function({templateUrl, prTemplate, autoFill}){ 6 | if(!prTemplate){ 7 | if(!templateUrl){ 8 | chrome.storage.sync.set({ 9 | templateUrl: 'http://cdn.rawgit.com/iceddev/getting-started/master/pr-template.md' 10 | }, getContent); 11 | } else { 12 | getContent(); 13 | } 14 | } 15 | if(autoFill === undefined){ 16 | chrome.storage.sync.set({ autoFill: false }); 17 | } 18 | }); 19 | 20 | chrome.pageAction.onClicked.addListener(function(){ 21 | chrome.tabs.query({ active: true, currentWindow: true }, function(tabs){ 22 | chrome.tabs.sendMessage(tabs[0].id, { fillPR: true }); 23 | }); 24 | }); 25 | 26 | chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab){ 27 | const regexUrl = /https:\/\/github\.com\/.*\/.*\/compare\/..*/; 28 | if(regexUrl.test(tab.url)){ 29 | chrome.pageAction.show(tabId); 30 | chrome.storage.sync.get('autoFill', function(res){ 31 | if(res.autoFill){ 32 | chrome.tabs.sendMessage(tabId, { autoFill: true }); 33 | } 34 | }); 35 | } else { 36 | chrome.pageAction.hide(tabId); 37 | } 38 | }); 39 | -------------------------------------------------------------------------------- /src/components/config-tab.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | const { createContainer } = require('sovereign'); 5 | 6 | const Checkbox = require('../primed/checkbox'); 7 | const configStore = require('../stores/config'); 8 | const { setConfig } = require('../actions/config'); 9 | 10 | class ConfigTab extends React.Component { 11 | constructor(...args){ 12 | super(...args); 13 | } 14 | config(event){ 15 | setConfig(event.target.checked); 16 | } 17 | renderError(){ 18 | const { errorMessage } = this.props; 19 | 20 | if(errorMessage){ 21 | return ( 22 |
23 | {errorMessage} 24 |
25 | ); 26 | } 27 | } 28 | render(){ 29 | const { autoFill } = this.props; 30 | 31 | const note = ( 32 | This will cause every Pull Request to be populated automatically. 33 | ); 34 | 35 | return ( 36 |
37 | {this.renderError()} 38 |
39 |
40 | 41 |
42 |
43 | 44 | Enable auto-fill 45 | 46 |
47 |
48 |
49 | ); 50 | } 51 | } 52 | 53 | module.exports = createContainer(ConfigTab, { 54 | getStores(){ 55 | return { 56 | config: configStore 57 | }; 58 | }, 59 | 60 | getPropsFromStores(){ 61 | return configStore.getState(); 62 | } 63 | }); 64 | -------------------------------------------------------------------------------- /src/components/layout.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | 5 | const ConfigTab = require('./config-tab'); 6 | const TemplateTab = require('./template-tab'); 7 | 8 | const Menu = require('../primed/menu'); 9 | const MenuItem = require('../primed/menu-item'); 10 | 11 | class Layout extends React.Component { 12 | constructor(...args){ 13 | super(...args); 14 | 15 | this.state = { 16 | tab: 0 17 | }; 18 | } 19 | 20 | updateTab(idx, evt){ 21 | evt.preventDefault(); 22 | 23 | this.setState({ 24 | tab: idx 25 | }); 26 | } 27 | 28 | render(){ 29 | const { tab } = this.state; 30 | 31 | let TabComponent; 32 | if(tab === 0){ 33 | TabComponent = TemplateTab; 34 | } 35 | 36 | if(tab === 1){ 37 | TabComponent = ConfigTab; 38 | } 39 | 40 | return ( 41 |
42 |

Git-Splainin Options

43 |
44 |
45 | 46 | this.updateTab(0, evt)}> 47 | 48 | Template 49 | 50 | this.updateTab(1, evt)}> 51 | 52 | Configuration 53 | 54 | 55 |
56 | 57 |
58 |
59 | ); 60 | } 61 | } 62 | 63 | module.exports = Layout; 64 | -------------------------------------------------------------------------------- /src/components/template-tab.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const React = require('react'); 4 | const { createContainer } = require('sovereign'); 5 | 6 | const Button = require('../primed/button'); 7 | const templateStore = require('../stores/template'); 8 | const { fetchNewTemplate, submitTemplate } = require('../actions/sync-template'); 9 | const { cancelChanges, setDeltaUrl, setDeltaTemplate } = require('../actions/edit-template'); 10 | 11 | class TemplateTab extends React.Component { 12 | constructor(...args){ 13 | super(...args); 14 | } 15 | renderError(){ 16 | const { errorMessage } = this.props; 17 | 18 | if(errorMessage){ 19 | return ( 20 |
21 | {errorMessage} 22 |
23 | ); 24 | } 25 | } 26 | templateChange(event){ 27 | setDeltaTemplate(event.target.value); 28 | } 29 | urlChange(event){ 30 | setDeltaUrl(event.target.value); 31 | } 32 | render(){ 33 | const { deltaUrl, deltaTemplate, disableSubmit, disableCancel } = this.props; 34 | 35 | return ( 36 |
37 | {this.renderError()} 38 |
39 |
40 | 41 |
42 |
43 |