Skip to content

Commit

Permalink
track developer/product WIP #84
Browse files Browse the repository at this point in the history
  • Loading branch information
dantheta committed Dec 17, 2019
1 parent 9606203 commit 0c9f39b
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 29 deletions.
6 changes: 4 additions & 2 deletions app/controller/ajaxcontroller.ctrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ public function save_slide(){
'description' => $description,
'step' => $step,
'position' => $position,
'track' => $_POST['track'],
'track_developer' => empty($_POST['track_developer']) ? null : $_POST['track_developer'],
'track_product' => empty($_POST['track_product']) ? null : $_POST['track_product'],
'slide_type' => $_POST['slide_type']),
$slide->idslide_list );
if ($step != $slide->step) {
Expand All @@ -251,7 +252,8 @@ public function save_slide(){
'description' => $description,
'step' => $step,
'position' => $position,
'track' => $_POST['track'],
'track_developer' => empty($_POST['track_developer']) ? null : $_POST['track_developer'],
'track_product' => empty($_POST['track_product']) ? null : $_POST['track_product'],
'slide_type' => $_POST['slide_type'],
)
);
Expand Down
14 changes: 0 additions & 14 deletions app/model/slidelist.model.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@ class Slidelist extends Model{

protected $table = 'slide_list';

const TRACKS = array(
0 => 'all',
1 => 'solo developer/new product',
3 => 'organisation/new product',
5 => 'solo developer/existing product',
31 => 'organisation/existing product'
);

/*
* 1 0101 = 21
* 1 0111 = 23
* 1 1101 = 29
* 1 1111 = 31
*/

public function getList(){

Expand Down
27 changes: 20 additions & 7 deletions app/view/manage/slide.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,30 @@
<option value="4" <?php echo ($slide->slide_type == 4) ? "selected" : "" ?>>Recap</option>
</select>
</div>
<div class="form-group">
Track: <select id="track" name="track">
<?php foreach(Slidelist::TRACKS as $trackid => $trackname) { ?>
<option value="<?php echo $trackid ?>" <?php echo ($trackid == $slidelist->track ? "selected" : "") ?> ><?php echo $trackname ?></option>
<?php } ?>
</select>
</div>

<div class="form-group">
<div class="textarea form-control" name="description" id="description"><?php echo $slide->description; ?></div>
<?php /* <textarea rows="25" name="description" id="description" class="form-control" data-provide="markdown" data-iconlibrary="fa"><?php echo $slide->description; ?></textarea> */ ?>
</div>
<div class="row">
<h3>Track</h3>
<div class="col-md-4">
<h4>Developer</h4>
<ul>
<li><input type="radio" name="track_developer" value="" <?php echo (empty($slide->track_developer) ? 'checked': '') ?> />Any</li>
<li><input type="radio" name="track_developer" value="1" <?php echo ($slide->track_developer == 1 ? 'checked': '') ?>/>Solo</li>
<li><input type="radio" name="track_developer" value="2" <?php echo ($slide->track_developer == 2 ? 'checked': '') ?>/>Organisation</li>
</ul>
</div>
<div class="col-md-4">
<h4>Product</h4>
<ul>
<li><input type="radio" name="track_product" value="" <?php echo (empty($slide->track_product) ? 'checked': '') ?> />Any</li>
<li><input type="radio" name="track_product" value="1" <?php echo ($slide->track_product == 1 ? 'checked': '') ?> />New</li>
<li><input type="radio" name="track_product" value="2" <?php echo ($slide->track_product == 2 ? 'checked': '') ?> />Existing</li>
</ul>
</div>
</div>
<div class="form-group">
<button type="submit" id="save-form" data-form="#slide-form" class="btn btn-primary">save</button>
</div>
Expand Down
3 changes: 2 additions & 1 deletion install.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@
`description` text NOT NULL,
`step` int(11) NOT NULL,
`slide_type` int(11) NOT NULL,
`track` int(11) NOT NULL DEFAULT 0,
`track_developer` int(11),
`track_product` int(11),
PRIMARY KEY (`idslide_list`),
KEY `idxSlidelistStep` (`step`),
KEY `idxSlidelistWeight` (`position`,`step`),
Expand Down
5 changes: 3 additions & 2 deletions public/dist/js/ToolSelectionAssistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,9 @@ $(document).ready(function(){
'id' : theForm.children('#id').val(),
'position' : theForm.children().children('#position').val(),
'slide_type' : $('#slide_type').val(),
'track' : $('#track').val()
}
'track_developer' : $('input[name=track_developer]:checked').val(),
'track_product' : $('input[name=track_product]:checked').val()
};

$.post(
'/ajax/save_slide',
Expand Down
3 changes: 2 additions & 1 deletion public/dist/js/script.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ $(document).ready(function() {
id: b.children("#id").val(),
position: b.children().children("#position").val(),
slide_type: $("#slide_type").val(),
track: $("#track").val()
track_developer: $("input[name=track_developer]:checked").val(),
track_product: $("input[name=track_product]:checked").val()
};
return $.post("/ajax/save_slide", c, function(a) {
a.created ? window.location.href = "/manage/slide/" + a.created : b.prepend('<div class="alert alert-' + a.code + '"><i class="fa fa-' + a.icon + '"></i> ' + a.message + "</div>");
Expand Down
5 changes: 3 additions & 2 deletions public/src/js/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,9 @@ $(document).ready(function(){
'id' : theForm.children('#id').val(),
'position' : theForm.children().children('#position').val(),
'slide_type' : $('#slide_type').val(),
'track' : $('#track').val()
}
'track_developer' : $('input[name=track_developer]:checked').val(),
'track_product' : $('input[name=track_product]:checked').val()
};

$.post(
'/ajax/save_slide',
Expand Down

0 comments on commit 0c9f39b

Please sign in to comment.