Code Monkey home page Code Monkey logo

borrowers's People

Contributors

abuiles avatar ember-tomster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

borrowers's Issues

p.66 create an articles new controller

p.66 of my PDF states this:

Tasks
Create an articles new controller and validate that the model includes description. 
If it is valid, let the action bubble to the route. Otherwise, set an errorMessage.

When I look at the code commits for this portion of the tutorial I would expect to see a file:

app/controllers/articles/new.js

...but I don't see one at all. Am I missing the intent of the task on p 66 of the PDF? When I click the link to look at the changes introduced (262f8c1) there is no articles controller of any type. The final project also does not have a new.js controller for articles.

What I did based on the task is to create the file app/controllers/articles/new.js and put the following code in there:

import Ember from 'ember';

export default Ember.Controller.extend({
    hasDescription: Ember.computed.notEmpty('model.description'),
    isValid: Ember.computed.and(
        'hasDescription'
    ),
    actions: {
        save: function () {
            console.log('+- save action in articles/new controller');
            if (this.get('isValid')) {
                return true;
            } else {
                this.set('errorMessage', 'You have to fill in all the fields');
                return false;
            }
        },
        cancel: function () { 
            return true;
        }
    }
});

Got a question about the auto-saving for article, not a issue

Hi
I'm reading the Ember cli 101 and I got a question about the article Auto-Save part.

In the section about implement "Auto-Save", we need to change the app/templates/components/articles/article-row.hbs from:

<td>
{{#if article.isSaving}}
   <p>Saving ...</p>
{{else if article.hasDirtyAttributes}}
  <button {{action "saveArticle" article}}>Save</button>
{{/if}}
</td>

to:

<td>
{{#if article.isSaving}} 
  <p>Saving ...</p>
{{/if}}
</td>

and also update the action in app/components/articles/article-row.js to:

saveArticle() {
  let article = this.get('article');
  if (article.get('hasDirtyAttributes')) { 
      this.sendAction('save', article);
    }
  }

then, if we change the state of a article, it will auto-save.

But I really didn't understand how it auto-saved, previously there is a Save button, once we click on the Save button, it will execute the action saveArticle, but after remove it from the page, how would it trigger the saveArticle to save the article.

I'm reading the book in Chinese version, maybe something is missing after the translate, I'm not sure.

May it's a stupid question, :), but looking forward of you reply.

Thanks in advance!

Articles -form partial not rendering when named "-form.hbs".

Hello everyone,

I'm experiencing an issue related to the articles/form partial template. I'm on page 73 in the PDF (page 67 in the book). I have the two partials located at app/templates/articles/-form.hbs and app/templates/friends/-form.hbs.

When I navigate to /friends/show/:friend_id and click "Lend article", the app/templates/articles/new.hbs template tries to load a partial for app/templates/articles/-form.hbs

<h2> Lending new articles</h2>
{{partial "articles/form"}}

Unfortunately, nothing from the template is rendered. The content in articles/new.hbs does render, so I do see "Lending new articles" but I don't see anything from the partial template. However, if I rename app/templates/articles/-form.hbs to anything else, such as -form2.hbs, and update the partial helper call in articles/new.hbs to {{partial "articles/form2"}}, the content from the partial template does render.

Anyone have any suggestions as to why? I know I must be missing something simple.

Thanks in advance 😄

Deletion on Friends Show Route

On page 49 (pdf) it is stated:
To support deletion on Friends Show Route, we just need to add the same link[...]
referring to the delete link added on the previous page:
<a href="#" {{action "delete" friend}}>Delete</a>

However to delete from the friends show route the link would need to be:
<a href="#" {{action "delete" model}}>Delete</a>

How can I get this to run?

Do I need to load an older version of ember-cli or node? Here's the output of my attempt to build and run this application:

git clone [email protected]:abuiles/borrowers.git
Cloning into 'borrowers'...
remote: Counting objects: 388, done.
remote: Total 388 (delta 0), reused 0 (delta 0), pack-reused 388
Receiving objects: 100% (388/388), 53.70 KiB | 0 bytes/s, done.
Resolving deltas: 100% (168/168), done.
Checking connectivity... done.
$ cd borrowers/
$ ember --version
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
ember-cli: 2.5.0
node: 5.11.1
os: linux x64
$ npm install; bower install; ember serve
npm WARN deprecated [email protected]: This package has been discontinued in favor of lodash@^4.0.0.
npm WARN deprecated [email protected]: Esperanto is deprecated. Please use http://rollupjs.org instead. See https://github.com/rollup/rollup/wiki/Migrating-from-Esperanto for more details
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated [email protected]: This package has been discontinued in favor of lodash@^4.0.0.
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN prefer global [email protected] should be installed with -g
(snipped npm & bower output)
Future versions of Ember CLI will not support v5.11.1. Please update to Node 0.12 or io.js.
version: 1.13.1
Could not find watchman, falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/#watchman for more info.
Proxying to http://api.ember-cli-101.com
Livereload server on http://localhost:35729
Serving on http://localhost:4200/

components/articles/article-row.js: line 11, col 9, 'article' is defined but never used.

1 error

===== 1 JSHint Error


Build successful - 2275ms.

Slowest Trees                                 | Total               
----------------------------------------------+---------------------
Concat: Vendor                                | 1379ms              
Babel                                         | 143ms               
Babel                                         | 135ms               

Slowest Trees (cumulative)                    | Total (avg)         
----------------------------------------------+---------------------
Concat: Vendor (1)                            | 1379ms              
Babel (5)                                     | 449ms (89 ms)       

Content Security Policy violation: {}
Content Security Policy violation: {}
Content Security Policy violation: {}
Content Security Policy violation: {}
Content Security Policy violation: {}

When I go to http://localhost:4200 in a browser I see the following error message in the console:
Error: Assertion Failed: Ember Views require jQuery between 1.7 and 2.1

Undefined appears in friends list

Clicking cancel at this url http://localhost:4200/friends/new returns you to http://localhost:4200/friends. This is expected. What's not expected is now at the bottom of the friends list it says undefinded.

screen shot 2015-04-06 at 5 40 24 pm

Error with {{#each model as |article|}}

Hi!

I'm on the page 71 of the book, and when I try to use the article-row component I get this error:

File: borrowers/templates/articles/index.hbs
Parse error on line 12:
...   {{#each model as |article|}}      {{
-----------------------^
Expecting 'CLOSE', 'CLOSE_UNESCAPED', 'STRING', 'INTEGER', 'BOOLEAN', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'EQUALS', 'DATA', 'SEP', got 'INVALID'

This is my articles/index.hbs template:

<table class="primary">
  <thead>
    <tr>
      <th>Description</th>
      <th>Borrowed since</th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    {{#each model as |article|}}
      {{articles/article-row article=article save="save" articleStates=possibleStates}}
    {{/each}}
  </tbody>
</table>

I really don't know what I'm missing here, I checked the book and the repo a couple of times, so... what I'm missing?

Clean startup fails

Following the instructions, ember server fails to start with this error message:

ember server
version: 0.2.0-beta.1
Proxying to http://api.ember-cli-101.com
Livereload server on port 35729
Serving on http://0.0.0.0:4200/
undefined is not a function
TypeError: undefined is not a function
    at rimraf (/Users/fstrecker/dev-ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rimraf/rimraf.js:57:13)
    at lib$rsvp$node$$tryApply (/Users/fstrecker/dev-ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1467:11)
    at lib$rsvp$node$$handleValueInput (/Users/fstrecker/dev-ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1567:20)
    at fn (/Users/fstrecker/dev-ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1555:18)
    at /Users/fstrecker/dev-ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/index.js:100:14
    at lib$rsvp$$internal$$tryCatch (/Users/fstrecker/dev-ember/borrowers/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:489:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/fstrecker/dev-ember/borrowers/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:501:17)
    at lib$rsvp$$internal$$publish (/Users/fstrecker/dev-ember/borrowers/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:472:11)
    at lib$rsvp$asap$$flush (/Users/fstrecker/dev-ember/borrowers/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1290:9)
    at process._tickCallback (node.js:355:11)

Error when cancelling an edit on friend

I keep getting an error on page 79. This is how I have my friends edit route:

import Ember from 'ember';

export default Ember.Route.extend({
    resetController(controller, isExiting) {
    if (isExiting) {
      var model = this.get('model');
      model.rollback();
    }
  }
});

When I try to cancel an edit on a friend, I get this error:

Error while processing route: friends.show.index (2)
"model.rollback is not a function. (In 'model.rollback()', 'model.rollback' is undefined)"

Has anybody else had this problem?

Cancel action in FriendsEditController

Hey Adolfo,

I just implemented the Cancel action for the friends/edit controller as seen here but whenever I click the cancel button, it redirects to http://localhost:4200/friends/undefined

I'm using the latest version of your book and ember-cli 0.1.5

My guess would be to use this.get('model') instead of just this in the route transition

borrowers doesn't build clean

I cloned the repo,
npm install
bower installl
and get the following warnings on npm install:


npm WARN engine [email protected]: wanted: {"node":"0.6.x"} (current: {"node":"0.12.0","npm":"2.5.1"})
npm WARN engine [email protected]: wanted: {"node":"0.6.x"} (current: {"node":"0.12.0","npm":"2.5.1"})
npm WARN unmet dependency /Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rimraf requires glob@'^4.4.2' but will load
npm WARN unmet dependency /Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/glob,
npm WARN unmet dependency which is version 4.0.5
npm WARN unmet dependency /Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/broccoli-caching-writer/node_modules/rimraf requires glob@'^4.4.2' but will load
npm WARN unmet dependency /Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/glob,
npm WARN unmet dependency which is version 4.0.5
npm WARN unmet dependency /Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/broccoli-es6modules/node_modules/esperanto/node_modules/sander/node_modules/rimraf requires glob@'^4.4.2' but will load
npm WARN unmet dependency /Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/glob,
npm WARN unmet dependency which is version 4.0.5
npm WARN unmet dependency /Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/broccoli-sourcemap-concat/node_modules/broccoli-caching-writer/node_modules/rimraf requires glob@'^4.4.2' but will load
npm WARN unmet dependency /Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/glob,
npm WARN unmet dependency which is version 4.0.5

And then when I attempt to ember server:

version: 0.2.0-beta.1
Proxying to http://api.ember-cli-101.com
Livereload server on port 35729
Serving on http://0.0.0.0:4200/
undefined is not a function
TypeError: undefined is not a function
    at rimraf (/Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rimraf/rimraf.js:57:13)
    at lib$rsvp$node$$tryApply (/Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1467:11)
    at lib$rsvp$node$$handleValueInput (/Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1567:20)
    at fn (/Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/node_modules/rsvp/dist/rsvp.js:1555:18)
    at /Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/broccoli-caching-writer/index.js:100:14
    at lib$rsvp$$internal$$tryCatch (/Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:489:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:501:17)
    at lib$rsvp$$internal$$publish (/Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:472:11)
    at lib$rsvp$asap$$flush (/Users/robert/src/ember/borrowers/node_modules/ember-cli/node_modules/promise-map-series/node_modules/rsvp/dist/rsvp.js:1290:9)
    at process._tickCallback (node.js:355:11)

Input type checkbox

At the top of page 36 (of pdf):
You have:
{{input type="checkbox" name=trusted}}.
I think it should be
{{input type="checkbox checked=trusted}}?

Deserializing Rails api results may fail in ember 1.8

Be careful upgrading to 1.8 from 1.7
I discovered that ActiveModel adapter won't deserialize properly causing this error:

TypeError: undefined is not a function
at Object.func (http://localhost:4200/assets/vendor.js:49499:18)
at Object.Cache.get (http://localhost:4200/assets/vendor.js:25100:38)
at decamelize (http://localhost:4200/assets/vendor.js:49541:31)
at RESTSerializer.extend.keyForAttribute (http://localhost:4200/assets/vendor.js:63962:16)
at apply (http://localhost:4200/assets/vendor.js:32847:27)
at superWrapper as keyForAttribute
at null. (http://localhost:4200/assets/vendor.js:66421:31)
at null. (http://localhost:4200/assets/vendor.js:68910:20)
at cb (http://localhost:4200/assets/vendor.js:29082:22)
at OrderedSet.forEach (http://localhost:4200/assets/vendor.js:28880:13)

But once i switched back to 1.7 , it worked perfectly.

In fact I AM following your book and it simply wouldn't work in the very first chapter where you attempt to call your api and get first name from friends endpoint.

can't get application to recognize picnic classes

Everything worked as described in the book up to page 50. index.html is as described. But I don't see an asset folder other than the one in the "dist" directory. Is that the asset folder the author's talking about. borrowers.css and vendor.css in dist/assets are both empty.

Page 60: linking to /friends/:friend_id/articles from friends index results in Error 'Uncaught Error: More context objects were passed than there are dynamic segments for the route: articles'

I'm running into an issue at Page 60 in the 'Nested Articles Index' section of the book. At the part where you write

If we visit a friend profile, we won’t see anything related with the articles index route. Why? Well,
we are not visiting that route, that’s why. To get to the articles index route, we need to modify the
link-to in app/templates/friends/index.hbs to reference the route articles instead of friends.show.
We’ll still pass the friend as an argument since the route articles is nested under friends.show
and it has the dynamic segment :friend_id.

so I updated the /app/templates/friends/index.hbs

<table class="primary">
  <thead>
    <tr>
      <th>Name</th>
      <th>Articles</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    {{#each model as |friend|}}
      <tr>
        <!-- update the link to 'articles' as specified in the passage above -->
        <td>{{link-to friend.fullName "articles" friend}}</td>
        <td>{{friend.totalArticles}}</td>
        <td><a href="#"{{action 'delete' friend}}>Delete</a></td>
      </tr>
    {{/each}}
  </tbody>
</table>

which results in the Uncaught Error: More context objects were passed than there are dynamic segments for the route: articles error from the browser console.

screen shot 2015-12-31 at 9 33 38 am

my /app/router.js looks like this

import Ember from 'ember';
import config from './config/environment';

const Router = Ember.Router.extend({
  location: config.locationType
});

Router.map(function() {
  this.route('friends', function() {
    this.route('new');

    this.route('show', {
      path: ':friend_id'
    }, function() {
      this.route('articles', {resetNamespace: true}, function() {
      });
    });

    this.route('edit', {
      path: ':friend_id/edit'
    });

  });
  this.route('articles');
});

export default Router;

I'm going to experiment with placing the articles index template in different places depending on what the ember inspector tells me. I'll update the issue if I find a solution.

Brocfile.js fonts

The 'destDir' for the fontello fonts should be 'font' (as it is in the book on page 50) and not 'assets/fonts' (which gives an error in the JS console).

App CSS

App doesn't look like the example given on page 59 (pdf). I thought I might have missed something so I downloaded master here but it's the same.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.