adva_blog 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be103e746dc5019a37a44afe5f2592cbdf32f49334bb0d9bad8b14d351284d3b
4
- data.tar.gz: 96d3af6bcc8b0e4b1cc9b11aa4d40af10e52273074b90a613bc67b3f4157e1a5
3
+ metadata.gz: 85b9f7df75c4a48ce6dc3ab8e567a49f4b0d65e042f7e59f1ab204f626416c03
4
+ data.tar.gz: 37e7e41f62a13b73d3b0db962c5571e4b8b4a9fe4efee004439afeb5bd678a88
5
5
  SHA512:
6
- metadata.gz: 0a01ee29afb12c403f94cb9bb541ff98c17aff2255cfdac5d90166842fa39599ba68a38d4d9b0a7da8f3898aabff7e982d4815c4cd0430a84b8311a7f24157ff
7
- data.tar.gz: 1185830c46a1952b7cd7ac67bcef10f12ae5fa515bc50b5529ddf3f2da07f9b93321bbb5e61958de7748ff28a1aac40da973c5e67e823b5bdeb467d2c57b1ceb
6
+ metadata.gz: 3b55484db019345e339206c2bcc29c2daa65f3c326079cb369f06d4de76d5dd9d4c90e8411fab63e7be8e542966dab5cd2d0694f33dfa023225164294295e032
7
+ data.tar.gz: d75ed39340ccf5ed1fca04a7542b40b1586b03f1a9a6fb085d23925ca557a76bc25bd5791982eddeb6ee83ca50eeed11ffb087aa6b16968ae5c3ec0b541c266f
@@ -1,23 +1,19 @@
1
1
  class BlogArticlesController < ArticlesController
2
2
  def index
3
- if skip_caching? or stale?(:etag => @section, :last_modified => [@articles.to_a, @section, @site].flatten.collect(&:updated_at).compact.max.utc, :public => true)
3
+ articles
4
+
5
+ if defined?(Comment)
6
+ articles.includes!(:approved_comments_counter)
7
+ end
8
+
9
+ # set after articles are fetched
10
+ @category ||= section.categories.build(title: "All Categories")
11
+
12
+ if skip_caching? or stale?([site, section], public: true)
4
13
  respond_to do |format|
5
14
  format.html { render :template => "blogs/articles/index" }
6
15
  format.atom { render :template => "blogs/articles/index", :layout => false }
7
16
  end
8
17
  end
9
18
  end
10
-
11
- protected
12
- def set_articles
13
- scope = @category ? @category.all_contents : @section.articles
14
- scope = scope.tagged("'#{@tags}'") if @tags.present?
15
- scope = scope.published # (params[:year], params[:month])
16
- scope = scope.includes(:approved_comments_counter) if defined?(Comment)
17
- @articles = scope.paginate(page: current_page, per_page: @section.contents_per_page).order(published_at: :desc)
18
- end
19
-
20
- def valid_article?
21
- @article and (@article.draft? or @article.published_at?(params.values_at(:year, :month, :day)))
22
- end
23
19
  end
@@ -5,12 +5,12 @@ module BlogHelper
5
5
  month = archive_month(month) if month && !month.is_a?(Time)
6
6
 
7
7
  title = []
8
- title << t(:'adva.blog.titles.date', :date => l(month, :format => '%B %Y')) if month
9
- title << t(:'adva.blog.titles.about', :category => category.title) if category
10
- title << t(:'adva.blog.titles.tags', :tags => tags.to_sentence) if tags
8
+ title << "from #{month.strftime('%B %Y')}" if month
9
+ title << "about #{category.title}" if category
10
+ title << "tagged #{tags.to_sentence}" if tags
11
11
 
12
12
  if title.present?
13
- title = t(:'adva.blog.titles.articles', :articles => title.join(', '))
13
+ title = "Articles #{title.join(', ')}"
14
14
  options[:format] ? raw(options[:format]) % title : title
15
15
  end
16
16
  end
data/app/models/blog.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class Blog < Section
2
- has_many :articles, -> { order("contents.published_at DESC") }, :foreign_key => 'section_id', :dependent => :destroy do
2
+ has_many :articles, -> { order("contents.published_at DESC") }, foreign_key: :section_id, dependent: :destroy do
3
3
  def permalinks
4
- published.map(&:permalink)
4
+ published.pluck(:permalink)
5
5
  end
6
6
  end
7
7
  alias_method :contents, :articles
@@ -11,30 +11,16 @@
11
11
  r.add_class "level_#{content.level}"
12
12
  r.cell content_status(content) + " " + link_to(content.title, [:edit, :admin, @section, content], :class => content.state)
13
13
  r.cell content.category_titles.join(", ") if @section.categories.any?
14
- r.cell content.accept_comments? && content.comments.present? ? link_to(content.comments.size, admin_comments_path) : t(:"adva.common.none") if defined?(Comment)
14
+ r.cell content.accept_comments? && content.comments.present? ? link_to(content.comments.size, admin_comments_path) : "none" if defined?(Comment)
15
15
  r.cell published_at_formatted(content)
16
16
  r.cell link_to("Edit", [:edit, :admin, @section, content], :class => "edit content") +
17
17
  link_to("Delete", [:admin, @section, content], :method => :delete, :class => "delete content")
18
18
  end
19
19
 
20
20
  t.empty :p, :class => 'empty' do
21
- raw params[:filters] ?
22
- t(:'adva.content.no_filtered_contents') :
23
- t(:'adva.contents.no_contents', :section => @section.title) + "\n" +
24
- link_to(t(:'adva.contents.links.create_now'), [:new, :admin, @section, :article])
21
+ raw "There are no contents in #{@section.title}. " +
22
+ link_to("Create one now", [:new, :admin, @section, :article])
25
23
  end
26
24
  end
27
25
  %>
28
26
 
29
- <%= content_for :sidebar do -%>
30
- <!--
31
- <div class="tabs">
32
- <ul>
33
- <li class="active"><a href="#filters" onclick="return false;">Filters</a></li>
34
- </ul>
35
- <div class="tab active" id="tab_filters">
36
- <%= filter_for(Article, :categories => @section.categories) %>
37
- </div>
38
- </div>
39
- -->
40
- <% end -%>
@@ -1,11 +1,7 @@
1
- <h2><%= t(:'adva.sections.titles.blog_settings') %></h2>
1
+ <h2>Blog settings</h2>
2
2
 
3
3
  <% f.field_set :blog_settings do %>
4
4
  <div class="col">
5
5
  <%= f.text_field :contents_per_page, :label => true %>
6
6
  </div>
7
-
8
- <div class="col">
9
- <%= f.select :content_filter, filter_options, {}, :label => true, :hint => :'adva.sections.hints.content_filter' %>
10
- </div>
11
7
  <% end %>
@@ -3,15 +3,15 @@
3
3
  <div class="meta">
4
4
  <p>
5
5
  <%= datetime_with_microformat(article.published_at, :format => :long) %><br />
6
- <%= t(:'adva.blog.attribution', :author => article.author_name) %>
6
+ by: <%= article.author_name %>
7
7
  <%= link_to_content_comments article if (defined?(Comment) && (article.accept_comments? || article.comments.present?)) && mode != :single %>
8
8
  <% authorized_tag :span, :update, article do -%>
9
- <%= link_to t(:'adva.common.edit'), edit_admin_article_path(@section, article) %>
9
+ <%= link_to "Edit", edit_admin_article_path(@section, article) %>
10
10
  <% end -%>
11
11
  </p>
12
12
  <p>
13
- <%= links_to_content_categories article, :'adva.common.content_categories' %>
14
- <%= links_to_content_tags article, :'adva.common.content_tags' %>
13
+ <%= links_to_content_categories article %>
14
+ <%= links_to_content_tags article %>
15
15
  </p>
16
16
  </div>
17
17
  <div class="content">
@@ -20,7 +20,8 @@
20
20
  </h2>
21
21
  <% if article.has_excerpt? %>
22
22
  <%= raw article.excerpt_html %>
23
- <p><%= link_to_content t( :'adva.blog.links.more' ), article unless mode == :single %></p>
23
+ <p><%= link_to_content "Read the rest of this entry", article unless mode == :single %></p>
24
+
24
25
  <% end %>
25
26
  <%= raw article.body_html if mode == :single || !article.has_excerpt? %>
26
27
  </div>
@@ -1,8 +1,8 @@
1
1
  <% content_for :footer do %>
2
2
  <div id="footer" class="clearing">
3
- <% if @section.categories.present? %>
3
+ <% if @section.categories.select(&:persisted?).any? %>
4
4
  <div>
5
- <h4><%=t :'adva.titles.categories' %></h4>
5
+ <h4>Categories</h4>
6
6
  <ul id="categories_list">
7
7
  <% @section.categories.each do |category| %>
8
8
  <li><%= link_to_category @section, category %></li>
@@ -13,7 +13,7 @@
13
13
 
14
14
  <% if @section.article_counts_by_month.present? %>
15
15
  <div>
16
- <h4><%=t :'adva.titles.archives' %></h4>
16
+ <h4>Archives</h4>
17
17
  <ul id="archives">
18
18
  <% @section.archive_months.each do |month| %>
19
19
  <li><%= link_to l( month, :format => '%B %Y' ), blog_path(@section, :year => month.year, :month => month.month) %></li>
@@ -23,7 +23,7 @@
23
23
  <% end %>
24
24
 
25
25
  <% if false and @section and @section.tag_counts.present? %>
26
- <h4><%=t :'adva.titles.tags' %></h4>
26
+ <h4>Tags</h4>
27
27
  <ul id="tags_list">
28
28
  <% @section.tag_counts.each do |tag| %>
29
29
  <li><%= link_to_tag @section, tag %></li>
@@ -32,9 +32,7 @@
32
32
  <% end %>
33
33
  </div>
34
34
 
35
- <%= render :partial => 'shared/footer' %>
36
-
37
35
  <ul id="feeds">
38
- <li><%= link_to t( :'adva.links.entries_feed' ), blog_url(@section, :format => :atom) %></li>
36
+ <li><%= link_to "Entries feed", blog_url(@section, :format => :atom) %></li>
39
37
  </ul>
40
38
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module AdvaBlog
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/adva_blog.rb CHANGED
@@ -1,10 +1,14 @@
1
1
  # require "adva_blog/version"
2
2
  require "rails"
3
3
 
4
+ # FIXME there's gotta be a better way!
5
+ spec = Gem::Specification.find_by_name("adva")
6
+ require "#{spec.gem_dir}/app/models/section"
7
+
4
8
  module AdvaBlog
5
9
  class Engine < Rails::Engine
6
10
  initializer "adva_blog.init" do
7
- Section.register_type 'Blog'
11
+ ::Section.register_type 'Blog'
8
12
  end
9
13
  end
10
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adva_blog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-01 00:00:00.000000000 Z
11
+ date: 2024-07-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Adva Blog
14
14
  email:
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubygems_version: 3.2.3
79
+ rubygems_version: 3.2.32
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Engine for Adva CMS blog component