Changed tag view

Added tag info which turns into form with sufficient privileges.
(Previously only form was available.)
This commit is contained in:
Marcin Kurczewski 2014-10-15 21:21:01 +02:00
parent 231d6a732f
commit 75f0045caf

View file

@ -3,57 +3,63 @@
<h1><%= tagName %></h1> <h1><%= tagName %></h1>
</div> </div>
<% if (_.any(privileges)) { %> <form class="edit">
<form class="edit"> <% if (privileges.canChangeName) { %>
<% if (privileges.canChangeName) { %> <div class="form-row">
<div class="form-row"> <label class="form-label" for="tag-name">Name:</label>
<label class="form-label" for="tag-name">Name:</label> <div class="form-input">
<div class="form-input">
<input maxlength="200" type="text" name="name" id="tag-name" placeholder="New tag name" value="<%= tag.name %>"/> <input maxlength="200" type="text" name="name" id="tag-name" placeholder="New tag name" value="<%= tag.name %>"/>
</div>
</div> </div>
<% } %> </div>
<% } %>
<% if (privileges.canChangeImplications) { %> <div class="form-row">
<div class="form-row"> <label class="form-label" for="tag-implications">Implications:</label>
<label class="form-label" for="tag-implications">Implications:</label> <div class="form-input">
<div class="form-input"> <% if (privileges.canChangeImplications) { %>
<input maxlength="200" type="text" name="implications" id="tag-implications" placeholder="tag1, tag2&hellip;" value="<%= _.pluck(tag.implications, 'name').join(' ') %>"/> <input maxlength="200" type="text" name="implications" id="tag-implications" placeholder="tag1, tag2&hellip;" value="<%= _.pluck(tag.implications, 'name').join(' ') %>"/>
<p><small>Added automatically when tagging with <strong><%= tagName %></strong>.</small></p> <p><small>Added automatically when tagging with <strong><%= tagName %></strong>.</small></p>
</div> <% } else { %>
</div> <%= _.pluck(tag.implications, 'name').join(' ') || '-' %></p>
<% } %> <% } %>
</div>
</div>
<% if (privileges.canChangeSuggestions) { %> <div class="form-row">
<div class="form-row"> <label class="form-label" for="tag-suggestions">Suggestions:</label>
<label class="form-label" for="tag-suggestions">Suggestions:</label> <div class="form-input">
<div class="form-input"> <% if (privileges.canChangeSuggestions) { %>
<input maxlength="200" type="text" name="suggestions" id="tag-suggestions" placeholder="tag1, tag2&hellip;" value="<%= _.pluck(tag.suggestions, 'name').join(' ') %>"/> <input maxlength="200" type="text" name="suggestions" id="tag-suggestions" placeholder="tag1, tag2&hellip;" value="<%= _.pluck(tag.suggestions, 'name').join(' ') %>"/>
<p><small>Suggested when tagging with <strong><%= tagName %></strong>.</small></p> <p><small>Suggested when tagging with <strong><%= tagName %></strong>.</small></p>
</div> <% } else { %>
</div> <%= _.pluck(tag.suggestions, 'name').join(' ') || '-' %>
<% } %> <% } %>
</div>
</div>
<% if (privileges.canBan) { %> <div class="form-row">
<div class="form-row"> <label class="form-label" for="tag-ban">Ban:</label>
<label class="form-label" for="tag-ban">Ban:</label> <div class="form-input">
<div class="form-input"> <% if (privileges.canBan) { %>
<input name="ban" type="checkbox" id="ban" <% print(tag.banned ? 'checked="checked"' : '') %>> <input name="ban" type="checkbox" id="ban" <% print(tag.banned ? 'checked="checked"' : '') %>>
<label for="ban"> <label for="ban">
Prevent tag from being used Prevent tag from being used
</label> </label>
</div> <% } else { %>
</div> <%= tag.banned ? 'This is banned and cannot cannot be used in posts.' : 'This tag is not banned and can be used in posts.' %>
<% } %> <% } %>
</div>
</div>
<% if (_.any(privileges)) { %>
<div class="form-row"> <div class="form-row">
<label class="form-label"></label> <label class="form-label"></label>
<div class="form-input"> <div class="form-input">
<button type="submit">Update</button> <button type="submit">Update</button>
</div> </div>
</div> </div>
</form> <% } %>
<% } %> </form>
<div class="post-list"> <div class="post-list">
<h3>Example usages</h3> <h3>Example usages</h3>