Moved non-config tag category info to its own class

This commit is contained in:
BrokenEagle
2017-11-07 16:10:33 -08:00
parent 7cb45fc8d3
commit 6838901aac
17 changed files with 128 additions and 77 deletions

View File

@@ -8,8 +8,8 @@
<% unless cookies[:dm] %>
<meta name="viewport" content="width=device-width,initial-scale=1">
<% end %>
<meta name="tag-category-names" content="<%= Danbooru.config.tag_category_mapping.keys %>">
<meta name="short-tag-category-names" content="<%= Danbooru.config.short_tag_name_mapping.keys %>">
<meta name="tag-category-names" content="<%= TagCategory.categories %>">
<meta name="short-tag-category-names" content="<%= TagCategory.short_name_list %>">
<meta name="current-user-name" content="<%= CurrentUser.name %>">
<meta name="current-user-id" content="<%= CurrentUser.id %>">
<meta name="current-user-can-approve-posts" content="<%= CurrentUser.can_approve_posts? %>">

View File

@@ -78,8 +78,8 @@
<%= button_tag "Related tags", :id => "related-tags-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
<% Danbooru.config.related_tag_button_list.each do |category| %>
<%= button_tag "#{Danbooru.config.full_tag_config_info[category]["relatedtag"]}", :id => "related-#{category}-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
<% TagCategory.related_button_list.each do |category| %>
<%= button_tag "#{TagCategory.related_button_mapping[category]}", :id => "related-#{category}-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
<% end %>
</div>

View File

@@ -153,7 +153,7 @@
<% end %>
<% content_for(:html_header) do %>
<meta name="related-tag-button-list" content="<%= Danbooru.config.related_tag_button_list %>">
<meta name="related-tag-button-list" content="<%= TagCategory.related_button_list %>">
<meta name="description" content="<%= @post.presenter.humanized_tag_string %>">
<meta name="tags" content="<%= @post.tag_string %>">
<meta name="favorites" content="<%= @post.fav_string %>">

View File

@@ -3,7 +3,7 @@
<section>
<%= form_tag(related_tag_path, :method => :get) do %>
<%= text_field_tag "query", params[:query], :data => { :autocomplete => "tag" } %>
<%= select_tag "category", options_for_select([""] + Danbooru.config.canonical_tag_category_mapping.map{|x| [x.first, x.first.downcase]}, params[:category]) %>
<%= select_tag "category", options_for_select([""] + TagCategory.canonical_mapping.map{|x| [x.first, x.first.downcase]}, params[:category]) %>
<%= submit_tag "Show"%>
<% end %>
</section>

View File

@@ -3,7 +3,7 @@
<%= simple_form_for(:search, method: :get, url: tag_aliases_path, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
<%= f.input :name_matches, label: "Name", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
<%= f.input :status, label: "Status", collection: ["", "Approved", "Pending"], selected: params[:search][:status] %>
<%= f.input :category, label: "Category", collection: Danbooru.config.canonical_tag_category_mapping.to_a, include_blank: true, selected: params[:search][:category] %>
<%= f.input :category, label: "Category", collection: TagCategory.canonical_mapping.to_a, include_blank: true, selected: params[:search][:category] %>
<%= f.input :order, label: "Order", collection: [%w[Status status], %w[Recently\ created created_at], %w[Recently\ updated updated_at], %w[Name name], %w[Tag\ count tag_count]], selected: params[:search][:order] %>
<%= f.submit "Search" %>
<% end %>

View File

@@ -3,7 +3,7 @@
<%= simple_form_for(:search, method: :get, url: tag_implications_path, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
<%= f.input :name_matches, label: "Name", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
<%= f.input :status, label: "Status", collection: ["", "Approved", "Pending"], selected: params[:search][:status] %>
<%= f.input :category, label: "Category", collection: Danbooru.config.canonical_tag_category_mapping.to_a, include_blank: true, selected: params[:search][:category] %>
<%= f.input :category, label: "Category", collection: TagCategory.canonical_mapping.to_a, include_blank: true, selected: params[:search][:category] %>
<%= f.input :order, label: "Order", collection: [%w[Status status], %w[Recently\ created created_at], %w[Recently\ updated updated_at], %w[Name name], %w[Tag\ count tag_count]], selected: params[:search][:order] %>
<%= f.submit "Search" %>
<% end %>

View File

@@ -1,6 +1,6 @@
<%= simple_form_for(:search, url: tags_path, method: :get, defaults: { required: false }, html: { class: "inline-form" }) do |f| %>
<%= f.input :name_matches, label: "Name", hint: "Use * for wildcard", input_html: { value: params[:search][:name_matches], data: { autocomplete: "tag" } } %>
<%= f.input :category, label: "Category", collection: Danbooru.config.canonical_tag_category_mapping.to_a, include_blank: true,selected: params[:search][:category] %>
<%= f.input :category, label: "Category", collection: TagCategory.canonical_mapping.to_a, include_blank: true,selected: params[:search][:category] %>
<%= f.input :order, collection: [%w[Newest date], %w[Count count], %w[Name name]], include_blank: false, selected: params[:search][:order] %>
<%= f.input :hide_empty, label: "Hide empty?", collection: %w[yes no], selected: params[:search][:hide_empty] %>
<%= f.input :has_wiki, label: "Has wiki?", collection: %w[yes no], include_blank: true, selected: params[:search][:has_wiki] %>

View File

@@ -6,7 +6,7 @@
<% if @tag.is_locked? %>
<p>This tag is category locked</p>
<% else %>
<%= f.input :category, :collection => Danbooru.config.canonical_tag_category_mapping.to_a, :include_blank => false %>
<%= f.input :category, :collection => TagCategory.canonical_mapping.to_a, :include_blank => false %>
<% end %>
<% if CurrentUser.is_moderator? %>

View File

@@ -110,9 +110,9 @@
<%= button_tag "Related tags", :id => "related-tags-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
<% Danbooru.config.related_tag_button_list.each do |category| %>
<%= button_tag "#{Danbooru.config.full_tag_config_info[category]["relatedtag"]}", :id => "related-#{category}-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
<% end %>
<% TagCategory.related_button_list.each do |category| %>
<%= button_tag "#{TagCategory.related_button_mapping[category]}", :id => "related-#{category}-button", :type => "button", :class => "ui-button ui-widget ui-corner-all sub gradient" %>
<% end %>
</div>
<div class="input">