Created
August 8, 2017 14:11
-
-
Save cbfranca/eb63509d9cb3f5b8c14da8708206188b to your computer and use it in GitHub Desktop.
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
<link rel="import" href="../../bower_components/juicy-html/juicy-html.html"> | |
<link rel="import" href="../../src/shared-elements/cr-styles/cr-shared-styles.html"> | |
<dom-module id="club-realty"> | |
<template> | |
<style include="cr-shared-styles"></style> | |
<app-location id="location" route="{{route}}"></app-location> | |
<app-route route="{{route}}" pattern="/:page" data="{{routeData}}" tail="{{subroute}}"></app-route> | |
<app-route route="{{subroute}}" pattern="/:id" data="{{subrouteData}}" tail={{another}}></app-route> | |
<app-route route="{{another}}" pattern="/:id" data="{{anotherData}}"></app-route> | |
<div class="page"> | |
<iron-lazy-pages selected="[[routeData.page]]" attr-for-selected="data-route" fallback-selection="404"> | |
<template is="dom-repeat" items="{{routes}}"> | |
<template is="iron-lazy-page" data-route="[[item.route]]" path="[[item.path]]"> | |
<template is="dom-if" if="[[!item.hasSubroute]]"> | |
<template is="juicy-html" content$="[[item.content]]"></template> | |
</template> | |
<template is="dom-if" if="[[item.hasSubroute]]"> | |
<template is="juicy-html" content$="{{_getContent(item.content, subrouteData.id, anotherData)}}"></template> | |
</template> | |
</template> | |
</template> | |
</iron-lazy-pages> | |
</div> | |
</template> | |
</dom-module> | |
<script type="text/javascript" src="club-realty.js"></script> |
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
@component("club-realty") | |
class ClubRealty extends polymer.Base { | |
@property({ type: Object, observer: '_routeChanged' }) | |
private route: any; | |
private routes: object[]; | |
constructor() { | |
super(); | |
this.routes = RouteConfig.ROUTES; | |
} | |
private _getContent (item: any, id: any, secondId?: any): string { | |
return secondId ? item.replace('{{id}}', id).replace('{{anotherId}}', secondId.id) : item.replace('{{id}}', id); | |
} | |
private _routeChanged (): void { | |
RouteConfig.CurrentRoute = this.route.path; | |
} | |
} | |
ClubRealty.register(); |
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
class RouteConfig { | |
public static get ROUTES (): object[] { | |
return [ | |
{ | |
route: "", | |
path: "/src/public/landing-page/cr-landing-page/cr-landing-page.html", | |
content: "<cr-landing-page></cr-landing-page>", | |
}, | |
{ | |
route: "login", | |
path: "/src/login/cr-login/cr-login.html", | |
content: "<cr-login></cr-login>", | |
}, | |
{ | |
route: "create-login", | |
path: "/src/login/cr-login-create/cr-login-create.html", | |
content: "<cr-login-create></cr-login-create>", | |
}, | |
{ | |
route: "about", | |
path: "/src/public/landing-page/cr-landing-page/cr-landing-page.html", | |
content: "<cr-landing-page></cr-landing-page>", | |
}, | |
{ | |
route: "realtor", | |
path: "/src/public/landing-page/cr-landing-page-realtor/cr-landing-page-realtor.html", | |
content: "<cr-landing-page-realtor></cr-landing-page-realtor>", | |
}, | |
{ | |
route: "home", | |
path: "/src/home/cr-home/cr-home.html", | |
content: "<cr-header></cr-header><cr-home></cr-home><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "manage-property", | |
path: "/src/property/cr-manage-property/cr-manage-property.html", | |
content: "<cr-header></cr-header><cr-manage-property></cr-manage-property><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "new-register-property", | |
path: "/src/property/cr-register-property/cr-register-property-new/cr-register-property-new.html", | |
content: "<cr-header></cr-header><cr-register-property-new></cr-register-property-new><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "edit-register-property", | |
path: "/src/property/cr-register-property/cr-register-property-edit/cr-register-property-edit.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-register-property-edit route='{{id}}'></cr-register-property-edit><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "register-property-images", | |
path: "/src/property/cr-register-property/cr-register-property-images/cr-register-property-images.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-register-property-images route='{{id}}'></cr-register-property-images><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "register-property-videos", | |
path: "/src/property/cr-register-property/cr-register-property-videos/cr-register-property-videos.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-register-property-videos route='{{id}}'></cr-register-property-videos><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "register-property-rents", | |
path: "/src/property/cr-register-property/cr-register-property-rents/cr-register-property-rents.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-register-property-rents route='{{id}}'></cr-register-property-rents><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "property-detail", | |
path: "/src/property/cr-property-detail/cr-property-detail.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-property-detail route='{{id}}'></cr-property-detail><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "user-edit", | |
path: "/src/user/cr-user-edit/cr-user-edit.html", | |
content: "<cr-header></cr-header><cr-user-edit></cr-user-edit><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "contact", | |
path: "/src/user/cr-contact/cr-contact.html", | |
content: "<cr-header></cr-header><cr-contact></cr-contact><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "doubts-suggestions", | |
path: "/src/cr-doubts-suggestions/cr-doubts-suggestions.html", | |
content: "<cr-header></cr-header><cr-doubts-suggestions></cr-doubts-suggestions><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "send-invitation", | |
path: "/src/cr-send-invitation/cr-send-invitation.html", | |
content: "<cr-header></cr-header><cr-send-invitation></cr-send-invitation><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "property-detail", | |
path: "/src/property/cr-property-detail/cr-property-detail.html", | |
content: "<cr-header></cr-header><cr-property-detail></cr-property-detail><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "property-search", | |
path: "/src/property/cr-property-search/cr-property-search.html", | |
content: "<cr-header></cr-header><cr-property-search></cr-property-search><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "manage-property", | |
path: "/src/property/cr-manage-property/cr-manage-property.html", | |
content: "<cr-header></cr-header><cr-manage-property></cr-manage-property><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "put-property-for-sale", | |
path: "/src/property/cr-put-property-sale/cr-put-property-sale.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-put-property-sale realty-id='{{id}}'></cr-put-property-sale><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "send-documents-property-sale", | |
path: "/src/property/cr-put-property-sale/cr-send-documents-property-sale/cr-send-documents-property-sale.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-send-documents-property-sale realty-id='{{id}}'></cr-send-documents-property-sale><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "property-trade", | |
path: "/src/property/property-trade/cr-property-trade/cr-property-trade.html", | |
content: "<cr-header></cr-header><cr-property-trade></cr-property-trade><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "invest-in-property", | |
path: "/src/property/property-invest/cr-property-invest/cr-property-invest.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-property-invest realty-id='{{id}}'></cr-property-invest><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "invest-in-property-amount", | |
path: "/src/property/property-invest/cr-property-invest-amount/cr-property-invest-amount.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-property-invest-amount realty-id='{{id}}' realty-sale-id='{{anotherId}}'></cr-property-invest-amount><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "invest-in-property-agreement", | |
path: "/src/property/property-invest/cr-property-invest-agreement/cr-property-invest-agreement.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-property-invest-agreement realty-id='{{id}}' realty-sale-id='{{anotherId}}'></cr-property-invest-agreement><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "invest-in-property-finish", | |
path: "/src/property/property-invest/cr-property-invest-success/cr-property-invest-success.html", | |
content: "<cr-header></cr-header><cr-property-invest-success></cr-property-invest-success><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "invest-in-property-contact", | |
path: "/src/property/property-invest/cr-property-invest-contact/cr-property-invest-contact.html", | |
hasSubroute: true, | |
content: "<cr-header></cr-header><cr-property-invest-contact realty-id='{{id}}'></cr-property-invest-contact><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "comparator", | |
path: "/src/comparator/cr-comparator.html", | |
content: "<cr-header></cr-header><cr-comparator></cr-comparator><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "crslider", | |
path: "/src/shared-elements/cr-slider/cr-slider.html", | |
content: "<cr-header></cr-header><cr-slider></cr-slider><cr-footer></cr-footer>", | |
}, | |
{ | |
route: "404", | |
path: "/src/cr-error-404/cr-error-404.html", | |
content: "<cr-error-404></cr-error-404>", | |
}, | |
]; | |
} | |
public static CurrentRoute: string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment