Commit 5d9d406be4776cff2e788f4a723f45f326c6e148

Authored by Pesah Arthur
1 parent 9a774bf7

Add all files

.bowerrc 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +{
  2 + "directory": "bower_components"
  3 +}
... ...
.editorconfig 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +# EditorConfig helps developers define and maintain consistent
  2 +# coding styles between different editors and IDEs
  3 +# editorconfig.org
  4 +
  5 +root = true
  6 +
  7 +
  8 +[*]
  9 +
  10 +# Change these settings to your own preference
  11 +indent_style = space
  12 +indent_size = 2
  13 +
  14 +# We recommend you to keep these unchanged
  15 +end_of_line = lf
  16 +charset = utf-8
  17 +trim_trailing_whitespace = true
  18 +insert_final_newline = true
  19 +
  20 +[*.md]
  21 +trim_trailing_whitespace = false
... ...
.gitattributes 0 → 100644
... ... @@ -0,0 +1 @@
  1 +* text=auto
0 2 \ No newline at end of file
... ...
.gitignore 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +/node_modules
  2 +/dist
  3 +/.tmp
  4 +/.sass-cache
  5 +/bower_components
... ...
.jscsrc 0 → 100644
... ... @@ -0,0 +1,6 @@
  1 +{
  2 + "requireCamelCaseOrUpperCaseIdentifiers": true,
  3 + "requireCapitalizedConstructors": true,
  4 + "requireParenthesesAroundIIFE": true,
  5 + "validateQuoteMarks": "'"
  6 +}
... ...
.jshintrc 0 → 100644
... ... @@ -0,0 +1,16 @@
  1 +{
  2 + "bitwise": true,
  3 + "browser": true,
  4 + "curly": true,
  5 + "eqeqeq": true,
  6 + "esnext": true,
  7 + "latedef": true,
  8 + "noarg": true,
  9 + "node": true,
  10 + "strict": true,
  11 + "undef": true,
  12 + "unused": true,
  13 + "globals": {
  14 + "angular": false
  15 + }
  16 +}
... ...
.yo-rc.json 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +{
  2 + "generator-karma": {
  3 + "base-path": "../",
  4 + "frameworks": "jasmine",
  5 + "browsers": "PhantomJS",
  6 + "app-files": "app/scripts/**/*.js",
  7 + "files-comments": "bower:js,endbower",
  8 + "bower-components-path": "bower_components",
  9 + "test-files": "test/mock/**/*.js,test/spec/**/*.js"
  10 + }
  11 +}
0 12 \ No newline at end of file
... ...
Gruntfile.js 0 → 100644
... ... @@ -0,0 +1,516 @@
  1 +// Generated on 2016-10-13 using generator-angular 0.15.1
  2 +'use strict';
  3 +
  4 +// # Globbing
  5 +// for performance reasons we're only matching one level down:
  6 +// 'test/spec/{,*/}*.js'
  7 +// use this if you want to recursively match all subfolders:
  8 +// 'test/spec/**/*.js'
  9 +
  10 +module.exports = function (grunt) {
  11 +
  12 + // Time how long tasks take. Can help when optimizing build times
  13 + require('time-grunt')(grunt);
  14 +
  15 + // Automatically load required Grunt tasks
  16 + require('jit-grunt')(grunt, {
  17 + useminPrepare: 'grunt-usemin',
  18 + ngtemplates: 'grunt-angular-templates',
  19 + cdnify: 'grunt-google-cdn'
  20 + });
  21 +
  22 + // Configurable paths for the application
  23 + var appConfig = {
  24 + app: require('./bower.json').appPath || 'app',
  25 + dist: 'dist'
  26 + };
  27 +
  28 + // Define the configuration for all the tasks
  29 + grunt.initConfig({
  30 +
  31 + // Project settings
  32 + yeoman: appConfig,
  33 +
  34 + // Watches files for changes and runs tasks based on the changed files
  35 + watch: {
  36 + bower: {
  37 + files: ['bower.json'],
  38 + tasks: ['wiredep']
  39 + },
  40 + js: {
  41 + files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
  42 + tasks: ['newer:jshint:all', 'newer:jscs:all'],
  43 + options: {
  44 + livereload: '<%= connect.options.livereload %>'
  45 + }
  46 + },
  47 + jsTest: {
  48 + files: ['test/spec/{,*/}*.js'],
  49 + tasks: ['newer:jshint:test', 'newer:jscs:test', 'karma']
  50 + },
  51 + compass: {
  52 + files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
  53 + tasks: ['compass:server', 'postcss:server']
  54 + },
  55 + gruntfile: {
  56 + files: ['Gruntfile.js']
  57 + },
  58 + livereload: {
  59 + options: {
  60 + livereload: '<%= connect.options.livereload %>'
  61 + },
  62 + files: [
  63 + '<%= yeoman.app %>/{,*/}*.html',
  64 + '.tmp/styles/{,*/}*.css',
  65 + '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
  66 + ]
  67 + }
  68 + },
  69 +
  70 + // The actual grunt server settings
  71 + connect: {
  72 + options: {
  73 + port: 9000,
  74 + // Change this to '0.0.0.0' to access the server from outside.
  75 + hostname: 'localhost',
  76 + livereload: 35729
  77 + },
  78 + livereload: {
  79 + options: {
  80 + open: true,
  81 + middleware: function (connect) {
  82 + return [
  83 + connect.static('.tmp'),
  84 + connect().use(
  85 + '/bower_components',
  86 + connect.static('./bower_components')
  87 + ),
  88 + connect().use(
  89 + '/app/styles',
  90 + connect.static('./app/styles')
  91 + ),
  92 + connect.static(appConfig.app)
  93 + ];
  94 + }
  95 + }
  96 + },
  97 + test: {
  98 + options: {
  99 + port: 9001,
  100 + middleware: function (connect) {
  101 + return [
  102 + connect.static('.tmp'),
  103 + connect.static('test'),
  104 + connect().use(
  105 + '/bower_components',
  106 + connect.static('./bower_components')
  107 + ),
  108 + connect.static(appConfig.app)
  109 + ];
  110 + }
  111 + }
  112 + },
  113 + dist: {
  114 + options: {
  115 + open: true,
  116 + base: '<%= yeoman.dist %>'
  117 + }
  118 + }
  119 + },
  120 +
  121 + // Make sure there are no obvious mistakes
  122 + jshint: {
  123 + options: {
  124 + jshintrc: '.jshintrc',
  125 + reporter: require('jshint-stylish')
  126 + },
  127 + all: {
  128 + src: [
  129 + 'Gruntfile.js',
  130 + '<%= yeoman.app %>/scripts/{,*/}*.js'
  131 + ]
  132 + },
  133 + test: {
  134 + options: {
  135 + jshintrc: 'test/.jshintrc'
  136 + },
  137 + src: ['test/spec/{,*/}*.js']
  138 + }
  139 + },
  140 +
  141 + // Make sure code styles are up to par
  142 + jscs: {
  143 + options: {
  144 + config: '.jscsrc',
  145 + verbose: true
  146 + },
  147 + all: {
  148 + src: [
  149 + 'Gruntfile.js',
  150 + '<%= yeoman.app %>/scripts/{,*/}*.js'
  151 + ]
  152 + },
  153 + test: {
  154 + src: ['test/spec/{,*/}*.js']
  155 + }
  156 + },
  157 +
  158 + // Empties folders to start fresh
  159 + clean: {
  160 + dist: {
  161 + files: [{
  162 + dot: true,
  163 + src: [
  164 + '.tmp',
  165 + '<%= yeoman.dist %>/{,*/}*',
  166 + '!<%= yeoman.dist %>/.git{,*/}*'
  167 + ]
  168 + }]
  169 + },
  170 + server: '.tmp'
  171 + },
  172 +
  173 + // Add vendor prefixed styles
  174 + postcss: {
  175 + options: {
  176 + processors: [
  177 + require('autoprefixer-core')({browsers: ['last 1 version']})
  178 + ]
  179 + },
  180 + server: {
  181 + options: {
  182 + map: true
  183 + },
  184 + files: [{
  185 + expand: true,
  186 + cwd: '.tmp/styles/',
  187 + src: '{,*/}*.css',
  188 + dest: '.tmp/styles/'
  189 + }]
  190 + },
  191 + dist: {
  192 + files: [{
  193 + expand: true,
  194 + cwd: '.tmp/styles/',
  195 + src: '{,*/}*.css',
  196 + dest: '.tmp/styles/'
  197 + }]
  198 + }
  199 + },
  200 +
  201 + // Automatically inject Bower components into the app
  202 + wiredep: {
  203 + app: {
  204 + src: ['<%= yeoman.app %>/index.html'],
  205 + ignorePath: /\.\.\//
  206 + },
  207 + test: {
  208 + devDependencies: true,
  209 + src: '<%= karma.unit.configFile %>',
  210 + ignorePath: /\.\.\//,
  211 + fileTypes:{
  212 + js: {
  213 + block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi,
  214 + detect: {
  215 + js: /'(.*\.js)'/gi
  216 + },
  217 + replace: {
  218 + js: '\'{{filePath}}\','
  219 + }
  220 + }
  221 + }
  222 + },
  223 + sass: {
  224 + src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
  225 + ignorePath: /(\.\.\/){1,2}bower_components\//
  226 + }
  227 + },
  228 +
  229 + // Compiles Sass to CSS and generates necessary files if requested
  230 + compass: {
  231 + options: {
  232 + sassDir: '<%= yeoman.app %>/styles',
  233 + cssDir: '.tmp/styles',
  234 + generatedImagesDir: '.tmp/images/generated',
  235 + imagesDir: '<%= yeoman.app %>/images',
  236 + javascriptsDir: '<%= yeoman.app %>/scripts',
  237 + fontsDir: '<%= yeoman.app %>/styles/fonts',
  238 + importPath: './bower_components',
  239 + httpImagesPath: '/images',
  240 + httpGeneratedImagesPath: '/images/generated',
  241 + httpFontsPath: '/styles/fonts',
  242 + relativeAssets: false,
  243 + assetCacheBuster: false,
  244 + raw: 'Sass::Script::Number.precision = 10\n'
  245 + },
  246 + dist: {
  247 + options: {
  248 + generatedImagesDir: '<%= yeoman.dist %>/images/generated'
  249 + }
  250 + },
  251 + server: {
  252 + options: {
  253 + sourcemap: true
  254 + }
  255 + }
  256 + },
  257 +
  258 + // Renames files for browser caching purposes
  259 + filerev: {
  260 + dist: {
  261 + src: [
  262 + '<%= yeoman.dist %>/scripts/{,*/}*.js',
  263 + '<%= yeoman.dist %>/styles/{,*/}*.css',
  264 + '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
  265 + '<%= yeoman.dist %>/styles/fonts/*'
  266 + ]
  267 + }
  268 + },
  269 +
  270 + // Reads HTML for usemin blocks to enable smart builds that automatically
  271 + // concat, minify and revision files. Creates configurations in memory so
  272 + // additional tasks can operate on them
  273 + useminPrepare: {
  274 + html: '<%= yeoman.app %>/index.html',
  275 + options: {
  276 + dest: '<%= yeoman.dist %>',
  277 + flow: {
  278 + html: {
  279 + steps: {
  280 + js: ['concat', 'uglifyjs'],
  281 + css: ['cssmin']
  282 + },
  283 + post: {}
  284 + }
  285 + }
  286 + }
  287 + },
  288 +
  289 + // Performs rewrites based on filerev and the useminPrepare configuration
  290 + usemin: {
  291 + html: ['<%= yeoman.dist %>/{,*/}*.html'],
  292 + css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
  293 + js: ['<%= yeoman.dist %>/scripts/{,*/}*.js'],
  294 + options: {
  295 + assetsDirs: [
  296 + '<%= yeoman.dist %>',
  297 + '<%= yeoman.dist %>/images',
  298 + '<%= yeoman.dist %>/styles'
  299 + ],
  300 + patterns: {
  301 + js: [[/(images\/[^''""]*\.(png|jpg|jpeg|gif|webp|svg))/g, 'Replacing references to images']]
  302 + }
  303 + }
  304 + },
  305 +
  306 + // The following *-min tasks will produce minified files in the dist folder
  307 + // By default, your `index.html`'s <!-- Usemin block --> will take care of
  308 + // minification. These next options are pre-configured if you do not wish
  309 + // to use the Usemin blocks.
  310 + // cssmin: {
  311 + // dist: {
  312 + // files: {
  313 + // '<%= yeoman.dist %>/styles/main.css': [
  314 + // '.tmp/styles/{,*/}*.css'
  315 + // ]
  316 + // }
  317 + // }
  318 + // },
  319 + // uglify: {
  320 + // dist: {
  321 + // files: {
  322 + // '<%= yeoman.dist %>/scripts/scripts.js': [
  323 + // '<%= yeoman.dist %>/scripts/scripts.js'
  324 + // ]
  325 + // }
  326 + // }
  327 + // },
  328 + // concat: {
  329 + // dist: {}
  330 + // },
  331 +
  332 + imagemin: {
  333 + dist: {
  334 + files: [{
  335 + expand: true,
  336 + cwd: '<%= yeoman.app %>/images',
  337 + src: '{,*/}*.{png,jpg,jpeg,gif}',
  338 + dest: '<%= yeoman.dist %>/images'
  339 + }]
  340 + }
  341 + },
  342 +
  343 + svgmin: {
  344 + dist: {
  345 + files: [{
  346 + expand: true,
  347 + cwd: '<%= yeoman.app %>/images',
  348 + src: '{,*/}*.svg',
  349 + dest: '<%= yeoman.dist %>/images'
  350 + }]
  351 + }
  352 + },
  353 +
  354 + htmlmin: {
  355 + dist: {
  356 + options: {
  357 + collapseWhitespace: true,
  358 + conservativeCollapse: true,
  359 + collapseBooleanAttributes: true,
  360 + removeCommentsFromCDATA: true
  361 + },
  362 + files: [{
  363 + expand: true,
  364 + cwd: '<%= yeoman.dist %>',
  365 + src: ['*.html'],
  366 + dest: '<%= yeoman.dist %>'
  367 + }]
  368 + }
  369 + },
  370 +
  371 + ngtemplates: {
  372 + dist: {
  373 + options: {
  374 + module: 'codeApp',
  375 + htmlmin: '<%= htmlmin.dist.options %>',
  376 + usemin: 'scripts/scripts.js'
  377 + },
  378 + cwd: '<%= yeoman.app %>',
  379 + src: 'views/{,*/}*.html',
  380 + dest: '.tmp/templateCache.js'
  381 + }
  382 + },
  383 +
  384 + // ng-annotate tries to make the code safe for minification automatically
  385 + // by using the Angular long form for dependency injection.
  386 + ngAnnotate: {
  387 + dist: {
  388 + files: [{
  389 + expand: true,
  390 + cwd: '.tmp/concat/scripts',
  391 + src: '*.js',
  392 + dest: '.tmp/concat/scripts'
  393 + }]
  394 + }
  395 + },
  396 +
  397 + // Replace Google CDN references
  398 + cdnify: {
  399 + dist: {
  400 + html: ['<%= yeoman.dist %>/*.html']
  401 + }
  402 + },
  403 +
  404 + // Copies remaining files to places other tasks can use
  405 + copy: {
  406 + dist: {
  407 + files: [{
  408 + expand: true,
  409 + dot: true,
  410 + cwd: '<%= yeoman.app %>',
  411 + dest: '<%= yeoman.dist %>',
  412 + src: [
  413 + '*.{ico,png,txt}',
  414 + '*.html',
  415 + 'images/{,*/}*.{webp}',
  416 + 'styles/fonts/{,*/}*.*'
  417 + ]
  418 + }, {
  419 + expand: true,
  420 + cwd: '.tmp/images',
  421 + dest: '<%= yeoman.dist %>/images',
  422 + src: ['generated/*']
  423 + }, {
  424 + expand: true,
  425 + cwd: '.',
  426 + src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
  427 + dest: '<%= yeoman.dist %>'
  428 + }]
  429 + },
  430 + styles: {
  431 + expand: true,
  432 + cwd: '<%= yeoman.app %>/styles',
  433 + dest: '.tmp/styles/',
  434 + src: '{,*/}*.css'
  435 + }
  436 + },
  437 +
  438 + // Run some tasks in parallel to speed up the build process
  439 + concurrent: {
  440 + server: [
  441 + 'compass:server'
  442 + ],
  443 + test: [
  444 + 'compass'
  445 + ],
  446 + dist: [
  447 + 'compass:dist',
  448 + 'imagemin',
  449 + 'svgmin'
  450 + ]
  451 + },
  452 +
  453 + // Test settings
  454 + karma: {
  455 + unit: {
  456 + configFile: 'test/karma.conf.js',
  457 + singleRun: true
  458 + }
  459 + }
  460 + });
  461 +
  462 +
  463 + grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
  464 + if (target === 'dist') {
  465 + return grunt.task.run(['build', 'connect:dist:keepalive']);
  466 + }
  467 +
  468 + grunt.task.run([
  469 + 'clean:server',
  470 + 'wiredep',
  471 + 'concurrent:server',
  472 + 'postcss:server',
  473 + 'connect:livereload',
  474 + 'watch'
  475 + ]);
  476 + });
  477 +
  478 + grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
  479 + grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
  480 + grunt.task.run(['serve:' + target]);
  481 + });
  482 +
  483 + grunt.registerTask('test', [
  484 + 'clean:server',
  485 + 'wiredep',
  486 + 'concurrent:test',
  487 + 'postcss',
  488 + 'connect:test',
  489 + 'karma'
  490 + ]);
  491 +
  492 + grunt.registerTask('build', [
  493 + 'clean:dist',
  494 + 'wiredep',
  495 + 'useminPrepare',
  496 + 'concurrent:dist',
  497 + 'postcss',
  498 + 'ngtemplates',
  499 + 'concat',
  500 + 'ngAnnotate',
  501 + 'copy:dist',
  502 + 'cdnify',
  503 + 'cssmin',
  504 + 'uglify',
  505 + 'filerev',
  506 + 'usemin',
  507 + 'htmlmin'
  508 + ]);
  509 +
  510 + grunt.registerTask('default', [
  511 + 'newer:jshint',
  512 + 'newer:jscs',
  513 + 'test',
  514 + 'build'
  515 + ]);
  516 +};
... ...
app/404.html 0 → 100644
... ... @@ -0,0 +1,152 @@
  1 +<!doctype html>
  2 +<html lang="en">
  3 + <head>
  4 + <meta charset="utf-8">
  5 + <title>Page Not Found :(</title>
  6 + <style>
  7 + ::-moz-selection {
  8 + background: #b3d4fc;
  9 + text-shadow: none;
  10 + }
  11 +
  12 + ::selection {
  13 + background: #b3d4fc;
  14 + text-shadow: none;
  15 + }
  16 +
  17 + html {
  18 + padding: 30px 10px;
  19 + font-size: 20px;
  20 + line-height: 1.4;
  21 + color: #737373;
  22 + background: #f0f0f0;
  23 + -webkit-text-size-adjust: 100%;
  24 + -ms-text-size-adjust: 100%;
  25 + }
  26 +
  27 + html,
  28 + input {
  29 + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  30 + }
  31 +
  32 + body {
  33 + max-width: 500px;
  34 + padding: 30px 20px 50px;
  35 + border: 1px solid #b3b3b3;
  36 + border-radius: 4px;
  37 + margin: 0 auto;
  38 + box-shadow: 0 1px 10px #a7a7a7, inset 0 1px 0 #fff;
  39 + background: #fcfcfc;
  40 + }
  41 +
  42 + h1 {
  43 + margin: 0 10px;
  44 + font-size: 50px;
  45 + text-align: center;
  46 + }
  47 +
  48 + h1 span {
  49 + color: #bbb;
  50 + }
  51 +
  52 + h3 {
  53 + margin: 1.5em 0 0.5em;
  54 + }
  55 +
  56 + p {
  57 + margin: 1em 0;
  58 + }
  59 +
  60 + ul {
  61 + padding: 0 0 0 40px;
  62 + margin: 1em 0;
  63 + }
  64 +
  65 + .container {
  66 + max-width: 380px;
  67 + margin: 0 auto;
  68 + }
  69 +
  70 + /* google search */
  71 +
  72 + #goog-fixurl ul {
  73 + list-style: none;
  74 + padding: 0;
  75 + margin: 0;
  76 + }
  77 +
  78 + #goog-fixurl form {
  79 + margin: 0;
  80 + }
  81 +
  82 + #goog-wm-qt,
  83 + #goog-wm-sb {
  84 + border: 1px solid #bbb;
  85 + font-size: 16px;
  86 + line-height: normal;
  87 + vertical-align: top;
  88 + color: #444;
  89 + border-radius: 2px;
  90 + }
  91 +
  92 + #goog-wm-qt {
  93 + width: 220px;
  94 + height: 20px;
  95 + padding: 5px;
  96 + margin: 5px 10px 0 0;
  97 + box-shadow: inset 0 1px 1px #ccc;
  98 + }
  99 +
  100 + #goog-wm-sb {
  101 + display: inline-block;
  102 + height: 32px;
  103 + padding: 0 10px;
  104 + margin: 5px 0 0;
  105 + white-space: nowrap;
  106 + cursor: pointer;
  107 + background-color: #f5f5f5;
  108 + background-image: -webkit-linear-gradient(rgba(255,255,255,0), #f1f1f1);
  109 + background-image: -moz-linear-gradient(rgba(255,255,255,0), #f1f1f1);
  110 + background-image: -ms-linear-gradient(rgba(255,255,255,0), #f1f1f1);
  111 + background-image: -o-linear-gradient(rgba(255,255,255,0), #f1f1f1);
  112 + -webkit-appearance: none;
  113 + -moz-appearance: none;
  114 + appearance: none;
  115 + }
  116 +
  117 + #goog-wm-sb:hover,
  118 + #goog-wm-sb:focus {
  119 + border-color: #aaa;
  120 + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  121 + background-color: #f8f8f8;
  122 + }
  123 +
  124 + #goog-wm-qt:hover,
  125 + #goog-wm-qt:focus {
  126 + border-color: #105cb6;
  127 + outline: 0;
  128 + color: #222;
  129 + }
  130 +
  131 + input::-moz-focus-inner {
  132 + padding: 0;
  133 + border: 0;
  134 + }
  135 + </style>
  136 + </head>
  137 + <body>
  138 + <div class="container">
  139 + <h1>Not found <span>:(</span></h1>
  140 + <p>Sorry, but the page you were trying to view does not exist.</p>
  141 + <p>It looks like this was the result of either:</p>
  142 + <ul>
  143 + <li>a mistyped address</li>
  144 + <li>an out-of-date link</li>
  145 + </ul>
  146 + <script>
  147 + var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),GOOG_FIXURL_SITE = location.host;
  148 + </script>
  149 + <script src="//linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
  150 + </div>
  151 + </body>
  152 +</html>
... ...
app/favicon.ico 0 → 100644
No preview for this file type
app/images/yeoman.png 0 → 100644

13.2 KB

app/index.html 0 → 100644
... ... @@ -0,0 +1,32 @@
  1 +<!doctype html>
  2 +<html>
  3 + <head>
  4 + <meta charset="utf-8">
  5 + <title>Movie Search</title>
  6 + <link rel="stylesheet" href="styles/main.css">
  7 + </head>
  8 +
  9 + <body ng-app="movieSearch">
  10 + <!-- Modules AngularJS -->
  11 + <script src="bower_components/angular/angular.js"></script>
  12 + <script src="bower_components/angular-animate/angular-animate.js"></script>
  13 + <script src="bower_components/angular-cookies/angular-cookies.js"></script>
  14 + <script src="bower_components/angular-resource/angular-resource.js"></script>
  15 + <script src="bower_components/angular-route/angular-route.js"></script>
  16 + <script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
  17 + <script src="bower_components/angular-touch/angular-touch.js"></script>
  18 +
  19 + <!-- Mes fichiers javascripts -->
  20 + <script src="scripts/app.js"></script>
  21 + <script src="scripts/services.js"></script>
  22 + <script src="scripts/controllers.js"></script>
  23 + <script src="scripts/filter.js"></script>
  24 +
  25 + <!-- Début du programme -->
  26 + <div class="container">
  27 + <div ng-view>
  28 +
  29 + </div>
  30 + </div>
  31 + </body>
  32 +</html>
... ...
app/robots.txt 0 → 100644
... ... @@ -0,0 +1,4 @@
  1 +# robotstxt.org
  2 +
  3 +User-agent: *
  4 +Disallow:
... ...
app/scripts/app.js 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +'use strict';
  2 +
  3 +angular.module('movieSearch', [
  4 + 'ngCookies',
  5 + 'ngResource',
  6 + 'ngRoute',
  7 + ])
  8 +
  9 + .config(function ($routeProvider) {
  10 + $routeProvider
  11 + .when('/', {
  12 + templateUrl: 'views/all.html',
  13 + controller: 'searchCtrl'
  14 + })
  15 + .when('/detail/:idMovie', {
  16 + templateUrl: 'views/detail.html',
  17 + controller: 'detailCtrl'
  18 + })
  19 + .otherwise({
  20 + redirectTo: '/'
  21 + });
  22 + });
... ...
app/scripts/controllers.js 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +angular.module('movieSearch')
  2 +
  3 +.controller('searchCtrl', function searchCtrl($scope, searchFactory) {
  4 + $scope.items = searchFactory.allMoviesResource.get(successFn, errorFn);
  5 +
  6 + function successFn() {
  7 + $scope.items = $scope.items["Search"]
  8 + console.log($scope.items)
  9 + }
  10 + function errorFn() {
  11 + console.error("Erreur dans la lecture de l'API")
  12 + }
  13 +})
  14 +
  15 +.controller('detailCtrl', function searchCtrl($scope, $routeParams, searchFactory) {
  16 + $scope.movie = searchFactory.detailMovieResource.get({idMovie: $routeParams.idMovie});
  17 +
  18 + function successFn() {
  19 + console.log($scope.movie)
  20 + }
  21 + function errorFn() {
  22 + console.error("Erreur dans la lecture de l'API")
  23 + }
  24 +});
... ...
app/scripts/filter.js 0 → 100644
... ... @@ -0,0 +1,26 @@
  1 +angular.module('movieSearch')
  2 +
  3 +.filter('searchFor', function(){
  4 + return function(arr, searchString){
  5 +
  6 + if(!searchString){
  7 + return arr;
  8 + }
  9 +
  10 + var result = [];
  11 + console.log(searchString)
  12 + searchString = searchString.toLowerCase();
  13 +
  14 + // Using the forEach helper method to loop through the array
  15 + angular.forEach(arr, function(item){
  16 +
  17 + if(item.Title.toLowerCase().indexOf(searchString) !== -1){
  18 + result.push(item);
  19 + }
  20 +
  21 + });
  22 +
  23 + return result;
  24 + };
  25 +
  26 +});
... ...
app/scripts/services.js 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +angular.module('movieSearch')
  2 +
  3 +.factory('searchFactory', function($resource) {
  4 +
  5 + var allMoviesResource = $resource('http://www.omdbapi.com/?s=la&y=&plot=short&r=json&page=1');
  6 + var detailMovieResource = $resource('http://www.omdbapi.com/?i=:idMovie&plot=short&r=json',
  7 + {idMovie:'@idMovie'}
  8 + );
  9 + return {
  10 + allMoviesResource: allMoviesResource,
  11 + detailMovieResource: detailMovieResource
  12 + };
  13 +});
... ...
app/styles/main.css 0 → 100644
... ... @@ -0,0 +1,89 @@
  1 +*{
  2 + margin:0;
  3 + padding:0;
  4 +}
  5 +
  6 +body{
  7 + font:15px/1.3 'Open Sans', sans-serif;
  8 + color: #5e5b64;
  9 + text-align:center;
  10 +}
  11 +
  12 +a, a:visited {
  13 + outline:none;
  14 + color:#389dc1;
  15 +}
  16 +
  17 +a:hover{
  18 + text-decoration:none;
  19 +}
  20 +
  21 +section, footer, header, aside, nav{
  22 + display: block;
  23 +}
  24 +
  25 +/*-------------------------
  26 + The search input
  27 +--------------------------*/
  28 +
  29 +.bar{
  30 + background-color:#5c9bb7;
  31 +
  32 + background-image:-webkit-linear-gradient(top, #5c9bb7, #5392ad);
  33 + background-image:-moz-linear-gradient(top, #5c9bb7, #5392ad);
  34 + background-image:linear-gradient(top, #5c9bb7, #5392ad);
  35 +
  36 + box-shadow: 0 1px 1px #ccc;
  37 + border-radius: 2px;
  38 + width: 400px;
  39 + padding: 14px;
  40 + margin: 45px auto 20px;
  41 + position:relative;
  42 +}
  43 +
  44 +.bar input{
  45 + background:#fff no-repeat 13px 13px;
  46 + background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkU5NEY0RTlFMTA4NzExRTM5RTEzQkFBQzMyRjkyQzVBIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkU5NEY0RTlGMTA4NzExRTM5RTEzQkFBQzMyRjkyQzVBIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6RTk0RjRFOUMxMDg3MTFFMzlFMTNCQUFDMzJGOTJDNUEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6RTk0RjRFOUQxMDg3MTFFMzlFMTNCQUFDMzJGOTJDNUEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4DjA/RAAABK0lEQVR42pTSQUdEURjG8dOY0TqmPkGmRcqYD9CmzZAWJRHVRIa0iFYtM6uofYaiEW2SRJtEi9YxIklp07ZkWswu0v/wnByve7vm5ee8M+85zz1jbt9Os+WiGkYdYxjCOx5wgFeXUHmtBSzpcCGa+5BJTCjEP+0nKWAT8xqe4ArPGEEVC1hHEbs2oBwdXkM7mj/JLZrad437sCGHOfUtcziutuYu2v8XUFF/4f6vMK/YgAH1HxkBYV60AR31gxkBYd6xAeF3VzMCwvzOBpypX8V4yuFRzX2d2gD/l5yjH4fYQEnzkj4fae5rJulF2sMXVrAsaTWttRFu4Osb+1jEDT71/ZveyhouTch2fINQL9hKefKjuYFfuznXWzXMTabyrvfyIV3M4vhXgAEAUMs7K0J9UJAAAAAASUVORK5CYII=);
  47 +
  48 + border: none;
  49 + width: 100%;
  50 + line-height: 19px;
  51 + padding: 11px 0;
  52 +
  53 + border-radius: 2px;
  54 + box-shadow: 0 2px 8px #c4c4c4 inset;
  55 + text-align: left;
  56 + font-size: 14px;
  57 + font-family: inherit;
  58 + color: #738289;
  59 + font-weight: bold;
  60 + outline: none;
  61 + text-indent: 40px;
  62 +}
  63 +
  64 +ul{
  65 + list-style: none;
  66 + width: 428px;
  67 + margin: 0 auto;
  68 + text-align: left;
  69 +}
  70 +
  71 +ul li{
  72 + border-bottom: 1px solid #ddd;
  73 + padding: 10px;
  74 + overflow: hidden;
  75 +}
  76 +
  77 +ul li img{
  78 + width:60px;
  79 + height:60px;
  80 + float:left;
  81 + border:none;
  82 +}
  83 +
  84 +ul li p{
  85 + margin-left: 75px;
  86 + font-weight: bold;
  87 + padding-top: 12px;
  88 + color:#6e7a7f;
  89 +}
... ...
app/views/all.html 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +<div class="bar">
  2 + <input type="text" ng-model="searchString" placeholder="Enter your search terms" />
  3 +</div>
  4 +<ul>
  5 + <li ng-repeat="i in items | searchFor:searchString">
  6 + <a href="#/detail/{{i.imdbID}}"><img ng-src="{{i.Poster}}" /></a>
  7 + <p>{{i.Title}}</p>
  8 + </li>
  9 +</ul>