jobshop 0.0.29 → 0.0.37

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: b9e9eaab0b35f68842256715a45fda81958e87c7
4
- data.tar.gz: e232d6a1bf2d96dc06010a7c5c218de6e9156898
3
+ metadata.gz: 6d5aae0bc0ef493f3af548a3924df2d7d3bfa20d
4
+ data.tar.gz: f3ec4420b0e9698bbfec1ba3d50c376c4fb8a261
5
5
  SHA512:
6
- metadata.gz: b01ffea7e425b9b5a9b9b0a8717402320ca86183a4acddabf95c8deb78a06839d2cfa5558fa29d2a31060a69420c434949c7e32d3eb3489d9ee14be247887527
7
- data.tar.gz: e5ea8f6e41ba2350d8b791bc770bd574b5cfc9774d706a66e843274935eb00b849892da165304f82330c684955f007233a4cff679364c76026902216f5f5a971
6
+ metadata.gz: 49cb1d2eda3f5e7cb29c119f8a6bc631784ab432479602df79327d6ea760be14a51d9b27fcb092765791d2646cf633f26583dd6a2c459ae0ff726e436604600d
7
+ data.tar.gz: 8a715e7172f5d4acef51079c0ae58153416aee02a905278b9bf33b1a716e07fab7e0af0cae39b91bc8e8af0146cb6e2bd2d783cd1e19288e0cf6892107b0373b
@@ -0,0 +1,8 @@
1
+ require_dependency "jobshop/application_controller"
2
+
3
+ module Jobshop
4
+ class SetupsController < ApplicationController
5
+ def show
6
+ end
7
+ end
8
+ end
@@ -16,6 +16,7 @@ module Jobshop
16
16
  @registration = ::Jobshop::Registration.new(params)
17
17
 
18
18
  if @registration.save
19
+ store_location_for(:user, team_setup_path)
19
20
  sign_in_and_redirect(@registration.user)
20
21
  else
21
22
  render(:new)
@@ -3,7 +3,13 @@ module Jobshop
3
3
  memo_attr(:user) { team.users.build(user_params) }
4
4
  memo_attr(:team) {
5
5
  record = ::Jobshop::Team.find(params[:team_id])
6
+
6
7
  record.assign_attributes(team_params)
8
+
9
+ record.singleton_class.class_eval do
10
+ validates :name, presence: true, on: :update, if: :name_changed?
11
+ end
12
+
7
13
  record
8
14
  }
9
15
 
@@ -27,13 +33,13 @@ module Jobshop
27
33
  end
28
34
 
29
35
  def team_params
30
- registration_params.fetch(
31
- :team, ActionController::Parameters.new).permit(:name)
36
+ registration_params.fetch(:team, ActionController::Parameters.new)
37
+ .permit(:name)
32
38
  end
33
39
 
34
40
  def user_params
35
- registration_params.fetch(:user, ActionController::Parameters.new).
36
- permit(:email, :password, :password_confirmation)
41
+ registration_params.fetch(:user, ActionController::Parameters.new)
42
+ .permit(:email, :password, :password_confirmation)
37
43
  end
38
44
  end
39
45
  end
@@ -4,8 +4,6 @@ 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
-
9
7
  def generate_registration_token
10
8
  raw, encrypted = Devise.token_generator.generate(
11
9
  self.class, :registration_token)
@@ -2,14 +2,14 @@
2
2
  %div.mdl-grid
3
3
  %div.mdl-cell.mdl-cell--12-col
4
4
  %div#sign-in.mdl-card
5
- = form_for(resource, builder: Jobshop::Builder, as: resource_name, url: session_path(resource_name)) do |f|
5
+ = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
6
6
  .mdl-card__title(style="height: 200px;")
7
7
  %object.logo{ type: "image/svg+xml", data: image_path("jobshop/logo.svg") }
8
8
 
9
9
  .mdl-card__supporting-text
10
- %div= f.email_field(:email)
11
- %div= f.password_field(:password)
10
+ = f.input(:email)
11
+ = f.input(:password)
12
12
 
13
13
  .mdl-card__actions
14
- %div= f.check_box :remember_me, "Remember me?"
15
- %div= f.button "Log in", class: "mdl-js-ripple-effect"
14
+ = f.input :remember_me, as: :boolean, input_html: { class: "mdl-checkbox__input" }
15
+ = f.button :submit, "Log in"
@@ -0,0 +1 @@
1
+ Welcome aboard!
@@ -2,15 +2,13 @@
2
2
  %div.mdl-grid
3
3
  %div.mdl-cell.mdl-cell--12-col
4
4
  %div#sign-in.mdl-card
5
- = form_for @lookup, builder: Jobshop::Builder, url: teams_lookup_path do |f|
5
+ = simple_form_for @lookup, url: teams_lookup_path do |f|
6
6
  .mdl-card__title
7
- %h4
8
- Can't find your team?
7
+ %h4 Can't find your team?
9
8
 
10
9
  .mdl-card__supporting-text
11
- %p
12
- Enter your email address and we'll send you the link.
13
- %div= f.email_field(:email)
10
+ %p Enter your email address and we'll send you the link.
11
+ = f.input :email
14
12
 
15
13
  .mdl-card__actions
16
- %div= f.button "Send the link to my email!", class: "mdl-js-ripple-effect"
14
+ = f.button :submit, "Send the link to my email!"
@@ -2,8 +2,7 @@
2
2
  %div.mdl-grid
3
3
  %div.mdl-cell.mdl-cell--12-col
4
4
  %div#register.mdl-card
5
- = form_for @registration,
6
- builder: Jobshop::Builder,
5
+ = simple_form_for @registration,
7
6
  url: team_registration_path(@registration.team) do |f|
8
7
  .mdl-card__title
9
8
  %object.logo{ type: "image/svg+xml",
@@ -14,13 +13,17 @@
14
13
  %strong Jobshop
15
14
  .mdl-card__supporting-text
16
15
  = hidden_field_tag(:registration_token, params[:registration_token])
17
- = f.fields_for(@registration.team) do |tf|
18
- %div= tf.text_field(:name)
19
-
20
- = f.fields_for(@registration.user) do |uf|
21
- %div= uf.email_field(:email)
22
- %div= uf.password_field(:password)
23
- %div= uf.password_field(:password_confirmation)
24
- %div= f.button "Next &#187;".html_safe,
25
- class: "btn waves-effect waves-light"
16
+ = f.fields_for(f.object.team) do |tf|
17
+ %p
18
+ Pick a name for your team. It will usually be (or include) your
19
+ company's name.
20
+ = tf.input :name, label: "Team Name"
26
21
 
22
+ = f.fields_for(f.object.user) do |uf|
23
+ = uf.input :email
24
+ %p
25
+ Pick a strong password, ideally being: longer than 8 characters,
26
+ of mixed upper/lower case, including numbers and symbols.
27
+ = uf.input :password
28
+ = uf.input :password_confirmation
29
+ = f.button :submit, "Next &#187;".html_safe
@@ -0,0 +1,158 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ # Wrappers are used by the form builder to generate a
4
+ # complete input. You can remove any component from the
5
+ # wrapper, change the order or even add your own to the
6
+ # stack. The options given below are used to wrap the
7
+ # whole input.
8
+
9
+ config.wrappers :string, class: [ "mdl-textfield", "mdl-js-textfield" ],
10
+ error_class: "is-invalid" do |b|
11
+
12
+ b.use :html5
13
+ b.use :input, class: "mdl-textfield__input"
14
+ b.use :label, class: "mdl-textfield__label"
15
+ b.use :error, wrap_with: { tag: :span, class: "mdl-textfield__error" }
16
+ end
17
+
18
+ config.wrappers :default, class: :input,
19
+ hint_class: :field_with_hint,
20
+ error_class: "is-invalid" do |b|
21
+
22
+ b.use :html5
23
+ b.use :placeholder
24
+ b.optional :maxlength
25
+ b.use :pattern
26
+ b.optional :min_max
27
+ b.optional :readonly
28
+ b.use :label_input
29
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
30
+ b.use :error, wrap_with: { tag: :span, class: :error }
31
+ end
32
+
33
+ # The default wrapper to be used by the FormBuilder.
34
+ config.default_wrapper = :default
35
+
36
+ # Define the way to render check boxes / radio buttons with labels.
37
+ # Defaults to :nested for bootstrap config.
38
+ # inline: input + label
39
+ # nested: label > input
40
+ config.boolean_style = :nested
41
+
42
+ # Default class for buttons
43
+ config.button_class = [
44
+ "mdl-button",
45
+ "mdl-js-button",
46
+ "mdl-button--raised",
47
+ "mdl-button--primary"
48
+ ]
49
+
50
+ # Method used to tidy up errors. Specify any Rails Array method.
51
+ # :first lists the first message for each field.
52
+ # Use :to_sentence to list all errors for each field.
53
+ config.error_method = :to_sentence
54
+
55
+ # Default tag used for error notification helper.
56
+ config.error_notification_tag = :div
57
+
58
+ # CSS class to add for error notification helper.
59
+ config.error_notification_class = "error_notification"
60
+
61
+ # ID to add for error notification helper.
62
+ # config.error_notification_id = nil
63
+
64
+ # Series of attempts to detect a default label method for collection.
65
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
66
+
67
+ # Series of attempts to detect a default value method for collection.
68
+ # config.collection_value_methods = [ :id, :to_s ]
69
+
70
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
71
+ # config.collection_wrapper_tag = nil
72
+
73
+ # You can define the class to use on all collection wrappers. Defaulting to none.
74
+ # config.collection_wrapper_class = nil
75
+
76
+ # You can wrap each item in a collection of radio/check boxes with a tag,
77
+ # defaulting to :span.
78
+ # config.item_wrapper_tag = :span
79
+
80
+ # You can define a class to use in all item wrappers. Defaulting to none.
81
+ # config.item_wrapper_class = nil
82
+
83
+ # How the label text should be generated altogether with the required text.
84
+ # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
85
+
86
+ # You can define the class to use on all labels. Default is nil.
87
+ # config.label_class = nil
88
+
89
+ # You can define the default class to be used on forms. Can be overriden
90
+ # with `html: { :class }`. Defaulting to none.
91
+ # config.default_form_class = nil
92
+
93
+ # You can define which elements should obtain additional classes
94
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
95
+
96
+ # Whether attributes are required by default (or not). Default is true.
97
+ # config.required_by_default = true
98
+
99
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
100
+ # These validations are enabled in SimpleForm's internal config but disabled by default
101
+ # in this configuration, which is recommended due to some quirks from different browsers.
102
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
103
+ # change this configuration to true.
104
+ # config.browser_validations = true
105
+
106
+ # Collection of methods to detect if a file type was given.
107
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
108
+
109
+ # Custom mappings for input types. This should be a hash containing a regexp
110
+ # to match as key, and the input type that will be used when the field name
111
+ # matches the regexp as value.
112
+ # config.input_mappings = { /count/ => :integer }
113
+
114
+ # Custom wrappers for input types. This should be a hash containing an input
115
+ # type as key and the wrapper that will be used for all inputs with specified type.
116
+ # config.wrapper_mappings = { string: :prepend }
117
+ config.wrapper_mappings = {
118
+ email: :string,
119
+ password: :string,
120
+ string: :string
121
+ }
122
+
123
+ # Namespaces where SimpleForm should look for custom input classes that
124
+ # override default inputs.
125
+ # config.custom_inputs_namespaces << "CustomInputs"
126
+
127
+ # Default priority for time_zone inputs.
128
+ # config.time_zone_priority = nil
129
+
130
+ # Default priority for country inputs.
131
+ # config.country_priority = nil
132
+
133
+ # When false, do not use translations for labels.
134
+ # config.translate_labels = true
135
+
136
+ # Automatically discover new inputs in Rails' autoload path.
137
+ # config.inputs_discovery = true
138
+
139
+ # Cache SimpleForm inputs discovery
140
+ # config.cache_discovery = !Rails.env.development?
141
+
142
+ # Default class for inputs
143
+ # config.input_class = nil
144
+
145
+ # Define the default class of the input wrapper of the boolean input.
146
+ config.boolean_label_class = [
147
+ "mdl-checkbox",
148
+ " mdl-js-checkbox",
149
+ " mdl-js-ripple-effect"
150
+ ]
151
+
152
+ # Defines if the default input wrapper class should be included in radio
153
+ # collection wrappers.
154
+ # config.include_default_input_wrapper_class = true
155
+
156
+ # Defines which i18n scope will be used in Simple Form.
157
+ # config.i18n_scope = 'simple_form'
158
+ end
@@ -0,0 +1,31 @@
1
+ en:
2
+ simple_form:
3
+ "yes": 'Yes'
4
+ "no": 'No'
5
+ required:
6
+ text: 'required'
7
+ mark: ''
8
+ # You can uncomment the line below if you need to overwrite the whole required html.
9
+ # When using html, text and mark won't be used.
10
+ # html: '<abbr title="required">*</abbr>'
11
+ error_notification:
12
+ default_message: "Please review the problems below:"
13
+ # Examples
14
+ # labels:
15
+ # defaults:
16
+ # password: 'Password'
17
+ # user:
18
+ # new:
19
+ # email: 'E-mail to sign in.'
20
+ # edit:
21
+ # email: 'E-mail.'
22
+ # hints:
23
+ # defaults:
24
+ # username: 'User name to sign in.'
25
+ # password: 'No special characters, please.'
26
+ # include_blanks:
27
+ # defaults:
28
+ # age: 'Rather not say'
29
+ # prompts:
30
+ # defaults:
31
+ # age: 'Select your age'
@@ -7,6 +7,8 @@ Jobshop::Engine.routes.draw do
7
7
  as: "teams_lookup"
8
8
  end
9
9
 
10
+ resource :setup, only: [ :show ]
11
+
10
12
  resource :registration, only: [ :new, :create ],
11
13
  controller: "teams/registrations"
12
14
  end
@@ -5,6 +5,7 @@ require "material_design_lite-sass"
5
5
  require "pundit"
6
6
  require "rolify"
7
7
  require "sass-rails"
8
+ require "simple_form"
8
9
  require "turbolinks"
9
10
 
10
11
  module Jobshop
@@ -6,7 +6,7 @@ module Jobshop
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 29
9
+ TINY = 37
10
10
  PRE = nil
11
11
 
12
12
  CODE_NAME = "bump it up prime".freeze
@@ -0,0 +1,10 @@
1
+ = simple_form_for(@<%= singular_table_name %>) do |f|
2
+ = f.error_notification
3
+
4
+ .form-inputs
5
+ <%- attributes.each do |attribute| -%>
6
+ = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
7
+ <%- end -%>
8
+
9
+ .form-actions
10
+ = f.button :submit
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.29
4
+ version: 0.0.37
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-08-05 00:00:00.000000000 Z
11
+ date: 2016-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: coffee-rails
@@ -98,22 +98,16 @@ dependencies:
98
98
  name: rails
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: 5.0.0.rc1
104
- - - "<"
101
+ - - "~>"
105
102
  - !ruby/object:Gem::Version
106
- version: '5.1'
103
+ version: 5.0.0
107
104
  type: :runtime
108
105
  prerelease: false
109
106
  version_requirements: !ruby/object:Gem::Requirement
110
107
  requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- version: 5.0.0.rc1
114
- - - "<"
108
+ - - "~>"
115
109
  - !ruby/object:Gem::Version
116
- version: '5.1'
110
+ version: 5.0.0
117
111
  - !ruby/object:Gem::Dependency
118
112
  name: rolify
119
113
  requirement: !ruby/object:Gem::Requirement
@@ -143,25 +137,33 @@ dependencies:
143
137
  - !ruby/object:Gem::Version
144
138
  version: 5.0.4
145
139
  - !ruby/object:Gem::Dependency
146
- name: turbolinks
140
+ name: simple_form
147
141
  requirement: !ruby/object:Gem::Requirement
148
142
  requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- version: 5.0.0.beta2
152
- - - "<"
143
+ - - "~>"
153
144
  - !ruby/object:Gem::Version
154
- version: '5.1'
145
+ version: 3.2.0
155
146
  type: :runtime
156
147
  prerelease: false
157
148
  version_requirements: !ruby/object:Gem::Requirement
158
149
  requirements:
159
- - - ">="
150
+ - - "~>"
160
151
  - !ruby/object:Gem::Version
161
- version: 5.0.0.beta2
162
- - - "<"
152
+ version: 3.2.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: turbolinks
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 5.0.1
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
163
165
  - !ruby/object:Gem::Version
164
- version: '5.1'
166
+ version: 5.0.1
165
167
  - !ruby/object:Gem::Dependency
166
168
  name: uglifier
167
169
  requirement: !ruby/object:Gem::Requirement
@@ -319,10 +321,10 @@ files:
319
321
  - app/assets/stylesheets/jobshop/application.scss
320
322
  - app/assets/stylesheets/jobshop/breakpoints.scss
321
323
  - app/assets/stylesheets/jobshop/static.scss
322
- - app/builders/jobshop/builder.rb
323
324
  - app/controllers/concerns/registration_token_validation.rb
324
325
  - app/controllers/jobshop/application_controller.rb
325
326
  - app/controllers/jobshop/dashboards_controller.rb
327
+ - app/controllers/jobshop/setups_controller.rb
326
328
  - app/controllers/jobshop/teams/lookups_controller.rb
327
329
  - app/controllers/jobshop/teams/registrations_controller.rb
328
330
  - app/controllers/jobshop/teams_controller.rb
@@ -350,6 +352,7 @@ files:
350
352
  - app/views/devise/shared/_links.html.haml
351
353
  - app/views/devise/unlocks/new.html.haml
352
354
  - app/views/jobshop/dashboards/show.html.haml
355
+ - app/views/jobshop/setups/show.html.haml
353
356
  - app/views/jobshop/teams/lookups/show.html.haml
354
357
  - app/views/jobshop/teams/registrations/new.html.haml
355
358
  - app/views/jobshop/teams_mailer/found_teams.text.erb
@@ -359,7 +362,9 @@ files:
359
362
  - config/initializers/assets.rb
360
363
  - config/initializers/devise.rb
361
364
  - config/initializers/field_with_errors.rb
365
+ - config/initializers/simple_form.rb
362
366
  - config/locales/devise.en.yml
367
+ - config/locales/simple_form.en.yml
363
368
  - config/routes.rb
364
369
  - db/migrate/20160314122952_devise_create_jobshop_users.rb
365
370
  - db/migrate/20160314190424_create_jobshop_sites.rb
@@ -388,6 +393,7 @@ files:
388
393
  - lib/jobshop/templates/secrets.yml.erb
389
394
  - lib/jobshop/version.rb
390
395
  - lib/tasks/jobshop_tasks.rake
396
+ - lib/templates/haml/scaffold/_form.html.haml
391
397
  homepage: https://jobshop.io
392
398
  licenses:
393
399
  - AGPL-3.0
@@ -1,48 +0,0 @@
1
- module Jobshop
2
- class Builder < ActionView::Helpers::FormBuilder # :nodoc:
3
- [ :email_field, :password_field, :text_field ].each do |field_method|
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
10
- output = ""
11
- output += @template.content_tag(:div, class: wrapper_classes) do
12
- content = ""
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
20
- content.html_safe
21
- end
22
- output.html_safe
23
- end
24
- end
25
-
26
- def check_box(field, *args)
27
- output = ""
28
- output += label(field, class: [ "mdl-checkbox", "mdl-js-checkbox", "mdl-js-ripple-effect" ]) do
29
- content = ""
30
- content += super(field, class: [ "mdl-checkbox__input" ])
31
- content += @template.content_tag(:span, field.to_s.humanize, class: [ "mdl-checkbox__label" ])
32
- content.html_safe
33
- end
34
- output.html_safe
35
- end
36
-
37
- def button(value = nil, *args)
38
- button_classes = [ "mdl-button", "mdl-js-button", "mdl-button--raised",
39
- "mdl-button--colored", "mdl-js-ripple-effect" ]
40
-
41
- super(value, class: button_classes)
42
- end
43
-
44
- def errors_on?(attribute)
45
- @object.errors[attribute].present?
46
- end
47
- end
48
- end