quick_script 0.0.51 → 0.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
| @@ -252,7 +252,9 @@ jQuery.ajax_qs = (opts)-> | |
| 252 252 | 
             
            			else
         | 
| 253 253 | 
             
            				opts.error() if opts.error?
         | 
| 254 254 | 
             
            	req.upload.addEventListener('error', opts.error) if opts.error?
         | 
| 255 | 
            -
            	 | 
| 255 | 
            +
            	if opts.progress?
         | 
| 256 | 
            +
            		req.upload.addEventListener 'progress', (ev)->
         | 
| 257 | 
            +
            			opts.progress(ev, Math.floor( ev.loaded / ev.total * 100 ))
         | 
| 256 258 | 
             
            	req.open opts.type, opts.url, true
         | 
| 257 259 | 
             
            	req.setRequestHeader 'X-CSRF-Token', jQuery('meta[name="csrf-token"]').attr('content')
         | 
| 258 260 | 
             
            	req.send(data)
         | 
| @@ -318,12 +320,12 @@ class @Model | |
| 318 320 | 
             
            		if (@model_state() != ko.modelStates.READY)
         | 
| 319 321 | 
             
            			console.log("Save postponed.")
         | 
| 320 322 | 
             
            			return
         | 
| 321 | 
            -
            		opts = @ | 
| 323 | 
            +
            		opts = @toAPI(fields)
         | 
| 322 324 | 
             
            		opts['id'] = @id()
         | 
| 323 325 | 
             
            		@adapter.save
         | 
| 324 326 | 
             
            			data: opts
         | 
| 325 | 
            -
            			progress : (ev)=>
         | 
| 326 | 
            -
            				@saveProgress(  | 
| 327 | 
            +
            			progress : (ev, prog)=>
         | 
| 328 | 
            +
            				@saveProgress( prog )
         | 
| 327 329 | 
             
            			success : (resp)=>
         | 
| 328 330 | 
             
            				@handleData(resp.data)
         | 
| 329 331 | 
             
            				callback(resp) if callback?
         | 
| @@ -363,6 +365,17 @@ class @Model | |
| 363 365 | 
             
            			else
         | 
| 364 366 | 
             
            				obj[prop] = @[prop]()
         | 
| 365 367 | 
             
            		obj
         | 
| 368 | 
            +
            	toAPI : (flds)=>
         | 
| 369 | 
            +
            		flds ||= @fields
         | 
| 370 | 
            +
            		obj = {}
         | 
| 371 | 
            +
            		for prop in flds
         | 
| 372 | 
            +
            			if typeof(@[prop].toAPI) == 'function'
         | 
| 373 | 
            +
            				obj[prop] = @[prop].toAPI()
         | 
| 374 | 
            +
            			else if typeof(@[prop].toJS) == 'function'
         | 
| 375 | 
            +
            				obj[prop] = @[prop].toJS()
         | 
| 376 | 
            +
            			else
         | 
| 377 | 
            +
            				obj[prop] = @[prop]()
         | 
| 378 | 
            +
            		obj
         | 
| 366 379 | 
             
            	toJSON : (flds)=>
         | 
| 367 380 | 
             
            		JSON.stringify(@toJS(flds))
         | 
| 368 381 | 
             
            	absorb : (model) =>
         | 
| @@ -389,10 +402,11 @@ class @FileModel extends @Model | |
| 389 402 | 
             
            			, this
         | 
| 390 403 | 
             
            		@input.isImage = ->
         | 
| 391 404 | 
             
            			if @input.present() then @input.file().type.match('image.*') else false
         | 
| 405 | 
            +
            		@input.clear = -> @input.files([])
         | 
| 392 406 | 
             
            	reset : ->
         | 
| 393 407 | 
             
            		super
         | 
| 394 408 | 
             
            		@input.files([])
         | 
| 395 | 
            -
            	 | 
| 409 | 
            +
            	toAPI : =>
         | 
| 396 410 | 
             
            		@input.file()
         | 
| 397 411 |  | 
| 398 412 | 
             
            class @Collection
         | 
| @@ -544,6 +558,11 @@ class @Collection | |
| 544 558 | 
             
            		for item in @items()
         | 
| 545 559 | 
             
            			objs.push(item.toJS())
         | 
| 546 560 | 
             
            		objs
         | 
| 561 | 
            +
            	toAPI : =>
         | 
| 562 | 
            +
            		objs = []
         | 
| 563 | 
            +
            		for item in @items()
         | 
| 564 | 
            +
            			objs.push(item.toAPI())
         | 
| 565 | 
            +
            		objs
         | 
| 547 566 |  | 
| 548 567 | 
             
            Collection.REPLACE = 0
         | 
| 549 568 | 
             
            Collection.INSERT = 1
         | 
| @@ -635,7 +654,7 @@ class @ModelAdapter | |
| 635 654 | 
             
            			success : opts.success
         | 
| 636 655 | 
             
            			error : opts.error
         | 
| 637 656 | 
             
            	send : (opts)->
         | 
| 638 | 
            -
            		$. | 
| 657 | 
            +
            		$.ajax_qs
         | 
| 639 658 | 
             
            			type : 'POST'
         | 
| 640 659 | 
             
            			url : opts.url
         | 
| 641 660 | 
             
            			data : opts.data
         | 
| @@ -674,9 +693,15 @@ class @AccountAdapter | |
| 674 693 | 
             
            	sendInviteCode : (code, callback)->
         | 
| 675 694 | 
             
            		$.post @enter_code_url, {code : code}, (resp) =>
         | 
| 676 695 | 
             
            			callback(resp)
         | 
| 677 | 
            -
            	save : (opts | 
| 678 | 
            -
            		 | 
| 679 | 
            -
             | 
| 696 | 
            +
            	save : (opts) ->
         | 
| 697 | 
            +
            		opts ||= {}
         | 
| 698 | 
            +
            		$.ajax_qs
         | 
| 699 | 
            +
            			type : 'POST'
         | 
| 700 | 
            +
            			url : @save_url
         | 
| 701 | 
            +
            			data : opts.data
         | 
| 702 | 
            +
            			progress : opts.progress
         | 
| 703 | 
            +
            			success : opts.success
         | 
| 704 | 
            +
            			error : opts.error
         | 
| 680 705 | 
             
            	resetPassword : (callback)->
         | 
| 681 706 | 
             
            		@is_loading(true)
         | 
| 682 707 | 
             
            		opts = {}
         | 
| @@ -684,6 +709,16 @@ class @AccountAdapter | |
| 684 709 | 
             
            		$.post @reset_url, opts, (resp) =>
         | 
| 685 710 | 
             
            				@is_loading(false)
         | 
| 686 711 | 
             
            				callback(resp) if callback?
         | 
| 712 | 
            +
            	send : (opts)->
         | 
| 713 | 
            +
            		$.ajax_qs
         | 
| 714 | 
            +
            			type : 'POST'
         | 
| 715 | 
            +
            			url : opts.url
         | 
| 716 | 
            +
            			data : opts.data
         | 
| 717 | 
            +
            			progress : opts.progress
         | 
| 718 | 
            +
            			success : opts.success
         | 
| 719 | 
            +
            			error : opts.error
         | 
| 720 | 
            +
            	add_method : (fn_name, fn)->
         | 
| 721 | 
            +
            		@[fn_name] = fn.bind(this)
         | 
| 687 722 |  | 
| 688 723 | 
             
            class @AppView extends @View
         | 
| 689 724 | 
             
            	constructor : (user_model)->
         | 
    
        data/lib/quick_script/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: quick_script
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 119
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 0
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.0. | 
| 9 | 
            +
              - 52
         | 
| 10 | 
            +
              version: 0.0.52
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Alan Graham
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2012-03- | 
| 18 | 
            +
            date: 2012-03-30 00:00:00 Z
         | 
| 19 19 | 
             
            dependencies: []
         | 
| 20 20 |  | 
| 21 21 | 
             
            description: Framework for single-page web applications
         |