jobshop 0.0.16 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/builders/jobshop/builder.rb +17 -3
- data/app/controllers/concerns/registration_token_validation.rb +18 -20
- data/app/controllers/jobshop/teams/registrations_controller.rb +1 -1
- data/app/models/jobshop/team.rb +2 -0
- data/app/views/jobshop/teams/registrations/new.html.haml +14 -14
- data/lib/jobshop/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab055cb2c42dd23830b4445b94986802dee8cb97
|
4
|
+
data.tar.gz: 470cb0c11c4751a5fe80ceb23864432447399153
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d0a964d475f03ed8c269656508162b9d496b53ddaf61a2a87ba14ddfbcbdae603434941b3d68a293594b975d7a766b4925f9d84a68fdf5b42976e8fbc8bbcb6
|
7
|
+
data.tar.gz: 50e037a98bd3177241c5b1c6ece132918629277c9a631f5070bc0ec0f9799d1dac8dee0ea237b7f995ff10f107b965e4721823c0c4de07c91e8a56f94378b0a8
|
@@ -2,11 +2,21 @@ module Jobshop
|
|
2
2
|
class Builder < ActionView::Helpers::FormBuilder # :nodoc:
|
3
3
|
[ :email_field, :password_field, :text_field ].each do |field_method|
|
4
4
|
define_method field_method do |field, options = {}|
|
5
|
+
wrapper_classes = [
|
6
|
+
"mdl-textfield",
|
7
|
+
"mdl-js-textfield",
|
8
|
+
("is-invalid" if errors_on?(field))
|
9
|
+
].compact
|
5
10
|
output = ""
|
6
|
-
output += @template.content_tag(:div, class:
|
11
|
+
output += @template.content_tag(:div, class: wrapper_classes) do
|
7
12
|
content = ""
|
8
|
-
content += super(field, class:
|
9
|
-
content += label(field, class:
|
13
|
+
content += super(field, class: "mdl-textfield__input")
|
14
|
+
content += label(field, class: "mdl-textfield__label")
|
15
|
+
if errors_on?(field)
|
16
|
+
content += @template.content_tag(:span, class: "mdl-textfield__error") do
|
17
|
+
@object.errors[field].first
|
18
|
+
end
|
19
|
+
end
|
10
20
|
content.html_safe
|
11
21
|
end
|
12
22
|
output.html_safe
|
@@ -30,5 +40,9 @@ module Jobshop
|
|
30
40
|
|
31
41
|
super(value, class: button_classes)
|
32
42
|
end
|
43
|
+
|
44
|
+
def errors_on?(attribute)
|
45
|
+
@object.errors[attribute].present?
|
46
|
+
end
|
33
47
|
end
|
34
48
|
end
|
@@ -1,27 +1,25 @@
|
|
1
1
|
module RegistrationTokenValidation
|
2
|
-
|
2
|
+
class << self
|
3
|
+
def before(controller)
|
4
|
+
@token = controller.params[:registration_token]
|
5
|
+
@controller = controller
|
6
|
+
controller.redirect_to controller.new_user_session_path unless valid?
|
7
|
+
end
|
3
8
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def validate_registration_token!
|
9
|
-
redirect_to new_user_session_path unless registration_token_valid?
|
10
|
-
end
|
11
|
-
|
12
|
-
def registration_token_valid?
|
13
|
-
params[:registration_token].present? && registration_token_resolves?
|
14
|
-
end
|
9
|
+
def valid?
|
10
|
+
@token.present? && resolves?
|
11
|
+
end
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
def resolves?
|
14
|
+
encrypted_token = Devise.token_generator.digest(
|
15
|
+
Jobshop::Team, :registration_token, @token)
|
19
16
|
|
20
|
-
|
21
|
-
|
17
|
+
configurable = Jobshop::Team.find_by(
|
18
|
+
id: @controller.params[:team_id], registration_token: encrypted_token)
|
22
19
|
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
configurable &&
|
21
|
+
configurable.registration_token_period_valid? &&
|
22
|
+
configurable.owner.blank?
|
23
|
+
end
|
26
24
|
end
|
27
25
|
end
|
data/app/models/jobshop/team.rb
CHANGED
@@ -4,6 +4,8 @@ module Jobshop
|
|
4
4
|
has_many :users, class_name: "Jobshop::User"
|
5
5
|
has_one :default_dashboard, class_name: "Jobshop::Dashboard"
|
6
6
|
|
7
|
+
validates :name, presence: true, on: :update
|
8
|
+
|
7
9
|
def generate_registration_token
|
8
10
|
raw, encrypted = Devise.token_generator.generate(
|
9
11
|
self.class, :registration_token)
|
@@ -2,26 +2,26 @@
|
|
2
2
|
%div.mdl-grid
|
3
3
|
%div.mdl-cell.mdl-cell--12-col
|
4
4
|
%div#register.mdl-card
|
5
|
-
= form_for @registration,
|
5
|
+
= form_for @registration,
|
6
|
+
builder: Jobshop::Builder,
|
7
|
+
url: team_registration_path(@registration.team) do |f|
|
6
8
|
.mdl-card__title
|
7
|
-
%object.logo{ type: "image/svg+xml",
|
8
|
-
|
9
|
+
%object.logo{ type: "image/svg+xml",
|
10
|
+
data: image_path("jobshop/logo.svg") }
|
9
11
|
%h4
|
10
12
|
Get started with
|
11
13
|
%br>
|
12
14
|
%strong Jobshop
|
13
15
|
.mdl-card__supporting-text
|
14
16
|
= hidden_field_tag(:registration_token, params[:registration_token])
|
17
|
+
= f.fields_for(@registration.team) do |tf|
|
18
|
+
%div= tf.text_field(:name)
|
19
|
+
= console
|
15
20
|
|
16
|
-
|
17
|
-
%
|
18
|
-
|
19
|
-
|
20
|
-
%div=
|
21
|
-
|
22
|
-
= f.fields_for(@registration.user) do |user_f|
|
23
|
-
%div= user_f.email_field(:email)
|
24
|
-
%div= user_f.password_field(:password)
|
25
|
-
%div= user_f.password_field(:password_confirmation)
|
26
|
-
%div= f.button "Next »".html_safe, class: "btn waves-effect waves-light"
|
21
|
+
= f.fields_for(@registration.user) do |uf|
|
22
|
+
%div= uf.email_field(:email)
|
23
|
+
%div= uf.password_field(:password)
|
24
|
+
%div= uf.password_field(:password_confirmation)
|
25
|
+
%div= f.button "Next »".html_safe,
|
26
|
+
class: "btn waves-effect waves-light"
|
27
27
|
|
data/lib/jobshop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jobshop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank J. Mattia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: coffee-rails
|