kablam 0.2.8 → 0.2.9

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: 865d1eb66fbbd162bef912ea6b41c1781898bfc2df16f74730f47f949668fb4a
4
- data.tar.gz: 27ffd407b3e5777ca66fddb72b3246c78eaad8d71b8c354871437fb27b9e7b0b
3
+ metadata.gz: 97a145e87413710a83b558049de185a9123526407d3fca6ed99715167d0d9718
4
+ data.tar.gz: 5266f0fd8782cc94507b586e99bd480be05cbd2b0fa2d333ec189430d894d99e
5
5
  SHA512:
6
- metadata.gz: 87d808b09665716042463d28319ed53f17192afc847d115ac2202f3ed6ad3c88da0cb82ae910b0a497cf04c3f18751c3953a61e037e3142a0dc9e081f336ff9a
7
- data.tar.gz: 9c4c9e40349582a48d398b9f2432af1ec3857359485f8dc36017eaaddf37e3eb86f2e9d17003ab9417ea756481f250ae62ad3adaad88cdf0c88d32ab2fe04382
6
+ metadata.gz: c6668f606d7c51abee9f3f1d80e98562130fea337a086f359f2f3edf17a90d8510addbc16e330aa4aa5df6bd962a6509d551d327369efbf57e9602b33be3c171
7
+ data.tar.gz: 5535eafaa22f108ab564a7cf60960a967a41a2b3eaac67c1334a7a68ff955feffb3ffe74f84c63d5c72f5604f3db63e192246959a3ec4fa7aff2a3b4ac30d909
data/.DS_Store CHANGED
Binary file
@@ -137,6 +137,16 @@ function submitRemove(form_id){
137
137
  });
138
138
  }
139
139
 
140
+ function submitRemove(form_id){
141
+ var form = document.getElementById(form_id),
142
+ path = document.getElementById(form_id+'_redirect').value;
143
+ form.addEventListener("ajax:success", function(e) {
144
+ e.preventDefault();
145
+ Turbolinks.visit(path);
146
+ });
147
+ }
148
+
149
+
140
150
  function submitToTop(form_id){
141
151
  var form = document.getElementById(form_id);
142
152
  form.addEventListener("ajax:success", function(e) {
@@ -22,6 +22,7 @@ class KablamController < ApplicationController
22
22
 
23
23
  def message
24
24
  @message = JSON.parse(params[:message])
25
+ redirect_to params[:redirect] if params[:redirect].present?
25
26
  respond_to do |format|
26
27
  format.js
27
28
  format.html do
@@ -35,6 +36,7 @@ class KablamController < ApplicationController
35
36
 
36
37
  if @object.save
37
38
  slack?(:create)
39
+ redirect_to params[:redirect] if params[:redirect].present?
38
40
  respond_to do |format|
39
41
  format.js
40
42
  format.html do
@@ -50,11 +52,12 @@ class KablamController < ApplicationController
50
52
  def update
51
53
  if @object.update(model_params)
52
54
  slack?(:update)
55
+ redirect_to params[:redirect] if params[:redirect].present?
53
56
  respond_to do |format|
54
57
  format.js
55
58
  format.html do
56
59
  redirect_to request.referrer
57
- flash[:notice] = :Destroyed
60
+ flash[:notice] = :Updated
58
61
  end
59
62
  end
60
63
  else
@@ -65,6 +68,7 @@ class KablamController < ApplicationController
65
68
  def destroy
66
69
  if @object.destroy
67
70
  slack?(:destroy)
71
+ redirect_to params[:redirect] if params[:redirect].present?
68
72
  respond_to do |format|
69
73
  format.js
70
74
  format.html do
@@ -9,6 +9,9 @@
9
9
  %>
10
10
 
11
11
  <%= form_with model: obj, url: @url, method: @method, id: @form_id, class: classes[:form_wrapper] do |f| %>
12
+ <% if redirect.present? %>
13
+ <input id="<%= @form_id %>_redirect" type="hidden" name="redirect" value="<%= redirect %>">
14
+ <% end %>
12
15
  <% if target.present? %>
13
16
  <input type="hidden" name="target" value="<%= target %>">
14
17
  <% end %>
@@ -34,7 +37,10 @@
34
37
  <script>
35
38
  initFileUploads({'class': '<%= classes[:file_upload]%>', 'icon': '<%= classes[:file_upload_icon] %>'});
36
39
  <% if ajax_remove.present? %>
37
- submitRemove('<%= @form_id %>')
40
+ submitRemove('<%= @form_id %>');
41
+ <% end %>
42
+ submitToTop('<%= @form_id %>');
43
+ <% if redirect.present? %>
44
+ submitRedirect('<%= @form_id %>');
38
45
  <% end %>
39
- submitToTop('<%= @form_id %>')
40
46
  </script>
@@ -7,9 +7,11 @@
7
7
  target = target || nil
8
8
  hidden = hidden || {}
9
9
  ajax_remove = ajax_remove || false
10
+ redirect = redirect || nil
11
+ p redirect
10
12
  %>
11
13
 
12
- <%= render "kablam_forms/form_generator", classes: classes, obj: obj, target: target, hidden: hidden, ajax_remove: ajax_remove %>
14
+ <%= render "kablam_forms/form_generator", classes: classes, obj: obj, target: target, hidden: hidden, ajax_remove: ajax_remove, redirect: redirect %>
13
15
 
14
16
 
15
17
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'kablam'
3
- s.version = '0.2.8'
3
+ s.version = '0.2.9'
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.}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kablam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Rivas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-22 00:00:00.000000000 Z
11
+ date: 2018-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails