added asset precompilation to deploy script, style tweaks
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
@import "../common/000_vars.css.scss";
|
||||
|
||||
div#c-artists {
|
||||
span.new-artist {
|
||||
font-weight: bold;
|
||||
@@ -19,4 +21,13 @@ div#c-artists {
|
||||
height: 5em;
|
||||
}
|
||||
}
|
||||
|
||||
div.recent-posts {
|
||||
margin-top: 1em;
|
||||
|
||||
h1 {
|
||||
font-size: $h2_size;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@ article.post-preview.blacklisted-active {
|
||||
}
|
||||
|
||||
div#c-posts {
|
||||
span.post-count {
|
||||
color: #CCC;
|
||||
margin-left: 0.2em;
|
||||
}
|
||||
|
||||
div.notice {
|
||||
font-size: 0.8em;
|
||||
padding: 1em;
|
||||
|
||||
@@ -21,7 +21,13 @@ class Tag < ActiveRecord::Base
|
||||
Danbooru.config.tag_category_mapping[string.downcase] || 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
module CountMethods
|
||||
def counts_for(tag_names)
|
||||
select_all_sql("SELECT name, post_count FROM tags WHERE name IN (?)", tag_names)
|
||||
end
|
||||
end
|
||||
|
||||
module ViewCountMethods
|
||||
def increment_view_count(name)
|
||||
Cache.incr("tvc:#{Cache.sanitize(name)}")
|
||||
@@ -353,6 +359,7 @@ class Tag < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
extend CountMethods
|
||||
extend ViewCountMethods
|
||||
include CategoryMethods
|
||||
extend StatisticsMethods
|
||||
|
||||
@@ -24,6 +24,13 @@ private
|
||||
@categories ||= Tag.categories_for(@tags)
|
||||
end
|
||||
|
||||
def counts
|
||||
@counts ||= Tag.counts_for(@tags).inject({}) do |hash, x|
|
||||
hash[x["name"]] = x["post_count"]
|
||||
hash
|
||||
end
|
||||
end
|
||||
|
||||
def build_list_item(tag, template, options)
|
||||
html = ""
|
||||
html << %{<li data-tag-type="#{categories[tag]}" data-tag-name="#{u(tag)}">}
|
||||
@@ -35,7 +42,9 @@ private
|
||||
end
|
||||
|
||||
humanized_tag = tag.tr("_", " ")
|
||||
html << %{<a href="/posts?tags=#{u(tag)}">#{h(humanized_tag)}</a>}
|
||||
html << %{<a href="/posts?tags=#{u(tag)}">#{h(humanized_tag)}</a> }
|
||||
html << %{<span class="post-count">} + counts[tag].to_s + %{</span>}
|
||||
|
||||
html << "</li>"
|
||||
html
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="recent-posts">
|
||||
<h1>Recent Posts</h1>
|
||||
<div style="margin: 1em 0;">
|
||||
<%= @post_set.presenter.post_previews_html(self) %>
|
||||
|
||||
@@ -75,6 +75,11 @@ namespace :deploy do
|
||||
end
|
||||
end
|
||||
|
||||
desc "Precompiles assets"
|
||||
task :precompile_assets do
|
||||
rake "assets:precompile"
|
||||
end
|
||||
|
||||
desc "Restart the application"
|
||||
task :restart do
|
||||
run "touch #{current_path}/tmp/restart.txt"
|
||||
|
||||
Reference in New Issue
Block a user