Skip to content
DAddYE edited this page Sep 12, 2010 · 22 revisions

Full Integration with Rails 2.2 [done]

  • In the new version the emails and activations are translated with rails locale. [done]
  • In the next verision also javascripts works with the integrated localization of rails. [done]

Short example:


# /config/locale/backend/en.yml

en:
  lipsiadmin:
    javascripts:
      buttons:
        add: "Add"
        edit: "Edit"
        remove: "Delete"

So in a javascript you can use:


alert(Backend.locale.buttons.add);

New javascripts features

  • Now the main js app is called Backend. [done]
  • Two fully tested templated (see app/views/backend/base/index). [done]
  • In this new version there is a better organization of backend.js now is more clean and more more fast. [done]
  • Now we have two beautiful templates, standard and slate. [done]
  • Now we have one top side menu (like toolbar). [done]
  • Now there is a beautifull helper for load html or load and execute js [done]
  • Cookie status of columns/grids, now you can personalize columns width, position etc. [done]
  • No more proxy memory for manage search and pagination, now are server side. [done]
  • Better generation of standard grids, editable grids, tree see this example. [done]
  • Caching and History support for columns and next-back buttons. [done]
  • Now you can reuse everywhere your forms in any page. [done]

Examples:


// some examples
Backend.app.load('/my_grid.js')
Backend.app.load('/my_page')
Backend.app.backTo = '/backend/mygrid'
Backend.app.back

Grid Generations:


# in app/controllers/accounts_controller.rb
    params[:limit] ||= 50
    @column_store = column_store_for Account do |cm|
      cm.add :name,         "Name",           :sortable => true
      cm.add :surname,      "Surname",        :sortable => true
      cm.add :email,        "Email",          :sortable => true
      cm.add :created_at,   "Created at",     :sortable => true, :renderer => :datetime, :align => :right
      cm.add :updated_at,   "Updated at",     :sortable => true, :renderer => :datetime, :align => :right
    end

    respond_to do |format|
      format.js 
      format.json do
        render :json => @column_store.store_data(params)
      end
    end

# in app/views/accounts/index.rjs

page.grid do |grid|
  grid.id "grid-accounts"
  grid.title "List all Accounts"
  grid.base_path "/backend/accounts"
  grid.forgery_protection_token request_forgery_protection_token
  grid.authenticity_token form_authenticity_token
  grid.tbar  :default
  grid.store do |store|
    store.url "/backend/accounts.json"
    store.fields @column_store.store_fields
  end
  grid.columns do |columns|
    columns.fields @column_store.column_fields
  end
  grid.bbar  :store => grid.get_store, :pageSize => params[:limit]
end

Example of reusing accounts form in another form:


# in app/views/dossiers/_form.html.haml

-tab "Accounts", :style => "padding:10px" do
  %table
    %tr
      %td{:style=>"width:100px"} 
        %b Customer:
      %td
        %span{:id => :account_name}=@dossier.account ? @dossier.account.full_name : "None"
        =hidden_field :dossier, :account_id
        =open_window "/backend/accounts.js", :id, :name, :dossier_account_id, :account_name

Plugins

  • Helpers for automatize sorting of image or files
  • Helpers for automatize file_field etc…
  • In the next version we use a new integrated system for storing images and files (like paperclip). [done]

In any model you can do:


  has_many_attachments              :attachments, :dependent => :destroy
  has_one_attachment                   :image
  attachment_styles_for                 :attachments, :normal, "128x128!"
  validates_attachment_presence_for     :attachments
  validates_attachment_size_for         :attachments, :greater_than => 10.megabytes
  validates_attachment_content_type_for :attachments, "image/png"
  ...

And in your view simply:


  =fields_for "yourmodel[attachments_attributes][]", @dossier.attachments.build do |attachment|
    Attach your file:
    =attachment.file_field :file

Authentication

  • New builtin authentication with modules and roles, multiaccount. [done]
  • Auth don’t need to restart the web server. [done]
  • SubMenu creations. [done]
  • Better backend and frontend managment. [done]

See this example:


  1. in app/models/account_access.rb
    class AccountAccess < Lipsiadmin::AccessControl::Base
roles_for :administrator do |role|
  1. Shared Permission
    role.allow_all_actions “/backend/base”
    role.allow_all_actions “/backend/event_logs”
    role.deny “/backend/base/onlyforcustomers”
role.project_module “My Administration Menu” do |project| project.menu :test, “/backend/dossiers/14/edit” do |submenu| submenu.add :sub_test_1 do |subsubmenu| subsubmenu.add :sub_sub_test_1, “/backend/dossier/test” subsubmenu.add :sub_sub_test_2, “/backend/dossier/test” end submenu.add :sub_test_2, “/backend/dossiers/14/edit” end …

Clone this wiki locally