Steps to use the template:
- Clone the template locally
- Replace angular.rtl with your project's name across the following files:
- index.html
- I swear I thought there were gonna be more files.
- Modify the
baseurlin deploy.ps1 (bash alternative yet to be provided) - Have a look at the
styles.cssto use the many classes to your advantage.
- To generate files for deployment, open up a terminal in the folder containing this README file and run
bash deploy.sh https://www.isid.ac.in/~testdeploy, replacinghttps://www.isid.ac.in/~testdeploywith the URL where the site is to be deployed. - Once this command succeeds, copy the files and folders from the folder called
deployto the folder calledpublic_htmlin the server. - A modification to the server to redirect any URLs not found to the 404.html page for our site specifically is necessary.
- Updates to existing pages such involving text and images can be accomplished by navigating to the
relevant file in the
src/datafolder and updating the content in the JSON dictionaries. - Note that any new images are to be placed in the assets folder (or a subdirectory) and its path used in the appropriate data file.
Paraspec components are meant to render paragraphs, images, lists and links. The only allowed combinations of fields being used at once are:
- text
- list
- image
- text and image
- list and image
- internalLink The reverse field (set to true or false) handles the layout of images when they are together with a list or a text.
Ex: The following paraspec will fail to render the list because list and text together are not allowed:
{
text:`Sample text`,
list:[
`item 1`,
`item 2`
]
}
Instead, use the following code:
{
text:`Sample text`
},
{
list:[
`item 1`,
`item 2`
]
}
There are two aspects to navigation
- Telling the framework that you want a particular URL to route to a particular page
- Writing links in other pages that be used to route that URL.
The NavBarRoutes in data/navigation.ts handle 1 and 2 the moment you update them. They are used by the function getAllRoutes to
setup the URL to page mapping by the framework and used by the
navbar component to render the navigation bar.
The footerRoutes work similar, displaying the routes in the footer.
The personRoutes list routes for individual faculty pages.
The otherRoutes are dicussed later.
These routes are lists of a an object type routeSpec Its fields
are described below:
{
label:`The label displayed when this route is rendered`,
route:`The path at which this page is shown`,
children:[
//other routeSpec objects. When children are given,
//the component field is not used. And the button
//in the navbar displays a dropdown of the routes
//corresponding to the children.
],
component:TheComponentWhichRendersThePage
//this component field is not used
//if children are supplied.
}
Note that you can have routeSpecs where neither children nor
component are specified if the route is an external link,
ex:
{
label:`Discussion Papers`,
route:`https://ideas.repec.org/s/alo/isipdp.html`
}
The getAllRoutes function also uses routes called miscRoutes;
these are from the miscroutes.ts file. These are routes not mentioned
in the NavBarRoutes, footerRoutes, otherRoutes and personRoutes.
That means that only (1) has been done for these routes; they exist
in the website but are not made visible to the client anywhere.
To use these routes (or any of the other routes), we can either
- (Recommended) Use an anchor tag in the text field of a paraSpec (or some other component where text is allowed):
You can find the past phd students here:
<a href="misc/pastphdstudents">
Past Phd Students
</a>
Note that misc/pastphdstudents is the value of the route: field the routeSpec
that establishes that misc/pastphdstudents must display the PastPhdStudentsComponent
in the miscroutes.ts file.
- In a paraSpec, we can use the
internalLinkfield:
{
text:`You can find the past phd students here:`
},
{
internalLink:miscRoutes['pastPhdStudents']
}
Here, we have passed the entire routeSpec related to the past PhD students page
to the internalLink field. We could also duplicate information (thought this is
not preferred as the updates will have to be more carefully done):
{
text:`You can find the past phd students here:`
},
{
internalLink:{
route:'misc/pastphdstudents',
component:PastPhdStudentsComponent,
label:'Past Phd Students'
}
}
The site also allows you to create new pages without going into the intricacies of Angular and HTML.
You simply have to add a new entry to othersData, located in
the otherspage.ts file.
Have a look at the page at http://localhost:4200/misc/others/demo to
see how this will be rendered.
For example, say I want to add a new page discussing something about COVID-19. This is what the othersData dictionary will look like:
export const othersData:othersSpec = {
demo:{
...
//pre existing code for demo page
},
//the `key` = covid19 makes sure that
//the path misc/others/covid19 routes to
//a page where the the data listed below is
//displayed
covid19:{
title:`New Page about COVID-19`,
groups:[
//groups conveying info about COVID-19
//look at the groups in the demo page
//to understand how they are used
//and rendered.
]
}
}
This project was generated with Angular CLI version 15.1.3.
Run ng serve for a dev server. Navigate to http://localhost:4200/. The application will automatically reload if you change any of the source files.
Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.
Run ng build to build the project. The build artifacts will be stored in the dist/ directory.
Run ng test to execute the unit tests via Karma.
Run ng e2e to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.