Skip to content

Commit

Permalink
Removed /#/ from URLs, fixes #21
Browse files Browse the repository at this point in the history
  • Loading branch information
DSpeichert committed Jan 7, 2015
1 parent 4b3e2fb commit ab70c0f
Show file tree
Hide file tree
Showing 16 changed files with 70 additions and 61 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,20 @@ Requirements
* PHP MySQL NATIVE DRIVER (mysqlnd) extension (or [this](http://forumsarchive.laravel.io/viewtopic.php?pid=58151) will happen)
* PHP APC or APCu extension (if you want ```plugins/ratelimiter.php``` to work)

Installation (zip-bundle release)
Installation (zip-bundle release) - stable
=====
* Download zip-bundle release from [GitHub](https://github.com/DevelopersPL/DevAAC/releases) (green button)
* Unpack to a directory higher then your web root, so that public_html is the web root (you can rename it if you need)
* If you use nginx, you can find sample vhost config [in our wiki](https://github.com/DevelopersPL/DevAAC/wiki)
* Web server MUST be configured to serve public_html as Document Root, DevAAC won't work in a subdirectory!
* Rename ```config.sample.php``` to ```config.php``` and follow instructions in it

Installation (dev release)
Installation (development)
=====
* [Get composer](https://getcomposer.org/download) ```curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin```
* Clone this repo: ```git clone https://github.com/DevelopersPL/DevAAC.git```
* Install dependencies: ```composer.phar install```
* Set up your web server to serve DevAAC/public_html as document root and [required rewrites](https://github.com/DevelopersPL/DevAAC/wiki)
* Set up your web server to serve DevAAC/public_html as document root and add [required rewrites](https://github.com/DevelopersPL/DevAAC/wiki)
* Rename ```config.sample.php``` to ```config.php``` and follow instructions

REST API
Expand Down
5 changes: 3 additions & 2 deletions public_html/.htaccess
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
DirectoryIndex index.html index.php

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^/api/ /index.php [L]
RewriteRule . /index.html [L]
11 changes: 9 additions & 2 deletions public_html/DevAAC.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function PageUrl(module) {
module = module.split('/');
if (module.length == 1) return 'modules/' + module[0] + '/' + module[0] + '.html';
else return 'modules/' + module[0] + '/' + module[1] + '.html';
if (module.length == 1) return '/modules/' + module[0] + '/' + module[0] + '.html';
else return '/modules/' + module[0] + '/' + module[1] + '.html';
}
function ApiUrl(link) {
// window.location.host typically includes port
Expand Down Expand Up @@ -31,6 +31,13 @@ var Cookie = {
// Initiate DevAAC
var DevAAC = angular.module('DevAAC', ['ngRoute', 'ngResource', 'ngSanitize', 'ui.bootstrap']);

DevAAC.config(['$locationProvider', function ($locationProvider) {
$locationProvider.html5Mode({
enabled: true,
rewriteLinks: true
});
}]);

DevAAC.run(['$rootScope', '$location', 'StatusMessage', function($rootScope, $location, StatusMessage) {
$rootScope.$on('$routeChangeStart', function(e, curr, prev) {
if (curr.$$route && curr.$$route.resolve) {
Expand Down
56 changes: 28 additions & 28 deletions public_html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
.nav, .pagination, .carousel, .panel-title a { cursor: pointer; }
</style>
<!-- AngularJS -->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular-route.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular-resource.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.18/angular-sanitize.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular-route.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular-resource.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.28/angular-sanitize.js"></script>
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Bootstrap JS -->
Expand All @@ -66,30 +66,30 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a ng-show="name" class="navbar-brand ng-hidden" href="#/">{{ name }}</a>
<a ng-hide="name" class="navbar-brand" href="#/">DevAAC</a>
<a ng-show="name" class="navbar-brand ng-hidden" ng-href="/">{{ name }}</a>
<a ng-hide="name" class="navbar-brand" ng-href="/">DevAAC</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div ng-controller="NavigationController" class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li ng-class="{active:isActive('/about')}"><a href="#/about"><i class="glyphicon glyphicon-question-sign"></i> About</a></li>
<li ng-class="{active:isActive('/players/online')}"><a href="#/players/online"><i class="glyphicon glyphicon-eye-open"></i> Who is online?</a></li>
<li ng-class="{active:isActive('/highscores')}"><a href="#/highscores"><i class="glyphicon glyphicon-stats"></i> Highscores</a></li>
<li ng-class="{active:isActive('/about')}"><a href ng-href="/about"><i class="glyphicon glyphicon-question-sign"></i> About</a></li>
<li ng-class="{active:isActive('/players/online')}"><a href ng-href="/players/online"><i class="glyphicon glyphicon-eye-open"></i> Who is online?</a></li>
<li ng-class="{active:isActive('/highscores')}"><a href ng-href="/highscores"><i class="glyphicon glyphicon-stats"></i> Highscores</a></li>
<li ng-class="{active:isActive('/guilds')}"><a href="javascript://" class="dropdown-toggle" data-toggle="dropdown">
<i class="glyphicon glyphicon-link"></i> Guilds</a>
<ul class="dropdown-menu" role="menu">
<li><a href="#/guilds">Guilds List</a></li>
<li><a href="#/guilds/wars">Guilds Wars</a></li>
<li><a href ng-href="/guilds">Guilds List</a></li>
<li><a href ng-href="/guilds/wars">Guilds Wars</a></li>
</ul>
</li>
<li ng-class="{active:isActive('/houses')}"><a href="#/houses"><i class="glyphicon glyphicon-home"></i> Houses</a></li>
<li ng-class="{active:isActive('/houses')}"><a href ng-href="/houses"><i class="glyphicon glyphicon-home"></i> Houses</a></li>
</ul>
<ul ng-if="isLoggedIn()" class="nav navbar-nav navbar-right">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown">Welcome {{account.name}}!<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="#/account"><i class="glyphicon glyphicon-cog"></i> My account</a></li>
<li><a href ng-href="/account"><i class="glyphicon glyphicon-cog"></i> My account</a></li>
<li class="divider"></li>
<li><a ng-click="Logout()" href="javascript://">Logout</a></li>
</ul>
Expand All @@ -109,7 +109,7 @@
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#/account/register">Register</a></li>
<li><a href ng-href="/account/register">Register</a></li>
<li class="divider"></li>
<li><a data-toggle="modal" data-target="#lostModal" href="javascript://">Lost password?</a></li>
</ul>
Expand Down Expand Up @@ -161,7 +161,7 @@ <h4 class="modal-title" id="myModalLabel">Lost your account name or password?</h

<div class="col-sm-3" ng-controller="WidgetController">
<div class="well well-sm">
<a href="#/players/online"><h3 class="text-center"><i class="glyphicon glyphicon-user"></i> {{info.players_online_count}} / {{info.maxPlayers}} online</h3></a>
<a href ng-href="/players/online"><h3 class="text-center"><i class="glyphicon glyphicon-user"></i> {{info.players_online_count}} / {{info.maxPlayers}} online</h3></a>
</div>

<div ng-show="highExperience.length">
Expand Down Expand Up @@ -195,7 +195,7 @@ <h4 class="text-center">Top 5 players by level</h4>
</thead>
<tbody>
<tr ng-repeat="player in highExperience">
<td>{{$index+1}}. <a href="#/players/{{player.name}}">{{player.name}}</a></td>
<td>{{$index+1}}. <a href ng-href="/players/{{player.name}}">{{player.name}}</a></td>
<td><span class="label label-primary">{{player.level}}</span></td>
</tr>
</tbody>
Expand Down Expand Up @@ -232,18 +232,18 @@ <h2>Loading...</h2>
<!-- /.container -->

<!-- DevAAC core -->
<script src="DevAAC.js"></script>
<script src="/DevAAC.js"></script>
<!-- Modules (components) -->
<script src="modules/main/main.js"></script>
<script src="modules/news/news.js"></script>
<script src="modules/account/account.js"></script>
<script src="modules/highscores/highscores.js"></script>
<script src="modules/guilds/wars.js"></script>
<script src="modules/guilds/guilds.js"></script>
<script src="modules/houses/houses.js"></script>
<script src="modules/players/players.js"></script>
<script src="modules/about/about.js"></script>
<script src="modules/404/404.js"></script>
<script src="modules/server/server.js"></script>
<script src="/modules/main/main.js"></script>
<script src="/modules/news/news.js"></script>
<script src="/modules/account/account.js"></script>
<script src="/modules/highscores/highscores.js"></script>
<script src="/modules/guilds/wars.js"></script>
<script src="/modules/guilds/guilds.js"></script>
<script src="/modules/houses/houses.js"></script>
<script src="/modules/players/players.js"></script>
<script src="/modules/about/about.js"></script>
<script src="/modules/404/404.js"></script>
<script src="/modules/server/server.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion public_html/modules/404/404.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- blog entry -->
<h1>Page not found.</h1>
<p class="lead">The page you requested was not found.<br><a href="#/">Home Page</a></p>
<p class="lead">The page you requested was not found.<br><a href ng-href="/">Home Page</a></p>
2 changes: 1 addition & 1 deletion public_html/modules/account/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ <h2>Player list</h2>
</thead>
<tbody>
<tr ng-repeat="player in players">
<td><a href="#/players/{{ player.id }}">{{ player.name }}</a></td>
<td><a href ng-href="/players/{{ player.id }}">{{ player.name }}</a></td>
<td>{{ vocation(player.vocation).name }}</td>
<td>{{ player.level }}</td>
<td><button ng-click="remove(player.id)" type="button" class="btn btn-danger"><i class="glyphicon glyphicon-remove"></i> Delete</button></td>
Expand Down
2 changes: 1 addition & 1 deletion public_html/modules/account/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1 class="page-header">Register new account</h1>
</div>
<div class="checkbox">
<label>
<input type="checkbox" required> I read and understand <a href="#/about#rules">server rules</a>
<input type="checkbox" required> I read and understand <a href ng-href="/about#rules">server rules</a>
</label>
</div>
<button type="submit" id="loading-register-btn" data-loading-text="Registering account..." class="btn btn-info">Register</button>
Expand Down
4 changes: 2 additions & 2 deletions public_html/modules/guilds/guild.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1 class="page-header">Guild: {{guild.name}}</h1>
<tbody>
<tr ng-repeat="player in guild.members">
<td><strong>{{ rank(player.membership.rank_id).name }} <span ng-show="player.membership.nick">({{ player.membership.nick }})</span> <span ng-show="player.id == guild.ownerid" class="label label-primary">Leader</span></strong></td>
<td> <a href="#/players/{{player.name}}">{{ player.name }}</a> <span ng-show="player.is_online" class="label label-success">Online</span></td>
<td> <a href ng-href="/players/{{player.name}}">{{ player.name }}</a> <span ng-show="player.is_online" class="label label-success">Online</span></td>
<td>{{ player.level }}</td>
<td>{{ vocation(player.vocation).name }}</td>
</tr>
Expand All @@ -51,7 +51,7 @@ <h1 class="page-header">Guild: {{guild.name}}</h1>
</thead>
<tbody>
<tr ng-repeat="inv in guild.invitations">
<td> <a href="#/players/{{ player(inv.player_id).name }}">{{ player(inv.player_id).name }}</a> <span ng-show="player(inv.player_id).is_online" class="label label-success">Online</span></td>
<td> <a href ng-href="/players/{{ player(inv.player_id).name }}">{{ player(inv.player_id).name }}</a> <span ng-show="player(inv.player_id).is_online" class="label label-success">Online</span></td>
<td>{{ player(inv.player_id).level }}</td>
<td>{{ vocation(player(inv.player_id).vocation).name }}</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions public_html/modules/guilds/guilds.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ <h1 class="page-header">Guilds <small>there are {{ guilds.length }} on this serv
</thead>
<tbody>
<tr ng-repeat="guild in guilds | orderBy: ['online_members', 'average_level'] : true">
<td><a href="#/guilds/{{ guild.name }}">{{ guild.name }}</a></td>
<td><a href="#/players/{{ guild.owner.name }}">{{ guild.owner.name }}</a> ({{ guild.owner.level}}) <span ng-show="guild.owner.is_online" class="label label-success">Online</span></td>
<td><a href ng-href="/guilds/{{ guild.name }}">{{ guild.name }}</a></td>
<td><a href ng-href="/players/{{ guild.owner.name }}">{{ guild.owner.name }}</a> ({{ guild.owner.level}}) <span ng-show="guild.owner.is_online" class="label label-success">Online</span></td>
<td>{{ guild.online_members }} / {{ guild.members_count }}</td>
<td>{{ guild.average_level }}</td>
<td>{{ guild.creationdata | date: fullDate }}</td>
Expand Down
10 changes: 5 additions & 5 deletions public_html/modules/guilds/war.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ <h1 class="page-header">Loading...</h1>
</div>

<div ng-if="war">
<h1 class="page-header">Guild War: <a href="#/guilds/{{ war.name1 }}"><strong>{{ war.name1 }}</strong></a> vs. <a href="#/guilds/{{ war.name2 }}"><strong>{{ war.name2 }}</strong></a> <small>{{ war.guild1_kills }} - {{ war.guild2_kills }}</small></h1>
<h1 class="page-header">Guild War: <a href ng-href="/guilds/{{ war.name1 }}"><strong>{{ war.name1 }}</strong></a> vs. <a href ng-href="/guilds/{{ war.name2 }}"><strong>{{ war.name2 }}</strong></a> <small>{{ war.guild1_kills }} - {{ war.guild2_kills }}</small></h1>

<p>This guild war began at {{ war.started | moment: 'LLL' }} and ended at {{ war.ended | moment: 'LLL' }}</p>

Expand All @@ -25,8 +25,8 @@ <h3>{{ war.name1 }} kills <span class="pull-right"><strong>{{ war.guild1_kills }
</thead>
<tbody>
<tr ng-repeat="kill in war.kills | orderBy:'time' | filter:{killerguild: war.guild1}">
<td><a href="#/players/{{ kill.killer }}">{{ kill.killer }}</a> <span class="label label-primary">{{ player(kill.killer).level }}</span></td>
<td><a href="#/players/{{ kill.target }}">{{ kill.target }}</a> <span class="label label-primary">{{ player(kill.target).level }}</span></td>
<td><a href ng-href="/players/{{ kill.killer }}">{{ kill.killer }}</a> <span class="label label-primary">{{ player(kill.killer).level }}</span></td>
<td><a href ng-href="/players/{{ kill.target }}">{{ kill.target }}</a> <span class="label label-primary">{{ player(kill.target).level }}</span></td>
<td>{{ kill.time | moment: 'LLL' }}</td>
</tr>
</tbody>
Expand All @@ -45,8 +45,8 @@ <h3>{{ war.name2 }} kills <span class="pull-right"><strong>{{ war.guild2_kills }
</thead>
<tbody>
<tr ng-repeat="kill in war.kills | orderBy:'time' | filter:{killerguild: war.guild2}">
<td><a href="#/players/{{ kill.killer }}">{{ kill.killer }}</a> <span class="label label-primary">{{ player(kill.killer).level }}</span></td>
<td><a href="#/players/{{ kill.target }}">{{ kill.target }}</a> <span class="label label-primary">{{ player(kill.target).level }}</span></td>
<td><a href ng-href="/players/{{ kill.killer }}">{{ kill.killer }}</a> <span class="label label-primary">{{ player(kill.killer).level }}</span></td>
<td><a href ng-href="/players/{{ kill.target }}">{{ kill.target }}</a> <span class="label label-primary">{{ player(kill.target).level }}</span></td>
<td>{{ kill.time | moment: 'LLL' }}</td>
</tr>
</tbody>
Expand Down
4 changes: 2 additions & 2 deletions public_html/modules/guilds/wars.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ <h1 class="page-header">Wars <small>there are {{ wars.length }} on this server</
</thead>
<tbody>
<tr ng-repeat="war in wars">
<td><a href="#/guilds/{{ war.name1 }}">{{ war.name1 }}</a> are at war against <a href="#/guilds/{{ war.name2 }}">{{ war.name2 }}</a></td>
<td><a href ng-href="/guilds/{{ war.name1 }}">{{ war.name1 }}</a> are at war against <a href ng-href="/guilds/{{ war.name2 }}">{{ war.name2 }}</a></td>
<td>{{ war.started | moment: 'LLL' }}</td>
<td>{{ war.ended | moment: 'LLL' }}</td>
<td><strong>{{ war.guild1_kills }}</strong> - <strong>{{ war.guild2_kills }}</strong></td>
<td><a href="#/guilds/wars/{{ war.id }}" class="btn btn-default btn-xs">Show details</a></td>
<td><a href ng-href="/guilds/wars/{{ war.id }}" class="btn btn-default btn-xs">Show details</a></td>
</tr>
</tbody>
</table>
Expand Down
2 changes: 1 addition & 1 deletion public_html/modules/highscores/highscores.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1 class="page-header">Highscores</h1>
<tbody>
<tr ng-repeat="player in players">
<td>{{$index+1}}</td>
<td><a href="#/players/{{ player.name }}">{{ player.name }}</a></td>
<td><a href ng-href="/players/{{ player.name }}">{{ player.name }}</a></td>
<td>{{ vocation(player.vocation).name }}</td>
<td>{{ player.level }}</td>
<td>{{ player[order] | number }}</td>
Expand Down
4 changes: 2 additions & 2 deletions public_html/modules/houses/house.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h1 class="page-header">House: <span ng-hide="house">Loading...</span>{{house.na
</div>

<div ng-if="house.owner != 0">
<h3>This house is owned by <a href="#/players/{{owner.name}}">{{owner.name}}</a></h3>
<h3>This house is owned by <a href ng-href="/players/{{owner.name}}">{{owner.name}}</a></h3>
</div>

<div ng-if="house.owner == 0">
Expand All @@ -52,7 +52,7 @@ <h3 ng-if="!info.houses_auctions">This house is available for purchase!</h3>
<div class="panel-body">
<div ng-if="house.highest_bidder != 0">
<div class="alert alert-warning">
<b>Highest bid: {{house.bid | number}} gp by by: <a href="#/players/{{highest_bidder.name}}">{{highest_bidder.name}}</a></b>
<b>Highest bid: {{house.bid | number}} gp by by: <a href ng-href="/players/{{highest_bidder.name}}">{{highest_bidder.name}}</a></b>
</div>
</div>

Expand Down
Loading

0 comments on commit ab70c0f

Please sign in to comment.