Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Unified Diff: fiddle/res/imp/fiddle-sk.html

Issue 1912793002: fiddle: Don't overwrite existing fiddle names unintentionally. (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« fiddle/go/named/named.go ('K') | « fiddle/go/named/named_test.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fiddle/res/imp/fiddle-sk.html
diff --git a/fiddle/res/imp/fiddle-sk.html b/fiddle/res/imp/fiddle-sk.html
index d5c2425a8b3f4b03b1c3024c923170e614ae7ab6..ee940111c8fe4b6c215b6c6fcc70172c65ae50b6 100644
--- a/fiddle/res/imp/fiddle-sk.html
+++ b/fiddle/res/imp/fiddle-sk.html
@@ -19,6 +19,7 @@
-->
<link rel="stylesheet" href="/res/common/css/md.css" type="text/css" media="all">
<link rel="import" href="bower_components/paper-spinner/paper-spinner.html">
+<link rel="import" href="bower_components/paper-checkbox/paper-checkbox.html">
<link rel="import" href="/res/common/imp/9/details-summary.html">
<link rel="import" href="/res/common/imp/9/toggle.html">
<link rel="import" href="/res/imp/bower_components/paper-input/paper-input.html">
@@ -173,9 +174,10 @@
<toggle-display-sk disabled$={{_not_logged_in}}>Name</toggle-display-sk>
<div id=namer>
<h3>Create a name for this fiddle:</h3>
- <paper-input id=name label="Name" size=40 auto-validate allowed-pattern="[0-9a-zA-Z_]" value=""></paper-input>
+ <paper-input id=name label="Name" placeholder="fiddle_name_goes_here" size=40 auto-validate allowed-pattern="[0-9a-zA-Z_]" value="{{_name}}"></paper-input>
<!-- Add a pop-up menu here that has completions based on what's been typed so far, and also any names that this page has loaded previously.-->
- <button class=save on-tap="_submit_name">Save</button>
+ <paper-checkbox id=overwrite title="Overwrite the existing name if one exists.">Overwrite</paper-checkbox>
+ <button class=save on-tap="_submit_name" disabled="{{_isEmpty(_name)}}">Save</button>
</div>
</div>
@@ -271,7 +273,12 @@
type: Boolean,
value: true,
reflectToAttribute: false,
- }
+ },
+ _name: {
+ type: String,
+ value: "",
+ reflectToAttribute: false,
+ },
},
ready: function() {
@@ -310,7 +317,10 @@
},
_submit_name: function() {
- this._run_impl({name: this.$.name.value});
+ this._run_impl({
+ name: this._name,
+ overwrite: this.$.overwrite.checked,
+ });
},
_run_impl: function(extra) {
@@ -337,7 +347,7 @@
this._compile_errors.forEach(function(err) {
this._editor.addLineClass(+err.line-1, "wrap", "error");
}.bind(this));
-
+ this.$.overwrite.checked = false;
}.bind(this)).catch(function(err) {
this.$.running.active = false;
sk.errorMessage(err);
@@ -366,5 +376,9 @@
return compile_errors.length > 0;
},
+ _isEmpty: function(name) {
+ return name == "";
+ },
+
});
</script>
« fiddle/go/named/named.go ('K') | « fiddle/go/named/named_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698