Sha256: 153eef0fd0e22f1e3a697547aa89787a0d715a58f2290e9bb837f4270eeceb61

Contents?: true

Size: 1.47 KB

Versions: 7

Compression:

Stored size: 1.47 KB

Contents

import Component from "@ember/component";
import { computed } from "@ember/object";

export default Component.extend({
  buttons: computed("currentMessage.{canSolve,protected}", function() {
    const canSolve = this.get("currentMessage.canSolve");
    const protect = this.get("currentMessage.protected");
    const buttons = [];

    if (!protect && canSolve) {
      buttons.push({
        klass: "solve",
        action: "solve",
        icon: "check-square-o",
        label: "Solve",
        danger: true
      });
    }

    if (!protect) {
      buttons.push(
        {
          klass: "remove",
          action: "remove",
          icon: "trash-o",
          label: "Remove",
          danger: true
        },
        {
          klass: "protect",
          action: "protect",
          icon: "lock",
          label: "Protect"
        }
      );
    } else {
      buttons.push({
        klass: "unprotect",
        action: "unprotect",
        icon: "unlock",
        label: "Unprotect"
      });
    }

    return buttons;
  }),

  actions: {
    protect() {
      this.get("currentMessage").protect();
    },
    unprotect() {
      this.get("currentMessage").unprotect();
    },
    remove() {
      this.removeMessage(this.get("currentMessage"));
    },
    solve() {
      this.solveMessage(this.get("currentMessage"));
    },
    share() {
      window.location.pathname = this.get("currentMessage.shareUrl");
    }
  }
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
logster-2.1.0 client-app/app/components/message-info.js
logster-2.0.1 client-app/app/components/message-info.js
logster-2.0.0.pre client-app/app/components/message-info.js
logster-1.4.0.pre client-app/app/components/message-info.js
logster-1.3.4 client-app/app/components/message-info.js
logster-1.3.3 client-app/app/components/message-info.js
logster-1.3.2 client-app/app/components/message-info.js