polivalente 0.6.2 → 0.7.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 +4 -0
- data/app/assets/build/css/components/_bookmarks.scss +20 -0
- data/app/assets/build/css/components/_colors.scss +104 -0
- data/app/assets/build/css/components/_forms.scss +23 -0
- data/app/assets/build/css/components/_pagination.scss +75 -0
- data/app/assets/build/css/components/_player.scss +148 -0
- data/app/assets/build/css/components/_tags.scss +29 -0
- data/app/assets/build/css/components/_themes.scss +69 -0
- data/app/assets/build/css/components/_tribute.scss +25 -0
- data/app/assets/build/css/components/plyr.css +1 -0
- data/app/assets/build/css/components/trix/_clipboard.scss +27 -0
- data/app/assets/build/css/components/trix/_trix.scss +181 -0
- data/app/assets/build/css/index.css +19 -0
- data/app/assets/build/js/application.js +2 -0
- data/app/assets/build/js/controllers/accordion_controller.js +21 -0
- data/app/assets/build/js/controllers/dynamic_select_controller.js +22 -0
- data/app/assets/build/js/controllers/index.js +33 -0
- data/app/assets/build/js/controllers/offline_controller.js +19 -0
- data/app/assets/build/js/controllers/reactive_text_controller.js +15 -0
- data/app/assets/build/js/controllers/text_counter_controller.js +38 -0
- data/app/assets/build/js/controllers/theme_controller.js +36 -0
- data/app/assets/build/js/controllers/trix_attachment_blocker_controller.js +15 -0
- data/app/assets/build/js/controllers/trix_autocomplete_controller.js +86 -0
- data/app/assets/build/js/controllers/trix_blockcode_controller.js +41 -0
- data/app/assets/build/js/controllers/trix_clipboard_controller.js +50 -0
- data/app/assets/build/js/controllers/trix_color_controller.js +49 -0
- data/app/assets/build/js/controllers/trix_highlight_controller.js +55 -0
- data/app/assets/build/js/controllers/trix_plyr_controller.js +86 -0
- data/app/assets/build/js/controllers/trix_toolbar_controller.js +48 -0
- data/app/assets/config/polivalente_manifest.js +1 -0
- data/app/assets/javascripts/polivalente/application.js +173 -0
- data/app/assets/stylesheets/polivalente/application.css +3 -14
- data/app/assets/stylesheets/polivalente/styles.css +1928 -0
- data/app/controllers/polivalente/application_controller.rb +2 -0
- data/app/controllers/polivalente/archives_controller.rb +18 -0
- data/app/controllers/polivalente/autocomplete_controller.rb +2 -3
- data/app/controllers/polivalente/comments_controller.rb +27 -0
- data/app/controllers/polivalente/trashes_controller.rb +18 -0
- data/app/controllers/polivalente/users_controller.rb +42 -0
- data/app/helpers/polivalente/gravatar_helper.rb +0 -4
- data/app/models/polivalente/tag.rb +1 -0
- data/app/views/layouts/polivalente/application.html.erb +9 -3
- data/app/views/polivalente/archives/_archive.html.erb +2 -0
- data/app/views/polivalente/archives/index.html.erb +3 -0
- data/app/views/polivalente/archives/show.html.erb +3 -0
- data/app/views/polivalente/autocomplete/tags.json.jbuilder +1 -0
- data/app/views/polivalente/autocomplete/users.json.jbuilder +1 -0
- data/app/views/polivalente/shared/_notices.html.erb +10 -0
- data/app/views/polivalente/shared/_offline_indicator.html.erb +10 -0
- data/app/views/polivalente/shared/_theme_toggle.html.erb +1 -0
- data/app/views/polivalente/tags/_cloud.html.erb +7 -0
- data/app/views/polivalente/tags/_list.html.erb +5 -0
- data/app/views/polivalente/tags/_tag.html.erb +1 -0
- data/app/views/polivalente/tags/_tag.json.jbuilder +4 -0
- data/app/views/polivalente/trashes/_trash.html.erb +2 -0
- data/app/views/polivalente/trashes/index.html.erb +3 -0
- data/app/views/polivalente/trashes/show.html.erb +3 -0
- data/app/views/polivalente/users/_form.html.erb +38 -0
- data/app/views/polivalente/users/_user.html.erb +4 -0
- data/app/views/polivalente/users/_user.json.jbuilder +4 -0
- data/app/views/polivalente/users/activities/_activity.html.erb +12 -0
- data/app/views/polivalente/users/activities/_recent.html.erb +17 -0
- data/app/views/polivalente/users/edit.html.erb +13 -0
- data/app/views/polivalente/users/related/_user.html.erb +14 -0
- data/app/views/polivalente/users/related/_users.html.erb +14 -0
- data/app/views/polivalente/users/show.html.erb +180 -0
- data/config/locales/en.yml +72 -0
- data/config/locales/es.yml +72 -0
- data/config/locales/fr.yml +74 -0
- data/config/locales/pt.yml +72 -0
- data/config/routes.rb +6 -0
- data/lib/generators/polivalente/install/install_generator.rb +1 -1
- data/lib/generators/polivalente/locales/locales_generator.rb +11 -0
- data/lib/generators/polivalente/templates/user.rb +3 -0
- data/lib/polivalente/engine.rb +1 -0
- data/lib/polivalente/version.rb +1 -1
- data/lib/polivalente.rb +3 -0
- metadata +107 -2
@@ -0,0 +1,55 @@
|
|
1
|
+
import {Controller} from "@hotwired/stimulus"
|
2
|
+
import highlightJs from 'highlight.js'
|
3
|
+
|
4
|
+
|
5
|
+
// Connects to data-controller="trix-highlight"
|
6
|
+
export default class extends Controller {
|
7
|
+
connect() {
|
8
|
+
console.log("trix-highlight")
|
9
|
+
|
10
|
+
highlightJs.configure({
|
11
|
+
languages: [
|
12
|
+
'applescript',
|
13
|
+
'bash',
|
14
|
+
'css',
|
15
|
+
'erb',
|
16
|
+
'html',
|
17
|
+
'javascript',
|
18
|
+
'php',
|
19
|
+
'python',
|
20
|
+
'ruby',
|
21
|
+
'swift',
|
22
|
+
'typescript',
|
23
|
+
]
|
24
|
+
})
|
25
|
+
|
26
|
+
highlightJs.highlightAll()
|
27
|
+
|
28
|
+
const formatBlocks = () => {
|
29
|
+
document.querySelectorAll('pre')
|
30
|
+
.forEach((block) => highlightJs.highlightElement(block))
|
31
|
+
}
|
32
|
+
|
33
|
+
const createClipboardCopyButton = () => {
|
34
|
+
document.querySelectorAll('article')
|
35
|
+
.forEach((article) => {
|
36
|
+
article.querySelectorAll('pre')
|
37
|
+
.forEach((block) => {
|
38
|
+
if (block.previousSibling.tagName === 'BUTTON') return;
|
39
|
+
|
40
|
+
const sample = document.createElement('div')
|
41
|
+
sample.classList.add('code-sample', 'my-3')
|
42
|
+
sample.insertAdjacentHTML('afterbegin', '<button class="copy z-4"></button>')
|
43
|
+
|
44
|
+
block.replaceWith(sample)
|
45
|
+
|
46
|
+
sample.insertAdjacentElement('beforeend', block)
|
47
|
+
})
|
48
|
+
})
|
49
|
+
}
|
50
|
+
|
51
|
+
//
|
52
|
+
formatBlocks()
|
53
|
+
createClipboardCopyButton()
|
54
|
+
}
|
55
|
+
}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import {Controller} from "@hotwired/stimulus"
|
2
|
+
import Plyr from "plyr"
|
3
|
+
import Trix from "trix"
|
4
|
+
|
5
|
+
// Connects to data-controller="trix-plyr"
|
6
|
+
export default class extends Controller {
|
7
|
+
static targets = ['editor']
|
8
|
+
|
9
|
+
get validContent() {
|
10
|
+
return ['audio', 'video']
|
11
|
+
}
|
12
|
+
|
13
|
+
get options() {
|
14
|
+
return {
|
15
|
+
autopause: true,
|
16
|
+
controls: [
|
17
|
+
'play-large',
|
18
|
+
'play',
|
19
|
+
'progress',
|
20
|
+
'current-time',
|
21
|
+
'mute',
|
22
|
+
'volume',
|
23
|
+
'captions',
|
24
|
+
'settings',
|
25
|
+
'pip',
|
26
|
+
'airplay',
|
27
|
+
'fullscreen'
|
28
|
+
],
|
29
|
+
settings: ['captions', 'quality', 'speed', 'loop'],
|
30
|
+
captions: {active: true, language: 'auto'},
|
31
|
+
fullscreen: {enabled: true, fallback: true, iosNative: false, container: null},
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
get container() {
|
36
|
+
return this['hasEditorTarget']
|
37
|
+
? this['editorTarget']
|
38
|
+
: document.querySelector('.trix-content')
|
39
|
+
}
|
40
|
+
|
41
|
+
connect() {
|
42
|
+
let isEditor = !!(this.container.attributes.contentEditable)
|
43
|
+
|
44
|
+
// if (isEditor)
|
45
|
+
// this.parsePlayerInEditor()
|
46
|
+
// else
|
47
|
+
// this.createPlayers()
|
48
|
+
}
|
49
|
+
|
50
|
+
createPlayers() {
|
51
|
+
window.players = Array
|
52
|
+
.from(document.querySelectorAll('audio, video'))
|
53
|
+
.map(player => new Plyr(player, this.options))
|
54
|
+
}
|
55
|
+
|
56
|
+
parsePlayerInEditor() {
|
57
|
+
window.attachments = []
|
58
|
+
window.originalAttachments = []
|
59
|
+
|
60
|
+
this.container.editor
|
61
|
+
.getDocument()
|
62
|
+
.getAttachments()
|
63
|
+
.filter(attachment => this.validContent.includes(attachment.getContentType().split('/')[0]))
|
64
|
+
.forEach(attachment => {
|
65
|
+
let range = this.container.editor.getDocument().getRangeOfAttachment(attachment)
|
66
|
+
let src = attachment.getAttributes().url
|
67
|
+
let tag = attachment.getContentType().split('/')[0]
|
68
|
+
|
69
|
+
let content = `<${tag} src="${src}" controls="true"></${tag}>`
|
70
|
+
|
71
|
+
// Add Plyr attachment for preview purposes only
|
72
|
+
this.container.editor.setSelectedRange([range[0] + 1, range[1] + 1])
|
73
|
+
|
74
|
+
let newAttachment = new Trix.Attachment({
|
75
|
+
content,
|
76
|
+
contentType: 'plyr',
|
77
|
+
serialize: false,
|
78
|
+
trixSerialize: false
|
79
|
+
})
|
80
|
+
this.container.editor.insertAttachment(newAttachment)
|
81
|
+
|
82
|
+
// window.attachments.push(newAttachment)
|
83
|
+
// window.originalAttachments.push(attachment)
|
84
|
+
})
|
85
|
+
}
|
86
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import {Controller} from "@hotwired/stimulus"
|
2
|
+
import Trix from "trix"
|
3
|
+
|
4
|
+
const {lang} = Trix.config;
|
5
|
+
|
6
|
+
// Connects to data-controller="trix-toolbar"
|
7
|
+
export default class extends Controller {
|
8
|
+
connect() {
|
9
|
+
console.log("trix-toolbar")
|
10
|
+
|
11
|
+
// /* What the newly created button does */
|
12
|
+
// Trix.config.textAttributes.red = {
|
13
|
+
// style: { color: "red" },
|
14
|
+
// parser: (element) => element.style.color === "red",
|
15
|
+
// inheritable: true
|
16
|
+
// }
|
17
|
+
|
18
|
+
// /* Insert the button visual in the default toolbar */
|
19
|
+
// addEventListener("trix-initialize", function(event) {
|
20
|
+
// var buttonHTML = '<button type="button" class="trix-button" data-trix-attribute="red">RED</button>'
|
21
|
+
|
22
|
+
// event.target.toolbarElement.
|
23
|
+
// querySelector(".trix-button-group").
|
24
|
+
// insertAdjacentHTML("beforeend", buttonHTML)
|
25
|
+
// })
|
26
|
+
|
27
|
+
// ===============
|
28
|
+
|
29
|
+
// Grab a reference to the toolbar(s) on the page.
|
30
|
+
const toolbar = this.element.previousSibling
|
31
|
+
|
32
|
+
// HTML for our buttons
|
33
|
+
const h2ButtonHTML = '<button type="button" class="trix-button" data-trix-attribute="heading" title="Subheading">H2</button>'
|
34
|
+
const h3ButtonHTML = '<button type="button" class="trix-button" data-trix-attribute="subHeading" title="Subheading">H3</button>'
|
35
|
+
|
36
|
+
// Only apply event listeners once to the toolbars
|
37
|
+
addEventListener("trix-initialize", (event) => {
|
38
|
+
const sibling1 = toolbar.querySelector(".trix-button--icon-increase-nesting-level")
|
39
|
+
sibling1.insertAdjacentHTML("afterend", h2ButtonHTML)
|
40
|
+
const sibling2 = toolbar.querySelector("[data-trix-attribute='heading']")
|
41
|
+
sibling2.insertAdjacentHTML("afterend", h3ButtonHTML)
|
42
|
+
}/*, {once: true}*/)
|
43
|
+
|
44
|
+
console.log("trix-toolbar-post")
|
45
|
+
}
|
46
|
+
|
47
|
+
disconnect () {}
|
48
|
+
}
|