0.0.1 • Published 9 years ago

webpublisher v0.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
9 years ago

Webpublisher

Coming Soon!

Webpublisher is a node module that will work along side of Express that aims to remove the need for website creation all together.

This allows you to focus your business and technology, and dynamically update website when new features are added in real time.

Form creation & handling in one spot

No need to connect the dots. All user interaction is both created, and handles in one spot. This simplifies your business logic and makes refactoring a snap!

//names will automatically be formatted,
//email and password will be proper field types
content.form(['firstName', 'lastName', 'email', 'password'], signup);

function signup(data) {
	//save data in database
}

Live Updating

Every time you make a change and save, the website will refresh immediately with it’s new content. This makes rapid content creation easier.

//push content
publicSite.page('/', require('./public/home'));
publicSite.page('/signup', require('./public/signup'));
webpublisher->publish();

We recommend running Nodemon to make updating-on-save easier.

Dynamically added content

Want to do some A/B Testing? Or show different content to different people? Create a callback to load dynamic content on specific parts of your website.

content->title('Lets load some on-demand content!');
content->dynamic(function(content){
	if(Math.round(Math.random()))
  	content->title({title: 'Option #1', size: 3});
	else
  	content->title({title: 'Option #2', size: 3});
});
content->paragraph('Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.');

Live-Updating Variables

All your variables (global, user specific or privilege based) will update in real time for everyone viewing your website when you make a change.

content->paragraph(‘Hello {user.name}!’);

//set a user-specific variable called name
webpublisher->var('user', 'name', 'Greg');

Themes

Create your themes with 5 variables, and attach those themes to any element you are creating (child elements will automatically inherit).

Theme Variables:

  • Background
  • Text
  • Link
  • Active
  • Border

User Access Levels

Control access to your website and pages easily by creating user access levels. Each privilege will also have its own set of variables.

//on top of public
webpublisher->privileges('admin', 'accounting', 'employee');

webpublisher.page('/admin', require('./admin/dashboard'), ['admin']);

function handleLogin(data){
	//verify user

	//promote user
	user->promote(‘admin’)
	user->redirect('/admin');

	//set an admin-level variable
	webpublisher->var('admin', 'logins', webpublisher->var('admin', 'logins') + 1);
}

Simple or Verbose

Whenever possible, we provide a much simpler syntax for getting 90% of the jobs done. We also document a verbose method for extra customization.

//simple:

content.form(['firstName', 'lastName', 'email', 'password'], handleSignup);

//Does the exact same thing as:

var formData = {
	type: 'horizontal'
	field: {
		firstName: {
			type: 'text',
			placeholder: '',
			title: 'First Name',
			required: true,
			hint: ''
		},
		lastName: {
			type: 'text',
			placeholder: '',
			title: 'Last Name',
			required: true,
			hint: ''
		},
		email: {
			type: 'email',
			placeholder: '',
			title: 'Email',
			required: true,
			hint: ''
		},
		password: {
			type: 'password',
			placeholder: '',
			title: 'Password',
			required: true,
			min: 7,
			hint: ''
		}
	}
};

content->form(formData, handleSignup);
0.0.1

9 years ago