This commit is contained in:
2015-10-04 11:54:25 +02:00
parent 20bc21f87f
commit e7cd77c675
15 changed files with 43 additions and 20 deletions
@@ -0,0 +1,11 @@
App.PageBodyComponent = Ember.Component.extend
setTemplate: (->
body = @get('templateBody')
body ||= ""
try
template = Ember.HTMLBars.compile(body)
catch
template = Ember.HTMLBars.compile(tspan('page.cannot_compile'))
@set 'template', Ember.HTMLBars.template(template)
@rerender()
).on('init').observes('templateBody')
@@ -1,6 +1,7 @@
attr = DS.attr
App.Supplier = DS.Model.extend
name: attr 'string'
user_message: attr 'string'
email: attr 'string'
time_zone: attr 'string'
address: attr 'string'
@@ -2,6 +2,9 @@
.form-row
.form-label: label=t 'attributes.supplier.name'
.form-field= input type="text" value=globals.current_supplier.name class="supplier-name"
.form-row
.form-label: label=t 'attributes.supplier.user_message'
.form-field= textarea value=globals.current_supplier.user_message class="supplier-user-message"
.form-row
.form-label: label=t 'attributes.supplier.email'
.form-field= input value=globals.current_supplier.email type="email" class="supplier-email"
@@ -1,11 +0,0 @@
#App.PageBodyView = Ember.View.extend
# setTemplate: (->
# body = @get('templateBody')
# body ||= ""
# try
# template = Ember.Handlebars.compile(body)
# catch
# template = Ember.Handlebars.compile(tspan('page.cannot_compile'))
# @set 'template', template
# @rerender()
# ).on('init').observes('templateBody')
@@ -22,6 +22,7 @@ var Qstorage = localStorage;
$.extend($translations.en, <%= I18n.t('supplier', locale: :en).to_json %>);
$.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>);
String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); }
window.time_zones = <%= ActiveSupport::TimeZone.all.map{|tz| {name: tz.name, formatted: "GMT#{tz.formatted_offset} #{tz.name}"}}.to_json.html_safe %>;
@@ -21,6 +21,7 @@
@ttry = (path, vars={})->
@t(path, $.extend(vars, emptyWhenNotFound: true))
# return translation in the form
# <span data-t="models.table">Tafel</span>
@tspan = (path, vars={}) -> "<span data-t='#{path}' class='translation' data-t-attributes='#{JSON.stringify(vars)}'>#{t(path, vars)}</span>"