Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.80 KB | None | 0 0
  1. @model DetailsModel
  2. @{
  3. }
  4. <div class="d-flex flex-row">
  5. <div class="p-2">
  6. @Html.ActionLink("Add New Step", "CreateStep", "StepTemplate", new { sectionTemplateId = Model.SectionTemplate.SectionTemplateId }, new { @class = "btn btn-sm btn-primary"})
  7. </div>
  8. </div>
  9. <br />
  10. <table class="table table-bordered table-condensed tablesorter" cellpadding="0" cellspacing="5">
  11. <tr>
  12. <th>Step ID</th>
  13. <th>Version ID</th>
  14. <th>Step Name</th>
  15. <th colspan="3">Actions</th>
  16. </tr>
  17. @foreach (var stepItem in Model.SectionTemplate.StepTemplateList)
  18. {
  19. if (stepItem.IsReadOnly)
  20. {
  21. <tr class="header">
  22. <th>@stepItem.StepId</th>
  23. <th>@stepItem.VersionId</th>
  24. <th>@Html.Label(stepItem.StepName, new { title = stepItem.StepText })</th>
  25. <th>
  26. @Html.ActionLink("Add New Version", "CreateStep", "StepTemplate", new { sectionTemplateId = Model.SectionTemplate.SectionTemplateId, stepTemplateId = stepItem.StepTemplateId, moduleTemplateId = Model.SectionTemplate.ModuleTemplateId, examTemplateId = Model.ExamTemplateId, createNewVerion = true }, new { @class = "btn btn-sm btn-primary" })
  27. </th>
  28. <th></th>
  29. <th> @Html.ActionLink("Remove Step", "", "StepTemplate", new { @class = "btn btn-sm btn-primary", @onclick = "javascript:return false;" })</th>
  30. </tr>
  31. }
  32. else
  33. {
  34. var indent = 0;
  35. foreach (var childStep in stepItem.ChildSteps)
  36. {
  37. if (childStep.ParentStepTemplateId == childStep.StepTemplateId && childStep.StepTemplateId == childStep.RootStepTemplateId)
  38. {
  39. <tr class="header">
  40. <th data-indent=@indent>@stepItem.StepId</th>
  41. <th data-indent=@indent>@stepItem.VersionId</th>
  42. <th data-indent=@indent>@Html.Label("",stepItem.StepName, new { title = stepItem.StepText })</th>
  43. <th data-indent=@indent>
  44. @Html.ActionLink("Edit", "CreateStep", "StepTemplate", new { sectionTemplateId = Model.SectionTemplate.SectionTemplateId, stepTemplateId = stepItem.StepTemplateId, moduleTemplateId = Model.SectionTemplate.ModuleTemplateId, examTemplateId = Model.ExamTemplateId }, new { @class = "btn btn-sm btn-primary" })
  45. </th>
  46. <td>
  47. <div class="d-flex flex-column">
  48. <div class="p-2">
  49. @Html.ActionLink("+ New Step", "CreateStep", "StepTemplate", new { sectionTemplateId = Model.SectionTemplate.SectionTemplateId, stepTemplateId = childStep.StepTemplateId,}, new { @class = "btn btn-sm btn-secondary", @title = "This action will add a new step after this step." })
  50. </div>
  51. <div class="p-2">
  52. @Html.ActionLink("+ New Child Step", "CreateStep", "StepTemplate", new { sectionTemplateId = Model.SectionTemplate.SectionTemplateId, stepTemplateId = childStep.StepTemplateId}, new { @class = "btn btn-sm btn-primary", @title = "This action will add a new child step to this step." })
  53. </div>
  54.  
  55. </div>
  56. </td>
  57. <th data-indent=@indent>@Html.ActionLink("Remove Step", "", "StepTemplate", new { @class = "btn btn-sm btn-primary", @onclick = "javascript:return false;" })</th>
  58. </tr>
  59. indent = indent + 1;
  60. }
  61. else if (childStep.ParentStepTemplateId == childStep.RootStepTemplateId && childStep.StepTemplateId != childStep.RootStepTemplateId)
  62. {
  63. <tr class="child">
  64. <td data-indent=@indent>.@childStep.StepId</td>
  65. <td data-indent=@indent>@childStep.VersionId</td>
  66. <td data-indent=@indent>@Html.Label("",childStep.StepName.ToString(), new { title = childStep.StepText })</td>
  67. <td data-indent=@indent>
  68. @Html.ActionLink("Edit", "CreateStep", "StepTemplate", new { sectionTemplateId = Model.SectionTemplate.SectionTemplateId, stepTemplateId = childStep.StepTemplateId, moduleTemplateId = Model.SectionTemplate.ModuleTemplateId, examTemplateId = Model.ExamTemplateId }, new { @class = "btn btn-sm btn-primary" })
  69. </td>
  70. <td>
  71. @Html.ActionLink("+ New Child Step", "CreateStep", "StepTemplate", new { sectionTemplateId = Model.SectionTemplate.SectionTemplateId, stepTemplateId = childStep.StepTemplateId}, new { @class = "btn btn-sm btn-primary", @title = "This action will add a new child step to this step."})
  72. </td>
  73. <td data-indent=@indent> @Html.ActionLink("Remove Step", "", "StepTemplate", new { @class = "btn btn-sm btn-primary", @onclick = "javascript:return false;" })</td>
  74. </tr>
  75. var childstepsforchild = stepItem.ChildSteps.Where(m => m.ParentStepTemplateId == childStep.StepTemplateId);
  76. foreach (var m in childstepsforchild)
  77. {
  78. m.childIndent = indent + 1;
  79. }
  80. }
  81. else if (childStep.ParentStepTemplateId != childStep.RootStepTemplateId)
  82. {
  83. var dots = "";
  84. for (int i = 0; i < @childStep.childIndent; i++)
  85. {
  86. dots = dots + ".";
  87. }
  88. <tr class="child">
  89. <td data-indent=@childStep.childIndent>@dots@childStep.StepId</td>
  90. <td data-indent=@childStep.childIndent>@childStep.VersionId</td>
  91. <td data-indent=@childStep.childIndent>@Html.Label("",childStep.StepName, new { title = childStep.StepText })</td>
  92. <td data-indent=@indent>
  93. @Html.ActionLink("Edit", "CreateStep", "StepTemplate", new { sectionTemplateId = Model.SectionTemplate.SectionTemplateId, stepTemplateId = childStep.StepTemplateId, moduleTemplateId = Model.SectionTemplate.ModuleTemplateId, examTemplateId = Model.ExamTemplateId }, new { @class = "btn btn-sm btn-primary" })
  94. </td>
  95. <td>
  96. @Html.ActionLink("+ New Child Step", "CreateStep", "StepTemplate", new { sectionTemplateId = Model.SectionTemplate.SectionTemplateId, stepTemplateId = childStep.StepTemplateId}, new { @class = "btn btn-sm btn-primary" , @title = "This action will add a new child step to this step." })
  97. </td>
  98. <td data-indent=@childStep.childIndent> @Html.ActionLink("Remove Step", "", "StepTemplate", new { @class = "btn btn-sm btn-primary", @onclick = "javascript:return false;" })</td>
  99. </tr>
  100. var childstepsforchild = stepItem.ChildSteps.Where(m => m.ParentStepTemplateId == childStep.StepTemplateId);
  101. foreach (var m in childstepsforchild)
  102. {
  103. m.childIndent = childStep.childIndent + 1;
  104. }
  105. }
  106. }
  107. }
  108. }
  109. </table>
  110.  
  111. <script type="text/javascript">
  112. $(document).ready(function () {
  113.  
  114. //$('.child').hide();
  115.  
  116. $('.header').click(function () {
  117. //var tr = $(this).parents('tr:first');
  118. //tr.find('.expand, .collapse').toggle();
  119. //$(this).toggleClass('expand').nextUntil('tr.header').toggle();
  120. $(this).nextUntil('tr.header').toggle();
  121. });
  122.  
  123. $("td")
  124. .css("padding-left", function (index) {
  125. return 20 * parseInt($(this).data("indent")) + "px";
  126. });
  127. });
  128. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement