Compare View

switch
from
...
to
 
Commits (8)
@@ -14,3 +14,4 @@ typings @@ -14,3 +14,4 @@ typings
14 npm-debug.log 14 npm-debug.log
15 src/vendor.bundle.js* 15 src/vendor.bundle.js*
16 .vagrant/ 16 .vagrant/
  17 +*.sw*
src/app/index.scss
@@ -82,3 +82,4 @@ h1, h2, h3, h4, h5 { @@ -82,3 +82,4 @@ h1, h2, h3, h4, h5 {
82 @import "layout/scss/layout"; 82 @import "layout/scss/layout";
83 @import "layout/scss/sidebar"; 83 @import "layout/scss/sidebar";
84 @import "layout/scss/tables"; 84 @import "layout/scss/tables";
  85 +@import "layout/scss/forms";
src/app/layout/blocks/block.component.ts
@@ -23,6 +23,7 @@ export class BlockComponent { @@ -23,6 +23,7 @@ export class BlockComponent {
23 currentUser: noosfero.User; 23 currentUser: noosfero.User;
24 isHomepage = true; 24 isHomepage = true;
25 editionMode = false; 25 editionMode = false;
  26 + designMode = false;
26 27
27 constructor(private $uibModal: any, 28 constructor(private $uibModal: any,
28 private $scope: ng.IScope, 29 private $scope: ng.IScope,
@@ -49,6 +50,7 @@ export class BlockComponent { @@ -49,6 +50,7 @@ export class BlockComponent {
49 }); 50 });
50 this.designModeService.onToggle.subscribe((designModeOn: boolean) => { 51 this.designModeService.onToggle.subscribe((designModeOn: boolean) => {
51 this.editionMode = designModeOn; 52 this.editionMode = designModeOn;
  53 + this.designMode = designModeOn;
52 this.$scope.$apply(); 54 this.$scope.$apply();
53 }); 55 });
54 } 56 }
src/app/layout/blocks/block.html
1 -<div ng-show="ctrl.canDisplay() || ctrl.editionMode" ng-class="{'invisible-block': !ctrl.canDisplay()}" class="noosfero-block" ng-mouseover="displayActions = true" ng-mouseleave="displayActions = false"> 1 +<div ng-show="ctrl.canDisplay() || ctrl.editionMode || ctrl.designMode" ng-class="{'invisible-block': !ctrl.canDisplay()}" class="noosfero-block" ng-mouseover="displayActions = true" ng-mouseleave="displayActions = false">
2 <div ng-show="displayActions" class="actions block-actions" permission="ctrl.block.permissions" permission-action="allow_edit"> 2 <div ng-show="displayActions" class="actions block-actions" permission="ctrl.block.permissions" permission-action="allow_edit">
3 <button type="submit" class="btn btn-xs btn-default" ng-click="ctrl.openEdit()"><i class="fa fa-edit fa-fw"></i></button> 3 <button type="submit" class="btn btn-xs btn-default" ng-click="ctrl.openEdit()"><i class="fa fa-edit fa-fw"></i></button>
4 </div> 4 </div>
src/app/layout/blocks/login-block/login-block.html
@@ -15,13 +15,21 @@ @@ -15,13 +15,21 @@
15 <div class="logged-user-info" ng-show="!ctrl.currentUser"> 15 <div class="logged-user-info" ng-show="!ctrl.currentUser">
16 <form> 16 <form>
17 <div class="form-group"> 17 <div class="form-group">
18 - <label for="exampleInputEmail1">{{"auth.form.login" | translate}}</label>  
19 - <input type="text" class="form-control" id="exampleInputEmail1" placeholder="Login / Email" ng-model="ctrl.credentials.username"> 18 + <label for="email">{{"auth.form.login" | translate}}</label>
  19 + <input type="text" class="form-control" id="email" placeholder="{{'auth.form.login' | translate}}" ng-model="ctrl.credentials.username">
20 </div> 20 </div>
21 <div class="form-group"> 21 <div class="form-group">
22 - <label for="exampleInputPassword1">{{"auth.form.password" | translate}}</label>  
23 - <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password" ng-model="ctrl.credentials.password"> 22 + <label for="passwd">{{"auth.form.password" | translate}}</label>
  23 + <input type="password" class="form-control" id="passwd" placeholder="{{'auth.form.password' | translate}}" ng-model="ctrl.credentials.password">
  24 + </div>
  25 + <div class="form-inline">
  26 + <div class="checkbox-nice">
  27 + <input type="checkbox" id="keep-logged">
  28 + <label for="keep-logged">
  29 + {{"auth.form.keepLoggedIn" | translate}}
  30 + </label>
  31 + </div>
24 </div> 32 </div>
25 <button type="submit" class="btn btn-default" ng-click="ctrl.login()">{{"auth.form.login_button" | translate}}</button> 33 <button type="submit" class="btn btn-default" ng-click="ctrl.login()">{{"auth.form.login_button" | translate}}</button>
26 </form> 34 </form>
27 -</div>  
28 \ No newline at end of file 35 \ No newline at end of file
  36 +</div>
src/app/layout/blocks/person-tags-plugin-interests/index.ts 0 → 100644
@@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
  1 +/* Module Index Entry - generated using the script npm run generate-index */
  2 +export * from "./person-tags-plugin-interests-block.component";
src/app/layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.component.spec.ts 0 → 100644
@@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
  1 +import {TestComponentBuilder} from 'ng-forward/cjs/testing/test-component-builder';
  2 +import {Provider, Input, provide, Component} from 'ng-forward';
  3 +import {provideFilters} from '../../../../spec/helpers';
  4 +import {PersonTagsPluginInterestsBlockComponent} from './person-tags-plugin-interests-block.component';
  5 +import * as helpers from "./../../../../spec/helpers";
  6 +
  7 +const htmlTemplate: string = '<noosfero-person-tags-plugin-interests-block [block]="ctrl.block" [owner]="ctrl.owner"></noosfero-person-tags-plugin-interests-block>';
  8 +
  9 +const tcb = new TestComponentBuilder();
  10 +
  11 +describe("Components", () => {
  12 + describe("Person Tags Interests Block Component", () => {
  13 +
  14 + let settingsObj = {};
  15 + let person = <noosfero.Person>{ name: "Person" };
  16 + let mockedService = {
  17 + getTags: (profile: noosfero.Profile): any => {
  18 + return Promise.resolve({ data: ['foo', 'bar'], headers: (name: string) => { return name; } });
  19 + }
  20 + };
  21 + beforeEach(angular.mock.module("templates"));
  22 +
  23 + let state = jasmine.createSpyObj("state", ["go"]);
  24 +
  25 +
  26 + function getProviders() {
  27 + return [
  28 + new Provider('$state', { useValue: state }),
  29 + new Provider('PersonService', {
  30 + useValue: mockedService
  31 + })
  32 + ].concat(provideFilters("truncateFilter", "stripTagsFilter"));
  33 + }
  34 + let componentClass: any = null;
  35 +
  36 + function getComponent() {
  37 + @Component({ selector: 'test-container-component', template: htmlTemplate, directives: [PersonTagsPluginInterestsBlockComponent], providers: getProviders() })
  38 + class BlockContainerComponent {
  39 + block = { type: 'Block', settings: settingsObj };
  40 + owner = person;
  41 + constructor() {
  42 + }
  43 + }
  44 + return BlockContainerComponent;
  45 + }
  46 +
  47 + it("get tags from the person service", done => {
  48 + tcb.createAsync(getComponent()).then(fixture => {
  49 + let PersonTagsPluginInterestsBlock: PersonTagsPluginInterestsBlockComponent = fixture.debugElement.componentViewChildren[0].componentInstance;
  50 + expect(PersonTagsPluginInterestsBlock.tags).toEqual(['foo', 'bar']);
  51 + done();
  52 + });
  53 + });
  54 +
  55 + });
  56 +});
src/app/layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.component.ts 0 → 100644
@@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
  1 +import {Component, Inject, Input} from "ng-forward";
  2 +import {PersonService} from "./../../../../lib/ng-noosfero-api/http/person.service";
  3 +import {Arrays} from "./../../../../lib/util/arrays";
  4 +
  5 +@Component({
  6 + selector: "noosfero-person-tags-plugin-interests-block",
  7 + templateUrl: 'app/layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.html'
  8 +})
  9 +@Inject(PersonService, "$state")
  10 +export class PersonTagsPluginInterestsBlockComponent {
  11 +
  12 + @Input() block: any;
  13 + @Input() owner: any;
  14 +
  15 + profile: any;
  16 + tags: any;
  17 +
  18 + constructor(private personService: PersonService, private $state: any) { }
  19 +
  20 + ngOnInit() {
  21 + this.profile = this.owner;
  22 + this.tags = [];
  23 + this.personService.getTags(this.owner).then((result: noosfero.RestResult<any>) => {
  24 + this.tags = result.data;
  25 + });
  26 + }
  27 +}
src/app/layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.html 0 → 100644
@@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
  1 +<ul class="person-tags-plugin-interests">
  2 + <li ng-repeat="tag in ctrl.tags">{{tag}}</li>
  3 +</ul>
src/app/layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.scss 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +.person-tags-plugin-interests {
  2 + padding: 0;
  3 + margin: 0;
  4 +
  5 + li {
  6 + list-style: none;
  7 + float: left;
  8 + padding: 5px;
  9 + margin: 5px;
  10 + text-transform: lowercase;
  11 + color: #fff;
  12 + background-color: #1E96D0;
  13 + }
  14 +}
src/app/layout/boxes/boxes.scss
1 .col-md-2-5 { 1 .col-md-2-5 {
2 @extend .col-md-3; 2 @extend .col-md-3;
3 - @media (min-width: 920px) { 3 + @media (min-width: 992px) {
4 width: 20.83%; 4 width: 20.83%;
5 } 5 }
6 } 6 }
src/app/layout/scss/_forms.scss 0 → 100644
@@ -0,0 +1,36 @@ @@ -0,0 +1,36 @@
  1 +label {
  2 + cursor: pointer;
  3 +}
  4 +
  5 +.checkbox-nice {
  6 + position: relative;
  7 + padding-left: 15px;
  8 +
  9 + input[type=checkbox] {
  10 + visibility: hidden;
  11 + }
  12 + label {
  13 + padding-top: 3px;
  14 + }
  15 + &.checkbox-inline > label {
  16 + margin-left: 16px;
  17 + }
  18 + label:before {
  19 + @include checkbox-mark(22px, 22px, 1px, 1px, #ffffff, 2px solid $main-bg-color);
  20 + @include border-radius(3px);
  21 + }
  22 + label:after {
  23 + @include checkbox-mark(12px, 7px, 7px, 6px, transparent, 3px solid #000);
  24 + @include opacity(0);
  25 +
  26 + border-top: none;
  27 + border-right: none;
  28 + transform: rotate(-45deg);
  29 + }
  30 + label:hover::after {
  31 + @include opacity(0.3);
  32 + }
  33 + input[type=checkbox]:checked + label:after {
  34 + @include opacity(1);
  35 + }
  36 +}
src/app/layout/scss/_mixins.scss
@@ -3,3 +3,15 @@ @@ -3,3 +3,15 @@
3 border-radius: $radius; 3 border-radius: $radius;
4 background-clip: padding-box; /* stops bg color from leaking outside the border: */ 4 background-clip: padding-box; /* stops bg color from leaking outside the border: */
5 } 5 }
  6 +
  7 +@mixin checkbox-mark($width, $height, $top, $left, $bg, $border, $content: "", $cursor: pointer, $position: absolute) {
  8 + width: $width;
  9 + height: $height;
  10 + cursor: $cursor;
  11 + position: $position;
  12 + left: $left;
  13 + top: $top;
  14 + background: $bg;
  15 + content: $content;
  16 + border: $border;
  17 +}
src/app/layout/scss/skins/_whbl.scss
@@ -306,6 +306,13 @@ $whbl-font-color: #16191c; @@ -306,6 +306,13 @@ $whbl-font-color: #16191c;
306 color: white; 306 color: white;
307 } 307 }
308 308
  309 + /* Form overrides */
  310 + .checkbox-nice {
  311 + label:after {
  312 + border-color: $whbl-primary-color;
  313 + }
  314 + }
  315 +
309 } 316 }
310 .rtl.skin-whbl #content-wrapper { 317 .rtl.skin-whbl #content-wrapper {
311 border-left: 0; 318 border-left: 0;
src/app/login/login.html
@@ -4,13 +4,21 @@ @@ -4,13 +4,21 @@
4 <div class="modal-body"> 4 <div class="modal-body">
5 <form> 5 <form>
6 <div class="form-group"> 6 <div class="form-group">
7 - <label for="exampleInputEmail1">{{"auth.form.login" | translate}}</label>  
8 - <input type="text" class="form-control" id="exampleInputEmail1" placeholder="Login / Email" ng-model="vm.credentials.username"> 7 + <label for="email">{{"auth.form.login" | translate}}</label>
  8 + <input type="text" class="form-control" id="email" placeholder="{{'auth.form.login' | translate}}" ng-model="vm.credentials.username">
9 </div> 9 </div>
10 <div class="form-group"> 10 <div class="form-group">
11 - <label for="exampleInputPassword1">{{"auth.form.password" | translate}}</label>  
12 - <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password" ng-model="vm.credentials.password"> 11 + <label for="passwd">{{"auth.form.password" | translate}}</label>
  12 + <input type="password" class="form-control" id="passwd" placeholder="{{'auth.form.password' | translate}}" ng-model="vm.credentials.password">
13 </div> 13 </div>
14 - <button type="submit" class="btn btn-default" ng-click="vm.login()">{{"auth.form.login_button" | translate}}</button> 14 + <div class="form-inline">
  15 + <div class="checkbox-nice">
  16 + <input type="checkbox" id="keep-logged">
  17 + <label for="keep-logged">
  18 + {{"auth.form.keepLoggedIn" | translate}}
  19 + </label>
  20 + </div>
  21 + </div>
  22 + <button type="submit" class="btn btn-default btn-block" ng-click="vm.login()">{{"auth.form.login_button" | translate}}</button>
15 </form> 23 </form>
16 </div> 24 </div>
src/app/login/login.scss 0 → 100644
@@ -0,0 +1,43 @@ @@ -0,0 +1,43 @@
  1 +.modal-content {
  2 + padding: 40px;
  3 + .modal-header {
  4 + border-bottom: 0;
  5 + text-align: center;
  6 + }
  7 + form {
  8 + margin-bottom: 30px;
  9 + button {
  10 + margin-top: 20px;
  11 + text-transform: uppercase;
  12 + }
  13 + }
  14 +}
  15 +
  16 +.strike {
  17 + display: block;
  18 + text-align: center;
  19 + overflow: hidden;
  20 + white-space: nowrap;
  21 + padding: 25px 0;
  22 + > span {
  23 + position: relative;
  24 + display: inline-block;
  25 + text-transform: uppercase;
  26 + }
  27 + > span:before, > span:after {
  28 + content: "";
  29 + position: absolute;
  30 + top: 50%;
  31 + width: 9999px;
  32 + height: 1px;
  33 + background: black;
  34 + }
  35 + > span:before {
  36 + right: 100%;
  37 + margin-right: 15px;
  38 + }
  39 + > span:after {
  40 + left: 100%;
  41 + margin-left: 15px;
  42 + }
  43 +}
src/app/main/main.component.ts
@@ -17,6 +17,7 @@ import {RecentDocumentsBlockComponent} from &quot;../layout/blocks/recent-documents/r @@ -17,6 +17,7 @@ import {RecentDocumentsBlockComponent} from &quot;../layout/blocks/recent-documents/r
17 import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component"; 17 import {ProfileImageBlockComponent} from "../layout/blocks/profile-image/profile-image-block.component";
18 import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component"; 18 import {RawHTMLBlockComponent} from "../layout/blocks/raw-html/raw-html-block.component";
19 import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component"; 19 import {StatisticsBlockComponent} from "../layout/blocks/statistics/statistics-block.component";
  20 +import {PersonTagsPluginInterestsBlockComponent} from "../layout/blocks/person-tags-plugin-interests/person-tags-plugin-interests-block.component";
20 import {CustomContentComponent} from "../profile/custom-content/custom-content.component"; 21 import {CustomContentComponent} from "../profile/custom-content/custom-content.component";
21 22
22 import {MembersBlockComponent} from "../layout/blocks/members/members-block.component"; 23 import {MembersBlockComponent} from "../layout/blocks/members/members-block.component";
@@ -85,7 +86,7 @@ export class EnvironmentContent { @@ -85,7 +86,7 @@ export class EnvironmentContent {
85 * @name main.Main 86 * @name main.Main
86 * @requires AuthService, Session, Notification, ArticleBlog, ArticleView, Boxes, Block, LinkListBlock, 87 * @requires AuthService, Session, Notification, ArticleBlog, ArticleView, Boxes, Block, LinkListBlock,
87 * MainBlock, RecentDocumentsBlock, Navbar, ProfileImageBlock, MembersBlock, 88 * MainBlock, RecentDocumentsBlock, Navbar, ProfileImageBlock, MembersBlock,
88 - * NoosferoTemplate, DateFormat, RawHTMLBlock 89 + * NoosferoTemplate, DateFormat, RawHTMLBlock, PersonTagsPluginInterestsBlock
89 * @description 90 * @description
90 * The Main controller for the Noosfero Angular Theme application. 91 * The Main controller for the Noosfero Angular Theme application.
91 * 92 *
@@ -104,7 +105,7 @@ export class EnvironmentContent { @@ -104,7 +105,7 @@ export class EnvironmentContent {
104 MainBlockComponent, RecentDocumentsBlockComponent, Navbar, SidebarComponent, ProfileImageBlockComponent, 105 MainBlockComponent, RecentDocumentsBlockComponent, Navbar, SidebarComponent, ProfileImageBlockComponent,
105 MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, StatisticsBlockComponent, 106 MembersBlockComponent, NoosferoTemplate, DateFormat, RawHTMLBlockComponent, StatisticsBlockComponent,
106 LoginBlockComponent, CustomContentComponent, PermissionDirective, SearchFormComponent, SearchComponent, 107 LoginBlockComponent, CustomContentComponent, PermissionDirective, SearchFormComponent, SearchComponent,
107 - BlockComponent 108 + PersonTagsPluginInterestsBlockComponent, BlockComponent
108 ].concat(plugins.mainComponents).concat(plugins.hotspots), 109 ].concat(plugins.mainComponents).concat(plugins.hotspots),
109 providers: [AuthService, SessionService, NotificationService, BodyStateClassesService, 110 providers: [AuthService, SessionService, NotificationService, BodyStateClassesService,
110 "ngAnimate", "ngCookies", "ngStorage", "ngTouch", 111 "ngAnimate", "ngCookies", "ngStorage", "ngTouch",
src/languages/en.json
@@ -21,9 +21,10 @@ @@ -21,9 +21,10 @@
21 "activities.create_article.description": "has published on", 21 "activities.create_article.description": "has published on",
22 "activities.add_member_in_community.description": "has joined the community", 22 "activities.add_member_in_community.description": "has joined the community",
23 "activities.new_friendship.description": "has made {friends, plural, one{one new friend} other{# new friends}}:", 23 "activities.new_friendship.description": "has made {friends, plural, one{one new friend} other{# new friends}}:",
24 - "auth.title": "Login",  
25 - "auth.form.login": "Login / Email address", 24 + "auth.title": "Great to have you back!",
  25 + "auth.form.login": "Username or Email address",
26 "auth.form.password": "Password", 26 "auth.form.password": "Password",
  27 + "auth.form.keepLoggedIn": "Keep me logged in",
27 "auth.form.login_button": "Login", 28 "auth.form.login_button": "Login",
28 "navbar.content_viewer_actions.new_item": "New Item", 29 "navbar.content_viewer_actions.new_item": "New Item",
29 "navbar.profile_actions.new_item": "New Item", 30 "navbar.profile_actions.new_item": "New Item",
src/languages/pt.json
@@ -21,9 +21,10 @@ @@ -21,9 +21,10 @@
21 "activities.create_article.description": "publicou em", 21 "activities.create_article.description": "publicou em",
22 "activities.add_member_in_community.description": "entrou na comunidade", 22 "activities.add_member_in_community.description": "entrou na comunidade",
23 "activities.new_friendship.description": "fez {friends, plural, one{um novo amigo} other{# novos amigos}}:", 23 "activities.new_friendship.description": "fez {friends, plural, one{um novo amigo} other{# novos amigos}}:",
24 - "auth.title": "Login",  
25 - "auth.form.login": "Login / Email", 24 + "auth.title": "Legal ter você de volta!",
  25 + "auth.form.login": "Nome de usuário ou Email",
26 "auth.form.password": "Senha", 26 "auth.form.password": "Senha",
  27 + "auth.form.keepLoggedIn": "Continuar logado",
27 "auth.form.login_button": "Login", 28 "auth.form.login_button": "Login",
28 "navbar.content_viewer_actions.new_item": "Novo Item", 29 "navbar.content_viewer_actions.new_item": "Novo Item",
29 "navbar.profile_actions.new_item": "Novo Item", 30 "navbar.profile_actions.new_item": "Novo Item",
src/lib/ng-noosfero-api/http/person.service.ts
1 import { Injectable, Inject } from "ng-forward"; 1 import { Injectable, Inject } from "ng-forward";
2 import {RestangularService} from "./restangular_service"; 2 import {RestangularService} from "./restangular_service";
  3 +import {ProfileService} from "./profile.service";
3 4
4 @Injectable() 5 @Injectable()
5 -@Inject("Restangular", "$q", "$log") 6 +@Inject("Restangular", "$q", "$log", ProfileService)
6 export class PersonService extends RestangularService<noosfero.Person> { 7 export class PersonService extends RestangularService<noosfero.Person> {
7 8
8 - constructor(Restangular: restangular.IService, $q: ng.IQService, $log: ng.ILogService) { 9 + constructor(Restangular: restangular.IService, $q: ng.IQService, $log: ng.ILogService, protected profileService: ProfileService) {
9 super(Restangular, $q, $log); 10 super(Restangular, $q, $log);
10 } 11 }
11 12
@@ -20,4 +21,11 @@ export class PersonService extends RestangularService&lt;noosfero.Person&gt; { @@ -20,4 +21,11 @@ export class PersonService extends RestangularService&lt;noosfero.Person&gt; {
20 }; 21 };
21 } 22 }
22 23
  24 + getTags(profile: noosfero.Profile): ng.IPromise<noosfero.RestResult<any>> {
  25 + let p = this.getElement(<number>profile.id).customGET('tags');
  26 + let deferred = this.$q.defer<noosfero.RestResult<any>>();
  27 + p.then(this.getHandleSuccessFunction<noosfero.RestResult<any>>(deferred));
  28 + p.catch(this.getHandleErrorFunction<noosfero.RestResult<any>>(deferred));
  29 + return deferred.promise;
  30 + }
23 } 31 }
src/lib/ng-noosfero-api/http/restangular_service.ts
@@ -79,7 +79,7 @@ export abstract class RestangularService&lt;T extends noosfero.RestModel&gt; { @@ -79,7 +79,7 @@ export abstract class RestangularService&lt;T extends noosfero.RestModel&gt; {
79 } 79 }
80 } 80 }
81 return { 81 return {
82 - data: response.data[dataKey], 82 + data: (response.data[dataKey] || response.data),
83 headers: response.headers 83 headers: response.headers
84 }; 84 };
85 }; 85 };