kablam 0.2.5 → 0.2.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e626efb6c2bfb5c0f0424021304b2c4665ec53ac5d098c28b335638a9d125076
|
4
|
+
data.tar.gz: 24474cac311ea7ea9b67f4b45631821f1e55d3f53ec353977189f1991af43c6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bb00d03e946af0cc9a853762f4731843112f9f5603fa80d646cc9e1be4cb07811d16107dff767d0f7b3349d45b05bfed70ccee45d70e1073ed83a52d4ddc30f
|
7
|
+
data.tar.gz: 4e3ffe8400233f0eea40a7487591e7b197e37abeb647a7a7bff5af34192597a96c3cf22c147ad769dedd609e420c161990282814386f0c4e861cb2ded08e867f
|
@@ -74,39 +74,5 @@ function RenderMessage(data) {
|
|
74
74
|
);
|
75
75
|
}
|
76
76
|
|
77
|
-
function insertHTML(target, content, location) {
|
78
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
function HtmlNode(target, data, options={}){
|
82
|
-
options = {
|
83
|
-
outerDivClass: options.outerDivClass || "pt3 ph3 ph2-l bg-white br2 shadow1 mb3",
|
84
|
-
innerDivClass: options.innerDivClass || "dt w-100 pb2 ph2 mt2",
|
85
|
-
imgDivClass: options.imgDivClass || "dtc w2 w3-ns v-mid",
|
86
|
-
imgClass: options.imgClass || "ba b--black-10 db br-100 w2 w3-ns h2 h3-ns",
|
87
|
-
userDivClass: options.userDivClass || "dtc v-mid pl3",
|
88
|
-
userNameClass: options.userNameClass || "f6 f5-ns fw6 lh-title black mv0",
|
89
|
-
timestampClass: options.timestampClass || "f6 fw4 mt0 mb0 black-60 i",
|
90
|
-
messageDivClass: options.messageDivClass || "ph3-l pb2",
|
91
|
-
messageClass: options.messageClass || "f5 lh-copy measure pb3"
|
92
|
-
}
|
93
|
-
|
94
|
-
var new_message = document.createElement("div");
|
95
|
-
|
96
|
-
new_message.className = options.outerDivClass;
|
97
|
-
var content = data['chat'].content.replace(/(?:\r\n|\r|\n)/g, '<br>');
|
98
|
-
new_message.innerHTML = `<div class="${options.innerDivClass}">
|
99
|
-
<div class="${options.imgDivClass}">
|
100
|
-
<img src="${data['chat'].image}" class="${options.imgClass}"/>
|
101
|
-
</div>
|
102
|
-
<div class="${options.userDivClass}">
|
103
|
-
<h1 class="${options.userNameClass}">${data['chat'].username}</h1>
|
104
|
-
<h2 class="${options.timestampClass}">${data['chat'].created_at}</h2>
|
105
|
-
</div>
|
106
|
-
</div>
|
107
|
-
<div class="${options.messageDivClass}"><p class="${options.messageClass}">${content}</p></div>`;
|
108
|
-
target.insertAdjacentElement('afterbegin', new_message);
|
109
|
-
}
|
110
|
-
|
111
77
|
var scrollPosition;
|
112
78
|
document.addEventListener('turbolinks:load', refreshScroll());
|
@@ -1,5 +1,9 @@
|
|
1
|
-
var content =
|
1
|
+
var content = `<%= j render "kablam/message", message: @message %>`;
|
2
2
|
var newMessage = HTMLElement.From(content);
|
3
3
|
var target = document.getElementById("kablam-chat-window");
|
4
4
|
|
5
|
-
|
5
|
+
<% if Kablam.message_location == "start" %>
|
6
|
+
target.innerHTML = newMessage.outerHTML + target.innerHTML;
|
7
|
+
<% elsif Kablam.message_location == "end" %>
|
8
|
+
target.innerHTML = target.innerHTML + newMessage.outerHTML;
|
9
|
+
<% end %>
|
data/kablam.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'kablam'
|
3
|
-
s.version = '0.2.
|
3
|
+
s.version = '0.2.6'
|
4
4
|
s.date = '2018-09-14'
|
5
5
|
s.summary = "Kablam! All the things you hate. But Faster."
|
6
6
|
s.description = "Gem to make development of everything in rails faster. Form creation & styling, all the resource routes, even actioncable messaging!\n {NOTE: In Development. NOT READY FOR TESTING.}"
|
@@ -42,4 +42,9 @@ Kablam.setup do |config|
|
|
42
42
|
config.multi_remove_button = "relative no-underline bg-red hover-bg-green white pa2 pl3 pr3 ml1 btn-3d br2"
|
43
43
|
config.multi_add_icon = "fa fa-plus"
|
44
44
|
config.multi_remove_icon = "fa fa-trash"
|
45
|
+
|
46
|
+
# ============================================================
|
47
|
+
# KABLAM MESSAGING
|
48
|
+
# ============================================================
|
49
|
+
config.message_location = "start" # Accepted values are "start" and "end"
|
45
50
|
end
|
data/lib/kablam.rb
CHANGED