<commit_before>/* eslint-disable unicorn/filename-case */
'use strict';
const { banner } = require('./packages/core-js-builder/config');

process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = grunt => {
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-webpack');
  grunt.initConfig({
    pkg: grunt.file.readJSON('./package.json'),
    uglify: {
      build: {
        files: {
          './packages/core-js-bundle/minified.js': './packages/core-js-bundle/index.js',
        },
        options: {
          mangle: {
            keep_fnames: true,
          },
          compress: {
            keep_fnames: true,
            pure_getters: true,
          },
          output: {
            max_line_len: 32000,
          },
          ie8: true,
          sourceMap: true,
          banner,
        },
      },
    },
    clean: {
      'core-js': [
        './packages/core-js/LICENSE',
      ],
      'core-js-pure': [
        './packages/core-js-pure/*',
        '!./packages/core-js-pure/override',
        '!./packages/core-js-pure/.npmignore',
        '!./packages/core-js-pure/package.json',
        '!./packages/core-js-pure/README.md',
      ],
      'core-js-builder': [
        './packages/core-js-builder/LICENSE',
      ],
      'core-js-bundle': [
        './packages/core-js-bundle/LICENSE',
      ],
      'core-js-compat': [
        './packages/core-js-compat/data.json',
        './packages/core-js-compat/LICENSE',
      ],
      tests: [
        './tests/bundles/*',
      ],
    },
    copy: {
      'core-js': {
        files: [
          {
            expand: true,
            src: ['LICENSE'],
            dest: './packages/core-js/',
          },
        ],
      },
      'core-js-pure': {
        files: [
          {
            expand: true,
            src: ['LICENSE'],
            dest: './packages/core-js-pure/',
          }, {
            expand: true,
            cwd: './packages/core-js/',
            src: [
              'es/**',
              'features/**',
              'internals/**',
              'modules/**',
              'proposals/**',
              'stable/**',
              'stage/**',
              'web/**',
              'index.js',
              'configurator.js',
            ],
            dest: './packages/core-js-pure/',
          }, {
            expand: true,
            cwd: './packages/core-js-pure/override/',
            src: '**',
            dest: './packages/core-js-pure',
          },
        ],
      },
      'core-js-builder': {
        files: [
          {
            expand: true,
            src: ['LICENSE'],
            dest: './packages/core-js-builder/',
          },
        ],
      },
      'core-js-bundle': {
        files: [
          {
            expand: true,
            src: ['LICENSE'],
            dest: './packages/core-js-bundle/',
          },
        ],
      },
      'core-js-compat': {
        files: [
          {
            expand: true,
            src: ['LICENSE'],
            dest: './packages/core-js/',
          },
        ],
      },
    },
    karma: {
      options: {
        frameworks: ['qunit'],
        basePath: '.',
        browsers: ['HeadlessChrome', 'PhantomJS'],
        customLaunchers: {
          HeadlessChrome: {
            base: 'ChromeHeadless',
            flags: ['--no-sandbox', '--disable-setuid-sandbox'],
          },
        },
        singleRun: true,
      },
      tests: {
        files: [
          'packages/core-js-bundle/index.js',
          'tests/bundles/qunit-helpers.js',
          'tests/bundles/tests.js',
        ].map(src => ({ src })),
      },
      pure: {
        files: [
          'tests/bundles/qunit-helpers.js',
          'tests/bundles/pure.js',
        ].map(src => ({ src })),
      },
    },
    webpack: require('./.webpack.config.js'),
  });
  grunt.registerTask('bundle', function () {
    const builder = require('./packages/core-js-builder');
    const done = this.async();

    builder({ filename: './packages/core-js-bundle/index.js' }).then(done).catch(error => {
      // eslint-disable-next-line no-console
      console.error(error);
      process.exit(1);
    });
  });
};
<commit_msg>fix license file in core-js-compat<commit_after>/* eslint-disable unicorn/filename-case */
'use strict';
const { banner } = require('./packages/core-js-builder/config');

process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = grunt => {
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-webpack');
  grunt.initConfig({
    pkg: grunt.file.readJSON('./package.json'),
    uglify: {
      build: {
        files: {
          './packages/core-js-bundle/minified.js': './packages/core-js-bundle/index.js',
        },
        options: {
          mangle: {
            keep_fnames: true,
          },
          compress: {
            keep_fnames: true,
            pure_getters: true,
          },
          output: {
            max_line_len: 32000,
          },
          ie8: true,
          sourceMap: true,
          banner,
        },
      },
    },
    clean: {
      'core-js': [
        './packages/core-js/LICENSE',
      ],
      'core-js-pure': [
        './packages/core-js-pure/*',
        '!./packages/core-js-pure/override',
        '!./packages/core-js-pure/.npmignore',
        '!./packages/core-js-pure/package.json',
        '!./packages/core-js-pure/README.md',
      ],
      'core-js-builder': [
        './packages/core-js-builder/LICENSE',
      ],
      'core-js-bundle': [
        './packages/core-js-bundle/LICENSE',
      ],
      'core-js-compat': [
        './packages/core-js-compat/data.json',
        './packages/core-js-compat/LICENSE',
      ],
      tests: [
        './tests/bundles/*',
      ],
    },
    copy: {
      'core-js': {
        files: [
          {
            expand: true,
            src: ['LICENSE'],
            dest: './packages/core-js/',
          },
        ],
      },
      'core-js-pure': {
        files: [
          {
            expand: true,
            src: ['LICENSE'],
            dest: './packages/core-js-pure/',
          }, {
            expand: true,
            cwd: './packages/core-js/',
            src: [
              'es/**',
              'features/**',
              'internals/**',
              'modules/**',
              'proposals/**',
              'stable/**',
              'stage/**',
              'web/**',
              'index.js',
              'configurator.js',
            ],
            dest: './packages/core-js-pure/',
          }, {
            expand: true,
            cwd: './packages/core-js-pure/override/',
            src: '**',
            dest: './packages/core-js-pure',
          },
        ],
      },
      'core-js-builder': {
        files: [
          {
            expand: true,
            src: ['LICENSE'],
            dest: './packages/core-js-builder/',
          },
        ],
      },
      'core-js-bundle': {
        files: [
          {
            expand: true,
            src: ['LICENSE'],
            dest: './packages/core-js-bundle/',
          },
        ],
      },
      'core-js-compat': {
        files: [
          {
            expand: true,
            src: ['LICENSE'],
            dest: './packages/core-js-compat/',
          },
        ],
      },
    },
    karma: {
      options: {
        frameworks: ['qunit'],
        basePath: '.',
        browsers: ['HeadlessChrome', 'PhantomJS'],
        customLaunchers: {
          HeadlessChrome: {
            base: 'ChromeHeadless',
            flags: ['--no-sandbox', '--disable-setuid-sandbox'],
          },
        },
        singleRun: true,
      },
      tests: {
        files: [
          'packages/core-js-bundle/index.js',
          'tests/bundles/qunit-helpers.js',
          'tests/bundles/tests.js',
        ].map(src => ({ src })),
      },
      pure: {
        files: [
          'tests/bundles/qunit-helpers.js',
          'tests/bundles/pure.js',
        ].map(src => ({ src })),
      },
    },
    webpack: require('./.webpack.config.js'),
  });
  grunt.registerTask('bundle', function () {
    const builder = require('./packages/core-js-builder');
    const done = this.async();

    builder({ filename: './packages/core-js-bundle/index.js' }).then(done).catch(error => {
      // eslint-disable-next-line no-console
      console.error(error);
      process.exit(1);
    });
  });
};
<|endoftext|>


<commit_before>module.exports = function (grunt) {

	grunt.initConfig({

	// Live browser injection
	browserSync: {
		bsFiles: {
			src : ["css/site.css", "js/*.js"]
		}
	},

	// Watch changes to files
	watch: {
		styles: {
			files: ["less/**/*.less", "js/**/*.js"],
			tasks: ["less", "minified"]
		},
		options: {
			spawn: false,
		},
	},

	// Compile set less files
	less: {
		development: {
			options: {
				paths: ["less"],
				sourceMap: true,
				sourceMapFilename: "css/site.css.map",
				sourceMapURL: "css/site.css.map"
			},
			files: {
				"css/site.css": ["less/*.less", "!less/_*.less"]
			}
		},
		production: {
			options: {
				paths: ["less"],
				sourceMap: false,
				cssmin: true
			},
			files: {
				"css/site.css": ["less/*.less", "!less/_*.less"]
			}
		}
	},

	// Compress .js files
	minified : {
		files: {
			src: [ 'js/*.js', '!js/*.min.js', '!js/vendor/**/*.js', '!js/**/_*.js'],
			dest: 'js/'
		},
		options : {
			allinone: false,
			ext: '.min.js'
		}
	}

	});

	// Load modules
	grunt.loadNpmTasks("grunt-contrib-watch");
	grunt.loadNpmTasks("grunt-contrib-less");
	grunt.loadNpmTasks("grunt-browser-sync");
	grunt.loadNpmTasks("grunt-contrib-cssmin");
	grunt.loadNpmTasks('grunt-minified');

	// The default task prints usage
	grunt.registerTask("default", "Prints usage", function () {
		grunt.log.writeln("");
		grunt.log.writeln("Building Base");
		grunt.log.writeln("------------------------");
		grunt.log.writeln("");
		grunt.log.writeln("* run 'grunt --help' to get an overview of all commands.");
		grunt.log.writeln("* run 'grunt dev' to start watching and compiling LESS changes for development.");
		grunt.log.writeln("* run 'grunt prod' to minify css and js files for production.");
	});

	// Create our tasks
	grunt.registerTask("dev", ["less:development", "minified", "watch", "browserSync"]);
	grunt.registerTask("prod", ["minified", "less:production"]);

};
<commit_msg>Revert to ae53c38cd2e65ebae404738eda03beaa1b764ed3 for working gruntfile<commit_after>module.exports = function (grunt) {

    grunt.initConfig({

        // live browser injection
        browserSync: {
            bsFiles: {
                src : 'css/site.css'
            },
            options: {
                watchTask: true
            }
        },

        // watch changes to less files
        watch: {
            styles: {
                files: ["less/**/*"],
                tasks: ["less"]
            },
            options: {
                spawn: false,
            },
        },

        // compile set less files
        less: {
            development: {
                options: {
                    paths: ["less"],
                    sourceMap: true,
                    sourceMapFilename: 'css/site.css.map',
                    sourceMapURL: 'css/site.css.map',
                    compress: true
                },
                files: {
                    "css/site.css": ["less/*.less", "!less/_*.less"]
                }
            }
        }

    });

    // Load tasks so we can use them
    grunt.loadNpmTasks("grunt-contrib-watch");
    grunt.loadNpmTasks("grunt-contrib-less");
    grunt.loadNpmTasks('grunt-browser-sync');

    // the default task will show the usage
    grunt.registerTask("default", "Prints usage", function () {
        grunt.log.writeln("");
        grunt.log.writeln("Building Base");
        grunt.log.writeln("------------------------");
        grunt.log.writeln("");
        grunt.log.writeln("* run 'grunt --help' to get an overview of all commands.");
        grunt.log.writeln("* run 'grunt dev' to start watching and compiling LESS changes for development.");
    });

    grunt.registerTask("dev", ["less", "browserSync", "watch"]);

};
<|endoftext|>


<commit_before>import React, { Component, PropTypes } from 'react'
import Radium from 'radium'
import Helmet from 'react-helmet'
import { connect } from 'react-redux'
import { SubmissionError } from 'redux-form'
import { Card, Header, Heading, RedeemTechDomainForm, Text } from '../../components'
import * as techDomainRedemptionActions from '../../redux/modules/techDomainRedemption'

const styles = {
  instructions: {
    fontSize: '22px',
    marginTop: '20px'
  },
  card: {
    marginLeft: 'auto',
    marginRight: 'auto',
    marginTop: '40px',
    marginBottom: '40px'
  },
  links: {
    color: 'white'
  }
}

class RedeemTechDomain extends Component {
  static propTypes = {
    submit: PropTypes.func.isRequired
  }

  handleSubmit(values) {
    const { submit } = this.props

    return submit(values.name, values.email, values.requested_domain, values.secret_code)
      .catch(error => {
        throw new SubmissionError(error.errors)
      })
  }

  render() {
    const { status } = this.props

    console.log(status);

    return (

        <Helmet title="Get a Free .TECH Domain" />

          <Heading>Get a free .TECH domain!</Heading>
          <Text style={styles.instructions}>
            Hack Club has partnered with .tech to get every Hack Club member a free .tech domain.
          </Text>

          <Text style={styles.instructions}>
            Just fill out the form below to submit your request and the .tech team will get you set
            up (they generally respond to requests within the day). Shoot an email to zach@hackclub.com
            if you run into any trouble.
          </Text>

        <Card style={styles.card}>
          <RedeemTechDomainForm
            onSubmit={values => this.handleSubmit(values)}
            status={status}
            />
        </Card>

    )
  }
}

const mapStateToProps = state => ({
    status: state.techDomainRedemption.status
})

export default connect(
  mapStateToProps,
  {...techDomainRedemptionActions}
)(Radium(RedeemTechDomain))
<commit_msg>Improve styling and copy of /redeem_tech_domain<commit_after>import React, { Component, PropTypes } from 'react'
import Radium from 'radium'
import Helmet from 'react-helmet'
import { connect } from 'react-redux'
import { SubmissionError } from 'redux-form'
import {
  Card,
  Container,
  Header,
  Heading,
  RedeemTechDomainForm,
  Text,
} from '../../components'
import * as techDomainRedemptionActions from '../../redux/modules/techDomainRedemption'

import colors from '../../styles/colors'

const styles = {
  heading: {
    color: colors.bg
  },
  instructions: {
    fontSize: '22px',
    marginTop: '20px',
    color: colors.bg
  },
  card: {
    marginLeft: 'auto',
    marginRight: 'auto',
    marginTop: '40px',
    marginBottom: '40px'
  }
}

class RedeemTechDomain extends Component {
  static propTypes = {
    submit: PropTypes.func.isRequired
  }

  handleSubmit(values) {
    const { submit } = this.props

    return submit(values.name, values.email, values.requested_domain, values.secret_code)
      .catch(error => {
        throw new SubmissionError(error.errors)
      })
  }

  render() {
    const { status } = this.props

    console.log(status);

    return (

        <Helmet title="Get a Free .TECH Domain" />

          <Container>
            <Heading style={styles.heading}>Get a free .TECH domain!</Heading>
            <Text style={styles.instructions}>
              We've partnered with the folks that own all of the .tech domains
              to get every Hack Club member a free domain.
            </Text>

            <Text style={styles.instructions}>
              Fill out the form below to submit your request and the .tech team
              will get you set up (they generally respond to requests within the
              day).
            </Text>
          </Container>

        <Card style={styles.card}>
          <RedeemTechDomainForm
             onSubmit={values => this.handleSubmit(values)}
            status={status}
            />
        </Card>

    )
  }
}

const mapStateToProps = state => ({
    status: state.techDomainRedemption.status
})

export default connect(
  mapStateToProps,
  {...techDomainRedemptionActions}
)(Radium(RedeemTechDomain))
<|endoftext|>


<commit_before>App.FormView = Backbone.View.extend({

  tagName: 'form',

  templateName: 'form',

  events: {
    'click .submit': 'onSubmit'
  },

  initialize: function initialize(options) {
    this.options = options;
    this.template = App.getTmpl(this.templateName);

    this.onRender = options.onRender || App.noop;
    this.onError = options.onError || this.onError;

    if(this.collection) {
      this.collection.on('sync', function() {this.trigger('success', this.collection)}, this);
      this.collection.on('error', this.onError, this);
    }

    if(this.model) {
      this.model.on('sync', function() {this.trigger('success', this.model)}, this);
      this.model.on('error', this.onError, this);
    }

  },

  text: function Text(name, attributes) {
    return $('<textarea/>', $.extend({name: name}, attributes));
  },

  string: function String(name, attributes) {
    return $('<input/>', $.extend({type: 'text', name: name}, attributes));
  },

  int: function Int(name, attributes) {
    return $('<input/>', $.extend({type: 'number', name: name}, attributes));
  },

  boolean: function Boolean(name, attributes) {
    return $('<input/>', $.extend({type: 'checkbox', name: name}, attributes));
  },

  construct: function construct() {
    this.render();
    this.build();
  },

  render: function render() {
    var html = this.template({'name': this.options.name});
    this.$el.html(html);
    this.trigger('render');
  },

  build: function build() {
    var p, label, widget;
    var container = this.$el.find('.fields');

    _.each(this.options.fields, function(options, name) {
      p = $('

');
      label = $('', {'for': name}).html(options.label + ':');
      widget = this[options.type](name, options.attributes || {});

      p.append(label, widget);
      container.append(p);
    }, this);
  },

  addWidget: function addWidget(el) {
    this.$el.find('.form-widgets').append(el);
  },

  getField: function getField(key) {
    return this.$el.find('[name="' + key + '"]');
  },

  unload: function unload() {
    this.model = null;
    this.el.reset();
    this.trigger('unload');
  },

  load: function load(id) {
    this.model = this.collection ? this.collection.get(id) : this.model;

    _.each(this.model.attributes, function(value, key) {
      var field = this.getField(key);

      switch(typeof value) {
        case "boolean":
          field.prop('checked', value);
          break;
        default:
          field.val(value);
          break;
      }

    }, this);

    this.trigger('load', this.model);
  },

  onSubmit: function onSubmit() {
    var data = this.$el.find('.fields').serializeObject();

    if(!this.model) {
      this.model = this.collection.create(data);
    } else {
      this.model.save(data);
    }

    this.model.once('sync', function() {
      App.alertView.success('Saved');
      this.trigger('saved', this.model);
    }, this);

    return false;
  },

  onError: function onError() {
    console.log(arguments);
    App.alertView.error('Invalid form');
  }

});<commit_msg>Intercept enter key being pressed, and submit the form<commit_after>App.FormView = Backbone.View.extend({

  tagName: 'form',

  templateName: 'form',

  events: {
    'submit': 'onSubmit',
    'click .submit': 'onSubmit'
  },

  initialize: function initialize(options) {
    this.options = options;
    this.template = App.getTmpl(this.templateName);

    this.onRender = options.onRender || App.noop;
    this.onError = options.onError || this.onError;

    if(this.collection) {
      this.collection.on('sync', function() {this.trigger('success', this.collection)}, this);
      this.collection.on('error', this.onError, this);
    }

    if(this.model) {
      this.model.on('sync', function() {this.trigger('success', this.model)}, this);
      this.model.on('error', this.onError, this);
    }

  },

  text: function Text(name, attributes) {
    return $('<textarea/>', $.extend({name: name}, attributes));
  },

  string: function String(name, attributes) {
    return $('<input/>', $.extend({type: 'text', name: name}, attributes));
  },

  int: function Int(name, attributes) {
    return $('<input/>', $.extend({type: 'number', name: name}, attributes));
  },

  boolean: function Boolean(name, attributes) {
    return $('<input/>', $.extend({type: 'checkbox', name: name}, attributes));
  },

  construct: function construct() {
    this.render();
    this.build();
  },

  render: function render() {
    var html = this.template({'name': this.options.name});
    this.$el.html(html);
    this.trigger('render');
  },

  build: function build() {
    var p, label, widget;
    var container = this.$el.find('.fields');

    _.each(this.options.fields, function(options, name) {
      p = $('

');
      label = $('', {'for': name}).html(options.label + ':');
      widget = this[options.type](name, options.attributes || {});

      p.append(label, widget);
      container.append(p);
    }, this);
  },

  addWidget: function addWidget(el) {
    this.$el.find('.form-widgets').append(el);
  },

  getField: function getField(key) {
    return this.$el.find('[name="' + key + '"]');
  },

  unload: function unload() {
    this.model = null;
    this.el.reset();
    this.trigger('unload');
  },

  load: function load(id) {
    this.model = this.collection ? this.collection.get(id) : this.model;

    _.each(this.model.attributes, function(value, key) {
      var field = this.getField(key);

      switch(typeof value) {
        case "boolean":
          field.prop('checked', value);
          break;
        default:
          field.val(value);
          break;
      }

    }, this);

    this.trigger('load', this.model);
  },

  onSubmit: function onSubmit() {
    var data = this.$el.find('.fields').serializeObject();

    if(!this.model) {
      this.model = this.collection.create(data);
    } else {
      this.model.save(data);
    }

    this.model.once('sync', function() {
      App.alertView.success('Saved');
      this.trigger('saved', this.model);
    }, this);

    return false;
  },

  onError: function onError() {
    console.log(arguments);
    App.alertView.error('Invalid form');
  }

});<|endoftext|>


<commit_before>import brkApi from './data-selection-api-brk';
import dataSelectionApi from './data-selection-api-data-selection';
import dcatApi from './data-selection-api-dcatd';

const DATA_SELECTION_CONFIG = {
  datasets: {
    bag: {
      CUSTOM_API: dataSelectionApi,
      MAX_AVAILABLE_PAGES: 100,
      MAX_NUMBER_OF_CLUSTERED_MARKERS: 10000,
      ENDPOINT_PREVIEW: 'dataselectie/bag/',
      ENDPOINT_MARKERS: 'dataselectie/bag/geolocation/',
      ENDPOINT_EXPORT: 'dataselectie/bag/export/',
      ENDPOINT_DETAIL: 'bag/nummeraanduiding/',
      PRIMARY_KEY: 'nummeraanduiding_id',
      TITLE: 'Adressen',
      TITLE_TAB: 'Adressen',
      SHOW_NUMBER_OF_RECORDS: true,
      SORT_FILTERS: false,
      FILTERS: [
        {
          slug: 'stadsdeel_naam',
          label: 'Stadsdeel'
        }, {
          slug: 'ggw_naam',
          label: 'GGW-gebied'
        }, {
          slug: 'buurtcombinatie_naam',
          label: 'Wijk'
        }, {
          slug: 'buurt_naam',
          label: 'Buurt'
        }, {
          slug: 'openbare_ruimte',
          label: 'Openbare ruimte'
        }, {
          slug: 'postcode',
          label: 'Postcode'
        }
      ],
      CONTENT: {
        TABLE: [
          {
            label: 'Naam openbare ruimte',
            variables: ['_openbare_ruimte_naam']
          },
          {
            label: 'Num.',
            variables: ['huisnummer']
          },
          {
            label: 'Let.',
            variables: ['huisletter']
          },
          {
            label: 'Toev.',
            variables: ['huisnummer_toevoeging']
          },
          {
            label: 'Postcode',
            variables: ['postcode']
          },
          {
            label: 'Stadsdeel',
            variables: ['stadsdeel_naam']
          },
          {
            label: '-code',
            variables: ['stadsdeel_code']
          },
          {
            label: 'GGW-gebied',
            variables: ['ggw_naam']
          },
          {
            label: '-code',
            variables: ['ggw_code']
          },
          {
            label: 'Wijk',
            variables: ['buurtcombinatie_naam']
          },
          {
            label: '-code',
            variables: ['buurtcombinatie_code']
          },
          {
            label: 'Buurt',
            variables: ['buurt_naam']
          },
          {
            label: '-code',
            variables: ['buurt_code']
          }
        ],
        LIST: [
          {
            variables: [
              '_openbare_ruimte_naam',
              'huisnummer',
              'huisletter',
              'huisnummer_toevoeging'
            ],
            formatter: 'bagAddress'
          },
          {
            variables: [
              'ligplaats_id',
              'standplaats_id'
            ],
            formatter: 'nummeraanduidingType'
          },
          {
            variables: [
              'hoofdadres'
            ],
            formatter: 'nevenadres'
          },
          {
            variables: [
              'status_id'
            ],
            formatter: 'verblijfsobjectGevormd'
          }
        ]
      }
    },
    brk: {
      AUTH_SCOPE: 'BRK/RSN',
      CUSTOM_API: brkApi,
      MAX_AVAILABLE_PAGES: 100,
      MAX_NUMBER_OF_CLUSTERED_MARKERS: Infinity,
      ENDPOINT_PREVIEW: {
        TABLE: 'dataselectie/brk/',
        LIST: 'dataselectie/brk/kot/',
        MAP: 'dataselectie/brk/kot/'
      },
      ENDPOINT_MARKERS: 'dataselectie/brk/geolocation/',
      ENDPOINT_EXPORT: 'dataselectie/brk/export/',
      ENDPOINT_DETAIL: 'brk/object/',
      PRIMARY_KEY: 'kadastraal_object_id',
      TITLE: 'Kadastrale objecten met zakelijk rechthebbenden',
      TITLE_TAB: 'Kadastrale objecten',
      SHOW_NUMBER_OF_RECORDS: true,
      SORT_FILTERS: false,
      FILTERS: [
        {
          slug: 'eigenaar_type',
          label: 'Type zakelijk gerechtigde',
          order: [
            'Grondeigenaar',
            'Pandeigenaar',
            'Appartementseigenaar'
          ],
          info_url: 'https://www.amsterdam.nl/stelselpedia/brk-index/producten-brk/kadastertabel/'
        }, {
          slug: 'eigenaar_cat',
          label: 'Zakelijk gerechtigde',
          order: [
            'Gemeente Amsterdam',
            'Overige gemeenten',
            'Staat',
            'Provincies',
            'Waterschappen',
            'Woningbouwcorporaties',
            'Verenigingen van eigenaren',
            'Spoorwegen/ProRail',
            'Overige niet-natuurlijke personen',
            'Overige natuurlijke personen'
          ],
          info_url: 'https://www.amsterdam.nl/stelselpedia/brk-index/producten-brk/kadastertabel/'
        }, {
          slug: 'stadsdeel_naam',
          label: 'Stadsdeel'
        }, {
          slug: 'ggw_naam',
          label: 'GGW-gebied'
        }, {
          slug: 'buurtcombinatie_naam',
          label: 'Wijk'
        }, {
          slug: 'buurt_naam',
          label: 'Buurt'
        }
      ],
      CONTENT: {
        TABLE: [
          {
            label: 'Kad. object',
            variables: ['aanduiding']
          },
          {
            label: '-eerste adres',
            variables: ['eerste_adres']
          },
          {
            label: 'Kad. gemeente',
            variables: ['kadastrale_gemeentenaam']
          },
          {
            label: 'Gemeente',
            variables: ['burgerlijke_gemeentenaam']
          },
          {
            label: 'Zakelijk recht: aard',
            variables: ['aard_zakelijk_recht']
          },
          {
            label: '-aandeel',
            variables: ['zakelijk_recht_aandeel']
          },
          {
            label: 'Natuurlijk persoon: naam',
            variables: ['sjt_naam']
          },
          {
            label: '-datum overlijden',
            variables: ['sjt_datum_overlijden'],
            formatter: 'date'
          },
          {
            label: 'Niet-natuurlijk persoon: statutaire naam',
            variables: ['sjt_statutaire_naam']
          },
          {
            label: '-rechtsvorm',
            variables: ['sjt_statutaire_rechtsvorm']
          }
        ],
        LIST: [
          { variables: ['aanduiding'] }
        ]
      }
    },
    hr: {
      CUSTOM_API: dataSelectionApi,
      AUTH_SCOPE: 'HR/R',
      MAX_AVAILABLE_PAGES: 100,
      MAX_NUMBER_OF_CLUSTERED_MARKERS: 10000,
      ENDPOINT_PREVIEW: 'dataselectie/hr/',
      ENDPOINT_MARKERS: 'dataselectie/hr/geolocation/',
      ENDPOINT_EXPORT: 'dataselectie/hr/export/',
      ENDPOINT_EXPORT_PARAM: 'dataset=ves',
      ENDPOINT_DETAIL: 'handelsregister/vestiging/',
      PRIMARY_KEY: 'vestiging_id',
      TITLE: 'Vestigingen',
      TITLE_TAB: 'Vestigingen',
      SHOW_NUMBER_OF_RECORDS: true,
      SORT_FILTERS: false,
      FILTERS: [
        {
          slug: 'sbi_code',
          label: 'SBI-code'
        }, {
          slug: 'sbi_l2',
          label: 'SBI-L2'
        }, {
          slug: 'sbi_l3',
          label: 'SBI-L3'
        }, {
          slug: 'sbi_l4',
          label: 'SBI-L4'
        }, {
          slug: 'sbi_l5',
          label: 'SBI-L5'
        }, {
          slug: 'bijzondere_rechtstoestand',
          label: 'Bijzondere rechtstoestand'
        }, {
          slug: 'stadsdeel_naam',
          label: 'Stadsdeel'
        }, {
          slug: 'ggw_naam',
          label: 'GGW-gebied'
        }, {
          slug: 'buurtcombinatie_naam',
          label: 'Wijk'
        }, {
          slug: 'buurt_naam',
          label: 'Buurt'
        }, {
          slug: 'openbare_ruimte',
          label: 'Openbare ruimte'
        }, {
          slug: 'postcode',
          label: 'Postcode'
        }
      ],
      CONTENT: {
        TABLE: [
          {
            label: 'KvK-num.',
            variables: ['kvk_nummer']
          },
          {
            label: 'Handelsnaam',
            variables: ['handelsnaam', 'bijzondere_rechtstoestand'],
            template: 'handelsnaam'
          },
          {
            label: 'SBI-code',
            variables: ['sbi_code']
          },
          {
            label: 'SBI-omschrijving',
            variables: ['sbi_omschrijving'],
            template: 'sbi-omschrijving'
          },
          {
            label: 'Bezoekadres',
            variables: ['bezoekadres_volledig_adres', 'non_mailing'],
            formatter: 'hrBezoekadres',
            template: 'bezoekadres'
          }
        ],
        LIST: [
          {
            variables: ['handelsnaam']
          }
        ]
      }
    },
    dcatd: {
      MAX_ITEMS_PER_PAGE: 100,
      CUSTOM_API: dcatApi,
      ENDPOINT_METADATA: 'dcatd/openapi',
      ENDPOINT_PREVIEW: 'dcatd/datasets',
      ENDPOINT_DETAIL: 'dcatd/datasets',
      TITLE: 'Catalogus',
      TITLE_TAB: 'Catalogus',
      SHOW_NUMBER_OF_RECORDS: true,
      PRIMARY_KEY: 'dct:identifier',
      SHOW_FILTER_OPTION_COUNTS: false,
      SORT_FILTERS: true,
      FILTERS: [
        {
          slug: 'status',
          label: 'Status'
        }, {
          slug: 'groups',
          label: 'Thema\'s'
        }, {
          slug: 'owners',
          label: 'Eigenaar'
        }, {
          slug: 'distributionTypes',
          label: 'Verschijningsvorm'
        }, {
          slug: 'serviceTypes',
          label: 'API/Service formaten'
        }, {
          slug: 'formats',
          label: 'Bestandsformaten',
          formatter: 'lowercase'
        }
      ],
      CONTENT: {
        CATALOG: []
      }
    }
  }
};

export default DATA_SELECTION_CONFIG;
<commit_msg>Fixed config file for switching between map and list view when dataselection saga is exectuted (#1719)<commit_after>import brkApi from './data-selection-api-brk';
import dataSelectionApi from './data-selection-api-data-selection';
import dcatApi from './data-selection-api-dcatd';

const DATA_SELECTION_CONFIG = {
  datasets: {
    bag: {
      CUSTOM_API: dataSelectionApi,
      MAX_AVAILABLE_PAGES: 100,
      MAX_NUMBER_OF_CLUSTERED_MARKERS: 10000,
      ENDPOINT_PREVIEW: 'dataselectie/bag/',
      ENDPOINT_MARKERS: 'dataselectie/bag/geolocation/',
      ENDPOINT_EXPORT: 'dataselectie/bag/export/',
      ENDPOINT_DETAIL: 'bag/nummeraanduiding/',
      PRIMARY_KEY: 'nummeraanduiding_id',
      TITLE: 'Adressen',
      TITLE_TAB: 'Adressen',
      SHOW_NUMBER_OF_RECORDS: true,
      SORT_FILTERS: false,
      FILTERS: [
        {
          slug: 'stadsdeel_naam',
          label: 'Stadsdeel'
        }, {
          slug: 'ggw_naam',
          label: 'GGW-gebied'
        }, {
          slug: 'buurtcombinatie_naam',
          label: 'Wijk'
        }, {
          slug: 'buurt_naam',
          label: 'Buurt'
        }, {
          slug: 'openbare_ruimte',
          label: 'Openbare ruimte'
        }, {
          slug: 'postcode',
          label: 'Postcode'
        }
      ],
      CONTENT: {
        TABLE: [
          {
            label: 'Naam openbare ruimte',
            variables: ['_openbare_ruimte_naam']
          },
          {
            label: 'Num.',
            variables: ['huisnummer']
          },
          {
            label: 'Let.',
            variables: ['huisletter']
          },
          {
            label: 'Toev.',
            variables: ['huisnummer_toevoeging']
          },
          {
            label: 'Postcode',
            variables: ['postcode']
          },
          {
            label: 'Stadsdeel',
            variables: ['stadsdeel_naam']
          },
          {
            label: '-code',
            variables: ['stadsdeel_code']
          },
          {
            label: 'GGW-gebied',
            variables: ['ggw_naam']
          },
          {
            label: '-code',
            variables: ['ggw_code']
          },
          {
            label: 'Wijk',
            variables: ['buurtcombinatie_naam']
          },
          {
            label: '-code',
            variables: ['buurtcombinatie_code']
          },
          {
            label: 'Buurt',
            variables: ['buurt_naam']
          },
          {
            label: '-code',
            variables: ['buurt_code']
          }
        ],
        LIST: [
          {
            variables: [
              '_openbare_ruimte_naam',
              'huisnummer',
              'huisletter',
              'huisnummer_toevoeging'
            ],
            formatter: 'bagAddress'
          },
          {
            variables: [
              'ligplaats_id',
              'standplaats_id'
            ],
            formatter: 'nummeraanduidingType'
          },
          {
            variables: [
              'hoofdadres'
            ],
            formatter: 'nevenadres'
          },
          {
            variables: [
              'status_id'
            ],
            formatter: 'verblijfsobjectGevormd'
          }
        ],
        MAP: [
          {
            variables: [
              '_openbare_ruimte_naam',
              'huisnummer',
              'huisletter',
              'huisnummer_toevoeging'
            ],
            formatter: 'bagAddress'
          },
          {
            variables: [
              'ligplaats_id',
              'standplaats_id'
            ],
            formatter: 'nummeraanduidingType'
          },
          {
            variables: [
              'hoofdadres'
            ],
            formatter: 'nevenadres'
          },
          {
            variables: [
              'status_id'
            ],
            formatter: 'verblijfsobjectGevormd'
          }
        ]
      }
    },
    brk: {
      AUTH_SCOPE: 'BRK/RSN',
      CUSTOM_API: brkApi,
      MAX_AVAILABLE_PAGES: 100,
      MAX_NUMBER_OF_CLUSTERED_MARKERS: Infinity,
      ENDPOINT_PREVIEW: {
        TABLE: 'dataselectie/brk/',
        LIST: 'dataselectie/brk/kot/',
        MAP: 'dataselectie/brk/kot/'
      },
      ENDPOINT_MARKERS: 'dataselectie/brk/geolocation/',
      ENDPOINT_EXPORT: 'dataselectie/brk/export/',
      ENDPOINT_DETAIL: 'brk/object/',
      PRIMARY_KEY: 'kadastraal_object_id',
      TITLE: 'Kadastrale objecten met zakelijk rechthebbenden',
      TITLE_TAB: 'Kadastrale objecten',
      SHOW_NUMBER_OF_RECORDS: true,
      SORT_FILTERS: false,
      FILTERS: [
        {
          slug: 'eigenaar_type',
          label: 'Type zakelijk gerechtigde',
          order: [
            'Grondeigenaar',
            'Pandeigenaar',
            'Appartementseigenaar'
          ],
          info_url: 'https://www.amsterdam.nl/stelselpedia/brk-index/producten-brk/kadastertabel/'
        }, {
          slug: 'eigenaar_cat',
          label: 'Zakelijk gerechtigde',
          order: [
            'Gemeente Amsterdam',
            'Overige gemeenten',
            'Staat',
            'Provincies',
            'Waterschappen',
            'Woningbouwcorporaties',
            'Verenigingen van eigenaren',
            'Spoorwegen/ProRail',
            'Overige niet-natuurlijke personen',
            'Overige natuurlijke personen'
          ],
          info_url: 'https://www.amsterdam.nl/stelselpedia/brk-index/producten-brk/kadastertabel/'
        }, {
          slug: 'stadsdeel_naam',
          label: 'Stadsdeel'
        }, {
          slug: 'ggw_naam',
          label: 'GGW-gebied'
        }, {
          slug: 'buurtcombinatie_naam',
          label: 'Wijk'
        }, {
          slug: 'buurt_naam',
          label: 'Buurt'
        }
      ],
      CONTENT: {
        TABLE: [
          {
            label: 'Kad. object',
            variables: ['aanduiding']
          },
          {
            label: '-eerste adres',
            variables: ['eerste_adres']
          },
          {
            label: 'Kad. gemeente',
            variables: ['kadastrale_gemeentenaam']
          },
          {
            label: 'Gemeente',
            variables: ['burgerlijke_gemeentenaam']
          },
          {
            label: 'Zakelijk recht: aard',
            variables: ['aard_zakelijk_recht']
          },
          {
            label: '-aandeel',
            variables: ['zakelijk_recht_aandeel']
          },
          {
            label: 'Natuurlijk persoon: naam',
            variables: ['sjt_naam']
          },
          {
            label: '-datum overlijden',
            variables: ['sjt_datum_overlijden'],
            formatter: 'date'
          },
          {
            label: 'Niet-natuurlijk persoon: statutaire naam',
            variables: ['sjt_statutaire_naam']
          },
          {
            label: '-rechtsvorm',
            variables: ['sjt_statutaire_rechtsvorm']
          }
        ],
        LIST: [
          { variables: ['aanduiding'] }
        ],
        MAP: [
          { variables: ['aanduiding'] }
        ]
      }
    },
    hr: {
      CUSTOM_API: dataSelectionApi,
      AUTH_SCOPE: 'HR/R',
      MAX_AVAILABLE_PAGES: 100,
      MAX_NUMBER_OF_CLUSTERED_MARKERS: 10000,
      ENDPOINT_PREVIEW: 'dataselectie/hr/',
      ENDPOINT_MARKERS: 'dataselectie/hr/geolocation/',
      ENDPOINT_EXPORT: 'dataselectie/hr/export/',
      ENDPOINT_EXPORT_PARAM: 'dataset=ves',
      ENDPOINT_DETAIL: 'handelsregister/vestiging/',
      PRIMARY_KEY: 'vestiging_id',
      TITLE: 'Vestigingen',
      TITLE_TAB: 'Vestigingen',
      SHOW_NUMBER_OF_RECORDS: true,
      SORT_FILTERS: false,
      FILTERS: [
        {
          slug: 'sbi_code',
          label: 'SBI-code'
        }, {
          slug: 'sbi_l2',
          label: 'SBI-L2'
        }, {
          slug: 'sbi_l3',
          label: 'SBI-L3'
        }, {
          slug: 'sbi_l4',
          label: 'SBI-L4'
        }, {
          slug: 'sbi_l5',
          label: 'SBI-L5'
        }, {
          slug: 'bijzondere_rechtstoestand',
          label: 'Bijzondere rechtstoestand'
        }, {
          slug: 'stadsdeel_naam',
          label: 'Stadsdeel'
        }, {
          slug: 'ggw_naam',
          label: 'GGW-gebied'
        }, {
          slug: 'buurtcombinatie_naam',
          label: 'Wijk'
        }, {
          slug: 'buurt_naam',
          label: 'Buurt'
        }, {
          slug: 'openbare_ruimte',
          label: 'Openbare ruimte'
        }, {
          slug: 'postcode',
          label: 'Postcode'
        }
      ],
      CONTENT: {
        TABLE: [
          {
            label: 'KvK-num.',
            variables: ['kvk_nummer']
          },
          {
            label: 'Handelsnaam',
            variables: ['handelsnaam', 'bijzondere_rechtstoestand'],
            template: 'handelsnaam'
          },
          {
            label: 'SBI-code',
            variables: ['sbi_code']
          },
          {
            label: 'SBI-omschrijving',
            variables: ['sbi_omschrijving'],
            template: 'sbi-omschrijving'
          },
          {
            label: 'Bezoekadres',
            variables: ['bezoekadres_volledig_adres', 'non_mailing'],
            formatter: 'hrBezoekadres',
            template: 'bezoekadres'
          }
        ],
        LIST: [
          {
            variables: ['handelsnaam']
          }
        ],
        MAP: [
          {
            variables: ['handelsnaam']
          }
        ]
      }
    },
    dcatd: {
      MAX_ITEMS_PER_PAGE: 100,
      CUSTOM_API: dcatApi,
      ENDPOINT_METADATA: 'dcatd/openapi',
      ENDPOINT_PREVIEW: 'dcatd/datasets',
      ENDPOINT_DETAIL: 'dcatd/datasets',
      TITLE: 'Catalogus',
      TITLE_TAB: 'Catalogus',
      SHOW_NUMBER_OF_RECORDS: true,
      PRIMARY_KEY: 'dct:identifier',
      SHOW_FILTER_OPTION_COUNTS: false,
      SORT_FILTERS: true,
      FILTERS: [
        {
          slug: 'status',
          label: 'Status'
        }, {
          slug: 'groups',
          label: 'Thema\'s'
        }, {
          slug: 'owners',
          label: 'Eigenaar'
        }, {
          slug: 'distributionTypes',
          label: 'Verschijningsvorm'
        }, {
          slug: 'serviceTypes',
          label: 'API/Service formaten'
        }, {
          slug: 'formats',
          label: 'Bestandsformaten',
          formatter: 'lowercase'
        }
      ],
      CONTENT: {
        CATALOG: []
      }
    }
  }
};

export default DATA_SELECTION_CONFIG;
<|endoftext|>


<commit_before>// Cost class

'use strict';

var memoize          = require('memoizee/plain')
  , defineCurrency   = require('dbjs-ext/number/currency')
  , defineStringLine = require('dbjs-ext/string/string-line');

module.exports = memoize(function (db) {
	var StringLine = defineStringLine(db)
	  , Currency = defineCurrency(db);

	return db.Object.extend('Cost', {
		// Cost label
		label: { type: StringLine },
		// Cost amount
		amount: { type: Currency, step: 1 },
		// Whether cost have been paid
		isPaid: { type: db.Boolean }
	});
}, { normalizer: require('memoizee/normalizers/get-1')() });
<commit_msg>Add cost.isElectronic<commit_after>// Cost class

'use strict';

var memoize          = require('memoizee/plain')
  , defineCurrency   = require('dbjs-ext/number/currency')
  , defineStringLine = require('dbjs-ext/string/string-line');

module.exports = memoize(function (db) {
	var StringLine = defineStringLine(db)
	  , Currency = defineCurrency(db);

	return db.Object.extend('Cost', {
		// Cost label
		label: { type: StringLine },
		// Cost amount
		amount: { type: Currency, step: 1 },
		// Whether cost have been paid
		isPaid: { type: db.Boolean, value: false },
		// Whether payment is made online
		isElectronic: { type: db.Boolean, value: false }
	});
}, { normalizer: require('memoizee/normalizers/get-1')() });
<|endoftext|>


<commit_before>describe('ui.grid.edit uiGridCellNavService', function() {
	var uiGridCellNavService,
		gridClassFactory,
		grid,
		uiGridConstants,
		uiGridCellNavConstants,
		$rootScope,
		$timeout;

	beforeEach(module('ui.grid.cellNav'));

	beforeEach(inject(
		function(_uiGridCellNavService_, _gridClassFactory_, $templateCache, _uiGridConstants_, _uiGridCellNavConstants_, _$rootScope_, _$timeout_) {
			uiGridCellNavService = _uiGridCellNavService_;
			gridClassFactory = _gridClassFactory_;
			uiGridConstants = _uiGridConstants_;
			uiGridCellNavConstants = _uiGridCellNavConstants_;
			$rootScope = _$rootScope_;
			$timeout = _$timeout_;

			$templateCache.put('ui-grid/uiGridCell', '<div/>');

			grid = gridClassFactory.createGrid();
			// throttled scrolling isn't working in tests for some reason
			grid.options.rowHeight = 30;
			grid.options.scrollDebounce = 0;
			grid.options.columnDefs = [
				{name: 'col0', allowCellFocus: true},
				{name: 'col1', allowCellFocus: false},
				{name: 'col2'}
			];

			grid.options.data = [
				{col0: 'row0col0', col1: 'row0col1', col2: 'row0col2'},
				{col0: 'row1col0', col1: 'row1col1', col2: 'row1col2'},
				{col0: 'row2col0', col1: 'row2col1', col2: 'row2col2'}
			];

			uiGridCellNavService.initializeGrid(grid);
			grid.modifyRows(grid.options.data);
		}));

	describe('public Apis function', function() {
		beforeEach(function() {
			grid.buildColumns();
		});

		it('should have getFocusedCell', function() {
			expect(grid.api.cellNav.getFocusedCell()).toBeDefined();
			expect(grid.api.cellNav.getFocusedCell()).toBe(null);
			grid.cellNav.lastRowCol = 'mockRowCol';
			expect(grid.api.cellNav.getFocusedCell()).toBe('mockRowCol');
		});
	});

	describe('cellNavColumnBuilder function', function() {
		beforeEach(function() {
			grid.buildColumns();
		});

		it('should populate allowCellFocus with defaults', function() {
			var colDef = grid.options.columnDefs[0];
			var col = grid.columns[0];
			uiGridCellNavService.cellNavColumnBuilder(colDef, col, grid.options);
			expect(col.colDef.allowCellFocus).toBe(true);

			colDef = grid.options.columnDefs[1];
			col = grid.columns[1];
			uiGridCellNavService.cellNavColumnBuilder(colDef, col, grid.options);
			expect(col.colDef.allowCellFocus).toBe(false);

			colDef = grid.options.columnDefs[2];
			col = grid.columns[2];
			uiGridCellNavService.cellNavColumnBuilder(colDef, col, grid.options);
			expect(col.colDef.allowCellFocus).toBe(true);
		});
	});

	describe('getDirection(evt)', function() {
		beforeEach(function() {
			grid.registerColumnBuilder(uiGridCellNavService.cellNavColumnBuilder);
			grid.buildColumns();
		});
		it('should navigate right on tab', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.TAB;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.RIGHT);
		});

		it('should navigate right on right arrow', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.RIGHT;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.RIGHT);
		});

		it('should navigate left on shift tab', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.TAB;
			evt.shiftKey = true;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.LEFT);
		});

		it('should navigate left on left arrow', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.LEFT;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.LEFT);
		});

		it('should navigate down on enter', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.ENTER;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.DOWN);
		});

		it('should navigate down on down arrow', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.DOWN;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.DOWN);
		});

		it('should navigate up on shift enter', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.ENTER;
			evt.shiftKey = true;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.UP);
		});

		it('should navigate up on up arrow', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.UP;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.UP);
		});

	});

	describe('scrollTo', function() {
		/*
		 * We have 11 rows (10 visible) and 11 columns (10 visible).  The column widths are
		 * 100 for the first 5, and 200 for the second 5.  Column 2 and row 2 are invisible.
		 */
		var args;
		var $scope;

		beforeEach(function() {
			var i, j, row;
			grid.options.columnDefs = [];
			for (i = 0; i < 11; i++) {
				grid.options.columnDefs.push({name: 'col' + i});
			}

			grid.options.data = [];
			for (i = 0; i < 11; i++) {
				row = {};
				for (j = 0; j < 11; j++) {
					row['col' + j] = 'test data ' + i + '_' + j;
				}
				grid.options.data.push(row);
			}

			uiGridCellNavService.initializeGrid(grid);
			grid.modifyRows(grid.options.data);

			grid.registerColumnBuilder(uiGridCellNavService.cellNavColumnBuilder);
			grid.buildColumns();

			grid.columns[2].visible = false;
			grid.rows[2].visible = false;

			grid.setVisibleColumns(grid.columns);
			grid.setVisibleRows(grid.rows);

			grid.renderContainers.body.headerHeight = 0;

			for (i = 0; i < 11; i++) {
				grid.columns[i].drawnWidth = i < 6 ? 100 : 200;
			}

			$scope = $rootScope.$new();

			args = null;
			grid.api.core.on.scrollEnd($scope, function(receivedArgs) {
				args = receivedArgs;
			});
		});

		// these have changed to use scrollToIfNecessary, which is better code
		// but it means these unit tests are now mostly checking that it is the same it used to
		// be, not that it is giving some specified result (i.e. I just updated them to what they were)
		it('should request scroll to row and column', function() {
			$timeout(function() {
				grid.scrollTo(grid.options.data[4], grid.columns[4].colDef);
			});
			$timeout.flush();

			expect(args.grid).toEqual(grid);
			expect(Math.round(args.y.percentage * 10) / 10).toBe(0.5);
			expect(isNaN(args.x.percentage)).toEqual(true);
		});

		it('should request scroll to row only - first row', function() {
			$timeout(function() {
				grid.scrollTo(grid.options.data[0], null);
			});
			$timeout.flush();

			// TODO: figure out why Safari fails on this check
			if (navigator.userAgent.indexOf('Safari') === -1) {
				expect(args.y.percentage).toBeCloseTo(0.15, 0.01);
			}
		});

		it('should request scroll to row only - last row', function() {
			$timeout(function() {
				grid.scrollTo(grid.options.data[10], null);
			});
			$timeout.flush();

			expect(args.y.percentage).toBeGreaterThan(0.5);
			expect(args.x).toBe(null);
		});

		it('should request scroll to row only - row 4', function() {
			$timeout(function() {
				grid.scrollTo(grid.options.data[5], null);
			});
			$timeout.flush();

			expect(Math.round(args.y.percentage * 10) / 10).toEqual(0.6);
			expect(args.x).toBe(null);
		});

		it('should request scroll to column only - first column', function() {
			$timeout(function() {
				grid.scrollTo(null, grid.columns[0].colDef);
			});
			$timeout.flush();

			expect(isNaN(args.x.percentage)).toEqual(true);
		});

		it('should request scroll to column only - last column', function() {
			$timeout(function() {
				grid.scrollTo(null, grid.columns[10].colDef);
			});
			$timeout.flush();

			expect(isNaN(args.x.percentage)).toEqual(true);
		});

		it('should request scroll to column only - column 7', function() {
			$timeout(function() {
				grid.scrollTo(null, grid.columns[8].colDef);
			});
			$timeout.flush();

			expect(isNaN(args.x.percentage)).toEqual(true);
		});

		it('should request no scroll as no row or column', function() {
			$timeout(function() {
				grid.scrollTo(null, null);
			});
			$timeout.flush();

			expect(args).toEqual(null);
		});
	});
});
<commit_msg>chore: 🤖 ensure gridHeight is constant to avoid inconsistencies<commit_after>describe('ui.grid.edit uiGridCellNavService', function() {
	var uiGridCellNavService,
		gridClassFactory,
		grid,
		uiGridConstants,
		uiGridCellNavConstants,
		$rootScope,
		$timeout;

	beforeEach(module('ui.grid.cellNav'));

	beforeEach(inject(
		function(_uiGridCellNavService_, _gridClassFactory_, $templateCache, _uiGridConstants_, _uiGridCellNavConstants_, _$rootScope_, _$timeout_) {
			uiGridCellNavService = _uiGridCellNavService_;
			gridClassFactory = _gridClassFactory_;
			uiGridConstants = _uiGridConstants_;
			uiGridCellNavConstants = _uiGridCellNavConstants_;
			$rootScope = _$rootScope_;
			$timeout = _$timeout_;

			$templateCache.put('ui-grid/uiGridCell', '<div/>');

			grid = gridClassFactory.createGrid();
			// throttled scrolling isn't working in tests for some reason
			grid.gridHeight = 30;
			grid.options.rowHeight = 30;
			grid.options.scrollDebounce = 0;
			grid.options.columnDefs = [
				{name: 'col0', allowCellFocus: true},
				{name: 'col1', allowCellFocus: false},
				{name: 'col2'}
			];

			grid.options.data = [
				{col0: 'row0col0', col1: 'row0col1', col2: 'row0col2'},
				{col0: 'row1col0', col1: 'row1col1', col2: 'row1col2'},
				{col0: 'row2col0', col1: 'row2col1', col2: 'row2col2'}
			];

			uiGridCellNavService.initializeGrid(grid);
			grid.modifyRows(grid.options.data);
		}));

	describe('public Apis function', function() {
		beforeEach(function() {
			grid.buildColumns();
		});

		it('should have getFocusedCell', function() {
			expect(grid.api.cellNav.getFocusedCell()).toBeDefined();
			expect(grid.api.cellNav.getFocusedCell()).toBe(null);
			grid.cellNav.lastRowCol = 'mockRowCol';
			expect(grid.api.cellNav.getFocusedCell()).toBe('mockRowCol');
		});
	});

	describe('cellNavColumnBuilder function', function() {
		beforeEach(function() {
			grid.buildColumns();
		});

		it('should populate allowCellFocus with defaults', function() {
			var colDef = grid.options.columnDefs[0];
			var col = grid.columns[0];
			uiGridCellNavService.cellNavColumnBuilder(colDef, col, grid.options);
			expect(col.colDef.allowCellFocus).toBe(true);

			colDef = grid.options.columnDefs[1];
			col = grid.columns[1];
			uiGridCellNavService.cellNavColumnBuilder(colDef, col, grid.options);
			expect(col.colDef.allowCellFocus).toBe(false);

			colDef = grid.options.columnDefs[2];
			col = grid.columns[2];
			uiGridCellNavService.cellNavColumnBuilder(colDef, col, grid.options);
			expect(col.colDef.allowCellFocus).toBe(true);
		});
	});

	describe('getDirection(evt)', function() {
		beforeEach(function() {
			grid.registerColumnBuilder(uiGridCellNavService.cellNavColumnBuilder);
			grid.buildColumns();
		});
		it('should navigate right on tab', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.TAB;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.RIGHT);
		});

		it('should navigate right on right arrow', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.RIGHT;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.RIGHT);
		});

		it('should navigate left on shift tab', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.TAB;
			evt.shiftKey = true;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.LEFT);
		});

		it('should navigate left on left arrow', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.LEFT;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.LEFT);
		});

		it('should navigate down on enter', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.ENTER;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.DOWN);
		});

		it('should navigate down on down arrow', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.DOWN;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.DOWN);
		});

		it('should navigate up on shift enter', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.ENTER;
			evt.shiftKey = true;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.UP);
		});

		it('should navigate up on up arrow', function() {
			var evt = jQuery.Event('keydown');
			evt.keyCode = uiGridConstants.keymap.UP;
			var direction = uiGridCellNavService.getDirection(evt);
			expect(direction).toBe(uiGridCellNavConstants.direction.UP);
		});

	});

	describe('scrollTo', function() {
		/*
		 * We have 11 rows (10 visible) and 11 columns (10 visible).  The column widths are
		 * 100 for the first 5, and 200 for the second 5.  Column 2 and row 2 are invisible.
		 */
		var args;
		var $scope;

		beforeEach(function() {
			var i, j, row;
			grid.options.columnDefs = [];
			for (i = 0; i < 11; i++) {
				grid.options.columnDefs.push({name: 'col' + i});
			}

			grid.options.data = [];
			for (i = 0; i < 11; i++) {
				row = {};
				for (j = 0; j < 11; j++) {
					row['col' + j] = 'test data ' + i + '_' + j;
				}
				grid.options.data.push(row);
			}

			uiGridCellNavService.initializeGrid(grid);
			grid.modifyRows(grid.options.data);

			grid.registerColumnBuilder(uiGridCellNavService.cellNavColumnBuilder);
			grid.buildColumns();

			grid.columns[2].visible = false;
			grid.rows[2].visible = false;

			grid.setVisibleColumns(grid.columns);
			grid.setVisibleRows(grid.rows);

			grid.renderContainers.body.headerHeight = 0;

			for (i = 0; i < 11; i++) {
				grid.columns[i].drawnWidth = i < 6 ? 100 : 200;
			}

			$scope = $rootScope.$new();

			args = null;
			grid.api.core.on.scrollEnd($scope, function(receivedArgs) {
				args = receivedArgs;
			});
		});

		// these have changed to use scrollToIfNecessary, which is better code
		// but it means these unit tests are now mostly checking that it is the same it used to
		// be, not that it is giving some specified result (i.e. I just updated them to what they were)
		it('should request scroll to row and column', function() {
			$timeout(function() {
				grid.scrollTo(grid.options.data[4], grid.columns[4].colDef);
			});
			$timeout.flush();

			expect(args.grid).toEqual(grid);
			expect(Math.round(args.y.percentage * 10) / 10).toBe(0.4);
			expect(isNaN(args.x.percentage)).toEqual(true);
		});

		it('should request scroll to row only - first row', function() {
			$timeout(function() {
				grid.scrollTo(grid.options.data[0], null);
			});
			$timeout.flush();

			// TODO: figure out why Safari fails on this check
			if (navigator.userAgent.indexOf('Safari') === -1) {
				expect(args.y.percentage).toBeCloseTo(0.15, 0.01);
			}
		});

		it('should request scroll to row only - last row', function() {
			$timeout(function() {
				grid.scrollTo(grid.options.data[10], null);
			});
			$timeout.flush();

			expect(args.y.percentage).toBeGreaterThan(0.5);
			expect(args.x).toBe(null);
		});

		it('should request scroll to row only - row 4', function() {
			$timeout(function() {
				grid.scrollTo(grid.options.data[5], null);
			});
			$timeout.flush();

			expect(Math.round(args.y.percentage * 10) / 10).toEqual(0.5);
			expect(args.x).toBe(null);
		});

		it('should request scroll to column only - first column', function() {
			$timeout(function() {
				grid.scrollTo(null, grid.columns[0].colDef);
			});
			$timeout.flush();

			expect(isNaN(args.x.percentage)).toEqual(true);
		});

		it('should request scroll to column only - last column', function() {
			$timeout(function() {
				grid.scrollTo(null, grid.columns[10].colDef);
			});
			$timeout.flush();

			expect(isNaN(args.x.percentage)).toEqual(true);
		});

		it('should request scroll to column only - column 7', function() {
			$timeout(function() {
				grid.scrollTo(null, grid.columns[8].colDef);
			});
			$timeout.flush();

			expect(isNaN(args.x.percentage)).toEqual(true);
		});

		it('should request no scroll as no row or column', function() {
			$timeout(function() {
				grid.scrollTo(null, null);
			});
			$timeout.flush();

			expect(args).toEqual(null);
		});
	});
});
<|endoftext|>


<commit_before>angular.module('rapid-build').config(['$provide', 'RB_COMMON_API', (p, common) => {
p.constant('RB_TOGGLE_API',
[
	{
		attribute: 'cache',
		description: `
			defaults to true
			If cache is true, onclick and fetch options will only
			fire the first time the toggle is opened.
		`,
		options: 'false',
		type: `bool`,
		required: false
	},
	{
		attribute: 'caption',
		description: `
			Text beside toggle icon.
		`,
		options: null,
		type: 'string',
		required: false
	},
	common.get('content'),
	// common.get('dark'),
	common.get('disabled'),
	{
		attribute: 'icon-kind-closed',
		description: `Closed toggle icon.`,
		options: `<a href="/components/rb-icon">rb-icon kind</a>`,
		type: 'string',
		required: false
	},
	{
		attribute: 'icon-kind-loading',
		description: `Loading icon.`,
		options: `<a href="/components/rb-icon">rb-icon kind</a>`,
		type: 'string',
		required: false
	},
	{
		attribute: 'icon-kind-open',
		description: `Open toggle icon.`,
		options: `<a href="/components/rb-icon">rb-icon kind</a>`,
		type: 'string',
		required: false
	},
	{
		attribute: 'icon-size-closed',
		description: `Closed toggle icon size.`,
		options: `
			rb-icon size
		`,
		type: 'number',
		required: false
	},
	{
		attribute: 'icon-size-loading',
		description: `Loading icon size.`,
		options: `
			rb-icon size
		`,
		type: 'number',
		required: false
	},
	{
		attribute: 'icon-size-open',
		description: `Open toggle icon size.`,
		options: `
			rb-icon size
		`,
		type: 'number',
		required: false
	},
	{
		attribute: 'icon-source-closed',
		description: `Refer to options.`,
		options: `<a href="/components/rb-icon">rb-icon source</a>`,
		type: 'string',
		required: false
	},
	{
		attribute: 'icon-source-loading',
		description: `Refer to options.`,
		options: `<a href="/components/rb-icon">rb-icon source</a>`,
		type: 'string',
		required: false
	},
	{
		attribute: 'icon-source-open',
		description: `Refer to options.`,
		options: `<a href="/components/rb-icon">rb-icon source</a>`,
		type: 'string',
		required: false
	},
	{
		attribute: 'fetch',
		description: `
			Path or url to file.

						toggle opens once
						file is fetched

						content will be set
						to file's contents

		`,
		options: null,
		type: 'string',
		required: false
	},
	common.get('inline'),
	common.get('kind'),
	{
		attribute: 'open',
		description: `
			defaults to false
			Opens the toggle.
		`,
		options: 'true',
		type: `n/a | bool`,
		required: false
	},
	common.get('onclick', {
		description: `
			Function to execute when opening toggle.

						toggle opens once function completes

						if function returns a string or
						a promise that resolves a string,
						content will be set to that string

						you'll usually set this in javascript

		`
	}),
	common.get('popover')
]
)}])<commit_msg>chore(rb-toggle api): comment out icon options, will be in next version<commit_after>angular.module('rapid-build').config(['$provide', 'RB_COMMON_API', (p, common) => {
p.constant('RB_TOGGLE_API',
[
	{
		attribute: 'cache',
		description: `
			defaults to true
			If cache is true, onclick and fetch options will only
			fire the first time the toggle is opened.
		`,
		options: 'false',
		type: `bool`,
		required: false
	},
	{
		attribute: 'caption',
		description: `
			Text beside toggle icon.
		`,
		options: null,
		type: 'string',
		required: false
	},
	common.get('content'),
	// common.get('dark'),
	common.get('disabled'),
	/*{
		attribute: 'icon-kind-closed',
		description: `Closed toggle icon.`,
		options: `<a href="/components/rb-icon">rb-icon kind</a>`,
		type: 'string',
		required: false
	},*/
	/*{
		attribute: 'icon-kind-loading',
		description: `Loading icon.`,
		options: `<a href="/components/rb-icon">rb-icon kind</a>`,
		type: 'string',
		required: false
	},*/
	/*{
		attribute: 'icon-kind-open',
		description: `Open toggle icon.`,
		options: `<a href="/components/rb-icon">rb-icon kind</a>`,
		type: 'string',
		required: false
	},*/
	/*{
		attribute: 'icon-size-closed',
		description: `Closed toggle icon size.`,
		options: `
			rb-icon size
		`,
		type: 'number',
		required: false
	},*/
	/*{
		attribute: 'icon-size-loading',
		description: `Loading icon size.`,
		options: `
			rb-icon size
		`,
		type: 'number',
		required: false
	},*/
	/*{
		attribute: 'icon-size-open',
		description: `Open toggle icon size.`,
		options: `
			rb-icon size
		`,
		type: 'number',
		required: false
	},*/
	/*{
		attribute: 'icon-source-closed',
		description: `Refer to options.`,
		options: `<a href="/components/rb-icon">rb-icon source</a>`,
		type: 'string',
		required: false
	},*/
	/*{
		attribute: 'icon-source-loading',
		description: `Refer to options.`,
		options: `<a href="/components/rb-icon">rb-icon source</a>`,
		type: 'string',
		required: false
	},*/
	/*{
		attribute: 'icon-source-open',
		description: `Refer to options.`,
		options: `<a href="/components/rb-icon">rb-icon source</a>`,
		type: 'string',
		required: false
	},*/
	{
		attribute: 'fetch',
		description: `
			Path or url to file.

						toggle opens once
						file is fetched

						content will be set
						to file's contents

		`,
		options: null,
		type: 'string',
		required: false
	},
	common.get('inline'),
	common.get('kind'),
	{
		attribute: 'open',
		description: `
			defaults to false
			Opens the toggle.
		`,
		options: 'true',
		type: `n/a | bool`,
		required: false
	},
	common.get('onclick', {
		description: `
			Function to execute when opening toggle.

						toggle opens once function completes

						if function returns a string or
						a promise that resolves a string,
						content will be set to that string

						you'll usually set this in javascript

		`
	}),
	common.get('popover')
]
)}])<|endoftext|>


<commit_before>// The queries allow you to grab the data you want Algolia to index directly from
// Gatsby’s GraphQL layer by exporting from src/utils/algolia.js an array of objects,
// each containing a required GraphQL query and an optional index name,
// transformer function and settings object.

//  the query property is a GraphQL query string.
// The transformer is a function that takes the data retrieved by the query and
// transforms it into the array of objects that will become your Algolia index records.

require('dotenv').config({
  path: `.env.${process.env.NODE_ENV}`,
});

const algoliaIndex = (process.env.NODE_ENV === 'development') ? 'dev_docs' : 'docs';

const pageQuery = `{
  docs: allMarkdownRemark(
    filter: {
      fileAbsolutePath: { regex: "/docs/" },
    }
  ) {
    edges {
      node {
        headings(depth: h3) {
          value
        }
        id
        frontmatter {
          title
          search_keyword
          contextual_links {
            type
            name
            url
          }
        }
        fields {
          slug
        }
        excerpt(
          pruneLength: 6700
        )
      }
    }
  }
}`;

function pageToAlgoliaRecord({ node: { id, frontmatter, ...rest } }) {
  return {
    objectID: id,
    ...frontmatter,
    ...rest,
  };
}

const settings = { attributesToSnippet: ['excerpt:20'] };

const queries = [
  {
    query: pageQuery,
    transformer: ({ data }) => data.docs.edges.map(pageToAlgoliaRecord),
    indexName: algoliaIndex,
    settings,
  },
];

module.exports = queries;
<commit_msg>remove contextual_links - right nav bar - from Algolia Index<commit_after>// The queries allow you to grab the data you want Algolia to index directly from
// Gatsby’s GraphQL layer by exporting from src/utils/algolia.js an array of objects,
// each containing a required GraphQL query and an optional index name,
// transformer function and settings object.

//  the query property is a GraphQL query string.
// The transformer is a function that takes the data retrieved by the query and
// transforms it into the array of objects that will become your Algolia index records.

require('dotenv').config({
  path: `.env.${process.env.NODE_ENV}`,
});

const algoliaIndex = (process.env.NODE_ENV === 'development') ? 'dev_docs' : 'docs';

const pageQuery = `{
  docs: allMarkdownRemark(
    filter: {
      fileAbsolutePath: { regex: "/docs/" },
    }
  ) {
    edges {
      node {
        headings(depth: h3) {
          value
        }
        id
        frontmatter {
          title
          search_keyword
        }
        fields {
          slug
        }
        excerpt(
          pruneLength: 6700
        )
      }
    }
  }
}`;

function pageToAlgoliaRecord({ node: { id, frontmatter, ...rest } }) {
  return {
    objectID: id,
    ...frontmatter,
    ...rest,
  };
}

const settings = { attributesToSnippet: ['excerpt:20'] };

const queries = [
  {
    query: pageQuery,
    transformer: ({ data }) => data.docs.edges.map(pageToAlgoliaRecord),
    indexName: algoliaIndex,
    settings,
  },
];

module.exports = queries;
<|endoftext|>


<commit_before>const config = {
    'header': {
        "appName": "Simulation Manager",
        "navItems": {
            "item1": {
                "name": 'Simulation Manager'
            },
            "item2": {
                "name": 'Active Que'
            },
            "item3": {
                "name": 'Process Tracker'
            },
            "item4": {
                "name": 'Setttings'
            },
        },
    },
}

export default config<commit_msg>Adds main config obj<commit_after>const config = {
    'header': {
        "appName": "Simulation Manager",
        "navItems": {
            "item1": {
                "name": 'Simulation Manager'
            },
            "item2": {
                "name": 'Active Que'
            },
            "item3": {
                "name": 'Process Tracker'
            },
            "item4": {
                "name": 'Setttings'
            },
        },
    },
    'body': {
        "simulationManager": {
            "title": "Simulation Manager"
        },
        "activeQue": {
            "title": "Active Que"
        },
        "processTracker": {
            "title": "Process Tracker"
        },
    }
}

export default config<|endoftext|>


<commit_before>// ==UserScript==
// @name         OPR Show EXIF Info
// @version      0.1
// @namespace    https://github.com/DeepAQ/SmartIntel
// @description  Show EXIF info of photos in OPR
// @match        *://opr.ingress.com/recon
// @require      https://cdn.bootcss.com/zepto/1.2.0/zepto.min.js
// @require      https://cdn.bootcss.com/exif-js/2.3.0/exif.min.js
// ==/UserScript==

(function() {
    var tagsToShow = ['DateTime', 'Make', 'Model', 'Software', 'GPSLatitude', 'GPSLongitude'];

    var getExif = function (url) {
        var img = document.createElement('img');
        img.src = url;
        img.onload = function () {
            EXIF.getData(img, function () {
                var tags = EXIF.getAllTags(this);
                var info = '[EXIF]
';
                for (var key in tagsToShow) {
                    if (tags[tagsToShow[key]]) {
                        info += '' + tagsToShow[key] + ': ' + tags[tagsToShow[key]] + '
';
                    }
                }
                $('#descriptionDiv').append('
' + info + '
');
            });
        };
    };

    var tryGetImgUrl = function () {
        var url = $('.center-cropped-img').attr('src');
        if (!url) {
            setTimeout(tryGetImgUrl, 1000);
        } else {
            getExif((url + '=s0').replace('http:', 'https:'));
        }
    };

    tryGetImgUrl();
})();
<commit_msg>Show OSM button if GPSLatitude + GPSLongitude are set<commit_after>// ==UserScript==
// @name         OPR Show EXIF Info
// @version      0.1
// @namespace    https://github.com/DeepAQ/SmartIntel
// @description  Show EXIF info of photos in OPR
// @match        *://opr.ingress.com/recon
// @require      https://cdn.bootcss.com/zepto/1.2.0/zepto.min.js
// @require      https://cdn.bootcss.com/exif-js/2.3.0/exif.min.js
// ==/UserScript==

function dms_to_deg(dms)
{
    var d = dms[0];
    var m = dms[1];
    var s = dms[2];

    var deg = d/1 + m/60 + s/3600;
    return deg;
}

(function() {
    var tagsToShow = ['DateTime', 'Make', 'Model', 'Software', 'GPSLatitude', 'GPSLongitude'];

    var getExif = function (url) {
        var img = document.createElement('img');
        img.src = url;
        img.onload = function () {
            EXIF.getData(img, function () {
                var tags = EXIF.getAllTags(this);
                var info = '[EXIF]
';
                for (var key in tagsToShow) {
                    if (tags[tagsToShow[key]]) {
                        info += '' + tagsToShow[key] + ': ' + tags[tagsToShow[key]] + '
';
                    }
                }
                if (tags['GPSLatitude'] && tags['GPSLongitude'])
                {
                    var deglat = dms_to_deg(tags['GPSLatitude']);
                    var deglon = dms_to_deg(tags['GPSLongitude']);
                    info += '
OSM
';
                }

                $('#descriptionDiv').append('
' + info + '
');
            });
        };
    };

    var tryGetImgUrl = function () {
        var url = $('.center-cropped-img').attr('src');
        if (!url) {
            setTimeout(tryGetImgUrl, 1000);
        } else {
            getExif((url + '=s0').replace('http:', 'https:'));
        }
    };

    tryGetImgUrl();
})();
<|endoftext|>


<commit_before>(function() {
  'use strict';

  var app = angular.module('radar.patients');

  function PatientDetailController(
    $scope,
    patient,
    session,
    hasPermissionForPatient,
    toggleDemographicsService,
    titleService
  ) {
    $scope.patient = patient;
    $scope.viewDemographicsPermission = hasPermissionForPatient(session.user, patient, 'VIEW_DEMOGRAPHICS');

    $scope.$watch(function() {
      return patient.getName(toggleDemographicsService.isVisible());
    }, titleService.setTitle);
  }

  PatientDetailController.$inject = [
    '$scope',
    'patient',
    'session',
    'hasPermissionForPatient',
    'toggleDemographicsService',
    'titleService'
  ];

  app.controller('PatientDetailController', PatientDetailController);
})();
<commit_msg>Add comment<commit_after>(function() {
  'use strict';

  var app = angular.module('radar.patients');

  function PatientDetailController(
    $scope,
    patient,
    session,
    hasPermissionForPatient,
    toggleDemographicsService,
    titleService
  ) {
    $scope.patient = patient;
    $scope.viewDemographicsPermission = hasPermissionForPatient(session.user, patient, 'VIEW_DEMOGRAPHICS');

    // Set the title to the patient's name
    $scope.$watch(function() {
      return patient.getName(toggleDemographicsService.isVisible());
    }, titleService.setTitle);
  }

  PatientDetailController.$inject = [
    '$scope',
    'patient',
    'session',
    'hasPermissionForPatient',
    'toggleDemographicsService',
    'titleService'
  ];

  app.controller('PatientDetailController', PatientDetailController);
})();
<|endoftext|>


<commit_before>'use strict';

const DriveWatch = require('drive-watch');

let callbacks = [];

function runCallbacks(eventType, driveName) {
	if (eventType !== 'mount') {
		return;
	}

	callbacks.forEach(callback => callback(driveName));
}

const dw = new DriveWatch(runCallbacks, {
	scanInterval: 60000
});

dw.start();

exports = module.exports = {
	watch: (callback) => {
		if (typeof callback === 'function') {
			callbacks.push(callback);
		}
	},
	unwatch: (callback) => {
		let index = callbacks.indexOf(callback);

		if (index >= 0) {
			callbacks = callbacks
				.slice(0, index)
				.concat(callbacks.slice(index + 1));
		}
	}
};<commit_msg>Status logging on drive change<commit_after>'use strict';

const DriveWatch = require('drive-watch');

let callbacks = [];

function runCallbacks(eventType, driveName) {
	console.log(`${eventType} on ${driveName}`);

	if (eventType !== 'mount') {
		return;
	}

	callbacks.forEach(callback => callback(driveName));
}

const dw = new DriveWatch(runCallbacks, {
	scanInterval: 60000
});

dw.start();

exports = module.exports = {
	watch: (callback) => {
		if (typeof callback === 'function') {
			callbacks.push(callback);
		}
	},
	unwatch: (callback) => {
		let index = callbacks.indexOf(callback);

		if (index >= 0) {
			callbacks = callbacks
				.slice(0, index)
				.concat(callbacks.slice(index + 1));
		}
	}
};<|endoftext|>


<commit_before>ZBase.registerView((function() {
  var query_mgr;
  var path_prefix = "/a/apps/dawanda_seller_analytics";

  var load = function(path) {
    ZBaseMainMenu.show();
    HeaderWidget.setBreadCrumbs([
      {href: path_prefix, title: "Analytics"},
      {href: path_prefix, title: "Sellers"}]);

    var result;
    var page = $.getTemplate(
        "views/seller",
        "seller_overview_main_tpl");

    $.onClick($("z-checkbox.premium", page), paramChanged);
    $("z-dropdown.metrics", page).addEventListener("change", function() {
      renderTable($(".zbase_seller_overview table.overview"), result, path);
      $.pushHistoryState(path_prefix + "?" + $.buildQueryString(getQueryParams()));
    });
    $("z-search.seller", page).addEventListener("z-search-submit", function(e) {
      $.navigateTo(path_prefix + "/" + e.detail.value);
    });

    $.handleLinks(page);
    $.replaceViewport(page);

    setParamPremiumSeller(UrlUtil.getParamValue(path, "premium"));
    setParamMetrics(UrlUtil.getParamValue(path, "metrics"));
    setParamOffset(UrlUtil.getParamValue(path, "offset"));
    setParamsOrder(
        UrlUtil.getParamValue(path, "order_by"),
        UrlUtil.getParamValue(path, "order_fn"));

    query_mgr = EventSourceHandler();
    var query = query_mgr.get(
      "sql_query",
      "/api/v1/sql?format=json_sse&query=" + encodeURIComponent(getSQLQuery()));

    query.addEventListener("result", function(e) {
      query_mgr.close("sql_query");
      result = JSON.parse(e.data).results[0];
      hideLoader();
      renderTable($(".zbase_seller_overview table.overview"), result, path);
      setPaginationFor(result.rows.length);
      setPaginationBack();

      var until = Date.now();
      $(".zbase_seller_overview .time_range").innerHTML =
         DateUtil.printDate(until - DateUtil.millisPerDay) + "-" +
         DateUtil.printDate(until);
    });

    query.addEventListener("error", function(e) {
      query_mgr.close("sql_query");
      $.fatalError();
    }, false);

    query.addEventListener("status", function(e) {
      renderQueryProgress(JSON.parse(e.data));
    }, false);
  };

  var destroy = function() {
    query_mgr.closeAll();
  };

  var getSQLQuery = function() {
    var order = getParamsOrder();
    var offset = getParamOffset();

    var query_str =
      "select count(1) as days, shop_id, " +
      "sum(num_active_products) num_active_products, " +
      "sum(num_listed_products) num_listed_products, " +
      "sum(num_purchases) num_purchases, " +
      "sum(num_refunds) num_refunds," +
      "sum(refund_rate) refund_rate," +
      "sum(gmv_eurcent) gmv_eurcent, " +
      "sum(refunded_gmv_eurcent) refunded_gmv_eurcent," +
      "sum(gmv_per_transaction_eurcent) / count(1) gmv_per_transaction_eurcent, " +
      "sum(shop_page_views) shop_page_views, " +
      "sum(product_page_views) product_page_views, " +
      "sum(listview_views_search_page) + sum(listview_views_shop_page) + sum(listview_views_catalog_page) + sum(listview_views_ads) + sum(listview_views_recos) as total_listviews, " +
      "sum(listview_views_search_page) listview_views_search_page," +
      "sum(listview_clicks_search_page) listview_clicks_search_page," +
      "sum(listview_ctr_search_page) / count(1) listview_ctr_search_page," +
      "sum(listview_views_catalog_page) listview_views_catalog_page," +
      "sum(listview_clicks_catalog_page) listview_clicks_catalog_page," +
      "sum(listview_ctr_catalog_page) / count(1) listview_ctr_catalog_page," +
      "sum(listview_views_shop_page) listview_views_shop_page," +
      "sum(listview_clicks_shop_page) listview_clicks_shop_page," +
      "sum(listview_ctr_shop_page) / count(1) listview_ctr_shop_page," +
      "sum(listview_views_ads) listview_views_ads, " +
      "sum(listview_clicks_ads) listview_clicks_ads, " +
      "sum(listview_ctr_ads) / count(1) listview_ctr_ads, " +
      "sum(listview_views_recos) listview_views_recos, " +
      "sum(listview_clicks_recos) listview_clicks_recos, " +
      "sum(listview_ctr_recos) / count(1) listview_ctr_recos " +
      "from shop_stats.last30d where " +
      order.order_by + " > 0 group by shop_id order by " + order.order_by +
      " " + order.order_fn + " limit 20 offset " + offset + ";";

    return query_str;
  };

  var renderQueryProgress = function(progress) {
    QueryProgressWidget.render(
        $(".zbase_seller_stats .query_progress"),
        progress);
  };

  var hideLoader = function() {
    $(".zbase_seller_stats .zbase_seller_overview").classList.remove("hidden");
    $(".zbase_seller_stats .query_progress").classList.add("hidden");
  };

  var renderTable = function(elem, result, path) {
    var metrics = {shop_id: true};
    $(".zbase_seller_stats z-dropdown.metrics")
        .getValue()
        .split(",")
        .forEach(function(metric) {
          metrics[metric] = true;
        });

    var table_tpl = $.getTemplate(
        "views/seller_overview",
        "seller_overview_table_tpl");

    result.columns.forEach(function(metric) {
      if (metrics[metric]) {
        var th = $("th." + metric, table_tpl);
        th.classList.remove("hidden");
        $.onClick($(".asc", th), function() {
          orderByParamChanged(metric, "asc");
        });
        $.onClick($(".desc", th), function() {
          orderByParamChanged(metric, "desc");
        });
      }
    });

    var tr_tpl = $.getTemplate(
        "views/seller_overview",
        "seller_overview_row_tpl");

    var tbody = $("tbody", table_tpl);
    result.rows.forEach(function(row) {
      var tr = tr_tpl.cloneNode(true);
      var url = "/a/apps/dawanda_seller_analytics/" + row[1]

      for (var i = 0; i < row.length; i++) {
        if (metrics[result.columns[i]]) {
          var td = $("td." + result.columns[i], tr);
          var a = $("a", td);
          a.innerHTML = ZBaseSellerMetrics[result.columns[i]].print(row[i]);
          a.href = url;
          td.classList.remove("hidden");
        }
      }

      tbody.appendChild(tr);
    });

    $.handleLinks(table_tpl);
    $.replaceContent(elem, table_tpl);

    setParamsOrder(
        UrlUtil.getParamValue(path, "order_by"),
        UrlUtil.getParamValue(path, "order_fn"));
  };

  var setPaginationFor = function(num_results) {
    var params = getQueryParams();
    params.limit = parseInt(params.limit, 10);

    if (num_results < params.limit) {
      $(".zbase_seller_stats .pager .for").classList.add("disabled");
      return;
    }

    params.offset = parseInt(params.offset, 10) + params.limit;
    $(".zbase_seller_stats .pager .for").href =
        path_prefix + "?" + $.buildQueryString(params);
  };

  var setPaginationBack = function() {
    var params = getQueryParams();
    params.offset = parseInt(params.offset, 10);

    if (params.offset <= 0) {
      $(".zbase_seller_stats .pager .back").classList.add("disabled");
      return;
    }

    params.offset = params.offset - parseInt(params.limit, 10);
    $(".zbase_seller_stats .pager .back").href =
        path_prefix + "?" + $.buildQueryString(params);
  };

  var setParamPremiumSeller = function(value) {
    if (value) {
      $(".zbase_seller_stats z-checkbox.premium").setAttribute(
        "data-active", "active");
    } else {
      $(".zbase_seller_stats z-checkbox.premium").removeAttribute("data-active");
    }
  };

  var setParamMetrics = function(metrics) {
    if (metrics) {
      $(".zbase_seller_stats z-dropdown.metrics").setValue(metrics.split(","));
    }
  };

  var setParamsOrder = function(order_by, order_fn) {
    if (order_by && order_fn) {
      if ($(".zbase_seller_stats thead")) {
        $(".zbase_seller_stats th.order_by").classList.remove("order_by");
        $(".zbase_seller_stats th." + order_by).classList.add("order_by");
      }

      var table = $(".zbase_seller_stats table.overview");
      table.setAttribute("data-order-by", order_by);
      table.setAttribute("data-order-fn", order_fn);
    }
  };

  var setParamOffset = function(offset) {
    if (!offset) {
      offset = 0;
    }

    $(".zbase_seller_stats .pager").setAttribute("data-offset", offset);
  };

  var getParamsOrder = function() {
    var table = $(".zbase_seller_stats table.overview");

    return {
      order_by: table.getAttribute("data-order-by"),
      order_fn: table.getAttribute("data-order-fn")
    };
  };

  var getParamOffset = function() {
    return parseInt(
        $(".zbase_seller_stats .pager").getAttribute("data-offset"), 10);
  };

  var getQueryParams = function() {
    var params = getParamsOrder();
    params.offset = getParamOffset();
    params.metrics = $(".zbase_seller_stats z-dropdown.metrics").getValue();
    params.premium = $(".zbase_seller_stats z-checkbox.premium").hasAttribute(
          "data-active");
    params.limit = "20";

    return params;
  };

  var paramChanged = function() {
    $.navigateTo(path_prefix + "?" + $.buildQueryString(getQueryParams()));
  };

  var orderByParamChanged = function(order_by, order_fn) {
    setParamsOrder(order_by, order_fn);
    setParamOffset(0);
    paramChanged();
  };

  return {
    name: "seller_overview",
    loadView: function(params) {load(params.path);},
    unloadView: destroy,
    handleNavigationChange: load
  };

})());
<commit_msg>seller breadcrumbs<commit_after>ZBase.registerView((function() {
  var query_mgr;
  var path_prefix = "/a/apps/dawanda_seller_analytics";

  var load = function(path) {
    ZBaseMainMenu.show();
    HeaderWidget.setBreadCrumbs([
      {href: path_prefix, title: "Analytics"},
      {href: path_prefix, title: "Seller"}]);

    var result;
    var page = $.getTemplate(
        "views/seller",
        "seller_overview_main_tpl");

    $.onClick($("z-checkbox.premium", page), paramChanged);
    $("z-dropdown.metrics", page).addEventListener("change", function() {
      renderTable($(".zbase_seller_overview table.overview"), result, path);
      $.pushHistoryState(path_prefix + "?" + $.buildQueryString(getQueryParams()));
    });
    $("z-search.seller", page).addEventListener("z-search-submit", function(e) {
      $.navigateTo(path_prefix + "/" + e.detail.value);
    });

    $.handleLinks(page);
    $.replaceViewport(page);

    setParamPremiumSeller(UrlUtil.getParamValue(path, "premium"));
    setParamMetrics(UrlUtil.getParamValue(path, "metrics"));
    setParamOffset(UrlUtil.getParamValue(path, "offset"));
    setParamsOrder(
        UrlUtil.getParamValue(path, "order_by"),
        UrlUtil.getParamValue(path, "order_fn"));

    query_mgr = EventSourceHandler();
    var query = query_mgr.get(
      "sql_query",
      "/api/v1/sql?format=json_sse&query=" + encodeURIComponent(getSQLQuery()));

    query.addEventListener("result", function(e) {
      query_mgr.close("sql_query");
      result = JSON.parse(e.data).results[0];
      hideLoader();
      renderTable($(".zbase_seller_overview table.overview"), result, path);
      setPaginationFor(result.rows.length);
      setPaginationBack();

      var until = Date.now();
      $(".zbase_seller_overview .time_range").innerHTML =
         DateUtil.printDate(until - DateUtil.millisPerDay) + "-" +
         DateUtil.printDate(until);
    });

    query.addEventListener("error", function(e) {
      query_mgr.close("sql_query");
      $.fatalError();
    }, false);

    query.addEventListener("status", function(e) {
      renderQueryProgress(JSON.parse(e.data));
    }, false);
  };

  var destroy = function() {
    query_mgr.closeAll();
  };

  var getSQLQuery = function() {
    var order = getParamsOrder();
    var offset = getParamOffset();

    var query_str =
      "select count(1) as days, shop_id, " +
      "sum(num_active_products) num_active_products, " +
      "sum(num_listed_products) num_listed_products, " +
      "sum(num_purchases) num_purchases, " +
      "sum(num_refunds) num_refunds," +
      "sum(refund_rate) refund_rate," +
      "sum(gmv_eurcent) gmv_eurcent, " +
      "sum(refunded_gmv_eurcent) refunded_gmv_eurcent," +
      "sum(gmv_per_transaction_eurcent) / count(1) gmv_per_transaction_eurcent, " +
      "sum(shop_page_views) shop_page_views, " +
      "sum(product_page_views) product_page_views, " +
      "sum(listview_views_search_page) + sum(listview_views_shop_page) + sum(listview_views_catalog_page) + sum(listview_views_ads) + sum(listview_views_recos) as total_listviews, " +
      "sum(listview_views_search_page) listview_views_search_page," +
      "sum(listview_clicks_search_page) listview_clicks_search_page," +
      "sum(listview_ctr_search_page) / count(1) listview_ctr_search_page," +
      "sum(listview_views_catalog_page) listview_views_catalog_page," +
      "sum(listview_clicks_catalog_page) listview_clicks_catalog_page," +
      "sum(listview_ctr_catalog_page) / count(1) listview_ctr_catalog_page," +
      "sum(listview_views_shop_page) listview_views_shop_page," +
      "sum(listview_clicks_shop_page) listview_clicks_shop_page," +
      "sum(listview_ctr_shop_page) / count(1) listview_ctr_shop_page," +
      "sum(listview_views_ads) listview_views_ads, " +
      "sum(listview_clicks_ads) listview_clicks_ads, " +
      "sum(listview_ctr_ads) / count(1) listview_ctr_ads, " +
      "sum(listview_views_recos) listview_views_recos, " +
      "sum(listview_clicks_recos) listview_clicks_recos, " +
      "sum(listview_ctr_recos) / count(1) listview_ctr_recos " +
      "from shop_stats.last30d where " +
      order.order_by + " > 0 group by shop_id order by " + order.order_by +
      " " + order.order_fn + " limit 20 offset " + offset + ";";

    return query_str;
  };

  var renderQueryProgress = function(progress) {
    QueryProgressWidget.render(
        $(".zbase_seller_stats .query_progress"),
        progress);
  };

  var hideLoader = function() {
    $(".zbase_seller_stats .zbase_seller_overview").classList.remove("hidden");
    $(".zbase_seller_stats .query_progress").classList.add("hidden");
  };

  var renderTable = function(elem, result, path) {
    var metrics = {shop_id: true};
    $(".zbase_seller_stats z-dropdown.metrics")
        .getValue()
        .split(",")
        .forEach(function(metric) {
          metrics[metric] = true;
        });

    var table_tpl = $.getTemplate(
        "views/seller_overview",
        "seller_overview_table_tpl");

    result.columns.forEach(function(metric) {
      if (metrics[metric]) {
        var th = $("th." + metric, table_tpl);
        th.classList.remove("hidden");
        $.onClick($(".asc", th), function() {
          orderByParamChanged(metric, "asc");
        });
        $.onClick($(".desc", th), function() {
          orderByParamChanged(metric, "desc");
        });
      }
    });

    var tr_tpl = $.getTemplate(
        "views/seller_overview",
        "seller_overview_row_tpl");

    var tbody = $("tbody", table_tpl);
    result.rows.forEach(function(row) {
      var tr = tr_tpl.cloneNode(true);
      var url = "/a/apps/dawanda_seller_analytics/" + row[1]

      for (var i = 0; i < row.length; i++) {
        if (metrics[result.columns[i]]) {
          var td = $("td." + result.columns[i], tr);
          var a = $("a", td);
          a.innerHTML = ZBaseSellerMetrics[result.columns[i]].print(row[i]);
          a.href = url;
          td.classList.remove("hidden");
        }
      }

      tbody.appendChild(tr);
    });

    $.handleLinks(table_tpl);
    $.replaceContent(elem, table_tpl);

    setParamsOrder(
        UrlUtil.getParamValue(path, "order_by"),
        UrlUtil.getParamValue(path, "order_fn"));
  };

  var setPaginationFor = function(num_results) {
    var params = getQueryParams();
    params.limit = parseInt(params.limit, 10);

    if (num_results < params.limit) {
      $(".zbase_seller_stats .pager .for").classList.add("disabled");
      return;
    }

    params.offset = parseInt(params.offset, 10) + params.limit;
    $(".zbase_seller_stats .pager .for").href =
        path_prefix + "?" + $.buildQueryString(params);
  };

  var setPaginationBack = function() {
    var params = getQueryParams();
    params.offset = parseInt(params.offset, 10);

    if (params.offset <= 0) {
      $(".zbase_seller_stats .pager .back").classList.add("disabled");
      return;
    }

    params.offset = params.offset - parseInt(params.limit, 10);
    $(".zbase_seller_stats .pager .back").href =
        path_prefix + "?" + $.buildQueryString(params);
  };

  var setParamPremiumSeller = function(value) {
    if (value) {
      $(".zbase_seller_stats z-checkbox.premium").setAttribute(
        "data-active", "active");
    } else {
      $(".zbase_seller_stats z-checkbox.premium").removeAttribute("data-active");
    }
  };

  var setParamMetrics = function(metrics) {
    if (metrics) {
      $(".zbase_seller_stats z-dropdown.metrics").setValue(metrics.split(","));
    }
  };

  var setParamsOrder = function(order_by, order_fn) {
    if (order_by && order_fn) {
      if ($(".zbase_seller_stats thead")) {
        $(".zbase_seller_stats th.order_by").classList.remove("order_by");
        $(".zbase_seller_stats th." + order_by).classList.add("order_by");
      }

      var table = $(".zbase_seller_stats table.overview");
      table.setAttribute("data-order-by", order_by);
      table.setAttribute("data-order-fn", order_fn);
    }
  };

  var setParamOffset = function(offset) {
    if (!offset) {
      offset = 0;
    }

    $(".zbase_seller_stats .pager").setAttribute("data-offset", offset);
  };

  var getParamsOrder = function() {
    var table = $(".zbase_seller_stats table.overview");

    return {
      order_by: table.getAttribute("data-order-by"),
      order_fn: table.getAttribute("data-order-fn")
    };
  };

  var getParamOffset = function() {
    return parseInt(
        $(".zbase_seller_stats .pager").getAttribute("data-offset"), 10);
  };

  var getQueryParams = function() {
    var params = getParamsOrder();
    params.offset = getParamOffset();
    params.metrics = $(".zbase_seller_stats z-dropdown.metrics").getValue();
    params.premium = $(".zbase_seller_stats z-checkbox.premium").hasAttribute(
          "data-active");
    params.limit = "20";

    return params;
  };

  var paramChanged = function() {
    $.navigateTo(path_prefix + "?" + $.buildQueryString(getQueryParams()));
  };

  var orderByParamChanged = function(order_by, order_fn) {
    setParamsOrder(order_by, order_fn);
    setParamOffset(0);
    paramChanged();
  };

  return {
    name: "seller_overview",
    loadView: function(params) {load(params.path);},
    unloadView: destroy,
    handleNavigationChange: load
  };

})());
<|endoftext|>