Changeset 379
- Timestamp:
- 01/05/07 17:13:36 (2 years ago)
- Files:
-
- branches/1.2-alpha/app/controllers/action_key_controller.rb (modified) (3 diffs)
- branches/1.2-alpha/app/controllers/asset_field_controller.rb (modified) (3 diffs)
- branches/1.2-alpha/app/controllers/asset_type_controller.rb (modified) (3 diffs)
- branches/1.2-alpha/app/controllers/keyring_controller.rb (modified) (7 diffs)
- branches/1.2-alpha/app/controllers/report_category_controller.rb (modified) (4 diffs)
- branches/1.2-alpha/app/controllers/user_group_controller.rb (modified) (3 diffs)
- branches/1.2-alpha/app/controllers/work_order_type_controller.rb (modified) (3 diffs)
- branches/1.2-alpha/app/models/report_field_value.rb (modified) (1 diff)
- branches/1.2-alpha/db/alpha_migrations/from_1.2.0-alpha7_to_1.2.0-alpha8.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.2-alpha/app/controllers/action_key_controller.rb
r299 r379 13 13 layout 'mainlevel' 14 14 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 20 15 def list 21 16 @help = 'general' … … 29 24 @help = 'general' 30 25 @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 ] 32 30 common_create(ActionKey, 'name', {:action => 'list'}, {:action => 'list'}) 33 31 end … … 36 34 @help = 'general' 37 35 @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 ] 39 40 common_edit(ActionKey, 'name', {:action => 'list'}, {:action => 'list'}) 40 41 end branches/1.2-alpha/app/controllers/asset_field_controller.rb
r299 r379 11 11 class AssetFieldController < ApplicationController 12 12 append_before_filter :login_required 13 14 # Common part of form fields15 @@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 ]20 13 21 14 def list … … 46 39 @asset_type = AssetType.find(params[:id], :readonly => true) 47 40 @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 ] 49 47 fields[1][1..-1] = [:select, 'type_code', [ 50 48 [_('String'), AssetField::STRING], … … 64 62 @asset_type = AssetType.find(params[:asset_type_id], :readonly => true) 65 63 @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 ] 67 69 fields[1][1..-1] = [:text, 'type_code_as_text'] 68 70 @fields = fields branches/1.2-alpha/app/controllers/asset_type_controller.rb
r339 r379 11 11 class AssetTypeController < ApplicationController 12 12 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 ]19 13 20 14 def list … … 50 44 @help = 'general' 51 45 @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 ] 53 52 params[:model][:set_typical_maintenance_time_interval] = nil if request.post? and params[:typical_maintenance_time_interval_enabled] != '1' 54 53 common_create(AssetType, 'name', {:action => 'list'}, {:action => 'list'}, 'asset_type/create_or_edit') … … 58 57 @help = 'general' 59 58 @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 ] 61 65 params[:model][:set_typical_maintenance_time_interval] = nil if request.post? and params[:typical_maintenance_time_interval_enabled] != '1' 62 66 common_edit(AssetType, 'name', {:action => 'list'}, {:action => 'list'}, 'asset_type/create_or_edit') branches/1.2-alpha/app/controllers/keyring_controller.rb
r299 r379 11 11 class KeyringController < ApplicationController 12 12 prepend_before_filter :login_required 13 14 # Variable: action_key_update_notice15 # ==================================16 # Common notice which is appended to all flash[:notice]s when17 # 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_fields21 # ===============================22 # Fields for create and edit actions23 @@create_or_edit_fields = [24 [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ],25 [_('Information'), :text_field, 'info', { :size => 40, :maxlength => 80 } ]26 ]27 13 28 14 def list … … 45 31 @help = 'general' 46 32 @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 ] 48 37 common_create(Keyring, 'name', {:action => 'list'}, {:action => 'list'}) 49 38 end … … 52 41 @help = 'general' 53 42 @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 ] 55 47 common_edit(Keyring, 'name', {:action => 'list'}, {:action => 'list'}) 56 48 end … … 93 85 94 86 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] 96 88 end 97 89 … … 107 99 keyring.action_keys.delete(action_keys_to_revoke) 108 100 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] 110 102 end 111 103 … … 135 127 136 128 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] 138 130 end 139 131 … … 149 141 keyring.users.delete(users_to_remove) 150 142 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.') 152 150 end 153 151 end branches/1.2-alpha/app/controllers/report_category_controller.rb
r299 r379 11 11 class ReportCategoryController < ApplicationController 12 12 prepend_before_filter :login_required 13 14 # Fields for create and edit actions15 @@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 ]20 13 21 14 def list … … 34 27 @help = 'general' 35 28 @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 ] 36 34 update_possible_parents() 37 @fields = @@create_or_edit_fields38 35 common_create(ReportCategory, 'name', {:action => 'list'}, {:action => 'list'}) 39 36 end … … 43 40 @title = _('Edit report category') 44 41 @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 ] 45 47 update_possible_parents(@report_category) 46 @fields = @@create_or_edit_fields47 48 common_edit(ReportCategory, 'name', {:action => 'list'}, {:action => 'list'}) 48 49 end … … 81 82 end 82 83 # Options for parent select 83 @ @create_or_edit_fields.last[3] = possible_parents84 @fields.last[3] = possible_parents 84 85 end 85 86 end branches/1.2-alpha/app/controllers/user_group_controller.rb
r299 r379 11 11 class UserGroupController < ApplicationController 12 12 prepend_before_filter :login_required 13 14 # Variable: create_or_edit_fields15 # ===============================16 #17 # Fields for create and edit actions18 @@create_or_edit_fields = [19 [_('Name'), :text_field, 'name', { :size => 40, :maxlength => 40 } ],20 [_('Information'), :text_field, 'information', { :size => 40, :maxlength => 80 } ]21 ]22 13 23 14 # Function: list … … 47 38 @help = 'general' 48 39 @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 ] 50 44 common_create(UserGroup, 'name', {:action => 'list'}, {:action => 'list'}) 51 45 end … … 58 52 @help = 'general' 59 53 @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 ] 61 58 common_edit(UserGroup, 'name', {:action => 'list'}, {:action => 'list'}) 62 59 end branches/1.2-alpha/app/controllers/work_order_type_controller.rb
r299 r379 14 14 15 15 # 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 ]21 16 22 17 # Displays the work_order type listing … … 36 31 @help = 'general' 37 32 @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 ] 39 38 common_create(WorkOrderType, 'name', {:action => 'list'}, {:action => 'list'}) 40 39 end … … 52 51 @help = 'general' 53 52 @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 ] 55 58 common_edit(WorkOrderType, 'name', {:action => 'list'}, {:action => 'list'}) 56 59 end branches/1.2-alpha/app/models/report_field_value.rb
r375 r379 18 18 def error_messages 19 19 result = [] 20 self.errors.each { |attribute, message| 21 result.push(message.gsub('%{fn}', self.report_field.name)) 20 self.errors.each { |attribute, message| 21 bindtextdomain('rails') 22 result.push(_(message).gsub('%{fn}', self.report_field.name)) 22 23 } 23 24 return result