work in progress category UI

refactor hack from earlier
This commit is contained in:
Sam 2013-07-17 14:54:21 +10:00
parent 5a7e78f0fc
commit 625204c8bd
5 changed files with 18 additions and 19 deletions

View File

@ -10,14 +10,12 @@ Discourse.SiteContentType = Discourse.Model.extend({});
Discourse.SiteContentType.reopenClass({
findAll: function() {
var promise = new Em.Deferred();
Discourse.ajax("/admin/site_content_types").then(function(data) {
return Discourse.ajax("/admin/site_content_types").then(function(data) {
var contentTypes = Em.A();
data.forEach(function (ct) {
contentTypes.pushObject(Discourse.SiteContentType.create(ct));
});
promise.resolve(contentTypes);
return contentTypes;
});
return promise;
}
});

View File

@ -14,7 +14,6 @@ Discourse.AdminSiteContentEditRoute = Discourse.Route.extend({
model: function(params) {
var list = this.controllerFor('adminSiteContents').get('model');
var model;
// ember routing is fun ... this is what happens
//
@ -28,14 +27,10 @@ Discourse.AdminSiteContentEditRoute = Discourse.Route.extend({
// we could avoid this hack if Ember just compared .serialize(model) with .serialize(context)
//
// alternatively we could use some sort of identity map
//
// see also: https://github.com/emberjs/ember.js/issues/3005
list.forEach(function(orig){
if(orig.get("content_type") === params.content_type){
model = orig;
}
});
return model;
return list.findProperty("content_type", params.content_type);
},
renderTemplate: function() {

View File

@ -22,10 +22,14 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
}.observes('description'),
title: function() {
if (this.get('id')) return I18n.t("category.edit_long");
if (this.get('isUncategorized')) return I18n.t("category.edit_uncategorized");
return I18n.t("category.create");
}.property('id'),
if (this.get('id')) {
return I18n.t("category.edit_long") + ": " + this.get('model.name');
}
if (this.get('isUncategorized')){
return I18n.t("category.edit_uncategorized");
}
return I18n.t("category.create") + " : " + this.get('model.name');
}.property('id', 'model.name'),
titleChanged: function() {
this.set('controllers.modal.title', this.get('title'));

View File

@ -64,6 +64,7 @@
{{#each permissions}}
<li>
<span class="name"><span class="badge-group">{{group_name}}</span></span>
{{{i18n "category.can"}}}
<span class="permission">{{permission.description}}</span>
<a {{action removePermission this}}><i class="icon icon-remove-sign"></i></a>
</li>

View File

@ -876,6 +876,7 @@ en:
other: "Are you sure you want to delete all those posts?"
category:
can: 'can&hellip; '
none: '(no category)'
edit: 'edit'
edit_long: "Edit Category"
@ -998,9 +999,9 @@ en:
browser_update: 'Unfortunately, <a href="http://www.discourse.org/faq/#browser">your browser is too old to work on this Discourse forum</a>. Please <a href="http://browsehappy.com">upgrade your browser</a>.'
permission_types:
full: "Create Topics, Create Posts and Read"
create_post: "Create Posts and Read"
readonly: "Read Only"
full: "CREATE / REPLY / SEE"
create_post: "REPLY / SEE"
readonly: "SEE"
# This section is exported to the javascript for i18n in the admin section
admin_js: