예제 #1
0
파일: script.py 프로젝트: NamiStudio/shuup
 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)
예제 #2
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)
예제 #3
0
파일: editor.py 프로젝트: NamiStudio/shuup
 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
예제 #4
0
파일: editor.py 프로젝트: rogasp/shuup
 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