Define styles for disabled buttons
This commit is contained in:
parent
76eafb8fa5
commit
68d7351893
2 changed files with 22 additions and 1 deletions
|
@ -161,6 +161,14 @@ button {
|
||||||
background-color: $btn-background-hover-color;
|
background-color: $btn-background-hover-color;
|
||||||
color: $btn-text-hover-color;
|
color: $btn-text-hover-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&[disabled],
|
||||||
|
&[disabled]:hover {
|
||||||
|
background-color: #ddd;
|
||||||
|
box-shadow: none;
|
||||||
|
color: #999;
|
||||||
|
cursor: initial;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn.secondary {
|
.btn.secondary {
|
||||||
|
|
|
@ -73,7 +73,9 @@
|
||||||
Add new item
|
Add new item
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn">Save</button>
|
<button type="submit" class="btn" :disabled="!isFormValid()">
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<sidebar></sidebar>
|
<sidebar></sidebar>
|
||||||
</div>
|
</div>
|
||||||
|
@ -204,6 +206,13 @@ export default class ProfileForm extends Vue {
|
||||||
this.form.fields_attributes.push({ name: "", value: "", value_source: "" })
|
this.form.fields_attributes.push({ name: "", value: "", value_source: "" })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isFormValid(): boolean {
|
||||||
|
if (this.form.display_name && this.form.display_name.length > 75) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
async save() {
|
async save() {
|
||||||
const authToken = this.store.ensureAuthToken()
|
const authToken = this.store.ensureAuthToken()
|
||||||
const profile = await updateProfile(authToken, this.form)
|
const profile = await updateProfile(authToken, this.form)
|
||||||
|
@ -307,4 +316,8 @@ export default class ProfileForm extends Vue {
|
||||||
filter: $link-hover-colorizer;
|
filter: $link-hover-colorizer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn[type="submit"] {
|
||||||
|
margin-bottom: $block-outer-padding;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue