npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

shadowfax

v0.1.0

Published

angular login/register and general account related directives

Downloads

1

Readme

shadowfax

angular login/register form directives - works well with gandalf

install

Install the module to your project:

$ npm install binocarlos/shadowfax --save

Include it in your app.js:

var angular = require('angular-bsfy')
var shadowfax = require('shadowfax')

var app = angular.module('myApp',[
    shadowfax.name
])

Then compile with browserify and brfs:

$ browserify -t brfs app.js > bundle.js

usage

Shadowfax directives use bootstrap markup - use them inside a controller that includes the shadowfax module.

var angular = require('angular-bsfy')
var shadowfax = require('shadowfax')

var app = angular.module('myApp',[
    shadowfax.name
])

app.controller('MyCtrl', function($scope){
	$scope.$on('shadowfax:login', function($ev, data){
		// handle login with data.username & data.password
	})
})

Then you can use shadowfax directives from your pages:

<body ng-app="MyApp" ng-controller="MyCtrl">
<h3>Login</h3>

<div>
	<shadowfax-login />
</div>

<h3>Register</h3>

<div>
	<shadowfax-register>

		<!--
			You can transclude extra form items into the register form
			Set the model to be property of data
		 -->
		<div class="form-group">
      <label class="col-md-2 control-label" for="extra">Extra</label>
      <div class="col-md-8">
        <input type="text" class="form-control" id="extra" name="extra" placeholder="Confirm Password" ng-model="data.extra" required>
      </div>
    </div>

	</shadowfax-register>
</div>

<script src="build.js"></script>
</body>

directives

shadowfax-login

Show a login form with username & password fields.

shadowfax-mini-login

Show a compact login form with username & password fields.

shadowfax-register

Show a register form with username, email & password fields.

It will render these fields automatically:

  • username
  • email
  • password

The register directive is transcluded so you can pass extra form fields into it.

shadowfax-details

Show a details form that is the same as the register form but will update a shadowfax:save event instead.

It is transcluded like the register form.

events

Listen to these events in the scope to handle the backend logic how you want.

$on('shadowfax:login', function($ev, data){})

Called when the login button is pressed - data is an object:

{
	username:"bob",
	password:"password"
}

An example of hooking up custom logic to deal with the login event:

app.controller('MyCtrl', function($scope, $http){
	$scope.$on('shadowfax:login', function($ev, data){
		$http({
			url:'/auth/login',
			method:'POST',
			data:data
		})
		.success(function(data){
			// user has logged in
		})
		.error(function(data){
			// problem
		})
	})
})
$on('shadowfax:register', function($ev, data){})

Called when the register button is pressed - data is an object:

{
	username:"bob",
	fullname:"Bob Bob",
	email:"[email protected]",
	password:"password"
}

An example of hooking up custom logic to deal with the login event:

app.controller('MyCtrl', function($scope, $http){
	$scope.$on('shadowfax:register', function($ev, data){
		$http({
			url:'/auth/register',
			method:'POST',
			data:data
		})
		.success(function(data){
			// user has registered
		})
		.error(function(data){
			// problem
		})
	})
})
$on('shadowfax:save', function($ev, data){})

Called when the details form is saved - essentially the same as register but used for an existing user to update their details.

license

MIT