Beispiel #1
0
 def unserialize(cls, step_data):
     kwargs = {
         "conditions": [Condition.unserialize(cond) for cond in step_data.get("conditions", ())],
         "actions": [Action.unserialize(action) for action in step_data.get("actions", ())],
     }
     if "next" in step_data:
         kwargs["next"] = StepNext(step_data["next"])
     if "cond_op" in step_data:
         kwargs["cond_op"] = StepConditionOperator(step_data["cond_op"])
     if "enabled" in step_data:
         kwargs["enabled"] = bool(step_data["enabled"])
     return cls(**kwargs)
Beispiel #2
0
 def get_context_data(self, **kwargs):
     context = super(EditScriptContentView, self).get_context_data(**kwargs)
     context["title"] = get_create_or_change_title(self.request, self.object)
     context["action_infos"] = Action.get_ui_info_map()
     context["condition_infos"] = Condition.get_ui_info_map()
     context["cond_op_names"] = get_enum_choices_dict(StepConditionOperator)
     context["step_next_names"] = get_enum_choices_dict(StepNext)
     context["toolbar"] = Toolbar([
         JavaScriptActionButton(
             text="Save", icon="fa fa-save", extra_css_class="btn-success",
             onclick="ScriptEditor.save();return false"
         ),
         get_discard_button(get_model_url(self.object, "edit"))
     ])
     return context
Beispiel #3
0
 def get_context_data(self, **kwargs):
     context = super(EditScriptContentView, self).get_context_data(**kwargs)
     context["title"] = get_create_or_change_title(self.request,
                                                   self.object)
     context["action_infos"] = Action.get_ui_info_map()
     context["condition_infos"] = Condition.get_ui_info_map()
     context["cond_op_names"] = get_enum_choices_dict(StepConditionOperator)
     context["step_next_names"] = get_enum_choices_dict(StepNext)
     context["toolbar"] = Toolbar([
         JavaScriptActionButton(text="Save",
                                icon="fa fa-save",
                                extra_css_class="btn-success",
                                onclick="ScriptEditor.save();return false"),
         get_discard_button(get_model_url(self.object, "edit"))
     ])
     return context
Beispiel #4
0
 def unserialize(cls, step_data):
     kwargs = {
         "conditions": [
             Condition.unserialize(cond)
             for cond in step_data.get("conditions", ())
         ],
         "actions": [
             Action.unserialize(action)
             for action in step_data.get("actions", ())
         ],
     }
     if "next" in step_data:
         kwargs["next"] = StepNext(step_data["next"])
     if "cond_op" in step_data:
         kwargs["cond_op"] = StepConditionOperator(step_data["cond_op"])
     if "enabled" in step_data:
         kwargs["enabled"] = bool(step_data["enabled"])
     return cls(**kwargs)