lipsiadmin 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +10 -1
- data/README +4 -3
- data/lib/access_control/base.rb +8 -8
- data/lib/controller/ext.rb +13 -18
- data/lib/version.rb +1 -1
- data/lib/view/helpers/backend_helper.rb +118 -7
- data/lipsiadmin_generators/backend/templates/config/locales/backend/en.yml +10 -1
- data/lipsiadmin_generators/backend/templates/config/locales/backend/it.yml +11 -2
- data/lipsiadmin_generators/backend/templates/config/locales/models/it.yml +12 -12
- data/lipsiadmin_generators/backend/templates/controllers/backend/accounts_controller.rb +5 -5
- data/lipsiadmin_generators/backend/templates/models/account_access.rb +14 -1
- data/lipsiadmin_generators/backend/templates/views/backend/accounts/_form.html.haml +7 -7
- data/lipsiadmin_generators/backend/templates/views/backend/accounts/edit.html.haml +1 -1
- data/lipsiadmin_generators/backend/templates/views/backend/accounts/index.rjs +2 -1
- data/lipsiadmin_generators/backend/templates/views/backend/accounts/new.html.haml +1 -1
- data/lipsiadmin_generators/backend_page/REMEMBER +1 -0
- data/lipsiadmin_generators/backend_page/templates/controller.rb +1 -1
- data/lipsiadmin_generators/backend_page/templates/form.html.haml +1 -1
- data/lipsiadmin_generators/backend_page/templates/view_edit.html.haml +1 -1
- data/lipsiadmin_generators/backend_page/templates/view_index.rjs.erb +1 -1
- data/lipsiadmin_generators/backend_page/templates/view_new.html.haml +1 -1
- metadata +2 -2
    
        data/CHANGELOG
    CHANGED
    
    | @@ -1,6 +1,15 @@ | |
| 1 | 
            +
            2009-05-15
         | 
| 2 | 
            +
              * Bumped version to 4.1.0
         | 
| 3 | 
            +
              * Now admin can be completly translated in any languages
         | 
| 4 | 
            +
              * Refactored generation of grids
         | 
| 5 | 
            +
              * Improved documentation of helpers
         | 
| 6 | 
            +
              * Fixed rdoc typos
         | 
| 7 | 
            +
              * Imporved backend helpers and rdoc
         | 
| 8 | 
            +
             | 
| 1 9 | 
             
            2009-05-11
         | 
| 2 10 | 
             
              * Bumped version to 4.0.0
         | 
| 3 | 
            -
              *  | 
| 11 | 
            +
              * Added editable grids
         | 
| 12 | 
            +
              * Refactored backend.js so javascript in tabs are evaluated after render so you can interact with tabs
         | 
| 4 13 | 
             
              * Refactored Backend.window so now you can do much more with your grids/forms. See rdoc for examples.
         | 
| 5 14 | 
             
              * Small refactor to attachment processor, now original attachments are saved without "_original_" in the filename.
         | 
| 6 15 |  | 
    
        data/README
    CHANGED
    
    | @@ -28,12 +28,12 @@ Haml 2+ | |
| 28 28 |  | 
| 29 29 | 
             
            Then in your config/environment.rb
         | 
| 30 30 |  | 
| 31 | 
            -
              config.gem "lipsiadmin", :version => "<  | 
| 31 | 
            +
              config.gem "lipsiadmin", :version => "< 5.0"
         | 
| 32 32 |  | 
| 33 33 | 
             
            Why we need to specify version?
         | 
| 34 34 |  | 
| 35 | 
            -
            Simply because we mantain backward compatibility until a  | 
| 36 | 
            -
            This mean that before v  | 
| 35 | 
            +
            Simply because we mantain backward compatibility until a 5.0 version.
         | 
| 36 | 
            +
            This mean that before v 5.0 we only do small improvemets, bug fix, doc etc...
         | 
| 37 37 |  | 
| 38 38 | 
             
            If you want install the edge version you can simply do:
         | 
| 39 39 |  | 
| @@ -52,6 +52,7 @@ So you can do: | |
| 52 52 | 
             
              $ script/generate backend # Generate the base admin
         | 
| 53 53 | 
             
              $ script/generate backend_page yourmodel # Generate a "scaffold" for your model
         | 
| 54 54 | 
             
              $ script/generate state_session # Create a "scaffold" for store extjs grid settings in db
         | 
| 55 | 
            +
              $ script/generate loops # Generate background workers
         | 
| 55 56 | 
             
              $ script/generate frontend # Generate the base frontend
         | 
| 56 57 | 
             
              $ script/generate attachment # Generate the an attachments
         | 
| 57 58 | 
             
              $ script/generate pdf PdfName # Generate a new pdf document
         | 
    
        data/lib/access_control/base.rb
    CHANGED
    
    | @@ -155,9 +155,9 @@ module Lipsiadmin | |
| 155 155 | 
             
                    return @allowed.uniq
         | 
| 156 156 | 
             
                  end
         | 
| 157 157 |  | 
| 158 | 
            -
                  # Return the original name or try to humanize the symbol
         | 
| 158 | 
            +
                  # Return the original name or try to translate or humanize the symbol
         | 
| 159 159 | 
             
                  def human_name
         | 
| 160 | 
            -
                    return @name.is_a?(Symbol) ? @name.to_s.humanize : @name
         | 
| 160 | 
            +
                    return @name.is_a?(Symbol) ? I18n.t("backend.menus.#{@name}", :default => @name.to_s.humanize) : @name
         | 
| 161 161 | 
             
                  end
         | 
| 162 162 |  | 
| 163 163 | 
             
                  # Return a unique id for the given project module
         | 
| @@ -167,9 +167,9 @@ module Lipsiadmin | |
| 167 167 |  | 
| 168 168 | 
             
                  # Return ExtJs Config for this project module
         | 
| 169 169 | 
             
                  def config
         | 
| 170 | 
            -
                    options = @options.merge(: | 
| 170 | 
            +
                    options = @options.merge(:text => human_name)
         | 
| 171 171 | 
             
                    options.merge!(:menu => @menus.collect(&:config)) if @menus.size > 0
         | 
| 172 | 
            -
                    options.merge!(:handler =>   | 
| 172 | 
            +
                    options.merge!(:handler =>  "function(){ Backend.app.load('#{url_for(@url.merge(:only_path => true))}') }".to_l) if @url
         | 
| 173 173 | 
             
                    return options
         | 
| 174 174 | 
             
                  end
         | 
| 175 175 | 
             
                end
         | 
| @@ -202,9 +202,9 @@ module Lipsiadmin | |
| 202 202 | 
             
                    return @allowed.uniq
         | 
| 203 203 | 
             
                  end
         | 
| 204 204 |  | 
| 205 | 
            -
                  # Return the original name or try to humanize the symbol
         | 
| 205 | 
            +
                  # Return the original name or try to translate or humanize the symbol
         | 
| 206 206 | 
             
                  def human_name
         | 
| 207 | 
            -
                    return @name.is_a?(Symbol) ? @name.to_s.humanize : @name
         | 
| 207 | 
            +
                    return @name.is_a?(Symbol) ? I18n.t("backend.menus.#{@name}", :default => @name.to_s.humanize) : @name
         | 
| 208 208 | 
             
                  end
         | 
| 209 209 |  | 
| 210 210 | 
             
                  # Return a unique id for the given project module
         | 
| @@ -214,9 +214,9 @@ module Lipsiadmin | |
| 214 214 |  | 
| 215 215 | 
             
                  # Return ExtJs Config for this menu
         | 
| 216 216 | 
             
                  def config
         | 
| 217 | 
            -
                    options = @options.merge(: | 
| 217 | 
            +
                    options = @options.merge(:text => human_name)
         | 
| 218 218 | 
             
                    options.merge!(:menu => @items.collect(&:config)) if @items.size > 0
         | 
| 219 | 
            -
                    options.merge!(:handler => | 
| 219 | 
            +
                    options.merge!(:handler => "function(){ Backend.app.load('#{url_for(@url.merge(:only_path => true))}') }".to_l) if @url
         | 
| 220 220 | 
             
                    return options
         | 
| 221 221 | 
             
                  end
         | 
| 222 222 | 
             
                end
         | 
    
        data/lib/controller/ext.rb
    CHANGED
    
    | @@ -10,6 +10,7 @@ module Lipsiadmin | |
| 10 10 | 
             
                  #       @column_store = column_store_for Debtor do |cm|
         | 
| 11 11 | 
             
                  #         cm.add :id          
         | 
| 12 12 | 
             
                  #         cm.add "full_name_or_company.upcase",   "Full Name",      :sortable => true, :dataIndex => :company
         | 
| 13 | 
            +
                  #         cm.add :surname  # Header will be autogenerated
         | 
| 13 14 | 
             
                  #         cm.add :email,                          "Email",          :sortable => true
         | 
| 14 15 | 
             
                  #         cm.add :piva,                           "Piva",           :sortable => true
         | 
| 15 16 | 
             
                  #         cm.add :created_at,                     "Creato il",      :sortable => true, :renderer => :date, :align => :right
         | 
| @@ -62,14 +63,18 @@ module Lipsiadmin | |
| 62 63 | 
             
                    end
         | 
| 63 64 |  | 
| 64 65 | 
             
                    # Method for add columns to the Column Model
         | 
| 65 | 
            -
                    def add( | 
| 66 | 
            -
                      options | 
| 67 | 
            -
             | 
| 68 | 
            -
                       | 
| 69 | 
            -
                      if  | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
                       | 
| 66 | 
            +
                    def add(*args)
         | 
| 67 | 
            +
                      options = { :method => args[0] }
         | 
| 68 | 
            +
                      options[:header]     = args[1].is_a?(String) || args[1].is_a?(Symbol) ? args[1].to_s : nil
         | 
| 69 | 
            +
                      
         | 
| 70 | 
            +
                      args.each { |a| options.merge!(a) if a.is_a?(Hash)  }
         | 
| 71 | 
            +
                      
         | 
| 72 | 
            +
                      # Add some defaults
         | 
| 73 | 
            +
                      options[:header]   ||= options[:method].to_s
         | 
| 74 | 
            +
                      options[:sortable] ||= true
         | 
| 75 | 
            +
                      
         | 
| 76 | 
            +
                      # Try to translate header
         | 
| 77 | 
            +
                      options[:header] = @model.human_attribute_name(options[:header].to_s)
         | 
| 73 78 |  | 
| 74 79 | 
             
                      # Reformat DataIndex
         | 
| 75 80 | 
             
                      if options[:dataIndex].is_a?(Array)
         | 
| @@ -101,9 +106,6 @@ module Lipsiadmin | |
| 101 106 | 
             
                                                                              gsub(/-+$/, '_').
         | 
| 102 107 | 
             
                                                                              gsub(/^-+$/, '_')
         | 
| 103 108 |  | 
| 104 | 
            -
                      # Reformat header
         | 
| 105 | 
            -
                      options[:header] = header || options[:dataIndex].to_s.humanize
         | 
| 106 | 
            -
             | 
| 107 109 | 
             
                      @data << options
         | 
| 108 110 | 
             
                    end
         | 
| 109 111 |  | 
| @@ -158,13 +160,6 @@ module Lipsiadmin | |
| 158 160 | 
             
                      end
         | 
| 159 161 | 
             
                    end
         | 
| 160 162 |  | 
| 161 | 
            -
                    # Returns an object whose <tt>to_json</tt> evaluates to +code+. Use this to pass a literal JavaScript 
         | 
| 162 | 
            -
                    # expression as an argument to another JavaScriptGenerator method.
         | 
| 163 | 
            -
                    #
         | 
| 164 | 
            -
                    def literal(code)
         | 
| 165 | 
            -
                      ActiveSupport::JSON::Variable.new(code.to_s)
         | 
| 166 | 
            -
                    end
         | 
| 167 | 
            -
                    alias_method :l, :literal
         | 
| 168 163 | 
             
                  end
         | 
| 169 164 | 
             
                end
         | 
| 170 165 | 
             
              end
         | 
    
        data/lib/version.rb
    CHANGED
    
    
| @@ -2,7 +2,7 @@ module Lipsiadmin | |
| 2 2 | 
             
              module View
         | 
| 3 3 | 
             
                module Helpers
         | 
| 4 4 | 
             
                  module BackendHelper
         | 
| 5 | 
            -
                    # This method work like builtin Rails error_message_for but use an Ext.Message. | 
| 5 | 
            +
                    # This method work like builtin Rails error_message_for but use an Ext.Message.show({..})
         | 
| 6 6 | 
             
                    def simple_error_messages_for(*params)
         | 
| 7 7 | 
             
                      options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
         | 
| 8 8 | 
             
                      objects = params.collect {|object_name| instance_variable_get("@#{object_name}") }.compact
         | 
| @@ -20,21 +20,132 @@ module Lipsiadmin | |
| 20 20 | 
             
                      end
         | 
| 21 21 | 
             
                    end
         | 
| 22 22 |  | 
| 23 | 
            -
                    # This method add tab for in your view
         | 
| 23 | 
            +
                    # This method add tab for in your view.
         | 
| 24 | 
            +
                    # 
         | 
| 25 | 
            +
                    # First argument is the name and title of the tab, an interesting thing wose that this helper 
         | 
| 26 | 
            +
                    # try to translate itself to your current locale ex:
         | 
| 27 | 
            +
                    # 
         | 
| 28 | 
            +
                    #   # Look for: I18n.t("backend.tabs.settings", :default => "Settings")
         | 
| 29 | 
            +
                    #   tab :settings do
         | 
| 30 | 
            +
                    #     ...
         | 
| 31 | 
            +
                    # 
         | 
| 32 | 
            +
                    # The second argument specify if is necessary 10px of padding inside the tab, default is +true+
         | 
| 33 | 
            +
                    # 
         | 
| 34 | 
            +
                    # Third argument is an hash that accepts:
         | 
| 35 | 
            +
                    # 
         | 
| 36 | 
            +
                    # <tt>:id</tt>::    The id of the tab
         | 
| 37 | 
            +
                    # <tt>:style</tt>:: Custom style of the tab
         | 
| 38 | 
            +
                    # 
         | 
| 24 39 | 
             
                    def tab(name, padding=true, options={}, &block)
         | 
| 25 | 
            -
                      options[:id] | 
| 26 | 
            -
                      options[:style] | 
| 27 | 
            -
                      options[:title]  = name
         | 
| 40 | 
            +
                      options[:id]    ||= name.to_s.downcase.gsub(/[^a-z0-9]+/, '_').gsub(/-+$/, '').gsub(/^-+$/, '')
         | 
| 41 | 
            +
                      options[:style] ||= "padding:10px;#{options[:style]}" if padding
         | 
| 42 | 
            +
                      options[:title]  = I18n.t("backend.tabs.#{name.to_s.downcase}", :default => name.to_s.humanize)
         | 
| 28 43 | 
             
                      options[:tabbed] = true
         | 
| 29 44 | 
             
                      options[:class]  = "x-hide-display"
         | 
| 30 45 | 
             
                      concat content_tag(:div, capture(&block), options)
         | 
| 31 46 | 
             
                    end
         | 
| 32 47 |  | 
| 33 | 
            -
                    # Set the title of the page
         | 
| 48 | 
            +
                    # Set the title of the page.
         | 
| 49 | 
            +
                    # 
         | 
| 50 | 
            +
                    # An interesting thing wose that this helper 
         | 
| 51 | 
            +
                    # try to translate itself to your current locale ex:
         | 
| 52 | 
            +
                    # 
         | 
| 53 | 
            +
                    #   # Look for: I18n.t("backend.titles.welcome_here", :default => "Welcome Here")
         | 
| 54 | 
            +
                    #   title :welcome_here
         | 
| 55 | 
            +
                    # 
         | 
| 34 56 | 
             
                    def title(title)
         | 
| 57 | 
            +
                      title = I18n.t("backend.titles.#{title.to_s.downcase}", :default => title.to_s.humanize)
         | 
| 35 58 | 
             
                      content_tag(:script, "Backend.app.setTitle(#{title.to_json})", :type => Mime::JS)
         | 
| 36 59 | 
             
                    end
         | 
| 37 60 |  | 
| 61 | 
            +
                    # Get the title for grids of the specified model based on your
         | 
| 62 | 
            +
                    # current locale.
         | 
| 63 | 
            +
                    # 
         | 
| 64 | 
            +
                    # The locale file for this translation is located: config/locales/backend
         | 
| 65 | 
            +
                    # 
         | 
| 66 | 
            +
                    #   # Generate: List all Accounts
         | 
| 67 | 
            +
                    #   list_title_for(Account)
         | 
| 68 | 
            +
                    # 
         | 
| 69 | 
            +
                    #   # Generate: List all My Accounts
         | 
| 70 | 
            +
                    #   list_title_for("My Accounts")
         | 
| 71 | 
            +
                    # 
         | 
| 72 | 
            +
                    def list_title_for(text)
         | 
| 73 | 
            +
                      I18n.t("backend.general.list", :model => text.is_a?(String) ? text : text.send(:human_name))
         | 
| 74 | 
            +
                    end
         | 
| 75 | 
            +
                    
         | 
| 76 | 
            +
                    # Get the title for edit action of a form based on your current locale
         | 
| 77 | 
            +
                    # 
         | 
| 78 | 
            +
                    # The locale file for this translation is located: config/locales/backend
         | 
| 79 | 
            +
                    # 
         | 
| 80 | 
            +
                    #   # Generate: Edit Account 18
         | 
| 81 | 
            +
                    #   edit_title_for(Account, @account.id)
         | 
| 82 | 
            +
                    #   
         | 
| 83 | 
            +
                    #   # Generate: Edit My Account Foo Bar
         | 
| 84 | 
            +
                    #   edit_title_for("My Account", @account.full_name)
         | 
| 85 | 
            +
                    # 
         | 
| 86 | 
            +
                    def edit_title_for(text, value)
         | 
| 87 | 
            +
                      title I18n.t("backend.general.editForm", :model => text.is_a?(String) ? text : text.send(:human_name), :value => value)
         | 
| 88 | 
            +
                    end
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                    # Get the title for new action of a form based on your current locale
         | 
| 91 | 
            +
                    # 
         | 
| 92 | 
            +
                    # The locale file for this translation is located: config/locales/backend
         | 
| 93 | 
            +
                    # 
         | 
| 94 | 
            +
                    #   # Generate: New Account
         | 
| 95 | 
            +
                    #   new_title_for(Account)
         | 
| 96 | 
            +
                    #   
         | 
| 97 | 
            +
                    #   # Generate: New My Account
         | 
| 98 | 
            +
                    #   new_title_for("My Account")
         | 
| 99 | 
            +
                    # 
         | 
| 100 | 
            +
                    def new_title_for(text)
         | 
| 101 | 
            +
                      title I18n.t("backend.general.newForm", :model => text.is_a?(String) ? text : text.send(:human_name))
         | 
| 102 | 
            +
                    end
         | 
| 103 | 
            +
                    
         | 
| 104 | 
            +
                    # Try to translate the given word
         | 
| 105 | 
            +
                    # 
         | 
| 106 | 
            +
                    #   # Generate: I18n.t("backend.labels.add", :default => "Add")
         | 
| 107 | 
            +
                    #   tl("Add")
         | 
| 108 | 
            +
                    # 
         | 
| 109 | 
            +
                    def translate_label(text)
         | 
| 110 | 
            +
                      I18n.t("backend.labels.#{text.to_s.downcase.gsub(/\s/, "_")}", :default => text.to_s.humanize)
         | 
| 111 | 
            +
                    end
         | 
| 112 | 
            +
                    alias_method :tl, :translate_label
         | 
| 113 | 
            +
             | 
| 114 | 
            +
                    # Try to translate the given pharse
         | 
| 115 | 
            +
                    # 
         | 
| 116 | 
            +
                    #   # Generate: I18n.t("backend.labels.lipsiadmin_is_beautifull", :default => "Lipsiadmin is beautifull")
         | 
| 117 | 
            +
                    #   tt("Lipsiadmin is beautifull")
         | 
| 118 | 
            +
                    # 
         | 
| 119 | 
            +
                    def translate_text(text)
         | 
| 120 | 
            +
                      I18n.t("backend.texts.#{text.to_s.downcase.gsub(/\s/, "_")}", :default => text.to_s.humanize)
         | 
| 121 | 
            +
                    end
         | 
| 122 | 
            +
                    alias_method :tt, :translate_text
         | 
| 123 | 
            +
                    
         | 
| 124 | 
            +
                    # Return the translated attribute based on your current locale
         | 
| 125 | 
            +
                    # 
         | 
| 126 | 
            +
                    #   # In config/locales/backend/models/en.yml
         | 
| 127 | 
            +
                    #   en:
         | 
| 128 | 
            +
                    #     activerecord:
         | 
| 129 | 
            +
                    #       attributes:
         | 
| 130 | 
            +
                    #         account:
         | 
| 131 | 
            +
                    #           name: "Account Name"
         | 
| 132 | 
            +
                    #           suranme: "Custom Title For Surname"
         | 
| 133 | 
            +
                    #           role: "Im a"
         | 
| 134 | 
            +
                    #   
         | 
| 135 | 
            +
                    #   # Generates: 
         | 
| 136 | 
            +
                    #   #   Account Name
         | 
| 137 | 
            +
                    #   #   Custom Title For Surname
         | 
| 138 | 
            +
                    #   #   Im a
         | 
| 139 | 
            +
                    #   #   Attribute not translated
         | 
| 140 | 
            +
                    #   human_name_for :account, :name
         | 
| 141 | 
            +
                    #   human_name_for :account, :surname
         | 
| 142 | 
            +
                    #   human_name_for :account, :role
         | 
| 143 | 
            +
                    #   human_name_for :account, :attribute_not_translated
         | 
| 144 | 
            +
                    # 
         | 
| 145 | 
            +
                    def human_name_for(instance, method)
         | 
| 146 | 
            +
                      I18n.t("activerecord.attributes.#{instance}.#{method}", :default => method.to_s.humanize)
         | 
| 147 | 
            +
                    end
         | 
| 148 | 
            +
                    
         | 
| 38 149 | 
             
                    # Store the location to come back from for example an extjs grid
         | 
| 39 150 | 
             
                    def back_to(location)
         | 
| 40 151 | 
             
                      content_tag(:script, "Backend.app.backTo(#{url_for(location)})", :type => Mime::JS)
         | 
| @@ -43,7 +154,7 @@ module Lipsiadmin | |
| 43 154 | 
             
                    # Generate the menu from the Lispiadmin::AccessControl
         | 
| 44 155 | 
             
                    def backend_menu
         | 
| 45 156 | 
             
                      config = current_account.maps.collect(&:project_modules)[0].collect(&:config)
         | 
| 46 | 
            -
                      config << { :text => " | 
| 157 | 
            +
                      config << { :text => I18n.t("backend.menus.help", :default => "Help"), :handler => "function() { Backend.app.openHelp() }".to_l }
         | 
| 47 158 | 
             
                      return config.to_json
         | 
| 48 159 | 
             
                    end
         | 
| 49 160 |  | 
| @@ -1,14 +1,23 @@ | |
| 1 1 | 
             
            # If you translate this other language or have something to fix please send me an email at: d.dagostino@lipsiasoft.com
         | 
| 2 2 | 
             
            en:
         | 
| 3 3 | 
             
              backend:
         | 
| 4 | 
            +
                tabs:
         | 
| 5 | 
            +
                  general: "General"
         | 
| 6 | 
            +
                titles:
         | 
| 7 | 
            +
                  welcome: "Welcome"
         | 
| 4 8 | 
             
                general:
         | 
| 9 | 
            +
                  list: "List {{model}}"
         | 
| 5 10 | 
             
                  editForm: "Edit {{model}} {{value}}"
         | 
| 6 11 | 
             
                  newForm: "New {{model}}"
         | 
| 7 12 | 
             
                  cantDelete: "You cannot delete this record."
         | 
| 8 13 | 
             
                sessions:
         | 
| 9 14 | 
             
                  wrong: "Wrong email or password"
         | 
| 10 15 | 
             
                  logout: "Correctly Logged Out"
         | 
| 11 | 
            -
             | 
| 16 | 
            +
                menus:
         | 
| 17 | 
            +
                  account: "Account"
         | 
| 18 | 
            +
                  list: "List"
         | 
| 19 | 
            +
                  new: "New"
         | 
| 20 | 
            +
                  help: "Help"
         | 
| 12 21 | 
             
                javascripts:
         | 
| 13 22 | 
             
                  buttons:
         | 
| 14 23 | 
             
                    add: "Add"
         | 
| @@ -1,13 +1,22 @@ | |
| 1 1 | 
             
            it:
         | 
| 2 2 | 
             
              backend:
         | 
| 3 | 
            +
                tabs:
         | 
| 4 | 
            +
                  general: "Generale"
         | 
| 5 | 
            +
                titles:  
         | 
| 6 | 
            +
                  welcome: "Benvenuto"
         | 
| 3 7 | 
             
                general:
         | 
| 8 | 
            +
                  list: "Elenco {{model}}"
         | 
| 4 9 | 
             
                  editForm: "Modifica {{model}} {{value}}"
         | 
| 5 | 
            -
                  newForm: " | 
| 10 | 
            +
                  newForm: "Nuovo {{model}}"
         | 
| 6 11 | 
             
                  cantDelete: "Non puoi cancellare questo record."
         | 
| 7 12 | 
             
                sessions:
         | 
| 8 13 | 
             
                  wrong: "Email o password sbagliati"
         | 
| 9 14 | 
             
                  logout: "Sei correttamente uscito dal sistema"
         | 
| 10 | 
            -
             | 
| 15 | 
            +
                menus:
         | 
| 16 | 
            +
                  help: "Aiuto"
         | 
| 17 | 
            +
                  account: "Account"
         | 
| 18 | 
            +
                  list: "Elenco"
         | 
| 19 | 
            +
                  new: "Nuovo"
         | 
| 11 20 | 
             
                javascripts:
         | 
| 12 21 | 
             
                  buttons:
         | 
| 13 22 | 
             
                    add: "Aggiungi"
         | 
| @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            # Questo file è utizzato per tradurre il nome dei modell/tabelle e dei suoi attributi/colonne
         | 
| 2 2 | 
             
            it:
         | 
| 3 3 | 
             
              activerecord:
         | 
| 4 | 
            -
                 | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
                   | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 4 | 
            +
                models:
         | 
| 5 | 
            +
                  account: Account
         | 
| 6 | 
            +
                attributes:
         | 
| 7 | 
            +
                  account:
         | 
| 8 | 
            +
                    name: Nome
         | 
| 9 | 
            +
                    surname: Cognome
         | 
| 10 | 
            +
                    created_at: Creato Il
         | 
| 11 | 
            +
                    updated_at: Aggiornato Il
         | 
| 12 | 
            +
                    role: Gruppo
         | 
| 13 | 
            +
                    password_confirmation: Conferma Password
         | 
| 14 | 
            +
                    created_at: Creato il
         | 
| 15 | 
            +
                    updated_at: Aggiornato il  
         | 
| @@ -2,11 +2,11 @@ class Backend::AccountsController < BackendController | |
| 2 2 | 
             
              def index
         | 
| 3 3 | 
             
                params[:limit] ||= 50
         | 
| 4 4 | 
             
                @column_store = column_store_for Account do |cm|
         | 
| 5 | 
            -
                  cm.add :name | 
| 6 | 
            -
                  cm.add :surname | 
| 7 | 
            -
                  cm.add :email | 
| 8 | 
            -
                  cm.add :created_at, | 
| 9 | 
            -
                  cm.add :updated_at, | 
| 5 | 
            +
                  cm.add :name
         | 
| 6 | 
            +
                  cm.add :surname
         | 
| 7 | 
            +
                  cm.add :email
         | 
| 8 | 
            +
                  cm.add :created_at, :renderer => :datetime, :align => :right
         | 
| 9 | 
            +
                  cm.add :updated_at, :renderer => :datetime, :align => :right
         | 
| 10 10 | 
             
                end
         | 
| 11 11 |  | 
| 12 12 | 
             
                respond_to do |format|
         | 
| @@ -2,9 +2,22 @@ class AccountAccess < Lipsiadmin::AccessControl::Base | |
| 2 2 |  | 
| 3 3 | 
             
              roles_for :administrator do |role|
         | 
| 4 4 | 
             
                # Shared Permission
         | 
| 5 | 
            +
                role.allow_all_actions "/backend"
         | 
| 5 6 | 
             
                role.allow_all_actions "/backend/base"
         | 
| 6 7 |  | 
| 7 | 
            -
                 | 
| 8 | 
            +
                # Remember that it will try to translate the menu in your current
         | 
| 9 | 
            +
                # locale
         | 
| 10 | 
            +
                # 
         | 
| 11 | 
            +
                #   # Look for: I18n.t("backend.menus.account") in /config/locales/backend/yourlocale.yml
         | 
| 12 | 
            +
                #   project_module :account
         | 
| 13 | 
            +
                #   # Look for: I18n.t("backend.menus.list") in /config/locales/backend/yourlocale.yml
         | 
| 14 | 
            +
                #   project.menu :list
         | 
| 15 | 
            +
                # 
         | 
| 16 | 
            +
                # It not necessary have a translation you can provide a classic strings like:
         | 
| 17 | 
            +
                # 
         | 
| 18 | 
            +
                #   role.project_module "My Menu Name"
         | 
| 19 | 
            +
                # 
         | 
| 20 | 
            +
                role.project_module :account do |project|
         | 
| 8 21 | 
             
                  project.menu :list,   "/backend/accounts.js" do |submenu|
         | 
| 9 22 | 
             
                    submenu.add :new, "/backend/accounts/new"
         | 
| 10 23 | 
             
                  end
         | 
| @@ -1,21 +1,21 @@ | |
| 1 1 | 
             
            =simple_error_messages_for :account
         | 
| 2 | 
            -
            -tab  | 
| 2 | 
            +
            -tab :general do
         | 
| 3 3 | 
             
              %table
         | 
| 4 4 | 
             
                %tr
         | 
| 5 | 
            -
                  %td  | 
| 5 | 
            +
                  %td=human_name_for :account, :name
         | 
| 6 6 | 
             
                  %td=text_field :account, :name
         | 
| 7 7 | 
             
                %tr
         | 
| 8 | 
            -
                  %td  | 
| 8 | 
            +
                  %td=human_name_for :account, :surname
         | 
| 9 9 | 
             
                  %td=text_field :account, :surname
         | 
| 10 10 | 
             
                %tr
         | 
| 11 | 
            -
                  %td  | 
| 11 | 
            +
                  %td=human_name_for :account, :email
         | 
| 12 12 | 
             
                  %td=text_field :account, :email
         | 
| 13 13 | 
             
                %tr
         | 
| 14 | 
            -
                  %td  | 
| 14 | 
            +
                  %td=human_name_for :account, :password
         | 
| 15 15 | 
             
                  %td=password_field :account, :password
         | 
| 16 16 | 
             
                %tr
         | 
| 17 | 
            -
                  %td  | 
| 17 | 
            +
                  %td=human_name_for :account, :password_confirmation
         | 
| 18 18 | 
             
                  %td=password_field :account, :password_confirmation
         | 
| 19 19 | 
             
                %tr
         | 
| 20 | 
            -
                  %td  | 
| 20 | 
            +
                  %td=human_name_for :account, :role
         | 
| 21 21 | 
             
                  %td=select :account, :role, AccountAccess.roles
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            page.grid do |grid|
         | 
| 2 2 | 
             
              grid.id "grid-accounts"
         | 
| 3 | 
            -
              grid.title  | 
| 3 | 
            +
              grid.title list_title_for(Account)
         | 
| 4 4 | 
             
              grid.base_path "/backend/accounts"
         | 
| 5 5 | 
             
              grid.forgery_protection_token request_forgery_protection_token
         | 
| 6 6 | 
             
              grid.authenticity_token form_authenticity_token
         | 
| @@ -9,6 +9,7 @@ page.grid do |grid| | |
| 9 9 | 
             
                store.url "/backend/accounts.json"
         | 
| 10 10 | 
             
                store.fields @column_store.store_fields
         | 
| 11 11 | 
             
              end
         | 
| 12 | 
            +
              grid.before << "groupingStore.setDefaultSort('accounts.created_at', 'DESC');"
         | 
| 12 13 | 
             
              grid.columns do |columns|
         | 
| 13 14 | 
             
                columns.fields @column_store.column_fields
         | 
| 14 15 | 
             
              end
         | 
| @@ -5,7 +5,7 @@ class Backend::<%= controller_class_name %>Controller < BackendController | |
| 5 5 |  | 
| 6 6 | 
             
                @column_store = column_store_for <%= model_name %> do |cm|
         | 
| 7 7 | 
             
                  <%- model_instance.class.content_columns.collect do |column| -%>
         | 
| 8 | 
            -
                  cm.add :<%= column.name.downcase  | 
| 8 | 
            +
                  cm.add :<%= column.name.downcase %><% if column.type == :date %>, :renderer => :date <% elsif column.type == :datetime %>, :renderer => :datetime <% end %>
         | 
| 9 9 | 
             
                  <%- end -%>
         | 
| 10 10 | 
             
                end
         | 
| 11 11 |  | 
| @@ -1,3 +1,3 @@ | |
| 1 | 
            -
            = | 
| 1 | 
            +
            =edit_title_for(<%= model_instance.class.name %>, <%= "@"+singular_name+".id" %>)
         | 
| 2 2 | 
             
            -form_tag({:action => :update, :id => @<%= singular_name %>}, :method => :put) do
         | 
| 3 3 | 
             
              =render :partial => "form"
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            page.grid do |grid|
         | 
| 2 2 | 
             
              grid.id "grid-<%= plural_name %>"
         | 
| 3 | 
            -
              grid.title  | 
| 3 | 
            +
              grid.title list_title_for(<%= model_instance.class.name %>)
         | 
| 4 4 | 
             
              grid.base_path "/backend/<%= plural_name %>"
         | 
| 5 5 | 
             
              grid.forgery_protection_token request_forgery_protection_token
         | 
| 6 6 | 
             
              grid.authenticity_token form_authenticity_token
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: lipsiadmin
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 4. | 
| 4 | 
            +
              version: 4.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Davide D'Agostino
         | 
| @@ -9,7 +9,7 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date: 2009-05- | 
| 12 | 
            +
            date: 2009-05-15 00:00:00 +02:00
         | 
| 13 13 | 
             
            default_executable: 
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         |