Added autocomplete to tag relations
This commit is contained in:
parent
9c29f6173d
commit
85ed59d169
3 changed files with 8 additions and 5 deletions
1
TODO
1
TODO
|
@ -10,7 +10,6 @@ first major release.
|
|||
- posts/listing: add buttons for toggling safety
|
||||
- posts: fix empty edit snapshots when changing only thumbnail content
|
||||
- users: add user-configurable "about me" (should support Markdown)
|
||||
- tags: suggestions and implications should be changed to tag inputs
|
||||
- tags: refresh tags.json when editing post
|
||||
- tags: add tag merging
|
||||
- tags: add tag categories
|
||||
|
|
|
@ -16,6 +16,8 @@ App.Presenters.TagPresenter = function(
|
|||
var $el = jQuery('#content');
|
||||
var $messages = $el;
|
||||
var templates = {};
|
||||
var implicationsTagInput;
|
||||
var suggestionsTagInput;
|
||||
|
||||
var tag;
|
||||
var tagName;
|
||||
|
@ -73,6 +75,8 @@ App.Presenters.TagPresenter = function(
|
|||
$el.html(templates.tag({privileges: privileges, tag: tag, tagName: tagName}));
|
||||
$el.find('.post-list').hide();
|
||||
$el.find('form').submit(editFormSubmitted);
|
||||
implicationsTagInput = App.Controls.TagInput($el.find('[name=implications]'));
|
||||
suggestionsTagInput = App.Controls.TagInput($el.find('[name=suggestions]'));
|
||||
}
|
||||
|
||||
function editFormSubmitted(e) {
|
||||
|
@ -89,11 +93,11 @@ App.Presenters.TagPresenter = function(
|
|||
}
|
||||
|
||||
if (privileges.canChangeImplications) {
|
||||
formData.implications = $form.find('[name=implications]').val();
|
||||
formData.implications = implicationsTagInput.getTags().join(' ');
|
||||
}
|
||||
|
||||
if (privileges.canChangeSuggestions) {
|
||||
formData.suggestions = $form.find('[name=suggestions]').val();
|
||||
formData.suggestions = suggestionsTagInput.getTags().join(' ');
|
||||
}
|
||||
|
||||
promise.wait(api.put('/tags/' + tag.name, formData))
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<label class="form-label" for="tag-implications">Implications:</label>
|
||||
<div class="form-input">
|
||||
<% if (privileges.canChangeImplications) { %>
|
||||
<input maxlength="200" type="text" name="implications" id="tag-implications" placeholder="tag1, tag2…" value="<%= _.pluck(tag.implications, 'name').join(' ') %>"/>
|
||||
<input maxlength="200" type="text" name="implications" id="tag-implications" placeholder="some tag…" value="<%= _.pluck(tag.implications, 'name').join(' ') %>"/>
|
||||
<p><small>Added automatically when tagging with <strong><%= tagName %></strong>.</small></p>
|
||||
<% } else { %>
|
||||
<%= _.pluck(tag.implications, 'name').join(' ') || '-' %></p>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<label class="form-label" for="tag-suggestions">Suggestions:</label>
|
||||
<div class="form-input">
|
||||
<% if (privileges.canChangeSuggestions) { %>
|
||||
<input maxlength="200" type="text" name="suggestions" id="tag-suggestions" placeholder="tag1, tag2…" value="<%= _.pluck(tag.suggestions, 'name').join(' ') %>"/>
|
||||
<input maxlength="200" type="text" name="suggestions" id="tag-suggestions" placeholder="some tag…" value="<%= _.pluck(tag.suggestions, 'name').join(' ') %>"/>
|
||||
<p><small>Suggested when tagging with <strong><%= tagName %></strong>.</small></p>
|
||||
<% } else { %>
|
||||
<%= _.pluck(tag.suggestions, 'name').join(' ') || '-' %>
|
||||
|
|
Loading…
Reference in a new issue