updating panel
This commit is contained in:
parent
310036ddb2
commit
6802f0c845
|
@ -17,13 +17,19 @@
|
|||
bottom: 0;
|
||||
padding: 15px 4px 4px 4px;
|
||||
background: #fff;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#counters li {
|
||||
clear: both;
|
||||
padding-bottom: 4px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
#counters .counter {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
|
|
|
@ -3,11 +3,15 @@ var App = (function() {
|
|||
|
||||
this.counters = [];
|
||||
|
||||
this.projects = [];
|
||||
|
||||
this.init = function() {
|
||||
$('#home')
|
||||
.click(app.loadProjects)
|
||||
.trigger('click');
|
||||
|
||||
$('#update').click(app.loadUpdatePanel);
|
||||
|
||||
app.checkTimers();
|
||||
}
|
||||
|
||||
|
@ -67,6 +71,8 @@ var App = (function() {
|
|||
var success = function(json) {
|
||||
app.json2html(json, 'projects-list-template');
|
||||
|
||||
app.projects = json;
|
||||
|
||||
$('.project').click(function(e) {
|
||||
app.loadProjectIssues($(e.target).data('id'), $(e.target).data('name'));
|
||||
});
|
||||
|
@ -100,6 +106,28 @@ var App = (function() {
|
|||
});
|
||||
}
|
||||
|
||||
this.loadUpdatePanel = function() {
|
||||
if (app.counters.length) {
|
||||
var counters = [];
|
||||
|
||||
for (i in app.counters) {
|
||||
if (app.counters[i]) {
|
||||
var c = app.counters[i];
|
||||
|
||||
if (c.value !== 0) {
|
||||
counters.push(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (counters.length) {
|
||||
app.json2html({
|
||||
counters: counters
|
||||
}, 'update-panel');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setTitle = function(name, clickCallback) {
|
||||
var $oTitle = $('#title');
|
||||
var $title = $oTitle.clone();
|
||||
|
@ -120,7 +148,7 @@ var App = (function() {
|
|||
json.issue.created_on = [date[0], date[1]].join(' ');
|
||||
|
||||
if (description.length) {
|
||||
json.issue.description = json.issue.description.replace(/\r\n/g, '<br />');
|
||||
json.issue.description = description;
|
||||
} else {
|
||||
json.issue.description = 'No description.';
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
<div id="counters">
|
||||
<ul class="list-group"></ul>
|
||||
|
||||
<button type="button" id="update" class="btn btn-danger btn-xs">Update online redmine</button>
|
||||
</div>
|
||||
|
||||
<script id="projects-list-template" type="text/x-handlebars-template">
|
||||
|
@ -70,14 +72,66 @@
|
|||
|
||||
<script id="timer-template" type="text/x-handlebars-template">
|
||||
<li data-id="{{ issue.id }}">
|
||||
<div class="counter bg-primary pull-right pointer" data-id="{{ issue.id }}"></div>
|
||||
|
||||
<span class="pull-right label label-primary pointer counter" data-id="{{ issue.id }}">#{{ issue.id }}</span>
|
||||
{{ issue.subject }}
|
||||
<br />
|
||||
<span class="label label-default">#{{ issue.id }}</span>
|
||||
<span data-id="{{ issue.project.id }}" data-name="{{ issue.project.name }}">{{ issue.project.name }}</span>
|
||||
<span class="label label-info" data-id="{{ issue.project.id }}" data-name="{{ issue.project.name }}">{{ issue.project.name }}</span>
|
||||
</li>
|
||||
</script>
|
||||
|
||||
<script id="update-panel" type="text/x-handlebars-template">
|
||||
<div class="col-md-12">
|
||||
<h3>Redmine updating</h3>
|
||||
|
||||
{{#each counters}}
|
||||
<div class="issue-counter form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="time_project_name_{{ issue.id }}" class="col-sm-2 control-label">Project</label>
|
||||
<div class="col-sm-10">
|
||||
{{ issue.project.name }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="time_issue_name_{{ issue.id }}" class="col-sm-2 control-label">Issue</label>
|
||||
<div class="col-sm-10">
|
||||
<span class="label label-default">#{{ issue.id }}</span>
|
||||
{{ counters.issue.subject }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="time_date_{{ issue.id }}" class="col-sm-2 control-label">Date*</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="time_date_{{ issue.id }}" placeholder="Date">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="time_time_{{ issue.id }}" class="col-sm-2 control-label">Time*</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="time_time_{{ issue.id }}" placeholder="Time">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="time_comment_{{ issue.id }}" class="col-sm-2 control-label">Comment</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" class="form-control" id="time_comment_{{ issue.id }}" placeholder="Comment" maxlength="255">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="time_activity_{{ issue.id }}" class="col-sm-2 control-label">Activity*</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" id="time_comment_{{ issue.id }}">
|
||||
<option value="">Todo</option>
|
||||
<option value="">Todo</option>
|
||||
<option value="">Todo</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="../config/api.js"></script>
|
||||
<script type="text/javascript" src="../node_modules/jquery/dist/jquery.min.js"></script>
|
||||
|
|
Loading…
Reference in a new issue