twAdminPlugin - 0.1.0

Backend module based on sfAdminDashPlugin

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

twAdminPlugin based on sfAdminDashPlugin

Overview

I had to create nice backend for my Thunderwolf Project and here is result.

This plugin is based on sfAdminDashPlugin created by Kevin Bond. Like him I had to create a menu to access all the various modules.

This plugin automates the process by using a configuration files.

Optional Requirements:

twCorePlugin Base plugin for all Thunderwolf Plugins

sfGuardPlugin The Best plugin for authentication

How to use

Step 1 - install plugin

Install the plugin, clear the cache and activate the twDefault and twAdmin module in the application's settings.yml.

enabled_modules:        [default, twDefault, twAdmin]

Step 2 - setup theme

Publish the plugin's assets:

plugin:publish-assets

If the modules are admin generator modules, deactivate the default admin generator theme in each module's generator.yml by creating a css property. You can either point the css property to a real stylesheet or just use a placeholder.

generator:
  class: sfPropelGenerator
  param:
    model_class:           Article
    theme:                 thunderwolf
    non_verbose_templates: true
    with_show:             false
    singular:              ~
    plural:                ~
    route_prefix:          article
    with_propel_route:     1
    css:                   nothing   #setting the css to a placeholder 

    config:
      actions: ~
      fields:  ~
      list:    ~
      filter:  ~
      form:    ~
      edit:    ~
      new:     ~

Add the plugin's header and footer partials to your applications global layout:

<body>
  <div id="wrapper">
    <?php include_component('twAdmin', 'top') ?>
    <?php include_component('twAdmin', 'menu') ?>
    <div id="layout-content" class="layout-row">
      <div class="layout-box">
        <?php echo $sf_content ?>
      </div> <!-- .layout-box -->
    </div> <!-- #layout-content -->
    <?php include_partial('twAdmin/bottom') ?>
  </div> <!-- #wrapper -->
</body>

Step 3 (optional) - setup sfGuardPlugin

Copy files from twAdminPlugin/data/skeleton/apps/backend/modules to your app modules.

Step 4 (optional) - setup the Thunderwolf Admin homepage

Set your application's homepage in your application's routing.yml to:

homepage:
  url:   /
  param: { module: twAdmin, action: index }

Step 5 - configure global plugin configuration

The plugin's app.yml file looks like the following:

all:
  tw_admin:
    web_dir:                      /twAdminPlugin
    image_dir:                    /twAdminPlugin/images/
    default_image:                logo.png
    resize_mode:                  thumbnail
    site:                         My Site
    site_start_year:              2009
    include_path:                 true
    include_jquery_no_conflict:   false
    logout:                       true
    login_route:                  @sf_guard_signin
    logout_route:                 @sf_guard_signout
  • web_dir - Where the plugin's default css/javascript/images are kept.
  • image_dir - Where your images for Thunderwolf Admin are kept - images should be 48x48.
  • default_image - The default item image if none is specified - this must be in the image_dir folder.
  • resize_mode - How the image will be resized for the menu items.
    • thumbnail - Looks for a directory inside image_dir called small for an image with the same - it should be 16x16.
    • html - Resizes the image with the html img tag width/height attributes.
  • site - What you would like the site name to be (shows up in the path bar as a link).
  • site_start_year - Year when site was started (for copyright in the path bar
  • include_path - Whether to generate path "breadcrumbs". Those are meant mainly for the admin generator.
  • include_jquery_no_conflict - In case you are using another JS framework in you website, you should set this to true. It will prevent jQuery from interfering.
  • logout - Whether a logout link will be shown.
  • login_route - The route to the login action, defaults to the sfGuardPlugin's.
  • logout_route - The route to the logout action, defaults to the sfGuardPlugin's.

You can override these settings as you see fit.

Step 6 - configure the Thunderwolf Menu items

[TODO]...Works different from oryginal plugin...[TODO]