├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README ├── README.md ├── Rakefile ├── app ├── assets │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── application.js │ │ ├── order_lines.js.coffee │ │ ├── orders.js.coffee │ │ └── products.js.coffee │ └── stylesheets │ │ ├── application.css.scss │ │ ├── framework_and_overrides.css.scss │ │ ├── order_lines.css.scss │ │ ├── orders.css.scss │ │ ├── products.css.scss │ │ └── scaffolds.css.scss ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ ├── order_lines_controller.rb │ ├── orders_controller.rb │ ├── products_controller.rb │ ├── users_controller.rb │ └── visitors_controller.rb ├── decorators │ ├── order_decorator.rb │ ├── order_line_decorator.rb │ └── product_decorator.rb ├── helpers │ ├── application_helper.rb │ ├── order_lines_helper.rb │ ├── orders_helper.rb │ └── products_helper.rb ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── concerns │ │ └── .keep │ ├── order.rb │ ├── order_line.rb │ ├── order_validation.rb │ ├── process_invalid_order.rb │ ├── process_invalid_order_template.rb │ ├── product.rb │ ├── reserve_stock_positions.rb │ ├── reserve_stock_positions_template.rb │ └── user.rb ├── services │ └── create_admin_service.rb └── views │ ├── devise │ ├── passwords │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── registrations │ │ ├── edit.html.erb │ │ └── new.html.erb │ └── sessions │ │ └── new.html.erb │ ├── layouts │ ├── _messages.html.slim │ ├── _navigation.html.slim │ ├── _navigation_links.html.erb │ └── application.html.slim │ ├── orders │ ├── _form.html.slim │ ├── edit.html.slim │ ├── index.html.slim │ ├── index.json.jbuilder │ ├── new.html.slim │ ├── show.html.slim │ └── show.json.jbuilder │ ├── products │ ├── _form.html.slim │ ├── edit.html.slim │ ├── index.html.slim │ ├── index.json.jbuilder │ ├── new.html.slim │ ├── show.html.slim │ └── show.json.jbuilder │ ├── users │ ├── _user.html.erb │ ├── index.html.erb │ ├── show.html.erb │ └── tasks.html.slim │ └── visitors │ └── index.html.erb ├── bin ├── bundle ├── rails ├── rake └── spring ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database.yml.sample ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── cookies_serializer.rb │ ├── devise.rb │ ├── devise_permitted_parameters.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── session_store.rb │ ├── simple_form.rb │ ├── simple_form_bootstrap.rb │ └── wrap_parameters.rb ├── locales │ ├── devise.en.yml │ ├── en.yml │ └── simple_form.en.yml ├── routes.rb ├── secrets.yml └── wf │ └── processing_order.json ├── db ├── dump.sql ├── migrate │ ├── 20150209172314_devise_create_users.rb │ ├── 20150209172316_add_name_to_users.rb │ ├── 20150209175803_create_products.rb │ ├── 20150209175919_create_orders.rb │ ├── 20150209175923_create_order_lines.rb │ ├── 20150209180608_add_role_to_user.rb │ └── 20150707182206_create_workflow_processes.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep ├── tasks │ └── .keep └── templates │ └── slim │ └── scaffold │ └── _form.html.slim ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico ├── humans.txt └── robots.txt ├── test ├── controllers │ ├── .keep │ ├── order_lines_controller_test.rb │ ├── orders_controller_test.rb │ └── products_controller_test.rb ├── decorators │ ├── order_decorator_test.rb │ ├── order_line_decorator_test.rb │ └── product_decorator_test.rb ├── fixtures │ ├── .keep │ ├── order_lines.yml │ ├── orders.yml │ ├── products.yml │ └── users.yml ├── helpers │ ├── .keep │ ├── order_lines_helper_test.rb │ ├── orders_helper_test.rb │ └── products_helper_test.rb ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── order_line_test.rb │ ├── order_test.rb │ ├── product_test.rb │ └── user_test.rb └── test_helper.rb └── vendor └── assets ├── javascripts └── .keep └── stylesheets └── .keep /.gitignore: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Ignore these files when commiting to a git repository. 3 | # 4 | # See http://help.github.com/ignore-files/ for more about ignoring files. 5 | # 6 | # The original version of this file is found here: 7 | # https://github.com/RailsApps/rails-composer/blob/master/files/gitignore.txt 8 | # 9 | # Corrections? Improvements? Create a GitHub issue: 10 | # http://github.com/RailsApps/rails-composer/issues 11 | #---------------------------------------------------------------------------- 12 | 13 | # bundler state 14 | /.bundle 15 | /vendor/bundle/ 16 | /vendor/ruby/ 17 | 18 | # minimal Rails specific artifacts 19 | db/*.sqlite3 20 | /db/*.sqlite3-journal 21 | /log/* 22 | /tmp/* 23 | 24 | # various artifacts 25 | **.war 26 | *.rbc 27 | *.sassc 28 | .redcar/ 29 | .sass-cache 30 | /config/config.yml 31 | /config/database.yml 32 | /coverage.data 33 | /coverage/ 34 | /db/*.javadb/ 35 | /db/*.sqlite3 36 | /doc/api/ 37 | /doc/app/ 38 | /doc/features.html 39 | /doc/specs.html 40 | /public/cache 41 | /public/stylesheets/compiled 42 | /public/system/* 43 | /spec/tmp/* 44 | /cache 45 | /capybara* 46 | /capybara-*.html 47 | /gems 48 | /specifications 49 | rerun.txt 50 | pickle-email-*.html 51 | .zeus.sock 52 | 53 | # If you find yourself ignoring temporary files generated by your text editor 54 | # or operating system, you probably want to add a global ignore instead: 55 | # git config --global core.excludesfile ~/.gitignore_global 56 | # 57 | # Here are some files you may want to ignore globally: 58 | 59 | # scm revert files 60 | **.orig 61 | 62 | # Mac finder artifacts 63 | .DS_Store 64 | 65 | # Netbeans project directory 66 | /nbproject/ 67 | 68 | # RubyMine project files 69 | .idea 70 | 71 | # Textmate project files 72 | /*.tmproj 73 | 74 | # vim artifacts 75 | **.swp 76 | 77 | # Environment files that may contain sensitive data 78 | .env 79 | .powenv 80 | 81 | .idea/ 82 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | ruby '2.3.1' 3 | gem 'rails', '4.2.7' 4 | gem 'sass-rails', '~> 4.0.3' 5 | gem 'uglifier', '>= 1.3.0' 6 | gem 'coffee-rails', '~> 4.0.0' 7 | gem 'jquery-rails' 8 | gem 'turbolinks' 9 | gem 'jbuilder', '~> 2.0' 10 | gem 'sdoc', '~> 0.4.0', group: :doc 11 | gem 'spring', group: :development 12 | gem 'bootstrap-sass' 13 | gem 'devise' 14 | gem 'pg' 15 | gem 'simple_form' 16 | gem 'slim-rails' 17 | gem 'rails_workflow' 18 | # gem 'rails_workflow', path: '../rails_workflow' 19 | gem 'inherited_resources' 20 | gem "symbolize" 21 | group :development do 22 | gem 'better_errors' 23 | gem 'binding_of_caller', :platforms=>[:mri_21] 24 | gem 'quiet_assets' 25 | gem 'rails_layout' 26 | end 27 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../rails_workflow 3 | specs: 4 | rails_workflow (0.3.9) 5 | active_model_serializers 6 | bootstrap-rails-engine 7 | draper 8 | guid 9 | jquery-rails 10 | pg 11 | rails (~> 4.1, >= 4.1.0) 12 | sidekiq 13 | slim-rails 14 | will_paginate 15 | 16 | GEM 17 | remote: https://rubygems.org/ 18 | specs: 19 | actionmailer (4.2.7) 20 | actionpack (= 4.2.7) 21 | actionview (= 4.2.7) 22 | activejob (= 4.2.7) 23 | mail (~> 2.5, >= 2.5.4) 24 | rails-dom-testing (~> 1.0, >= 1.0.5) 25 | actionpack (4.2.7) 26 | actionview (= 4.2.7) 27 | activesupport (= 4.2.7) 28 | rack (~> 1.6) 29 | rack-test (~> 0.6.2) 30 | rails-dom-testing (~> 1.0, >= 1.0.5) 31 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 32 | actionview (4.2.7) 33 | activesupport (= 4.2.7) 34 | builder (~> 3.1) 35 | erubis (~> 2.7.0) 36 | rails-dom-testing (~> 1.0, >= 1.0.5) 37 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 38 | active_model_serializers (0.10.2) 39 | actionpack (>= 4.1, < 6) 40 | activemodel (>= 4.1, < 6) 41 | jsonapi (~> 0.1.1.beta2) 42 | railties (>= 4.1, < 6) 43 | activejob (4.2.7) 44 | activesupport (= 4.2.7) 45 | globalid (>= 0.3.0) 46 | activemodel (4.2.7) 47 | activesupport (= 4.2.7) 48 | builder (~> 3.1) 49 | activerecord (4.2.7) 50 | activemodel (= 4.2.7) 51 | activesupport (= 4.2.7) 52 | arel (~> 6.0) 53 | activesupport (4.2.7) 54 | i18n (~> 0.7) 55 | json (~> 1.7, >= 1.7.7) 56 | minitest (~> 5.1) 57 | thread_safe (~> 0.3, >= 0.3.4) 58 | tzinfo (~> 1.1) 59 | arel (6.0.3) 60 | autoprefixer-rails (6.5.1.1) 61 | execjs 62 | bcrypt (3.1.11) 63 | better_errors (2.1.1) 64 | coderay (>= 1.0.0) 65 | erubis (>= 2.6.6) 66 | rack (>= 0.9.0) 67 | binding_of_caller (0.7.2) 68 | debug_inspector (>= 0.0.1) 69 | bootstrap-rails-engine (3.1.1.0) 70 | railties (>= 3.0) 71 | bootstrap-sass (3.3.5) 72 | autoprefixer-rails (>= 5.0.0.1) 73 | sass (>= 3.2.19) 74 | builder (3.2.2) 75 | coderay (1.1.1) 76 | coffee-rails (4.0.1) 77 | coffee-script (>= 2.2.0) 78 | railties (>= 4.0.0, < 5.0) 79 | coffee-script (2.4.1) 80 | coffee-script-source 81 | execjs 82 | coffee-script-source (1.10.0) 83 | concurrent-ruby (1.0.2) 84 | connection_pool (2.2.0) 85 | debug_inspector (0.0.2) 86 | devise (4.2.0) 87 | bcrypt (~> 3.0) 88 | orm_adapter (~> 0.1) 89 | railties (>= 4.1.0, < 5.1) 90 | responders 91 | warden (~> 1.2.3) 92 | draper (2.1.0) 93 | actionpack (>= 3.0) 94 | activemodel (>= 3.0) 95 | activesupport (>= 3.0) 96 | request_store (~> 1.0) 97 | erubis (2.7.0) 98 | execjs (2.7.0) 99 | globalid (0.3.7) 100 | activesupport (>= 4.1.0) 101 | guid (0.1.1) 102 | has_scope (0.6.0) 103 | actionpack (>= 3.2, < 5) 104 | activesupport (>= 3.2, < 5) 105 | hike (1.2.3) 106 | i18n (0.7.0) 107 | inherited_resources (1.6.0) 108 | actionpack (>= 3.2, < 5) 109 | has_scope (~> 0.6.0.rc) 110 | railties (>= 3.2, < 5) 111 | responders 112 | jbuilder (2.6.0) 113 | activesupport (>= 3.0.0, < 5.1) 114 | multi_json (~> 1.2) 115 | jquery-rails (4.2.1) 116 | rails-dom-testing (>= 1, < 3) 117 | railties (>= 4.2.0) 118 | thor (>= 0.14, < 2.0) 119 | json (1.8.3) 120 | jsonapi (0.1.1.beta6) 121 | jsonapi-parser (= 0.1.1.beta3) 122 | jsonapi-renderer (= 0.1.1.beta1) 123 | jsonapi-parser (0.1.1.beta3) 124 | jsonapi-renderer (0.1.1.beta1) 125 | loofah (2.0.3) 126 | nokogiri (>= 1.5.9) 127 | mail (2.6.4) 128 | mime-types (>= 1.16, < 4) 129 | mime-types (3.1) 130 | mime-types-data (~> 3.2015) 131 | mime-types-data (3.2016.0521) 132 | mini_portile2 (2.1.0) 133 | minitest (5.9.1) 134 | multi_json (1.12.1) 135 | nokogiri (1.6.8.1) 136 | mini_portile2 (~> 2.1.0) 137 | orm_adapter (0.5.0) 138 | pg (0.19.0) 139 | quiet_assets (1.1.0) 140 | railties (>= 3.1, < 5.0) 141 | rack (1.6.4) 142 | rack-protection (1.5.3) 143 | rack 144 | rack-test (0.6.3) 145 | rack (>= 1.0) 146 | rails (4.2.7) 147 | actionmailer (= 4.2.7) 148 | actionpack (= 4.2.7) 149 | actionview (= 4.2.7) 150 | activejob (= 4.2.7) 151 | activemodel (= 4.2.7) 152 | activerecord (= 4.2.7) 153 | activesupport (= 4.2.7) 154 | bundler (>= 1.3.0, < 2.0) 155 | railties (= 4.2.7) 156 | sprockets-rails 157 | rails-deprecated_sanitizer (1.0.3) 158 | activesupport (>= 4.2.0.alpha) 159 | rails-dom-testing (1.0.7) 160 | activesupport (>= 4.2.0.beta, < 5.0) 161 | nokogiri (~> 1.6.0) 162 | rails-deprecated_sanitizer (>= 1.0.1) 163 | rails-html-sanitizer (1.0.3) 164 | loofah (~> 2.0) 165 | rails_layout (1.0.34) 166 | railties (4.2.7) 167 | actionpack (= 4.2.7) 168 | activesupport (= 4.2.7) 169 | rake (>= 0.8.7) 170 | thor (>= 0.18.1, < 2.0) 171 | rake (11.3.0) 172 | rdoc (4.2.2) 173 | json (~> 1.4) 174 | redis (3.3.1) 175 | request_store (1.3.1) 176 | responders (2.3.0) 177 | railties (>= 4.2.0, < 5.1) 178 | sass (3.2.19) 179 | sass-rails (4.0.5) 180 | railties (>= 4.0.0, < 5.0) 181 | sass (~> 3.2.2) 182 | sprockets (~> 2.8, < 3.0) 183 | sprockets-rails (~> 2.0) 184 | sdoc (0.4.2) 185 | json (~> 1.7, >= 1.7.7) 186 | rdoc (~> 4.0) 187 | sidekiq (4.2.3) 188 | concurrent-ruby (~> 1.0) 189 | connection_pool (~> 2.2, >= 2.2.0) 190 | rack-protection (>= 1.5.0) 191 | redis (~> 3.2, >= 3.2.1) 192 | simple_form (3.3.1) 193 | actionpack (> 4, < 5.1) 194 | activemodel (> 4, < 5.1) 195 | slim (3.0.7) 196 | temple (~> 0.7.6) 197 | tilt (>= 1.3.3, < 2.1) 198 | slim-rails (3.1.1) 199 | actionpack (>= 3.1) 200 | railties (>= 3.1) 201 | slim (~> 3.0) 202 | spring (2.0.0) 203 | activesupport (>= 4.2) 204 | sprockets (2.12.4) 205 | hike (~> 1.2) 206 | multi_json (~> 1.0) 207 | rack (~> 1.0) 208 | tilt (~> 1.1, != 1.3.0) 209 | sprockets-rails (2.3.3) 210 | actionpack (>= 3.0) 211 | activesupport (>= 3.0) 212 | sprockets (>= 2.8, < 4.0) 213 | symbolize (4.5.2) 214 | activemodel (>= 3.2, < 5) 215 | activesupport (>= 3.2, < 5) 216 | i18n 217 | temple (0.7.7) 218 | thor (0.19.1) 219 | thread_safe (0.3.5) 220 | tilt (1.4.1) 221 | turbolinks (5.0.1) 222 | turbolinks-source (~> 5) 223 | turbolinks-source (5.0.0) 224 | tzinfo (1.2.2) 225 | thread_safe (~> 0.1) 226 | uglifier (3.0.3) 227 | execjs (>= 0.3.0, < 3) 228 | warden (1.2.6) 229 | rack (>= 1.0) 230 | will_paginate (3.1.5) 231 | 232 | PLATFORMS 233 | ruby 234 | 235 | DEPENDENCIES 236 | better_errors 237 | binding_of_caller 238 | bootstrap-sass 239 | coffee-rails (~> 4.0.0) 240 | devise 241 | inherited_resources 242 | jbuilder (~> 2.0) 243 | jquery-rails 244 | pg 245 | quiet_assets 246 | rails (= 4.2.7) 247 | rails_layout 248 | rails_workflow! 249 | sass-rails (~> 4.0.3) 250 | sdoc (~> 0.4.0) 251 | simple_form 252 | slim-rails 253 | spring 254 | symbolize 255 | turbolinks 256 | uglifier (>= 1.3.0) 257 | 258 | RUBY VERSION 259 | ruby 2.3.1p112 260 | 261 | BUNDLED WITH 262 | 1.12.5 263 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Rails Workflow Demo 2 | ================ 3 | 4 | Rails Composer, open source, supported by subscribers. 5 | Please join RailsApps to support development of Rails Composer. 6 | Need help? Ask on Stack Overflow with the tag 'railsapps.' 7 | Problems? Submit an issue: https://github.com/RailsApps/rails_apps_composer/issues 8 | Your application contains diagnostics in this README file. 9 | Please provide a copy of this README file when reporting any issues. 10 | 11 | 12 | option Build a starter application? 13 | choose Enter your selection: [rails-devise] 14 | option Get on the mailing list for Rails Composer news? 15 | choose Enter your selection: [none] 16 | option Web server for development? 17 | choose Enter your selection: [webrick] 18 | option Web server for production? 19 | choose Enter your selection: [webrick] 20 | option Database used in development? 21 | choose Enter your selection: [postgresql] 22 | option Template engine? 23 | choose Enter your selection: [slim] 24 | option Test framework? 25 | choose Enter your selection: [none] 26 | option Continuous testing? 27 | choose Enter your selection: [] 28 | option Front-end framework? 29 | choose Enter your selection: [bootstrap3] 30 | option Add support for sending email? 31 | choose Enter your selection: [none] 32 | option Authentication? 33 | choose Enter your selection: [devise] 34 | option Devise modules? 35 | choose Enter your selection: [default] 36 | option OmniAuth provider? 37 | choose Enter your selection: [] 38 | option Authorization? 39 | choose Enter your selection: [false] 40 | option Use a form builder gem? 41 | choose Enter your selection: [simple_form] 42 | option Add pages? 43 | choose Enter your selection: [users] 44 | option Set a locale? 45 | choose Enter your selection: [none] 46 | option Install page-view analytics? 47 | choose Enter your selection: [none] 48 | option Add a deployment mechanism? 49 | choose Enter your selection: [none] 50 | option Set a robots.txt file to ban spiders? 51 | choose Enter your selection: [] 52 | option Create a GitHub repository? (y/n) 53 | choose Enter your selection: [] 54 | option Add gem and file for environment variables? 55 | choose Enter your selection: [false] 56 | option Reduce assets logger noise during development? 57 | choose Enter your selection: [true] 58 | option Improve error reporting with 'better_errors' during development? 59 | choose Enter your selection: [true] 60 | option Use 'pry' as console replacement during development and test? 61 | choose Enter your selection: [false] 62 | option Use or create a project-specific rvm gemset? 63 | choose Enter your selection: [false] 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Rails Workflow Demo 2 | ================ 3 | 4 | This application was generated with the [rails_apps_composer](https://github.com/RailsApps/rails_apps_composer) gem 5 | provided by the [RailsApps Project](http://railsapps.github.io/). 6 | 7 | Rails Composer is open source and supported by subscribers. Please join RailsApps to support development of Rails Composer. 8 | 9 | Problems? Issues? 10 | ----------- 11 | 12 | Need help? Ask on Stack Overflow with the tag 'railsapps.' 13 | 14 | Your application contains diagnostics in the README file. Please provide a copy of the README file when reporting any issues. 15 | 16 | If the application doesn't work as expected, please [report an issue](https://github.com/RailsApps/rails_apps_composer/issues) 17 | and include the diagnostics. 18 | 19 | Ruby on Rails 20 | ------------- 21 | 22 | This application requires: 23 | 24 | - Ruby 2.1.2 25 | - Rails 4.1.9 26 | 27 | Learn more about [Installing Rails](http://railsapps.github.io/installing-rails.html). 28 | 29 | Getting Started 30 | --------------- 31 | 32 | Documentation and Support 33 | ------------------------- 34 | 35 | Issues 36 | ------------- 37 | 38 | Similar Projects 39 | ---------------- 40 | 41 | Contributing 42 | ------------ 43 | 44 | Credits 45 | ------- 46 | 47 | License 48 | ------- 49 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require turbolinks 16 | //= require bootstrap-sprockets 17 | //= require_tree . 18 | -------------------------------------------------------------------------------- /app/assets/javascripts/order_lines.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/orders.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/products.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/framework_and_overrides.css.scss: -------------------------------------------------------------------------------- 1 | // import the CSS framework 2 | @import "bootstrap-sprockets"; 3 | @import "bootstrap"; 4 | 5 | // make all images responsive by default 6 | img { 7 | @extend .img-responsive; 8 | margin: 0 auto; 9 | } 10 | // override for the 'Home' navigation link 11 | .navbar-brand { 12 | font-size: inherit; 13 | } 14 | 15 | // THESE ARE EXAMPLES YOU CAN MODIFY 16 | // create your own classes 17 | // to make views framework-neutral 18 | .column { 19 | @extend .col-md-6; 20 | @extend .text-center; 21 | } 22 | .form { 23 | @extend .col-md-6; 24 | } 25 | .form-centered { 26 | @extend .col-md-6; 27 | @extend .text-center; 28 | } 29 | .submit { 30 | @extend .btn; 31 | @extend .btn-primary; 32 | @extend .btn-lg; 33 | } 34 | // apply styles to HTML elements 35 | // to make views framework-neutral 36 | main { 37 | @extend .container; 38 | background-color: #eee; 39 | padding-bottom: 80px; 40 | width: 100%; 41 | margin-top: 51px; // accommodate the navbar 42 | } 43 | section { 44 | @extend .row; 45 | margin-top: 20px; 46 | } 47 | 48 | // Styles for form views 49 | // using Bootstrap 50 | // generated by the rails_layout gem 51 | .authform { 52 | padding-top: 30px; 53 | max-width: 320px; 54 | margin: 0 auto; 55 | } 56 | .authform form { 57 | @extend .well; 58 | @extend .well-lg; 59 | padding-bottom: 40px; 60 | } 61 | .authform .right { 62 | float: right !important; 63 | } 64 | .authform .button { 65 | @extend .btn; 66 | @extend .btn-primary; 67 | } 68 | .authform fieldset { 69 | @extend .well; 70 | } 71 | #error_explanation { 72 | @extend .alert; 73 | @extend .alert-danger; 74 | } 75 | #error_explanation h2 { 76 | font-size: 16px; 77 | } 78 | .button-xs { 79 | @extend .btn; 80 | @extend .btn-primary; 81 | @extend .btn-xs; 82 | } 83 | -------------------------------------------------------------------------------- /app/assets/stylesheets/order_lines.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the OrderLines controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/orders.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Orders controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/products.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Products controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/scaffolds.css.scss: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | color: #333; 4 | font-family: verdana, arial, helvetica, sans-serif; 5 | font-size: 13px; 6 | line-height: 18px; 7 | } 8 | 9 | p, ol, ul, td { 10 | font-family: verdana, arial, helvetica, sans-serif; 11 | font-size: 13px; 12 | line-height: 18px; 13 | } 14 | 15 | pre { 16 | background-color: #eee; 17 | padding: 10px; 18 | font-size: 11px; 19 | } 20 | 21 | a { 22 | color: #000; 23 | &:visited { 24 | color: #666; 25 | } 26 | &:hover { 27 | color: #fff; 28 | background-color: #000; 29 | } 30 | } 31 | 32 | div { 33 | &.field, &.actions { 34 | margin-bottom: 10px; 35 | } 36 | } 37 | 38 | #notice { 39 | color: green; 40 | } 41 | 42 | .field_with_errors { 43 | padding: 2px; 44 | background-color: red; 45 | display: table; 46 | } 47 | 48 | #error_explanation { 49 | width: 450px; 50 | border: 2px solid red; 51 | padding: 7px; 52 | padding-bottom: 0; 53 | margin-bottom: 20px; 54 | background-color: #f0f0f0; 55 | h2 { 56 | text-align: left; 57 | font-weight: bold; 58 | padding: 5px 5px 5px 15px; 59 | font-size: 12px; 60 | margin: -7px; 61 | margin-bottom: 0px; 62 | background-color: #c00; 63 | color: #fff; 64 | } 65 | ul li { 66 | font-size: 12px; 67 | list-style: square; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | before_action :authenticate_user! 6 | end 7 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/order_lines_controller.rb: -------------------------------------------------------------------------------- 1 | class OrderLinesController < InheritedResources::Base 2 | 3 | private 4 | 5 | def order_line_params 6 | params.require(:order_line).permit(:order_id, :product_id, :qty) 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /app/controllers/orders_controller.rb: -------------------------------------------------------------------------------- 1 | class OrdersController < InheritedResources::Base 2 | 3 | def new 4 | @order = Order.new 5 | Product.find_each {|p| @order.lines.build(product: p, qty: 0)} 6 | new! 7 | end 8 | 9 | def create 10 | @order = Order.create( 11 | order_params.merge(customer: current_user) 12 | ) 13 | 14 | create! do |success, failure| 15 | success.html do 16 | process_template_id = 1 17 | RailsWorkflow::ProcessManager.start_process( 18 | process_template_id , { resource: resource } 19 | ) 20 | 21 | redirect_to orders_path 22 | end 23 | end 24 | end 25 | 26 | def update 27 | update! do |success, failure| 28 | success.html do 29 | if current_operation && (params['commit'] == 'Complete') 30 | current_operation.complete 31 | end 32 | 33 | redirect_to root_path 34 | end 35 | end 36 | end 37 | 38 | 39 | private 40 | 41 | def order_params 42 | params.require(:order).permit(lines_attributes: [:id, :qty, :product_id]) 43 | end 44 | end 45 | 46 | -------------------------------------------------------------------------------- /app/controllers/products_controller.rb: -------------------------------------------------------------------------------- 1 | class ProductsController < InheritedResources::Base 2 | 3 | private 4 | 5 | def product_params 6 | params.require(:product).permit(:name, :active, :vendor_id, :unit_price, :stock_qty, :reserved_qty, :min_qty) 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | before_filter :authenticate_user! 3 | 4 | def index 5 | @users = User.all 6 | end 7 | 8 | def show 9 | @user = User.find(params[:id]) 10 | unless @user == current_user 11 | redirect_to :back, :alert => "Access denied." 12 | end 13 | end 14 | 15 | end 16 | -------------------------------------------------------------------------------- /app/controllers/visitors_controller.rb: -------------------------------------------------------------------------------- 1 | class VisitorsController < ApplicationController 2 | end 3 | -------------------------------------------------------------------------------- /app/decorators/order_decorator.rb: -------------------------------------------------------------------------------- 1 | class OrderDecorator < Draper::Decorator 2 | delegate_all 3 | 4 | # Define presentation-specific methods here. Helpers are accessed through 5 | # `helpers` (aka `h`). You can override attributes, for example: 6 | # 7 | # def created_at 8 | # helpers.content_tag :span, class: 'time' do 9 | # object.created_at.strftime("%a %m/%d/%y") 10 | # end 11 | # end 12 | 13 | end 14 | -------------------------------------------------------------------------------- /app/decorators/order_line_decorator.rb: -------------------------------------------------------------------------------- 1 | class OrderLineDecorator < Draper::Decorator 2 | delegate_all 3 | 4 | # Define presentation-specific methods here. Helpers are accessed through 5 | # `helpers` (aka `h`). You can override attributes, for example: 6 | # 7 | # def created_at 8 | # helpers.content_tag :span, class: 'time' do 9 | # object.created_at.strftime("%a %m/%d/%y") 10 | # end 11 | # end 12 | 13 | end 14 | -------------------------------------------------------------------------------- /app/decorators/product_decorator.rb: -------------------------------------------------------------------------------- 1 | class ProductDecorator < Draper::Decorator 2 | delegate_all 3 | 4 | # Define presentation-specific methods here. Helpers are accessed through 5 | # `helpers` (aka `h`). You can override attributes, for example: 6 | # 7 | # def created_at 8 | # helpers.content_tag :span, class: 'time' do 9 | # object.created_at.strftime("%a %m/%d/%y") 10 | # end 11 | # end 12 | 13 | end 14 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/order_lines_helper.rb: -------------------------------------------------------------------------------- 1 | module OrderLinesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/orders_helper.rb: -------------------------------------------------------------------------------- 1 | module OrdersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/products_helper.rb: -------------------------------------------------------------------------------- 1 | module ProductsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/app/mailers/.keep -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/app/models/.keep -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/order.rb: -------------------------------------------------------------------------------- 1 | class Order < ActiveRecord::Base 2 | belongs_to :customer, class_name: "User" 3 | has_many :lines, class_name: "OrderLine" 4 | 5 | accepts_nested_attributes_for :lines 6 | end 7 | -------------------------------------------------------------------------------- /app/models/order_line.rb: -------------------------------------------------------------------------------- 1 | class OrderLine < ActiveRecord::Base 2 | belongs_to :order 3 | belongs_to :product 4 | 5 | delegate :name, to: :product 6 | end 7 | -------------------------------------------------------------------------------- /app/models/order_validation.rb: -------------------------------------------------------------------------------- 1 | class OrderValidation < RailsWorkflow::Operation 2 | def execute 3 | self.data[:orderValid] = false 4 | save 5 | end 6 | end -------------------------------------------------------------------------------- /app/models/process_invalid_order.rb: -------------------------------------------------------------------------------- 1 | class ProcessInvalidOrder < RailsWorkflow::UserByRoleOperation 2 | def on_complete 3 | self.data[:orderValid] = true 4 | save 5 | end 6 | end -------------------------------------------------------------------------------- /app/models/process_invalid_order_template.rb: -------------------------------------------------------------------------------- 1 | class ProcessInvalidOrderTemplate < RailsWorkflow::OperationTemplate 2 | def build_operation operation 3 | resource = operation.data[:resource] 4 | operation.title += " ##{resource.id}" 5 | 6 | operation.context.data.merge!({ 7 | url_path: :edit_order_path, 8 | url_params: [resource] 9 | 10 | }) 11 | end 12 | 13 | 14 | def resolve_dependency operation 15 | !operation.data[:orderValid] 16 | end 17 | 18 | end -------------------------------------------------------------------------------- /app/models/product.rb: -------------------------------------------------------------------------------- 1 | class Product < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/models/reserve_stock_positions.rb: -------------------------------------------------------------------------------- 1 | class ReserveStockPositions < RailsWorkflow::Operation 2 | def execute 3 | resource = data[:resource] 4 | resource.lines.each do |order_line| 5 | product = order_line.product 6 | 7 | product.reserved_qty = 8 | product.reserved_qty.to_i + order_line.qty 9 | 10 | product.save 11 | end 12 | 13 | end 14 | end -------------------------------------------------------------------------------- /app/models/reserve_stock_positions_template.rb: -------------------------------------------------------------------------------- 1 | class ReserveStockPositionsTemplate < RailsWorkflow::OperationTemplate 2 | def resolve_dependency operation 3 | operation.data[:orderValid] 4 | end 5 | end -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ActiveRecord::Base 2 | # Include default devise modules. Others available are: 3 | # :confirmable, :lockable, :timeoutable and :omniauthable 4 | devise :database_authenticatable, :registerable, 5 | :recoverable, :rememberable, :trackable, :validatable 6 | 7 | # symbolize :role, in: [:admin, :customer, :sale, :stock] 8 | 9 | def self.get_role_values 10 | [["Admin", "admin"], ["Customers", "customer"], ["Sales Team", "sale"], ["Stock Provisioning", "stock"]] 11 | end 12 | include RailsWorkflow::User::Assignment 13 | 14 | end 15 | -------------------------------------------------------------------------------- /app/services/create_admin_service.rb: -------------------------------------------------------------------------------- 1 | class CreateAdminService 2 | def call 3 | user = User.find_or_create_by!(email: Rails.application.secrets.admin_email) do |user| 4 | user.password = Rails.application.secrets.admin_password 5 | user.password_confirmation = Rails.application.secrets.admin_password 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /app/views/devise/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %> 3 |

Change your password

4 | <%= devise_error_messages! %> 5 | <%= f.hidden_field :reset_password_token %> 6 |
7 | <%= f.label :password, 'New password' %> 8 | <%= f.password_field :password, autofocus: true, autocomplete: 'off', class: 'form-control' %> 9 | <%= f.label :password_confirmation, 'Confirm new password' %> 10 | <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'form-control' %> 11 |
12 | <%= f.submit 'Change my Password', :class => 'button right' %> 13 | <% end %> 14 |
15 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, :role => 'form'}) do |f| %> 3 |

Forgot your password?

4 |

We'll send password reset instructions.

5 | <%= devise_error_messages! %> 6 |
7 | <%= f.label :email %> 8 | <%= f.email_field :email, :autofocus => true, class: 'form-control' %> 9 |
10 | <%= f.submit 'Reset Password', :class => 'button right' %> 11 | <% end %> 12 |
13 | -------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Edit <%= resource_name.to_s.humanize %>

3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :role => 'form'}) do |f| %> 4 | <%= devise_error_messages! %> 5 |
6 | <%= f.label :name %> 7 | <%= f.text_field :name, :autofocus => true, class: 'form-control' %> 8 |
9 |
10 | <%= f.label :email %> 11 | <%= f.email_field :email, class: 'form-control' %> 12 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 13 |
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
14 | <% end %> 15 |
16 |
17 |

Leave these fields blank if you don't want to change your password.

18 |
19 | <%= f.label :password %> 20 | <%= f.password_field :password, :autocomplete => 'off', class: 'form-control' %> 21 |
22 |
23 | <%= f.label :password_confirmation %> 24 | <%= f.password_field :password_confirmation, class: 'form-control' %> 25 |
26 |
27 |
28 |

You must enter your current password to make changes.

29 |
30 | <%= f.label :current_password %> 31 | <%= f.password_field :current_password, class: 'form-control' %> 32 |
33 |
34 | <%= f.submit 'Update', :class => 'button right' %> 35 | <% end %> 36 |
37 |
38 |

Cancel Account

39 |

Unhappy? We'll be sad to see you go.

40 | <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete, :class => 'button right' %> 41 |
42 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :role => 'form'}) do |f| %> 3 |

Sign up

4 | <%= devise_error_messages! %> 5 |
6 | <%= f.label :name %> 7 | <%= f.text_field :name, :autofocus => true, class: 'form-control' %> 8 |
9 |
10 | <%= f.label :email %> 11 | <%= f.email_field :email, class: 'form-control' %> 12 |
13 |
14 | <%= f.label :password %> 15 | <%= f.password_field :password, class: 'form-control' %> 16 |
17 |
18 | <%= f.label :password_confirmation %> 19 | <%= f.password_field :password_confirmation, class: 'form-control' %> 20 |
21 | <%= f.submit 'Sign up', :class => 'button right' %> 22 | <% end %> 23 |
24 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :role => 'form'}) do |f| %> 3 |

Sign in

4 | <%= devise_error_messages! %> 5 |
6 | <%- if devise_mapping.registerable? %> 7 | <%= link_to 'Sign up', new_registration_path(resource_name), class: 'right' %> 8 | <% end -%> 9 | <%= f.label :email %> 10 | <%= f.email_field :email, :autofocus => true, class: 'form-control' %> 11 |
12 |
13 | <%- if devise_mapping.recoverable? %> 14 | <%= link_to "Forgot password?", new_password_path(resource_name), class: 'right' %> 15 | <% end -%> 16 | <%= f.label :password %> 17 | <%= f.password_field :password, class: 'form-control' %> 18 |
19 | <%= f.submit 'Sign in', :class => 'button right' %> 20 | <% if devise_mapping.rememberable? -%> 21 |
22 | 25 |
26 | <% end -%> 27 | <% end %> 28 |
29 | -------------------------------------------------------------------------------- /app/views/layouts/_messages.html.slim: -------------------------------------------------------------------------------- 1 | / Rails flash messages styled for Bootstrap 3.0 2 | - flash.each do |name, msg| 3 | - if msg.is_a?(String) 4 | div class="alert alert-#{name.to_s == 'notice' ? 'success' : 'danger'}" 5 | button.close[type="button" data-dismiss="alert" aria-hidden="true"] × 6 | = content_tag :div, msg, :id => "flash_#{name}" 7 | -------------------------------------------------------------------------------- /app/views/layouts/_navigation.html.slim: -------------------------------------------------------------------------------- 1 | / navigation styled for Bootstrap 3.0 2 | nav.navbar.navbar-inverse.navbar-fixed-top 3 | .container 4 | .navbar-header 5 | button.navbar-toggle[type="button" data-toggle="collapse" data-target=".navbar-collapse"] 6 | span.sr-only Toggle navigation 7 | span.icon-bar 8 | span.icon-bar 9 | span.icon-bar 10 | = link_to 'Home', root_path, class: 'navbar-brand' 11 | .collapse.navbar-collapse 12 | ul.nav.navbar-nav 13 | == render 'layouts/navigation_links' 14 | -------------------------------------------------------------------------------- /app/views/layouts/_navigation_links.html.erb: -------------------------------------------------------------------------------- 1 | <%# add navigation links to this file %> 2 | <% if user_signed_in? %> 3 |
  • <%= link_to 'Create New Order', new_order_path %>
  • 4 |
  • <%= link_to 'User Operations', tasks_path %>
  • 5 |
  • <%= link_to 'Edit account', edit_user_registration_path %>
  • 6 |
  • <%= link_to 'Sign out', destroy_user_session_path, :method=>'delete' %>
  • 7 | <% else %> 8 |
  • <%= link_to 'Sign in', new_user_session_path %>
  • 9 |
  • <%= link_to 'Sign up', new_user_registration_path %>
  • 10 | <% end %> 11 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.slim: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | meta[name="viewport" content="width=device-width, initial-scale=1.0"] 5 | title 6 | = content_for?(:title) ? yield(:title) : 'Rails Workflow Demo' 7 | meta name="description" content="#{content_for?(:description) ? yield(:description) : 'Rails Workflow Demo'}" 8 | == stylesheet_link_tag "application", :media => 'all', 'data-turbolinks-track' => true 9 | == javascript_include_tag 'application', 'data-turbolinks-track' => true 10 | == csrf_meta_tags 11 | body 12 | header 13 | == render 'layouts/navigation' 14 | main[role="main"] 15 | == render 'layouts/messages' 16 | == yield 17 | -------------------------------------------------------------------------------- /app/views/orders/_form.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for(@order) do |f| 2 | = f.error_notification 3 | 4 | .form-inputs 5 | = f.simple_fields_for :lines do |l| 6 | .row 7 | = l.input :id, as: :hidden 8 | = l.input :product_id, as: :hidden 9 | = l.input :qty, label: l.object.name 10 | 11 | 12 | .form-actions 13 | - if current_operation.present? 14 | .btn-group 15 | = f.submit value="Complete", class: "btn btn-success" 16 | - else 17 | .form-actions 18 | = f.button :submit -------------------------------------------------------------------------------- /app/views/orders/edit.html.slim: -------------------------------------------------------------------------------- 1 | .container 2 | - if current_operation.present? 3 | h1.page-header = current_operation.title 4 | p = current_operation.instruction 5 | - else 6 | h1.page-header Editing order 7 | 8 | == render 'form' 9 | 10 | = link_to 'Show', @order 11 | '| 12 | = link_to 'Back', orders_path 13 | 14 | -------------------------------------------------------------------------------- /app/views/orders/index.html.slim: -------------------------------------------------------------------------------- 1 | .container 2 | h1.page-header Listing orders 3 | 4 | 5 | table.table.table-striped 6 | thead 7 | tr 8 | th Order 9 | th Customer 10 | th 11 | th 12 | 13 | tbody 14 | - @orders.each do |order| 15 | tr 16 | td = "##{order.id}" 17 | td = order.customer.email 18 | td = link_to 'Show', order 19 | td = link_to 'Edit', edit_order_path(order) 20 | td = link_to 'Destroy', order, data: {:confirm => 'Are you sure?'}, :method => :delete 21 | 22 | br 23 | 24 | = link_to 'New Order', new_order_path, class: "btn btn-default" 25 | -------------------------------------------------------------------------------- /app/views/orders/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@orders) do |order| 2 | json.extract! order, :id, :customer_id 3 | json.url order_url(order, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/orders/new.html.slim: -------------------------------------------------------------------------------- 1 | .container 2 | h1.page-header New order 3 | 4 | == render 'form' 5 | 6 | = link_to 'Back', orders_path 7 | -------------------------------------------------------------------------------- /app/views/orders/show.html.slim: -------------------------------------------------------------------------------- 1 | .container 2 | 3 | p#notice = notice 4 | 5 | p 6 | strong Customer: 7 | = @order.customer.email 8 | 9 | - @order.lines.each do |line| 10 | p 11 | strong Name: 12 | = line.name 13 | p 14 | strong Quantity: 15 | = line.qty 16 | 17 | 18 | = link_to 'Edit', edit_order_path(@order) 19 | '| 20 | = link_to 'Back', orders_path 21 | -------------------------------------------------------------------------------- /app/views/orders/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! @order, :id, :customer_id, :created_at, :updated_at 2 | -------------------------------------------------------------------------------- /app/views/products/_form.html.slim: -------------------------------------------------------------------------------- 1 | = simple_form_for(@product) do |f| 2 | = f.error_notification 3 | 4 | .form-inputs 5 | = f.input :name 6 | /= f.input :active 7 | /= f.input :vendor_id 8 | = f.input :unit_price 9 | = f.input :stock_qty 10 | /= f.input :reserved_qty 11 | = f.input :min_qty 12 | 13 | .form-actions 14 | = f.button :submit 15 | -------------------------------------------------------------------------------- /app/views/products/edit.html.slim: -------------------------------------------------------------------------------- 1 | h1 Editing product 2 | 3 | == render 'form' 4 | 5 | = link_to 'Show', @product 6 | '| 7 | = link_to 'Back', products_path 8 | 9 | -------------------------------------------------------------------------------- /app/views/products/index.html.slim: -------------------------------------------------------------------------------- 1 | .container 2 | h1 Products 3 | 4 | table.table.table-striped 5 | thead 6 | tr 7 | th Name 8 | /th Active 9 | /th Vendor 10 | th Unit price 11 | th Stock qty 12 | th Reserved qty 13 | th Min qty 14 | th 15 | th 16 | th 17 | 18 | tbody 19 | - @products.each do |product| 20 | tr 21 | td = product.name 22 | /td = product.active 23 | /td = product.vendor_id 24 | td = product.unit_price 25 | td = product.stock_qty 26 | td = product.reserved_qty.to_i 27 | td = product.min_qty 28 | td = link_to 'Show', product 29 | td = link_to 'Edit', edit_product_path(product) 30 | td = link_to 'Destroy', product, data: {:confirm => 'Are you sure?'}, :method => :delete 31 | 32 | br 33 | 34 | = link_to 'New Product', new_product_path, class: "btn btn-default" 35 | -------------------------------------------------------------------------------- /app/views/products/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@products) do |product| 2 | json.extract! product, :id, :name, :active, :vendor_id, :unit_price, :stock_qty, :reserved_qty, :min_qty 3 | json.url product_url(product, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/products/new.html.slim: -------------------------------------------------------------------------------- 1 | h1 New product 2 | 3 | == render 'form' 4 | 5 | = link_to 'Back', products_path 6 | -------------------------------------------------------------------------------- /app/views/products/show.html.slim: -------------------------------------------------------------------------------- 1 | p#notice = notice 2 | 3 | p 4 | strong Name: 5 | = @product.name 6 | p 7 | strong Active: 8 | = @product.active 9 | p 10 | strong Vendor: 11 | = @product.vendor_id 12 | p 13 | strong Unit price: 14 | = @product.unit_price 15 | p 16 | strong Stock qty: 17 | = @product.stock_qty 18 | p 19 | strong Reserved qty: 20 | = @product.reserved_qty 21 | p 22 | strong Min qty: 23 | = @product.min_qty 24 | 25 | = link_to 'Edit', edit_product_path(@product) 26 | '| 27 | = link_to 'Back', products_path 28 | -------------------------------------------------------------------------------- /app/views/products/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! @product, :id, :name, :active, :vendor_id, :unit_price, :stock_qty, :reserved_qty, :min_qty, :created_at, :updated_at 2 | -------------------------------------------------------------------------------- /app/views/users/_user.html.erb: -------------------------------------------------------------------------------- 1 | <%= link_to user.name, user %> 2 | <%= link_to user.email, user %> 3 | -------------------------------------------------------------------------------- /app/views/users/index.html.erb: -------------------------------------------------------------------------------- 1 |
    2 |
    3 |

    Users

    4 |
    5 | 6 | 7 | <% @users.each do |user| %> 8 | 9 | <%= render user %> 10 | 11 | <% end %> 12 | 13 |
    14 |
    15 |
    16 |
    17 | -------------------------------------------------------------------------------- /app/views/users/show.html.erb: -------------------------------------------------------------------------------- 1 |

    User

    2 |

    Name: <%= @user.name if @user.name %>

    3 |

    Email: <%= @user.email if @user.email %>

    4 | -------------------------------------------------------------------------------- /app/views/users/tasks.html.slim: -------------------------------------------------------------------------------- 1 | 2 | h1 Tasks 3 | 4 | p 5 | | Current User: 6 | span<>= current_user.email 7 | span<>= "role: #{current_user.role}" 8 | 9 | .row 10 | .col-sm-6 11 | - if current_operation 12 | .panel 13 | .panel-heading 14 | h1.panel-title Current Operation 15 | 16 | .panel-body 17 | 18 | table.table.table-striped.table-hover 19 | thead 20 | tr 21 | th Title 22 | th Status 23 | th 24 | 25 | tbody 26 | tr 27 | td 28 | = current_operation.title 29 | td 30 | span.label<> class=(current_operation.status[:class]) 31 | = current_operation.status[:text] 32 | td 33 | .btn-group 34 | button.btn.btn-primary.dropdown-toggle aria-expanded="false" data-toggle="dropdown" type="button" 35 | | Complete 36 | span.caret< 37 | ul.dropdown-menu role="menu" 38 | li 39 | = link_to 'Complete', workflow.complete_operation_path(current_operation) 40 | li 41 | = link_to 'Skip', workflow.skip_operation_path(current_operation) 42 | li 43 | = link_to "Cancel", workflow.cancel_operation_path(current_operation) 44 | 45 | 46 | 47 | .panel 48 | .panel-heading 49 | h1.panel-title Operations, Assigned to user 50 | 51 | .panel-body 52 | table.table.table-striped.table-hover 53 | thead 54 | tr 55 | th Title 56 | th Status 57 | th 58 | 59 | tbody 60 | - assigned_operations.each do |operation| 61 | tr 62 | td = operation.title 63 | td 64 | span.label<> class=(operation.status[:class]) 65 | = operation.status[:text] 66 | td = button_to 'Start', workflow.pickup_operation_path(operation), class: "btn btn-primary btn-sm", method: :put 67 | 68 | .col-sm-6 69 | .panel 70 | .panel-heading 71 | h1.panel-title Available 72 | 73 | .panel-body 74 | 75 | table.table.table-striped.table-hover 76 | thead 77 | tr 78 | th Title 79 | th Status 80 | th 81 | 82 | tbody 83 | - available_operations.each do |operation| 84 | tr 85 | td = operation.title 86 | td 87 | span.label<> class=(operation.status[:class]) 88 | = operation.status[:text] 89 | td = button_to 'Start', workflow.pickup_operation_path(operation), class: "btn btn-primary btn-sm", method: :put -------------------------------------------------------------------------------- /app/views/visitors/index.html.erb: -------------------------------------------------------------------------------- 1 |

    Welcome

    2 |

    <%= link_to 'Users:', users_path %> <%= User.count %> registered

    3 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | APP_PATH = File.expand_path('../../config/application', __FILE__) 7 | require_relative '../config/boot' 8 | require 'rails/commands' 9 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path("../spring", __FILE__) 4 | rescue LoadError 5 | end 6 | require_relative '../config/boot' 7 | require 'rake' 8 | Rake.application.run 9 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast 4 | # It gets overwritten when you run the `spring binstub` command 5 | 6 | unless defined?(Spring) 7 | require "rubygems" 8 | require "bundler" 9 | 10 | if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) 11 | ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR) 12 | ENV["GEM_HOME"] = nil 13 | Gem.paths = ENV 14 | 15 | gem "spring", match[1] 16 | require "spring/binstub" 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module RailsWorkflowDemo 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | 15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 17 | # config.time_zone = 'Central Time (US & Canada)' 18 | 19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 21 | # config.i18n.default_locale = :de 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | 4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) 5 | -------------------------------------------------------------------------------- /config/database.yml.sample: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 8.2 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On Mac OS X with macports: 6 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 7 | # On Windows: 8 | # gem install pg 9 | # Choose the win32 build. 10 | # Install PostgreSQL and put its /bin directory on your path. 11 | # 12 | # Configure Using Gemfile 13 | # gem 'pg' 14 | # 15 | development: 16 | adapter: postgresql 17 | host: localhost 18 | encoding: unicode 19 | database: rails_workflow_demo_development 20 | pool: 5 21 | username: localhost 22 | password: localhost 23 | template: template0 24 | 25 | # Connect on a TCP socket. Omitted by default since the client uses a 26 | # domain socket that doesn't need configuration. Windows does not have 27 | # domain sockets, so uncomment these lines. 28 | #host: localhost 29 | #port: 5432 30 | 31 | # Schema search path. The server defaults to $user,public 32 | #schema_search_path: myapp,sharedapp,public 33 | 34 | # Minimum log levels, in increasing order: 35 | # debug5, debug4, debug3, debug2, debug1, 36 | # log, notice, warning, error, fatal, and panic 37 | # The server defaults to notice. 38 | #min_messages: warning 39 | 40 | # Warning: The database defined as "test" will be erased and 41 | # re-generated from your development database when you run "rake". 42 | # Do not set this db to the same as development or production. 43 | test: 44 | adapter: postgresql 45 | host: localhost 46 | encoding: unicode 47 | database: rails_workflow_demo_test 48 | pool: 5 49 | username: localhost 50 | password: localhost 51 | template: template0 52 | 53 | production: 54 | adapter: postgresql 55 | host: localhost 56 | encoding: unicode 57 | database: rails_workflow_demo_production 58 | pool: 5 59 | username: maxim 60 | password: localhost 61 | template: template0 62 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Adds additional error checking when serving assets at runtime. 31 | # Checks for improperly declared sprockets dependencies. 32 | # Raises helpful error messages. 33 | config.assets.raise_runtime_errors = true 34 | 35 | # Raises error for missing translations 36 | # config.action_view.raise_on_missing_translations = true 37 | end 38 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. 20 | # config.action_dispatch.rack_cache = true 21 | 22 | # Disable Rails's static asset server (Apache or nginx will already do this). 23 | config.serve_static_assets = false 24 | 25 | # Compress JavaScripts and CSS. 26 | config.assets.js_compressor = :uglifier 27 | # config.assets.css_compressor = :sass 28 | 29 | # Do not fallback to assets pipeline if a precompiled asset is missed. 30 | config.assets.compile = false 31 | 32 | # Generate digests for assets URLs. 33 | config.assets.digest = true 34 | 35 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 36 | 37 | # Specifies the header that your server uses for sending files. 38 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 39 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 40 | 41 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 42 | # config.force_ssl = true 43 | 44 | # Set to :debug to see everything in the log. 45 | config.log_level = :info 46 | 47 | # Prepend all log lines with the following tags. 48 | # config.log_tags = [ :subdomain, :uuid ] 49 | 50 | # Use a different logger for distributed setups. 51 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 52 | 53 | # Use a different cache store in production. 54 | # config.cache_store = :mem_cache_store 55 | 56 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 57 | # config.action_controller.asset_host = "http://assets.example.com" 58 | 59 | # Ignore bad email addresses and do not raise email delivery errors. 60 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 61 | # config.action_mailer.raise_delivery_errors = false 62 | 63 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 64 | # the I18n.default_locale when a translation cannot be found). 65 | config.i18n.fallbacks = true 66 | 67 | # Send deprecation notices to registered listeners. 68 | config.active_support.deprecation = :notify 69 | 70 | # Disable automatic flushing of the log to improve performance. 71 | # config.autoflush_log = false 72 | 73 | # Use default logging formatter so that PID and timestamp are not suppressed. 74 | config.log_formatter = ::Logger::Formatter.new 75 | 76 | # Do not dump schema after migrations. 77 | config.active_record.dump_schema_after_migration = false 78 | end 79 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static asset server for tests with Cache-Control for performance. 16 | config.serve_static_assets = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Print deprecation notices to the stderr. 35 | config.active_support.deprecation = :stderr 36 | 37 | # Raises error for missing translations 38 | # config.action_view.raise_on_missing_translations = true 39 | end 40 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Precompile additional assets. 7 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 8 | # Rails.application.config.assets.precompile += %w( search.js ) 9 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # Use this hook to configure devise mailer, warden hooks and so forth. 2 | # Many of these configuration options can be set straight in your model. 3 | Devise.setup do |config| 4 | # The secret key used by Devise. Devise uses this key to generate 5 | # random tokens. Changing this key will render invalid all existing 6 | # confirmation, reset password and unlock tokens in the database. 7 | config.secret_key = '7e02fec1d451543686aa89ab166438c02d891938e84ea4addf159d4e49ea39f08109d4770aabbbc06536b57829c550e9ae64268e053ed44c1b6c8bd3389c6b8c' 8 | 9 | # ==> Mailer Configuration 10 | # Configure the e-mail address which will be shown in Devise::Mailer, 11 | # note that it will be overwritten if you use your own mailer class 12 | # with default "from" parameter. 13 | config.mailer_sender = 'no-reply@' + Rails.application.secrets.domain_name 14 | 15 | # Configure the class responsible to send e-mails. 16 | # config.mailer = 'Devise::Mailer' 17 | 18 | # ==> ORM configuration 19 | # Load and configure the ORM. Supports :active_record (default) and 20 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 21 | # available as additional gems. 22 | require 'devise/orm/active_record' 23 | 24 | # ==> Configuration for any authentication mechanism 25 | # Configure which keys are used when authenticating a user. The default is 26 | # just :email. You can configure it to use [:username, :subdomain], so for 27 | # authenticating a user, both parameters are required. Remember that those 28 | # parameters are used only when authenticating and not when retrieving from 29 | # session. If you need permissions, you should implement that in a before filter. 30 | # You can also supply a hash where the value is a boolean determining whether 31 | # or not authentication should be aborted when the value is not present. 32 | # config.authentication_keys = [ :email ] 33 | 34 | # Configure parameters from the request object used for authentication. Each entry 35 | # given should be a request method and it will automatically be passed to the 36 | # find_for_authentication method and considered in your model lookup. For instance, 37 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 38 | # The same considerations mentioned for authentication_keys also apply to request_keys. 39 | # config.request_keys = [] 40 | 41 | # Configure which authentication keys should be case-insensitive. 42 | # These keys will be downcased upon creating or modifying a user and when used 43 | # to authenticate or find a user. Default is :email. 44 | config.case_insensitive_keys = [ :email ] 45 | 46 | # Configure which authentication keys should have whitespace stripped. 47 | # These keys will have whitespace before and after removed upon creating or 48 | # modifying a user and when used to authenticate or find a user. Default is :email. 49 | config.strip_whitespace_keys = [ :email ] 50 | 51 | # Tell if authentication through request.params is enabled. True by default. 52 | # It can be set to an array that will enable params authentication only for the 53 | # given strategies, for example, `config.params_authenticatable = [:database]` will 54 | # enable it only for database (email + password) authentication. 55 | # config.params_authenticatable = true 56 | 57 | # Tell if authentication through HTTP Auth is enabled. False by default. 58 | # It can be set to an array that will enable http authentication only for the 59 | # given strategies, for example, `config.http_authenticatable = [:database]` will 60 | # enable it only for database authentication. The supported strategies are: 61 | # :database = Support basic authentication with authentication key + password 62 | # config.http_authenticatable = false 63 | 64 | # If 401 status code should be returned for AJAX requests. True by default. 65 | # config.http_authenticatable_on_xhr = true 66 | 67 | # The realm used in Http Basic Authentication. 'Application' by default. 68 | # config.http_authentication_realm = 'Application' 69 | 70 | # It will change confirmation, password recovery and other workflows 71 | # to behave the same regardless if the e-mail provided was right or wrong. 72 | # Does not affect registerable. 73 | # config.paranoid = true 74 | 75 | # By default Devise will store the user in session. You can skip storage for 76 | # particular strategies by setting this option. 77 | # Notice that if you are skipping storage for all authentication paths, you 78 | # may want to disable generating routes to Devise's sessions controller by 79 | # passing skip: :sessions to `devise_for` in your config/routes.rb 80 | config.skip_session_storage = [:http_auth] 81 | 82 | # By default, Devise cleans up the CSRF token on authentication to 83 | # avoid CSRF token fixation attacks. This means that, when using AJAX 84 | # requests for sign in and sign up, you need to get a new CSRF token 85 | # from the server. You can disable this option at your own risk. 86 | # config.clean_up_csrf_token_on_authentication = true 87 | 88 | # ==> Configuration for :database_authenticatable 89 | # For bcrypt, this is the cost for hashing the password and defaults to 10. If 90 | # using other encryptors, it sets how many times you want the password re-encrypted. 91 | # 92 | # Limiting the stretches to just one in testing will increase the performance of 93 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 94 | # a value less than 10 in other environments. Note that, for bcrypt (the default 95 | # encryptor), the cost increases exponentially with the number of stretches (e.g. 96 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 97 | config.stretches = Rails.env.test? ? 1 : 10 98 | 99 | # Setup a pepper to generate the encrypted password. 100 | # config.pepper = 'ec667fdc0dee95ca5c54227c336228e77e4176e07a184223075e8c7520c625a228bf547b6bd374c37cb134e9fd2b2eda79fdce0bc41115dbc7464ebb7bd73356' 101 | 102 | # ==> Configuration for :confirmable 103 | # A period that the user is allowed to access the website even without 104 | # confirming their account. For instance, if set to 2.days, the user will be 105 | # able to access the website for two days without confirming their account, 106 | # access will be blocked just in the third day. Default is 0.days, meaning 107 | # the user cannot access the website without confirming their account. 108 | # config.allow_unconfirmed_access_for = 2.days 109 | 110 | # A period that the user is allowed to confirm their account before their 111 | # token becomes invalid. For example, if set to 3.days, the user can confirm 112 | # their account within 3 days after the mail was sent, but on the fourth day 113 | # their account can't be confirmed with the token any more. 114 | # Default is nil, meaning there is no restriction on how long a user can take 115 | # before confirming their account. 116 | # config.confirm_within = 3.days 117 | 118 | # If true, requires any email changes to be confirmed (exactly the same way as 119 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 120 | # db field (see migrations). Until confirmed, new email is stored in 121 | # unconfirmed_email column, and copied to email column on successful confirmation. 122 | config.reconfirmable = true 123 | 124 | # Defines which key will be used when confirming an account 125 | # config.confirmation_keys = [ :email ] 126 | 127 | # ==> Configuration for :rememberable 128 | # The time the user will be remembered without asking for credentials again. 129 | # config.remember_for = 2.weeks 130 | 131 | # Invalidates all the remember me tokens when the user signs out. 132 | config.expire_all_remember_me_on_sign_out = true 133 | 134 | # If true, extends the user's remember period when remembered via cookie. 135 | # config.extend_remember_period = false 136 | 137 | # Options to be passed to the created cookie. For instance, you can set 138 | # secure: true in order to force SSL only cookies. 139 | # config.rememberable_options = {} 140 | 141 | # ==> Configuration for :validatable 142 | # Range for password length. 143 | config.password_length = 8..128 144 | 145 | # Email regex used to validate email formats. It simply asserts that 146 | # one (and only one) @ exists in the given string. This is mainly 147 | # to give user feedback and not to assert the e-mail validity. 148 | # config.email_regexp = /\A[^@]+@[^@]+\z/ 149 | 150 | # ==> Configuration for :timeoutable 151 | # The time you want to timeout the user session without activity. After this 152 | # time the user will be asked for credentials again. Default is 30 minutes. 153 | # config.timeout_in = 30.minutes 154 | 155 | # If true, expires auth token on session timeout. 156 | # config.expire_auth_token_on_timeout = false 157 | 158 | # ==> Configuration for :lockable 159 | # Defines which strategy will be used to lock an account. 160 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 161 | # :none = No lock strategy. You should handle locking by yourself. 162 | # config.lock_strategy = :failed_attempts 163 | 164 | # Defines which key will be used when locking and unlocking an account 165 | # config.unlock_keys = [ :email ] 166 | 167 | # Defines which strategy will be used to unlock an account. 168 | # :email = Sends an unlock link to the user email 169 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 170 | # :both = Enables both strategies 171 | # :none = No unlock strategy. You should handle unlocking by yourself. 172 | # config.unlock_strategy = :both 173 | 174 | # Number of authentication tries before locking an account if lock_strategy 175 | # is failed attempts. 176 | # config.maximum_attempts = 20 177 | 178 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 179 | # config.unlock_in = 1.hour 180 | 181 | # Warn on the last attempt before the account is locked. 182 | # config.last_attempt_warning = true 183 | 184 | # ==> Configuration for :recoverable 185 | # 186 | # Defines which key will be used when recovering the password for an account 187 | # config.reset_password_keys = [ :email ] 188 | 189 | # Time interval you can reset your password with a reset password key. 190 | # Don't put a too small interval or your users won't have the time to 191 | # change their passwords. 192 | config.reset_password_within = 6.hours 193 | 194 | # ==> Configuration for :encryptable 195 | # Allow you to use another encryption algorithm besides bcrypt (default). You can use 196 | # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, 197 | # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) 198 | # and :restful_authentication_sha1 (then you should set stretches to 10, and copy 199 | # REST_AUTH_SITE_KEY to pepper). 200 | # 201 | # Require the `devise-encryptable` gem when using anything other than bcrypt 202 | # config.encryptor = :sha512 203 | 204 | # ==> Scopes configuration 205 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 206 | # "users/sessions/new". It's turned off by default because it's slower if you 207 | # are using only default views. 208 | # config.scoped_views = false 209 | 210 | # Configure the default scope given to Warden. By default it's the first 211 | # devise role declared in your routes (usually :user). 212 | # config.default_scope = :user 213 | 214 | # Set this configuration to false if you want /users/sign_out to sign out 215 | # only the current scope. By default, Devise signs out all scopes. 216 | # config.sign_out_all_scopes = true 217 | 218 | # ==> Navigation configuration 219 | # Lists the formats that should be treated as navigational. Formats like 220 | # :html, should redirect to the sign in page when the user does not have 221 | # access, but formats like :xml or :json, should return 401. 222 | # 223 | # If you have any extra navigational formats, like :iphone or :mobile, you 224 | # should add them to the navigational formats lists. 225 | # 226 | # The "*/*" below is required to match Internet Explorer requests. 227 | # config.navigational_formats = ['*/*', :html] 228 | 229 | # The default HTTP method used to sign out a resource. Default is :delete. 230 | config.sign_out_via = :delete 231 | 232 | # ==> OmniAuth 233 | # Add a new OmniAuth provider. Check the wiki for more information on setting 234 | # up on your models and hooks. 235 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 236 | 237 | # ==> Warden configuration 238 | # If you want to use other strategies, that are not supported by Devise, or 239 | # change the failure app, you can configure them inside the config.warden block. 240 | # 241 | # config.warden do |manager| 242 | # manager.intercept_401 = false 243 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 244 | # end 245 | 246 | # ==> Mountable engine configurations 247 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 248 | # is mountable, there are some extra configurations to be taken into account. 249 | # The following options are available, assuming the engine is mounted as: 250 | # 251 | # mount MyEngine, at: '/my_engine' 252 | # 253 | # The router that invoked `devise_for`, in the example above, would be: 254 | # config.router_name = :my_engine 255 | # 256 | # When using omniauth, Devise cannot automatically set Omniauth path, 257 | # so you need to do it manually. For the users scope, it would be: 258 | # config.omniauth_path_prefix = '/my_engine/users/auth' 259 | end 260 | -------------------------------------------------------------------------------- /config/initializers/devise_permitted_parameters.rb: -------------------------------------------------------------------------------- 1 | module DevisePermittedParameters 2 | extend ActiveSupport::Concern 3 | 4 | included do 5 | before_filter :configure_permitted_parameters 6 | end 7 | 8 | protected 9 | 10 | def configure_permitted_parameters 11 | devise_parameter_sanitizer.for(:sign_up) << :name 12 | devise_parameter_sanitizer.for(:account_update) << :name 13 | end 14 | 15 | end 16 | 17 | DeviseController.send :include, DevisePermittedParameters 18 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password, :password_confirmation] 5 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_rails_workflow_demo_session' 4 | -------------------------------------------------------------------------------- /config/initializers/simple_form.rb: -------------------------------------------------------------------------------- 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 | config.wrappers :default, class: :input, 9 | hint_class: :field_with_hint, error_class: :field_with_errors do |b| 10 | ## Extensions enabled by default 11 | # Any of these extensions can be disabled for a 12 | # given input by passing: `f.input EXTENSION_NAME => false`. 13 | # You can make any of these extensions optional by 14 | # renaming `b.use` to `b.optional`. 15 | 16 | # Determines whether to use HTML5 (:email, :url, ...) 17 | # and required attributes 18 | b.use :html5 19 | 20 | # Calculates placeholders automatically from I18n 21 | # You can also pass a string as f.input placeholder: "Placeholder" 22 | b.use :placeholder 23 | 24 | ## Optional extensions 25 | # They are disabled unless you pass `f.input EXTENSION_NAME => true` 26 | # to the input. If so, they will retrieve the values from the model 27 | # if any exists. If you want to enable any of those 28 | # extensions by default, you can change `b.optional` to `b.use`. 29 | 30 | # Calculates maxlength from length validations for string inputs 31 | b.optional :maxlength 32 | 33 | # Calculates pattern from format validations for string inputs 34 | b.optional :pattern 35 | 36 | # Calculates min and max from length validations for numeric inputs 37 | b.optional :min_max 38 | 39 | # Calculates readonly automatically from readonly attributes 40 | b.optional :readonly 41 | 42 | ## Inputs 43 | b.use :label_input 44 | b.use :hint, wrap_with: { tag: :span, class: :hint } 45 | b.use :error, wrap_with: { tag: :span, class: :error } 46 | 47 | ## full_messages_for 48 | # If you want to display the full error message for the attribute, you can 49 | # use the component :full_error, like: 50 | # 51 | # b.use :full_error, wrap_with: { tag: :span, class: :error } 52 | end 53 | 54 | # The default wrapper to be used by the FormBuilder. 55 | config.default_wrapper = :default 56 | 57 | # Define the way to render check boxes / radio buttons with labels. 58 | # Defaults to :nested for bootstrap config. 59 | # inline: input + label 60 | # nested: label > input 61 | config.boolean_style = :nested 62 | 63 | # Default class for buttons 64 | config.button_class = 'btn' 65 | 66 | # Method used to tidy up errors. Specify any Rails Array method. 67 | # :first lists the first message for each field. 68 | # Use :to_sentence to list all errors for each field. 69 | # config.error_method = :first 70 | 71 | # Default tag used for error notification helper. 72 | config.error_notification_tag = :div 73 | 74 | # CSS class to add for error notification helper. 75 | config.error_notification_class = 'error_notification' 76 | 77 | # ID to add for error notification helper. 78 | # config.error_notification_id = nil 79 | 80 | # Series of attempts to detect a default label method for collection. 81 | # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] 82 | 83 | # Series of attempts to detect a default value method for collection. 84 | # config.collection_value_methods = [ :id, :to_s ] 85 | 86 | # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. 87 | # config.collection_wrapper_tag = nil 88 | 89 | # You can define the class to use on all collection wrappers. Defaulting to none. 90 | # config.collection_wrapper_class = nil 91 | 92 | # You can wrap each item in a collection of radio/check boxes with a tag, 93 | # defaulting to :span. Please note that when using :boolean_style = :nested, 94 | # SimpleForm will force this option to be a label. 95 | # config.item_wrapper_tag = :span 96 | 97 | # You can define a class to use in all item wrappers. Defaulting to none. 98 | # config.item_wrapper_class = nil 99 | 100 | # How the label text should be generated altogether with the required text. 101 | # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } 102 | 103 | # You can define the class to use on all labels. Default is nil. 104 | # config.label_class = nil 105 | 106 | # You can define the default class to be used on forms. Can be overriden 107 | # with `html: { :class }`. Defaulting to none. 108 | # config.default_form_class = nil 109 | 110 | # You can define which elements should obtain additional classes 111 | # config.generate_additional_classes_for = [:wrapper, :label, :input] 112 | 113 | # Whether attributes are required by default (or not). Default is true. 114 | # config.required_by_default = true 115 | 116 | # Tell browsers whether to use the native HTML5 validations (novalidate form option). 117 | # These validations are enabled in SimpleForm's internal config but disabled by default 118 | # in this configuration, which is recommended due to some quirks from different browsers. 119 | # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, 120 | # change this configuration to true. 121 | config.browser_validations = false 122 | 123 | # Collection of methods to detect if a file type was given. 124 | # config.file_methods = [ :mounted_as, :file?, :public_filename ] 125 | 126 | # Custom mappings for input types. This should be a hash containing a regexp 127 | # to match as key, and the input type that will be used when the field name 128 | # matches the regexp as value. 129 | # config.input_mappings = { /count/ => :integer } 130 | 131 | # Custom wrappers for input types. This should be a hash containing an input 132 | # type as key and the wrapper that will be used for all inputs with specified type. 133 | # config.wrapper_mappings = { string: :prepend } 134 | 135 | # Namespaces where SimpleForm should look for custom input classes that 136 | # override default inputs. 137 | # config.custom_inputs_namespaces << "CustomInputs" 138 | 139 | # Default priority for time_zone inputs. 140 | # config.time_zone_priority = nil 141 | 142 | # Default priority for country inputs. 143 | # config.country_priority = nil 144 | 145 | # When false, do not use translations for labels. 146 | # config.translate_labels = true 147 | 148 | # Automatically discover new inputs in Rails' autoload path. 149 | # config.inputs_discovery = true 150 | 151 | # Cache SimpleForm inputs discovery 152 | # config.cache_discovery = !Rails.env.development? 153 | 154 | # Default class for inputs 155 | # config.input_class = nil 156 | 157 | # Define the default class of the input wrapper of the boolean input. 158 | config.boolean_label_class = 'checkbox' 159 | 160 | # Defines if the default input wrapper class should be included in radio 161 | # collection wrappers. 162 | # config.include_default_input_wrapper_class = true 163 | 164 | # Defines which i18n scope will be used in Simple Form. 165 | # config.i18n_scope = 'simple_form' 166 | end 167 | -------------------------------------------------------------------------------- /config/initializers/simple_form_bootstrap.rb: -------------------------------------------------------------------------------- 1 | # Use this setup block to configure all options available in SimpleForm. 2 | SimpleForm.setup do |config| 3 | config.error_notification_class = 'alert alert-danger' 4 | config.button_class = 'btn btn-default' 5 | config.boolean_label_class = nil 6 | 7 | config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 8 | b.use :html5 9 | b.use :placeholder 10 | b.optional :maxlength 11 | b.optional :pattern 12 | b.optional :min_max 13 | b.optional :readonly 14 | b.use :label, class: 'control-label' 15 | 16 | b.use :input, class: 'form-control' 17 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 18 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 19 | end 20 | 21 | config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 22 | b.use :html5 23 | b.use :placeholder 24 | b.optional :maxlength 25 | b.optional :readonly 26 | b.use :label, class: 'control-label' 27 | 28 | b.use :input 29 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 30 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 31 | end 32 | 33 | config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 34 | b.use :html5 35 | b.optional :readonly 36 | 37 | b.wrapper tag: 'div', class: 'checkbox' do |ba| 38 | ba.use :label_input 39 | end 40 | 41 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 42 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 43 | end 44 | 45 | config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 46 | b.use :html5 47 | b.optional :readonly 48 | b.use :label, class: 'control-label' 49 | b.use :input 50 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 51 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 52 | end 53 | 54 | config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 55 | b.use :html5 56 | b.use :placeholder 57 | b.optional :maxlength 58 | b.optional :pattern 59 | b.optional :min_max 60 | b.optional :readonly 61 | b.use :label, class: 'col-sm-3 control-label' 62 | 63 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 64 | ba.use :input, class: 'form-control' 65 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 66 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 67 | end 68 | end 69 | 70 | config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 71 | b.use :html5 72 | b.use :placeholder 73 | b.optional :maxlength 74 | b.optional :readonly 75 | b.use :label, class: 'col-sm-3 control-label' 76 | 77 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 78 | ba.use :input 79 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 80 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 81 | end 82 | end 83 | 84 | config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 85 | b.use :html5 86 | b.optional :readonly 87 | 88 | b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr| 89 | wr.wrapper tag: 'div', class: 'checkbox' do |ba| 90 | ba.use :label_input, class: 'col-sm-9' 91 | end 92 | 93 | wr.use :error, wrap_with: { tag: 'span', class: 'help-block' } 94 | wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 95 | end 96 | end 97 | 98 | config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 99 | b.use :html5 100 | b.optional :readonly 101 | 102 | b.use :label, class: 'col-sm-3 control-label' 103 | 104 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 105 | ba.use :input 106 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 107 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 108 | end 109 | end 110 | 111 | config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 112 | b.use :html5 113 | b.use :placeholder 114 | b.optional :maxlength 115 | b.optional :pattern 116 | b.optional :min_max 117 | b.optional :readonly 118 | b.use :label, class: 'sr-only' 119 | 120 | b.use :input, class: 'form-control' 121 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 122 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 123 | end 124 | 125 | # Wrappers for forms and inputs using the Bootstrap toolkit. 126 | # Check the Bootstrap docs (http://getbootstrap.com) 127 | # to learn about the different styles for forms and inputs, 128 | # buttons and other elements. 129 | config.default_wrapper = :vertical_form 130 | config.wrapper_mappings = { 131 | check_boxes: :vertical_radio_and_checkboxes, 132 | radio_buttons: :vertical_radio_and_checkboxes, 133 | file: :vertical_file_input, 134 | boolean: :vertical_boolean, 135 | } 136 | end 137 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your email address has been successfully confirmed." 7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." 8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid %{authentication_keys} or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account is locked." 15 | not_found_in_database: "Invalid %{authentication_keys} or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your email address before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock instructions" 26 | omniauth_callbacks: 27 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 28 | success: "Successfully authenticated from %{kind} account." 29 | passwords: 30 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." 31 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 32 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." 33 | updated: "Your password has been changed successfully. You are now signed in." 34 | updated_not_active: "Your password has been changed successfully." 35 | registrations: 36 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." 37 | signed_up: "Welcome! You have signed up successfully." 38 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 39 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 40 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." 41 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." 42 | updated: "Your account has been updated successfully." 43 | sessions: 44 | signed_in: "Signed in successfully." 45 | signed_out: "Signed out successfully." 46 | already_signed_out: "Signed out successfully." 47 | unlocks: 48 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." 49 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." 50 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 51 | errors: 52 | messages: 53 | already_confirmed: "was already confirmed, please try signing in" 54 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 55 | expired: "has expired, please request a new one" 56 | not_found: "not found" 57 | not_locked: "was not locked" 58 | not_saved: 59 | one: "1 error prohibited this %{resource} from being saved:" 60 | other: "%{count} errors prohibited this %{resource} from being saved:" 61 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | activerecord: 25 | symbolizes: 26 | user: 27 | role: 28 | admin: Admin 29 | customer: Customer 30 | sale: Sales Team 31 | stock: Stock Team 32 | -------------------------------------------------------------------------------- /config/locales/simple_form.en.yml: -------------------------------------------------------------------------------- 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: '*' 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' 32 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | resources :orders do 3 | resources :order_lines 4 | end 5 | 6 | resources :products 7 | 8 | root to: 'visitors#index' 9 | devise_for :users 10 | resources :users 11 | 12 | get "/tasks", to: "users#tasks" 13 | 14 | mount RailsWorkflow::Engine => '/workflow', as: 'workflow' 15 | end 16 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | admin_name: First User 15 | admin_email: user@example.com 16 | admin_password: changeme 17 | domain_name: example.com 18 | secret_key_base: b737c289b10e3b2fb85d95c37866025582877995e259445170fb5a2fbf1c603d84ee1107caab6ce8ea62ae0cfce980e97741f50a56441025960dd8f9477520bb 19 | 20 | test: 21 | domain_name: example.com 22 | secret_key_base: 3338c590723517393c5b0c2f7c85e0c787b9e2031316d86cd8acce60eaa55e6c0dd8f635128cc7ad64ba92fccaf9b9d881676d12b006438ab5f08b88912e2a47 23 | 24 | # Do not keep production secrets in the repository, 25 | # instead read values from the environment. 26 | production: 27 | admin_name: <%= ENV["ADMIN_NAME"] %> 28 | admin_email: <%= ENV["ADMIN_EMAIL"] %> 29 | admin_password: <%= ENV["ADMIN_PASSWORD"] %> 30 | domain_name: 'test.com' 31 | secret_key_base: b737c289b10e3b2fb85d95c37866025582877995e259445170fb5a2fbf1c603d84ee1107caab6ce8ea62ae0cfce980e97741f50a56441025960dd8f9477520bb 32 | -------------------------------------------------------------------------------- /config/wf/processing_order.json: -------------------------------------------------------------------------------- 1 | {"process_template":{"uuid":null,"title":"Processing Order","source":null,"manager_class":"","process_class":"","type":"","partial_name":null,"version":null,"tag":null,"child_processes":[],"operations":[{"uuid":null,"title":"Order Validation","source":null,"dependencies":[],"operation_class":"OrderValidation","async":false,"assignment_id":null,"assignment_type":null,"kind":"default","role":null,"group":null,"instruction":null,"is_background":true,"type":"","partial_name":null,"version":null,"tag":null,"child_process":null},{"uuid":null,"title":"Correct Invalid Order Information","source":null,"dependencies":[{"statuses":[2],"uuid":null}],"operation_class":"ProcessInvalidOrder","async":false,"assignment_id":null,"assignment_type":null,"kind":"user_role","role":"sale","group":null,"instruction":"","is_background":true,"type":"ProcessInvalidOrderTemplate","partial_name":null,"version":null,"tag":null,"child_process":null},{"uuid":null,"title":"Reserve Stock Positions","source":null,"dependencies":[{"statuses":[2],"uuid":null},{"statuses":[2],"uuid":null}],"operation_class":"ReserveStockPositions","async":false,"assignment_id":null,"assignment_type":null,"kind":"default","role":null,"group":null,"instruction":null,"is_background":true,"type":"ReserveStockPositionsTemplate","partial_name":null,"version":null,"tag":null,"child_process":null}]}} -------------------------------------------------------------------------------- /db/dump.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- PostgreSQL database dump 3 | -- 4 | 5 | SET statement_timeout = 0; 6 | SET lock_timeout = 0; 7 | SET client_encoding = 'UTF8'; 8 | SET standard_conforming_strings = on; 9 | SET check_function_bodies = false; 10 | SET client_min_messages = warning; 11 | 12 | -- 13 | -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: 14 | -- 15 | 16 | CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; 17 | 18 | 19 | -- 20 | -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: 21 | -- 22 | 23 | COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; 24 | 25 | 26 | SET search_path = public, pg_catalog; 27 | 28 | SET default_tablespace = ''; 29 | 30 | SET default_with_oids = false; 31 | 32 | -- 33 | -- Name: order_lines; Type: TABLE; Schema: public; Owner: maxim; Tablespace: 34 | -- 35 | 36 | CREATE TABLE order_lines ( 37 | id integer NOT NULL, 38 | order_id integer, 39 | product_id integer, 40 | qty integer, 41 | created_at timestamp without time zone, 42 | updated_at timestamp without time zone 43 | ); 44 | 45 | 46 | ALTER TABLE public.order_lines OWNER TO localhost; 47 | 48 | -- 49 | -- Name: order_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: localhost 50 | -- 51 | 52 | CREATE SEQUENCE order_lines_id_seq 53 | START WITH 1 54 | INCREMENT BY 1 55 | NO MINVALUE 56 | NO MAXVALUE 57 | CACHE 1; 58 | 59 | 60 | ALTER TABLE public.order_lines_id_seq OWNER TO localhost; 61 | 62 | -- 63 | -- Name: order_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: localhost 64 | -- 65 | 66 | ALTER SEQUENCE order_lines_id_seq OWNED BY order_lines.id; 67 | 68 | 69 | -- 70 | -- Name: orders; Type: TABLE; Schema: public; Owner: localhost; Tablespace: 71 | -- 72 | 73 | CREATE TABLE orders ( 74 | id integer NOT NULL, 75 | customer_id integer, 76 | created_at timestamp without time zone, 77 | updated_at timestamp without time zone 78 | ); 79 | 80 | 81 | ALTER TABLE public.orders OWNER TO localhost; 82 | 83 | -- 84 | -- Name: orders_id_seq; Type: SEQUENCE; Schema: public; Owner: localhost 85 | -- 86 | 87 | CREATE SEQUENCE orders_id_seq 88 | START WITH 1 89 | INCREMENT BY 1 90 | NO MINVALUE 91 | NO MAXVALUE 92 | CACHE 1; 93 | 94 | 95 | ALTER TABLE public.orders_id_seq OWNER TO localhost; 96 | 97 | -- 98 | -- Name: orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: localhost 99 | -- 100 | 101 | ALTER SEQUENCE orders_id_seq OWNED BY orders.id; 102 | 103 | 104 | -- 105 | -- Name: products; Type: TABLE; Schema: public; Owner: localhost; Tablespace: 106 | -- 107 | 108 | CREATE TABLE products ( 109 | id integer NOT NULL, 110 | name character varying(255), 111 | active boolean, 112 | vendor_id integer, 113 | unit_price double precision, 114 | stock_qty integer, 115 | reserved_qty integer, 116 | min_qty integer, 117 | created_at timestamp without time zone, 118 | updated_at timestamp without time zone 119 | ); 120 | 121 | 122 | ALTER TABLE public.products OWNER TO localhost; 123 | 124 | -- 125 | -- Name: products_id_seq; Type: SEQUENCE; Schema: public; Owner: localhost 126 | -- 127 | 128 | CREATE SEQUENCE products_id_seq 129 | START WITH 1 130 | INCREMENT BY 1 131 | NO MINVALUE 132 | NO MAXVALUE 133 | CACHE 1; 134 | 135 | 136 | ALTER TABLE public.products_id_seq OWNER TO localhost; 137 | 138 | -- 139 | -- Name: products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: localhost 140 | -- 141 | 142 | ALTER SEQUENCE products_id_seq OWNED BY products.id; 143 | 144 | 145 | -- 146 | -- Name: rails_workflow_contexts; Type: TABLE; Schema: public; Owner: localhost; Tablespace: 147 | -- 148 | 149 | CREATE TABLE rails_workflow_contexts ( 150 | id integer NOT NULL, 151 | parent_id integer, 152 | parent_type character varying(255), 153 | body json, 154 | created_at timestamp without time zone, 155 | updated_at timestamp without time zone 156 | ); 157 | 158 | 159 | ALTER TABLE public.rails_workflow_contexts OWNER TO localhost; 160 | 161 | -- 162 | -- Name: rails_workflow_contexts_id_seq; Type: SEQUENCE; Schema: public; Owner: localhost 163 | -- 164 | 165 | CREATE SEQUENCE rails_workflow_contexts_id_seq 166 | START WITH 1 167 | INCREMENT BY 1 168 | NO MINVALUE 169 | NO MAXVALUE 170 | CACHE 1; 171 | 172 | 173 | ALTER TABLE public.rails_workflow_contexts_id_seq OWNER TO localhost; 174 | 175 | -- 176 | -- Name: rails_workflow_contexts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: localhost 177 | -- 178 | 179 | ALTER SEQUENCE rails_workflow_contexts_id_seq OWNED BY rails_workflow_contexts.id; 180 | 181 | 182 | -- 183 | -- Name: rails_workflow_errors; Type: TABLE; Schema: public; Owner: localhost; Tablespace: 184 | -- 185 | 186 | CREATE TABLE rails_workflow_errors ( 187 | id integer NOT NULL, 188 | message character varying(255), 189 | stack_trace text, 190 | parent_id integer, 191 | parent_type character varying(255), 192 | created_at timestamp without time zone, 193 | updated_at timestamp without time zone, 194 | resolved boolean 195 | ); 196 | 197 | 198 | ALTER TABLE public.rails_workflow_errors OWNER TO localhost; 199 | 200 | -- 201 | -- Name: rails_workflow_errors_id_seq; Type: SEQUENCE; Schema: public; Owner: localhost 202 | -- 203 | 204 | CREATE SEQUENCE rails_workflow_errors_id_seq 205 | START WITH 1 206 | INCREMENT BY 1 207 | NO MINVALUE 208 | NO MAXVALUE 209 | CACHE 1; 210 | 211 | 212 | ALTER TABLE public.rails_workflow_errors_id_seq OWNER TO localhost; 213 | 214 | -- 215 | -- Name: rails_workflow_errors_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: localhost 216 | -- 217 | 218 | ALTER SEQUENCE rails_workflow_errors_id_seq OWNED BY rails_workflow_errors.id; 219 | 220 | 221 | -- 222 | -- Name: rails_workflow_operation_templates; Type: TABLE; Schema: public; Owner: localhost; Tablespace: 223 | -- 224 | 225 | CREATE TABLE rails_workflow_operation_templates ( 226 | id integer NOT NULL, 227 | title character varying(255), 228 | source text, 229 | dependencies text, 230 | operation_class character varying(255), 231 | process_template_id integer, 232 | created_at timestamp without time zone, 233 | updated_at timestamp without time zone, 234 | async boolean, 235 | child_process_id integer, 236 | assignment_id integer, 237 | assignment_type character varying(255), 238 | kind character varying(255), 239 | role character varying(255), 240 | "group" character varying(255), 241 | instruction text, 242 | is_background boolean DEFAULT true, 243 | type character varying(255) 244 | ); 245 | 246 | 247 | ALTER TABLE public.rails_workflow_operation_templates OWNER TO localhost; 248 | 249 | -- 250 | -- Name: rails_workflow_operation_templates_id_seq; Type: SEQUENCE; Schema: public; Owner: localhost 251 | -- 252 | 253 | CREATE SEQUENCE rails_workflow_operation_templates_id_seq 254 | START WITH 1 255 | INCREMENT BY 1 256 | NO MINVALUE 257 | NO MAXVALUE 258 | CACHE 1; 259 | 260 | 261 | ALTER TABLE public.rails_workflow_operation_templates_id_seq OWNER TO localhost; 262 | 263 | -- 264 | -- Name: rails_workflow_operation_templates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: localhost 265 | -- 266 | 267 | ALTER SEQUENCE rails_workflow_operation_templates_id_seq OWNED BY rails_workflow_operation_templates.id; 268 | 269 | 270 | -- 271 | -- Name: rails_workflow_operations; Type: TABLE; Schema: public; Owner: localhost; Tablespace: 272 | -- 273 | 274 | CREATE TABLE rails_workflow_operations ( 275 | id integer NOT NULL, 276 | status integer, 277 | async boolean, 278 | title character varying(255), 279 | created_at timestamp without time zone, 280 | updated_at timestamp without time zone, 281 | process_id integer, 282 | template_id integer, 283 | dependencies text, 284 | child_process_id integer, 285 | assignment_id integer, 286 | assignment_type character varying(255), 287 | assigned_at timestamp without time zone, 288 | type character varying(255), 289 | is_active boolean, 290 | completed_at timestamp without time zone, 291 | is_background boolean 292 | ); 293 | 294 | 295 | ALTER TABLE public.rails_workflow_operations OWNER TO localhost; 296 | 297 | -- 298 | -- Name: rails_workflow_operations_id_seq; Type: SEQUENCE; Schema: public; Owner: localhost 299 | -- 300 | 301 | CREATE SEQUENCE rails_workflow_operations_id_seq 302 | START WITH 1 303 | INCREMENT BY 1 304 | NO MINVALUE 305 | NO MAXVALUE 306 | CACHE 1; 307 | 308 | 309 | ALTER TABLE public.rails_workflow_operations_id_seq OWNER TO localhost; 310 | 311 | -- 312 | -- Name: rails_workflow_operations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: localhost 313 | -- 314 | 315 | ALTER SEQUENCE rails_workflow_operations_id_seq OWNED BY rails_workflow_operations.id; 316 | 317 | 318 | -- 319 | -- Name: rails_workflow_process_templates; Type: TABLE; Schema: public; Owner: localhost; Tablespace: 320 | -- 321 | 322 | CREATE TABLE rails_workflow_process_templates ( 323 | id integer NOT NULL, 324 | title character varying(255), 325 | source text, 326 | manager_class character varying(255), 327 | process_class character varying(255), 328 | created_at timestamp without time zone, 329 | updated_at timestamp without time zone, 330 | type character varying(255) 331 | ); 332 | 333 | 334 | ALTER TABLE public.rails_workflow_process_templates OWNER TO localhost; 335 | 336 | -- 337 | -- Name: rails_workflow_process_templates_id_seq; Type: SEQUENCE; Schema: public; Owner: localhost 338 | -- 339 | 340 | CREATE SEQUENCE rails_workflow_process_templates_id_seq 341 | START WITH 1 342 | INCREMENT BY 1 343 | NO MINVALUE 344 | NO MAXVALUE 345 | CACHE 1; 346 | 347 | 348 | ALTER TABLE public.rails_workflow_process_templates_id_seq OWNER TO localhost; 349 | 350 | -- 351 | -- Name: rails_workflow_process_templates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: localhost 352 | -- 353 | 354 | ALTER SEQUENCE rails_workflow_process_templates_id_seq OWNED BY rails_workflow_process_templates.id; 355 | 356 | 357 | -- 358 | -- Name: rails_workflow_processes; Type: TABLE; Schema: public; Owner: localhost; Tablespace: 359 | -- 360 | 361 | CREATE TABLE rails_workflow_processes ( 362 | id integer NOT NULL, 363 | status integer, 364 | async boolean, 365 | title character varying(255), 366 | created_at timestamp without time zone, 367 | updated_at timestamp without time zone, 368 | template_id integer, 369 | type character varying(255) 370 | ); 371 | 372 | 373 | ALTER TABLE public.rails_workflow_processes OWNER TO localhost; 374 | 375 | -- 376 | -- Name: rails_workflow_processes_id_seq; Type: SEQUENCE; Schema: public; Owner: localhost 377 | -- 378 | 379 | CREATE SEQUENCE rails_workflow_processes_id_seq 380 | START WITH 1 381 | INCREMENT BY 1 382 | NO MINVALUE 383 | NO MAXVALUE 384 | CACHE 1; 385 | 386 | 387 | ALTER TABLE public.rails_workflow_processes_id_seq OWNER TO localhost; 388 | 389 | -- 390 | -- Name: rails_workflow_processes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: localhost 391 | -- 392 | 393 | ALTER SEQUENCE rails_workflow_processes_id_seq OWNED BY rails_workflow_processes.id; 394 | 395 | 396 | -- 397 | -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: localhost; Tablespace: 398 | -- 399 | 400 | CREATE TABLE schema_migrations ( 401 | version character varying(255) NOT NULL 402 | ); 403 | 404 | 405 | ALTER TABLE public.schema_migrations OWNER TO localhost; 406 | 407 | -- 408 | -- Name: users; Type: TABLE; Schema: public; Owner: localhost; Tablespace: 409 | -- 410 | 411 | CREATE TABLE users ( 412 | id integer NOT NULL, 413 | email character varying(255) DEFAULT ''::character varying NOT NULL, 414 | encrypted_password character varying(255) DEFAULT ''::character varying NOT NULL, 415 | reset_password_token character varying(255), 416 | reset_password_sent_at timestamp without time zone, 417 | remember_created_at timestamp without time zone, 418 | sign_in_count integer DEFAULT 0 NOT NULL, 419 | current_sign_in_at timestamp without time zone, 420 | last_sign_in_at timestamp without time zone, 421 | current_sign_in_ip inet, 422 | last_sign_in_ip inet, 423 | created_at timestamp without time zone, 424 | updated_at timestamp without time zone, 425 | name character varying(255), 426 | role character varying(255) 427 | ); 428 | 429 | 430 | ALTER TABLE public.users OWNER TO localhost; 431 | 432 | -- 433 | -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: localhost 434 | -- 435 | 436 | CREATE SEQUENCE users_id_seq 437 | START WITH 1 438 | INCREMENT BY 1 439 | NO MINVALUE 440 | NO MAXVALUE 441 | CACHE 1; 442 | 443 | 444 | ALTER TABLE public.users_id_seq OWNER TO localhost; 445 | 446 | -- 447 | -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: localhost 448 | -- 449 | 450 | ALTER SEQUENCE users_id_seq OWNED BY users.id; 451 | 452 | 453 | -- 454 | -- Name: id; Type: DEFAULT; Schema: public; Owner: localhost 455 | -- 456 | 457 | ALTER TABLE ONLY order_lines ALTER COLUMN id SET DEFAULT nextval('order_lines_id_seq'::regclass); 458 | 459 | 460 | -- 461 | -- Name: id; Type: DEFAULT; Schema: public; Owner: localhost 462 | -- 463 | 464 | ALTER TABLE ONLY orders ALTER COLUMN id SET DEFAULT nextval('orders_id_seq'::regclass); 465 | 466 | 467 | -- 468 | -- Name: id; Type: DEFAULT; Schema: public; Owner: localhost 469 | -- 470 | 471 | ALTER TABLE ONLY products ALTER COLUMN id SET DEFAULT nextval('products_id_seq'::regclass); 472 | 473 | 474 | -- 475 | -- Name: id; Type: DEFAULT; Schema: public; Owner: localhost 476 | -- 477 | 478 | ALTER TABLE ONLY rails_workflow_contexts ALTER COLUMN id SET DEFAULT nextval('rails_workflow_contexts_id_seq'::regclass); 479 | 480 | 481 | -- 482 | -- Name: id; Type: DEFAULT; Schema: public; Owner: localhost 483 | -- 484 | 485 | ALTER TABLE ONLY rails_workflow_errors ALTER COLUMN id SET DEFAULT nextval('rails_workflow_errors_id_seq'::regclass); 486 | 487 | 488 | -- 489 | -- Name: id; Type: DEFAULT; Schema: public; Owner: localhost 490 | -- 491 | 492 | ALTER TABLE ONLY rails_workflow_operation_templates ALTER COLUMN id SET DEFAULT nextval('rails_workflow_operation_templates_id_seq'::regclass); 493 | 494 | 495 | -- 496 | -- Name: id; Type: DEFAULT; Schema: public; Owner: localhost 497 | -- 498 | 499 | ALTER TABLE ONLY rails_workflow_operations ALTER COLUMN id SET DEFAULT nextval('rails_workflow_operations_id_seq'::regclass); 500 | 501 | 502 | -- 503 | -- Name: id; Type: DEFAULT; Schema: public; Owner: localhost 504 | -- 505 | 506 | ALTER TABLE ONLY rails_workflow_process_templates ALTER COLUMN id SET DEFAULT nextval('rails_workflow_process_templates_id_seq'::regclass); 507 | 508 | 509 | -- 510 | -- Name: id; Type: DEFAULT; Schema: public; Owner: localhost 511 | -- 512 | 513 | ALTER TABLE ONLY rails_workflow_processes ALTER COLUMN id SET DEFAULT nextval('rails_workflow_processes_id_seq'::regclass); 514 | 515 | 516 | -- 517 | -- Name: id; Type: DEFAULT; Schema: public; Owner: localhost 518 | -- 519 | 520 | ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass); 521 | 522 | 523 | -- 524 | -- Data for Name: order_lines; Type: TABLE DATA; Schema: public; Owner: localhost 525 | -- 526 | 527 | COPY order_lines (id, order_id, product_id, qty, created_at, updated_at) FROM stdin; 528 | 31 12 1 1 2015-02-10 16:21:43.460091 2015-02-10 16:21:43.460091 529 | 32 12 2 2 2015-02-10 16:21:43.474962 2015-02-10 16:21:43.474962 530 | 33 12 3 3 2015-02-10 16:21:43.485121 2015-02-10 16:21:43.485121 531 | \. 532 | 533 | 534 | -- 535 | -- Name: order_lines_id_seq; Type: SEQUENCE SET; Schema: public; Owner: localhost 536 | -- 537 | 538 | SELECT pg_catalog.setval('order_lines_id_seq', 33, true); 539 | 540 | 541 | -- 542 | -- Data for Name: orders; Type: TABLE DATA; Schema: public; Owner: localhost 543 | -- 544 | 545 | COPY orders (id, customer_id, created_at, updated_at) FROM stdin; 546 | 12 2 2015-02-10 16:21:43.428054 2015-02-10 16:21:43.428054 547 | \. 548 | 549 | 550 | -- 551 | -- Name: orders_id_seq; Type: SEQUENCE SET; Schema: public; Owner: localhost 552 | -- 553 | 554 | SELECT pg_catalog.setval('orders_id_seq', 12, true); 555 | 556 | 557 | -- 558 | -- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: localhost 559 | -- 560 | 561 | COPY products (id, name, active, vendor_id, unit_price, stock_qty, reserved_qty, min_qty, created_at, updated_at) FROM stdin; 562 | 1 Test Product #1 \N \N 12 500 4 50 2015-02-09 18:02:14.298965 2015-02-10 16:22:26.950948 563 | 2 Test Product #2 \N \N 23 500 7 10 2015-02-09 18:04:02.377629 2015-02-10 16:22:26.96204 564 | 3 Test Product #3 \N \N 15 25 10 10 2015-02-09 18:04:26.101027 2015-02-10 16:22:26.97307 565 | \. 566 | 567 | 568 | -- 569 | -- Name: products_id_seq; Type: SEQUENCE SET; Schema: public; Owner: localhost 570 | -- 571 | 572 | SELECT pg_catalog.setval('products_id_seq', 3, true); 573 | 574 | 575 | -- 576 | -- Data for Name: rails_workflow_contexts; Type: TABLE DATA; Schema: public; Owner: localhost 577 | -- 578 | 579 | COPY rails_workflow_contexts (id, parent_id, parent_type, body, created_at, updated_at) FROM stdin; 580 | 1 1 Workflow::Process {"resource":{"id":8,"class":"Order"}} 2015-02-09 19:37:16.596733 2015-02-09 19:37:16.596733 581 | 2 1 Workflow::Operation {"resource":{"id":8,"class":"Order"}} 2015-02-09 19:37:16.761363 2015-02-09 19:37:16.761363 582 | 3 1 Workflow::Error {"parent":{"id":1,"class":"Workflow::Process"},"target":{"id":1,"class":"Workflow::Process"},"method":"build_dependencies","args":[{"id":1,"class":"OrderValidation"}]} 2015-02-09 19:37:17.020582 2015-02-09 19:37:17.020582 583 | 4 2 Workflow::Operation {"resource":{"id":8,"class":"Order"}} 2015-02-09 19:38:22.638002 2015-02-09 19:38:22.638002 584 | 5 3 Workflow::Operation {"resource":{"id":8,"class":"Order"},"orderValid":true} 2015-02-09 19:38:22.80376 2015-02-09 19:38:22.80376 585 | 6 2 Workflow::Process {"resource":{"id":9,"class":"Order"}} 2015-02-09 19:39:25.70428 2015-02-09 19:39:25.70428 586 | 7 4 Workflow::Operation {"resource":{"id":9,"class":"Order"}} 2015-02-09 19:39:25.834166 2015-02-09 19:39:25.834166 587 | 8 5 Workflow::Operation {"resource":{"id":9,"class":"Order"},"orderValid":false} 2015-02-09 19:39:26.078433 2015-02-09 19:39:26.078433 588 | 9 3 Workflow::Process {"resource":{"id":10,"class":"Order"}} 2015-02-09 19:58:33.209583 2015-02-09 19:58:33.209583 589 | 10 6 Workflow::Operation {"resource":{"id":10,"class":"Order"}} 2015-02-09 19:58:33.332066 2015-02-09 19:58:33.332066 590 | 11 7 Workflow::Operation {"resource":{"id":10,"class":"Order"},"orderValid":false} 2015-02-09 19:58:33.530454 2015-02-09 19:58:33.530454 591 | 12 4 Workflow::Process {"resource":{"id":11,"class":"Order"}} 2015-02-09 19:59:09.661348 2015-02-09 19:59:09.661348 592 | 13 8 Workflow::Operation {"resource":{"id":11,"class":"Order"}} 2015-02-09 19:59:09.794754 2015-02-09 19:59:09.794754 593 | 14 2 Workflow::Error {"parent":{"id":4,"class":"Workflow::Process"},"target":{"id":4,"class":"Workflow::Process"},"method":"build_dependencies","args":[{"id":8,"class":"OrderValidation"}]} 2015-02-09 19:59:09.994922 2015-02-09 19:59:09.994922 594 | 15 3 Workflow::Error {"parent":{"id":4,"class":"Workflow::Process"},"target":{"id":4,"class":"Workflow::Process"},"method":"build_dependencies","args":[{"id":8,"class":"OrderValidation"}]} 2015-02-09 20:00:50.928824 2015-02-09 20:00:50.928824 595 | 16 4 Workflow::Error {"parent":{"id":4,"class":"Workflow::Process"},"target":{"id":4,"class":"Workflow::Process"},"method":"build_dependencies","args":[{"id":8,"class":"OrderValidation"}]} 2015-02-09 20:02:15.555284 2015-02-09 20:02:15.555284 596 | 17 9 Workflow::Operation {"resource":{"id":11,"class":"Order"},"url_path":"edit_order_path","url_params":[{"id":11,"class":"Order"}]} 2015-02-09 20:02:27.605936 2015-02-09 20:02:27.605936 597 | 18 10 Workflow::Operation {"resource":{"id":11,"class":"Order"},"url_path":"edit_order_path","url_params":[{"id":11,"class":"Order"}],"orderValid":true} 2015-02-09 20:12:23.773507 2015-02-09 20:12:23.773507 598 | 19 5 RailsWorkflow::Process {"resource":{"id":12,"class":"Order"}} 2015-02-10 16:21:43.67017 2015-02-10 16:21:43.67017 599 | 20 11 RailsWorkflow::Operation {"resource":{"id":12,"class":"Order"}} 2015-02-10 16:21:43.896855 2015-02-10 16:21:43.896855 600 | 21 12 RailsWorkflow::Operation {"resource":{"id":12,"class":"Order"},"orderValid":false,"url_path":"edit_order_path","url_params":[{"id":12,"class":"Order"}]} 2015-02-10 16:21:44.204188 2015-02-10 16:21:44.204188 601 | 22 13 RailsWorkflow::Operation {"resource":{"id":12,"class":"Order"},"orderValid":true,"url_path":"edit_order_path","url_params":[{"id":12,"class":"Order"}]} 2015-02-10 16:22:26.885045 2015-02-10 16:22:26.885045 602 | \. 603 | 604 | 605 | -- 606 | -- Name: rails_workflow_contexts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: localhost 607 | -- 608 | 609 | SELECT pg_catalog.setval('rails_workflow_contexts_id_seq', 22, true); 610 | 611 | 612 | -- 613 | -- Data for Name: rails_workflow_errors; Type: TABLE DATA; Schema: public; Owner: localhost 614 | -- 615 | 616 | COPY rails_workflow_errors (id, message, stack_trace, parent_id, parent_type, created_at, updated_at, resolved) FROM stdin; 617 | \. 618 | 619 | 620 | -- 621 | -- Name: rails_workflow_errors_id_seq; Type: SEQUENCE SET; Schema: public; Owner: localhost 622 | -- 623 | 624 | SELECT pg_catalog.setval('rails_workflow_errors_id_seq', 4, true); 625 | 626 | 627 | -- 628 | -- Data for Name: rails_workflow_operation_templates; Type: TABLE DATA; Schema: public; Owner: localhost 629 | -- 630 | 631 | COPY rails_workflow_operation_templates (id, title, source, dependencies, operation_class, process_template_id, created_at, updated_at, async, child_process_id, assignment_id, assignment_type, kind, role, "group", instruction, is_background, type) FROM stdin; 632 | 1 Order Validation \N \N OrderValidation 1 2015-02-09 18:49:05.693104 2015-02-09 18:49:05.693104 f \N \N \N default \N \N \N t 633 | 2 Correct Invalid Order Information \N [{"id":1,"statuses":[2]}] ProcessInvalidOrder 1 2015-02-09 19:07:56.488993 2015-02-09 19:07:56.488993 f \N \N \N user_role sale \N t ProcessInvalidOrderTemplate 634 | 3 Reserve Stock Positions \N [{"id":1,"statuses":[2]},{"id":2,"statuses":[2]}] ReserveStockPositions 1 2015-02-09 19:20:47.127717 2015-02-09 19:20:47.127717 f \N \N \N default \N \N \N t ReserveStockPositionsTemplate 635 | \. 636 | 637 | 638 | -- 639 | -- Name: rails_workflow_operation_templates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: localhost 640 | -- 641 | 642 | SELECT pg_catalog.setval('rails_workflow_operation_templates_id_seq', 3, true); 643 | 644 | 645 | -- 646 | -- Data for Name: rails_workflow_operations; Type: TABLE DATA; Schema: public; Owner: localhost 647 | -- 648 | 649 | COPY rails_workflow_operations (id, status, async, title, created_at, updated_at, process_id, template_id, dependencies, child_process_id, assignment_id, assignment_type, assigned_at, type, is_active, completed_at, is_background) FROM stdin; 650 | 11 2 f Order Validation 2015-02-10 16:21:43.884884 2015-02-10 16:21:44.016677 5 1 [] \N \N \N \N OrderValidation \N 2015-02-10 16:21:44.01373 t 651 | 12 2 f Correct Invalid Order Information #12 2015-02-10 16:21:44.147104 2015-02-10 16:22:26.782557 5 2 [{"operation_id":11,"status":2}] \N 4 User 2015-02-10 16:22:24.213059 ProcessInvalidOrder t 2015-02-10 16:22:26.780255 t 652 | 13 2 f Reserve Stock Positions 2015-02-10 16:22:26.849853 2015-02-10 16:22:26.981909 5 3 [{"operation_id":12,"status":2}] \N \N \N \N ReserveStockPositions \N 2015-02-10 16:22:26.979301 t 653 | \. 654 | 655 | 656 | -- 657 | -- Name: rails_workflow_operations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: localhost 658 | -- 659 | 660 | SELECT pg_catalog.setval('rails_workflow_operations_id_seq', 13, true); 661 | 662 | 663 | -- 664 | -- Data for Name: rails_workflow_process_templates; Type: TABLE DATA; Schema: public; Owner: localhost 665 | -- 666 | 667 | COPY rails_workflow_process_templates (id, title, source, manager_class, process_class, created_at, updated_at, type) FROM stdin; 668 | 1 Processing Order # \N 2015-02-09 18:43:33.026077 2015-02-09 18:43:33.026077 669 | \. 670 | 671 | 672 | -- 673 | -- Name: rails_workflow_process_templates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: localhost 674 | -- 675 | 676 | SELECT pg_catalog.setval('rails_workflow_process_templates_id_seq', 1, true); 677 | 678 | 679 | -- 680 | -- Data for Name: rails_workflow_processes; Type: TABLE DATA; Schema: public; Owner: localhost 681 | -- 682 | 683 | COPY rails_workflow_processes (id, status, async, title, created_at, updated_at, template_id, type) FROM stdin; 684 | 5 2 \N Processing Order # 2015-02-10 16:21:43.590604 2015-02-10 16:22:27.086875 1 \N 685 | \. 686 | 687 | 688 | -- 689 | -- Name: rails_workflow_processes_id_seq; Type: SEQUENCE SET; Schema: public; Owner: localhost 690 | -- 691 | 692 | SELECT pg_catalog.setval('rails_workflow_processes_id_seq', 5, true); 693 | 694 | 695 | -- 696 | -- Data for Name: schema_migrations; Type: TABLE DATA; Schema: public; Owner: localhost 697 | -- 698 | 699 | COPY schema_migrations (version) FROM stdin; 700 | 20150209172314 701 | 20150209172316 702 | 20150123172243 703 | 20150202091139 704 | 20150206192702 705 | 20150207181058 706 | 20150209173226 707 | 20150209175803 708 | 20150209175919 709 | 20150209175923 710 | 20150209180608 711 | 20150210070051 712 | 20150210161941 713 | \. 714 | 715 | 716 | -- 717 | -- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: localhost 718 | -- 719 | 720 | COPY users (id, email, encrypted_password, reset_password_token, reset_password_sent_at, remember_created_at, sign_in_count, current_sign_in_at, last_sign_in_at, current_sign_in_ip, last_sign_in_ip, created_at, updated_at, name, role) FROM stdin; 721 | 2 admin@test.com $2a$10$uwn.riGpK2tmiAQuja.ncO1TyxJXLGXlVgFQDmrb8TkbxCpTKPx5C \N \N \N 1 2015-02-09 17:39:01.996479 2015-02-09 17:39:01.996479 127.0.0.1 127.0.0.1 2015-02-09 17:39:01.979426 2015-02-09 17:39:01.999412 admin \N 722 | 1 user@example.com $2a$10$7.mF5KHhg0zk1Z55czWDde8fvyLZcwlJUyIYaxrg.ZNne1ybpNfPW \N \N \N 0 \N \N \N \N 2015-02-09 17:23:35.585533 2015-02-09 18:07:18.22158 \N admin 723 | 3 admin@admin.com $2a$10$pbd2cRrXF21CSyrxEY1beuJQOVODii.Lxd8E6Vtz9UuLWXOxH1N/6 \N \N \N 0 \N \N \N \N 2015-02-09 19:31:00.55203 2015-02-09 19:31:00.55203 \N admin 724 | 6 prov@test.com $2a$10$nHNcKhbgsug4sEEZcxczieShWRY0IUDE419SX5FkJcgQjwwUfNrVy \N \N \N 0 \N \N \N \N 2015-02-09 19:31:16.577724 2015-02-09 19:31:16.577724 \N stock 725 | 5 customer@test.com $2a$10$GgJUkMbcNmbdP.q9F2WU5.1o7KkX8EURvd5Haj464o1gWVHCO3Ut2 \N \N \N 1 2015-02-09 19:31:31.591745 2015-02-09 19:31:31.591745 127.0.0.1 127.0.0.1 2015-02-09 19:31:00.74892 2015-02-09 19:31:31.594472 \N customer 726 | 4 sales@test.com $2a$10$JrGQMjOCDWfwJGMv0ouOt.iesteNmQdfcLP2SBIoo7TXwrZCTqqEC \N \N \N 2 2015-02-10 16:22:17.952585 2015-02-09 19:53:51.116009 127.0.0.1 127.0.0.1 2015-02-09 19:31:00.657197 2015-02-10 16:22:17.96001 \N sale 727 | \. 728 | 729 | 730 | -- 731 | -- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: localhost 732 | -- 733 | 734 | SELECT pg_catalog.setval('users_id_seq', 6, true); 735 | 736 | 737 | -- 738 | -- Name: order_lines_pkey; Type: CONSTRAINT; Schema: public; Owner: localhost; Tablespace: 739 | -- 740 | 741 | ALTER TABLE ONLY order_lines 742 | ADD CONSTRAINT order_lines_pkey PRIMARY KEY (id); 743 | 744 | 745 | -- 746 | -- Name: orders_pkey; Type: CONSTRAINT; Schema: public; Owner: localhost; Tablespace: 747 | -- 748 | 749 | ALTER TABLE ONLY orders 750 | ADD CONSTRAINT orders_pkey PRIMARY KEY (id); 751 | 752 | 753 | -- 754 | -- Name: products_pkey; Type: CONSTRAINT; Schema: public; Owner: localhost; Tablespace: 755 | -- 756 | 757 | ALTER TABLE ONLY products 758 | ADD CONSTRAINT products_pkey PRIMARY KEY (id); 759 | 760 | 761 | -- 762 | -- Name: rails_workflow_contexts_pkey; Type: CONSTRAINT; Schema: public; Owner: localhost; Tablespace: 763 | -- 764 | 765 | ALTER TABLE ONLY rails_workflow_contexts 766 | ADD CONSTRAINT rails_workflow_contexts_pkey PRIMARY KEY (id); 767 | 768 | 769 | -- 770 | -- Name: rails_workflow_errors_pkey; Type: CONSTRAINT; Schema: public; Owner: localhost; Tablespace: 771 | -- 772 | 773 | ALTER TABLE ONLY rails_workflow_errors 774 | ADD CONSTRAINT rails_workflow_errors_pkey PRIMARY KEY (id); 775 | 776 | 777 | -- 778 | -- Name: rails_workflow_operation_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: localhost; Tablespace: 779 | -- 780 | 781 | ALTER TABLE ONLY rails_workflow_operation_templates 782 | ADD CONSTRAINT rails_workflow_operation_templates_pkey PRIMARY KEY (id); 783 | 784 | 785 | -- 786 | -- Name: rails_workflow_operations_pkey; Type: CONSTRAINT; Schema: public; Owner: localhost; Tablespace: 787 | -- 788 | 789 | ALTER TABLE ONLY rails_workflow_operations 790 | ADD CONSTRAINT rails_workflow_operations_pkey PRIMARY KEY (id); 791 | 792 | 793 | -- 794 | -- Name: rails_workflow_process_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: localhost; Tablespace: 795 | -- 796 | 797 | ALTER TABLE ONLY rails_workflow_process_templates 798 | ADD CONSTRAINT rails_workflow_process_templates_pkey PRIMARY KEY (id); 799 | 800 | 801 | -- 802 | -- Name: rails_workflow_processes_pkey; Type: CONSTRAINT; Schema: public; Owner: localhost; Tablespace: 803 | -- 804 | 805 | ALTER TABLE ONLY rails_workflow_processes 806 | ADD CONSTRAINT rails_workflow_processes_pkey PRIMARY KEY (id); 807 | 808 | 809 | -- 810 | -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: localhost; Tablespace: 811 | -- 812 | 813 | ALTER TABLE ONLY users 814 | ADD CONSTRAINT users_pkey PRIMARY KEY (id); 815 | 816 | 817 | -- 818 | -- Name: index_rails_workflow_contexts_on_parent_id_and_parent_type; Type: INDEX; Schema: public; Owner: localhost; Tablespace: 819 | -- 820 | 821 | CREATE INDEX index_rails_workflow_contexts_on_parent_id_and_parent_type ON rails_workflow_contexts USING btree (parent_id, parent_type); 822 | 823 | 824 | -- 825 | -- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: localhost; Tablespace: 826 | -- 827 | 828 | CREATE UNIQUE INDEX index_users_on_email ON users USING btree (email); 829 | 830 | 831 | -- 832 | -- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: localhost; Tablespace: 833 | -- 834 | 835 | CREATE UNIQUE INDEX index_users_on_reset_password_token ON users USING btree (reset_password_token); 836 | 837 | 838 | -- 839 | -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: localhost; Tablespace: 840 | -- 841 | 842 | CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version); 843 | 844 | 845 | -- 846 | -- Name: public; Type: ACL; Schema: -; Owner: localhost 847 | -- 848 | 849 | REVOKE ALL ON SCHEMA public FROM PUBLIC; 850 | REVOKE ALL ON SCHEMA public FROM localhost; 851 | GRANT ALL ON SCHEMA public TO localhost; 852 | GRANT ALL ON SCHEMA public TO PUBLIC; 853 | 854 | 855 | -- 856 | -- PostgreSQL database dump complete 857 | -- 858 | 859 | -------------------------------------------------------------------------------- /db/migrate/20150209172314_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | class DeviseCreateUsers < ActiveRecord::Migration 2 | def change 3 | create_table(:users) do |t| 4 | ## Database authenticatable 5 | t.string :email, null: false, default: "" 6 | t.string :encrypted_password, null: false, default: "" 7 | 8 | ## Recoverable 9 | t.string :reset_password_token 10 | t.datetime :reset_password_sent_at 11 | 12 | ## Rememberable 13 | t.datetime :remember_created_at 14 | 15 | ## Trackable 16 | t.integer :sign_in_count, default: 0, null: false 17 | t.datetime :current_sign_in_at 18 | t.datetime :last_sign_in_at 19 | t.inet :current_sign_in_ip 20 | t.inet :last_sign_in_ip 21 | 22 | ## Confirmable 23 | # t.string :confirmation_token 24 | # t.datetime :confirmed_at 25 | # t.datetime :confirmation_sent_at 26 | # t.string :unconfirmed_email # Only if using reconfirmable 27 | 28 | ## Lockable 29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 30 | # t.string :unlock_token # Only if unlock strategy is :email or :both 31 | # t.datetime :locked_at 32 | 33 | 34 | t.timestamps 35 | end 36 | 37 | add_index :users, :email, unique: true 38 | add_index :users, :reset_password_token, unique: true 39 | # add_index :users, :confirmation_token, unique: true 40 | # add_index :users, :unlock_token, unique: true 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /db/migrate/20150209172316_add_name_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddNameToUsers < ActiveRecord::Migration 2 | def change 3 | add_column :users, :name, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150209175803_create_products.rb: -------------------------------------------------------------------------------- 1 | class CreateProducts < ActiveRecord::Migration 2 | def change 3 | create_table :products do |t| 4 | t.string :name 5 | t.boolean :active 6 | t.integer :vendor_id 7 | t.float :unit_price 8 | t.integer :stock_qty 9 | t.integer :reserved_qty 10 | t.integer :min_qty 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20150209175919_create_orders.rb: -------------------------------------------------------------------------------- 1 | class CreateOrders < ActiveRecord::Migration 2 | def change 3 | create_table :orders do |t| 4 | t.integer :customer_id 5 | 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20150209175923_create_order_lines.rb: -------------------------------------------------------------------------------- 1 | class CreateOrderLines < ActiveRecord::Migration 2 | def change 3 | create_table :order_lines do |t| 4 | t.integer :order_id 5 | t.integer :product_id 6 | t.integer :qty 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20150209180608_add_role_to_user.rb: -------------------------------------------------------------------------------- 1 | class AddRoleToUser < ActiveRecord::Migration 2 | def change 3 | add_column :users, :role, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20150707182206_create_workflow_processes.rb: -------------------------------------------------------------------------------- 1 | class CreateWorkflowProcesses < ActiveRecord::Migration 2 | def change 3 | create_tables 4 | create_columns 5 | check_json_columns 6 | create_indexes 7 | end 8 | 9 | def create_tables 10 | [ 11 | [:workflow_processes, :rails_workflow_processes], 12 | [:workflow_operations, :rails_workflow_operations], 13 | [:workflow_process_templates, :rails_workflow_process_templates], 14 | [:workflow_operation_templates, :rails_workflow_operation_templates], 15 | [:workflow_contexts, :rails_workflow_contexts], 16 | [:workflow_errors, :rails_workflow_errors] 17 | ].map do |names| 18 | if table_exists? names[0] 19 | rename_table names[0], names[1] 20 | end 21 | 22 | create_table names[1] unless table_exists? names[1] 23 | end 24 | 25 | end 26 | 27 | def create_indexes 28 | [ 29 | [:rails_workflow_contexts, [:parent_id, :parent_type]], 30 | [:rails_workflow_errors, [:parent_id, :parent_type]], 31 | [:rails_workflow_operation_templates, :process_template_id], 32 | [:rails_workflow_operation_templates, :uuid], 33 | [:rails_workflow_process_templates, :uuid], 34 | [:rails_workflow_operations, :process_id], 35 | [:rails_workflow_operations, :template_id] 36 | ].each do |idx| 37 | unless index_exists? idx[0], idx[1] 38 | add_index idx[0], idx[1] 39 | end 40 | end 41 | end 42 | 43 | def create_columns 44 | { 45 | :rails_workflow_contexts => [ 46 | [:integer, :parent_id], 47 | [:string, :parent_type], 48 | [:text, :body], 49 | [:datetime, :created_at], 50 | [:datetime, :updated_at], 51 | ], 52 | 53 | :rails_workflow_errors => [ 54 | [:string, :message], 55 | [:text, :stack_trace], 56 | [:integer, :parent_id], 57 | [:string, :parent_type], 58 | [:datetime, :created_at], 59 | [:datetime, :updated_at], 60 | [:boolean, :resolved] 61 | ], 62 | 63 | :rails_workflow_operation_templates => [ 64 | [:string, :title], 65 | [:string, :version], 66 | [:string, :uuid], 67 | [:string, :tag], 68 | [:text, :source], 69 | [:text, :dependencies], 70 | [:string, :operation_class], 71 | [:integer, :process_template_id], 72 | [:datetime, :created_at], 73 | [:datetime, :updated_at], 74 | [:boolean, :async], 75 | [:integer, :child_process_id], 76 | [:integer, :assignment_id], 77 | [:string, :assignment_type], 78 | [:string, :kind], 79 | [:string, :role], 80 | [:string, :group], 81 | [:text, :instruction], 82 | [:boolean, :is_background], 83 | [:string, :type], 84 | [:string, :partial_name], 85 | ], 86 | 87 | :rails_workflow_operations => [ 88 | [:integer, :status], 89 | [:boolean, :async], 90 | [:string, :version], 91 | [:string, :tag], 92 | [:string, :title], 93 | [:datetime, :created_at], 94 | [:datetime, :updated_at], 95 | [:integer, :process_id], 96 | [:integer, :template_id], 97 | [:text, :dependencies], 98 | [:integer, :child_process_id], 99 | [:integer, :assignment_id], 100 | [:string, :assignment_type], 101 | [:datetime, :assigned_at], 102 | [:string, :type], 103 | [:boolean, :is_active], 104 | [:datetime, :completed_at], 105 | [:boolean, :is_background] 106 | ], 107 | 108 | :rails_workflow_process_templates => [ 109 | [:string, :title], 110 | [:text, :source], 111 | [:string, :uuid], 112 | [:string, :version], 113 | [:string, :tag], 114 | [:string, :manager_class], 115 | [:string, :process_class], 116 | [:datetime, :created_at], 117 | [:datetime, :updated_at], 118 | [:string, :type], 119 | [:string, :partial_name] 120 | ], 121 | 122 | :rails_workflow_processes => [ 123 | [:integer, :status], 124 | [:string, :version], 125 | [:string, :tag], 126 | [:boolean, :async], 127 | [:string, :title], 128 | [:datetime, :created_at], 129 | [:datetime, :updated_at], 130 | [:integer, :template_id], 131 | [:string, :type] 132 | ] 133 | }.each do |table, columns| 134 | columns.map do |column| 135 | unless column_exists? table, column[1] 136 | add_column table, column[1], column[0] 137 | end 138 | end 139 | 140 | end 141 | 142 | end 143 | 144 | def check_json_columns 145 | [ 146 | [RailsWorkflow::Operation, :dependencies], 147 | [RailsWorkflow::OperationTemplate, :dependencies], 148 | [RailsWorkflow::Context, :body] 149 | ].map do |check| 150 | if check[0].columns_hash[check[1].to_s].sql_type == "json" 151 | # change_column check[0].table_name, check[1], "JSON USING #{check[1]}::JSON" 152 | change_column check[0].table_name, check[1], :text 153 | end 154 | end 155 | end 156 | end 157 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # This file is auto-generated from the current state of the database. Instead 3 | # of editing this file, please use the migrations feature of Active Record to 4 | # incrementally modify your database, and then regenerate this schema definition. 5 | # 6 | # Note that this schema.rb definition is the authoritative source for your 7 | # database schema. If you need to create the application database on another 8 | # system, you should be using db:schema:load, not running all the migrations 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). 11 | # 12 | # It's strongly recommended that you check this file into your version control system. 13 | 14 | ActiveRecord::Schema.define(version: 20150707182206) do 15 | 16 | # These are extensions that must be enabled in order to support this database 17 | enable_extension "plpgsql" 18 | 19 | create_table "order_lines", force: true do |t| 20 | t.integer "order_id" 21 | t.integer "product_id" 22 | t.integer "qty" 23 | t.datetime "created_at" 24 | t.datetime "updated_at" 25 | end 26 | 27 | create_table "orders", force: true do |t| 28 | t.integer "customer_id" 29 | t.datetime "created_at" 30 | t.datetime "updated_at" 31 | end 32 | 33 | create_table "products", force: true do |t| 34 | t.string "name" 35 | t.boolean "active" 36 | t.integer "vendor_id" 37 | t.float "unit_price" 38 | t.integer "stock_qty" 39 | t.integer "reserved_qty" 40 | t.integer "min_qty" 41 | t.datetime "created_at" 42 | t.datetime "updated_at" 43 | end 44 | 45 | create_table "rails_workflow_contexts", force: true do |t| 46 | t.integer "parent_id" 47 | t.string "parent_type" 48 | t.text "body" 49 | t.datetime "created_at" 50 | t.datetime "updated_at" 51 | end 52 | 53 | add_index "rails_workflow_contexts", ["parent_id", "parent_type"], name: "index_rails_workflow_contexts_on_parent_id_and_parent_type", using: :btree 54 | 55 | create_table "rails_workflow_errors", force: true do |t| 56 | t.string "message" 57 | t.text "stack_trace" 58 | t.integer "parent_id" 59 | t.string "parent_type" 60 | t.datetime "created_at" 61 | t.datetime "updated_at" 62 | t.boolean "resolved" 63 | end 64 | 65 | add_index "rails_workflow_errors", ["parent_id", "parent_type"], name: "index_rails_workflow_errors_on_parent_id_and_parent_type", using: :btree 66 | 67 | create_table "rails_workflow_operation_templates", force: true do |t| 68 | t.string "title" 69 | t.text "source" 70 | t.text "dependencies" 71 | t.string "operation_class" 72 | t.integer "process_template_id" 73 | t.datetime "created_at" 74 | t.datetime "updated_at" 75 | t.boolean "async" 76 | t.integer "child_process_id" 77 | t.integer "assignment_id" 78 | t.string "assignment_type" 79 | t.string "kind" 80 | t.string "role" 81 | t.string "group" 82 | t.text "instruction" 83 | t.boolean "is_background", default: true 84 | t.string "type" 85 | t.string "version" 86 | t.string "uuid" 87 | t.string "tag" 88 | t.string "partial_name" 89 | end 90 | 91 | add_index "rails_workflow_operation_templates", ["process_template_id"], name: "index_rails_workflow_operation_templates_on_process_template_id", using: :btree 92 | add_index "rails_workflow_operation_templates", ["uuid"], name: "index_rails_workflow_operation_templates_on_uuid", using: :btree 93 | 94 | create_table "rails_workflow_operations", force: true do |t| 95 | t.integer "status" 96 | t.boolean "async" 97 | t.string "title" 98 | t.datetime "created_at" 99 | t.datetime "updated_at" 100 | t.integer "process_id" 101 | t.integer "template_id" 102 | t.text "dependencies" 103 | t.integer "child_process_id" 104 | t.integer "assignment_id" 105 | t.string "assignment_type" 106 | t.datetime "assigned_at" 107 | t.string "type" 108 | t.boolean "is_active" 109 | t.datetime "completed_at" 110 | t.boolean "is_background" 111 | t.string "version" 112 | t.string "tag" 113 | end 114 | 115 | add_index "rails_workflow_operations", ["process_id"], name: "index_rails_workflow_operations_on_process_id", using: :btree 116 | add_index "rails_workflow_operations", ["template_id"], name: "index_rails_workflow_operations_on_template_id", using: :btree 117 | 118 | create_table "rails_workflow_process_templates", force: true do |t| 119 | t.string "title" 120 | t.text "source" 121 | t.string "manager_class" 122 | t.string "process_class" 123 | t.datetime "created_at" 124 | t.datetime "updated_at" 125 | t.string "type" 126 | t.string "uuid" 127 | t.string "version" 128 | t.string "tag" 129 | t.string "partial_name" 130 | end 131 | 132 | add_index "rails_workflow_process_templates", ["uuid"], name: "index_rails_workflow_process_templates_on_uuid", using: :btree 133 | 134 | create_table "rails_workflow_processes", force: true do |t| 135 | t.integer "status" 136 | t.boolean "async" 137 | t.string "title" 138 | t.datetime "created_at" 139 | t.datetime "updated_at" 140 | t.integer "template_id" 141 | t.string "type" 142 | t.string "version" 143 | t.string "tag" 144 | end 145 | 146 | create_table "users", force: true do |t| 147 | t.string "email", default: "", null: false 148 | t.string "encrypted_password", default: "", null: false 149 | t.string "reset_password_token" 150 | t.datetime "reset_password_sent_at" 151 | t.datetime "remember_created_at" 152 | t.integer "sign_in_count", default: 0, null: false 153 | t.datetime "current_sign_in_at" 154 | t.datetime "last_sign_in_at" 155 | t.inet "current_sign_in_ip" 156 | t.inet "last_sign_in_ip" 157 | t.datetime "created_at" 158 | t.datetime "updated_at" 159 | t.string "name" 160 | t.string "role" 161 | end 162 | 163 | add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree 164 | add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree 165 | 166 | end 167 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | [{ 2 | email: "admin@admin.com", 3 | role: "admin", 4 | password: "Qwerty123", 5 | password_confirmation: "Qwerty123" 6 | }, 7 | { 8 | email: "sales@test.com", 9 | role: "sale", 10 | password: "Qwerty123", 11 | password_confirmation: "Qwerty123" 12 | }, 13 | { 14 | email: "customer@test.com", 15 | role: "customer", 16 | password: "Qwerty123", 17 | password_confirmation: "Qwerty123" 18 | }, 19 | 20 | { 21 | email: "prov@test.com", 22 | role: "stock", 23 | password: "Qwerty123", 24 | password_confirmation: "Qwerty123" 25 | }].each {|attrs| User.create(attrs) } 26 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/templates/slim/scaffold/_form.html.slim: -------------------------------------------------------------------------------- 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 11 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 |

    The page you were looking for doesn't exist.

    62 |

    You may have mistyped the address or the page may have moved.

    63 |
    64 |

    If you are the application owner check the logs for more information.

    65 |
    66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 |

    The change you wanted was rejected.

    62 |

    Maybe you tried to change something you didn't have access to.

    63 |
    64 |

    If you are the application owner check the logs for more information.

    65 |
    66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 |

    We're sorry, but something went wrong.

    62 |
    63 |

    If you are the application owner check the logs for more information.

    64 |
    65 | 66 | 67 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/public/favicon.ico -------------------------------------------------------------------------------- /public/humans.txt: -------------------------------------------------------------------------------- 1 | /* the humans responsible & colophon */ 2 | /* humanstxt.org */ 3 | 4 | 5 | /* TEAM */ 6 | : 7 | Site: 8 | Twitter: 9 | Location: 10 | 11 | /* THANKS */ 12 | Daniel Kehoe (@rails_apps) for the RailsApps project 13 | 14 | /* SITE */ 15 | Standards: HTML5, CSS3 16 | Components: jQuery 17 | Software: Ruby on Rails 18 | 19 | /* GENERATED BY */ 20 | Rails Composer: http://railscomposer.com/ 21 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/order_lines_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class OrderLinesControllerTest < ActionController::TestCase 4 | setup do 5 | @order_line = order_lines(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:order_lines) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create order_line" do 20 | assert_difference('OrderLine.count') do 21 | post :create, order_line: { order_id: @order_line.order_id, product_id: @order_line.product_id, qty: @order_line.qty } 22 | end 23 | 24 | assert_redirected_to order_line_path(assigns(:order_line)) 25 | end 26 | 27 | test "should show order_line" do 28 | get :show, id: @order_line 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @order_line 34 | assert_response :success 35 | end 36 | 37 | test "should update order_line" do 38 | patch :update, id: @order_line, order_line: { order_id: @order_line.order_id, product_id: @order_line.product_id, qty: @order_line.qty } 39 | assert_redirected_to order_line_path(assigns(:order_line)) 40 | end 41 | 42 | test "should destroy order_line" do 43 | assert_difference('OrderLine.count', -1) do 44 | delete :destroy, id: @order_line 45 | end 46 | 47 | assert_redirected_to order_lines_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/controllers/orders_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class OrdersControllerTest < ActionController::TestCase 4 | setup do 5 | @order = orders(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:orders) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create order" do 20 | assert_difference('Order.count') do 21 | post :create, order: { customer_id: @order.customer_id } 22 | end 23 | 24 | assert_redirected_to order_path(assigns(:order)) 25 | end 26 | 27 | test "should show order" do 28 | get :show, id: @order 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @order 34 | assert_response :success 35 | end 36 | 37 | test "should update order" do 38 | patch :update, id: @order, order: { customer_id: @order.customer_id } 39 | assert_redirected_to order_path(assigns(:order)) 40 | end 41 | 42 | test "should destroy order" do 43 | assert_difference('Order.count', -1) do 44 | delete :destroy, id: @order 45 | end 46 | 47 | assert_redirected_to orders_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/controllers/products_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ProductsControllerTest < ActionController::TestCase 4 | setup do 5 | @product = products(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:products) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create product" do 20 | assert_difference('Product.count') do 21 | post :create, product: { active: @product.active, min_qty: @product.min_qty, name: @product.name, reserved_qty: @product.reserved_qty, stock_qty: @product.stock_qty, unit_price: @product.unit_price, vendor_id: @product.vendor_id } 22 | end 23 | 24 | assert_redirected_to product_path(assigns(:product)) 25 | end 26 | 27 | test "should show product" do 28 | get :show, id: @product 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @product 34 | assert_response :success 35 | end 36 | 37 | test "should update product" do 38 | patch :update, id: @product, product: { active: @product.active, min_qty: @product.min_qty, name: @product.name, reserved_qty: @product.reserved_qty, stock_qty: @product.stock_qty, unit_price: @product.unit_price, vendor_id: @product.vendor_id } 39 | assert_redirected_to product_path(assigns(:product)) 40 | end 41 | 42 | test "should destroy product" do 43 | assert_difference('Product.count', -1) do 44 | delete :destroy, id: @product 45 | end 46 | 47 | assert_redirected_to products_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/decorators/order_decorator_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class OrderDecoratorTest < Draper::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/decorators/order_line_decorator_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class OrderLineDecoratorTest < Draper::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/decorators/product_decorator_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ProductDecoratorTest < Draper::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/order_lines.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | order_id: 1 5 | product_id: 1 6 | qty: 1 7 | 8 | two: 9 | order_id: 1 10 | product_id: 1 11 | qty: 1 12 | -------------------------------------------------------------------------------- /test/fixtures/orders.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | customer_id: 1 5 | 6 | two: 7 | customer_id: 1 8 | -------------------------------------------------------------------------------- /test/fixtures/products.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | name: MyString 5 | active: false 6 | vendor_id: 1 7 | unit_price: 1.5 8 | stock_qty: 1 9 | reserved_qty: 1 10 | min_qty: 1 11 | 12 | two: 13 | name: MyString 14 | active: false 15 | vendor_id: 1 16 | unit_price: 1.5 17 | stock_qty: 1 18 | reserved_qty: 1 19 | min_qty: 1 20 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | # This model initially had no columns defined. If you add columns to the 4 | # model remove the '{}' from the fixture names and add the columns immediately 5 | # below each fixture, per the syntax in the comments below 6 | # 7 | one: {} 8 | # column: value 9 | # 10 | two: {} 11 | # column: value 12 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/test/helpers/.keep -------------------------------------------------------------------------------- /test/helpers/order_lines_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class OrderLinesHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/orders_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class OrdersHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/products_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ProductsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/test/models/.keep -------------------------------------------------------------------------------- /test/models/order_line_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class OrderLineTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/order_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class OrderTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/product_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ProductTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/user_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class UserTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madzhuga/rails_workflow_demo/2fde55ac00e81bfb16e685889f8065c69d8daf5f/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------