-
Notifications
You must be signed in to change notification settings - Fork 780
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add indent between questions in one line: #65
- Loading branch information
1 parent
52bf827
commit 97165a8
Showing
6 changed files
with
20 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,34 @@ | ||
/// <reference path="../questionbase.ts" /> | ||
module Survey { | ||
export class QuestionImplementorBase { | ||
koVisible: any; koErrors: any; koMarginLeft: any; koRenderWidth: any; | ||
koVisible: any; koErrors: any; koMarginLeft: any; koPaddingRight: any; koRenderWidth: any; | ||
constructor(public question: QuestionBase) { | ||
var self = this; | ||
question.visibilityChangedCallback = function () { self.onVisibilityChanged(); }; | ||
question.renderWidthChangedCallback = function () { self.onRenderWidthChanged(); }; | ||
this.koVisible = ko.observable(this.question.visible); | ||
this.koRenderWidth = ko.observable(this.question.renderWidth); | ||
this.koErrors = ko.observableArray(); | ||
this.koMarginLeft = ko.pureComputed(function () { | ||
if (self.question.indent < 1) return ""; | ||
if (!self.question["data"]) return ""; | ||
var css = self.question["data"]["css"]; | ||
if (!css) return ""; | ||
return self.question.indent * css.question.indent + "px"; | ||
}); | ||
this.koMarginLeft = ko.pureComputed(function () { return self.getIndentSize(self.question.indent); }); | ||
this.koPaddingRight = ko.pureComputed(function () { return self.getIndentSize(self.question.rightIndent); }); | ||
this.question["koVisible"] = this.koVisible; | ||
this.question["koRenderWidth"] = this.koRenderWidth; | ||
this.question["koErrors"] = this.koErrors; | ||
this.question["koMarginLeft"] = this.koMarginLeft; | ||
this.question["koPaddingRight"] = this.koPaddingRight; | ||
} | ||
protected onVisibilityChanged() { | ||
this.koVisible(this.question.visible); | ||
} | ||
protected onRenderWidthChanged() { | ||
this.koRenderWidth(this.question.renderWidth); | ||
} | ||
private getIndentSize(indent: number): string { | ||
if (indent < 1) return ""; | ||
if (!this.question["data"]) return ""; | ||
var css = this.question["data"]["css"]; | ||
if (!css) return ""; | ||
return indent * css.question.indent + "px"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters