'use strict';

var Marty = require( 'marty' );
var Constants = require( '../constants/TableFormConstants' );


module.exports = Marty.createActionCreators({
    id: 'TableFormActions',

    changePage: function ( pageNum ) {
        this.dispatch( Constants.CHANGE_TABLE_PAGE, pageNum );
    },

    editTableRow: function ( row ) {
        this.dispatch( Constants.EDIT_TABLE_ROW, row );
    }
});
var Marty = require('marty');
var RoomUtils = require('../utils/roomUtils');
var RoomConstants = require('../constants/roomConstants');

var RoomActionCreators = Marty.createActionCreators({
  id: 'RoomActionCreators',
  createRoom: function (name) {
    var room = RoomUtils.createRoom(name);

    this.dispatch(RoomConstants.RECEIVE_ROOMS, room);

    this.app.roomsAPI.createRoom(room).then(function (res) {
      this.dispatch(RoomConstants.UPDATE_ROOM, room.cid, res.body);
    }.bind(this))
  },
  receiveRooms: function (rooms) {
    this.dispatch(RoomConstants.RECEIVE_ROOMS, rooms);
  }
});

module.exports = RoomActionCreators;
var Marty = require('marty');
var sowForTab = require('../sow');
var PageConstants = require('../constants/pageConstants');

var PageActionCreators = Marty.createActionCreators({
  id: 'Page',
  pageLoaded: function (tabId, sow) {
    this.dispatch(PageConstants.PAGE_LOADED, tabId, sow);
    this.connections.Devtools.send(tabId, {
      type: 'PAGE_LOADED',
      payload: sowForTab(tabId)
    });
  },
  pageUnloaded: function (tabId) {
    this.dispatch(PageConstants.PAGE_UNLOADED, tabId);
    this.connections.Devtools.send(tabId, {
      type: 'PAGE_UNLOADED'
    });
  }
});

module.exports = PageActionCreators;
var Marty                   = require('marty');
var DeclinedTaskConstants   = require('../constants/DeclinedTasksConstants');
var DeclinedTasksAPI        = require('../sources/DeclinedTasksAPI');


var Actions = Marty.createActionCreators({
    declineTask: DeclinedTaskConstants['DECLINE_TASK_CLICK'](function (task,key) {
        DeclinedTasksAPI.declineTask(task,key);
    }),
    removeDeclinedTasks: DeclinedTaskConstants['REMOVE_DECLINED_TASKS'](function (tasks) {
        DeclinedTasksAPI.removeDeclinedTasks(tasks);
    }),
    invalidateTasks: DeclinedTaskConstants['INVALIDATE_TASKS'](function (tasks) {
        this.dispatch(tasks);
    })
});
module.exports = Actions;
var Marty = require('marty');
var TodoListConstants = require('../constants/TodoListConstants');

var TodoListActionCreators = Marty.createActionCreators({
  id: 'TodoListActionCreators',
  createItem: function (content, done) {
    this.dispatch(TodoListConstants.CREATE, content, done);
  },
  updateItem: function (id, done) {
    this.dispatch(TodoListConstants.UPDATE, id, done);
  },
  clearDone: function () {
    this.dispatch(TodoListConstants.CLEAR_DONE);
  }
});

module.exports = TodoListActionCreators;
var Marty = require('marty');
var ClientActions = require('../constants/Constants').ClientActions;
var ClientApi = require('../sources/ClientApi');

var ClientActionCreators = Marty.createActionCreators({
  loadClients(){
    this.app.ClientApi.getClients();
  },
  updateClient(id, data){
    ClientApi.updateClient(id, data);
  }
});

module.exports = ClientActionCreators;
Example #7
0
var Marty                   = require('marty');
var CaseConstants   		= require('../constants/CaseConstants');
var CaseAPI        			= require('../sources/CaseAPI');

var Actions = Marty.createActionCreators({
    invalidateCase: CaseConstants['INVALIDATE_CASE'](function (caseNumber) {
        this.dispatch(caseNumber);
    })
});
module.exports = Actions;
var Marty           	= require('marty');
var CommentConstants   	= require('../constants/CommentConstants');

var Actions = Marty.createActionCreators({
    receiveComments: CommentConstants['RECEIVE_COMMENTS'](function (caseNumber, comments) {
    	this.dispatch(caseNumber, comments);
    })
});
module.exports = Actions;
var Marty = require('marty');
var MessageUtils = require('../utils/messageUtils');
var MessagesAPI = require('../sources/messagesAPI');
var MessageConstants = require('../constants/messageConstants');

var MessageActionCreators = Marty.createActionCreators({
  id: 'MessageActionCreators',
  sendMessage: function (text, roomId) {
    var message = MessageUtils.createMessage(text, roomId);

    this.dispatch(MessageConstants.RECIEVE_MESSAGES, roomId, message);

    MessagesAPI.createMessage(message).then(function (res) {
      this.dispatch(MessageConstants.UPDATE_MESSAGE, message.cid, res.body);
    }.bind(this))
  },
  recieveMessages: function (roomId, messages) {
    this.dispatch(MessageConstants.RECIEVE_MESSAGES, roomId, messages);
  }
});

module.exports = MessageActionCreators;
var Marty = require('marty');
var Router = require('../router');

var NavigationActionCreators = Marty.createActionCreators({
  displayName: 'Navigation',
  navigateHome: function () {
    navigateTo('home');
  }
});

function navigateTo(route, params) {
  require('../router').transitionTo(route, params || {});
}

module.exports = NavigationActionCreators;
var sow = require('../sow');
var Marty = require('marty');
var MartyStore = require('../stores/martyStore');
var DevtoolsConstants = require('../constants/devtoolsConstants');

var DevtoolsActionCreators = Marty.createActionCreators({
  id: 'Devtools',
  devtoolsLoaded: function (tabId) {
    this.dispatch(DevtoolsConstants.LOADED, tabId);

    // If marty has already been on the page, then just
    // send the sow straight away
    if (MartyStore.hasMartyBeenFoundInTab(tabId)) {
      this.connections.Devtools.send(tabId, {
        type: 'PAGE_LOADED',
        payload: sow(tabId)
      });
    }
  }
});

module.exports = DevtoolsActionCreators;