rao-service_controller 0.0.34.pre → 0.0.35.pre

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: 044201c27521da75e191b34e353c0129c724509b03964550c55e7435a8757b16
4
- data.tar.gz: be07a7ec2b9c8e88aff6a6981dacb2e1cb735149a101f5d5e771c57130899599
3
+ metadata.gz: b16db751f11c940c44896837ac073cd3dd5cfa59aa99089a3c92f6bdc0c75a1c
4
+ data.tar.gz: 4291a1ebbc4bc1e11a62ae1c1e22aa50ca1b0997d32949ccd47fe1f6fb5a2688
5
5
  SHA512:
6
- metadata.gz: 42fc2d752908eb0aa1d6e31643b7df089efd5907641957eeaf7f3070c18d185537cf394394f7a3d4708990349ce6e93fc04a2e1f27a3a91236751a90db84de86
7
- data.tar.gz: 2e52b1a3d8bd16f1841bea442feab077cf77a114f646a32568bb339cb44ed89788ddc0d4a27e102fbc33eed6cbf39316e6dae848a6c8899cd231dd9c467c88fe
6
+ metadata.gz: a9ddbf9fbfd2f71f64094a3093eea1cf9eaa32b3cd4a319bf58e03d387b939d233ba604bd08698f15eefe439bda12b40b3ebd7d73e635223c7a1ad281f52e638
7
+ data.tar.gz: 8bc7cfb3f6046a1d542623d927d7568a3c650da025a2de569ba1839d3b008d9879d6a0ceb393b58872a6fa1f450e3540d7cd80a2ffd943a41a7328003afb7192
@@ -1,5 +1,5 @@
1
1
  $(document).ready(function () {
2
- $('[data-auto-submit="true"]').each(function () {
2
+ $('[data-autosubmit="true"]').each(function () {
3
3
  $(this).closest("form").append('<div class="loading">Loading&#8230;</div>');
4
4
  $(this).closest("form").submit();
5
5
  });
@@ -0,0 +1,47 @@
1
+ module Rao
2
+ # Handles automatic form submits.
3
+ #
4
+ # Prerequisites:
5
+ #
6
+ # Include the javascript:
7
+ #
8
+ # # app/assets/javascripts/application.js
9
+ # //= require rao/service_controller/application/autosubmit
10
+ #
11
+ # Example:
12
+ #
13
+ # # app/controllers/posts_controller.rb
14
+ # class PostsController < ApplicationController
15
+ # include Rao::ServiceController::AutosubmitConcern
16
+ #
17
+ # # ...
18
+ #
19
+ # private
20
+ #
21
+ # def autosubmit?
22
+ # true
23
+ # end
24
+ # end
25
+ #
26
+ # # app/views/posts/new.html.haml
27
+ # = form_for(...) do |f|
28
+ # = f.input :autosubmit, as: :autosubmit
29
+ #
30
+ module ServiceController::AutosubmitConcern
31
+ extend ActiveSupport::Concern
32
+
33
+ included do
34
+ helper_method :autosubmit?, :autosubmit_now?
35
+ end
36
+
37
+ private
38
+
39
+ def autosubmit?
40
+ false
41
+ end
42
+
43
+ def autosubmit_now?
44
+ autosubmit? && action_name == 'new'
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,8 @@
1
+ class AutosubmitInput < SimpleForm::Inputs::Base
2
+ def input(wrapper_options)
3
+ wrapper_options.reverse_merge!(label: false)
4
+ if template.autosubmit_now?
5
+ template.content_tag(:div, nil, data: { autosubmit: true } )
6
+ end
7
+ end
8
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rao-service_controller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.34.pre
4
+ version: 0.0.35.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-08 00:00:00.000000000 Z
11
+ date: 2019-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -146,16 +146,18 @@ files:
146
146
  - MIT-LICENSE
147
147
  - README.md
148
148
  - Rakefile
149
- - app/assets/javascripts/rao/service_controller/application/auto_submit.js
149
+ - app/assets/javascripts/rao/service_controller/application/autosubmit.js
150
150
  - app/assets/stylesheets/rao-service_controller.css
151
151
  - app/assets/stylesheets/rao/service_controller/application.css
152
152
  - app/assets/stylesheets/rao/service_controller/application/table_monospaced.css
153
+ - app/concerns/rao/service_controller/autosubmit_concern.rb
153
154
  - app/concerns/rao/service_controller/location_history_concern.rb
154
155
  - app/concerns/rao/service_controller/rest_actions_concern.rb
155
156
  - app/concerns/rao/service_controller/rest_service_urls_concern.rb
156
157
  - app/concerns/rao/service_controller/service_concern.rb
157
158
  - app/concerns/rao/service_controller/service_inflections_concern.rb
158
159
  - app/controllers/rao/service_controller/base.rb
160
+ - app/inputs/autosubmit_input.rb
159
161
  - app/views/rao/service_controller/base/_create_after_service_output.haml
160
162
  - app/views/rao/service_controller/base/_create_before_service_output.haml
161
163
  - app/views/rao/service_controller/base/_form_buttons.haml