rtcl 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +14 -0
  5. data/app/assets/config/rtcl_manifest.js +3 -0
  6. data/app/assets/images/user-sample.jpg +0 -0
  7. data/app/assets/javascripts/rtcl/application.js +174 -0
  8. data/app/assets/javascripts/rtcl/name-that-color.js +1 -0
  9. data/app/assets/stylesheets/rtcl/application.css +7 -0
  10. data/app/assets/stylesheets/rtcl/highlight-android.css +1 -0
  11. data/app/assets/stylesheets/rtcl/styles.css +2578 -0
  12. data/app/assets/stylesheets/rtcl/trix.css +556 -0
  13. data/app/controllers/rtcl/application_controller.rb +18 -0
  14. data/app/controllers/rtcl/articles/comments_controller.rb +11 -0
  15. data/app/controllers/rtcl/articles_controller.rb +65 -0
  16. data/app/controllers/rtcl/comments_controller.rb +27 -0
  17. data/app/helpers/rtcl/application_helper.rb +4 -0
  18. data/app/jobs/rtcl/application_job.rb +4 -0
  19. data/app/mailers/rtcl/application_mailer.rb +6 -0
  20. data/app/models/ability.rb +20 -0
  21. data/app/models/concerns/rtcl/blogger.rb +9 -0
  22. data/app/models/rtcl/application_record.rb +5 -0
  23. data/app/models/rtcl/article.rb +53 -0
  24. data/app/views/layouts/rtcl/application.html.erb +19 -0
  25. data/app/views/rtcl/articles/_article.html.erb +33 -0
  26. data/app/views/rtcl/articles/_article.json.jbuilder +5 -0
  27. data/app/views/rtcl/articles/_form.html.erb +69 -0
  28. data/app/views/rtcl/articles/edit.html.erb +17 -0
  29. data/app/views/rtcl/articles/index.html.erb +32 -0
  30. data/app/views/rtcl/articles/new.html.erb +16 -0
  31. data/app/views/rtcl/articles/show.html.erb +64 -0
  32. data/app/views/rtcl/comments/_comment.html.erb +47 -0
  33. data/app/views/rtcl/comments/_comments.html.erb +18 -0
  34. data/app/views/rtcl/comments/_form.html.erb +11 -0
  35. data/app/views/rtcl/comments/new.html.erb +7 -0
  36. data/app/views/rtcl/comments/show.html.erb +1 -0
  37. data/config/routes.rb +11 -0
  38. data/db/migrate/20220208044728_create_articles.rb +16 -0
  39. data/lib/generators/rtcl/install/install_generator.rb +28 -0
  40. data/lib/generators/rtcl/templates/active_model_serializers.rb +1 -0
  41. data/lib/generators/rtcl/templates/rtcl.rb +10 -0
  42. data/lib/rtcl/configuration.rb +7 -0
  43. data/lib/rtcl/engine.rb +33 -0
  44. data/lib/rtcl/railtie.rb +4 -0
  45. data/lib/rtcl/version.rb +3 -0
  46. data/lib/rtcl.rb +30 -0
  47. data/lib/tasks/rtcl_tasks.rake +4 -0
  48. metadata +252 -0
@@ -0,0 +1,556 @@
1
+ @charset "UTF-8";
2
+ /*
3
+ Trix 1.3.1
4
+ Copyright © 2020 Basecamp, LLC
5
+ http://trix-editor.org/*/
6
+ trix-editor {
7
+ border: 1px solid #bbb;
8
+ border-radius: 3px;
9
+ margin: 0;
10
+ padding: 0.4em 0.6em;
11
+ min-height: 5em;
12
+ outline: none;
13
+ }
14
+
15
+ trix-toolbar * {
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ trix-toolbar .trix-button-row {
20
+ display: flex;
21
+ flex-wrap: nowrap;
22
+ justify-content: space-between;
23
+ overflow-x: auto;
24
+ }
25
+
26
+ trix-toolbar .trix-button-group {
27
+ display: flex;
28
+ margin-bottom: 10px;
29
+ border: 1px solid #bbb;
30
+ border-top-color: #ccc;
31
+ border-bottom-color: #888;
32
+ border-radius: 3px;
33
+ }
34
+
35
+ trix-toolbar .trix-button-group:not(:first-child) {
36
+ margin-left: 1.5vw;
37
+ }
38
+
39
+ @media (max-device-width: 768px) {
40
+ trix-toolbar .trix-button-group:not(:first-child) {
41
+ margin-left: 0;
42
+ }
43
+ }
44
+
45
+ trix-toolbar .trix-button-group-spacer {
46
+ flex-grow: 1;
47
+ }
48
+
49
+ @media (max-device-width: 768px) {
50
+ trix-toolbar .trix-button-group-spacer {
51
+ display: none;
52
+ }
53
+ }
54
+
55
+ trix-toolbar .trix-button {
56
+ position: relative;
57
+ float: left;
58
+ color: rgba(0, 0, 0, 0.6);
59
+ font-size: 0.75em;
60
+ font-weight: 600;
61
+ white-space: nowrap;
62
+ padding: 0 0.5em;
63
+ margin: 0;
64
+ outline: none;
65
+ border: none;
66
+ border-bottom: 1px solid #ddd;
67
+ border-radius: 0;
68
+ background: transparent;
69
+ }
70
+
71
+ trix-toolbar .trix-button:not(:first-child) {
72
+ border-left: 1px solid #ccc;
73
+ }
74
+
75
+ trix-toolbar .trix-button.trix-active {
76
+ background: #cbeefa;
77
+ color: black;
78
+ }
79
+
80
+ trix-toolbar .trix-button:not(:disabled) {
81
+ cursor: pointer;
82
+ }
83
+
84
+ trix-toolbar .trix-button:disabled {
85
+ color: rgba(0, 0, 0, 0.125);
86
+ }
87
+
88
+ @media (max-device-width: 768px) {
89
+ trix-toolbar .trix-button {
90
+ letter-spacing: -0.01em;
91
+ padding: 0 0.3em;
92
+ }
93
+ }
94
+
95
+ trix-toolbar .trix-button--icon {
96
+ font-size: inherit;
97
+ width: 2.6em;
98
+ height: 1.6em;
99
+ max-width: calc(0.8em + 4vw);
100
+ text-indent: -9999px;
101
+ }
102
+
103
+ @media (max-device-width: 768px) {
104
+ trix-toolbar .trix-button--icon {
105
+ height: 2em;
106
+ max-width: calc(0.8em + 3.5vw);
107
+ }
108
+ }
109
+
110
+ trix-toolbar .trix-button--icon::before {
111
+ display: inline-block;
112
+ position: absolute;
113
+ top: 0;
114
+ right: 0;
115
+ bottom: 0;
116
+ left: 0;
117
+ opacity: 0.6;
118
+ content: "";
119
+ background-position: center;
120
+ background-repeat: no-repeat;
121
+ background-size: contain;
122
+ }
123
+
124
+ @media (max-device-width: 768px) {
125
+ trix-toolbar .trix-button--icon::before {
126
+ right: 6%;
127
+ left: 6%;
128
+ }
129
+ }
130
+
131
+ trix-toolbar .trix-button--icon.trix-active::before {
132
+ opacity: 1;
133
+ }
134
+
135
+ trix-toolbar .trix-button--icon:disabled::before {
136
+ opacity: 0.125;
137
+ }
138
+
139
+ trix-toolbar .trix-button--icon-attach::before {
140
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M16.5%206v11.5a4%204%200%201%201-8%200V5a2.5%202.5%200%200%201%205%200v10.5a1%201%200%201%201-2%200V6H10v9.5a2.5%202.5%200%200%200%205%200V5a4%204%200%201%200-8%200v12.5a5.5%205.5%200%200%200%2011%200V6h-1.5z%22%2F%3E%3C%2Fsvg%3E);
141
+ top: 8%;
142
+ bottom: 4%;
143
+ }
144
+
145
+ trix-toolbar .trix-button--icon-bold::before {
146
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M15.6%2011.8c1-.7%201.6-1.8%201.6-2.8a4%204%200%200%200-4-4H7v14h7c2.1%200%203.7-1.7%203.7-3.8%200-1.5-.8-2.8-2.1-3.4zM10%207.5h3a1.5%201.5%200%201%201%200%203h-3v-3zm3.5%209H10v-3h3.5a1.5%201.5%200%201%201%200%203z%22%2F%3E%3C%2Fsvg%3E);
147
+ }
148
+
149
+ trix-toolbar .trix-button--icon-italic::before {
150
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M10%205v3h2.2l-3.4%208H6v3h8v-3h-2.2l3.4-8H18V5h-8z%22%2F%3E%3C%2Fsvg%3E);
151
+ }
152
+
153
+ trix-toolbar .trix-button--icon-link::before {
154
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M9.88%2013.7a4.3%204.3%200%200%201%200-6.07l3.37-3.37a4.26%204.26%200%200%201%206.07%200%204.3%204.3%200%200%201%200%206.06l-1.96%201.72a.91.91%200%201%201-1.3-1.3l1.97-1.71a2.46%202.46%200%200%200-3.48-3.48l-3.38%203.37a2.46%202.46%200%200%200%200%203.48.91.91%200%201%201-1.3%201.3z%22%2F%3E%3Cpath%20d%3D%22M4.25%2019.46a4.3%204.3%200%200%201%200-6.07l1.93-1.9a.91.91%200%201%201%201.3%201.3l-1.93%201.9a2.46%202.46%200%200%200%203.48%203.48l3.37-3.38c.96-.96.96-2.52%200-3.48a.91.91%200%201%201%201.3-1.3%204.3%204.3%200%200%201%200%206.07l-3.38%203.38a4.26%204.26%200%200%201-6.07%200z%22%2F%3E%3C%2Fsvg%3E);
155
+ }
156
+
157
+ trix-toolbar .trix-button--icon-strike::before {
158
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M12.73%2014l.28.14c.26.15.45.3.57.44.12.14.18.3.18.5%200%20.3-.15.56-.44.75-.3.2-.76.3-1.39.3A13.52%2013.52%200%200%201%207%2014.95v3.37a10.64%2010.64%200%200%200%204.84.88c1.26%200%202.35-.19%203.28-.56.93-.37%201.64-.9%202.14-1.57s.74-1.45.74-2.32c0-.26-.02-.51-.06-.75h-5.21zm-5.5-4c-.08-.34-.12-.7-.12-1.1%200-1.29.52-2.3%201.58-3.02%201.05-.72%202.5-1.08%204.34-1.08%201.62%200%203.28.34%204.97%201l-1.3%202.93c-1.47-.6-2.73-.9-3.8-.9-.55%200-.96.08-1.2.26-.26.17-.38.38-.38.64%200%20.27.16.52.48.74.17.12.53.3%201.05.53H7.23zM3%2013h18v-2H3v2z%22%2F%3E%3C%2Fsvg%3E);
159
+ }
160
+
161
+ trix-toolbar .trix-button--icon-quote::before {
162
+ background-image: url(data:image/svg+xml,%3Csvg%20version%3D%221%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M6%2017h3l2-4V7H5v6h3zm8%200h3l2-4V7h-6v6h3z%22%2F%3E%3C%2Fsvg%3E);
163
+ }
164
+
165
+ trix-toolbar .trix-button--icon-heading-1::before {
166
+ background-image: url(data:image/svg+xml,%3Csvg%20version%3D%221%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M12%209v3H9v7H6v-7H3V9h9zM8%204h14v3h-6v12h-3V7H8V4z%22%2F%3E%3C%2Fsvg%3E);
167
+ }
168
+
169
+ trix-toolbar .trix-button--icon-code::before {
170
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M18.2%2012L15%2015.2l1.4%201.4L21%2012l-4.6-4.6L15%208.8l3.2%203.2zM5.8%2012L9%208.8%207.6%207.4%203%2012l4.6%204.6L9%2015.2%205.8%2012z%22%2F%3E%3C%2Fsvg%3E);
171
+ }
172
+
173
+ trix-toolbar .trix-button--icon-bullet-list::before {
174
+ background-image: url(data:image/svg+xml,%3Csvg%20version%3D%221%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M4%204a2%202%200%201%200%200%204%202%202%200%200%200%200-4zm0%206a2%202%200%201%200%200%204%202%202%200%200%200%200-4zm0%206a2%202%200%201%200%200%204%202%202%200%200%200%200-4zm4%203h14v-2H8v2zm0-6h14v-2H8v2zm0-8v2h14V5H8z%22%2F%3E%3C%2Fsvg%3E);
175
+ }
176
+
177
+ trix-toolbar .trix-button--icon-number-list::before {
178
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M2%2017h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1%203h1.8L2%2013.1v.9h3v-1H3.2L5%2010.9V10H2v1zm5-6v2h14V5H7zm0%2014h14v-2H7v2zm0-6h14v-2H7v2z%22%2F%3E%3C%2Fsvg%3E);
179
+ }
180
+
181
+ trix-toolbar .trix-button--icon-undo::before {
182
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M12.5%208c-2.6%200-5%201-6.9%202.6L2%207v9h9l-3.6-3.6A8%208%200%200%201%2020%2016l2.4-.8a10.5%2010.5%200%200%200-10-7.2z%22%2F%3E%3C%2Fsvg%3E);
183
+ }
184
+
185
+ trix-toolbar .trix-button--icon-redo::before {
186
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M18.4%2010.6a10.5%2010.5%200%200%200-16.9%204.6L4%2016a8%208%200%200%201%2012.7-3.6L13%2016h9V7l-3.6%203.6z%22%2F%3E%3C%2Fsvg%3E);
187
+ }
188
+
189
+ trix-toolbar .trix-button--icon-decrease-nesting-level::before {
190
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M3%2019h19v-2H3v2zm7-6h12v-2H10v2zm-8.3-.3l2.8%202.9L6%2014.2%204%2012l2-2-1.4-1.5L1%2012l.7.7zM3%205v2h19V5H3z%22%2F%3E%3C%2Fsvg%3E);
191
+ }
192
+
193
+ trix-toolbar .trix-button--icon-increase-nesting-level::before {
194
+ background-image: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%3E%3Cpath%20d%3D%22M3%2019h19v-2H3v2zm7-6h12v-2H10v2zm-6.9-1L1%2014.2l1.4%201.4L6%2012l-.7-.7-2.8-2.8L1%209.9%203.1%2012zM3%205v2h19V5H3z%22%2F%3E%3C%2Fsvg%3E);
195
+ }
196
+
197
+ trix-toolbar .trix-dialogs {
198
+ position: relative;
199
+ }
200
+
201
+ trix-toolbar .trix-dialog {
202
+ position: absolute;
203
+ top: 0;
204
+ left: 0;
205
+ right: 0;
206
+ font-size: 0.75em;
207
+ padding: 15px 10px;
208
+ background: #fff;
209
+ box-shadow: 0 0.3em 1em #ccc;
210
+ border-top: 2px solid #888;
211
+ border-radius: 5px;
212
+ z-index: 5;
213
+ }
214
+
215
+ trix-toolbar .trix-input--dialog {
216
+ font-size: inherit;
217
+ font-weight: normal;
218
+ padding: 0.5em 0.8em;
219
+ margin: 0 10px 0 0;
220
+ border-radius: 3px;
221
+ border: 1px solid #bbb;
222
+ background-color: #fff;
223
+ box-shadow: none;
224
+ outline: none;
225
+ -webkit-appearance: none;
226
+ -moz-appearance: none;
227
+ }
228
+
229
+ trix-toolbar .trix-input--dialog.validate:invalid {
230
+ box-shadow: #F00 0px 0px 1.5px 1px;
231
+ }
232
+
233
+ trix-toolbar .trix-button--dialog {
234
+ font-size: inherit;
235
+ padding: 0.5em;
236
+ border-bottom: none;
237
+ }
238
+
239
+ trix-toolbar .trix-dialog--link {
240
+ max-width: 600px;
241
+ }
242
+
243
+ trix-toolbar .trix-dialog__link-fields {
244
+ display: flex;
245
+ align-items: baseline;
246
+ }
247
+
248
+ trix-toolbar .trix-dialog__link-fields .trix-input {
249
+ flex: 1;
250
+ }
251
+
252
+ trix-toolbar .trix-dialog__link-fields .trix-button-group {
253
+ flex: 0 0 content;
254
+ margin: 0;
255
+ }
256
+
257
+ trix-editor [data-trix-mutable]:not(.attachment__caption-editor) {
258
+ -webkit-user-select: none;
259
+ -moz-user-select: none;
260
+ -ms-user-select: none;
261
+ user-select: none;
262
+ }
263
+
264
+ trix-editor [data-trix-mutable]::-moz-selection,
265
+ trix-editor [data-trix-cursor-target]::-moz-selection, trix-editor [data-trix-mutable] ::-moz-selection {
266
+ background: none;
267
+ }
268
+
269
+ trix-editor [data-trix-mutable]::selection,
270
+ trix-editor [data-trix-cursor-target]::selection, trix-editor [data-trix-mutable] ::selection {
271
+ background: none;
272
+ }
273
+
274
+ trix-editor [data-trix-mutable].attachment__caption-editor:focus::-moz-selection {
275
+ background: highlight;
276
+ }
277
+
278
+ trix-editor [data-trix-mutable].attachment__caption-editor:focus::selection {
279
+ background: highlight;
280
+ }
281
+
282
+ trix-editor [data-trix-mutable].attachment.attachment--file {
283
+ box-shadow: 0 0 0 2px highlight;
284
+ border-color: transparent;
285
+ }
286
+
287
+ trix-editor [data-trix-mutable].attachment img {
288
+ box-shadow: 0 0 0 2px highlight;
289
+ }
290
+
291
+ trix-editor .attachment {
292
+ position: relative;
293
+ }
294
+
295
+ trix-editor .attachment:hover {
296
+ cursor: default;
297
+ }
298
+
299
+ trix-editor .attachment--preview .attachment__caption:hover {
300
+ cursor: text;
301
+ }
302
+
303
+ trix-editor .attachment__progress {
304
+ position: absolute;
305
+ z-index: 1;
306
+ height: 20px;
307
+ top: calc(50% - 10px);
308
+ left: 5%;
309
+ width: 90%;
310
+ opacity: 0.9;
311
+ transition: opacity 200ms ease-in;
312
+ }
313
+
314
+ trix-editor .attachment__progress[value="100"] {
315
+ opacity: 0;
316
+ }
317
+
318
+ trix-editor .attachment__caption-editor {
319
+ display: inline-block;
320
+ width: 100%;
321
+ margin: 0;
322
+ padding: 0;
323
+ font-size: inherit;
324
+ font-family: inherit;
325
+ line-height: inherit;
326
+ color: inherit;
327
+ text-align: center;
328
+ vertical-align: top;
329
+ border: none;
330
+ outline: none;
331
+ -webkit-appearance: none;
332
+ -moz-appearance: none;
333
+ }
334
+
335
+ trix-editor .attachment__toolbar {
336
+ position: absolute;
337
+ z-index: 1;
338
+ top: -0.9em;
339
+ left: 0;
340
+ width: 100%;
341
+ text-align: center;
342
+ }
343
+
344
+ trix-editor .trix-button-group {
345
+ display: inline-flex;
346
+ }
347
+
348
+ trix-editor .trix-button {
349
+ position: relative;
350
+ float: left;
351
+ color: #666;
352
+ white-space: nowrap;
353
+ font-size: 80%;
354
+ padding: 0 0.8em;
355
+ margin: 0;
356
+ outline: none;
357
+ border: none;
358
+ border-radius: 0;
359
+ background: transparent;
360
+ }
361
+
362
+ trix-editor .trix-button:not(:first-child) {
363
+ border-left: 1px solid #ccc;
364
+ }
365
+
366
+ trix-editor .trix-button.trix-active {
367
+ background: #cbeefa;
368
+ }
369
+
370
+ trix-editor .trix-button:not(:disabled) {
371
+ cursor: pointer;
372
+ }
373
+
374
+ trix-editor .trix-button--remove {
375
+ text-indent: -9999px;
376
+ display: inline-block;
377
+ padding: 0;
378
+ outline: none;
379
+ width: 1.8em;
380
+ height: 1.8em;
381
+ line-height: 1.8em;
382
+ border-radius: 50%;
383
+ background-color: #fff;
384
+ border: 2px solid highlight;
385
+ box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.25);
386
+ }
387
+
388
+ trix-editor .trix-button--remove::before {
389
+ display: inline-block;
390
+ position: absolute;
391
+ top: 0;
392
+ right: 0;
393
+ bottom: 0;
394
+ left: 0;
395
+ opacity: 0.7;
396
+ content: "";
397
+ background-image: url(data:image/svg+xml,%3Csvg%20height%3D%2224%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M19%206.4L17.6%205%2012%2010.6%206.4%205%205%206.4l5.6%205.6L5%2017.6%206.4%2019l5.6-5.6%205.6%205.6%201.4-1.4-5.6-5.6z%22%2F%3E%3Cpath%20d%3D%22M0%200h24v24H0z%22%20fill%3D%22none%22%2F%3E%3C%2Fsvg%3E);
398
+ background-position: center;
399
+ background-repeat: no-repeat;
400
+ background-size: 90%;
401
+ }
402
+
403
+ trix-editor .trix-button--remove:hover {
404
+ border-color: #333;
405
+ }
406
+
407
+ trix-editor .trix-button--remove:hover::before {
408
+ opacity: 1;
409
+ }
410
+
411
+ trix-editor .attachment__metadata-container {
412
+ position: relative;
413
+ }
414
+
415
+ trix-editor .attachment__metadata {
416
+ position: absolute;
417
+ left: 50%;
418
+ top: 2em;
419
+ transform: translate(-50%, 0);
420
+ max-width: 90%;
421
+ padding: 0.1em 0.6em;
422
+ font-size: 0.8em;
423
+ color: #fff;
424
+ background-color: rgba(0, 0, 0, 0.7);
425
+ border-radius: 3px;
426
+ }
427
+
428
+ trix-editor .attachment__metadata .attachment__name {
429
+ display: inline-block;
430
+ max-width: 100%;
431
+ vertical-align: bottom;
432
+ overflow: hidden;
433
+ text-overflow: ellipsis;
434
+ white-space: nowrap;
435
+ }
436
+
437
+ trix-editor .attachment__metadata .attachment__size {
438
+ margin-left: 0.2em;
439
+ white-space: nowrap;
440
+ }
441
+
442
+ @charset "UTF-8";
443
+ .trix-content {
444
+ line-height: 1.5;
445
+ }
446
+
447
+ .trix-content * {
448
+ box-sizing: border-box;
449
+ margin: 0;
450
+ padding: 0;
451
+ }
452
+
453
+ .trix-content h1 {
454
+ font-size: 1.2em;
455
+ line-height: 1.2;
456
+ }
457
+
458
+ .trix-content blockquote {
459
+ border: 0 solid #ccc;
460
+ border-left-width: 0.3em;
461
+ margin-left: 0.3em;
462
+ padding-left: 0.6em;
463
+ }
464
+
465
+ .trix-content [dir=rtl] blockquote,
466
+ .trix-content blockquote[dir=rtl] {
467
+ border-width: 0;
468
+ border-right-width: 0.3em;
469
+ margin-right: 0.3em;
470
+ padding-right: 0.6em;
471
+ }
472
+
473
+ .trix-content li {
474
+ margin-left: 1em;
475
+ }
476
+
477
+ .trix-content [dir=rtl] li {
478
+ margin-right: 1em;
479
+ }
480
+
481
+ .trix-content pre {
482
+ display: inline-block;
483
+ width: 100%;
484
+ vertical-align: top;
485
+ font-family: monospace;
486
+ font-size: 0.9em;
487
+ padding: 0.5em;
488
+ white-space: pre;
489
+ background-color: #eee;
490
+ overflow-x: auto;
491
+ }
492
+
493
+ .trix-content img {
494
+ max-width: 100%;
495
+ height: auto;
496
+ }
497
+
498
+ .trix-content .attachment {
499
+ display: inline-block;
500
+ position: relative;
501
+ max-width: 100%;
502
+ }
503
+
504
+ .trix-content .attachment a {
505
+ color: inherit;
506
+ text-decoration: none;
507
+ }
508
+
509
+ .trix-content .attachment a:hover, .trix-content .attachment a:visited:hover {
510
+ color: inherit;
511
+ }
512
+
513
+ .trix-content .attachment__caption {
514
+ text-align: center;
515
+ }
516
+
517
+ .trix-content .attachment__caption .attachment__name + .attachment__size::before {
518
+ content: ' · ';
519
+ }
520
+
521
+ .trix-content .attachment--preview {
522
+ width: 100%;
523
+ text-align: center;
524
+ }
525
+
526
+ .trix-content .attachment--preview .attachment__caption {
527
+ color: #666;
528
+ font-size: 0.9em;
529
+ line-height: 1.2;
530
+ }
531
+
532
+ .trix-content .attachment--file {
533
+ color: #333;
534
+ line-height: 1;
535
+ margin: 0 2px 2px 2px;
536
+ padding: 0.4em 1em;
537
+ border: 1px solid #bbb;
538
+ border-radius: 5px;
539
+ }
540
+
541
+ .trix-content .attachment-gallery {
542
+ display: flex;
543
+ flex-wrap: wrap;
544
+ position: relative;
545
+ }
546
+
547
+ .trix-content .attachment-gallery .attachment {
548
+ flex: 1 0 33%;
549
+ padding: 0 0.5em;
550
+ max-width: 33%;
551
+ }
552
+
553
+ .trix-content .attachment-gallery.attachment-gallery--2 .attachment, .trix-content .attachment-gallery.attachment-gallery--4 .attachment {
554
+ flex-basis: 50%;
555
+ max-width: 50%;
556
+ }
@@ -0,0 +1,18 @@
1
+ module Rtcl
2
+ class ApplicationController < Rtcl.config.base_controller.constantize
3
+ include Polivalente::UserLocale
4
+ before_action :set_user_locale!
5
+
6
+ def set_page_title
7
+ @page_title = controller_name.capitalize
8
+ end
9
+
10
+ rescue_from CanCan::AccessDenied do |exception|
11
+ respond_to do |format|
12
+ format.json { head :forbidden }
13
+ format.html { redirect_back fallback_location: main_app.root_path, flash: { error: exception.message } }
14
+ # format.html { redirect_to main_app.new_user_session_path || main_app.root_url, flash: { error: exception.message } }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ module Rtcl
2
+ class Articles::CommentsController < Polivalente::CommentsController
3
+ before_action :set_commentable, only: [:create, :destroy]
4
+
5
+ private
6
+
7
+ def set_commentable
8
+ @commentable = Article.find(params[:article_id])
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,65 @@
1
+ module Rtcl
2
+ class ArticlesController < ApplicationController
3
+ before_action :set_article, except: [:index, :create, :new]
4
+ load_and_authorize_resource
5
+
6
+ include Pagy::Backend
7
+
8
+ def index
9
+ if params[:tag]
10
+ @paginator, @articles = pagy(Article.tagged_with(params[:tag]).accessible_by(current_ability).latest, items: 8)
11
+ else
12
+ @paginator, @articles = pagy(Article.kept.accessible_by(current_ability).latest, items: 8)
13
+ end
14
+ respond_to do |format|
15
+ format.html
16
+ format.rss { render :layout => false }
17
+ end
18
+ end
19
+
20
+ def show
21
+ end
22
+
23
+ def new
24
+ @article = Article.new
25
+ end
26
+
27
+ def edit
28
+ end
29
+
30
+ def create
31
+ @article = Article.new(article_params.merge(author: current_user))
32
+ if @article.save
33
+ redirect_to @article
34
+ else
35
+ render :new
36
+ end
37
+ end
38
+
39
+ def update
40
+ if @article.update(article_params)
41
+ render :show
42
+ else
43
+ render :edit
44
+ end
45
+ end
46
+
47
+ def destroy
48
+ @article.discard!
49
+ redirect_to articles_path
50
+ end
51
+
52
+ private
53
+
54
+ # Use callbacks to share common setup or constraints between actions.
55
+ def set_article
56
+ @article = Article.find(params[:id])
57
+ @page_title = @article.title
58
+ end
59
+
60
+ # Only allow a list of trusted parameters through.
61
+ def article_params
62
+ params.require(:article).permit(:title, :content, :excerpt, :status, :is_private, :language, :tag_list)
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,27 @@
1
+ module Rtcl
2
+ class CommentsController < ApplicationController
3
+ def create
4
+ @comment = @commentable.comments.new(comment_params)
5
+ @comment.user = current_user
6
+ @comment.save
7
+ redirect_to @commentable, notice: "Your comment was successfully posted."
8
+ end
9
+
10
+ def destroy
11
+ @comment = Polivalente::Comment.where(user_id: current_user.id).find(params[:id])
12
+
13
+ @comment.destroy if @comment
14
+
15
+ respond_to do |format|
16
+ format.html { redirect_back(fallback_location: @commentable) }
17
+ format.json { head :no_content }
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def comment_params
24
+ params.require(:comment).permit(:content)
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ module Rtcl
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Rtcl
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Rtcl
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
6
+ end