Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
Ti.include('/app/views/code_history/code_history_table_view_window.js') | |||
Ti.include('/app/models/splash_store.js') | |||
|
|||
class CodeHistoryController extends Citrus.Controller | |||
scans: [] | |||
page: 0 | |||
|
|||
constructor: () -> | |||
d "Code history controller being created" | |||
@window = new Citrus.CodeHistoryTableViewWindow(this) | |||
@window.win.addEventListener("focus", (e) => this.focused(e)) | |||
|
|||
focused: (e) -> | |||
d "Code history being shown." | |||
if @scans.length == 0 | |||
this.showNextPage() | |||
|
|||
showNextPage: () -> | |||
@window.showLoading() | |||
@window.hideLoading() | |||
# Get scans for page and add to scans array | |||
# Add new scans to window | |||
|
|||
Citrus.CodeHistoryController = CodeHistoryController |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,3 @@ | |||
class Controller | class Controller extends Citrus.Object | ||
|
|
||
Citrus.Controller = Controller | Citrus.Controller = Controller |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,55 +1,54 @@ | |||
class AccountSet extends Citrus.Object | class AccountSet extends Citrus.Object | ||
|
|||
constructor: () -> | constructor: () -> | ||
@accounts = [] | @accounts = [] | ||
|
|||
this.load() | this.load() | ||
|
|||
# Loads the account set from the app properties | # Loads the account set from the app properties | ||
load: -> | load: -> | ||
# Ti.API.debug("Loading accounts from : ") | # Ti.API.debug("Loading accounts from : ") | ||
# Ti.API.debug(Ti.App.Properties.getString("CitrusAccounts")) | # Ti.API.debug(Ti.App.Properties.getString("CitrusAccounts")) | ||
|
|||
return [] unless Ti.App.Properties.hasProperty(this.key()) | return [] unless Ti.App.Properties.hasProperty(this.key()) | ||
try | try | ||
datas = JSON.parse(Ti.App.Properties.getString(this.key())) | datas = JSON.parse(Ti.App.Properties.getString(this.key())) | ||
catch e | catch e | ||
Ti.API.error("Error parsing account set JSON from properties: ") | Ti.API.error("Error parsing account set JSON from properties: ") | ||
Ti.API.error(e) | Ti.API.error(e) | ||
return false | return false | ||
|
|||
datas ?= [] | datas ?= [] | ||
accounts = [] | accounts = [] | ||
for datum in datas | for datum in datas | ||
account = Citrus.PersistedObject.loadFromPersistable(datum) | account = Citrus.PersistedObject.loadFromPersistable(datum) | ||
if account | if account | ||
Ti.API.info("Loaded "+account.type+" from persistable.") | Ti.API.info("Loaded "+account.type+" from persistable.") | ||
accounts.push account | accounts.push account | ||
|
|||
@accounts = accounts | @accounts = accounts | ||
return @accounts | return @accounts | ||
|
|||
# Persists the account set so the app can be closed. Works by serializing the accounts | # Persists the account set so the app can be closed. Works by serializing the accounts | ||
# to JSON and then saving in the app properties. | # to JSON and then saving in the app properties. | ||
save: -> | save: -> | ||
Ti.API.debug("Saving accounts store.") | Ti.API.debug("Saving accounts store.") | ||
persistable_accounts = [] | persistable_accounts = [] | ||
for account in @accounts | for account in @accounts | ||
persistable_accounts.push(account.persistable()) | persistable_accounts.push(account.persistable()) | ||
|
|||
|
|||
return Ti.App.Properties.setString(this.key(), JSON.stringify(persistable_accounts)) | return Ti.App.Properties.setString(this.key(), JSON.stringify(persistable_accounts)) | ||
|
|||
key: -> | key: -> | ||
return "CitrusAccounts" | return "CitrusAccounts" | ||
|
|
||
addAccount: (account) -> | addAccount: (account) -> | ||
Ti.API.debug("Account Added to store.") | Ti.API.debug("Account Added to store.") | ||
@accounts.push account | @accounts.push account | ||
this.save() | this.save() | ||
|
|||
removeAccount: (account) -> | removeAccount: (account) -> | ||
@accounts = _.without(@accounts, account) | @accounts = _.without(@accounts, account) | ||
this.save() | this.save() | ||
|
|||
Citrus.AccountSet = AccountSet | Citrus.AccountSet = AccountSet |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.