Browse Source

Many assorted fixes on the fronted, fixup previous commit slightly

Fixes #104 and fixes #102
Bojidar Marinov 8 years ago
parent
commit
c47cf0b25b

+ 1 - 0
.editorconfig

@@ -5,6 +5,7 @@ root = true
 [*]
 end_of_line = lf
 insert_final_newline = true
+trim_trailing_whitespace = true
 charset = utf-8
 
 # CSS

+ 13 - 14
src/Helpers/Utils.php

@@ -19,37 +19,37 @@ class Utils
         if (is_int($provider)) {
             $provider = $this->c->constants['download_provider'][$provider];
         }
-        $warning_suffix = "Please, ensure that the URL and the repository provider are, indeed, correct.";
+        $warning_suffix = "Please, ensure that the URL and the repository provider are correct.";
         $light_warning_suffix = "Please, doublecheck that the URL and the repository provider are correct.";
         switch ($provider) {
             case 'GitHub':
                 if (sizeof(preg_grep('/^https:\/\/github\.com\/[^\/]+?\/[^\/]+?$/', [$repo_url])) == 0) {
-                    $warning = "\"$repo_url\" doesn't look correct; it should be similar to \"https://github.com/<owner>/<name>\". $warning_suffix";
+                    $warning .= "\"$repo_url\" doesn't look correct; it should be similar to \"https://github.com/<owner>/<name>\". $warning_suffix\n";
                 }
                 return "$repo_url/archive/$commit.zip";
             case 'GitLab':
                 if (sizeof(preg_grep('/^https:\/\/(gitlab\.com|[^\/]+)\/[^\/]+?\/[^\/]+?$/', [$repo_url])) == 0) {
-                    $warning = "\"$repo_url\" doesn't look correct; it should be similar to \"https://<gitlab instance>/<owner>/<name>\". $warning_suffix";
+                    $warning .= "\"$repo_url\" doesn't look correct; it should be similar to \"https://<gitlab instance>/<owner>/<name>\". $warning_suffix\n";
                 } elseif (sizeof(preg_grep('/^https:\/\/(gitlab\.com)\/[^\/]+?\/[^\/]+?$/', [$repo_url])) == 0) {
-                    $warning = "\"$repo_url\" might not be correct; it should be similar to \"https://gitlab.com/<owner>/<name>\", unless the asset is hosted on a custom instance of GitLab. $light_warning_suffix";
+                    $warning .= "\"$repo_url\" might not be correct; it should be similar to \"https://gitlab.com/<owner>/<name>\", unless the asset is hosted on\n a custom instance of GitLab. $light_warning_suffix";
                 }
                 return "$repo_url/repository/archive.zip?ref=$commit";
             case 'BitBucket':
                 if (sizeof(preg_grep('/^https:\/\/bitbucket\.org\/[^\/]+?\/[^\/]+?$/', [$repo_url])) == 0) {
-                    $warning = "\"$repo_url\" doesn't look correct; it should be similar to \"https://bitbucket.org/<owner>/<name>\". $warning_suffix";
+                    $warning .= "\"$repo_url\" doesn't look correct; it should be similar to \"https://bitbucket.org/<owner>/<name>\". $warning_suffix\n";
                 }
                 return "$repo_url/get/$commit.zip";
             case 'Gogs':
                 if (sizeof(preg_grep('/^https?:\/\/[^\/]+?\/[^\/]+?\/[^\/]+?$/', [$repo_url])) == 0) {
-                    $warning = "\"$repo_url\" doesn't look correct; it should be similar to \"http<s>://<gogs instance>/<owner>/<name>\". $warning_suffix";
+                    $warning .= "\"$repo_url\" doesn't look correct; it should be similar to \"http<s>://<gogs instance>/<owner>/<name>\". $warning_suffix\n";
                 }
-                $warning = "Since Gogs might be self-hosted, we can't be sure that \"$repo_url\" is a valid Gogs URL. $light_warning_suffix";
+                $warning .= "Since Gogs might be self-hosted, we can't be sure that \"$repo_url\" is a valid Gogs URL. $light_warning_suffix\n";
                 return "$repo_url/archive/$commit.zip";
             case 'cgit':
                 if (sizeof(preg_grep('/^https?:\/\/[^\/]+?\/[^\/]+?\/[^\/]+?$/', [$repo_url])) == 0) {
-                    $warning = "\"$repo_url\" doesn't look correct; it should be similar to \"http<s>://<cgit instance>/<owner>/<name>\". $warning_suffix";
+                    $warning .= "\"$repo_url\" doesn't look correct; it should be similar to \"http<s>://<cgit instance>/<owner>/<name>\". $warning_suffix\n";
                 }
-                $warning = "Since cgit might be self-hosted, we can't be sure that \"$repo_url\" is a valid cgit URL. $light_warning_suffix";
+                $warning .= "Since cgit might be self-hosted, we can't be sure that \"$repo_url\" is a valid cgit URL. $light_warning_suffix\n";
                 return "$repo_url/snapshot/$commit.zip";
             default:
                 return "$repo_url/$commit.zip"; // Obviously incorrect, but we would like to have some default case...
@@ -76,8 +76,8 @@ class Utils
 
     public function getFormattedGodotVersion($internal_id, &$warning=null)
     {
-        if ($internal_id == 0) {
-            $warning = "Setting Godot version as \"unknown\" is not recommended, as it would prevent people from finding your asset easily.";
+        if ($internal_id == $this->c->constants['special_godot_versions']['unknown']) {
+            $warning .= "Setting Godot version as \"unknown\" is not recommended, as it would prevent people from finding your asset easily.\n";
         }
         if (isset($this->c->constants['special_godot_versions'][$internal_id])) {
             return $this->c->constants['special_godot_versions'][$internal_id];
@@ -124,7 +124,7 @@ class Utils
         return false;
     }
 
-    public function errorResponseIfNotOwner($currentStatus, &$response, $user, $asset_id, $message = 'You are not authorized to do this')
+    public function errorResponseIfNotOwnerOrLevel($currentStatus, &$response, $user, $asset_id, $required_level_name, $message = 'You are not authorized to do this')
     {
         if($user === false || $currentStatus) {
             return true;
@@ -141,8 +141,7 @@ class Utils
         $asset = $query->fetch();
 
         if($asset['author_id'] != $user['user_id']) {
-            $response = $response->withJson(['error' => $message], 403);
-            return true;
+            return $this->errorResponseIfNotUserHasLevel(false, $response, $user, $required_level_name, $message);
         }
 
         return false;

+ 2 - 2
src/constants.php

@@ -54,7 +54,7 @@ return $constants = [
     ],
     'special_godot_versions' => double_map([
         0 => 'unknown',
-        9999999 => 'custom'
+        9999999 => 'custom_build'
     ]),
     'common_godot_versions' => [
         '1.0',
@@ -64,6 +64,6 @@ return $constants = [
         '2.2',
         '3.0', //'3.1'
         'unknown',
-        'custom',
+        'custom_build',
     ]
 ];

+ 0 - 1
src/middleware.php

@@ -58,7 +58,6 @@ if (FRONTEND) {
             $result = [];
         }
 
-
         if (isset($result['url'])) {
             $response = new \Slim\Http\Response(303);
             $response = $response->withHeader('Location', $request->getUri()->getBasePath() . '/' . $result['url']);

+ 5 - 4
src/queries.php

@@ -100,7 +100,10 @@ return [
 
         'set_support_level' => 'UPDATE `as_assets`
             SET support_level=:support_level
-            WHERE asset_id=:asset_id'
+            WHERE asset_id=:asset_id',
+
+        'delete' => 'UPDATE `as_assets` SET searchable=FALSE WHERE asset_id=:asset_id',
+        'undelete' => 'UPDATE `as_assets` SET searchable=TRUE WHERE asset_id=:asset_id'
     ],
     'asset_edit' => [
         'get_one' => 'SELECT edit_id, `as_asset_edits`.asset_id, user_id, title, description, category_id, godot_version, version_string,
@@ -173,8 +176,6 @@ return [
             WHERE edit_id=:edit_id AND edit_preview_id=:edit_preview_id',
 
         'set_asset_id' => 'UPDATE `as_asset_edits` SET asset_id=:asset_id WHERE edit_id=:edit_id',
-        'set_status_and_reason' => 'UPDATE `as_asset_edits` SET status=:status, reason=:reason WHERE edit_id=:edit_id',
-        'delete' => 'UPDATE `as_assets` SET searchable=FALSE WHERE asset_id=:asset_id',
-        'undelete' => 'UPDATE `as_assets` SET searchable=TRUE WHERE asset_id=:asset_id'
+        'set_status_and_reason' => 'UPDATE `as_asset_edits` SET status=:status, reason=:reason WHERE edit_id=:edit_id'
     ]
 ];

+ 6 - 6
src/routes/asset.php

@@ -259,11 +259,11 @@ $app->post('/asset/{id:[0-9]+}/delete', function ($request, $response, $args) {
     $body = $request->getParsedBody();
 
     $error = $this->utils->ensureLoggedIn(false, $response, $body, $user);
-    $error = $this->utils->errorResponseIfNotOwner($error, $response, $user, $args['id']);
+    $error = $this->utils->errorResponseIfNotOwnerOrLevel($error, $response, $user, $args['id'], 'moderator');
 
     if($error) return $response;
 
-    $query = $this->queries['asset_edit']['delete'];
+    $query = $this->queries['asset']['delete'];
     $query->bindValue(':asset_id', (int) $args['id'], PDO::PARAM_INT);
     $query->execute();
 
@@ -272,7 +272,7 @@ $app->post('/asset/{id:[0-9]+}/delete', function ($request, $response, $args) {
 
     return $response->withJson([
         'changed' => true,
-        'url' => 'asset/',
+        'url' => 'asset/' . $args['id'],
     ], 200);
 });
 
@@ -284,11 +284,11 @@ $app->post('/asset/{id:[0-9]+}/undelete', function ($request, $response, $args)
     $body = $request->getParsedBody();
 
     $error = $this->utils->ensureLoggedIn(false, $response, $body, $user);
-    $error = $this->utils->errorResponseIfNotOwner($error, $response, $user, $args['id']);
+    $error = $this->utils->errorResponseIfNotOwnerOrLevel($error, $response, $user, $args['id'], 'moderator');
 
     if($error) return $response;
 
-    $query = $this->queries['asset_edit']['undelete'];
+    $query = $this->queries['asset']['undelete'];
     $query->bindValue(':asset_id', (int) $args['id'], PDO::PARAM_INT);
     $query->execute();
 
@@ -297,6 +297,6 @@ $app->post('/asset/{id:[0-9]+}/undelete', function ($request, $response, $args)
 
     return $response->withJson([
         'changed' => true,
-        'url' => 'asset/',
+        'url' => 'asset/' . $args['id'],
     ], 200);
 });

+ 11 - 6
src/routes/asset_edit.php

@@ -88,7 +88,7 @@ function _insert_asset_edit_fields($c, $error, &$response, $query, $body, $requi
         }
     }
     if (isset($body['godot_version'])) {
-        $body['godot_version'] = $c->utils->getUnformattedGodotVersion($body['godot_version']);
+        $body['godot_version'] = (string) $c->utils->getUnformattedGodotVersion($body['godot_version']);
     }
 
     foreach ($c->constants['asset_edit_fields'] as $i => $field) {
@@ -350,6 +350,8 @@ $get_edit = function ($request, $response, $args) {
         return $response;
     }
 
+    $warning = null;
+
     $output = $query->fetchAll();
 
     $previews = [];
@@ -381,8 +383,6 @@ $get_edit = function ($request, $response, $args) {
                     $asset_edit['status'] = $this->constants['edit_status'][(int) $value];
                 } elseif ($column==='download_provider') {
                     $asset_edit['download_provider'] = $this->constants['download_provider'][(int) $value];
-                }  elseif ($column==='godot_version') {
-                    $asset_edit['godot_version'] = $this->utils->getFormattedGodotVersion((int) $value);
                 } else {
                     $asset_edit[$column] = $value;
                 }
@@ -427,7 +427,7 @@ $get_edit = function ($request, $response, $args) {
                 $asset_edit['download_commit'] ?: $asset_edit['original']['download_commit'],
                 $warning
             );
-            if ($asset_edit['issues_url'] == '') {
+            if ($asset_edit['issues_url'] === '') {
                 $asset_edit['issues_url'] = $this->utils->getDefaultIssuesUrl(
                     $asset_edit['browse_url'] ?: $asset_edit['original']['browse_url'],
                     $asset_edit['download_provider'] ?: $asset_edit['original']['download_provider']
@@ -437,15 +437,20 @@ $get_edit = function ($request, $response, $args) {
             $asset_edit['download_url'] = null;
         }
 
-        $asset_edit['original']['download_url'] = $this->utils->getComputedDownloadUrl($asset_edit['original']['browse_url'], $asset_edit['original']['download_provider'], $asset_edit['original']['download_commit'], $warning);
+        if ($asset_edit['godot_version'] != null) {
+            $asset_edit['godot_version'] = $this->utils->getFormattedGodotVersion((int) $asset_edit['godot_version'], $warning);
+        }
+
+        $asset_edit['original']['download_url'] = $this->utils->getComputedDownloadUrl($asset_edit['original']['browse_url'], $asset_edit['original']['download_provider'], $asset_edit['original']['download_commit']);
 
         if ($asset_edit['original']['issues_url'] == '') {
             $asset_edit['original']['issues_url'] = $this->utils->getDefaultIssuesUrl($asset_edit['original']['browse_url'], $asset_edit['original']['download_provider']);
         }
     } else {
         $asset_edit['download_url'] = $this->utils->getComputedDownloadUrl($asset_edit['browse_url'], $asset_edit['download_provider'], $asset_edit['download_commit'], $warning);
+        $asset_edit['godot_version'] = $this->utils->getFormattedGodotVersion((int) $asset_edit['godot_version'], $warning);
 
-        if ($asset_edit['issues_url'] == '') {
+        if ($asset_edit['issues_url'] === '') {
             $asset_edit['issues_url'] = $this->utils->getDefaultIssuesUrl($asset_edit['browse_url'], $asset_edit['download_provider']);
         }
     }

+ 9 - 0
style/base.css

@@ -22,3 +22,12 @@
         }
     }
 }
+
+.required_mark::after {
+    content: ' *';
+    color: #d9534f;
+}
+.media-object {
+    overflow: hidden;
+    text-overflow: ellipsis;
+}

+ 98 - 94
templates/_asset_fields.phtml

@@ -4,6 +4,7 @@
 $_asset_values = array_merge([
     'title' => '',
     'category_id' => '0',
+    'godot_version' => 'unknown',
     'version_string' => '',
     'download_provider' => '0',
     'download_commit' => '',
@@ -16,37 +17,38 @@ $_asset_values = array_merge([
 ], $_asset_values);
 ?>
 <div class="form-group">
-        <label class="col-md-4 control-label" for="title">Asset Name</label>
+        <label class="col-md-4 control-label required_mark" for="title">Asset Name</label>
         <div class="col-md-5">
                 <input id="title" name="title" type="text" placeholder="Asset Name" class="form-control input-md" required="" value="<?php echo esc($_asset_values['title']) ?>">
-                <span class="help-block">Set the name of your asset</span>
+                <span class="help-block">The name of the asset</span>
         </div>
 </div>
 
 <div class="form-group">
-        <label class="col-md-4 control-label" for="category">Category</label>
-        <div class="col-md-5">
-                <select id="category" name="category_id" class="form-control">
-                        <?php foreach($categories as $key => $category) { ?>
-                            <option value="<?php echo esc($category['id']) ?>" <?php if($category['id'] == $_asset_values['category_id']) echo 'selected=""'; ?>>
-                                <?php echo esc($category['name']) ?>
-                            </option>
-                        <?php } ?>
-                </select>
-        </div>
+    <label class="col-md-4 control-label required_mark" for="category">Category</label>
+    <div class="col-md-5">
+        <select id="category" name="category_id" class="form-control">
+            <?php foreach($constants['category_type'] as $type => $type_name) if(is_int($type)) { ?>
+                <optgroup label="<?php echo esc(ucfirst($type_name . 's')) ?>">
+                    <?php foreach($categories as $key => $category) if($category['type'] == $type) { ?>
+                        <option value="<?php echo esc($category['id']) ?>" <?php if($category['id'] == $_asset_values['category_id']) echo 'selected=""'; ?>>
+                            <?php echo esc($category['name']) ?>
+                        </option>
+                    <?php } ?>
+                </optgroup>
+            <?php } ?>
+        </select>
+        <span class="help-block">The category the asset belongs to</span>
+    </div>
 </div>
 
 <div class="form-group">
-    <label class="col-md-4 control-label" for="version">Godot version</label>
+    <label class="col-md-4 control-label required_mark" for="godot_version">Godot version</label>
     <div class="col-md-5">
-        <select id="category" name="godot_version" class="form-control">
-            <option value="">
-                Any
-            </option>
-
+        <select id="godot_version" name="godot_version" class="form-control">
             <?php foreach($constants['common_godot_versions'] as $version) { ?>
                 <option value="<?php echo esc($version) ?>" <?php if($version == $_asset_values['godot_version']) echo 'selected=""'; ?>>
-                    <?php echo esc(ucfirst($version)) ?>
+                    <?php echo esc(ucfirst(str_replace('_', ' ', $version))) ?>
                 </option>
             <?php } ?>
         </select>
@@ -55,90 +57,92 @@ $_asset_values = array_merge([
 </div>
 
 <div class="form-group">
-        <label class="col-md-4 control-label" for="version">Version</label>
-        <div class="col-md-5">
-                <input id="version" name="version_string" type="text" placeholder="Version" class="form-control input-md" required="" value="<?php echo esc($_asset_values['version_string']) ?>">
-                <span class="help-block">Set the version of your asset</span>
-        </div>
+    <label class="col-md-4 control-label required_mark" for="version">Version</label>
+    <div class="col-md-5">
+        <input id="version" name="version_string" type="text" placeholder="Version" class="form-control input-md" required="" value="<?php echo esc($_asset_values['version_string']) ?>">
+        <span class="help-block">The version of the asset</span>
+    </div>
 </div>
 
 <div class="form-group">
-        <label class="col-md-4 control-label" for="download_provider">Repository hoster</label>
-        <div class="col-md-5">
-                <select id="download_provider" name="download_provider" class="form-control">
-                    <?php foreach($constants['download_provider'] as $id => $name) if(is_int($id)) { ?>
-                        <option value="<?php echo esc($name) ?>" <?php if($name == $_asset_values['download_provider']) echo 'selected=""'; ?>>
-                            <?php echo esc($name) ?>
-                        </option>
-                    <?php } ?>
-                </select>
-                <span class="help-block">We really need to know where your repository is hosted in order to compute the final download URL. If your Git repository provider is missing, you might like to <a href="https://github.com/godotengine/asset-library/issues">open an issue</a> about it.</span>
-        </div>
+    <label class="col-md-4 control-label required_mark" for="download_provider">Repository host</label>
+    <div class="col-md-5">
+        <select id="download_provider" name="download_provider" class="form-control">
+            <?php foreach($constants['download_provider'] as $id => $name) if(is_int($id)) { ?>
+                <option value="<?php echo esc($name) ?>" <?php if($name == $_asset_values['download_provider']) echo 'selected=""'; ?>>
+                    <?php echo esc($name) ?>
+                </option>
+            <?php } ?>
+        </select>
+        <span class="help-block">We need to know where your repository is hosted in order to compute the final download URL. If your Git repository provider is missing, you might like to <a href="https://github.com/godotengine/asset-library/issues">open an issue</a> about it.</span>
+    </div>
 </div>
 
 <div class="form-group">
-        <label class="col-md-4 control-label" for="browse">Repository URL</label>
-        <div class="col-md-5">
-                <input id="browse" name="browse_url" type="text" placeholder="Repository URL" class="form-control input-md" required="" value="<?php echo esc($_asset_values['browse_url']) ?>">
-                <span class="help-block">Set the url to browse the asset's files (webpage). Should be similar to <code>https://github.com/&lt;user&gt;/&lt;project&gt;</code> (Might be different depending on your "provider")</span>
-        </div>
+    <label class="col-md-4 control-label required_mark" for="browse">Repository URL</label>
+    <div class="col-md-5">
+        <input id="browse" name="browse_url" type="text" placeholder="Repository URL" class="form-control input-md" required="" value="<?php echo esc($_asset_values['browse_url']) ?>">
+        <span class="help-block">The url to browse the asset's files (webpage). Should be similar to <code>https://github.com/&lt;user&gt;/&lt;project&gt;</code> (Might be different depending on your "provider")</span>
+    </div>
 </div>
 
 <div class="form-group">
-        <label class="col-md-4 control-label" for="issues">Issues URL</label>
-        <div class="col-md-5">
-                <input id="issues" name="issues_url" type="text" placeholder="Issues URL" class="form-control input-md" value="<?php echo esc($_asset_values['issues_url']) ?>">
-                <span class="help-block">Set the url to issues list of the  asset. Should be similar to <code>https://github.com/&lt;user&gt;/&lt;project&gt;/issues</code> (Might be different depending on your "provider"). If you use your provider's issue list, you can leave it empty.</span>
-        </div>
+    <label class="col-md-4 control-label" for="issues">Issues URL</label>
+    <div class="col-md-5">
+        <input id="issues" name="issues_url" type="text" placeholder="Issues URL" class="form-control input-md" value="<?php echo esc($_asset_values['issues_url']) ?>">
+        <span class="help-block">The url to issues list of the  asset. Should be similar to <code>https://github.com/&lt;user&gt;/&lt;project&gt;/issues</code> (Might be different depending on your "provider"). If you use your provider's issue list, you can leave it empty.</span>
+    </div>
 </div>
 
 <div class="form-group">
-        <label class="col-md-4 control-label" for="commit">Download Commit/tag</label>
-        <div class="col-md-5">
-                <input id="commit" name="download_commit" type="text" placeholder="Download Commit/tag" class="form-control input-md" required="" value="<?php echo esc($_asset_values['download_commit']) ?>">
-                <span class="help-block">Set the commit or tag to download the asset. Should be similar to <code>b1d3172f89b86e52465a74f63a74ac84c491d3e1</code> or <code>v1.0</code>. The final download url would be computed from this.</span>
-        </div>
+    <label class="col-md-4 control-label required_mark" for="commit">Download Commit/tag</label>
+    <div class="col-md-5">
+        <input id="commit" name="download_commit" type="text" placeholder="Download Commit/tag" class="form-control input-md" required="" value="<?php echo esc($_asset_values['download_commit']) ?>">
+        <span class="help-block">The commit or tag to download the asset. Should be similar to <code>b1d3172f89b86e52465a74f63a74ac84c491d3e1</code> or <code>v1.0</code>. The final download url would be computed from this.</span>
+    </div>
 </div>
 
 <div class="form-group">
-        <label class="col-md-4 control-label" for="icon">Icon URL</label>
-        <div class="col-md-5">
-                <input id="icon" name="icon_url" type="text" placeholder="Icon URL" class="form-control input-md" required="" value="<?php echo esc($_asset_values['icon_url']) ?>">
-                <span class="help-block">Set the url to the asset's icon (png or jpg image)</span>
-        </div>
+    <label class="col-md-4 control-label required_mark" for="icon">Icon URL</label>
+    <div class="col-md-5">
+        <input id="icon" name="icon_url" type="text" placeholder="Icon URL" class="form-control input-md" required="" value="<?php echo esc($_asset_values['icon_url']) ?>">
+        <span class="help-block">The url to the asset's icon (png or jpg image)</span>
+    </div>
 </div>
 
 <div class="form-group">
-        <label class="col-md-4 control-label" for="license">License</label>
-        <div class="col-md-5">
-                <select id="license" name="cost" class="form-control">
-                    <?php $licenses = [
-                        'MIT' => 'MIT',
-                        'GPLv3' => 'GPL v3',
-                        'GPLv2' => 'GPL v2',
-                        'CC0' => 'CC0',
-                        'BSD-2-Clause' => 'BSD 2-clause License',
-                        'BSL-1.0' => 'Boost Software License'
-                    ] ?>
-                    <?php foreach($licenses as $id => $name) { ?>
-                        <option value="<?php echo raw($id) ?>" <?php if($id == $_asset_values['cost']) echo 'selected=""'; ?>>
-                            <?php echo esc($name) ?>
-                        </option>
-                    <?php } ?>
-                </select>
-        </div>
+    <label class="col-md-4 control-label required_mark" for="license">License</label>
+    <div class="col-md-5">
+        <select id="license" name="cost" class="form-control">
+            <?php $licenses = [
+                'MIT' => 'MIT',
+                'GPLv3' => 'GPL v3',
+                'GPLv2' => 'GPL v2',
+                'CC0' => 'CC0',
+                'BSD-2-Clause' => 'BSD 2-clause License',
+                'BSL-1.0' => 'Boost Software License'
+            ] ?>
+            <?php foreach($licenses as $id => $name) { ?>
+                <option value="<?php echo raw($id) ?>" <?php if($id == $_asset_values['cost']) echo 'selected=""'; ?>>
+                    <?php echo esc($name) ?>
+                </option>
+            <?php } ?>
+        </select>
+        <span class="help-block">The license under which the asset is available. Check <a href="https://opensource.org/licenses">opensource.org</a> for a more detailed description of each. <br> In case an OSI-approved license you are using is missing, you might <a href="https://github.com/godotengine/asset-library/issues">open an issue</a> about it.</span>
+    </div>
 </div>
 
 <div class="form-group">
-        <label class="col-md-4 control-label" for="description">Description</label>
-        <div class="col-md-5">
-                <textarea class="form-control" id="description" name="description" rows="7"><?php echo esc($_asset_values['description']) ?></textarea>
-        </div>
+    <label class="col-md-4 control-label required_mark" for="description">Description</label>
+    <div class="col-md-5">
+        <textarea class="form-control" id="description" name="description" rows="7"><?php echo esc($_asset_values['description']) ?></textarea>
+        <span class="help-block">The description which would be visible on the asset page</span>
+    </div>
 </div>
 
 <?php for ($i=0; $i < count($_asset_values['previews']) + 3; $i++) {
     if($i < count($_asset_values['previews'])) $preview = $_asset_values['previews'][$i];
-    else $preview = ['type' => 'image', 'link' => '', 'thumbnail' => '']
+    else $preview = ['type' => 'image', 'link' => '', 'thumbnail' => ''];
     ?>
     <div class="panel panel-default">
         <div class="panel-heading form-inline">
@@ -189,34 +193,34 @@ $_asset_values = array_merge([
                     </label>
                 <?php } ?>
             </div>
-    </div>
+        </div>
 
         <div class="panel-body">
             <div class="form-group">
-                    <label class="col-md-4 control-label" for="previews[<?php echo $i ?>][type]">Type</label>
-                    <div class="col-md-5">
-                            <select id="license" name="previews[<?php echo $i ?>][type]" class="form-control">
-                                <?php $types = ['image' => 'Image', 'video' => 'Video'] ?>
-                                <?php foreach($types as $id => $name) { ?>
-                                    <option value="<?php echo raw($id) ?>" <?php if($id == $preview['type']) echo 'selected=""'; ?>>
-                                        <?php echo esc($name) ?>
-                                    </option>
-                                <?php } ?>
-                            </select>
-                    </div>
+                <label class="col-md-4 control-label required_mark" for="previews[<?php echo $i ?>][type]">Type</label>
+                <div class="col-md-5">
+                    <select id="previews[<?php echo $i ?>][type]" name="previews[<?php echo $i ?>][type]" class="form-control">
+                        <?php $types = ['image' => 'Image', 'video' => 'Video'] ?>
+                        <?php foreach($types as $id => $name) { ?>
+                            <option value="<?php echo raw($id) ?>" <?php if($id == $preview['type']) echo 'selected=""'; ?>>
+                                <?php echo esc($name) ?>
+                            </option>
+                        <?php } ?>
+                    </select>
+                </div>
             </div>
 
             <div class="form-group">
-                <label class="control-label col-md-4" for="previews[<?php echo $i ?>][link]">Image/Youtube Link</label>
+                <label class="col-md-4 control-label required_mark" for="previews[<?php echo $i ?>][link]">Image/Youtube Link</label>
                 <div class="col-md-5">
-                    <input id="youtube-<?php echo $i ?>" name="previews[<?php echo $i ?>][link]" type="text" placeholder="Image/Youtube Link" class="form-control input-md" value="<?php echo esc($preview['link']) ?>">
+                    <input id="previews[<?php echo $i ?>][link]" name="previews[<?php echo $i ?>][link]" type="text" placeholder="Image/Youtube Link" class="form-control input-md" value="<?php echo esc($preview['link']) ?>">
                 </div>
             </div>
 
             <div class="form-group">
-                <label class="control-label col-md-4" for="previews[<?php echo $i ?>][thumbnail]">Link to thumbnail (To be removed)</label>
+                <label class="col-md-4 control-label required_mark" for="previews[<?php echo $i ?>][thumbnail]">Link to thumbnail (To be removed)</label>
                 <div class="col-md-5">
-                    <input id="youtube-<?php echo $i ?>" name="previews[<?php echo $i ?>][thumbnail]" type="text" placeholder="Image Link" class="form-control input-md" value="<?php echo esc($preview['thumbnail']) ?>">
+                    <input id="previews[<?php echo $i ?>][thumbnail]" name="previews[<?php echo $i ?>][thumbnail]" type="text" placeholder="Image Link" class="form-control input-md" value="<?php echo esc($preview['thumbnail']) ?>">
                 </div>
             </div>
 

+ 22 - 3
templates/asset.phtml

@@ -5,13 +5,21 @@
     </div>
     <div class="media-body">
         <h4 class="media-heading">
+            <?php if (!$data['searchable']) { ?><del><?php } ?>
             <?php echo esc($data['title']) ?>
+            <?php if (!$data['searchable']) { ?></del><?php } ?>
             <small><?php echo esc($data['version_string']) ?></small>
+
             <?php for ($star=1; $star <= 5; $star++) { ?>
                 <i class="glyphicon glyphicon-star<?php if($data['rating'] < $star) echo '-empty'; ?>"></i>
             <?php } ?>
+
+            <?php if (!$data['searchable']) { ?>
+                <span class="label label-default">Deleted</span>
+            <?php } ?>
+
             <span class="label label-primary"><?php echo esc($data['category']) ?></span>
-            <span class="label label-danger"><?php echo esc(ucfirst($data['godot_version'])) ?></span>
+            <span class="label label-danger"><?php echo esc(ucfirst(str_replace('_', ' ', $data['godot_version']))) ?></span>
             <span class="label label-<?php echo raw([
                 'official' => 'success',
                 'community' => 'info',
@@ -46,7 +54,7 @@
             </a>
         </p>
         <?php if(isset($user) && ($user['type'] >= $constants['user_type']['moderator'])) { ?>
-            <form class="form-inline" action="<?php echo raw($basepath) ?>/asset/<?php echo url($data['asset_id']) ?>/support_level" method="post">
+            <form class="form-inline" style="display: inline-block" action="<?php echo raw($basepath) ?>/asset/<?php echo url($data['asset_id']) ?>/support_level" method="post">
                 <?php include("_csrf.phtml") ?>
                 <div class="btn-group">
                     <select id="support_level" name="support_level" class="form-control btn btn-default">
@@ -56,9 +64,20 @@
                             </option>
                         <?php } ?>
                     </select>
-                    <button type="submit" class="btn btn-danger">Change support level</button>
+                    <button type="submit" class="btn btn-warning">Change support level</button>
                 </div>
             </form>
+            <?php if ($data['searchable']) { ?>
+                <form class="form-inline" style="display: inline-block" action="<?php echo raw($basepath) ?>/asset/<?php echo url($data['asset_id']) ?>/delete" method="post">
+                    <?php include("_csrf.phtml") ?>
+                    <button type="submit" class="btn btn-danger" onclick="javascript:return window.confirm('Do you really want to delete this asset?');">Remove from library</button>
+                </form>
+            <?php } else { ?>
+                <form class="form-inline" style="display: inline-block" action="<?php echo raw($basepath) ?>/asset/<?php echo url($data['asset_id']) ?>/undelete" method="post">
+                    <?php include("_csrf.phtml") ?>
+                    <button type="submit" class="btn btn-info" onclick="javascript:return window.confirm('Do you want to restore this asset?');">Restore to library</button>
+                </form>
+            <?php } ?>
         <?php } ?>
         <p class="text-muted">Sha256 Hash: <code><?php echo esc($data['download_hash']) ?></code></p>
         <hr/>

+ 19 - 9
templates/asset_edit.phtml

@@ -31,6 +31,8 @@ $preview_field_names = [
         <?php if ($name == 'preview_thumbnail') { ?>
             <br><img src="<?php echo esc($data) ?>" style="max-height:345px"></a>
         <?php }?>
+    <?php } elseif($name == 'godot_version') { ?>
+        <?php echo raw(ucfirst(str_replace('_', ' ', $data))) ?>
     <?php } elseif($name == 'category_id') { ?>
         <?php echo raw($categories[$data]['name']) ?>
     <?php } elseif($name == 'description') { ?>
@@ -46,7 +48,11 @@ $preview_field_names = [
         <a href="<?php echo raw($basepath) ?>/asset/<?php echo raw($data['asset_id']) ?>">"<?php echo esc($data['original']['title']) ?>"</a>
     <?php } else { ?>
         Creation of asset
-        <a href="<?php echo raw($basepath) ?>/asset/<?php echo url($data['asset_id']) ?>">"<?php echo esc($data['title']) ?>"</a>
+        <?php if($data['asset_id'] != -1) { ?>
+            <a href="<?php echo raw($basepath) ?>/asset/<?php echo url($data['asset_id']) ?>">"<?php echo esc($data['title']) ?>"</a>
+        <?php } else { ?>
+            <a href="#">"<?php echo esc($data['title']) ?>"</a>
+        <?php } ?>
     <?php } ?>
     <span class="label label-<?php echo raw(['new' => 'info', 'in_review' => 'primary', 'rejected' => 'danger', 'accepted' => 'success'][$data['status']]) ?>">
         <?php echo raw(ucfirst(str_replace('_', ' ', $data['status']))) ?>
@@ -57,6 +63,18 @@ $preview_field_names = [
     <div class="form-group">
         <a class="btn btn-success" href="<?php echo raw($basepath) ?>/asset/edit/<?php echo url($data['edit_id']) ?>/edit">Edit modifications</a>
     </div>
+<?php } ?>
+
+<?php if(isset($data['warning'])) { ?>
+    <div class="alert alert-warning" role="alert">
+        <?php foreach (explode("\n", $data['warning']) as $warning) if ($warning != '') { ?>
+            <strong>Warning:</strong> <?php echo esc($warning) ?> <br><br>
+        <?php } ?>
+        <em>If you think that this warning is incorrect, you can always <a href="https://github.com/godotengine/asset-library/issues">open an issue</a>.</em>
+    </div>
+<?php } ?>
+
+<?php if(isset($user) && $data['user_id'] == $user['user_id'] && $data['status'] == 'new') { ?>
     <div class="alert alert-info" role="alert">
         <?php if($data['asset_id'] != -1) { ?>
             This edit you made is currently pending approval by our moderators. <strong>When it is approved, changes would finally go live</strong>. To access this page again later, you can use the "View pending" button on the asset's page, or just use the "Feed" button in the toolbar. <!--You will be notified by email when decision is made.-->
@@ -72,14 +90,6 @@ $preview_field_names = [
     </div>
 <?php } ?>
 
-<?php if(isset($data['warning'])) { ?>
-    <div class="alert alert-warning" role="alert">
-        <strong>Warning:</strong> <?php echo nl2br(esc($data['warning'])) ?>
-        <br><br>
-        <em>If you think that this warning should not be here, you can always <a href="https://github.com/godotengine/asset-library/issues">open an issue</a>.</em>
-    </div>
-<?php } ?>
-
 <table class="table table-bordered">
     <tbody>
         <tr>

+ 10 - 7
templates/asset_edits.phtml

@@ -1,7 +1,7 @@
 <?php include("_header.phtml") ?>
 
 <form method="get" action="edit">
-    <div class="form-inline">
+    <div class="form-inline form-search">
         <div class="form-group">
             <label>Status</label>
             <?php foreach($constants['edit_status'] as $id => $status) if(is_int($id)) { ?>
@@ -17,7 +17,6 @@
             <?php } ?>
         </div>
         <?php if(isset($params['asset'])) { ?>
-            <div style="display:inline-block;width:40px;"></div>
             <div class="form-group bg-primary" style="padding:0 5px;">
                 <label>
                     <input type="checkbox" name="asset" value="<?php echo esc($params['asset']) ?>" checked="">
@@ -30,7 +29,6 @@
             </div>
         <?php } ?>
         <?php if(isset($params['user'])) { ?>
-            <div style="display:inline-block;width:40px;"></div>
             <div class="form-group bg-primary" style="padding:0 5px;">
                 <label>
                     <input type="checkbox" name="user" value="<?php echo esc($params['user']) ?>" checked="">
@@ -56,10 +54,15 @@
             </div>
             <div class="media-body">
                 <h4 class="media-heading">
-                    <a href="<?php echo raw($basepath) . '/asset/edit/' . url($asset_edit['edit_id']) ?>"><?php echo ($asset_edit['asset_id'] == -1 ? 'Create ' : 'Edit ') . esc($asset_edit['title']) ?></a>
-
-                    <span class="label label-<?php echo raw(['new' => 'info', 'in_review' => 'primary', 'rejected' => 'danger', 'accepted' => 'success'][$asset_edit['status']]) ?>"><?php echo raw(ucfirst(str_replace('_', ' ', $asset_edit['status']))) ?></span>
-                    <span class="label label-danger"><?php echo esc(ucfirst($asset_edit['godot_version'])) ?></span>
+                    <a href="<?php echo raw($basepath) . '/asset/edit/' . url($asset_edit['edit_id']) ?>"><?php echo ($asset_edit['asset_id'] == -1 ? 'Create ' : 'Edit ') . '"' . esc($asset_edit['title']) . '"' ?></a>
+                    <br>
+                    <span class="label label-<?php echo raw([
+                        'new' => 'info',
+                        'in_review' => 'primary',
+                        'rejected' => 'danger',
+                        'accepted' => 'success'
+                    ][$asset_edit['status']]) ?>"><?php echo raw(ucfirst(str_replace('_', ' ', $asset_edit['status']))) ?></span>
+                    <span class="label label-default"><?php echo raw(ucfirst(str_replace('_', ' ', $asset_edit['godot_version']))) ?></span>
 
                     <span class="label label-<?php echo raw([
                         'official' => 'danger',

+ 4 - 6
templates/assets.phtml

@@ -1,6 +1,6 @@
 <?php include("_header.phtml") ?>
 <form method="get" action="asset">
-    <div class="form-inline">
+    <div class="form-inline form-search">
         <div class="form-group">
             <label for="category">Category</label>
             <select id="category" name="category" class="form-control">
@@ -15,9 +15,8 @@
                 <?php } ?>
             </select>
         </div>
-        <div style="display:inline-block;width:40px;"></div>
         <div class="form-group">
-            <label>Support level</label>
+            <label>Support level</label><br class="visible-xs-block">
             <?php foreach($constants['support_level'] as $id => $level) if(is_int($id)) { ?>
                 <label>
                     <input type="checkbox" name="support[<?php echo esc($level) ?>]" value="1"
@@ -30,7 +29,6 @@
                 </label>
             <?php } ?>
         </div>
-        <div style="display:inline-block;width:40px;"></div>
         <div class="form-group">
             <label>Godot version</label>
             <select id="category" name="godot_version" class="form-control">
@@ -60,7 +58,6 @@
             </label>
         </div>
         <?php if(isset($params['user'])) { ?>
-            <div style="display:inline-block;width:40px;"></div>
             <div class="form-group bg-primary" style="padding:0 5px;">
                 <label>
                     <input type="checkbox" name="user" value="<?php echo esc($params['user']) ?>" checked="">
@@ -93,8 +90,9 @@
                         <?php for ($star=1; $star <= 5; $star++) { ?>
                             <i class="glyphicon glyphicon-star<?php if($asset['rating'] < $star) echo '-empty'; ?>"></i>
                         <?php } ?>
+                        <br>
                         <span class="label label-primary"><?php echo esc($asset['category']) ?></span>
-                        <span class="label label-danger"><?php echo esc(ucfirst($asset['godot_version'])) ?></span>
+                        <span class="label label-danger"><?php echo esc(ucfirst(str_replace('_', ' ', $asset['godot_version']))) ?></span>
                         <span class="label label-<?php echo raw([
                             'official' => 'success',
                             'community' => 'info',

+ 0 - 8
templates/edit_asset.phtml

@@ -22,14 +22,6 @@
                                 </a>
                         </div>
                 </div>
-
-                <div class="form-group">
-                    <div class="col-md-4 col-md-push-9 align-right">
-                        <form action="<?php echo raw($basepath) ?>/asset/<?php echo url($data['asset_id']) ?>/delete" method="POST">
-                            <button type="submit" id="delete" class="btn btn-danger" onclick="javascript:if(window.confirm('Do you really want to delete this asset?')){ return true; }else{ return false; }">Delete asset from library</button>
-                        </form>
-                    </div>
-                </div>
         </fieldset>
 </form>
 <?php include("_footer.phtml") ?>

+ 0 - 222
templates/index.html

@@ -1,222 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
-    <title>Godot Addonlib</title>
-
-    <!-- Bootstrap -->
-    <link href="../bower_componenets/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
-
-    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
-    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
-    <!--[if lt IE 9]>
-        <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
-        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
-    <![endif]-->
-</head>
-
-<body>
-    <!-- Navigation -->
-    <nav class="navbar navbar-inverse" role="navigation">
-        <div class="container">
-            <!-- Brand and toggle get grouped for better mobile display -->
-            <div class="navbar-header">
-                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
-                    <span class="sr-only">Toggle navigation</span>
-                    <span class="icon-bar"></span>
-                    <span class="icon-bar"></span>
-                    <span class="icon-bar"></span>
-                </button>
-                <a class="navbar-brand" href="#">Godot Addonlib</a>
-            </div>
-            <!-- Collect the nav links, forms, and other content for toggling -->
-            <div class="collapse navbar-collapse" id="navbar-collapse-1">
-                <ul class="nav navbar-nav navbar-right">
-                    <li>
-                        <a href="#">Feed</a>
-                    </li>
-                    <li class="active">
-                        <a href="#">My Assets</a>
-                    </li>
-                    <li>
-                        <a href="#">New Asset</a>
-                    </li>
-                    <li>
-                        <a href="#">Moderator</a>
-                    </li>
-                    <li>
-                        <a href="#">Logout</a>
-                    </li>
-                </ul>
-            </div>
-            <!-- /.navbar-collapse -->
-        </div>
-        <!-- /.container -->
-    </nav>
-    <div class="container">
-        <div class="row">
-            <div class="col-md-3">
-                <ul class="nav nav-pills nav-stacked">
-                    <li role="presentation"><a href="#">New Asset</a>
-                    <li role="presentation" class="active"><a href="#">SmaraGD</a>
-                    </li>
-                    <li role="presentation"><a href="#">Make Halo</a>
-                    </li>
-                    <li role="presentation"><a href="#">Unity2Godot</a>
-                    </li>
-                </ul>
-            </div>
-            <div class="col-md-9">
-                <div class="alert alert-info" role="alert">
-                    This asset is currently pending approval by our moderators. You will be notified by email when decision is made.
-                </div>
-                <form class="form-horizontal">
-                    <fieldset>
-
-                        <!-- Form Name -->
-                        <legend>Edit Asset</legend>
-
-                        <!-- Text input-->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="asset_name">Asset Name</label>
-                            <div class="col-md-5">
-                                <input id="asset_name" name="asset_name" type="text" placeholder="Asset Name" class="form-control input-md" required="">
-                                <span class="help-block">Set the name of your asset</span>
-                            </div>
-                        </div>
-
-                        <!-- Select Basic -->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="category">Category</label>
-                            <div class="col-md-5">
-                                <select id="category" name="category" class="form-control">
-                                    <option value="2d">2D</option>
-                                    <option value="3d">3D</option>
-                                    <option value="script">Script</option>
-                                    <option value="other">Other</option>
-                                </select>
-                            </div>
-                        </div>
-
-                        <!-- Text input-->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="versiono">Version</label>
-                            <div class="col-md-5">
-                                <input id="versiono" name="versiono" type="text" placeholder="Version" class="form-control input-md" required="">
-                                <span class="help-block">Set the version of your asset</span>
-                            </div>
-                        </div>
-
-                        <!-- Text input-->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="download">Download URL</label>
-                            <div class="col-md-5">
-                                <input id="download" name="download" type="text" placeholder="Download URL" class="form-control input-md" required="">
-                                <span class="help-block">Set the url to download the asset (direct)</span>
-                            </div>
-                        </div>
-
-                        <!-- Select Basic -->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="license">License</label>
-                            <div class="col-md-5">
-                                <select id="license" name="license" class="form-control">
-                                    <option value="MIT">MIT</option>
-                                    <option value="GPLv3">GPL v3</option>
-                                    <option value="GPLv2">GPL v2</option>
-                                    <option value="CC0">CC0</option>
-                                </select>
-                            </div>
-                        </div>
-
-                        <!-- Textarea -->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="description">Description</label>
-                            <div class="col-md-4">
-                                <textarea class="form-control" id="description" name="description"></textarea>
-                            </div>
-                        </div>
-
-                        <!-- File Button -->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="icon">Icon</label>
-                            <div class="col-md-4">
-                                <input id="icon" name="icon" class="input-file" type="file">
-                            </div>
-                        </div>
-
-                        <!-- File Button -->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="screenshot1">Main Screenshot</label>
-                            <div class="col-md-4">
-                                <input id="screenshot1" name="screenshot1" class="input-file" type="file">
-                            </div>
-                        </div>
-
-                        <!-- File Button -->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="screenshot2">Screenshot 2</label>
-                            <div class="col-md-4">
-                                <input id="screenshot2" name="screenshot2" class="input-file" type="file">
-                            </div>
-                        </div>
-
-                        <!-- File Button -->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="filebutton">Screenshot 3</label>
-                            <div class="col-md-4">
-                                <input id="filebutton" name="filebutton" class="input-file" type="file">
-                            </div>
-                        </div>
-
-                        <!-- File Button -->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="screenshot4">Screenshot 4</label>
-                            <div class="col-md-4">
-                                <input id="screenshot4" name="screenshot4" class="input-file" type="file">
-                            </div>
-                        </div>
-
-                        <!-- Text input-->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="youtube">Youtube Link</label>
-                            <div class="col-md-5">
-                                <input id="youtube" name="youtube" type="text" placeholder="Youtube Link" class="form-control input-md">
-                                <span class="help-block">Set the youtube link demonstrating your asset</span>
-                            </div>
-                        </div>
-
-                        <!-- Button -->
-                        <div class="form-group">
-                            <label class="col-md-4 control-label" for="submit"></label>
-                            <div class="col-md-4">
-                                <button id="submit" name="submit" class="btn btn-primary">Edit</button>
-                            </div>
-                        </div>
-
-                    </fieldset>
-                </form>
-            </div>
-        </div>
-        <footer>
-            <div class="row">
-                <div class="col-md-12">
-                    <hr/>
-                    <p>Copyright &copy; 2016 Godot Game Engine All Rights Reserved.</p>
-                </div>
-            </div>
-            <!-- /.row -->
-        </footer>
-    </div>
-
-    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
-    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
-    <!-- Include all compiled plugins (below), or include individual files as needed -->
-    <script src="../bower_componenets/bootstrap/dist/js/bootstrap.min.js"></script>
-</body>
-
-</html>

+ 1 - 1
templates/register.phtml

@@ -23,8 +23,8 @@
         <input type="password" name="password" class="form-control" id="login-form-password" placeholder="Password">
     </div>
     <div class="btn-group">
-        <button type="submit" class="btn btn-primary">Register</button>
         <a href="<?php echo raw($basepath) ?>/login" class="btn btn-default">Login</a>
+        <button type="submit" class="btn btn-primary">Register</button>
     </div>
 </form>
 <?php include("_footer.phtml") ?>