Changeset 378

Show
Ignore:
Timestamp:
01/05/07 16:49:40 (2 years ago)
Author:
jarmo
Message:
  • Removes translations from the class scope. Closes #208.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/controllers/action_key_controller.rb

    r293 r378  
    1313  layout 'mainlevel' 
    1414 
    15   @@create_or_edit_fields = [ 
    16                               [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
    17                               [_('Information'), :text_field, 'info', { :size => 40, :maxlength => 80 } ] 
    18                             ] 
    19  
    2015  def list 
    2116    @help = 'general' 
     
    2924    @help = 'general' 
    3025    @title = _('Create a new key') 
    31     @fields = @@create_or_edit_fields 
     26    @fields = [ 
     27                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     28                [_('Information'), :text_field, 'info', { :size => 40, :maxlength => 80 } ] 
     29              ] 
    3230    common_create(ActionKey, 'name', {:action => 'list'}, {:action => 'list'}) 
    3331  end 
     
    3634    @help = 'general' 
    3735    @title = _('Edit key') 
    38     @fields = @@create_or_edit_fields 
     36    @fields = [ 
     37                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     38                [_('Information'), :text_field, 'info', { :size => 40, :maxlength => 80 } ] 
     39              ] 
    3940    common_edit(ActionKey, 'name', {:action => 'list'}, {:action => 'list'}) 
    4041  end 
  • trunk/app/controllers/asset_field_controller.rb

    r293 r378  
    1111class AssetFieldController < ApplicationController 
    1212  append_before_filter :login_required 
    13  
    14   # Common part of form fields 
    15   @@form_fields = [ 
    16                    [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
    17                    [_('Type')], 
    18                    [_('User field in report template'), :text_field_with_prefix, 'user_field_name', { :size => 17, :maxlength => 17, :prefix => 'cmms_asset_' } ] 
    19                   ] 
    2013 
    2114  def list 
     
    4639    @asset_type = AssetType.find(params[:id], :readonly => true) 
    4740    @hide_subaction_links = true 
    48     fields = @@form_fields.dup 
     41 
     42    fields =  [ 
     43               [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     44               [_('Type')], 
     45               [_('User field in report template'), :text_field_with_prefix, 'user_field_name', { :size => 17, :maxlength => 17, :prefix => 'cmms_asset_' } ] 
     46              ] 
    4947    fields[1][1..-1] = [:select, 'type_code', [ 
    5048                                               [_('String'), AssetField::STRING], 
     
    6462    @asset_type = AssetType.find(params[:asset_type_id], :readonly => true) 
    6563    @hide_subaction_links = true 
    66     fields = @@form_fields.dup 
     64    fields =  [ 
     65               [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     66               [_('Type')], 
     67               [_('User field in report template'), :text_field_with_prefix, 'user_field_name', { :size => 17, :maxlength => 17, :prefix => 'cmms_asset_' } ] 
     68              ] 
    6769    fields[1][1..-1] = [:text, 'type_code_as_text'] 
    6870    @fields = fields 
  • trunk/app/controllers/asset_type_controller.rb

    r337 r378  
    1111class AssetTypeController < ApplicationController 
    1212  prepend_before_filter :login_required 
    13   @@create_or_edit_fields = [ 
    14                               [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
    15                               [_('Icon'), :select_asset_type_icon, 'asset_type_icon_id'], 
    16                              [_('Typical maintenance time interval'), :input_field_with_enable_check_box, :select_time_interval, 'typical_maintenance_time_interval', {}, 'typical_maintenance_time_interval_enabled', 1, {:onclick => 'update_time_interval_field("typical_maintenance_time_interval")'}], 
    17                               [_('Description'), :markup_text_area, 'description', { :cols => 100, :rows => 20 }] 
    18                             ] 
    1913 
    2014  def list 
     
    5044    @help = 'general' 
    5145    @title = _('Create a new asset type') 
    52     @fields = @@create_or_edit_fields 
     46    @fields = [ 
     47                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     48                [_('Icon'), :select_asset_type_icon, 'asset_type_icon_id'], 
     49               [_('Typical maintenance time interval'), :input_field_with_enable_check_box, :select_time_interval, 'typical_maintenance_time_interval', {}, 'typical_maintenance_time_interval_enabled', 1, {:onclick => 'update_time_interval_field("typical_maintenance_time_interval")'}], 
     50                [_('Description'), :markup_text_area, 'description', { :cols => 100, :rows => 20 }] 
     51              ] 
    5352    params[:model][:set_typical_maintenance_time_interval] = nil if request.post? and params[:typical_maintenance_time_interval_enabled] != '1' 
    5453    common_create(AssetType, 'name', {:action => 'list'}, {:action => 'list'}, 'asset_type/create_or_edit') 
     
    5857    @help = 'general' 
    5958    @title = _('Edit asset type') 
    60     @fields = @@create_or_edit_fields 
     59    @fields = [ 
     60                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     61                [_('Icon'), :select_asset_type_icon, 'asset_type_icon_id'], 
     62               [_('Typical maintenance time interval'), :input_field_with_enable_check_box, :select_time_interval, 'typical_maintenance_time_interval', {}, 'typical_maintenance_time_interval_enabled', 1, {:onclick => 'update_time_interval_field("typical_maintenance_time_interval")'}], 
     63                [_('Description'), :markup_text_area, 'description', { :cols => 100, :rows => 20 }] 
     64              ] 
    6165    params[:model][:set_typical_maintenance_time_interval] = nil if request.post? and params[:typical_maintenance_time_interval_enabled] != '1' 
    6266    common_edit(AssetType, 'name', {:action => 'list'}, {:action => 'list'}, 'asset_type/create_or_edit') 
  • trunk/app/controllers/keyring_controller.rb

    r293 r378  
    1111class KeyringController < ApplicationController 
    1212  prepend_before_filter :login_required 
    13  
    14   # Variable: action_key_update_notice 
    15   # ================================== 
    16   # Common notice which is appended to all flash[:notice]s when 
    17   # updating action_keys. 
    18   @@action_key_update_notice = _('Keys and keyrings are updated when user logins the next time.') 
    19  
    20   # Variable: create_or_edit_fields 
    21   # =============================== 
    22   # Fields for create and edit actions 
    23   @@create_or_edit_fields = [ 
    24                               [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
    25                               [_('Information'), :text_field, 'info', { :size => 40, :maxlength => 80 } ] 
    26                             ] 
    2713 
    2814  def list 
     
    4531    @help = 'general' 
    4632    @title = _('Create a new keyring') 
    47     @fields = @@create_or_edit_fields 
     33    @fields = [ 
     34                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     35                [_('Information'), :text_field, 'info', { :size => 40, :maxlength => 80 } ] 
     36              ] 
    4837    common_create(Keyring, 'name', {:action => 'list'}, {:action => 'list'}) 
    4938  end 
     
    5241    @help = 'general' 
    5342    @title = _('Edit keyring') 
    54     @fields = @@create_or_edit_fields 
     43    @fields = [ 
     44                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     45                [_('Information'), :text_field, 'info', { :size => 40, :maxlength => 80 } ] 
     46              ] 
    5547    common_edit(Keyring, 'name', {:action => 'list'}, {:action => 'list'}) 
    5648  end 
     
    9385 
    9486    info "Key #{action_key.name} added to keyring #{keyring.name}" 
    95     flash[:notice] = [_('Key %s added to keyring %s.', action_key.name, keyring.name), @@action_key_update_notice] 
     87    flash[:notice] = [_('Key %s added to keyring %s.', action_key.name, keyring.name), action_key_update_notice] 
    9688  end 
    9789 
     
    10799    keyring.action_keys.delete(action_keys_to_revoke) 
    108100 
    109     flash[:notice] = [_('%d keys removed.', action_keys_to_revoke.size), @@action_key_update_notice] 
     101    flash[:notice] = [_('%d keys removed.', action_keys_to_revoke.size), action_key_update_notice] 
    110102  end 
    111103 
     
    135127 
    136128    info "Keyring #{keyring.name} given to user #{user.login}" 
    137     flash[:notice] = [_('Keyring %s given to user %s.', keyring.name, user.login_and_name), @@action_key_update_notice] 
     129    flash[:notice] = [_('Keyring %s given to user %s.', keyring.name, user.login_and_name), action_key_update_notice] 
    138130  end 
    139131 
     
    149141    keyring.users.delete(users_to_remove) 
    150142 
    151     flash[:notice] = [_('Keyring %s removed from %d users.', keyring.name, users_to_remove.size), @@action_key_update_notice] 
     143    flash[:notice] = [_('Keyring %s removed from %d users.', keyring.name, users_to_remove.size), action_key_update_notice] 
     144  end 
     145 
     146  protected 
     147 
     148  def action_key_update_notice 
     149    return _('Keys and keyrings are updated when user logins the next time.') 
    152150  end 
    153151end 
  • trunk/app/controllers/report_category_controller.rb

    r293 r378  
    1111class ReportCategoryController < ApplicationController 
    1212  prepend_before_filter :login_required 
    13  
    14   # Fields for create and edit actions 
    15   @@create_or_edit_fields = [ 
    16                               [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 }], 
    17                               [_('Tag'), :select, 'report_tag_id', ReportTag.find(:all, :order => 'name').map {|tag| [tag.full_name, tag.id] }, { :include_blank => true } ], 
    18                               [_('Parent'), :select, 'parent_id' ] 
    19                             ] 
    2013 
    2114  def list 
     
    3427    @help = 'general' 
    3528    @title = _('Create a new report category') 
     29    @fields = [ 
     30                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 }], 
     31                [_('Tag'), :select, 'report_tag_id', ReportTag.find(:all, :order => 'name').map {|tag| [tag.full_name, tag.id] }, { :include_blank => true } ], 
     32                [_('Parent'), :select, 'parent_id' ] 
     33              ] 
    3634    update_possible_parents() 
    37     @fields = @@create_or_edit_fields 
    3835    common_create(ReportCategory, 'name', {:action => 'list'}, {:action => 'list'}) 
    3936  end 
     
    4340    @title = _('Edit report category') 
    4441    @report_category = ReportCategory.find params[:id] 
     42    @fields = [ 
     43                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 }], 
     44                [_('Tag'), :select, 'report_tag_id', ReportTag.find(:all, :order => 'name').map {|tag| [tag.full_name, tag.id] }, { :include_blank => true } ], 
     45                [_('Parent'), :select, 'parent_id' ] 
     46              ] 
    4547    update_possible_parents(@report_category) 
    46     @fields = @@create_or_edit_fields 
    4748    common_edit(ReportCategory, 'name', {:action => 'list'}, {:action => 'list'}) 
    4849  end 
     
    8182    end 
    8283    # Options for parent select 
    83     @@create_or_edit_fields.last[3] = possible_parents 
     84    @fields.last[3] = possible_parents 
    8485  end 
    8586end 
  • trunk/app/controllers/user_group_controller.rb

    r293 r378  
    1111class UserGroupController < ApplicationController 
    1212  prepend_before_filter :login_required 
    13  
    14   # Variable: create_or_edit_fields 
    15   # =============================== 
    16   # 
    17   # Fields for create and edit actions 
    18   @@create_or_edit_fields = [ 
    19                               [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
    20                               [_('Information'), :text_field, 'information', { :size => 40, :maxlength => 80 } ] 
    21                             ] 
    2213 
    2314  # Function: list 
     
    4738    @help = 'general' 
    4839    @title = _('Create user group') 
    49     @fields = @@create_or_edit_fields 
     40    @fields = [ 
     41                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     42                [_('Information'), :text_field, 'information', { :size => 40, :maxlength => 80 } ] 
     43              ] 
    5044    common_create(UserGroup, 'name', {:action => 'list'}, {:action => 'list'}) 
    5145  end 
     
    5852    @help = 'general' 
    5953    @title = _('Edit user group') 
    60     @fields = @@create_or_edit_fields 
     54    @fields = [ 
     55                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     56                [_('Information'), :text_field, 'information', { :size => 40, :maxlength => 80 } ] 
     57              ] 
    6158    common_edit(UserGroup, 'name', {:action => 'list'}, {:action => 'list'}) 
    6259  end 
  • trunk/app/controllers/work_order_type_controller.rb

    r293 r378  
    1414 
    1515  # Fields for create and edit actions 
    16   @@create_or_edit_fields = [ 
    17                               [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
    18                               [_('Tag'), :select, 'work_order_tag_id', WorkOrderTag.find(:all, :order => 'name').map {|tag| [tag.full_name, tag.id] }, { :include_blank => true } ], 
    19                               [_('Description'), :text_field, 'description', { :size => 40, :maxlength => 80 } ] 
    20                             ] 
    2116 
    2217  # Displays the work_order type listing 
     
    3631    @help = 'general' 
    3732    @title = _('New work order type') 
    38     @fields = @@create_or_edit_fields 
     33    @fields = [ 
     34                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     35                [_('Tag'), :select, 'work_order_tag_id', WorkOrderTag.find(:all, :order => 'name').map {|tag| [tag.full_name, tag.id] }, { :include_blank => true } ], 
     36                [_('Description'), :text_field, 'description', { :size => 40, :maxlength => 80 } ] 
     37              ] 
    3938    common_create(WorkOrderType, 'name', {:action => 'list'}, {:action => 'list'}) 
    4039  end 
     
    5251    @help = 'general' 
    5352    @title = _('Edit work order type') 
    54     @fields = @@create_or_edit_fields 
     53    @fields = [ 
     54                [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ], 
     55                [_('Tag'), :select, 'work_order_tag_id', WorkOrderTag.find(:all, :order => 'name').map {|tag| [tag.full_name, tag.id] }, { :include_blank => true } ], 
     56                [_('Description'), :text_field, 'description', { :size => 40, :maxlength => 80 } ] 
     57              ] 
    5558    common_edit(WorkOrderType, 'name', {:action => 'list'}, {:action => 'list'}) 
    5659  end 

© 2004-2007 Norfello Oy All Rights Reserved