Skip to content

Commit

Permalink
Issue #8 feat: option add ckeditor and validation
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinsahu731 committed Jul 27, 2018
1 parent 89528aa commit 95decbb
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 9 deletions.
42 changes: 40 additions & 2 deletions editor/controllers/mcq-controller.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions editor/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,20 @@ i.large.icon.delete-icon{
.ck-error{
border: 1px solid red;
}
.cke_float {
z-index: 9999999 !important;
}

.option-text {
margin: 0 20px 0 20px;
border-bottom: 1px #eee solid;
cursor: text;
}

.option-text::before {
content: 'Enter answer';
color: #aaa;
text-align: center;
position: relative;
display: block;
}
11 changes: 4 additions & 7 deletions editor/templates/horizontal_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,14 @@
</span>
</div>
<div ng-repeat="(key, value) in mcqFormData.options" class="outer-segment">
<div class="ui segments inner-segment" ng-class="{cardBorder: focused, 'has-errorCard': submitted && mcqForm['options_' + $index].$error.required}" id="eachCard">
<div class="ui segments inner-segment option-box" ng-class="{cardBorder: focused, 'has-errorCard': submitted && mcqForm['options_' + $index].$error.required}" id="option-box-{{$index}}">
<div class="ui segment">
<div class="ui grid">
<div class="eleven wide column">
<div class="form-group segment textBoxDiv">
<input type="text" class="form-control textbox" ng-class="{'has-success':mcqForm['options_' + $index].$valid, 'has-error': submitted && mcqForm['options_' + $index].$error.required}" placeholder="Enter answer" name="options_{{$index}}" ng-model="mcqFormData.options[key].text" maxlength="1000" ng-init="focused = false" ng-focus="focused = true;generateTelemetry({type: 'TOUCH', id: 'input', target: {id: 'questionunit-mcq-answer', ver: '', type: 'input'}})" ng-blur="focused = false" ng-required="!(mcqFormData.options[key].text.length || mcqFormData.options[key].image.length || mcqFormData.options[key].audio.length)"/>
<div class="one column row">
<div class="form-group one column row">
<div ng-click="optionEditable($event)" class="form-control option-text" id="options_{{$index}}" name="options_{{$index}}">{{mcqFormData.options[key].text}}</div>
</div>
</div>
<div class="one wide column text-len">
<span class="maxLengthText">{{value.text.length}}<span class="length-divider">/</span>1000</span>
</div>
<div class="four column row">
<div class="two wide column" ng-if="mcqFormData.options[key].image.length > 0">
<img src="{{mcqFormData.options[key].image}}" class="imgWidth" ng-click="addImage(key)"/>
Expand Down

0 comments on commit 95decbb

Please sign in to comment.