Skip to content

marcomusso/Mojolicious-Boilerplate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Mojolicious and Bootstrap from Twitter

##Features

  • YAML config for Mojolicious
  • Configurable application menu based on user type
  • Unified user notification through messages displayed (alert, success, info)
  • Examples of using the Mojolicious sessions

##Getting Started

###1. Installation ####1.1 Install Mojolicious

  sudo -s 'curl -L cpanmin.us | perl - Mojolicious'

####1.2 Install Mojolicious::Plugin::YamlConfig

sudo cpan Mojolicious::Plugin::YamlConfig

####1.3 Install the YAML::XS module - used for reading the config file

sudo cpan YAML::XS

####1.4 Install Test::BDD::Cucumber - for running the test suite

sudo cpan Test::BDD::Cucumber 

###2. Clone this repository

 git clone git://github.com/tudorconstantin/Mojolicious-Boilerplate.git

###3. Start the app for development

cd Mojolicious-boilerplate
morbo script/boilerplate

###4. Point your browser at http://127.0.0.1:3000

#Web Application Development with Mojolicious Boilerplate

##Configure application menu

  • start by editing
conf/config.yaml
  • config values found in this file are accessible inside the application as a hash ref in
#$c being the controller instance
$c->app->{config}
  • there are 2 demo users in the config file: admin and regular. Those users are used for showing how to build different application menu for different user types. In your application, you'll 'probably' take your users from a DB or something
  • based on user types, we have 3 types of menu:
    • anonymous - when there is no one logged in
    • regular - when there is a 'normal' user logged in
    • admin - menu for the admins

##Display error/notice/success messages automatically

  • simply push strings into the $self->session->{error_messages} array ref, in order to display error messages
push @{ $self->session->{error_messages} },  'Error message'
  • same for notice or success messages:
push @{ $self->session->{notice_messages} },  'You look too good to be true';
push @{ $self->session->{success_messages} },  'Success looks good on anybody';

Mojolicious/Bootstrap msg examples

##Contributors

##About Mojolicious

  • Awesome Perl microframework inspired by Sinatra
  • Very easy to get started with:
use Mojolicious::Lite;
get '/' => {text => 'Hello World!'};
app->start;

##About Bootstrap from Twitter

  • Give your applications a slick look and feel
  • Gain cross browser compatibility out of the box
  • Very customizable
  • Get access to a great collection of components and plugins

Releases

No releases published

Packages

No packages published