Skip to content

Commit 770768e

Browse files
committed
Move Delete File and Delete Gist in more contextually appropriate places
1 parent c8df947 commit 770768e

File tree

14 files changed

+56
-28
lines changed

14 files changed

+56
-28
lines changed

src/Gistlyn.Resources/app.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Gistlyn.Resources/css/app.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Gistlyn.Resources/css/editor.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
#tabs #files-menu:hover {
2727
color: #ffc;
2828
}
29+
#tabs .delete {
30+
font-size: 16px;
31+
vertical-align: bottom;
32+
padding: 0 0 0 5px;
33+
cursor: pointer;
34+
}
35+
#tabs .delete:hover {
36+
color: #f00;
37+
}
2938
.popup {
3039
display: none;
3140
position: absolute;

src/Gistlyn/css/codemirror.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ span.CodeMirror-selectedtext { background: none; }
358358
flex: 1;
359359
overflow: auto;
360360
}
361+
.macintel .ReactCodeMirror {
362+
margin-left: -3px;
363+
}
361364

362365
.CodeMirror {
363366
margin: 0;

src/Gistlyn/css/editor.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@
2626
#tabs #files-menu:hover {
2727
color: #ffc;
2828
}
29+
#tabs .delete {
30+
font-size: 16px;
31+
vertical-align: bottom;
32+
padding: 0 0 0 5px;
33+
cursor: pointer;
34+
}
35+
#tabs .delete:hover {
36+
color: #f00;
37+
}
2938
.popup {
3039
display: none;
3140
position: absolute;

src/Gistlyn/src/Editor.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Gistlyn/src/Editor.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Gistlyn/src/Editor.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import { queryString, splitOnLast } from 'servicestack-client';
3-
import { UA, getSortedFileNames, IGistFile } from './utils';
3+
import { UA, getSortedFileNames, IGistFile, FileNames } from './utils';
44

55
import CodeMirror from 'react-codemirror';
66
import "jspm_packages/npm/[email protected]/addon/edit/matchbrackets.js";
@@ -149,7 +149,12 @@ export default class Editor extends React.Component<any, any> {
149149
<div className={active ? 'active' : null}
150150
onClick={e => !active ? this.props.selectFileName(fileName) : this.props.editFileName(fileName) }>
151151
{this.props.editingFileName !== fileName
152-
? <b>{fileName}</b>
152+
? <b>
153+
{fileName}
154+
{ this.props.isOwner && active && FileNames.canDelete(fileName)
155+
? <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>
156+
: null}
157+
</b>
153158
: <input type="text" className="txtFileName"
154159
onBlur={e => this.props.onRenameFile(fileName, e) }
155160
onKeyDown={e => e.keyCode === 13 ? (e.target as HTMLElement).blur() : null }

src/Gistlyn/src/app.js

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Gistlyn/src/app.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Gistlyn/src/app.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,6 @@ class App extends React.Component<any, any> {
814814
if (authUsername) {
815815
EditorPopup.push((
816816
<div onClick={e => this.props.showDialog("edit-gist") }>Edit Gist</div>));
817-
EditorPopup.push((
818-
<div onClick={e => confirm(`Are you sure you want to delete this gist?`) ? this.deleteGist(this.props.gist) : null }>Delete Gist</div>));
819817
}
820818
EditorPopup.push((
821819
<div onClick={e => this.props.showDialog("add-ss-ref") }>Add ServiceStack Reference</div>));
@@ -918,6 +916,7 @@ class App extends React.Component<any, any> {
918916
updateSource={(fileName, src) => this.props.updateSource(fileName, src) }
919917
onRenameFile={(fileName, e) => this.handleRenameFile(fileName, e) }
920918
onCreateFile={e => this.handleCreateFile(e) }
919+
onDeleteFile={fileName => this.deleteFile(fileName) }
921920
onShortcut={keyPattern => this.onShortcut(keyPattern)} />
922921

923922
<div id="preview">
@@ -944,12 +943,10 @@ class App extends React.Component<any, any> {
944943
<span className="octicon octicon-repo-forked" style={{ margin: "3px 3px 0 0" }}></span>
945944
<p>{authUsername ? (shouldFork ? "Fork As" : "Save As") : "Sign-in to save"}</p>
946945
</div>) }
947-
{ meta && meta.owner_login === authUsername && this.props.activeFileName &&
948-
this.props.activeFileName !== FileNames.GistMain &&
949-
this.props.activeFileName !== FileNames.GistPackages
950-
? (<div id="delete-file" onClick={e => confirm(`Are you sure you want to delete '${this.props.activeFileName}?`) ? this.deleteFile(this.props.activeFileName) : null }>
951-
<i className="material-icons">delete </i>
952-
<p>Delete File</p>
946+
{ meta && meta.owner_login === authUsername
947+
? (<div id="delete-file" onClick={e => confirm(`Are you sure you want to delete gist '${meta.description}'?`) ? this.deleteGist(this.props.gist) : null }>
948+
<i className="material-icons">delete_forever</i>
949+
<p>Delete Gist</p>
953950
</div>)
954951
: null }
955952
</div>

src/Gistlyn/src/utils.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)