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 {
|
div#c-artists {
|
||||||
span.new-artist {
|
span.new-artist {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@@ -19,4 +21,13 @@ div#c-artists {
|
|||||||
height: 5em;
|
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 {
|
div#c-posts {
|
||||||
|
span.post-count {
|
||||||
|
color: #CCC;
|
||||||
|
margin-left: 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
div.notice {
|
div.notice {
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
|
|||||||
@@ -21,7 +21,13 @@ class Tag < ActiveRecord::Base
|
|||||||
Danbooru.config.tag_category_mapping[string.downcase] || 0
|
Danbooru.config.tag_category_mapping[string.downcase] || 0
|
||||||
end
|
end
|
||||||
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
|
module ViewCountMethods
|
||||||
def increment_view_count(name)
|
def increment_view_count(name)
|
||||||
Cache.incr("tvc:#{Cache.sanitize(name)}")
|
Cache.incr("tvc:#{Cache.sanitize(name)}")
|
||||||
@@ -353,6 +359,7 @@ class Tag < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
extend CountMethods
|
||||||
extend ViewCountMethods
|
extend ViewCountMethods
|
||||||
include CategoryMethods
|
include CategoryMethods
|
||||||
extend StatisticsMethods
|
extend StatisticsMethods
|
||||||
|
|||||||
@@ -24,6 +24,13 @@ private
|
|||||||
@categories ||= Tag.categories_for(@tags)
|
@categories ||= Tag.categories_for(@tags)
|
||||||
end
|
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)
|
def build_list_item(tag, template, options)
|
||||||
html = ""
|
html = ""
|
||||||
html << %{<li data-tag-type="#{categories[tag]}" data-tag-name="#{u(tag)}">}
|
html << %{<li data-tag-type="#{categories[tag]}" data-tag-name="#{u(tag)}">}
|
||||||
@@ -35,7 +42,9 @@ private
|
|||||||
end
|
end
|
||||||
|
|
||||||
humanized_tag = tag.tr("_", " ")
|
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 << "</li>"
|
||||||
html
|
html
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="recent-posts">
|
||||||
<h1>Recent Posts</h1>
|
<h1>Recent Posts</h1>
|
||||||
<div style="margin: 1em 0;">
|
<div style="margin: 1em 0;">
|
||||||
<%= @post_set.presenter.post_previews_html(self) %>
|
<%= @post_set.presenter.post_previews_html(self) %>
|
||||||
|
|||||||
@@ -75,6 +75,11 @@ namespace :deploy do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "Precompiles assets"
|
||||||
|
task :precompile_assets do
|
||||||
|
rake "assets:precompile"
|
||||||
|
end
|
||||||
|
|
||||||
desc "Restart the application"
|
desc "Restart the application"
|
||||||
task :restart do
|
task :restart do
|
||||||
run "touch #{current_path}/tmp/restart.txt"
|
run "touch #{current_path}/tmp/restart.txt"
|
||||||
|
|||||||
Reference in New Issue
Block a user