export function formatAuthorsForDisplay(immtblAuthors, fieldMap = {id: 'id', fullName: 'fullName'}) { if (!immtblAuthors || !Immutable.Iterable.isIterable(immtblAuthors)) { return; } return immtblAuthors.map(author => { return Map().withMutations(o => { o.set(fieldMap.id, author.get('id')); o.set(fieldMap.fullName, author.get('firstName') + ' ' + author.get('lastName')); }); }); }
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses').map(openCourseCntr => { if (openCourseCntr.get('openCourse').get('id') === action.updatedOpenCourseErrorCntr.openCourseId) { return openCourseCntr.set('statusText', action.updatedOpenCourseErrorCntropenCourseCntr.statusText) .set('ajaxStart', action.updatedOpenCourseErrorCntropenCourseCntr.ajaxStart) .set('ajaxEnd', action.updatedOpenCourseErrorCntropenCourseCntr.ajaxEnd); } return openCourseCntr; })); })
function add_keyword(keyword){ var id = Date.now(); var _keywords = _state.get('keywords'); keyword = keyword.trim(); if(keyword != '' && _keywords.indexOf(keyword) < 0){ _keywords.push(keyword); _state = _state.set('keywords',_keywords); AppActions.detect_google_position(keyword, _state.get('domain')); return true; } return false; }
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses') .push( initialOpenCourseCntr.openCourseCntr.set('openCourse', action.newOpenCourseCntr.openCourse) .set('courseName', action.newOpenCourseCntr.courseName) .set('statusText', action.newOpenCourseCntr.statusText) .set('ajaxStart', action.newOpenCourseCntr.ajaxStart) .set('ajaxEnd', action.newOpenCourseCntr.ajaxEnd) ) .sort(sortByCourseName) ); })
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses').map(openCourseCntr => { // Set the OpenCourseContainer object's updated message using Moment return openCourseCntr.withMutations(ocCntr => { ocCntr.set('updatedMsg', moment(ocCntr.get('ajaxEnd'), 'YYYY-MM-DD:HH:mm:ss.SSS').fromNow()); // Turn off the chart animation for the updated message refresh ocCntr.set('animateChart', false); }); })); })
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses').map(openCourseCntr => { // Set the OpenCourseContainer object's updated message using Moment if (openCourseCntr.get('openCourse').get('id') === action.openCourseIdAndSecs.openCourseId) { return openCourseCntr.set('animateChart', false).set('refreshSeconds', action.openCourseIdAndSecs.seconds); } return openCourseCntr.set('animateChart', false); })); })
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses').map(openCourseCntr => { // Find matching OpenCourseContainer object and return the new OpenCourseContainer object. if (openCourseCntr.get('openCourse').get('id') === action.deleteOpenCourseErrorCntr.openCourseId) { return openCourseCntr.set('statusText', action.deleteOpenCourseErrorCntr.statusText) .set('ajaxStart', action.deleteOpenCourseErrorCntr.ajaxStart) .set('ajaxEnd', action.deleteOpenCourseErrorCntr.ajaxEnd); } return openCourseCntr; })); })
state.openCoursesCntr.withMutations(openCoursesCntr => { openCoursesCntr.set('allOpenCourses', openCoursesCntr.get('allOpenCourses').map(openCourseCntr => { // Set the OpenCourseContainer's "updating" property to ture if (openCourseCntr.get('openCourse').get('id') === action.openCourseId) { return openCourseCntr.set('updating', true).set('animateChart', false); } return openCourseCntr.set('animateChart', false); })); })