FIX: Discourse.Model was removed. Use EmberObject instead (#10)
This commit is contained in:
		
							parent
							
								
									3d9fe5fdce
								
							
						
					
					
						commit
						7ba08ab7da
					
				|  | @ -1,11 +1,12 @@ | |||
| import { registerUnbound } from "discourse-common/lib/helpers"; | ||||
| import { autoUpdatingRelativeAge } from "discourse/lib/formatter"; | ||||
| import { htmlSafe } from "@ember/template"; | ||||
| 
 | ||||
| registerUnbound("format-unix-date", function(timestamp) { | ||||
|   if (timestamp) { | ||||
|     const date = new Date(moment.unix(timestamp).format()); | ||||
| 
 | ||||
|     return new Handlebars.SafeString( | ||||
|     return new htmlSafe( | ||||
|       autoUpdatingRelativeAge(date, { | ||||
|         format: "medium", | ||||
|         title: true, | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| import { ajax } from "discourse/lib/ajax"; | ||||
| import EmberObject from "@ember/object"; | ||||
| 
 | ||||
| const AdminProduct = Discourse.Model.extend({ | ||||
| const AdminProduct = EmberObject.extend({ | ||||
|   isNew: false, | ||||
|   metadata: {}, | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,8 @@ | |||
| import computed from "ember-addons/ember-computed-decorators"; | ||||
| import { ajax } from "discourse/lib/ajax"; | ||||
| import EmberObject from "@ember/object"; | ||||
| 
 | ||||
| const AdminSubscription = Discourse.Model.extend({ | ||||
| const AdminSubscription = EmberObject.extend({ | ||||
|   @computed("status") | ||||
|   canceled(status) { | ||||
|     return status === "canceled"; | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| import { ajax } from "discourse/lib/ajax"; | ||||
| import EmberObject from "@ember/object"; | ||||
| 
 | ||||
| const Customer = Discourse.Model.extend({ | ||||
| const Customer = EmberObject.extend({ | ||||
|   save() { | ||||
|     const data = { | ||||
|       source: this.source | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| import { ajax } from "discourse/lib/ajax"; | ||||
| import EmberObject from "@ember/object"; | ||||
| 
 | ||||
| const Group = Discourse.Model.extend({}); | ||||
| const Group = EmberObject.extend({}); | ||||
| 
 | ||||
| Group.reopenClass({ | ||||
|   subscriptionGroup: | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| import { ajax } from "discourse/lib/ajax"; | ||||
| import EmberObject from "@ember/object"; | ||||
| 
 | ||||
| const Invoice = Discourse.Model.extend({}); | ||||
| const Invoice = EmberObject.extend({}); | ||||
| 
 | ||||
| Invoice.reopenClass({ | ||||
|   findAll() { | ||||
|  |  | |||
|  | @ -1,7 +1,8 @@ | |||
| import computed from "ember-addons/ember-computed-decorators"; | ||||
| import { ajax } from "discourse/lib/ajax"; | ||||
| import EmberObject from "@ember/object"; | ||||
| 
 | ||||
| const Subscription = Discourse.Model.extend({ | ||||
| const Subscription = EmberObject.extend({ | ||||
|   @computed("status") | ||||
|   canceled(status) { | ||||
|     return status === "canceled"; | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ QUnit.test("subscriptionRate", assert => { | |||
| 
 | ||||
|   assert.equal( | ||||
|     plan.get("subscriptionRate"), | ||||
|     "$23.99 AUD / month", | ||||
|     "23.99 AUD / month", | ||||
|     "it returns the formatted subscription rate" | ||||
|   ); | ||||
| }); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue