Skip to content

Commit d174cb4

Browse files
customize layout and nav.
1 parent ae9f65c commit d174cb4

File tree

21 files changed

+412
-34
lines changed

21 files changed

+412
-34
lines changed

_config.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77

88
# Site Settings
99
locale : "en-US"
10-
title : "Site Title"
10+
title : "UI-Router"
1111
title_separator : "-"
12-
name : "Your Name"
13-
description : "An amazing website."
12+
name : "UI-Router"
13+
description : "State based routing for single-page web applications"
1414
url : # the base hostname & protocol for your site e.g. "https://mmistakes.github.io"
1515
baseurl : # the subpath of your site, e.g. "/blog"
16-
gh_repo :
16+
gh_repo : # Link to both github repositories?
1717
teaser : # filename of teaser fallback teaser image placed in /images/, .e.g. "500x300.png"
1818
# breadcrumbs : false # true, false (default)
1919
# words_per_minute : 200
2020
comments:
21-
provider : # false (default), "disqus", "facebook", "google-plus", custom"
21+
provider : "disqus"
2222
disqus:
2323
shortname : # https://help.disqus.com/customer/portal/articles/466208-what-s-a-shortname-
2424
facebook:
@@ -61,10 +61,10 @@ google_ad_slot :
6161

6262
# Site Author
6363
author:
64-
name : "Your Name"
65-
avatar : "bio-photo.jpg"
66-
bio : "I am an amazing person."
67-
location : "Somewhere"
64+
name : # "UI-Router"
65+
avatar : "clear.gif"
66+
bio : #
67+
location : #
6868
email :
6969
uri :
7070
bitbucket :
@@ -148,7 +148,7 @@ kramdown:
148148
# Outputting
149149
permalink: /:categories/:title/
150150
paginate: 5 # amount of posts to show
151-
paginate_path: /page:num/
151+
paginate_path: /blog/page:num/
152152
timezone: # http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
153153

154154

@@ -204,3 +204,15 @@ compress_html:
204204
clippings: all
205205
ignore:
206206
envs: development
207+
208+
collections:
209+
docs:
210+
output: true
211+
permalink: /docs/:path:output_ext
212+
213+
defaults:
214+
- scope:
215+
path: ""
216+
type: docs
217+
values:
218+
layout: docs

_data/navigation.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
# main links links
22
main:
3-
- title: "Quick-Start Guide"
4-
url: https://mmistakes.github.io/minimal-mistakes/docs/quick-start-guide/
5-
63
- title: "About"
7-
url: https://mmistakes.github.io/minimal-mistakes/
4+
url: /about
85

9-
- title: "Sample Posts"
10-
url: https://mmistakes.github.io/minimal-mistakes/year-archive/
6+
- title: "Getting started"
7+
url: /start
118

12-
- title: "Sample Pages"
13-
url: https://mmistakes.github.io/minimal-mistakes/page-archive/
9+
- title: "Docs"
10+
url: /docs
1411

15-
- title: "Sample Collections"
16-
url: https://mmistakes.github.io/minimal-mistakes/collection-archive/
12+
- title: "Blog"
13+
url: /blog

_docs/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
---
3+
4+
5+
{% assign files = site.docs %}
6+
{% for doc in site.docs %}
7+
{% if doc.path like
8+
9+
{{ doc.path }} <br>
10+
{% endfor %}

_includes/author-profile.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
{% assign author = site.data.authors[page.author] %}{% else %}{% assign author = site.author %}
55
{% endif %}
66

7+
{% if author.name %}
8+
79
<div itemscope itemtype="http://schema.org/Person">
810

911
<div class="author__avatar">
@@ -100,3 +102,5 @@ <h3 class="author__name">{{ author.name }}</h3>
100102
</ul>
101103
</div>
102104
</div>
105+
106+
{% endif %}

_includes/masthead.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@
22

33
<div class="masthead">
44
<div class="masthead__inner-wrap">
5+
6+
<div></div>
7+
58
<div class="masthead__menu">
69
<nav id="site-nav" class="greedy-nav">
710
<button><div class="navicon"></div></button>
811
<ul class="visible-links">
9-
<li class="masthead__menu-item masthead__menu-item--lg"><a href="{{ base_path }}/">{{ site.title }}</a></li>
12+
<li class="masthead__menu-item masthead__menu-item--lg">
13+
<a href="{{ base_path }}/">
14+
<img class="logo" src="/images/logos/ui-router.png">
15+
{{ site.title }}
16+
</a>
17+
</li>
1018
{% for link in site.data.navigation.main %}
1119
{% if link.url contains 'http' %}
1220
{% assign domain = '' %}

_pages/about/about.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: "About"
3+
layout: single
4+
excerpt: "UI-Router is a routing framework for single page web applications"
5+
sitemap: true
6+
permalink: /about/
7+
---
8+
9+
{% include toc icon="columns" title="About" %}
10+
11+
UI-Router is a [client-side router](#client-side-routing) for [single page web applications](https://en.wikipedia.org/wiki/Single-page_application).
12+
13+
Read about [UI-Router Features](/about/features)
14+
15+
## Supported Frameworks
16+
17+
UI-Router core is framework agnostic. We currently provide adapters for Angular 1 and Angular 2.
18+
19+
<div class="about_frameworks">
20+
<div><a href="/start/ng1"><img src="/images/logos/angular1.png"><div>Angular 1</div></a></div>
21+
<div><a href="/start/ng2"><img src="/images/logos/angular2.png"><div>Angular 2</div></a></div>
22+
</div>
23+
24+
25+
## Client-side routing
26+
27+
A client-side router updates the browser URL as the user nagivates through the single page app.
28+
Conversely, changes to the browser's URL can drive navigation of the app, enabling
29+
a user to create deep-links (i.e., bookmarks) to areas deep within the application.
30+
31+
The simplest form of client-side routing maps a screen in the app to a url. For instance, the Contacts
32+
screen might map to the url `/contacts`, while the Preferences screen might map to the url `/prefs`.
33+
34+
![contacts feature has contacts url](/images/about/contacts-url.png)

_pages/about/features.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: "UI-Router Features"
3+
layout: splash
4+
excerpt: "UI-Router features"
5+
sitemap: true
6+
permalink: /about/features
7+
---
8+
9+
{% include toc icon="columns" title="Features" %}
10+
11+
## States
12+
13+
UI-Router is state based. A state defines each logical "place" within the application.
14+
It describes the URL, UI (view or views), behavior, logical prerequisites, and data dependencies for that "place".
15+
16+
UI-Router states are hierarchical; states can be nested inside other states, forming a tree of states.
17+
Child states may inherit data and behaviors from their parent states.
18+
19+
[Read more about ui-router states](/about/states)
20+
21+
## Views
22+
23+
A state defines its UI and behavior using views. The view declares the component which should fill the
24+
parent viewport (`<ui-view>`).
25+
26+
- **Nested**: a state's view(s) can nest inside other views
27+
- **Multiple Named**: a state can define multiple named views
28+
- Named views can target any viewport, even outside the current DOM hierarchy.
29+
- This can be used to fill (or override) headers or nagivation, based on the current state.
30+
31+
## Urls
32+
33+
- **Optional**: states may have URLs, but it isn't required
34+
- after a transitioning to a state with no URL, the browser's URL does not change
35+
- **Hierarchical**: a child state's url fragment is appended to the parent state's url fragment
36+
- **Parameterized**: a url may be parameterized
37+
- when a state needs specific data (e.g., `contacts.edit` needs to know which contact to edit), the url
38+
may contain a parameter, e.g., `url: '/edit/:contactId'`
39+
40+
## Parameters
41+
42+
- **Types**
43+
- **Path**: `/foo/:fooId` matches '123' in `http://mysite.com/foo/123`
44+
- **Query**: `/foo?fooId` matches '123' in `http://mysite.com/foo?fooId=123`
45+
- **Non-url**: arbitrary parameter data may be passed programmatically
46+
- **Default Values**: a parameter may define a default value
47+
- the default parameter value is used when the parameter value is missing (from the URL, for example)
48+
- **Squash**: when a default value is found, it may be removed from the URL
49+
- if `123` is the default value for the parameter `fooId` in the state url `/foo/:fooId`, then `/foo/123` can
50+
be squashed to `/foo` in the browser's URL.
51+
- **Typed**: parameters can be typed.
52+
- Typed parameters are encoded in the URL, but converted to their native type when used in the code.
53+
- Built in types: number, boolean, date, json
54+
- **Custom Types**: custom parameter types may be defined by the user
55+
56+
57+
## Resolve Data
58+
59+
A state often requires that some data be fetched from a server-side API (often, the data to fetch is specified
60+
in a url parameter).
61+
62+
The `resolve` mechanism allows data retrieval to be a first class participant in the transition. When a state is
63+
being entered, its resolve data is fetched. If any of the resolve promises are rejected (perhaps due to a 401,
64+
404, or 500 server response from a REST API), then the transition's promise is rejected and the error hooks are
65+
invoked. This enables robust error handling for applications, and helps to avoid leaving the application in an
66+
inconsistent state.
67+
68+
- **Resolve data**:
69+
- **declarative**: A state defines what data should be fetched (generally delegating to a service)
70+
- **views**: The data is provided to the state's views
71+
- **hierarchical**: A child state (and its views) can use the parent state's resolve data
72+
- **dependency resolution**: A resolve may depend on another resolve's result within the same state
73+
74+
## Transitions
75+
76+
Navigating between parts of the application occurs by transitioning from one state to another.
77+
Transitions between states are transaction-like, i.e., they either completely succeed or completely fail.
78+
79+
- **Lifecycle**: transitions have a well defined lifecycle
80+
- **before**: before the asyc portion of a transition has begun
81+
- **start**: the transition has begun
82+
- **exit**: the transition is exiting states
83+
- **retain**: states are retained (a state was active, and is neither being exited nor entered)
84+
- **enter**: the transition is entering states
85+
- **finish**: the transition is finishing
86+
- **success/error**: after the transition is complete
87+
- **Transition Lifecycle Hooks**:
88+
- Hooks may be registered for any stage of the transition lifecycle.
89+
- Hooks can alter the transition:
90+
- **pause** the transition, waiting on some promise
91+
- **cancel** the transition
92+
- **redirect** the transition to a new target state
93+
- **match criteria**:
94+
- A hook can choose which transitions it should be applied to.
95+
- **to/from**: only run the hook if the transition is going to or coming from a specific state
96+
- **entering/exiting**: only run the hook if the transition is going to enter or exit a specific state
97+
- **criteria types**:
98+
- **state name**: the hook's match criteria can be state names, such as `banking.account`
99+
- **glob**: the criteria can be a state glob pattern, such ash `banking.**`
100+
- **callback**: the criteria can be a callback function, such as `tostate => tostate.data.requiresAuth == true`
101+

_pages/about/states.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: "About States"
3+
layout: single
4+
excerpt: ""
5+
sitemap: true
6+
permalink: /about/states
7+
---
8+
9+
The basic building block of a ui-router application is a state. A ui-router state corresponds to a
10+
"place" in the application in terms of the overall UI and navigation.
11+
Some examples of states might be "dashboard", "messages", "shoppingcart", or "viewblogpost".
12+
13+
A state (via it's views) defines how the UI looks and what it does at that "place" in the application. It
14+
can define a URL fragment that will be added to the browser's URL when the state is active. It also defines
15+
the data that the state requires, as well as how to get the data.
16+
17+
Unlike states in a traditional [*state machine*](https://en.wikipedia.org/wiki/Finite-state_machine),
18+
UI-Router states can be nested. A parent state can have multiple children states, forming a hierarchical
19+
tree of application states. Often, the child states will render their UI inside a viewport from the parent
20+
state, forming a hierarchical view tree as well.
21+
22+
Hierarchical states can be used to drill down from a more general feature to more specific one, or to implement
23+
a master/detail pattern. For instance, you might have a state called "contacts" (which renders a list of contacts),
24+
and two child states "contacts.contact" (to view a single contact) and "contacts.new" (to create a new contact).
25+
These substates share a common parent state "contacts" and may inherit data and behavior from the parent.
26+
27+
![a tree of states](/images/about/state-tree.png)
28+
29+
### State Machine and Transitions
30+
31+
UI-Router provides a state machine to transition between application states. These transitions are essentially
32+
atomic. When transitioning from state A to state B, either the *entire transition succeeds* and
33+
the application's current state is now B, or the *entire transition fails* and the application remains at state A.
34+
35+
Transitions have a lifecycle, and expose hooks for each stage of the lifecycle, which applications can tap into.
36+
37+
To learn more about transition hooks, read the API documentation for IHookRegistry.

_pages/start/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: "Getting started"
3+
layout: single
4+
sitemap: true
5+
permalink: /start/
6+
---
7+
8+
[Getting started: Angular 1](/start/ng1)
9+
10+
[Getting started: Angular 2](/start/ng2)
11+

_pages/start/ng1.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
title: "Getting started: Angular 1"
3+
layout: single
4+
excerpt: "Getting started with UI-Router for Angular 1"
5+
sitemap: true
6+
permalink: /start/ng1
7+
---
8+
9+
1. Get UI-Router for Angular 1 using your preferred mechanism:
10+
- Using npm: `npm install angular-ui-router`
11+
- Using bower: `bower install angular-ui-router`
12+
- Download directly from [npmcdn](https://npmcdn.com/[email protected]/release/angular-ui-router.js)
13+
14+
2. Add the `angular-ui-router.js` script tag after `angular.js`
15+
16+
```html
17+
<head>
18+
<script src="lib/angular.js"></script>
19+
<script src="lib/angular-ui-router.js"></script>
20+
</head>
21+
```
22+
23+
3. Create a module dependency on the `ui.router` angular module
24+
25+
```js
26+
var myApp = angular.module('myApp', ['ui.router']);
27+
```
28+
29+
4. Create two top-level states using the `$stateProvider`
30+
31+
```js
32+
myApp.config(function($stateProvider) {
33+
34+
$stateProvider.state('hello', {
35+
url: '/hello',
36+
template: '<h3>hello world!</h3>'
37+
});
38+
39+
$stateProvider.state('about', {
40+
url: '/about',
41+
template: '<h3>Its the UI-Router hello world app!</h3>'
42+
});
43+
44+
});
45+
```
46+
47+
5. Add a `<ui-view>` tag (ui-router viewport) to your HTML. When your states are activated, they
48+
will fill in this viewport.
49+
50+
```html
51+
<body ng-app="myApp">
52+
<ui-view></ui-view>
53+
</body>
54+
```
55+
56+
6. Add some `ui-sref` links, which can be used to activate your states.
57+
58+
```html
59+
<body>
60+
<a ui-sref="hello">Hello</a>
61+
<a ui-sref="about">About</a>
62+
<ui-view></ui-view>
63+
</body>
64+
```
65+
66+
### The whole thing
67+
68+
Here is a live plunker [(edit)](http://plnkr.co/edit/6eQV15?p=preview):
69+
70+
<iframe style="width: 100%; height: 600px" src="http://embed.plnkr.co/6eQV15/" frameborder="0" allowfullscren="allowfullscren"></iframe>
71+

0 commit comments

Comments
 (0)