diff --git a/app/assets/javascripts/app/index.js.coffee b/app/assets/javascripts/app/index.js.coffee
index 98dce1d1e..5cb31e6a4 100644
--- a/app/assets/javascripts/app/index.js.coffee
+++ b/app/assets/javascripts/app/index.js.coffee
@@ -83,8 +83,9 @@ class App extends Spine.Controller
isHtmlEscape = false
if attribute_config.tag is 'textarea'
isHtmlEscape = true
- result = App.Utils.text2html( result )
+ result = App.Utils.text2html( result )
+ # remember, html snippets are already escaped
else if attribute_config.tag is 'richtext'
isHtmlEscape = true
@@ -94,22 +95,20 @@ class App extends Spine.Controller
result = attribute_config.options[result]
# translate content
- isTranslated = false
if attribute_config.translate || ( isObject && item.translate && item.translate() )
- isTranslated = true
isHtmlEscape = true
- result = App.i18n.translateContent( result )
+ result = App.i18n.translateContent( result )
# transform date
if attribute_config.tag is 'date'
isHtmlEscape = true
- result = App.i18n.translateDate(result)
+ result = App.i18n.translateDate(result)
# use pretty time for datetime
else if attribute_config.tag is 'datetime'
isHtmlEscape = true
- result = "?"
- #result = App.i18n.translateTimestamp(result)
+ result = "?"
+ #result = App.i18n.translateTimestamp(result)
if !isHtmlEscape && typeof result is 'string'
result = App.Utils.htmlEscape(result)
diff --git a/app/models/object_manager.rb b/app/models/object_manager.rb
index ad53aaed7..74c287529 100644
--- a/app/models/object_manager.rb
+++ b/app/models/object_manager.rb
@@ -65,7 +65,7 @@ list of all attributes
=begin
-add a new activity entry for an object
+add a new attribute entry for an object
ObjectManager::Attribute.add(
:object => 'Ticket',
@@ -101,7 +101,6 @@ add a new activity entry for an object
:updated_at => '2014-06-04 10:00:00',
)
-
=end
def self.add(data)
@@ -114,8 +113,8 @@ add a new activity entry for an object
# check newest entry - is needed
result = ObjectManager::Attribute.where(
- :object_lookup_id => data[:object_lookup_id],
- :name => data[:name],
+ :object_lookup_id => data[:object_lookup_id],
+ :name => data[:name],
).first
if result
# raise "ERROR: attribute #{data[:name]} for #{data[:object]} already exists"
@@ -129,6 +128,30 @@ add a new activity entry for an object
=begin
+get the attribute model based on object and name
+
+ attribute = ObjectManager::Attribute.get(
+ :object => 'Ticket',
+ :name => 'group_id',
+ )
+
+=end
+
+ def self.get(data)
+
+ # lookups
+ if data[:object]
+ data[:object_lookup_id] = ObjectLookup.by_name( data[:object] )
+ end
+
+ ObjectManager::Attribute.where(
+ :object_lookup_id => data[:object_lookup_id],
+ :name => data[:name],
+ ).first
+ end
+
+=begin
+
get user based list of object attributes
attribute_list = ObjectManager::Attribute.by_object('Ticket', user)
diff --git a/db/migrate/20150206000002_create_address.rb b/db/migrate/20150206000002_create_address.rb
new file mode 100644
index 000000000..3cdabbd18
--- /dev/null
+++ b/db/migrate/20150206000002_create_address.rb
@@ -0,0 +1,70 @@
+class CreateAddress < ActiveRecord::Migration
+ def up
+ add_column :users, :address, :string, :limit => 500, :null => true
+
+ User.all.each {|user|
+ address = ''
+ if user.street && !user.street.empty?
+ address += "#{user.street}\n"
+ end
+ if user.zip && !user.zip.empty?
+ address += "#{user.zip} "
+ end
+ if user.city && !user.city.empty?
+ address += "#{user.city}"
+ end
+ if !address.empty?
+ user.address = address
+ user.save
+ end
+ }
+
+ ['street', 'zip', 'city', 'department'].each {|attribute_name|
+ attribute = ObjectManager::Attribute.get(
+ :object => 'User',
+ :name => attribute_name,
+ )
+ if attribute
+ attribute.active = false
+ attribute.save
+ end
+ }
+
+ ObjectManager::Attribute.add(
+ :object => 'User',
+ :name => 'address',
+ :display => 'Address',
+ :data_type => 'textarea',
+ :data_option => {
+ :type => 'text',
+ :maxlength => 500,
+ :null => true,
+ :item_class => 'formGroup--halfSize',
+ },
+ :editable => false,
+ :active => true,
+ :screens => {
+ :signup => {},
+ :invite_agent => {},
+ :edit => {
+ '-all-' => {
+ :null => true,
+ },
+ },
+ :view => {
+ '-all-' => {
+ :shown => true,
+ },
+ },
+ },
+ :pending_migration => false,
+ :position => 1350,
+ :created_by_id => 1,
+ :updated_by_id => 1,
+ )
+
+ end
+
+ def down
+ end
+end