kablam 0.3.7 → 0.3.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: b338c47800ce82600d8559c6bc669b20a63d197f950fe0a4b6b15800d2d4ddbe
4
- data.tar.gz: '09e87e1aad2e3f350aca2f96735f1f22d52acb878340b03299a7905f3e847f27'
3
+ metadata.gz: 90137a68468f91c7f4cdf8ed598b1f34c57d68ab9b5e0d5ce982a5e23a52fcd5
4
+ data.tar.gz: 727d5e07d5c453614eb21455e2984e74b56d748fec81c3d59d7b74ae4135dc4f
5
5
  SHA512:
6
- metadata.gz: 56ad6fe5c806be4ccc6815474d63fb541e3447e7557baf8124487137e3c1e78d49fce7cf1e53a0af85d39c71913ac572d6b8fd701216d14951ef5377ba03b831
7
- data.tar.gz: 2d31c6164b666c7b2a937d8dcdb96c4bceafac494c7e60aad323168df3158d622858d7fffc907c55ca1fd467482f1fa872938f335fc7cd4620cec540c6de1df5
6
+ metadata.gz: 9a01e79cb8ffdbd837a1b9c273a044972789b86686736a87c340ba5b02b39d08545a4817406efcb9a362bda1d0041a171103b046dfd07ce63136ac49fbeca8c5
7
+ data.tar.gz: 7e6bbf550266f841415381904627b080f31eae4b0f38242f9f17a0b6e18143d38044e24efc9cacea7268547df42b94c2e31ce0403fbd332334f9b1973e0b5660
@@ -7,7 +7,7 @@
7
7
  @form_id = "#{obj.id.blank? ? "new" : "update"}_#{@form_name}_form"
8
8
  @url = (@method == :post ? Kablam::Engine.routes.url_helpers.create_path(@table_name) : Kablam::Engine.routes.url_helpers.update_path(@table_name, obj.id))
9
9
  %>
10
-
10
+ <% yield %>
11
11
  <%= form_with model: obj, url: @url, method: @method, id: @form_id, class: classes[:form_wrapper], multipart: true do |f| %>
12
12
  <% if redirect.present? %>
13
13
  <input id="<%= @form_id %>_redirect" type="hidden" name="redirect" value="<%= redirect %>">
@@ -22,6 +22,7 @@
22
22
  <% end %>
23
23
  <% end %>
24
24
  <% @model.fields.each do |field| %>
25
+ <%= capture(&@kablam_before[field]) if @kablam_before[field].present? %>
25
26
  <% kablam_scope = "kablam_forms.#{@table_name}.#{field}" %>
26
27
  <% classyy = @model.prep_form_field[field] %>
27
28
  <% next if classyy == :exclude %>
@@ -29,6 +30,7 @@
29
30
  <% opt = obj.opt_for(field) %>
30
31
  <%= (render "kablam_forms/fields/pretext", classes: classes, input: input) if input[:pretext].present? %>
31
32
  <%= render "kablam_forms/fields/#{classyy.to_s}", classes: classes, input: input, f: f, opt: opt %>
33
+ <%= capture(&@kablam_after[field]) if @kablam_after[field].present? %>
32
34
  <% end %>
33
35
  <div>
34
36
  <%= yield(f) %>
@@ -9,6 +9,8 @@
9
9
  ajax_remove = ajax_remove || false
10
10
  redirect = redirect || nil
11
11
  scrolltop = scrolltop || false
12
+ @kablam_before = {}
13
+ @kablam_after = {}
12
14
  %>
13
15
  <%= render "kablam_forms/form_generator", classes: classes, obj: obj, target: target, hidden: hidden, ajax_remove: ajax_remove, redirect: redirect, scrolltop: scrolltop do |f| %>
14
16
  <%= yield(f) %>
data/kablam.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'kablam'
3
- s.version = '0.3.7'
3
+ s.version = '0.3.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.}"
@@ -10,10 +10,25 @@ module Kablam
10
10
  end
11
11
 
12
12
  def kablam_form_for(obj, options = {}, &block)
13
+ # @kablam_content = {}
13
14
  options[:obj] = obj
14
- render layout: "kablam_forms/kablam_form", locals: options do
15
- capture(&block) if block_given?
15
+ # options[:block] = block_given? ? block : ""
16
+ render layout: "kablam_forms/kablam_form", locals: options do |f|
17
+ capture(f, &block) if block_given?
16
18
  end
19
+ # nil
20
+ end
21
+
22
+ def kablam_before(field, &block)
23
+ @kablam_before = {} if @kablam_before.blank?
24
+ @kablam_before[field] = block
25
+ nil
26
+ end
27
+
28
+ def kablam_after(field, &block)
29
+ @kablam_after = {} if @kablam_after.blank?
30
+ @kablam_after[field] = block
31
+ nil
17
32
  end
18
33
 
19
34
  # TODO: Complete this 🤷
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.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Rivas