Browse Source

fix: update menu text

Gerald 9 years ago
parent
commit
776c4fa021
2 changed files with 5 additions and 1 deletions
  1. 2 0
      src/popup/views/item.js
  2. 3 1
      src/popup/views/menu.js

+ 2 - 0
src/popup/views/item.js

@@ -12,6 +12,8 @@ var MenuItemView = BaseView.extend({
     var it = this.model.toJSON();
     if (typeof it.symbol === 'function')
       it.symbol = it.symbol(it.data);
+    if (typeof it.name === 'function')
+      it.name = it.name(it.data);
     this.$el.html(this.templateFn(it))
     .attr('title', it.title === true ? it.name : it.title);
     if (it.data === false) this.$el.addClass('disabled');

+ 3 - 1
src/popup/views/menu.js

@@ -49,7 +49,9 @@ var MenuView = MenuBaseView.extend({
       },
     }, top);
     _this.addMenuItem({
-      name: _.i18n('menuScriptEnabled'),
+      name: function (data) {
+        return data ? _.i18n('menuScriptEnabled') : _.i18n('menuScriptDisabled');
+      },
       data: _.options.get('isApplied'),
       symbol: function (data) {
         return data ? 'fa-check' : 'fa-times';