Skip to content

Commit

Permalink
make code lines < 80 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Rousseau committed Dec 14, 2014
1 parent abece0f commit c77498d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 12 deletions.
29 changes: 19 additions & 10 deletions client/app/views/new_bank.coffee
Expand Up @@ -25,12 +25,13 @@ module.exports = class NewBankView extends BaseView
formInputWebsite.removeClass("hide")
else
formInputWebsite.addClass("hide")

$("#inputWebsite").empty()
for website in websites
for website in websites
$("#formInputWebsite").removeClass("hide")
$("#inputWebsite").append("<option value=\"" + website.hostname + "\">" + website.label + "</option>")

$("#inputWebsite").append(
"<option value=\"#{website.hostname}\">#{website.label}</option>")

saveBank: (event) ->
event.preventDefault()

Expand All @@ -40,7 +41,8 @@ module.exports = class NewBankView extends BaseView

oldText = button.html()
button.addClass "disabled"
button.html window.i18n("verifying") + "<img src='./loader_green.gif' />"
button.html(
"#{window.i18n("verifying")} <img src='./loader_green.gif' />")

button.removeClass 'btn-warning'
button.addClass 'btn-success'
Expand All @@ -57,12 +59,14 @@ module.exports = class NewBankView extends BaseView

bankAccess.save data,
success: (model, response, options) ->
button.html window.i18n("sent") + " <img src='./loader_green.gif' />"
button.html(
"#{window.i18n("sent")} <img src='./loader_green.gif' />")

# fetch the new accounts:
bank = window.collections.allBanks.get(data.bank)
if bank?
console.log "Fetching for new accounts in bank" + bank.get("name")
console.log(
"Fetching new accounts for bank #{bank.get("name")}")
bank.accounts.trigger "loading"
bank.accounts.fetch()

Expand All @@ -71,7 +75,8 @@ module.exports = class NewBankView extends BaseView
button.removeClass "disabled"
button.html oldText

window.activeObjects.trigger "new_access_added_successfully", model
window.activeObjects.trigger(
"new_access_added_successfully", model)

setTimeout () ->
$("#add-bank-window").modal("hide")
Expand All @@ -85,10 +90,14 @@ module.exports = class NewBankView extends BaseView
button.addClass 'btn-warning'

if xhr?.status? and xhr.status is 409
@$(".message-modal").html "<div class='alert alert-danger'>" + window.i18n("access already exists") + "</div>"
accessString = window.i18n("access already exists")
@$(".message-modal").html(
"<div class='alert alert-danger'>#{accessString}</div>")
button.html window.i18n("access already exists button")
else
@$(".message-modal").html "<div class='alert alert-danger'>" + window.i18n("error_check_credentials") + "</div>"
@$(".message-modal").html(
errorString = window.i18n("error_check_credentials")
"<div class='alert alert-danger'>#{errorString}</div>")
button.html window.i18n("error_check_credentials_btn")

getRenderData: ->
Expand Down
8 changes: 6 additions & 2 deletions server/init.coffee
@@ -1,14 +1,18 @@
module.exports = (app, server, callback) ->

Bank = require './models/bank'

# Bank initialization
Bank.all (err, banks) ->
if err or banks?.length is 0 # if there aren't any banks
async = require 'async'
bankList = require "../tests/fixtures/banks-all.json"
process = (bank, callback) ->
Bank.create name: bank.name, uuid: bank.uuid, websites: bank.websites, (err) ->
newBank =
name: bank.name
uuid: bank.uuid
websites: bank.websites
Bank.create newBank, (err) ->
if err?
callback err
else
Expand Down

0 comments on commit c77498d

Please sign in to comment.