+
Skip to content

V1.0 coffee script -> es6 + rewrite with new apis #171

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

Merged
merged 20 commits into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions lib/components/BlameLine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use babel';

import { React } from 'react-for-atom';

const HASH_LENGTH = 7;

export default function BlameLine(props) {
const {
className,
hash,
noCommit,
date,
author,
showOnlyLastNames,
viewCommitUrl,
} = props;

return (
<div className={'blame-line ' + className}>
<a href={viewCommitUrl} className="hash">{hash.substring(0, HASH_LENGTH)}</a>
<span className="date">{date}</span>
<span className="committer text-highlight">{author}</span>
</div>
);
}
27 changes: 27 additions & 0 deletions lib/components/GutterResize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use babel';

import { isFunction } from 'lodash';
import React from 'react-for-atom';
import { compose, withHandlers } from 'recompose';

function GutterResize({children, onMouseDown}) {
return (
<div className="resize-container">
{children}
<div
className="resize"
onMouseDown={onMouseDown}
/>
</div>
);
}

export default compose(
withHandlers({
onMouseDown({ onResizeStart }) {
return function (e) {
return isFunction(onResizeStart) && onResizeStart(e.nativeEvent);
};
}
})
)(GutterResize);
28 changes: 28 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'use babel';

export default {
useCustomUrlTemplateIfStandardRemotesFail : {
type: 'boolean',
default: false
},
customCommitUrlTemplateString : {
type: 'string',
default: 'Example -> https://github.com/<%- project %>/<%- repo %>/commit/<%- revision %>'
},
columnWidth : {
type: 'integer',
default: 210
},
dateFormatString : {
type: 'string',
default: 'YYYY-MM-DD'
},
ignoreWhiteSpaceDiffs : {
type: 'boolean',
default: false
},
showOnlyLastNames : {
type: 'boolean',
default: true
},
}
53 changes: 0 additions & 53 deletions lib/controllers/blameViewController.js

This file was deleted.

76 changes: 0 additions & 76 deletions lib/git-blame.js

This file was deleted.

59 changes: 59 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use babel';

import { Directory } from 'pathwatcher';
import path from 'path';
import { CompositeDisposable } from 'atom';

import config from './config';
import Blamer from './util/blamer';
import BlameGutter from './util/BlameGutter';
import errorController from './controllers/errorController';

/**
* Main Package Module
*/
export default {

config,

disposables: null,
gutters: null,

activate() {
this.gutters = new Map();
this.disposables = new CompositeDisposable();
this.disposables.add(atom.commands.add('atom-workspace', {
'git-blame:toggle': this.toggle.bind(this),
}));
},

deactivate() {
this.disposables.dispose();
this.gutters.clear();
},

toggle() {
const editor = atom.workspace.getActiveTextEditor();

// if there is no active text editor, git-blame can do nothing
if (!editor) {
return;
}

// get a BlameGutter from the cache or create a new one and add
// it to the cache.
let gutter = this.gutters.get(editor);
if (!gutter) {
gutter = new BlameGutter(editor);
this.disposables.add(gutter);
this.gutters.set(editor, gutter);
}

// toggle visiblity of the active gutter
gutter.toggleVisibility()
.catch(e => {
console.error(e);
});
},

};
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载