Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Nick Mealey
@nickmealey
There's not really much to be done, and creating a form is pretty easy. Just make the raw bits now and I can style them tomorrow morning.
Simon Kim
@simon-kim
we're trying to get the raw bits out right now but shit keeps breaking everytime we introduce something new
which is why we brought in another guy
Nick Mealey
@nickmealey
What's breaking?
Everything? :)
William Huang
@thewillhuang
lmao
fk angular?
Simon Kim
@simon-kim
it SHOULDNT be breaking but it is
is there a reason why the login/profile/search
is at the footer
Nick Mealey
@nickmealey
I just threw it in there as a link, their just placeholders
they're*
Simon Kim
@simon-kim
okay just wondering!
Nick Mealey
@nickmealey
We can put whatever link you guys want in either the header or footer, you'll notice that it becomes a mobile menu small.
I'd be happy to pitch in, if you have a view, send my way and I'll make it look good.
Like I said, I'll be up early tomorrow, so hopefully things will pan out
by then*
Simon Kim
@simon-kim
uhh for now just change up the main page's view i guess?
like it'd be nice if clicking "ripple" could redirect back to a homepage
and the placeholders could have actual information or images or something?
like if one of those divs is for the comments
write comments so we can have a better "idea"?
i dunno
Joe Teo
@joekteo
require('./controllers/bibleCtrl')(bibleApp);
// require('./controllers/userCtrl')(bibleApp);

// bibleApp.config(['$routeProvider', function($routeProvider) {
//   $routeProvider
//   .when('/', {
//     templateUrl: 'assets/templates/home.html',
//     controller: 'bibleCtrl'
//   })
//   .when('/login', {
//     templateUrl: 'assets/templates/login.html',
//     controller: 'userCtrl'
//   });
// //   .otherwise({
// //     redirectTo: '/'
// //   });
// }]);
Joe Teo
@joekteo
<div data-ng-controller="userCtrl">
  <section id='buttons'data-ng-hide='signUp || signIn'>
    <button id='signin' data-ng-click='signIn = true'>Log In</button>
    <p>Or <a id='signup' href data-ng-click='signUp = true'>Sign Up</a></p>
  </section>
  <section id='signUp' class='form' data-ng-show='signUp'>
    <i>{{errors}}</i><br>
    <form>
      <label>Username: </label><br>
      <label>Email: </label><br>
      <input type='text' data-ng-model='newUser.email'><br>
      <label>Password: </label><br>
      <input type='password' data-ng-model='newUser.password'><br>
      <label>Password Confirmation: </label><br>
      <input type='password' data-ng-model='newUser.passwordConfirmation'><br>
      <button id='submit' class='submit' data-ng-click='signUp()'>Sign Up</button>
    </form>
    <a id='signin' href data-ng-click='signIn = true; signUp = false; errors = null;'>Log In</a>
  </section>
  <section id='signIn' class='form' data-ng-show='signIn'>
    <i>{{errors}}</i><br>
    <form>
      <label>Email:</label><br>
      <input type='text' data-ng-model='user.email'><br>
      <label>Password:</label><br>
      <input type='password' data-ng-model='user.password'><br>
      <button id='login' class='submit' data-ng-click='logIn()'>Log In</button>
    </form>
    <a id='signin' href data-ng-click='signUp = true; signIn = false; errors = null;'>Sign Up</a>
  </section>
</div>
'use strict';

module.exports = function(app) {
  app.controller('userCtrl', ['$scope', '$http', '$base64', '$cookies', '$location', function($scope, $http, $base64, $cookies, $location) {
    $scope.signUp = false;
    $scope.signIn = false;
    if ($cookies.jwt) {
      console.log('redirecting');
      $location.path('/');
    }

    $scope.logIn = function() {
      $scope.errors = null;
      $http.defaults.headers.common.Authorization = 'Basic ' + $base64.encode($scope.user.email + ':' + $scope.user.password);
      $http({
        method: 'GET',
        url: '/api/users'
      })
      .success(function(data) {
        $cookies.jwt = data.jwt;
        $location.path('/');
      })
      .error(function(data) {
        console.log('err', data);
        $scope.errors = data;
      });
    };

    $scope.signUp = function() {
      $scope.errors = null;
      if ($scope.newUser.password !== $scope.newUser.passwordConfirmation) $scope.errors = 'passwords did not match';
      if (!$scope.newUser.email) $scope.errors = 'please specify an email';
      if (!$scope.newUser.password) $scope.errors = 'invalid password';
      if ($scope.errors !== null) return;

      $http({
        method: 'POST',
        url: '/api/users',
        data: $scope.newUser
      })
      .success(function(data) {
        $cookies.jwt = data.jwt;
        $location.path('/');
      })
      .error(function(data) {
        console.log('err', data);
        $scope.errors = data;
      });
    };
  }]);
};
Simon Kim
@simon-kim
2 fucking am and I got templates/angular/modularization to work
i'll try to get to Code Fellows at like 8 or 9
Nick Mealey
@nickmealey
I'm at CodeFellows, I'll be on the middle floor.