#931 ✓resolved
Tim Griffin

filter-menu needs additional param 'model-name' (or context)

Reported by Tim Griffin | March 16th, 2011 @ 01:32 AM | in Hobo 1.3 (Rails 3)

The implementation of <filter-menu> in Hobo 1.3pre30 currently allows its options to be specified in the locale file as follows:

en:    
  tags:
    filter_menu:   
      state: 
        no_filter: All
        options:
        - [ "Draft", "draft" ]
        - [ "Submitted", "submitted" ]
        - [ "In Review", "in_review" ]
        - [ "Accepted", "accepted" ]
        - [ "Rejected", "rejected" ]
        - [ "Withdrawn", "withdrawn" ]
        - [ "Archived", "archived" ]

But as soon as another model exists that uses the param-name 'state', we're unable to specify its options because the <filter-menu> tag is hard-coded to pick up its keys as:

  <% opt = t("tags.filter_menu.#{param_name}.options", :default=>'')

This would be more useful if it instead used the model level of definition:

  <% opt = t("#{model_name}.filter_menu.#{param_name}.options", :default=>'')

so that filter-menu options in the locale file can be associated with their respective models:

instruments:
  filter_menu:
    status: 
      no_filter: All
      options:
      - [ "Unregistered", "unregistered" ]
      - [ "Registered", "registered" ]

packages:
  filter_menu:   
    state: 
      no_filter: All
      options:
      - [ "Draft", "draft" ]
      - [ "Submitted", "submitted" ]
      - [ "In Review", "in_review" ]
      - [ "Accepted", "accepted" ]
      - [ "Rejected", "rejected" ]
      - [ "Withdrawn", "withdrawn" ]
      - [ "Archived", "archived" ]

Perhaps there is some more magical way of referencing or inferring the model from the context in which the filter-menu is called; regardless, it needs to be more flexible between models.

Tim

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Referenced by

Pages