-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing Post/Survey Title Description fields to be editable #415
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far. Few issues in comments.
@@ -113,11 +116,17 @@ function PostEditorController( | |||
// If attributesToIgnore is set, remove those attributes from set of fields to display | |||
var attributes = []; | |||
_.each(attrs, function (attr) { | |||
if (!_.contains($scope.attributesToIgnore, attr.key)) { | |||
if (attr.type === 'title' || attr.type === 'description') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this first if
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think probably not, I'm not sure what it was for
@@ -113,11 +116,17 @@ function PostEditorController( | |||
// If attributesToIgnore is set, remove those attributes from set of fields to display | |||
var attributes = []; | |||
_.each(attrs, function (attr) { | |||
if (!_.contains($scope.attributesToIgnore, attr.key)) { | |||
if (attr.type === 'title' || attr.type === 'description') { | |||
if (attr.type === 'title') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be cleaner (though less efficient) to just do
_.findWhere(attrs, {type: 'title})
and then process that.. rather than adding many conditions to a loop
<label translate="survey.require_field">Require this field be completed</label> | ||
<div class="toggle-switch"> | ||
<input class="tgl" id="switchnewattribute" type="checkbox" ng-model="editAttribute.required"> | ||
<label class="tgl-btn" for="switchnewattribute"></label> | ||
</div> | ||
</div> | ||
<div class="form-sheet" ng-show="editAttribute.form_stage_id"> | ||
<div class="form-sheet" ng-show="editAttribute.form_stage_id" ng-show="editAttribute.type !== 'title' && editAttribute.type !== 'description'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple ng-show's won't work here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -3,7 +3,7 @@ | |||
<label translate="app.name">Name</label> | |||
<input type="text" ng-model="editAttribute.label"> | |||
</div> | |||
<div class="form-field" ng-if="editAttribute.input !== 'upload'"> | |||
<div class="form-field" ng-if="editAttribute.input !== 'upload' && editAttribute.type !== 'title' && editAttribute.type !== 'description'"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kinda ugly.. could we move this to a canSetDefault
method on the scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually given the 3 new checks.. it seems like you could just wrap all the the form after label
in 1 large ng-if and it'd be cleaner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
This pull request makes the following changes:
Test these changes by:
Fixes ushahidi/platform#1469
Ping @ushahidi/platform
This change is