Skip to content

Commit

Permalink
Added AI icons for page content suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
kobusvanwyk committed Dec 13, 2023
1 parent 3b62819 commit 17f23fd
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 15 deletions.
14 changes: 14 additions & 0 deletions src/public/css/page-builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -467,3 +467,17 @@ div.dataTables_processing {
.form-group label {
font-weight: bold;
}
.ai-enhance-container {
padding: 10px 8px;
font-size: 14px;
display: flex;
align-items: start;
gap: 8px;
cursor: pointer;
}
.ai-enhance-container:hover {
background: #f5f5f5;
}
.ai-enhance-container img {
width: 24px;
}
6 changes: 6 additions & 0 deletions src/public/images/ui-icons/icon-tina-ai.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/templates/admin/page-builder.scss
Original file line number Diff line number Diff line change
Expand Up @@ -611,4 +611,23 @@ div.dataTables_processing {
label {
font-weight: bold;
}
}

.ai-enhance-container {
padding: 10px 8px;
font-size: 14px;
display: flex;
align-items: start;
gap: 8px;
cursor: pointer;

&:hover {
background: #f5f5f5;
}

img {
width: 24px;
position: relative;
top: 2px;
}
}
52 changes: 37 additions & 15 deletions src/templates/api/admin/pages/form.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,26 @@
</div>
<div class="form-group col-md-3">
<label for="title">Title</label>
<input id="title" class="form-control" type="text" name="title" placeholder="Title" value="{{ data.title }}">
<pre onclick="$('#title').val('{{ ai.title }}')">{{ ai.title }}</pre>
<input id="title" class="form-control" type="text" name="title" placeholder="Title"
value="{{ data.title }}">
<div class="ai-enhance-container alert alert-light mt-2" role="alert" title="Click to add content">
<img class="ai-enhance-icon" src="{{ baseUrl }}/images/ui-icons/icon-tina-ai.svg" alt="TinaAI Icon">
<div>
<span onclick="$('#title').val('{{ ai.title }}')">{{ ai.title }}</span>
</div>
</div>
</div>
<div class="form-group col-md-3">
<label for="description">Description</label>
<input id="description" class="form-control" type="text" name="description" placeholder="Description" value="{{ data.description }}">
<pre onclick="$('#description').val('{{ ai.description }}')">{{ ai.description }}</pre>
<input id="description" class="form-control" type="text" name="description" placeholder="Description"
value="{{ data.description }}">
<div class="ai-enhance-container alert alert-light mt-2" role="alert" title="Click to add content">
<img class="ai-enhance-icon" src="{{ baseUrl }}/images/ui-icons/icon-tina-ai.svg" alt="TinaAI Icon">
<div>
<span onclick="$('#description').val('{{ ai.description }}')">{{ ai.description }}</span>
</div>
</div>

</div>
<div class="form-group col-md-1">
<img class="img-thumbnail" src="data:image/png;base64,{{ data.image }}">
Expand All @@ -23,27 +36,36 @@
</div>
<div class="form-group col-md-1">
<div class="form-check form-switch">
<input class="form-check-input" name="isPublished" value="1" type="checkbox" id="isPublished" {% if (data.isPublished == 1 ) %} checked {% endif%}>
<input class="form-check-input" name="isPublished" value="1" type="checkbox"
id="isPublished" {% if (data.isPublished == 1 ) %} checked {% endif %}>
<label class="form-check-label" for="isPublished">Published</label>
</div>
</div>
{% if (not data.pageBuilderContent) %}
<div class="form-group col-md-12">
{% include "snippets/content-editor.twig" %}
</div>
<div class="form-group col-md-12">
{% include "snippets/content-editor.twig" %}
</div>
{% else %}
<div class="form-group col-md-12" style="overflow:auto; height: 100">
<div id="contentEditor" class="form-control" style="display:none">{{ data.content | raw }}</div>
<label>Content</label><br>
{{ renderedText }}
</div>
<div class="form-group col-md-12" style="overflow: auto;">
<div class="alert alert-light my-4">
<div id="contentEditor" class="form-control" style="display:none">{{ data.content | raw }}</div>
<label>Content</label><br>
{{ renderedText }}
</div>
</div>
{% endif %}
<div class="form-group col-md-12">
<label>Keywords/Tags</label>
{% include "tagLookup.twig" %}
<pre onclick="$('#tags').val('{{ ai.keywords }}')">{{ ai.keywords }}</pre>
<div class="ai-enhance-container alert alert-light mt-2" role="alert" title="Click to add content">
<img class="ai-enhance-icon" src="{{ baseUrl }}/images/ui-icons/icon-tina-ai.svg" alt="TinaAI Icon">
<div>
<span onclick="$('#tags').val('{{ ai.keywords }}')">{{ ai.keywords }}</span>
</div>
</div>

</div>
</div>
<input type="hidden" name="siteId" value="{{ siteId }}">
{{ "pageForm" | formToken | raw }}
{{ "pageForm" | formToken | raw }}
</form>

0 comments on commit 17f23fd

Please sign in to comment.