-
-
Notifications
You must be signed in to change notification settings - Fork 567
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c63445
commit a0fcd98
Showing
7 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
core/Piranha.Manager/assets/src/js/components/fields/color-field.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template> | ||
<div class="input-group color-field"> | ||
<div class="input-group-prepend"> | ||
<div class="color-preview" :style="{ backgroundColor: model.value }"></div> | ||
<input class="form-control" type="color" v-model="model.value"> | ||
</div> | ||
<input class="form-control" type="text" v-model="model.value" :placeholder="meta.placeholder"> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ["uid", "model", "meta"] | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) .NET Foundation and Contributors | ||
* | ||
* This software may be modified and distributed under the terms | ||
* of the MIT license. See the LICENSE file for details. | ||
* | ||
* https://github.com/piranhacms/piranha.core | ||
* | ||
*/ | ||
|
||
namespace Piranha.Extend.Fields | ||
{ | ||
[FieldType(Name = "Color", Shorthand = "Color", Component = "color-field")] | ||
public class ColorField : SimpleField<string> | ||
{ | ||
/// <summary> | ||
/// Implicit operator for converting a string to a field. | ||
/// </summary> | ||
/// <param name="str">The color value</param> | ||
public static implicit operator ColorField(string str) | ||
{ | ||
return new ColorField { Value = str }; | ||
} | ||
|
||
/// <summary> | ||
/// Implicitly converts the color field to a string. | ||
/// </summary> | ||
/// <param name="field">The field</param> | ||
public static implicit operator string(ColorField field) | ||
{ | ||
return field.Value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters