Skip to content

Commit

Permalink
Move Delete File and Delete Gist in more contextually appropriate places
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Aug 25, 2016
1 parent c8df947 commit 770768e
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 28 deletions.
10 changes: 5 additions & 5 deletions src/Gistlyn.Resources/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Gistlyn.Resources/css/app.min.css

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/Gistlyn.Resources/css/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
#tabs #files-menu:hover {
color: #ffc;
}
#tabs .delete {
font-size: 16px;
vertical-align: bottom;
padding: 0 0 0 5px;
cursor: pointer;
}
#tabs .delete:hover {
color: #f00;
}
.popup {
display: none;
position: absolute;
Expand Down
3 changes: 3 additions & 0 deletions src/Gistlyn/css/codemirror.css
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ span.CodeMirror-selectedtext { background: none; }
flex: 1;
overflow: auto;
}
.macintel .ReactCodeMirror {
margin-left: -3px;
}

.CodeMirror {
margin: 0;
Expand Down
9 changes: 9 additions & 0 deletions src/Gistlyn/css/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
#tabs #files-menu:hover {
color: #ffc;
}
#tabs .delete {
font-size: 16px;
vertical-align: bottom;
padding: 0 0 0 5px;
cursor: pointer;
}
#tabs .delete:hover {
color: #f00;
}
.popup {
display: none;
position: absolute;
Expand Down
4 changes: 3 additions & 1 deletion src/Gistlyn/src/Editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Gistlyn/src/Editor.js.map

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/Gistlyn/src/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { queryString, splitOnLast } from 'servicestack-client';
import { UA, getSortedFileNames, IGistFile } from './utils';
import { UA, getSortedFileNames, IGistFile, FileNames } from './utils';

import CodeMirror from 'react-codemirror';
import "jspm_packages/npm/[email protected]/addon/edit/matchbrackets.js";
Expand Down Expand Up @@ -149,7 +149,12 @@ export default class Editor extends React.Component<any, any> {
<div className={active ? 'active' : null}
onClick={e => !active ? this.props.selectFileName(fileName) : this.props.editFileName(fileName) }>
{this.props.editingFileName !== fileName
? <b>{fileName}</b>
? <b>
{fileName}
{ this.props.isOwner && active && FileNames.canDelete(fileName)
? <i className="material-icons delete" onClick={e => e.stopPropagation() || confirm(`Are you sure you want to delete file '${fileName}'?`) ? this.props.onDeleteFile(fileName) : null } title="delete file">cancel</i>
: null}
</b>
: <input type="text" className="txtFileName"
onBlur={e => this.props.onRenameFile(fileName, e) }
onKeyDown={e => e.keyCode === 13 ? (e.target as HTMLElement).blur() : null }
Expand Down
9 changes: 3 additions & 6 deletions src/Gistlyn/src/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Gistlyn/src/app.js.map

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions src/Gistlyn/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,6 @@ class App extends React.Component<any, any> {
if (authUsername) {
EditorPopup.push((
<div onClick={e => this.props.showDialog("edit-gist") }>Edit Gist</div>));
EditorPopup.push((
<div onClick={e => confirm(`Are you sure you want to delete this gist?`) ? this.deleteGist(this.props.gist) : null }>Delete Gist</div>));
}
EditorPopup.push((
<div onClick={e => this.props.showDialog("add-ss-ref") }>Add ServiceStack Reference</div>));
Expand Down Expand Up @@ -918,6 +916,7 @@ class App extends React.Component<any, any> {
updateSource={(fileName, src) => this.props.updateSource(fileName, src) }
onRenameFile={(fileName, e) => this.handleRenameFile(fileName, e) }
onCreateFile={e => this.handleCreateFile(e) }
onDeleteFile={fileName => this.deleteFile(fileName) }
onShortcut={keyPattern => this.onShortcut(keyPattern)} />

<div id="preview">
Expand All @@ -944,12 +943,10 @@ class App extends React.Component<any, any> {
<span className="octicon octicon-repo-forked" style={{ margin: "3px 3px 0 0" }}></span>
<p>{authUsername ? (shouldFork ? "Fork As" : "Save As") : "Sign-in to save"}</p>
</div>) }
{ meta && meta.owner_login === authUsername && this.props.activeFileName &&
this.props.activeFileName !== FileNames.GistMain &&
this.props.activeFileName !== FileNames.GistPackages
? (<div id="delete-file" onClick={e => confirm(`Are you sure you want to delete '${this.props.activeFileName}?`) ? this.deleteFile(this.props.activeFileName) : null }>
<i className="material-icons">delete </i>
<p>Delete File</p>
{ meta && meta.owner_login === authUsername
? (<div id="delete-file" onClick={e => confirm(`Are you sure you want to delete gist '${meta.description}'?`) ? this.deleteGist(this.props.gist) : null }>
<i className="material-icons">delete_forever</i>
<p>Delete Gist</p>
</div>)
: null }
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/Gistlyn/src/utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 770768e

Please sign in to comment.