Increased control over tag categories
This commit is contained in:
parent
42f37d8fee
commit
58768acc1c
6 changed files with 34 additions and 23 deletions
|
@ -99,10 +99,10 @@ usersPerPage = 20
|
|||
postsPerPage = 40
|
||||
|
||||
[tags]
|
||||
categories[] = meta
|
||||
categories[] = artist
|
||||
categories[] = character
|
||||
categories[] = copyright
|
||||
categories[] = 'meta, meta, #aaa'
|
||||
categories[] = 'artist, artist, #a00'
|
||||
categories[] = 'character, character, #0a0'
|
||||
categories[] = 'copyright, copyright, #a0a'
|
||||
|
||||
[misc]
|
||||
thumbnailCropStyle = outside
|
||||
|
|
|
@ -137,7 +137,7 @@ module.exports = function(grunt) {
|
|||
templates: readTemplates(grunt),
|
||||
timestamp: grunt.template.today('isoDateTime'),
|
||||
maxPostSize: config.database.maxPostSize,
|
||||
tagCategories: config.tags.categories,
|
||||
tagCategories: config.tags.categories.map(function(s) { return s.split(/,\s*/); }),
|
||||
}
|
||||
},
|
||||
dist: {
|
||||
|
|
|
@ -78,19 +78,6 @@
|
|||
word-break: break-all;
|
||||
}
|
||||
|
||||
.tag-category-character,
|
||||
.tag-category-character a {
|
||||
color: #0a0;
|
||||
}
|
||||
.tag-category-copyright,
|
||||
.tag-category-copyright a {
|
||||
color: #a0a;
|
||||
}
|
||||
.tag-category-artist,
|
||||
.tag-category-artist a {
|
||||
color: #a00;
|
||||
}
|
||||
.tag-category-meta,
|
||||
.tag-category-meta a {
|
||||
color: #aaa;
|
||||
*[class*='tag-category-']:not(.tag-category-default) a {
|
||||
color: inherit;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
data-version="dev"
|
||||
data-build-time=""
|
||||
data-max-post-size="10485760"
|
||||
data-tag-categories='["meta","character","artist","copyright"]'>
|
||||
data-tag-categories='[["meta","meta","#aaa"],["character","character","#0a0"],["artist","artist","#a00"],["copyright","copyright","#a0a"]]'>
|
||||
<!-- /build -->
|
||||
<!-- build:template
|
||||
<head
|
||||
|
@ -24,8 +24,23 @@
|
|||
<title><%= serviceName %></title>
|
||||
/build -->
|
||||
|
||||
<!-- build:remove -->
|
||||
<style type="text/css">
|
||||
.tag-category-character { color: #0a0; }
|
||||
.tag-category-copyright { color: #a0a; }
|
||||
.tag-category-artist { color: #a00; }
|
||||
.tag-category-meta { color: #aaa; }
|
||||
</style>
|
||||
<!-- /build -->
|
||||
<!-- build:template
|
||||
<link rel="stylesheet" type="text/css" href="app.min.css?<%= timestamp %>"/>
|
||||
<style type="text/css">
|
||||
<% _.each(tagCategories, function(item) {
|
||||
var type = item[0];
|
||||
var color = item[2];
|
||||
%>.tag-category-<%= type %>{color:<%=color%>;}<%
|
||||
}); %>
|
||||
</style>
|
||||
/build -->
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="/lib/font-awesome/css/font-awesome.min.css"/>
|
||||
|
|
|
@ -81,12 +81,21 @@ App.Presenters.TagPresenter = function(
|
|||
});
|
||||
}
|
||||
|
||||
function getTagCategories() {
|
||||
var tagCategories = JSON.parse(jQuery('head').attr('data-tag-categories'));
|
||||
var result = {};
|
||||
jQuery.each(tagCategories, function(i, item) {
|
||||
result[item[0]] = item[1];
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function render() {
|
||||
$el.html(templates.tag({
|
||||
privileges: privileges,
|
||||
tag: tag,
|
||||
siblings: siblings,
|
||||
tagCategories: JSON.parse(jQuery('head').attr('data-tag-categories')),
|
||||
tagCategories: getTagCategories(),
|
||||
util: util,
|
||||
historyTemplate: templates.history,
|
||||
}));
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<div class="form-row">
|
||||
<label class="form-label" for="tag-category">Category:</label>
|
||||
<div class="form-input">
|
||||
<% _.each(_.extend({'default': 'default'}, _.object(tagCategories, tagCategories)), function(v, k) { %>
|
||||
<% _.each(_.extend({'default': 'default'}, tagCategories), function(v, k) { %>
|
||||
<input name="category" type="radio" value="<%= k %>" id="category-<%= k %>" <% print(tag.category === k ? 'checked="checked"' : '') %>>
|
||||
<label for="category-<%= k %>">
|
||||
<% print(tag.category === k ? v + ' (current)' : v) %>
|
||||
|
|
Loading…
Reference in a new issue