I have exhausted all thoughts on how to actually get jquery file upload to work, so screw it, I am just going to make something homegrown for tomorrow
This commit is contained in:
@@ -15,6 +15,8 @@ group :development do
|
|||||||
gem 'rb-fsevent'
|
gem 'rb-fsevent'
|
||||||
gem 'guard-shell'
|
gem 'guard-shell'
|
||||||
gem 'bundler-audit'
|
gem 'bundler-audit'
|
||||||
|
gem 'guard-livereload'
|
||||||
|
gem 'rack-livereload'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -23,7 +25,7 @@ end
|
|||||||
group :assets do
|
group :assets do
|
||||||
gem 'sass-rails', '~> 3.2.3'
|
gem 'sass-rails', '~> 3.2.3'
|
||||||
gem 'coffee-rails', '~> 3.2.1'
|
gem 'coffee-rails', '~> 3.2.1'
|
||||||
|
gem 'jquery-fileupload-rails'
|
||||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||||
# gem 'therubyracer', :platforms => :ruby
|
# gem 'therubyracer', :platforms => :ruby
|
||||||
|
|
||||||
|
|||||||
+18
-1
@@ -52,7 +52,11 @@ GEM
|
|||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.6.2)
|
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)
|
erubis (2.7.0)
|
||||||
|
eventmachine (1.0.3)
|
||||||
execjs (1.4.0)
|
execjs (1.4.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
fastercsv (1.5.5)
|
fastercsv (1.5.5)
|
||||||
@@ -68,15 +72,23 @@ GEM
|
|||||||
guard-brakeman (0.6.3)
|
guard-brakeman (0.6.3)
|
||||||
brakeman (>= 1.8.2)
|
brakeman (>= 1.8.2)
|
||||||
guard (>= 1.1.0)
|
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-shell (0.5.1)
|
||||||
guard (>= 1.1.0)
|
guard (>= 1.1.0)
|
||||||
haml (4.0.2)
|
haml (4.0.2)
|
||||||
tilt
|
tilt
|
||||||
highline (1.6.16)
|
highline (1.6.16)
|
||||||
hike (1.2.2)
|
hike (1.2.2)
|
||||||
|
http_parser.rb (0.5.3)
|
||||||
i18n (0.6.1)
|
i18n (0.6.1)
|
||||||
journey (1.0.4)
|
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)
|
railties (>= 3.0, < 5.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
json (1.7.7)
|
json (1.7.7)
|
||||||
@@ -101,6 +113,8 @@ GEM
|
|||||||
rack (1.4.5)
|
rack (1.4.5)
|
||||||
rack-cache (1.2)
|
rack-cache (1.2)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
|
rack-livereload (0.3.15)
|
||||||
|
rack
|
||||||
rack-ssl (1.3.3)
|
rack-ssl (1.3.3)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.2)
|
rack-test (0.6.2)
|
||||||
@@ -172,10 +186,13 @@ DEPENDENCIES
|
|||||||
coffee-rails (~> 3.2.1)
|
coffee-rails (~> 3.2.1)
|
||||||
foreman
|
foreman
|
||||||
guard-brakeman
|
guard-brakeman
|
||||||
|
guard-livereload
|
||||||
guard-shell
|
guard-shell
|
||||||
|
jquery-fileupload-rails
|
||||||
jquery-rails
|
jquery-rails
|
||||||
minitest
|
minitest
|
||||||
powder
|
powder
|
||||||
|
rack-livereload
|
||||||
rails (= 3.2.13)
|
rails (= 3.2.13)
|
||||||
rb-fsevent
|
rb-fsevent
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
|
|||||||
@@ -11,3 +11,12 @@ end
|
|||||||
guard :shell do
|
guard :shell do
|
||||||
watch(%r{^Gemfile|Gemfile.lock$}) { system("bundle-audit")}
|
watch(%r{^Gemfile|Gemfile.lock$}) { system("bundle-audit")}
|
||||||
end
|
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
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
//= require jquery.validate.js
|
//= require jquery.validate.js
|
||||||
//= require jquery.snippet.js
|
//= require jquery.snippet.js
|
||||||
//= require jquery.easy-pie-chart.js
|
//= require jquery.easy-pie-chart.js
|
||||||
|
//= require jquery-fileupload/basic
|
||||||
|
//= require jquery-fileupload/vendor/tmpl
|
||||||
|
|
||||||
function rubyCodeFormat() {
|
function rubyCodeFormat() {
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
*
|
*
|
||||||
*= require_self
|
*= require_self
|
||||||
*= require_tree .
|
*= require_tree .
|
||||||
|
*= require jquery.fileupload-ui
|
||||||
*/
|
*/
|
||||||
|
|
||||||
p.desc {
|
p.desc {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class BenefitFormsController < ApplicationController
|
class BenefitFormsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@benefits = Benefits.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -14,6 +15,10 @@ class BenefitFormsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def upload
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
# More secure version
|
# More secure version
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class Benefits < ActiveRecord::Base
|
||||||
|
|
||||||
|
def self.save(file)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -52,20 +52,72 @@
|
|||||||
<!-- End Widget Body -->
|
<!-- End Widget Body -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<div class="widget">
|
||||||
|
<div class="widget-header">
|
||||||
|
<div class="title">
|
||||||
|
<span class="fs1" aria-hidden="true" data-icon=""></span> Health Insurance
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Begin Widget Body -->
|
||||||
|
<div class="widget-body">
|
||||||
|
<div>
|
||||||
|
<h2>Upload file</h2>
|
||||||
|
<%= form_for @benefits, :url => upload_path, :html => { :action => "upload", :multipart => true, :id => "fi" } do |f| %>
|
||||||
|
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<!-- The fileinput-button span is used to style the file input field as button -->
|
||||||
|
<span class="btn btn-success fileinput-button">
|
||||||
|
<i class="icon-plus icon-white"></i>
|
||||||
|
<span>Add files...</span>
|
||||||
|
<%= f.file_field :upload %>
|
||||||
|
</span>
|
||||||
|
<button id="start_upload" type="submit" class="btn btn-primary start">
|
||||||
|
<i class="icon-upload icon-white"></i>
|
||||||
|
<span><%= t('fileupload.start_upload') %></span>
|
||||||
|
</button>
|
||||||
|
<input type="checkbox" class="toggle">
|
||||||
|
</div>
|
||||||
|
<div class="span5">
|
||||||
|
<!-- The global progress bar -->
|
||||||
|
<div class="progress progress-success progress-striped active fade">
|
||||||
|
<div class="bar" style="width:0%;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- The loading indicator is shown during image processing -->
|
||||||
|
<div class="fileupload-loading"></div>
|
||||||
|
<br>
|
||||||
|
<!-- The table listing the files available for upload/download -->
|
||||||
|
<table class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody>
|
||||||
|
</table>
|
||||||
|
<% end %>
|
||||||
|
<div id="progress">
|
||||||
|
<div class="bar" style="width: 0%;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
|
||||||
function makeActive(){
|
function makeActive(){
|
||||||
$('li[id="benefit_forms"]').addClass('active');
|
$('li[id="benefit_forms"]').addClass('active');
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(makeActive)
|
$(document).ready(
|
||||||
|
makeActive
|
||||||
|
);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -34,4 +34,13 @@ Railsgoat::Application.configure do
|
|||||||
|
|
||||||
# Expands the lines which load the assets
|
# Expands the lines which load the assets
|
||||||
config.assets.debug = true
|
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
|
end
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ resources :users do
|
|||||||
end
|
end
|
||||||
|
|
||||||
get "download" => "benefit_forms#download"
|
get "download" => "benefit_forms#download"
|
||||||
|
post "upload" => "benefit_forms#upload"
|
||||||
|
|
||||||
resources :tutorials do
|
resources :tutorials do
|
||||||
collection do
|
collection do
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
class CreateBenefits < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :benefits do |t|
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
+6
-1
@@ -11,7 +11,12 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# 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|
|
create_table "paid_time_offs", :force => true do |t|
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
|
|||||||
Vendored
+11
@@ -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
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class BenefitsTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user