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: ea5aa8b0bb18d19bf0fb27248b0280fc1defc81541116db1c8f20ae78b6dcbbe
4
- data.tar.gz: 608717219ca9f67c3bbaa551353c28d6804b6b0d172cf4ccc0980919a918369d
3
+ metadata.gz: e626efb6c2bfb5c0f0424021304b2c4665ec53ac5d098c28b335638a9d125076
4
+ data.tar.gz: 24474cac311ea7ea9b67f4b45631821f1e55d3f53ec353977189f1991af43c6f
5
5
  SHA512:
6
- metadata.gz: 60958bb2d96a09fd523784bb4332f039926de3f3e4785ec8619cc46fe531b10d035681c10d7c20ee189f430e864614c41af759b3f398826bf51e170bcb6fe503
7
- data.tar.gz: abe3ce049c4a68f68a14c1610c5d78bc52efc9a9e41d112f0fbbc12d7f0462371b1893ceaf270dbb710379de533962dd1f6575fb9a104acb53842c4bf7514558
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,4 +1,4 @@
1
- var content = '<%= j render "kablam/models/#{@object.model_name.singular}", obj: @object %>'
1
+ var content = `<%= j render "kablam/models/#{@object.model_name.singular}", obj: @object %>`
2
2
 
3
3
  document
4
4
  .getElementById('<%= params[:target] || "target_index" %>')
@@ -1,5 +1,9 @@
1
- var content = '<%= j render "kablam/message", message: @message %>';
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
- target.innerHTML = newMessage.outerHTML + target.innerHTML;
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 %>
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'kablam'
3
- s.version = '0.2.5'
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
@@ -28,6 +28,9 @@ module Kablam
28
28
  mattr_accessor :multi_add_icon
29
29
  mattr_accessor :multi_remove_icon
30
30
 
31
+ # Message settings
32
+ mattr_accessor :message_location
33
+
31
34
  module ClassMethods
32
35
 
33
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kablam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Rivas