Commit ba389eccf4a61f157021dba8d225a9cbffe1dea1
1 parent
6b15acb7
Exists in
master
and in
27 other branches
Edit visibility status of an article
Showing
6 changed files
with
58 additions
and
18 deletions
Show diff stats
src/app/article/basic-editor/basic-editor.html
| 1 | -<div class="basic-editor row"> | |
| 2 | - <div class="col-md-2"></div> | |
| 3 | - <div class="col-md-8"> | |
| 4 | - <form> | |
| 5 | - <div class="form-group"> | |
| 6 | - <label for="titleInput">{{"article.basic_editor.title" | translate}}</label> | |
| 7 | - <input type="text" class="form-control" id="titleInput" placeholder="{{'article.basic_editor.title' | translate}}" ng-model="vm.article.name"> | |
| 1 | +<div class="basic-editor"> | |
| 2 | + <div class="row"> | |
| 3 | + <div class="col-md-1"></div> | |
| 4 | + <div class="col-md-8"> | |
| 5 | + <form> | |
| 6 | + <div class="form-group"> | |
| 7 | + <label for="titleInput">{{"article.basic_editor.title" | translate}}</label> | |
| 8 | + <input type="text" class="form-control" id="titleInput" placeholder="{{'article.basic_editor.title' | translate}}" ng-model="vm.article.name"> | |
| 9 | + </div> | |
| 10 | + <div class="form-group"> | |
| 11 | + <label for="bodyInput">{{"article.basic_editor.body" | translate}}</label> | |
| 12 | + <html-editor [(value)]="vm.article.body"></html-editor> | |
| 13 | + </div> | |
| 14 | + <button type="submit" class="btn btn-default" ng-click="vm.save()">{{"article.basic_editor.save" | translate}}</button> | |
| 15 | + <button type="button" class="btn btn-danger" ng-click="vm.cancel()">{{"article.basic_editor.cancel" | translate}}</button> | |
| 16 | + </form> | |
| 17 | + </div> | |
| 18 | + <div class="side-options"> | |
| 19 | + <div class="visibility panel panel-default"> | |
| 20 | + <div class="panel-heading">{{"article.basic_editor.visibility" | translate}}</div> | |
| 21 | + <div class="panel-body"> | |
| 22 | + <div> | |
| 23 | + <input type="radio" ng-model="vm.article.published" ng-value="true"> | |
| 24 | + <i class="fa fa-unlock fa-fw"></i> {{"article.basic_editor.visibility.public" | translate}} | |
| 25 | + </div> | |
| 26 | + <div> | |
| 27 | + <input type="radio" ng-model="vm.article.published" ng-value="false"> | |
| 28 | + <i class="fa fa-lock fa-fw"></i> {{"article.basic_editor.visibility.private" | translate}} | |
| 29 | + </div> | |
| 30 | + </div> | |
| 8 | 31 | </div> |
| 9 | - <div class="form-group"> | |
| 10 | - <label for="bodyInput">{{"article.basic_editor.body" | translate}}</label> | |
| 11 | - <html-editor [(value)]="vm.article.body"></html-editor> | |
| 12 | - </div> | |
| 13 | - <button type="submit" class="btn btn-default" ng-click="vm.save()">{{"article.basic_editor.save" | translate}}</button> | |
| 14 | - <button type="button" class="btn btn-danger" ng-click="vm.cancel()">{{"article.basic_editor.cancel" | translate}}</button> | |
| 15 | - </form> | |
| 32 | + </div> | |
| 16 | 33 | </div> |
| 17 | - <div class="col-md-2"></div> | |
| 18 | 34 | </div> | ... | ... |
src/app/article/basic-editor/basic-editor.scss
| 1 | 1 | .basic-editor { |
| 2 | 2 | @extend .container-fluid; |
| 3 | 3 | padding: 0 1%; |
| 4 | + | |
| 5 | + .side-options { | |
| 6 | + @extend .col-md-3; | |
| 7 | + margin-top: 25px; | |
| 8 | + | |
| 9 | + .visibility { | |
| 10 | + .panel-heading { | |
| 11 | + background-color: transparent; | |
| 12 | + font-weight: bold; | |
| 13 | + } | |
| 14 | + .panel-body { | |
| 15 | + i { | |
| 16 | + color: #A5A5A5; | |
| 17 | + } | |
| 18 | + } | |
| 19 | + } | |
| 20 | + } | |
| 4 | 21 | } | ... | ... |
src/languages/en.json
| ... | ... | @@ -42,5 +42,8 @@ |
| 42 | 42 | "article.basic_editor.save": "Save", |
| 43 | 43 | "article.basic_editor.cancel": "Cancel", |
| 44 | 44 | "article.basic_editor.success.title": "Good job!", |
| 45 | - "article.basic_editor.success.message": "Article saved!" | |
| 45 | + "article.basic_editor.success.message": "Article saved!", | |
| 46 | + "article.basic_editor.visibility": "Visibility", | |
| 47 | + "article.basic_editor.visibility.public": "Public", | |
| 48 | + "article.basic_editor.visibility.private": "Private" | |
| 46 | 49 | } | ... | ... |
src/languages/pt.json
| ... | ... | @@ -42,5 +42,8 @@ |
| 42 | 42 | "article.basic_editor.save": "Salvar", |
| 43 | 43 | "article.basic_editor.cancel": "Cancelar", |
| 44 | 44 | "article.basic_editor.success.title": "Bom trabalho!", |
| 45 | - "article.basic_editor.success.message": "Artigo salvo com sucesso!" | |
| 45 | + "article.basic_editor.success.message": "Artigo salvo com sucesso!", | |
| 46 | + "article.basic_editor.visibility": "Visibilidade", | |
| 47 | + "article.basic_editor.visibility.public": "Público", | |
| 48 | + "article.basic_editor.visibility.private": "Privado" | |
| 46 | 49 | } | ... | ... |
src/lib/ng-noosfero-api/http/article.service.ts
| ... | ... | @@ -27,7 +27,7 @@ export class ArticleService extends RestangularService<noosfero.Article> { |
| 27 | 27 | 'Content-Type': 'application/json' |
| 28 | 28 | }; |
| 29 | 29 | let deferred = this.$q.defer<noosfero.RestResult<noosfero.Article>>(); |
| 30 | - let attributesToUpdate: any = { article: { name: article.name, body: article.body } }; | |
| 30 | + let attributesToUpdate: any = { article: { name: article.name, body: article.body, published: article.published } }; | |
| 31 | 31 | let restRequest: ng.IPromise<noosfero.RestResult<noosfero.Article>> = this.getElement(article.id).customPOST(attributesToUpdate, null, null, headers); |
| 32 | 32 | restRequest.then(this.getHandleSuccessFunction(deferred)) |
| 33 | 33 | .catch(this.getHandleErrorFunction(deferred)); | ... | ... |