Skip to content

Commit

Permalink
#124 initialize client side validation and enable on forms
Browse files Browse the repository at this point in the history
  • Loading branch information
İsmail Akbudak committed Aug 3, 2016
1 parent 4632634 commit 61cf830
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 9 deletions.
5 changes: 4 additions & 1 deletion lib/cybele/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,14 @@ def setup_capistrano_settings
end
end

# Nor using
def setup_recipes
generate 'recipes_matic:install'
end

def setup_client_side_validations
generate 'client_side_validations:install'
end

def update_secret_token
remove_file 'config/initializers/secret_token.rb', force: true
template 'config/initializers/secret_token.erb', 'config/initializers/secret_token.rb'
Expand Down
5 changes: 5 additions & 0 deletions lib/cybele/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ def setup_recipes
build :setup_recipes
end

def setup_client_side_validations
say 'Setup client_side_validations'
build :setup_client_side_validations
end

def setup_secret_token
say 'Setup secret token'
build :update_secret_token
Expand Down
2 changes: 2 additions & 0 deletions templates/app/assets/javascripts/application.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#= require jquery.datetimepicker
#= require nprogress
#= require trix
#= require rails.validations
#= require rails.validations.simple_form

class @App

Expand Down
3 changes: 2 additions & 1 deletion templates/app/assets/javascripts/hq/application.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
#= require trix
#= require jquery.datetimepicker
#= require nprogress

#= require rails.validations
#= require rails.validations.simple_form

class @App
@tooltip = ->
Expand Down
2 changes: 1 addition & 1 deletion templates/app/views/devise/registrations/edit.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%h2
= t('devise.registration.title', model: resource.class.model_name.human )
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }, validate: true) do |f|
= f.error_notification
.form-inputs
= f.input :email, required: true, autofocus: true
Expand Down
2 changes: 1 addition & 1 deletion templates/app/views/devise/registrations/new.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
%h3.text-center
= t('view.or')
%hr/
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), validate: true) do |f|
= f.error_notification
.form-inputs
= f.input :email
Expand Down
2 changes: 1 addition & 1 deletion templates/app/views/hq/admins/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%i.icon-edit.icon-large
= yield :form_title
.panel-body
= simple_form_for([:hq, @admin]) do |f|
= simple_form_for([:hq, @admin], validate: true) do |f|
= f.error_notification

.form-inputs
Expand Down
2 changes: 1 addition & 1 deletion templates/app/views/hq/cities/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%i.icon-edit.icon-large
= yield :form_title
.panel-body
= simple_form_for([:hq, @city]) do |f|
= simple_form_for([:hq, @city], validate: true) do |f|
= f.error_notification

.form-inputs
Expand Down
2 changes: 1 addition & 1 deletion templates/app/views/hq/countries/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%i.icon-edit.icon-large
= yield :form_title
.panel-body
= simple_form_for([:hq, @country]) do |f|
= simple_form_for([:hq, @country], validate: true) do |f|
= f.error_notification

.form-inputs
Expand Down
2 changes: 1 addition & 1 deletion templates/app/views/hq/users/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%i.icon-edit.icon-large
= yield :form_title
.panel-body
= simple_form_for([:hq, @user]) do |f|
= simple_form_for([:hq, @user], validate: true) do |f|
= f.error_notification

.form-inputs
Expand Down
2 changes: 1 addition & 1 deletion templates/app/views/user/profiles/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%i.icon-edit.icon-large
= yield :form_title
.panel-body
= simple_form_for([:user, @profile], url: user_profile_path) do |f|
= simple_form_for([:user, @profile], url: user_profile_path, validate: true) do |f|
= f.error_notification

.form-inputs
Expand Down

0 comments on commit 61cf830

Please sign in to comment.