{"size": 1639, "ext": "js", "max_stars_repo_path": "app/components/module-wrap.js", "max_stars_repo_name": "jiridanek/web-frontend", "max_stars_repo_stars_event_min_datetime": "2016-12-01T16:03:00.000Z", "max_stars_repo_stars_event_max_datetime": "2017-09-12T16:13:36.000Z", "max_issues_repo_path": "app/components/module-wrap.js", "max_issues_repo_name": "jiridanek/web-frontend", "max_issues_repo_issues_event_min_datetime": "2016-04-18T20:03:32.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-13T22:30:10.000Z", "max_forks_repo_path": "app/components/module-wrap.js", "max_forks_repo_name": "jiridanek/web-frontend", "max_forks_repo_forks_event_min_datetime": "2016-08-05T12:47:07.000Z", "max_forks_repo_forks_event_max_datetime": "2020-12-05T19:10:07.000Z"}
{"max_stars_count": 3, "max_issues_count": 205, "max_forks_count": 3, "avg_line_length": 31.5192307692, "max_line_length": 105, "alphanum_fraction": 0.5497254423}
import Ember from "ember";

export default Ember.Component.extend({
    tagName: "",
    classNames: [],
    is_editing: false,
    submitting: false,
    show_report: false,
    report_button_text: "Zobrazit orgovský report",

    session: Ember.inject.service(),
    show: function() {
        return this.get("is_editing") || !this.get("module.is_correct") || this.get("module.is_general");
    }.property("is_editing", "module.state"),

    didRender: function() {
        MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
    },

    actions: {
        submit: function() {
            this.set("submitting", true);
            this.get("module_logic").send("submit");
        },
        show: function() {
            this.set("is_editing", true);
        },
        submit_done: function() {
            this.send("set_report_button_text");
            this.set("submitting", false);
        },
        submit_succ_done: function() {
            this.set("submitting", false);
            if ( this.getWithDefault("module.blockClosing", false) === false ){
                this.set("is_editing", false);
            }
            this.sendAction("submit");
        },
        set_report_button_text: function(){
            if(this.get("module.show_report")) {
                this.set("report_button_text", "Skrýt orgovský report");
            } else {
                this.set("report_button_text", "Zobrazit orgovský report");
            }
        },
        toggle_report: function() {
            this.set("module.show_report", !this.get("module.show_report"));
            this.send("set_report_button_text");
        }
    }
});
