diff --git a/Gemfile b/Gemfile index 8e9cc8c..457e278 100755 --- a/Gemfile +++ b/Gemfile @@ -15,6 +15,8 @@ group :development do gem 'rb-fsevent' gem 'guard-shell' gem 'bundler-audit' + gem 'guard-livereload' + gem 'rack-livereload' end @@ -23,7 +25,7 @@ end group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' - + gem 'jquery-fileupload-rails' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer', :platforms => :ruby diff --git a/Gemfile.lock b/Gemfile.lock index a3941ff..c37ee5c 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,7 +52,11 @@ GEM coffee-script-source execjs coffee-script-source (1.6.2) + em-websocket (0.5.0) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0.5.3) erubis (2.7.0) + eventmachine (1.0.3) execjs (1.4.0) multi_json (~> 1.0) fastercsv (1.5.5) @@ -68,15 +72,23 @@ GEM guard-brakeman (0.6.3) brakeman (>= 1.8.2) guard (>= 1.1.0) + guard-livereload (1.3.0) + em-websocket (>= 0.2.0) + guard (>= 1.5.0) + multi_json (~> 1.0) guard-shell (0.5.1) guard (>= 1.1.0) haml (4.0.2) tilt highline (1.6.16) hike (1.2.2) + http_parser.rb (0.5.3) i18n (0.6.1) journey (1.0.4) - jquery-rails (2.2.1) + jquery-fileupload-rails (0.4.1) + actionpack (>= 3.1) + railties (>= 3.1) + jquery-rails (3.0.1) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.7.7) @@ -101,6 +113,8 @@ GEM rack (1.4.5) rack-cache (1.2) rack (>= 0.4) + rack-livereload (0.3.15) + rack rack-ssl (1.3.3) rack rack-test (0.6.2) @@ -172,10 +186,13 @@ DEPENDENCIES coffee-rails (~> 3.2.1) foreman guard-brakeman + guard-livereload guard-shell + jquery-fileupload-rails jquery-rails minitest powder + rack-livereload rails (= 3.2.13) rb-fsevent sass-rails (~> 3.2.3) diff --git a/Guardfile b/Guardfile index 8cc9be1..b3ae7e6 100755 --- a/Guardfile +++ b/Guardfile @@ -10,4 +10,13 @@ end guard :shell do watch(%r{^Gemfile|Gemfile.lock$}) { system("bundle-audit")} -end \ No newline at end of file +end + +guard 'livereload', host: "railsgoat.dev", port: '35727' do + watch(%r{app/views/.+\.(erb|haml|slim)$}) + watch(%r{app/helpers/.+\.rb}) + watch(%r{public/.+\.(css|js|html)}) + watch(%r{config/locales/.+\.yml}) + # Rails Assets Pipeline + watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html))).*}) { |m| "/assets/#{m[3]}" } +end diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 42684d8..6a75987 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -27,6 +27,8 @@ //= require jquery.validate.js //= require jquery.snippet.js //= require jquery.easy-pie-chart.js +//= require jquery-fileupload/basic +//= require jquery-fileupload/vendor/tmpl function rubyCodeFormat() { diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 67bee38..a50142e 100755 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -10,6 +10,7 @@ * *= require_self *= require_tree . + *= require jquery.fileupload-ui */ p.desc { diff --git a/app/controllers/benefit_forms_controller.rb b/app/controllers/benefit_forms_controller.rb index b46a17a..b1f586b 100644 --- a/app/controllers/benefit_forms_controller.rb +++ b/app/controllers/benefit_forms_controller.rb @@ -1,6 +1,7 @@ class BenefitFormsController < ApplicationController def index + @benefits = Benefits.new end @@ -13,6 +14,10 @@ class BenefitFormsController < ApplicationController redirect_to user_benefit_forms_path(:user_id => current_user.user_id) end end + + def upload + + end =begin diff --git a/app/models/benefits.rb b/app/models/benefits.rb new file mode 100644 index 0000000..bc3d427 --- /dev/null +++ b/app/models/benefits.rb @@ -0,0 +1,7 @@ +class Benefits < ActiveRecord::Base + + def self.save(file) + + end + +end diff --git a/app/views/benefit_forms/index.html.erb b/app/views/benefit_forms/index.html.erb index 372a2ce..01007c6 100644 --- a/app/views/benefit_forms/index.html.erb +++ b/app/views/benefit_forms/index.html.erb @@ -52,20 +52,72 @@ - - - - + +
+
+
+
+
+ Health Insurance +
+
+ +
+
+

Upload file

+ <%= form_for @benefits, :url => upload_path, :html => { :action => "upload", :multipart => true, :id => "fi" } do |f| %> + +
+
+ + + + Add files... + <%= f.file_field :upload %> + + + +
+
+ +
+
+
+
+
+ +
+
+ + +
+ <% end %> +
+
+
+ +
+
+
+
+ + \ No newline at end of file diff --git a/config/environments/development.rb b/config/environments/development.rb index a160db4..9db258d 100755 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -34,4 +34,13 @@ Railsgoat::Application.configure do # Expands the lines which load the assets config.assets.debug = true + + config.middleware.insert_before( + Rack::Lock, Rack::LiveReload, + :min_delay => 500, + :max_delay => 1000, + :port => 35727, + :host => 'railsgoat.dev', + :ignore => [ %r{dont/modify\.html$} ] + ) end diff --git a/config/routes.rb b/config/routes.rb index 5db7baa..7cac899 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -31,6 +31,7 @@ resources :users do end get "download" => "benefit_forms#download" +post "upload" => "benefit_forms#upload" resources :tutorials do collection do diff --git a/db/migrate/20130708202859_create_benefits.rb b/db/migrate/20130708202859_create_benefits.rb new file mode 100644 index 0000000..39c63b6 --- /dev/null +++ b/db/migrate/20130708202859_create_benefits.rb @@ -0,0 +1,8 @@ +class CreateBenefits < ActiveRecord::Migration + def change + create_table :benefits do |t| + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index a2afef1..ba16163 100755 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,12 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130531182058) do +ActiveRecord::Schema.define(:version => 20130708202859) do + + create_table "benefits", :force => true do |t| + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end create_table "paid_time_offs", :force => true do |t| t.integer "user_id" diff --git a/test/fixtures/benefits.yml b/test/fixtures/benefits.yml new file mode 100644 index 0000000..c63aac0 --- /dev/null +++ b/test/fixtures/benefits.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/unit/benefits_test.rb b/test/unit/benefits_test.rb new file mode 100644 index 0000000..5104350 --- /dev/null +++ b/test/unit/benefits_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class BenefitsTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end