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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8836a59044956ad6f3a87a7ae6d1f8ed555d4206
4
- data.tar.gz: 784ebaafda1c6e0e7f55c35eb9541961b0c07b3f
3
+ metadata.gz: ab055cb2c42dd23830b4445b94986802dee8cb97
4
+ data.tar.gz: 470cb0c11c4751a5fe80ceb23864432447399153
5
5
  SHA512:
6
- metadata.gz: d497a7ad7a2cd3fdd6cce2fe9430fb10bc1776bb4d82088128adbd29063045b8a35304170e8d6b203752df4682f1c260da1233f0640844ef62921a09ec54feda
7
- data.tar.gz: 5ca0c588a1c163ca5d51e33584732f9afabc97d58ff1d871d59c9e7904964c0bc8083a7b5b2099b3ca6a3727f9af76b7808aa8cb7030147bdf1f07a7d2d2293c
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: "mdl-textfield mdl-js-textfield") do
11
+ output += @template.content_tag(:div, class: wrapper_classes) do
7
12
  content = ""
8
- content += super(field, class: [ "mdl-textfield__input" ])
9
- content += label(field, class: [ "mdl-textfield__label" ])
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
- extend ActiveSupport::Concern
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
- included do
5
- before_action :validate_registration_token!
6
- end
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
- def registration_token_resolves?
17
- encrypted_token = Devise.token_generator.digest(
18
- Jobshop::Team, :registration_token, params[:registration_token])
13
+ def resolves?
14
+ encrypted_token = Devise.token_generator.digest(
15
+ Jobshop::Team, :registration_token, @token)
19
16
 
20
- configurable = Jobshop::Team.find_by(
21
- id: params[:team_id], registration_token: encrypted_token)
17
+ configurable = Jobshop::Team.find_by(
18
+ id: @controller.params[:team_id], registration_token: encrypted_token)
22
19
 
23
- configurable &&
24
- configurable.registration_token_period_valid? &&
25
- configurable.owner.blank?
20
+ configurable &&
21
+ configurable.registration_token_period_valid? &&
22
+ configurable.owner.blank?
23
+ end
26
24
  end
27
25
  end
@@ -2,7 +2,7 @@ require_dependency "jobshop/application_controller"
2
2
 
3
3
  module Jobshop
4
4
  class Teams::RegistrationsController < ApplicationController
5
- include RegistrationTokenValidation
5
+ before_action RegistrationTokenValidation
6
6
 
7
7
  skip_before_action :authenticate_user!
8
8
 
@@ -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, builder: Jobshop::Builder, url: team_registration_path(@registration.team) do |f|
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", data: image_path("jobshop/logo.svg") }
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
- - if @registration.errors.present?
17
- %p.error try again
18
-
19
- = f.fields_for(@registration.team) do |team_f|
20
- %div= team_f.text_field(:name)
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 &#187;".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 &#187;".html_safe,
26
+ class: "btn waves-effect waves-light"
27
27
 
@@ -6,10 +6,10 @@ module Jobshop
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 16
9
+ TINY = 23
10
10
  PRE = nil
11
11
 
12
- CODE_NAME = "bump it up".freeze
12
+ CODE_NAME = "bump it up prime".freeze
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".").freeze
14
14
  end
15
15
  end
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.16
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-07-27 00:00:00.000000000 Z
11
+ date: 2016-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-rails