GithubHelp home page GithubHelp logo

tarlepp / angular-sailsjs-boilerplate-frontend Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 15.0 91 KB

Frontend side for angular-sailsjs-boilerplate

License: MIT License

JavaScript 69.64% HTML 26.76% CSS 3.60%

angular-sailsjs-boilerplate-frontend's Issues

_fetchData() behavior

I have a controller that depends if the user is a normal user or is an admin/manager user load diferent data:

                resolve: {
                  _items: [
                    'ListConfig',
                    'IncidenceModel',
                    'UserService',
                    function resolve(
                      ListConfig,
                      IncidenceModel,
                      UserService
                    ) {
                      var config = ListConfig.getConfig();
                      var user = UserService.user();
                      var parameters = {
                        populate: 'users',
                        limit: config.itemsPerPage,
                        sort: 'createdAt DESC'
                      };
                      if (!user.admin && !user.gestorIncidencias) {
                        parameters.user = user.id;
                      }
                      return IncidenceModel.load(parameters);
                    }
                  ],

This work ok for me and load the correct data but in the list.html view when you try to make a search in the 'search filter' the _fechData() load all the items from IncidenceModel:

        function _fetchData() {
          $scope.loading = true;

          // Common parameters for count and data query
          var commonParameters = {
            where: SocketHelperService.getWhere($scope.filters)
          };

          // Data query specified parameters
          var parameters = {
            populate: 'users',
            limit: $scope.itemsPerPage,
            skip: ($scope.currentPage - 1) * $scope.itemsPerPage,
            sort: $scope.sort.column + ' ' + ($scope.sort.direction ? 'ASC' : 'DESC')
          };


          // Fetch data count
          var count = IncidenceModel
            .count(commonParameters)
            .then(
              function onSuccess(response) {
                $scope.itemCount = response.count;
              }
            )
          ;

          // Fetch actual data
          var load = IncidenceModel
            .load(_.merge({}, commonParameters, parameters))
            .then(
              function onSuccess(response) {
                  $scope.items = response;
              }
            )

          // And wrap those all to promise loading
          $q
            .all([count, load])
            .finally(
              function onFinally() {
                $scope.loaded = true;
                $scope.loading = false;
              }
            )
          ;
        }

How can I resolve this? I try to introduce another condition (user: $scope.user.id) in count and load vars but I'm unable.

Can anyone help me please?

datepicker refresh error

When you select to modify a book and change the released year, if you 'Cancel' the changes the view show the date that you select in the calendar, not the date in the database. If you refresh the page, them you can see the correct value of the date.

Thanks.

https server in the frontend

I need that Frontend response through HTTPS instead of HTTP (due to ServiceWorker). My production server is working with HTTPS without problems but, is there an easy way to do that on my local machine (developer environment)? Thanks

Node 4 compatibility

Is there any plans to update many of the dev dependencies any time soon? Some of them are not Node 4 compatible like gulp-sass.

DataModel.setScope behavior

My resolve variable in ui-router:

            _votesSurvey: [
                    '$stateParams',
                    'AnswerModel',
                    'VoteModel',
                    function resolve(
                      $stateParams,
                      AnswerModel,
                      VoteModel
                    ) {
                      return AnswerModel.load({survey: $stateParams.survey, populate: 'votes'});
                    }
                  ]

My controller:

VotoModel.setScope($scope, false, 'votesSurvey');
$scope.votesSurvey = _votesSurvey;

At first the $scope.votesSurvey format is (contain the fields of AnswerModel with populate votes):

0:Object
  createdAt:"2016-08-22T08:52:30.000Z"
  createdUser:3
  survey:8
  id:33
  text:"respuesta1"
  updatedAt:"2016-08-22T08:52:30.000Z"
  updatedUser:3
  votes:Array[2]
  __proto__:Object
1:Object
  createdAt:"2016-08-22T08:52:39.000Z"
  createdUser:3
  survey:8
  id:34
  text:"respuesta2"
  updatedAt:"2016-08-22T08:52:39.000Z"
  updatedUser:3
  votes:Array[0]
  __proto__:Object
...

But when another user make a vote (create a register in votes table) the format of $scope.votesSurvey change (contain only the fields of VoteModel).
What is happening here? What am I doing wrong?
Thanks

/admin/loginHistory gets redirected

Hi! What a great work you shared here, thanks! I'm going to use this for my next project.

Just a question, cause I don't know if this is the expected behavior: There's a folder admin under src/app with a module which defines a route to /admin/loginHistory. When I try to reach that via the browser address bar, the app redirects to the login page then to the page where I was. Judging by the code, it seems to me that this shouldn't happen. Am I wrong?

LiveReload causing net::ERR_CONNECTION_REFUSED

I've been using this boilerplate for quite a while now, I love it!

LiveReload seems to be giving throwing an error in the console:

GET http://localhost:35729/livereload.js?snipver=1 net::ERR_CONNECTION_REFUSED

It used to work perfectly before upgrading its version in package.json.

Also, in the terminal, it now reads:

Server started at http://:::3001

instead of

Server started at http://localhost:3001

as if it doesn't detect the hostname properly anymore (it showed fine with older version of gulp-serve).

Maybe those issues are somehow related?

Suggestions: Would it be better to move to https://github.com/BrowserSync/browser-sync ? I can try and PR if it works well.

gulp dist do not create well a page

I'm testing my project and in 'gulp serve' works fine but after make a gulp dist and production there is a page that is no complete. No errors in console.
With gulp serve:
image

With gulp dist + gulp production:
image

datepicker options

Where can I find the datepicker options? Is it possible to change to Spanish language?

<datepicker
   ...
></datepicker>

Thanks in advance.

error in gulp dist

When I try to make 'gulp dist' appear the next error:

[00:44:19] Starting 'scripts-dist'...

stream.js:74
      throw er; // Unhandled stream error in pipe.
      ^
 Error: Broken @import declaration of "http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" - timeout

Where is the correct way to add a js vendor?

I need to add 'angular-locale_es-es.js' to the frontend.
Where is the correct way to add this file to the project?
I make 'bower install angular-i18n' but in this way don't appear in the project.

Thanks in advance.

Integration with gulp-ejs

Any chance you might be willing to include gulp-els in this project for those who have to support templates and want to follow your good work in this area?

integration with ionic

I would like to integrate the frontend in ionic , I tried to add

$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}});

in app.js , in the angular.module('frontend').run....
but it don't work : any idea for integrating it in ionic???? Have I to change something in ui-router?

I know that I will have to change my html and css files for the project , but for index.html I just have what is provided by ionic and I don't have the ionic tab with 'ionic blank starter' as if I begin a blank ionic project

[enhancement] DataModel to be much faster

I have a suggestion to make. I already implemented it into my project, and it works as expected.

I noticed that the DataModel was always reloading/refetching the models from the backend in the handlerCreated, handlerUpdated, handlerDestroyed methods.

However, this is unnecessary, since their message parameter already contains the created, updated, or destroyed object in message.data (and its id in message.id).

Thus, what I am doing instead of reloading the objects is simply this:

For handlerCreated:
self.objects.push(message.data);
++self.scope[self.itemNames.count];

For handlerUpdated:
var idx = self._findIndexById(message.id);
self.objects.splice(idx, 1, message.data);

For handlerDestroyed:
var idx = self._findIndexById(message.id);
self.objects.splice(idx, 1);
--self.scope[self.itemNames.count];

My _findIndexById() method is as follow:

DataModel.prototype._findIndexById = function findIndexById(id) {
    var self = this;

    for(var idx = 0; idx < self.objects.length; ++idx) {
        if(self.objects[idx].id === id) {
              return idx;
         }
     }
}

This way, it behaves exactly the same way as before, but does not reload/refetch/recounts everything on every event.

Let me know your opinion on this. If interested I will PR it.

P.S:
I also added an update to the count on the load() function:

if (fromCache && self.scope && self.itemNames.count) {
    self.scope[self.itemNames.count] = self.objects.length;
}

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.