Skip to content

Commit ccfafbc

Browse files
author
Marc J. Schmidt
committed
Disable Save&Run button when not editable
1 parent 53e25fb commit ccfafbc

File tree

6 files changed

+38
-4
lines changed

6 files changed

+38
-4
lines changed

Resources/public/build/app.js

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

Resources/public/build/app.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.

Resources/public/controller/MainController.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ export default class MainController {
164164
run() {
165165
var data = this.scope.model;
166166

167+
if (!this.scope.editable) {
168+
return;
169+
}
170+
167171
this.scope.loading = true;
168172

169173
if (!this.fiddleId) {

Resources/public/css/layout.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,11 @@ a, a:link {
12791279
border-bottom: 1px dotted #e8e8e8;
12801280
padding: 3px 2px; }
12811281

1282+
.no-tables {
1283+
color: gray;
1284+
text-align: center;
1285+
padding: 50px 0; }
1286+
12821287
button {
12831288
background-color: #c3dceb;
12841289
border: 0px;
@@ -1291,6 +1296,14 @@ button {
12911296
button:hover {
12921297
background-color: #b9cfde; }
12931298

1299+
button.disabled,
1300+
button.disabled:hover,
1301+
button.disabled:active {
1302+
background-color: #c9e2f1;
1303+
color: #aab3c2;
1304+
cursor: default;
1305+
outline: 0; }
1306+
12941307
td > div {
12951308
margin: 5px;
12961309
border: 1px solid #E0E0E0; }

Resources/public/css/layout.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ a, a:link {
134134
padding: 3px 2px;
135135
}
136136

137+
.no-tables {
138+
color: gray;
139+
text-align: center;
140+
padding: 50px 0;
141+
}
142+
137143
button {
138144
background-color: #c3dceb;
139145
border: 0px;
@@ -144,11 +150,19 @@ button {
144150
border-radius: 0;
145151
}
146152

147-
148153
button:hover {
149154
background-color: #b9cfde;
150155
}
151156

157+
button.disabled,
158+
button.disabled:hover,
159+
button.disabled:active {
160+
background-color: #c9e2f1;
161+
color: #aab3c2;
162+
cursor: default;
163+
outline: 0;
164+
}
165+
152166
td > div {
153167
margin: 5px;
154168
border: 1px solid #E0E0E0;

Resources/views/app.twig.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<div class="app-actions">
7070
<button ng-click="mainController.newFiddle()">New</button>
7171
<button ng-click="mainController.forkFiddle()">Fork</button>
72-
<button ng-click="mainController.run()">Save & Run</button>
72+
<button ng-click="mainController.run()" ng-class="{'disabled': !editable}">Save & Run</button>
7373
</div>
7474
<div class="app-title">
7575
<input placeholder="Enter a Title ..." ng-model="model.title" type="text"/>
@@ -100,7 +100,7 @@
100100
</table>
101101
</tab>
102102
</tabset>
103-
<div ng-if="!fiddle.databaseInformation || !fiddle.databaseInformation.length">
103+
<div ng-if="!fiddle.databaseInformation || !fiddle.databaseInformation.length" class="no-tables">
104104
No Tables found.
105105
</div>
106106
</div>

0 commit comments

Comments
 (0)