R
R
Roma Antonyuk2017-09-25 15:14:21
Angular
Roma Antonyuk, 2017-09-25 15:14:21

How to solve problem with coffeescript and gulp?

There is a project written in angularJs and coffeescript.
There you need to finish the feature.
But with gulp default

{ C:\OpenServer\domains\ps-angular-js-frontend\app\coffee\modules\accounts\main.coffee:3:17: error: unexpected identifier
  MenuProvider.addItem (UserType, AccessRules)->
 ^^^^^^^^^^^^
  location: { first_line: 2, first_column: 16, last_line: 2, last_column: 27 },
  toString: [Function: syntaxErrorToString],
  filename: 'C:\\OpenServer\\domains\\ps-angular-js-frontend\\app\\coffee\\modules\\accounts\\main.coffee',
  name: 'SyntaxError',
  message: 'unexpected identifier',
  stack: 'C:\\OpenServer\\domains\\ps-angular-js-frontend\\app\\coffee\\modules\\accounts\\main.coffee:3:17: error: unexpected identifier\n  ### Menu ###\r  MenuProvider.addItem (UserType, AccessRules)->\r\n              \r ^^^^^^^^^^^^',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-coffee' }

main.coffee file
accounts = ($injector, $stateProvider, MenuProvider) ->

  ### Menu ###
  #= require menu.coffee

  templateUrl = 'views/accounts/

  dependencies =
    templateUrl: templateUrl
    currencyView: tools.currencyView
    endpointFromUrl: endpointFromUrl
    showModal: showModal
    loadById: loadById


  #Controllers

  cashbookCtrl = ($scope, $injector, FormusContainer)->
    alias = 'cashbook'
    $scope.form = form = FormusContainer.get 'cashbookFilter'
    form.data.from = (new Date()).toShortString()
    form.data.to = (new Date()).toShortString()
    $injector.invoke addReportButtonHandler, this, ($scope: $scope, form: form, alias: alias)

  receiptsLedgerCtrl = ($scope, $injector, FormusContainer)->
    alias = 'receipts-ledger'
    $scope.form = form = FormusContainer.get 'receiptsLedgerFilter'
    form.data.from = (new Date()).toShortString()
    form.data.to = (new Date()).toShortString()
    $scope.$watch "form.data.selectBy", (newValue) ->
      switch newValue
        when 1
          $scope.form.fieldset.fields[0].fields[1].hide = false
          $scope.form.fieldset.fields[0].fields[2].hide = true
          $scope.form.fieldset.fields[0].fields[3].hide = true
          $scope.form.fieldset.fields[1].fields[1].hide = false
        when 2
          $scope.form.fieldset.fields[0].fields[1].hide = true
          $scope.form.fieldset.fields[0].fields[2].hide = false
          $scope.form.fieldset.fields[0].fields[3].hide = false
          $scope.form.fieldset.fields[1].fields[1].hide = true
          $scope.form.data.includeDbs = 0

    $injector.invoke addReportButtonHandler, this, ($scope: $scope, form: form, alias: alias)

  #Routes
  $stateProvider
  .state 'accounts',
    parent: 'base'
    url: 'accounts'
    abstract: true
    resolve:
      url: -> 'payments'
      payments: endpointFromUrl
      premises: (Restangular)-> Restangular.all 'premises'
      premisesList: premisesList
      users: (Restangular)-> Restangular.all 'users'
      reservations: (Restangular)-> Restangular.all 'reservations'

    templateUrl: templateUrl + 'base.html'
    data:
      unit: 'accounts'
  .state 'accounts.index',
    url: ''

  .state 'accounts.cashbook',
    url: '/cashbook'
    data:
      section: 'reports'
      subitem: 'cashbook'
      access:
        only: ['administrators']
        fn: (UserType, AccessRules)-> (UserType.isAuditor() && AccessRules.get('auditors', 'accounts', 'trustAccount'))
    controller: cashbookCtrl
    templateUrl: templateUrl + 'cashbook.html'

  .state 'accounts.receipts-ledger',
    url: '/receipts-ledger'
    data:
      section: 'reports'
      subitem: 'receipts-ledger'
      access:
        only: ['administrators']
        fn: (UserType, AccessRules)-> (UserType.isAuditor() && AccessRules.get('auditors', 'accounts', 'trustAccount'))
    controller: receiptsLedgerCtrl
    templateUrl: templateUrl + 'receipts-ledger.html'


  #= require trust.coffee
  $injector.invoke trust, this, dependencies

  #= require property.coffee
  $injector.invoke property, this, dependencies

  #= require misc.coffee
  $injector.invoke misc, this, dependencies

  #= require dbs.coffee
  $injector.invoke dbs, this, dependencies

  #= require agents.coffee
  $injector.invoke agents, this, dependencies

  #= require my-trust.coffee
  $injector.invoke myTrust, this, dependencies

  #= require expenses.coffee
  $injector.invoke expenses, this, dependencies

  #= require credits.coffee
  $injector.invoke credits, this, dependencies

  #= require reconcile.coffee
  $injector.invoke reconcile, this, dependencies

  #= require reconciliations.coffee
  $injector.invoke reconciliations, this, dependencies

  #= require invoices.coffee
  $injector.invoke invoices, this, dependencies

  #= require transaction.coffee
  $injector.invoke transaction, this, dependencies

  #= require report.coffee
  $injector.invoke report, this, dependencies

menu.coffee file
MenuProvider.addItem (UserType, AccessRules)->
  menu =
    name: 'accounts', icon: 'credit-card', title: 'Financials', order: 11,
    items: [
      (name: 'trust',       icon: 'shield',       title: 'Trust',               sref: 'accounts.trust')
      (name: 'agents',      icon: 'shield',       title: 'Agent',               sref: 'accounts.agents.list')
      (name: 'expenses',    icon: 'shield',       title: 'Account Expenses',    sref: 'accounts.expenses.list')
      (name: 'credits',     icon: 'money',        title: 'Account Credits',     sref: 'accounts.credits.list')
      (name: 'invoices',    icon: 'list-alt',     title: 'Account Invoices',    sref: 'accounts.invoices')
      (name: 'reconcile',   icon: 'minus-circle', title: 'Generate Accounts',   sref: 'accounts.reconcile.index')
      (name: 'reports',     icon: 'file-text-o',  title: 'Reports', items: [
        (name: 'property',              icon: 'home',           title: 'Premises Pro Forma',    sref: 'accounts.property')
        (name: 'cashbook',              icon: 'file-text',      title: 'Cashbook',              sref: 'accounts.cashbook')
        (name: 'receipts-ledger',       icon: 'file-text',      title: 'Receipts Ledger',       sref: 'accounts.receipts-ledger')
        (name: 'trial-balance',         icon: 'file-text',      title: 'Trial Balance',         sref: 'accounts.report({alias:"trial-balance"})')
        (name: 'owner-summary',         icon: 'file-text',      title: 'Owner Summary',         sref: 'accounts.report({alias:"owner-summary"})')
        (name: 'misc-summary',          icon: 'file-text',      title: 'Other Transactions',    sref: 'accounts.report({alias:"misc-summary"})')
        (name: 'past-period-accounts',  icon: 'floppy-o',       title: 'Past Period Accounts',  sref: 'accounts.reconcile.past')
        (name: 'accounts-summary',      icon: 'folder-open-o',  title: 'Accounts Summary',      sref: 'accounts.reconciliations')
      ])
      (name: 'transactionSummary',   icon: 'shield', title: 'CC Transactions',   sref: 'accounts.transactions')
    ]

I didn't write.
As far as I understand, the problem is with the comment and the connection of the menu.
Can you suggest how to solve it?
The company said not to edit someone else's code.
And you need to make a build.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question