bongo 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/controllers/bongo/articles_controller.rb +1 -1
- data/app/controllers/bongo/drafts_controller.rb +7 -0
- data/app/models/bongo/article.rb +15 -0
- data/app/views/bongo/articles/_article.html.erb +9 -0
- data/app/views/bongo/articles/_hr.html +1 -0
- data/app/views/bongo/articles/index.html.erb +8 -19
- data/app/views/bongo/articles/show.html.erb +14 -22
- data/app/views/bongo/drafts/index.html.erb +16 -0
- data/config/routes.rb +1 -0
- data/lib/bongo.rb +1 -0
- data/lib/bongo/version.rb +1 -1
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e018498e675e3bb9291082e9041703e1b4b81f6a739502b03fca12080598c35
|
4
|
+
data.tar.gz: 89202916b3e43b153644fab00b360d9fb997999119b37c7c7f555df11a920ef1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 970c24e98878f15c05779524e6c0ec2b1f52b8589e8b6db4dfd987272b90f4109958f024225eaf777e28f6bba275993da66a33e3ce2e5c71618475614daa0ca9
|
7
|
+
data.tar.gz: 49b47ae00c0349700139d53a40a7a2e45800de748d898cc2d5a253fe74511054ca154dd8ffebe6dc137e4bb96ad58cd6a11c9bd83fc777d776bcdaaf15fb6aaa
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ module Bongo
|
|
7
7
|
before_action :set_article, only: [:show, :edit, :update, :destroy]
|
8
8
|
|
9
9
|
def index
|
10
|
-
@articles = policy_scope(Article).order(publish_at: :desc)
|
10
|
+
@articles = policy_scope(Article).published.order(publish_at: :desc)
|
11
11
|
respond_to do |format|
|
12
12
|
format.html
|
13
13
|
format.rss do
|
data/app/models/bongo/article.rb
CHANGED
@@ -1,11 +1,26 @@
|
|
1
1
|
module Bongo
|
2
2
|
class Article
|
3
3
|
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps::Updated
|
5
|
+
include Mongoid::Slug
|
6
|
+
|
7
|
+
slug :title, history: true
|
4
8
|
|
5
9
|
field :title, type: String
|
6
10
|
field :text, type: String
|
7
11
|
field :publish_at, type: Date
|
8
12
|
|
9
13
|
scope :published, -> { where(:publish_at.lte => Date.today) }
|
14
|
+
|
15
|
+
# Mongoid (v7.0.8) doesn't have a cache_version method on its document.
|
16
|
+
# This causes https://jira.mongodb.org/browse/MONGOID-4680 when trying to
|
17
|
+
# use Rails collection caching.
|
18
|
+
def cache_version
|
19
|
+
if respond_to?(:updated_at)
|
20
|
+
updated_at.utc.to_s(:usec)
|
21
|
+
else
|
22
|
+
nil
|
23
|
+
end
|
24
|
+
end
|
10
25
|
end
|
11
26
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<article>
|
2
|
+
<header>
|
3
|
+
<h2><%= link_to article.title, article %></h2>
|
4
|
+
<small><%= article.publish_at ? l(article.publish_at, format: :long) : "Unpublished draft"%></small>
|
5
|
+
</header>
|
6
|
+
<div class="trix-content">
|
7
|
+
<%= article.text.html_safe %>
|
8
|
+
</div>
|
9
|
+
</article>
|
@@ -0,0 +1 @@
|
|
1
|
+
<hr>
|
@@ -1,20 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
<
|
5
|
-
|
6
|
-
</header>
|
7
|
-
<div class="trix-content">
|
8
|
-
<%= article.text.html_safe %>
|
9
|
-
</div>
|
10
|
-
</article>
|
11
|
-
<br>
|
12
|
-
<% end %>
|
13
|
-
|
14
|
-
<br>
|
15
|
-
|
16
|
-
<% if policy(Bongo::Article).create? %>
|
17
|
-
<%= link_to new_article_path do %>
|
18
|
-
<b>New Article</b>
|
1
|
+
<header>
|
2
|
+
<% if policy(Bongo::Article).create? %>
|
3
|
+
<%= link_to drafts_url do %>
|
4
|
+
<i>Drafts</i>
|
5
|
+
<% end %>
|
19
6
|
<% end %>
|
20
|
-
|
7
|
+
</header>
|
8
|
+
|
9
|
+
<%= render(collection: @articles, partial: 'article', spacer_template: "hr", cached: true) || "There are no articles yet." %>
|
@@ -1,27 +1,19 @@
|
|
1
|
-
|
2
|
-
<header>
|
3
|
-
<h2><%= @article.title %></h2>
|
4
|
-
<small><%= @article.publish_at ? l(@article.publish_at, format: :long) : "Unpublished draft"%></small>
|
5
|
-
</header>
|
1
|
+
<%= render @article %>
|
6
2
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
<footer>
|
12
|
-
<% if policy(@article).update? %>
|
13
|
-
<%= link_to edit_article_path(@article) do %>
|
14
|
-
<b>Edit</b>
|
15
|
-
<% end %>
|
3
|
+
<footer>
|
4
|
+
<% if policy(@article).update? %>
|
5
|
+
<%= link_to edit_article_path(@article) do %>
|
6
|
+
<b>Edit</b>
|
16
7
|
<% end %>
|
8
|
+
<% end %>
|
17
9
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<% end %>
|
10
|
+
<% if policy(@article).destroy? %>
|
11
|
+
<%= link_to @article, method: :delete, data: {confirm: "Are you sure?"} do %>
|
12
|
+
<em>Delete</em>
|
22
13
|
<% end %>
|
14
|
+
<% end %>
|
23
15
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
</
|
16
|
+
<%= link_to articles_path do %>
|
17
|
+
<i>Back</i>
|
18
|
+
<% end %>
|
19
|
+
</footer>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<header>
|
2
|
+
<% if policy(Bongo::Article).create? %>
|
3
|
+
<%= link_to new_article_path do %>
|
4
|
+
<b>New Article</b>
|
5
|
+
<% end %>
|
6
|
+
<% end %>
|
7
|
+
</header>
|
8
|
+
|
9
|
+
<ul>
|
10
|
+
<% @drafts.each do |draft| %>
|
11
|
+
<li>
|
12
|
+
<%= link_to draft.title, draft %><br>
|
13
|
+
<small>last modified <%= distance_of_time_in_words_to_now(draft.updated_at) %> ago</small>
|
14
|
+
</li>
|
15
|
+
<% end %>
|
16
|
+
</ul>
|
data/config/routes.rb
CHANGED
data/lib/bongo.rb
CHANGED
data/lib/bongo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bongo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Hutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05
|
11
|
+
date: 2020-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 7.0.5
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mongoid-slug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '6'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '6'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: aws-sdk-s3
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,6 +98,7 @@ files:
|
|
84
98
|
- app/assets/stylesheets/bongo/trix.css
|
85
99
|
- app/controllers/bongo/application_controller.rb
|
86
100
|
- app/controllers/bongo/articles_controller.rb
|
101
|
+
- app/controllers/bongo/drafts_controller.rb
|
87
102
|
- app/controllers/bongo/files_controller.rb
|
88
103
|
- app/helpers/bongo/application_helper.rb
|
89
104
|
- app/helpers/bongo/articles_helper.rb
|
@@ -91,13 +106,16 @@ files:
|
|
91
106
|
- app/mailers/bongo/application_mailer.rb
|
92
107
|
- app/models/bongo/article.rb
|
93
108
|
- app/policies/bongo/article_policy.rb
|
109
|
+
- app/views/bongo/articles/_article.html.erb
|
94
110
|
- app/views/bongo/articles/_form.html.erb
|
111
|
+
- app/views/bongo/articles/_hr.html
|
95
112
|
- app/views/bongo/articles/_notice.html.erb
|
96
113
|
- app/views/bongo/articles/edit.html.erb
|
97
114
|
- app/views/bongo/articles/index.html.erb
|
98
115
|
- app/views/bongo/articles/index.rss.builder
|
99
116
|
- app/views/bongo/articles/new.html.erb
|
100
117
|
- app/views/bongo/articles/show.html.erb
|
118
|
+
- app/views/bongo/drafts/index.html.erb
|
101
119
|
- app/views/layouts/bongo/application.html.erb
|
102
120
|
- config/routes.rb
|
103
121
|
- lib/bongo.rb
|