kablam 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d02c1f024ff270c98e5f4e67ac2154e7afb641c9d917064de0c9558bbdea0427
4
- data.tar.gz: 86634ed643f2b24183d140a6a3fe52d560f1a9dcc371cf46954f3a339774aebb
3
+ metadata.gz: 865d1eb66fbbd162bef912ea6b41c1781898bfc2df16f74730f47f949668fb4a
4
+ data.tar.gz: 27ffd407b3e5777ca66fddb72b3246c78eaad8d71b8c354871437fb27b9e7b0b
5
5
  SHA512:
6
- metadata.gz: 1c368445f5ea48b8044b1a590b6988abeae9d744d4a9bcfdbd8f34033eafe43784127ce4776c928263c79eaedc16ccfe76a61764e70a58d0b32191e6aefb85ee
7
- data.tar.gz: 3a4578e4037ad059adac81bcd49f6e1c24bc43d9f93ebb7c8083187ac589272c474f0cf38d7305f3ddff6dd2a459d65c6b0f02f8ff1a9b3c270f28055c51c061
6
+ metadata.gz: 87d808b09665716042463d28319ed53f17192afc847d115ac2202f3ed6ad3c88da0cb82ae910b0a497cf04c3f18751c3953a61e037e3142a0dc9e081f336ff9a
7
+ data.tar.gz: 9c4c9e40349582a48d398b9f2432af1ec3857359485f8dc36017eaaddf37e3eb86f2e9d17003ab9417ea756481f250ae62ad3adaad88cdf0c88d32ab2fe04382
@@ -1,4 +1,4 @@
1
- require 'rest-client'
1
+ # require 'rest-client'
2
2
  require 'json'
3
3
 
4
4
  class KablamController < ApplicationController
@@ -1,3 +1,4 @@
1
+ <% if params[:target].present? %>
1
2
  var content = `<%= j render "kablam/models/#{@object.model_name.singular}", obj: @object %>`
2
3
 
3
4
  document
@@ -7,4 +8,5 @@ document
7
8
  document
8
9
  .querySelector('[action$="/<%= params[:target] || "target_index" %>"]')
9
10
  .reset()
11
+ <% end %>
10
12
  <%= render_flash message: 'Created' %>
@@ -15,6 +15,7 @@
15
15
  <% if hidden.present? %>
16
16
  <% hidden.each do |k,v| %>
17
17
  <input type="hidden" name="<%= k.to_s %>" value="<%= v %>">
18
+ }
18
19
  <% end %>
19
20
  <% end %>
20
21
  <% @model.fields.each do |field| %>
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.7'
3
+ s.version = '0.2.8'
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
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.}"
@@ -75,9 +75,11 @@ module Kablam
75
75
 
76
76
  def gen_yaml(db_index)
77
77
  path = "config/locales/kablam-forms.#{name}.yml"
78
- original = YAML.load_file(path)
79
78
  yml_hash = {name => {"kablam_forms" => db_to_hash(db_index)}}
80
- yml_hash.merge!(original) if original.present?
79
+ if File.exist?(Rails.root.to_s + "/"+ path)
80
+ original = YAML.load_file(path)
81
+ yml_hash.merge!(original) if original.present?
82
+ end
81
83
 
82
84
  File.write(path, yml_hash.to_yaml)
83
85
  dump_yaml_with_double_quotes(path)
data/lib/kablam.rb CHANGED
@@ -54,3 +54,4 @@ end
54
54
  require 'kablam/engine'
55
55
  require 'kablam/forms'
56
56
  require 'kablam/kablam_record'
57
+ require 'kablam/kablam_helper'
@@ -0,0 +1,31 @@
1
+ module Kablam
2
+ module KablamHelper
3
+ def replace_with(id, content)
4
+ end
5
+
6
+ def undo_destroy_path(model)
7
+ name = model.model_name.singular
8
+ params = [[name, { destroyed_at: nil }]].to_h
9
+ polymorphic_path("data_undo", params)
10
+ end
11
+
12
+ # TODO: Complete this 🤷
13
+ def disable_test
14
+ 'console.log("test")'
15
+ end
16
+
17
+ # TODO: Use Rails UJS setData/expando to stash original state 😎
18
+ def show(model)
19
+ raw "document.getElementById('#{model.html_id}').style.display = 'table-row'"
20
+ end
21
+
22
+ def hide(model)
23
+ raw "document.getElementById('#{model.html_id}').style.display = 'none'"
24
+ end
25
+
26
+ def render_flash(partial: 'application/flash_notice', **locals)
27
+ html = j render partial: partial, locals: locals
28
+ raw "document.getElementById('flash').innerHTML = '#{html}'"
29
+ end
30
+ end
31
+ end
@@ -1,5 +1,5 @@
1
1
  module Kablam
2
- class Kablam::KablamRecord < ActiveRecord::Base
2
+ class KablamRecord < ActiveRecord::Base
3
3
  self.abstract_class = true
4
4
 
5
5
  def html_id
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.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Rivas
@@ -110,6 +110,7 @@ files:
110
110
  - lib/kablam.rb
111
111
  - lib/kablam/engine.rb
112
112
  - lib/kablam/forms.rb
113
+ - lib/kablam/kablam_helper.rb
113
114
  - lib/kablam/kablam_record.rb
114
115
  homepage: http://rubygems.org/gems/kablam
115
116
  licenses: