binda 0.0.2
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +63 -0
- data/Rakefile +37 -0
- data/app/assets/config/binda_manifest.js +2 -0
- data/app/assets/javascripts/binda/application.js +18 -0
- data/app/assets/javascripts/binda/components/form_item.js +54 -0
- data/app/assets/javascripts/binda/components/form_item_asset.js +24 -0
- data/app/assets/javascripts/binda/components/form_item_repeater.js +66 -0
- data/app/assets/javascripts/binda/components/sortable.js +44 -0
- data/app/assets/javascripts/binda/dist/binda.bundle.js +336 -0
- data/app/assets/javascripts/binda/index.js +16 -0
- data/app/assets/stylesheets/binda/application.css +6 -0
- data/app/assets/stylesheets/binda/components/assets_manager.scss +46 -0
- data/app/assets/stylesheets/binda/components/button.scss +7 -0
- data/app/assets/stylesheets/binda/components/form_body.scss +2 -0
- data/app/assets/stylesheets/binda/components/form_item.scss +169 -0
- data/app/assets/stylesheets/binda/components/form_item_asset.scss +20 -0
- data/app/assets/stylesheets/binda/components/form_section.scss +40 -0
- data/app/assets/stylesheets/binda/components/login.scss +6 -0
- data/app/assets/stylesheets/binda/components/main_container.scss +0 -0
- data/app/assets/stylesheets/binda/components/main_content.scss +5 -0
- data/app/assets/stylesheets/binda/components/main_header.scss +25 -0
- data/app/assets/stylesheets/binda/components/main_table.scss +28 -0
- data/app/assets/stylesheets/binda/components/sidebar.scss +131 -0
- data/app/assets/stylesheets/binda/components/sortable.scss +98 -0
- data/app/assets/stylesheets/binda/index.scss +24 -0
- data/app/assets/stylesheets/binda/layout/components_index.scss +9 -0
- data/app/assets/stylesheets/binda/layout/dashboard.scss +7 -0
- data/app/assets/stylesheets/binda/layout/users_sign_in.scss +29 -0
- data/app/assets/stylesheets/binda/settings/common.scss +93 -0
- data/app/assets/stylesheets/binda/settings/fonts.scss +90 -0
- data/app/assets/stylesheets/binda/settings/variables.scss +83 -0
- data/app/assets/stylesheets/scaffolds.scss +89 -0
- data/app/controllers/binda/application_controller.rb +29 -0
- data/app/controllers/binda/assets_controller.rb +62 -0
- data/app/controllers/binda/bindings_controller.rb +62 -0
- data/app/controllers/binda/categories_controller.rb +60 -0
- data/app/controllers/binda/components_controller.rb +223 -0
- data/app/controllers/binda/dates_controller.rb +62 -0
- data/app/controllers/binda/field_groups_controller.rb +114 -0
- data/app/controllers/binda/field_settings_controller.rb +66 -0
- data/app/controllers/binda/galleries_controller.rb +62 -0
- data/app/controllers/binda/manage/users_controller.rb +97 -0
- data/app/controllers/binda/repeaters_controller.rb +67 -0
- data/app/controllers/binda/settings_controller.rb +75 -0
- data/app/controllers/binda/structures_controller.rb +89 -0
- data/app/controllers/binda/texts_controller.rb +62 -0
- data/app/controllers/binda/users/confirmations_controller.rb +33 -0
- data/app/controllers/binda/users/omniauth_callbacks_controller.rb +33 -0
- data/app/controllers/binda/users/passwords_controller.rb +37 -0
- data/app/controllers/binda/users/registrations_controller.rb +89 -0
- data/app/controllers/binda/users/sessions_controller.rb +30 -0
- data/app/controllers/binda/users/unlocks_controller.rb +33 -0
- data/app/helpers/binda/application_helper.rb +25 -0
- data/app/helpers/binda/assets_helper.rb +4 -0
- data/app/helpers/binda/bindings_helper.rb +4 -0
- data/app/helpers/binda/categories_helper.rb +10 -0
- data/app/helpers/binda/components_helper.rb +10 -0
- data/app/helpers/binda/dates_helper.rb +4 -0
- data/app/helpers/binda/field_groups_helper.rb +10 -0
- data/app/helpers/binda/field_settings_helper.rb +14 -0
- data/app/helpers/binda/galleries_helper.rb +4 -0
- data/app/helpers/binda/repeaters_helper.rb +4 -0
- data/app/helpers/binda/settings_helper.rb +13 -0
- data/app/helpers/binda/structures_helper.rb +4 -0
- data/app/helpers/binda/texts_helper.rb +4 -0
- data/app/jobs/binda/application_job.rb +4 -0
- data/app/mailers/binda/application_mailer.rb +6 -0
- data/app/models/binda/application_record.rb +5 -0
- data/app/models/binda/asset.rb +21 -0
- data/app/models/binda/binding.rb +24 -0
- data/app/models/binda/category.rb +31 -0
- data/app/models/binda/component.rb +186 -0
- data/app/models/binda/date.rb +9 -0
- data/app/models/binda/field_group.rb +40 -0
- data/app/models/binda/field_setting.rb +95 -0
- data/app/models/binda/gallery.rb +18 -0
- data/app/models/binda/repeater.rb +108 -0
- data/app/models/binda/setting.rb +42 -0
- data/app/models/binda/structure.rb +31 -0
- data/app/models/binda/text.rb +9 -0
- data/app/models/binda/user.rb +8 -0
- data/app/uploaders/binda/asset/image_uploader.rb +76 -0
- data/app/views/binda/assets/_form.html.erb +22 -0
- data/app/views/binda/assets/edit.html.erb +6 -0
- data/app/views/binda/assets/index.html.erb +29 -0
- data/app/views/binda/assets/new.html.erb +5 -0
- data/app/views/binda/assets/show.html.erb +19 -0
- data/app/views/binda/bindings/_form.html.erb +32 -0
- data/app/views/binda/bindings/edit.html.erb +6 -0
- data/app/views/binda/bindings/index.html.erb +31 -0
- data/app/views/binda/bindings/new.html.erb +5 -0
- data/app/views/binda/bindings/show.html.erb +19 -0
- data/app/views/binda/categories/_form.html.erb +58 -0
- data/app/views/binda/categories/edit.html.erb +8 -0
- data/app/views/binda/categories/index.html.erb +34 -0
- data/app/views/binda/categories/new.html.erb +8 -0
- data/app/views/binda/components/_form_body.html.erb +86 -0
- data/app/views/binda/components/_form_item_asset.html.erb +20 -0
- data/app/views/binda/components/_form_item_date.html.erb +16 -0
- data/app/views/binda/components/_form_item_gallery.html.erb +0 -0
- data/app/views/binda/components/_form_item_new_repeater.html.erb +33 -0
- data/app/views/binda/components/_form_item_repeater.html.erb +81 -0
- data/app/views/binda/components/_form_item_text.html.erb +28 -0
- data/app/views/binda/components/_form_section.html.erb +37 -0
- data/app/views/binda/components/_form_section_repeater.html.erb +31 -0
- data/app/views/binda/components/_form_sidebar.html.erb +34 -0
- data/app/views/binda/components/edit.html.erb +8 -0
- data/app/views/binda/components/index.html.erb +43 -0
- data/app/views/binda/components/new.html.erb +8 -0
- data/app/views/binda/dates/_form.html.erb +22 -0
- data/app/views/binda/dates/edit.html.erb +6 -0
- data/app/views/binda/dates/index.html.erb +27 -0
- data/app/views/binda/dates/new.html.erb +5 -0
- data/app/views/binda/dates/show.html.erb +9 -0
- data/app/views/binda/field_groups/_form_body.html.erb +71 -0
- data/app/views/binda/field_groups/_form_item.html.erb +62 -0
- data/app/views/binda/field_groups/_form_section.html.erb +37 -0
- data/app/views/binda/field_groups/_form_section_repeater.html.erb +25 -0
- data/app/views/binda/field_groups/edit.html.erb +8 -0
- data/app/views/binda/field_groups/index.html.erb +34 -0
- data/app/views/binda/field_groups/new.html.erb +8 -0
- data/app/views/binda/field_settings/_form_body.html.erb +60 -0
- data/app/views/binda/field_settings/edit.html.erb +8 -0
- data/app/views/binda/field_settings/index.html.erb +31 -0
- data/app/views/binda/field_settings/new.html.erb +8 -0
- data/app/views/binda/galleries/_form.html.erb +27 -0
- data/app/views/binda/galleries/edit.html.erb +6 -0
- data/app/views/binda/galleries/index.html.erb +29 -0
- data/app/views/binda/galleries/new.html.erb +5 -0
- data/app/views/binda/galleries/show.html.erb +14 -0
- data/app/views/binda/manage/users/_admin_manage_user.json.jbuilder +2 -0
- data/app/views/binda/manage/users/_form_body.html.erb +58 -0
- data/app/views/binda/manage/users/edit.html.erb +8 -0
- data/app/views/binda/manage/users/index.html.erb +38 -0
- data/app/views/binda/manage/users/index.json.jbuilder +1 -0
- data/app/views/binda/manage/users/new.html.erb +8 -0
- data/app/views/binda/manage/users/show.json.jbuilder +1 -0
- data/app/views/binda/repeaters/_form.html.erb +27 -0
- data/app/views/binda/repeaters/edit.html.erb +6 -0
- data/app/views/binda/repeaters/index.html.erb +29 -0
- data/app/views/binda/repeaters/new.html.erb +5 -0
- data/app/views/binda/repeaters/show.html.erb +14 -0
- data/app/views/binda/settings/_dashboard_form.html.erb +51 -0
- data/app/views/binda/settings/_form.html.erb +52 -0
- data/app/views/binda/settings/dashboard.html.erb +9 -0
- data/app/views/binda/settings/edit.html.erb +8 -0
- data/app/views/binda/settings/index.html.erb +34 -0
- data/app/views/binda/settings/new.html.erb +8 -0
- data/app/views/binda/structures/_form_body.html.erb +56 -0
- data/app/views/binda/structures/_form_section.html.erb +64 -0
- data/app/views/binda/structures/add_child.html.erb +0 -0
- data/app/views/binda/structures/edit.html.erb +8 -0
- data/app/views/binda/structures/index.html.erb +34 -0
- data/app/views/binda/structures/new.html.erb +8 -0
- data/app/views/binda/texts/_form.html.erb +22 -0
- data/app/views/binda/texts/edit.html.erb +6 -0
- data/app/views/binda/texts/index.html.erb +27 -0
- data/app/views/binda/texts/new.html.erb +5 -0
- data/app/views/binda/texts/show.html.erb +9 -0
- data/app/views/layouts/binda/_flash.html.erb +26 -0
- data/app/views/layouts/binda/_header.html.erb +9 -0
- data/app/views/layouts/binda/_sidebar.html.erb +50 -0
- data/app/views/layouts/binda/application.html.erb +29 -0
- data/app/views/users/confirmations/new.html.erb +16 -0
- data/app/views/users/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/users/mailer/password_change.html.erb +3 -0
- data/app/views/users/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/users/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/users/passwords/edit.html.erb +31 -0
- data/app/views/users/passwords/new.html.erb +28 -0
- data/app/views/users/registrations/edit.html.erb +27 -0
- data/app/views/users/registrations/new.html.erb +17 -0
- data/app/views/users/sessions/new.html.erb +27 -0
- data/app/views/users/shared/_links.html.erb +25 -0
- data/app/views/users/unlocks/new.html.erb +16 -0
- data/config/initializers/assets.rb +3 -0
- data/config/initializers/devise.rb +278 -0
- data/config/initializers/devise_patch.rb +50 -0
- data/config/initializers/friendly_id.rb +88 -0
- data/config/initializers/simple_form.rb +165 -0
- data/config/initializers/simple_form_bootstrap.rb +149 -0
- data/config/locales/devise.en.yml +62 -0
- data/config/locales/en.yml +37 -0
- data/config/locales/simple_form.en.yml +31 -0
- data/config/routes.rb +67 -0
- data/config/tinymce.yml +15 -0
- data/db/migrate/1_create_binda_tables.rb +172 -0
- data/lib/binda.rb +5 -0
- data/lib/binda/engine.rb +30 -0
- data/lib/binda/version.rb +3 -0
- data/lib/generators/binda/install/USAGE +9 -0
- data/lib/generators/binda/install/install_generator.rb +107 -0
- data/lib/generators/binda/install/templates/config/initializers/carrierwave.rb +32 -0
- data/lib/generators/binda/install/templates/config/initializers/devise.rb +280 -0
- data/lib/generators/binda/setup/USAGE +8 -0
- data/lib/generators/binda/setup/setup_generator.rb +43 -0
- data/lib/tasks/binda.rake +25 -0
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- metadata +637 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
require_dependency "binda/application_controller"
|
|
2
|
+
|
|
3
|
+
module Binda
|
|
4
|
+
class StructuresController < ApplicationController
|
|
5
|
+
before_action :set_structure, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
def index
|
|
8
|
+
@structures = Structure.order('position').all
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def show
|
|
12
|
+
redirect_to action: :edit
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def new
|
|
16
|
+
@structure = Structure.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def edit
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create
|
|
23
|
+
@structure = Structure.new(structure_params)
|
|
24
|
+
|
|
25
|
+
if @structure.save
|
|
26
|
+
# Creates a default empty field group
|
|
27
|
+
@fiedl_group = @structure.field_groups.build( name: 'General Details' )
|
|
28
|
+
# Unless there is a problem...
|
|
29
|
+
unless @fiedl_group.save
|
|
30
|
+
return redirect_to structure_path( @structure.slug ), flash: { error: 'General Details group hasn\'t been created' }
|
|
31
|
+
end
|
|
32
|
+
# ... redirect to the new structure path
|
|
33
|
+
redirect_to structure_path( @structure.slug ), notice: 'Structure was successfully created.'
|
|
34
|
+
else
|
|
35
|
+
render :new
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def update
|
|
40
|
+
# Create new fields if any
|
|
41
|
+
new_params[:new_field_groups].each do |field_group|
|
|
42
|
+
unless field_group[:name].blank?
|
|
43
|
+
new_field_group = @structure.field_groups.create( name: field_group[:name] )
|
|
44
|
+
unless new_field_group
|
|
45
|
+
return redirect_to structure_path( @structure.slug ), flash: { error: new_field_group.errors }
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Update the other ones
|
|
51
|
+
if @structure.update(structure_params)
|
|
52
|
+
redirect_to structure_path( @structure.slug ), notice: 'Structure was successfully updated.'
|
|
53
|
+
else
|
|
54
|
+
render :edit
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def destroy
|
|
59
|
+
@structure.destroy
|
|
60
|
+
redirect_to structures_url, notice: 'Structure was successfully destroyed.'
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def fields_update
|
|
64
|
+
redirect_to :back, notice: 'Components was successfully updated.'
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def sort
|
|
68
|
+
params[:structure].each_with_index do |id, i|
|
|
69
|
+
Binda::Structure.find( id ).update({ position: i + 1 })
|
|
70
|
+
end
|
|
71
|
+
head :ok
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
private
|
|
75
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
76
|
+
def set_structure
|
|
77
|
+
@structure = Structure.friendly.find(params[:id])
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Only allow a trusted parameter "white list" through.
|
|
81
|
+
def structure_params
|
|
82
|
+
params.require(:structure).permit(:name, :slug, :position, :has_categories, field_groups_attributes: [ :id, :name, :structure_id, :slug ] )
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def new_params
|
|
86
|
+
params.require(:structure).permit( new_field_groups:[ :name, :structure_id ] )
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require_dependency "binda/application_controller"
|
|
2
|
+
|
|
3
|
+
module Binda
|
|
4
|
+
class TextsController < ApplicationController
|
|
5
|
+
before_action :set_text, only: [:show, :edit, :update, :destroy]
|
|
6
|
+
|
|
7
|
+
# GET /texts
|
|
8
|
+
def index
|
|
9
|
+
@texts = Text.all
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# GET /texts/1
|
|
13
|
+
def show
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /texts/new
|
|
17
|
+
def new
|
|
18
|
+
@text = Text.new
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# GET /texts/1/edit
|
|
22
|
+
def edit
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# POST /texts
|
|
26
|
+
def create
|
|
27
|
+
@text = Text.new(text_params)
|
|
28
|
+
|
|
29
|
+
if @text.save
|
|
30
|
+
redirect_to text_path( @text.id ), notice: 'Text was successfully created.'
|
|
31
|
+
else
|
|
32
|
+
render :new
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# PATCH/PUT /texts/1
|
|
37
|
+
def update
|
|
38
|
+
if @text.update(text_params)
|
|
39
|
+
redirect_to text_path( @text.id ), notice: 'Text was successfully updated.'
|
|
40
|
+
else
|
|
41
|
+
render :edit
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# DELETE /texts/1
|
|
46
|
+
def destroy
|
|
47
|
+
@text.destroy
|
|
48
|
+
redirect_to texts_url, notice: 'Text was successfully destroyed.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
53
|
+
def set_text
|
|
54
|
+
@text = Text.find(params[:id])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Only allow a trusted parameter "white list" through.
|
|
58
|
+
def text_params
|
|
59
|
+
params.require(:text).permit(:content, :position)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Does it need require_dependecy? Maybe not
|
|
2
|
+
# require_dependency "binda/application_controller"
|
|
3
|
+
|
|
4
|
+
module Binda
|
|
5
|
+
class Users::ConfirmationsController < Devise::ConfirmationsController
|
|
6
|
+
# GET /resource/confirmation/new
|
|
7
|
+
# def new
|
|
8
|
+
# super
|
|
9
|
+
# end
|
|
10
|
+
|
|
11
|
+
# POST /resource/confirmation
|
|
12
|
+
# def create
|
|
13
|
+
# super
|
|
14
|
+
# end
|
|
15
|
+
|
|
16
|
+
# GET /resource/confirmation?confirmation_token=abcdef
|
|
17
|
+
# def show
|
|
18
|
+
# super
|
|
19
|
+
# end
|
|
20
|
+
|
|
21
|
+
# protected
|
|
22
|
+
|
|
23
|
+
# The path used after resending confirmation instructions.
|
|
24
|
+
# def after_resending_confirmation_instructions_path_for(resource_name)
|
|
25
|
+
# super(resource_name)
|
|
26
|
+
# end
|
|
27
|
+
|
|
28
|
+
# The path used after confirmation.
|
|
29
|
+
# def after_confirmation_path_for(resource_name, resource)
|
|
30
|
+
# super(resource_name, resource)
|
|
31
|
+
# end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Does it need require_dependecy? Maybe not
|
|
2
|
+
# require_dependency "binda/application_controller"
|
|
3
|
+
|
|
4
|
+
module Binda
|
|
5
|
+
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
6
|
+
# You should configure your model like this:
|
|
7
|
+
# devise :omniauthable, omniauth_providers: [:twitter]
|
|
8
|
+
|
|
9
|
+
# You should also create an action method in this controller like this:
|
|
10
|
+
# def twitter
|
|
11
|
+
# end
|
|
12
|
+
|
|
13
|
+
# More info at:
|
|
14
|
+
# https://github.com/plataformatec/devise#omniauth
|
|
15
|
+
|
|
16
|
+
# GET|POST /resource/auth/twitter
|
|
17
|
+
# def passthru
|
|
18
|
+
# super
|
|
19
|
+
# end
|
|
20
|
+
|
|
21
|
+
# GET|POST /users/auth/twitter/callback
|
|
22
|
+
# def failure
|
|
23
|
+
# super
|
|
24
|
+
# end
|
|
25
|
+
|
|
26
|
+
# protected
|
|
27
|
+
|
|
28
|
+
# The path used when OmniAuth fails
|
|
29
|
+
# def after_omniauth_failure_path_for(scope)
|
|
30
|
+
# super(scope)
|
|
31
|
+
# end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Does it need require_dependecy? Maybe not
|
|
2
|
+
# require_dependency "binda/application_controller"
|
|
3
|
+
|
|
4
|
+
module Binda
|
|
5
|
+
class Users::PasswordsController < Devise::PasswordsController
|
|
6
|
+
# GET /resource/password/new
|
|
7
|
+
# def new
|
|
8
|
+
# super
|
|
9
|
+
# end
|
|
10
|
+
|
|
11
|
+
# POST /resource/password
|
|
12
|
+
# def create
|
|
13
|
+
# super
|
|
14
|
+
# end
|
|
15
|
+
|
|
16
|
+
# GET /resource/password/edit?reset_password_token=abcdef
|
|
17
|
+
# def edit
|
|
18
|
+
# super
|
|
19
|
+
# end
|
|
20
|
+
|
|
21
|
+
# PUT /resource/password
|
|
22
|
+
# def update
|
|
23
|
+
# super
|
|
24
|
+
# end
|
|
25
|
+
|
|
26
|
+
# protected
|
|
27
|
+
|
|
28
|
+
# def after_resetting_password_path_for(resource)
|
|
29
|
+
# super(resource)
|
|
30
|
+
# end
|
|
31
|
+
|
|
32
|
+
# The path used after sending reset password instructions
|
|
33
|
+
# def after_sending_reset_password_instructions_path_for(resource_name)
|
|
34
|
+
# super(resource_name)
|
|
35
|
+
# end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Does it need require_dependecy? Maybe not
|
|
2
|
+
# require_dependency "binda/application_controller"
|
|
3
|
+
|
|
4
|
+
module Binda
|
|
5
|
+
class Users::RegistrationsController < Devise::RegistrationsController
|
|
6
|
+
# before_action :configure_sign_up_params, only: [:create]
|
|
7
|
+
# before_action :configure_account_update_params, only: [:update]
|
|
8
|
+
prepend_before_action :require_no_authentication, only: [:cancel]
|
|
9
|
+
|
|
10
|
+
# GET /resource/sign_up
|
|
11
|
+
def new
|
|
12
|
+
if user_signed_in?
|
|
13
|
+
super
|
|
14
|
+
else
|
|
15
|
+
redirect_to settings_path
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# POST /resource
|
|
20
|
+
def create
|
|
21
|
+
build_resource( sign_up_params )
|
|
22
|
+
|
|
23
|
+
resource.save
|
|
24
|
+
yield resource if block_given?
|
|
25
|
+
if resource.persisted?
|
|
26
|
+
if resource.active_for_authentication?
|
|
27
|
+
set_flash_message! :notice, :signed_user
|
|
28
|
+
# The following is commented out so the user remains the current, not the one just created
|
|
29
|
+
# sign_up(resource_name, resource)
|
|
30
|
+
respond_with resource, location: after_sign_up_path_for(resource)
|
|
31
|
+
else
|
|
32
|
+
set_flash_message! :notice, :"signed_user_but_#{resource.inactive_message}"
|
|
33
|
+
expire_data_after_sign_in!
|
|
34
|
+
respond_with resource, location: after_inactive_sign_up_path_for(resource)
|
|
35
|
+
end
|
|
36
|
+
else
|
|
37
|
+
clean_up_passwords resource
|
|
38
|
+
set_minimum_password_length
|
|
39
|
+
respond_with resource
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# GET /resource/edit
|
|
44
|
+
# def edit
|
|
45
|
+
# super
|
|
46
|
+
# end
|
|
47
|
+
|
|
48
|
+
# PUT /resource
|
|
49
|
+
# def update
|
|
50
|
+
# super
|
|
51
|
+
# end
|
|
52
|
+
|
|
53
|
+
# DELETE /resource
|
|
54
|
+
# def destroy
|
|
55
|
+
# super
|
|
56
|
+
# end
|
|
57
|
+
|
|
58
|
+
# GET /resource/cancel
|
|
59
|
+
# Forces the session data which is usually expired after sign
|
|
60
|
+
# in to be expired now. This is useful if the user wants to
|
|
61
|
+
# cancel oauth signing in/up in the middle of the process,
|
|
62
|
+
# removing all OAuth session data.
|
|
63
|
+
# def cancel
|
|
64
|
+
# super
|
|
65
|
+
# end
|
|
66
|
+
|
|
67
|
+
# protected
|
|
68
|
+
|
|
69
|
+
# If you have extra params to permit, append them to the sanitizer.
|
|
70
|
+
# def configure_sign_up_params
|
|
71
|
+
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
|
|
72
|
+
# end
|
|
73
|
+
|
|
74
|
+
# If you have extra params to permit, append them to the sanitizer.
|
|
75
|
+
# def configure_account_update_params
|
|
76
|
+
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
|
|
77
|
+
# end
|
|
78
|
+
|
|
79
|
+
# The path used after sign up.
|
|
80
|
+
# def after_sign_up_path_for(resource)
|
|
81
|
+
# super(resource)
|
|
82
|
+
# end
|
|
83
|
+
|
|
84
|
+
# The path used after sign up for inactive accounts.
|
|
85
|
+
# def after_inactive_sign_up_path_for(resource)
|
|
86
|
+
# super(resource)
|
|
87
|
+
# end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Does it need require_dependecy? Maybe not
|
|
2
|
+
# require_dependency "binda/application_controller"
|
|
3
|
+
|
|
4
|
+
module Binda
|
|
5
|
+
class Users::SessionsController < Devise::SessionsController
|
|
6
|
+
# before_action :configure_sign_in_params, only: [:create]
|
|
7
|
+
|
|
8
|
+
# GET /resource/sign_in
|
|
9
|
+
# def new
|
|
10
|
+
# super
|
|
11
|
+
# end
|
|
12
|
+
|
|
13
|
+
# POST /resource/sign_in
|
|
14
|
+
# def create
|
|
15
|
+
# super
|
|
16
|
+
# end
|
|
17
|
+
|
|
18
|
+
# DELETE /resource/sign_out
|
|
19
|
+
# def destroy
|
|
20
|
+
# super
|
|
21
|
+
# end
|
|
22
|
+
|
|
23
|
+
# protected
|
|
24
|
+
|
|
25
|
+
# If you have extra params to permit, append them to the sanitizer.
|
|
26
|
+
# def configure_sign_in_params
|
|
27
|
+
# devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
|
|
28
|
+
# end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Does it need require_dependecy? Maybe not
|
|
2
|
+
# require_dependency "binda/application_controller"
|
|
3
|
+
|
|
4
|
+
module Binda
|
|
5
|
+
class Users::UnlocksController < Devise::UnlocksController
|
|
6
|
+
# GET /resource/unlock/new
|
|
7
|
+
# def new
|
|
8
|
+
# super
|
|
9
|
+
# end
|
|
10
|
+
|
|
11
|
+
# POST /resource/unlock
|
|
12
|
+
# def create
|
|
13
|
+
# super
|
|
14
|
+
# end
|
|
15
|
+
|
|
16
|
+
# GET /resource/unlock?unlock_token=abcdef
|
|
17
|
+
# def show
|
|
18
|
+
# super
|
|
19
|
+
# end
|
|
20
|
+
|
|
21
|
+
# protected
|
|
22
|
+
|
|
23
|
+
# The path used after sending unlock password instructions
|
|
24
|
+
# def after_sending_unlock_instructions_path_for(resource)
|
|
25
|
+
# super(resource)
|
|
26
|
+
# end
|
|
27
|
+
|
|
28
|
+
# The path used after unlocking the resource
|
|
29
|
+
# def after_unlock_path_for(resource)
|
|
30
|
+
# super(resource)
|
|
31
|
+
# end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Binda
|
|
2
|
+
module ApplicationHelper
|
|
3
|
+
|
|
4
|
+
def main_app
|
|
5
|
+
Rails.application.class.routes.url_helpers
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def is_devise_controller
|
|
9
|
+
devise_controllers = [
|
|
10
|
+
'confirmations',
|
|
11
|
+
'omniauth_callbacks',
|
|
12
|
+
'passwords',
|
|
13
|
+
'sessions',
|
|
14
|
+
'unlocks'
|
|
15
|
+
]
|
|
16
|
+
devise_controllers.include? controller_name
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def get_form_manage_user_url
|
|
20
|
+
return manage_users_path if action_name == 'new'
|
|
21
|
+
return manage_user_path if action_name == 'edit'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|