quick_script 0.11.1 → 0.11.4
Sign up to get free protection for your applications and to get access to all the features.
data/lib/quick_script/helpers.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module QuickScript
|
2
2
|
module Helpers
|
3
|
-
def jsify
|
4
|
-
raw (model ? model.to_api.to_json : 'null')
|
3
|
+
def jsify(model, opt=:full)
|
4
|
+
raw (model ? model.to_api(opt).to_json : 'null')
|
5
5
|
end
|
6
6
|
|
7
7
|
def jqtpl(name, &block)
|
@@ -20,7 +20,7 @@ module QuickScript
|
|
20
20
|
|
21
21
|
$(function() {
|
22
22
|
initKO();
|
23
|
-
CURRENT_USER = (#{jsify current_user});
|
23
|
+
CURRENT_USER = (#{jsify current_user, :me});
|
24
24
|
appViewModel = new #{app_model}();
|
25
25
|
initApp();
|
26
26
|
console.log('Initialized...');
|
data/lib/quick_script/version.rb
CHANGED
@@ -351,7 +351,7 @@
|
|
351
351
|
if self[field]?
|
352
352
|
self[field].reset()
|
353
353
|
else
|
354
|
-
self[field] = new model({}, self)
|
354
|
+
self[field] = new model({}, self, {is_submodel : true})
|
355
355
|
self.fields.pushOnce(field) if typeof(field) == "string"
|
356
356
|
|
357
357
|
ko.intercepter = (observable, write_fn, self) ->
|
@@ -437,7 +437,7 @@ jQuery.ajax_qs = (opts)->
|
|
437
437
|
class @Model
|
438
438
|
init : ->
|
439
439
|
extend : ->
|
440
|
-
constructor: (data, collection) ->
|
440
|
+
constructor: (data, collection, opts) ->
|
441
441
|
@fields = []
|
442
442
|
ko.addFields(['id'], '', this)
|
443
443
|
@events = {}
|
@@ -447,6 +447,8 @@ class @Model
|
|
447
447
|
@errors = ko.observable([])
|
448
448
|
@model_state = ko.observable(0)
|
449
449
|
@saveProgress = ko.observable(0)
|
450
|
+
if opts?
|
451
|
+
@is_submodel = opts.is_submodel
|
450
452
|
@extend()
|
451
453
|
@init()
|
452
454
|
@is_ready = ko.dependentObservable ->
|
@@ -990,31 +992,31 @@ class @AccountAdapter
|
|
990
992
|
@[prop] = val
|
991
993
|
login : (username, password, opts)->
|
992
994
|
opts.data = {} unless opts.data?
|
993
|
-
opts.url = @
|
995
|
+
opts.url = @login_url
|
994
996
|
opts.data[@login_key] = username
|
995
997
|
opts.data[@password_key] = password
|
996
998
|
@send opts
|
997
999
|
logout : (opts)->
|
998
1000
|
opts.data = {}
|
999
|
-
opts.url = @
|
1001
|
+
opts.url = @logout_url
|
1000
1002
|
@send opts
|
1001
1003
|
register : (data_opts, opts)->
|
1002
1004
|
opts.data = data_opts
|
1003
|
-
opts.url = @
|
1005
|
+
opts.url = @register_url
|
1004
1006
|
@send opts
|
1005
1007
|
sendInviteCode : (code, opts)->
|
1006
1008
|
opts.data = {code : code}
|
1007
|
-
opts.url = @
|
1009
|
+
opts.url = @enter_code_url
|
1008
1010
|
@send opts
|
1009
1011
|
save : (data_opts, opts) ->
|
1010
1012
|
opts.data = data_opts
|
1011
|
-
opts.url = @
|
1013
|
+
opts.url = @save_url
|
1012
1014
|
@send opts
|
1013
1015
|
load : (opts) ->
|
1014
1016
|
opts ||= {}
|
1015
1017
|
$.ajax_qs
|
1016
1018
|
type : 'POST'
|
1017
|
-
url : @
|
1019
|
+
url : @load_url
|
1018
1020
|
data : opts.data
|
1019
1021
|
progress : opts.progress
|
1020
1022
|
success : opts.success
|
@@ -1022,11 +1024,11 @@ class @AccountAdapter
|
|
1022
1024
|
resetPassword : (login, opts)->
|
1023
1025
|
opts.data = {}
|
1024
1026
|
opts.data[@login_key] = login
|
1025
|
-
opts.url = @
|
1027
|
+
opts.url = @reset_url
|
1026
1028
|
@send opts
|
1027
1029
|
activate: (token, opts)->
|
1028
1030
|
opts.data = {token : token}
|
1029
|
-
opts.url = @
|
1031
|
+
opts.url = @activate_url
|
1030
1032
|
@send opts
|
1031
1033
|
send : (opts)->
|
1032
1034
|
ModelAdapter.send(@host, opts)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 11
|
8
|
-
-
|
9
|
-
version: 0.11.
|
8
|
+
- 4
|
9
|
+
version: 0.11.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alan Graham
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-10-
|
17
|
+
date: 2012-10-25 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|