-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a color picker input component for Tycho
This mirrors the Wondergem component we had. Fixes: OX-10453
- Loading branch information
Showing
6 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
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
21 changes: 21 additions & 0 deletions
21
src/main/resources/default/assets/tycho/libs/bootstrap-colorpicker/LICENSE.txt
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,21 @@ | ||
boostrap-colorpicker - MIT License | ||
|
||
Copyright (c) 2017 Javi Aguilar | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
18 changes: 18 additions & 0 deletions
18
...sources/default/assets/tycho/libs/bootstrap-colorpicker/css/bootstrap-colorpicker.min.css
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
...resources/default/assets/tycho/libs/bootstrap-colorpicker/js/bootstrap-colorpicker.min.js
Large diffs are not rendered by default.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
src/main/resources/default/taglib/t/colorpicker.html.pasta
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,51 @@ | ||
<i:arg name="class" type="String" default="" description="Lists additional CSS classes to apply to the field."/> | ||
<i:arg name="fieldClass" type="String" default="" description="Lists additional CSS classes to apply to the field."/> | ||
<i:arg name="labelClass" type="String" default="" description="Lists additional CSS classes to apply to the label."/> | ||
<i:arg name="name" type="String" default=""/> | ||
<i:arg name="fieldName" type="String" default="@name"/> | ||
<i:arg name="value" type="String"/> | ||
<i:arg name="labelKey" type="String" default=""/> | ||
<i:arg name="label" type="String" default="@i18n(labelKey)"/> | ||
<i:arg name="forceLabel" type="boolean" default="false"/> | ||
<i:arg name="helpKey" type="String" default=""/> | ||
<i:arg name="help" type="String" default="@i18n(helpKey)"/> | ||
<i:arg name="id" type="String" default="@generateId('colorpicker-%s')"/> | ||
<i:arg name="placeholder" type="String" default=""/> | ||
<i:arg name="tabIndex" type="String" default=""/> | ||
|
||
<i:pragma name="description" value="Renders a color picker within a Tycho template"/> | ||
|
||
<div class="form-group @UserContext.get().signalFieldError(name) @class"> | ||
<i:if test="isFilled(label) || forceLabel"> | ||
<label><span class="@labelClass">@label</span></label> | ||
</i:if> | ||
|
||
<div class="input-group"> | ||
<input @if(isFilled(fieldName)) { name="@fieldName" } | ||
@if(isFilled(id)) { id="@id" } | ||
type="text" | ||
value="@UserContext.get().getFieldValue(name, value)" | ||
class="form-control input-block-level @fieldClass" | ||
@if (isFilled(placeholder)) { placeholder="@placeholder" } | ||
@if (isFilled(tabIndex)) { tabindex="@tabIndex" }/> | ||
<span class="input-group-append"> | ||
<span class="input-group-text colorpicker-input-addon"><i></i></span> | ||
</span> | ||
</div> | ||
|
||
<i:if test="isFilled(help)"> | ||
<small class="form-text text-muted"> | ||
<i:raw>@expandMessage(help)</i:raw> | ||
</small> | ||
</i:if> | ||
<i:if test="UserContext.get().hasError(name)"> | ||
<small class="error-block form-text">@UserContext.get().getFieldErrorMessage(name)</small> | ||
</i:if> | ||
<script> | ||
$(function () { | ||
$('#@id').parent().colorpicker({ | ||
format: 'hex' | ||
}); | ||
}); | ||
</script> | ||
</div> |