schoolgirl_uniform 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 58dbc55cc5843ea0980f2438a97a6cfbb85bd6fc37e503bdd507f95cd2a00b75
4
+ data.tar.gz: 7105a08c67034e2b76dc48a6e8204c752bdd23dc6fa3c8e0ec25c85b897a19d8
5
+ SHA512:
6
+ metadata.gz: 7818389aa702ad6a083dd10ae352d3b51baef8ed93525edd80a56baae6461883b86e5cfe2a24c8013ee698e5d21b9cc4a681347dcf688ba63dafe27b241575c6
7
+ data.tar.gz: 72ff48308ea6985940542ae978834ec5cebb7a7850babceb93f647e34436dab8beed50ff2e824026f625a483c191c8aa930fa4480102e1d78ca761d698958203
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .idea/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.13.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in schoolgirl_uniform.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Yaro
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,157 @@
1
+ <br>
2
+ <br>
3
+ <p align="center">
4
+ <a href="#">
5
+ <img align="center" width="75%" src="https://user-images.githubusercontent.com/2478436/210048098-9d09b442-f057-42e1-b77b-94277928e452.png"/>
6
+ </a>
7
+ </p>
8
+ <br>
9
+
10
+ # Schoolgirl Uniform
11
+
12
+ <p align="right">
13
+ <a href="#schoolgirl-uniform">
14
+ <img align="right" width="30%" src="https://user-images.githubusercontent.com/2478436/210023063-339c9be3-5ac3-4d9b-87a1-60d1d8462861.png"/>
15
+ </a>
16
+ </p>
17
+
18
+ :feet: Multistep form concept for Rails projects. Allows to create complex forms for a few models simultaneously. Supports selectable per step validations without data persistence into db.
19
+
20
+ <br>
21
+
22
+ ## Installation
23
+
24
+ To start using it just add this line to your application's Gemfile:
25
+
26
+ ```ruby
27
+ gem 'schoolgirl_uniform'
28
+ ```
29
+ <br>
30
+
31
+ Then you need to generate scaffold for future multistep form:
32
+
33
+ ```ruby
34
+ $ rails generate schoolgirl_uniform:install CatgirlsSurvey
35
+ ```
36
+
37
+ > You can also use snake case, so `catgirls_survey` would be identical to `CatgirlsSurvey` and will generate the same output during scaffolding.
38
+
39
+
40
+ ## Usage and Config
41
+
42
+ To achieve working multistep form you need to configure FVC:
43
+
44
+ - :womans_clothes: [**Form**](#womans_clothes-form)
45
+
46
+ - :dress: [**View**](#dress-view)
47
+
48
+ - :school_satchel: [**Controller**](#school_satchel-controller)
49
+ <hr>
50
+
51
+ ### :womans_clothes: Form
52
+ e.g. CatgirlsSurveyForm - app/forms/catgirls_survey_form.rb
53
+
54
+ 1. Declare the steps:
55
+ ```ruby
56
+ def self.steps
57
+ %w[first second third]
58
+ end
59
+ ```
60
+ 2. Define form fields
61
+ ```ruby
62
+ attribute :username, String
63
+ ```
64
+ 3. Define validation and select appropriate step for it
65
+ ```ruby
66
+ validates :username, presence: true, if: proc { on_step('second') }
67
+ ```
68
+ 4. Inside `save!` method build your records, set them with form attributes and save them in transaction.
69
+ Use `.save!(validate: false)` to skip native validations on model.
70
+ In order to return the result set the `@identifier` with created records reference/references
71
+
72
+ ( e.g. simple `1234` or complex `{user_id: 1234, personal_data_id: 5678}` )
73
+ ```ruby
74
+ def save!
75
+ user = User.new(username: username)
76
+ personal_data = user.build_personal_data(email: email)
77
+
78
+ ActiveRecord::Base.transaction do
79
+ user.save!(validate: false)
80
+ personal_data.save!(validate: false)
81
+ end
82
+
83
+ @identifier = user.id
84
+ end
85
+ ```
86
+ ### :dress: View
87
+ - Scaffolding will generate example structure of view files:
88
+ - _show.html.erb_
89
+ - _finish.html.erb_
90
+ - __wizard.html.erb_
91
+ - __form_errors.html.erb_
92
+
93
+ and steps/:
94
+ - __first.html.erb_
95
+ - __second.html.erb_
96
+ - __third.html.erb_
97
+
98
+ :exclamation: Please notice that **_show_** and **_finish_** are action views, others are partials. \
99
+ :art: Feel free to modify html and styles around the form.
100
+
101
+ #### :infinity: Steps
102
+
103
+ By default Scaffolding generates 3 steps, but you can modify, delete them or add new steps. Just make sure that steps are **__partials_** and match corresponded names inside **_Form_** (e.g. CatgirlsSurveyForm):
104
+
105
+ ```ruby
106
+ # app/views/catgirls_survey/steps/_first.html.erb
107
+
108
+ <%= form.label :username %>
109
+ <%= form.text_field :username %>
110
+ <br>
111
+ <%= form.label :password %>
112
+ <%= form.text_field :password %>
113
+ ```
114
+
115
+
116
+ ### :school_satchel: Controller
117
+ e.g. CatgirlsSurveyController - app/controllers/catgirls_survey_controller.rb
118
+
119
+ 1. Make sure you have listed all form fields (used for permit params)
120
+ ```ruby
121
+ def form_attributes
122
+ [:username, :password, :email, :phone]
123
+ end
124
+ ```
125
+ 2. Fetch resource/resources from DB using identifier, which you set in `.save!`
126
+ ```ruby
127
+ def finish
128
+ @record = User.find_by(uuid: params[:identifier])
129
+ ...
130
+ # or if you have a few identifiers
131
+ ...
132
+ @record1 = Book.find_by(title: params[:identifier][:title])
133
+ @record2 = Author.find_by(id: params[:identifier][:author_id])
134
+ end
135
+ ```
136
+
137
+
138
+ ## Contributing
139
+
140
+ Bug reports and pull requests are welcome on GitHub at https://github.com/vergilet/schoolgirl_uniform
141
+
142
+ Feel free to contribute:
143
+ 1. Fork it (https://github.com/vergilet/schoolgirl_uniform/fork)
144
+ 2. Create your feature branch (git checkout -b my-new-feature)
145
+ 3. Commit your changes (git commit -am 'Add some feature')
146
+ 4. Push to the branch (git push origin my-new-feature)
147
+ 5. Create new Pull Request
148
+
149
+
150
+
151
+ ## License
152
+ The gem is available as open source under the terms of the MIT License.
153
+
154
+ Copyright © 2016 Yaro.
155
+
156
+ [![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen)](https://raw.githubusercontent.com/vergilet/schoolgirl_uniform/master/LICENSE)
157
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,22 @@
1
+ module SchoolgirlUniform
2
+ class Carrier
3
+
4
+ def initialize(form, paths = {})
5
+ @form = form
6
+ @current_step_path = paths[:current]
7
+ @previous_step_path = paths[:previous]
8
+ end
9
+
10
+ def current_step_path
11
+ @current_step_path
12
+ end
13
+
14
+ def previous_step_path
15
+ @previous_step_path
16
+ end
17
+
18
+ private
19
+
20
+ attr_reader :form
21
+ end
22
+ end
@@ -0,0 +1,81 @@
1
+ module SchoolgirlUniform
2
+ class BaseController < ActionController::Base
3
+ before_action :reset_session, only: :show
4
+ before_action :refresh_session, only: :current
5
+ before_action :initialize_form, except: [:index]
6
+ after_action :refresh_current_step, only: [:show, :current, :previous]
7
+ helper_method :form_carrier
8
+
9
+ def show
10
+ redirect_to action: :current, step: @form.current_step
11
+ end
12
+
13
+ def initialize_form
14
+ @form = BaseForm.new(session[session_key] || {})
15
+ end
16
+
17
+ def reset_session
18
+ session[session_key] = {}
19
+ end
20
+
21
+ def refresh_session
22
+ return if request.get?
23
+ session[session_key].deep_merge!(session_params)
24
+ end
25
+
26
+ def current
27
+ if request.post?
28
+ return render :show unless @form.valid?
29
+ redirect_to redirect_options
30
+ elsif request.get?
31
+ return render :show if params[:step] == @form.current_step
32
+ redirect_to action: :current, step: @form.current_step
33
+ end
34
+ end
35
+
36
+ def previous
37
+ @form.previous_step
38
+ redirect_to action: :current, step: @form.current_step
39
+ end
40
+
41
+ def form_carrier
42
+ @form_carrier ||= SchoolgirlUniform::Carrier.new(@form, paths)
43
+ end
44
+
45
+ private
46
+
47
+ def paths
48
+ {
49
+ current: nil,
50
+ previous: nil
51
+ }
52
+ end
53
+
54
+ def refresh_current_step
55
+ session[session_key]['step'] = @form.current_step
56
+ end
57
+
58
+ def metadata_params
59
+ params.require(session_key).permit(form_attributes.push(:step))
60
+ end
61
+
62
+ def session_params
63
+ metadata_params.to_hash
64
+ end
65
+
66
+ def session_key
67
+ "#{controller_name}_form"
68
+ end
69
+
70
+ def redirect_options
71
+ if @form.last_step?
72
+ @form.save!
73
+ reset_session
74
+ { action: :finish, identifier: @form.identifier }
75
+ else
76
+ @form.next_step
77
+ { action: :current, step: @form.current_step }
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,16 @@
1
+ module SchoolgirlUniform
2
+ class BaseForm
3
+
4
+ include SchoolgirlUniform::Uniformable
5
+ attribute :step, String
6
+ attr_reader :identifier
7
+
8
+ def self.steps
9
+ raise NotImplementedError
10
+ end
11
+
12
+ def initialize(options = {})
13
+ initialize_attributes(options)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,69 @@
1
+ module SchoolgirlUniform
2
+ module Uniformable
3
+
4
+ def self.included(base)
5
+ base.include ActiveModel::Model
6
+ base.include Virtus.model
7
+ end
8
+
9
+ def initialize(options = {})
10
+ initialize_attributes(options)
11
+ end
12
+
13
+ def save!
14
+ raise NotImplementedError
15
+ end
16
+
17
+ def current_step
18
+ step || steps.first
19
+ end
20
+
21
+ def next_step
22
+ return if last_step? || !valid?
23
+ shift_step(1)
24
+ end
25
+
26
+ def previous_step
27
+ shift_step(-1)
28
+ end
29
+
30
+ def first_step?
31
+ current_step == steps.first
32
+ end
33
+
34
+ def last_step?
35
+ current_step == steps.last
36
+ end
37
+
38
+ def steps
39
+ self.class.steps
40
+ end
41
+
42
+ def current_step_index
43
+ steps.index(current_step)
44
+ end
45
+
46
+ private
47
+
48
+ def initialize_attributes(new_attributes)
49
+ self.errors ||= ActiveModel::Errors.new(self)
50
+ self.attributes = defaults.merge(new_attributes)
51
+ end
52
+
53
+ def defaults
54
+ { }
55
+ end
56
+
57
+ def persisted?
58
+ false
59
+ end
60
+
61
+ def shift_step(delta)
62
+ self.step = steps[steps.index(current_step) + delta]
63
+ end
64
+
65
+ def on_step(step)
66
+ current_step == step
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,15 @@
1
+ :css
2
+ .schoolgirl-uniform-step-wizard {
3
+ margin: 10px 25%;
4
+ }
5
+ .milestone {
6
+ display: inline-block;
7
+ }
8
+ div.active {
9
+ background-color: greenyellow;
10
+ }
11
+ .schoolgirl-uniform-step-wizard
12
+ - form.steps.each_with_index do |step, index|
13
+ %div{class: "#{'active' if form.current_step_index >= index} milestone"}
14
+ %span
15
+ = step
@@ -0,0 +1,22 @@
1
+ :css
2
+ .field_with_errors {
3
+ display: inline-block;
4
+ }
5
+ .field_with_errors input {
6
+ border: 1px solid red
7
+ }
8
+
9
+
10
+ = render 'wizard', form: @form
11
+ = form_for @form, as: "#{controller_name}_form".to_sym, url: form_carrier.next_step_path, html: { id: "#{controller_name}_form", class: 'multistep-form' } do |form|
12
+ = form.hidden_field :step, value: @form.current_step
13
+ = render "form_errors", form: form
14
+ = render "#{ controller_name }/steps/#{@form.current_step}", form: form
15
+ .tc
16
+ - if !@form.first_step?
17
+ = link_to 'back', form_carrier.previous_step_path
18
+ - if @form.last_step?
19
+ = form.submit 'submit'
20
+ - else
21
+ = form.submit 'next'
22
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "schoolgirl_uniform"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+ # rails generate schoolgirl_uniform:install MyForm
3
+
4
+ module SchoolgirlUniform
5
+ module Generators
6
+ class InstallGenerator < Rails::Generators::NamedBase
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ argument :controller_name, type: :string, default: "form"
10
+
11
+ def create_initializer_file
12
+ copy_file "wizard.html.erb", "app/views/#{file_name}/_wizard.html.erb"
13
+ copy_file "form_errors.html.erb", "app/views/#{file_name}/_form_errors.html.erb"
14
+ copy_file "show.html.erb", "app/views/#{file_name}/show.html.erb"
15
+ copy_file "finish.html.erb", "app/views/#{file_name}/finish.html.erb"
16
+ copy_file "steps/first.html.erb", "app/views/#{file_name}/steps/_first.html.erb"
17
+ copy_file "steps/second.html.erb", "app/views/#{file_name}/steps/_second.html.erb"
18
+ copy_file "steps/third.html.erb", "app/views/#{file_name}/steps/_third.html.erb"
19
+ template "forms/template_form.rb.erb", "app/forms/#{file_name}_form.rb"
20
+ template "controllers/template_controller.rb.erb", "app/controllers/#{file_name}_controller.rb"
21
+ end
22
+
23
+ def setup_routes
24
+ route <<-FILE
25
+ resource :#{file_name}, controller: '#{file_name}', only: :show do
26
+ collection do
27
+ match :current, via: [:get, :post]
28
+ get :previous
29
+ get :finish
30
+ end
31
+ end
32
+ FILE
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,21 @@
1
+ class <%= class_name.camelcase %>Controller < SchoolgirlUniform::BaseController
2
+
3
+ def initialize_form
4
+ @form = <%= class_name.camelcase %>Form.new(session[session_key] || {})
5
+ end
6
+
7
+ def finish
8
+ @record = User.find_by(uuid: params[:identifier])
9
+ end
10
+
11
+ def form_attributes
12
+ [:username, :password, :email, :phone]
13
+ end
14
+
15
+ def paths
16
+ {
17
+ current: current_<%= class_name.snakecase %>_path(step: @form.current_step),
18
+ previous: previous_<%= class_name.snakecase %>_path
19
+ }
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ uuid: <%= @record.uuid %>
2
+ <br>
3
+ username: <%= @record.username %>
4
+ <br>
5
+ email: <%= @record.personal_data.email %>
6
+ <br>
7
+ phone: <%= @record.personal_data.phone %>
@@ -0,0 +1,20 @@
1
+ <style>
2
+ .schoolgirl-uniform-errors {
3
+ border: 1px solid red;
4
+ }
5
+ .schoolgirl-uniform-errors span {
6
+ color: red;
7
+ }
8
+ </style>
9
+
10
+ <% if @form.errors.any? %>
11
+ <div class="schoolgirl-uniform-errors">
12
+ <ul>
13
+ <% @form.errors.full_messages.each do |message|%>
14
+ <li>
15
+ <span><%= message %> </span>
16
+ </li>
17
+ <%end%>
18
+ </ul>
19
+ </div>
20
+ <%end%>
@@ -0,0 +1,53 @@
1
+ class <%= class_name %>Form < SchoolgirlUniform::BaseForm
2
+ attribute :username, String
3
+ attribute :password, String
4
+ attribute :email, String
5
+ attribute :phone, String
6
+
7
+ validates :username, presence: true, length: 3..10, if: proc { on_step('first') }
8
+ validate :custom_username_validation, if: proc { on_step('first') }
9
+ validates :password, length: { minimum: 3 }, if: proc { on_step('first') }
10
+
11
+ validates :email, presence: true, if: proc { on_step('second') }
12
+ validate :custom_email_validation, if: proc { on_step('second') }
13
+
14
+ validates :phone, presence: true, if: proc { on_step('third') }
15
+ validate :custom_phone_validation, if: proc { on_step('third') }
16
+
17
+ def custom_username_validation
18
+ errors.add(:username, 'cannot contain "@"') if username.include?('@')
19
+ errors.add(:username, 'cannot contain "#"') if username.include?('#')
20
+ errors.add(:username, 'cannot contain "?"') if username.include?('?')
21
+ end
22
+
23
+ def custom_email_validation
24
+ errors.add(:email, 'should contain "@"') if email.exclude?('@')
25
+ errors.add(:email, 'should not contain ".."') if email.include?('..')
26
+ end
27
+
28
+ def custom_phone_validation
29
+ errors.add(:phone, 'should be max 14 symbols') if phone.size > 14
30
+ end
31
+
32
+ def self.steps
33
+ %w[first second third]
34
+ end
35
+
36
+ def save!
37
+ ActiveRecord::Base.transaction do
38
+ user.save!(validate: false)
39
+ personal_data.save!(validate: false)
40
+ end
41
+ @identifier = user.reload.uuid
42
+ end
43
+
44
+ private
45
+
46
+ def user
47
+ @user ||= User.new(username: username, password: password)
48
+ end
49
+
50
+ def personal_data
51
+ user.build_personal_data(email: email, phone: phone)
52
+ end
53
+ end
@@ -0,0 +1,27 @@
1
+ <style>
2
+ .field_with_errors {
3
+ display: inline-block;
4
+ }
5
+ .field_with_errors input {
6
+ border: 1px solid red
7
+ }
8
+ </style>
9
+
10
+ <%= render 'wizard', form: @form %>
11
+ <%= form_for @form, as: "#{controller_name}_form".to_sym, url: form_carrier.current_step_path, html: { id: "#{controller_name}_form", class: 'multistep-form' } do |form| %>
12
+ <%= form.hidden_field :step, value: @form.current_step %>
13
+
14
+ <%= render "form_errors", form: form %>
15
+ <%= render "#{ controller_name }/steps/#{@form.current_step}", form: form %>
16
+
17
+ <div class="tc">
18
+ <% if !@form.first_step? %>
19
+ <%= link_to 'back', form_carrier.previous_step_path %>
20
+ <% end %>
21
+ <% if @form.last_step? %>
22
+ <%= form.submit 'submit' %>
23
+ <% else %>
24
+ <%= form.submit 'next' %>
25
+ <% end %>
26
+ </div>
27
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= form.label :username %>
2
+ <%= form.text_field :username %>
3
+ <br>
4
+ <%= form.label :password %>
5
+ <%= form.text_field :password %>
@@ -0,0 +1,2 @@
1
+ <%= form.label :email %>
2
+ <%= form.text_field :email %>
@@ -0,0 +1,2 @@
1
+ <%= form.label :phone %>
2
+ <%= form.text_field :phone %>
@@ -0,0 +1,21 @@
1
+ <style>
2
+ .schoolgirl-uniform-step-wizard {
3
+ margin: 10px 25%;
4
+ }
5
+ .milestone {
6
+ display: inline-block;
7
+ }
8
+ div.active {
9
+ background-color: greenyellow;
10
+ }
11
+ </style>
12
+
13
+ <div class="schoolgirl-uniform-step-wizard">
14
+ <% form.steps.each_with_index do |step, index| %>
15
+ <div class="<%= 'active' if form.current_step_index >= index %> milestone">
16
+ <span>
17
+ <%= step %>
18
+ </span>
19
+ </div>
20
+ <% end %>
21
+ </div>
@@ -0,0 +1,3 @@
1
+ module SchoolgirlUniform
2
+ class Engine < ::Rails::Engine; end
3
+ end
@@ -0,0 +1,3 @@
1
+ module SchoolgirlUniform
2
+ VERSION = "0.2.0"
3
+ end
@@ -0,0 +1,14 @@
1
+ require 'virtus'
2
+ require '../schoolgirl_uniform/app/carriers/carrier'
3
+ require '../schoolgirl_uniform/app/forms/uniformable'
4
+ require '../schoolgirl_uniform/app/forms/base_form'
5
+ require '../schoolgirl_uniform/app/controllers/base_controller'
6
+ require 'schoolgirl_uniform/engine'
7
+
8
+ module SchoolgirlUniform
9
+ pp 111
10
+ # autoload :Uniformable, 'schoolgirl_uniform/forms/uniformable'
11
+ # autoload :BaseForm, 'schoolgirl_uniform/forms/base_form'
12
+ # autoload :Carrier, 'schoolgirl_uniform/carriers/carrier'
13
+ # autoload :BaseController, 'schoolgirl_uniform/controllers/base_controller'
14
+ end
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'schoolgirl_uniform/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "schoolgirl_uniform"
8
+ spec.version = SchoolgirlUniform::VERSION
9
+ spec.authors = ["YaroslavO"]
10
+ spec.email = ["osyaroslav@gmail.com"]
11
+
12
+ spec.summary = %q{Multistep form for Rails apps.}
13
+ spec.description = %q{Multistep form concept for Rails projects.
14
+ Allows to create complex forms for a few models simultaneously.
15
+ Supports selectable per step validations without data persistence into db.}
16
+ spec.homepage = "https://github.com/vergilet/schoolgirl_uniform"
17
+ spec.license = "MIT"
18
+
19
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
20
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
21
+ if spec.respond_to?(:metadata)
22
+ spec.metadata["homepage_uri"] = spec.homepage
23
+ # spec.metadata["source_code_uri"] = "Put your gem's public repo URL here."
24
+ # spec.metadata["changelog_uri"] = "Put your gem's CHANGELOG.md URL here."
25
+ else
26
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
27
+ end
28
+
29
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
30
+ f.match(%r{^(test|spec|features)/})
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ spec.add_runtime_dependency 'activemodel', '~> 6.0'
37
+
38
+ spec.add_dependency "bundler", '~> 2.0'
39
+ spec.add_dependency "rake", '~> 13.0'
40
+ spec.add_dependency "rspec", '~> 3.5'
41
+ spec.add_dependency "virtus", '~> 2.0'
42
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: schoolgirl_uniform
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - YaroslavO
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-01-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activemodel
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.5'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: virtus
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ description: |-
84
+ Multistep form concept for Rails projects.
85
+ Allows to create complex forms for a few models simultaneously.
86
+ Supports selectable per step validations without data persistence into db.
87
+ email:
88
+ - osyaroslav@gmail.com
89
+ executables: []
90
+ extensions: []
91
+ extra_rdoc_files: []
92
+ files:
93
+ - ".gitignore"
94
+ - ".rspec"
95
+ - ".travis.yml"
96
+ - Gemfile
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - app/carriers/carrier.rb
101
+ - app/controllers/base_controller.rb
102
+ - app/forms/base_form.rb
103
+ - app/forms/uniformable.rb
104
+ - app/views/schoolgirl_uniform/base/_wizard.html.haml
105
+ - app/views/schoolgirl_uniform/base/show.html.haml
106
+ - bin/console
107
+ - bin/setup
108
+ - lib/generators/schoolgirl_uniform/install_generator.rb
109
+ - lib/generators/schoolgirl_uniform/templates/controllers/template_controller.rb.erb
110
+ - lib/generators/schoolgirl_uniform/templates/finish.html.erb
111
+ - lib/generators/schoolgirl_uniform/templates/form_errors.html.erb
112
+ - lib/generators/schoolgirl_uniform/templates/forms/template_form.rb.erb
113
+ - lib/generators/schoolgirl_uniform/templates/show.html.erb
114
+ - lib/generators/schoolgirl_uniform/templates/steps/first.html.erb
115
+ - lib/generators/schoolgirl_uniform/templates/steps/second.html.erb
116
+ - lib/generators/schoolgirl_uniform/templates/steps/third.html.erb
117
+ - lib/generators/schoolgirl_uniform/templates/wizard.html.erb
118
+ - lib/schoolgirl_uniform.rb
119
+ - lib/schoolgirl_uniform/engine.rb
120
+ - lib/schoolgirl_uniform/version.rb
121
+ - schoolgirl_uniform.gemspec
122
+ homepage: https://github.com/vergilet/schoolgirl_uniform
123
+ licenses:
124
+ - MIT
125
+ metadata:
126
+ homepage_uri: https://github.com/vergilet/schoolgirl_uniform
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubygems_version: 3.2.15
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: Multistep form for Rails apps.
146
+ test_files: []