Browse Source

Add more content (about pages) and some style fixes

Jordi Boggiano 14 years ago
parent
commit
21babe7ed9

+ 42 - 0
src/Packagist/WebBundle/Controller/AboutController.php

@@ -0,0 +1,42 @@
+<?php
+
+/*
+ * This file is part of Packagist.
+ *
+ * (c) Jordi Boggiano <j.boggiano@seld.be>
+ *     Nils Adermann <naderman@naderman.de>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Packagist\WebBundle\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use Symfony\Component\HttpFoundation\Response;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+
+/**
+ * @author Jordi Boggiano <j.boggiano@seld.be>
+ */
+class AboutController extends Controller
+{
+    /**
+     * @Template()
+     * @Route("/about", name="about")
+     */
+    public function aboutAction()
+    {
+        return array();
+    }
+
+    /**
+     * @Template()
+     * @Route("/about-composer", name="about.composer")
+     */
+    public function aboutComposerAction()
+    {
+        return array();
+    }
+}

+ 0 - 9
src/Packagist/WebBundle/Controller/WebController.php

@@ -180,13 +180,4 @@ class WebController extends Controller
 
         return array('package' => $package);
     }
-
-    /**
-     * @Template()
-     * @Route("/about", name="about")
-     */
-    public function aboutAction()
-    {
-        return array();
-    }
 }

+ 28 - 10
src/Packagist/WebBundle/Resources/public/css/main.css

@@ -104,12 +104,15 @@ a:hover {
 header h1 {
   font-size: 50px;
   margin-top: 0;
-  font-family: "Neuton", serif;
+  float: left;
 }
 
 header h2 {
   font-size: 30px;
-  margin: 10px 0;
+  position: relative;
+  top: 20px;
+  left: 20px;
+  display: inline;
 }
 
 header p {
@@ -129,6 +132,21 @@ header {
   font-size: 15px;
 }
 
+.main, header p {
+  clear: left;
+}
+
+footer {
+  border-top: 2px solid #eee;
+  padding-top: 30px;
+  margin-top: 30px;
+}
+footer ul {
+  width: 20%;
+  list-style: none;
+  float: right;
+}
+
 .flash-message {
   font-size: 20px;
   margin: 20px 0;
@@ -141,12 +159,10 @@ header {
   color: #a21a1a;
 }
 
-.betawarn {
-  border: 1px solid #cc0;
-  background: #ffa;
-  padding: 10px;
-  border-radius: 5px;
-  margin: 10px 0;
+p {
+  margin-bottom: 10px;
+  font-family: "Arial", sans-serif;
+  line-height: 150%;
 }
 
 .user {
@@ -176,11 +192,13 @@ header {
 }
 
 .main h1 {
-  font-size: 30px;
+  font-size: 25px;
+  margin-bottom: 10px;
 }
 
 .main h2 {
-  font-size: 23px;
+  font-size: 20px;
+  margin-bottom: 10px;
 }
 
 label {

+ 49 - 0
src/Packagist/WebBundle/Resources/views/About/about.html.twig

@@ -0,0 +1,49 @@
+{% extends "PackagistWebBundle::layout.html.twig" %}
+
+{% block content %}
+    <h1>What is Packagist?</h1>
+    <p>Packagist is a Composer package repository. It lets you find packages you want, and lets Composer know where to get the code from. You can use Composer to manage your project or libraries' dependencies - read more about it on the <a href="{{ path('about.composer') }}">Composer page</a>.</p>
+    <p>You can find the packagist.org source on <a href="https://github.com/composer/packagist">GitHub</a>.
+
+    <h1>How to submit packages?</h1>
+    <h2>Naming your package</h2>
+    <p>First of all, you must pick a package name. This is a very important step since it can not change, and it should be unique enough to avoid problems in the future.</p>
+    <p>The general rule for package naming is that for libraries and applications, you can use any name, although it's best to avoid using common names like DB, Logger, MySQL, etc. Try to be imaginative when naming your project.</p>
+    <p>For plugins, be it Typo3 extensions, Symfony2 bundles, Drupal modules, or whatever your project of choice calls them, you should prefix your plugin name by the project it applies to. For example <code>Symfony2-AcmePizzaBundle</code>, <code>Typo3-Session</code> and such. This ensures uniqueness across frameworks/applications, and clearly says what your package relates to. This prefix should match your package type by the way, but we will see that later.</p>
+    <h2>Creating a composer.json file</h2>
+    <p>The composer.json file should reside at the top of your package's git repository, and is the way you describe your package to both packagist and composer.</p>
+    <p>A typical composer.json file looks like this:
+<pre>
+{
+    "name": "Monolog",
+    "type": "Library",
+    "description": "Logging for PHP 5.3",
+    "keywords": ["log","logging"],
+    "homepage": "http://github.com/Seldaek/monolog",
+    "version": "1.0.0",
+    "license": "MIT",
+    "authors": [
+        {
+            "name": "Jordi Boggiano",
+            "email": "j.boggiano@seld.be",
+            "homepage": "http://seld.be"
+        }
+    ],
+    "require": {
+        "php": ">=5.3.0"
+    }
+}
+</pre>
+As you see in this case the type is Library, so the name doesn't contain any prefix. If if was a Symfony2 bundle, the type would be <code>Symfony2</code> and the name <code>Symfony2-MonologBundle</code></p>
+    <p>Once you have this file committed in your repository root, you can <a href="{{ path('submit') }}">submit the package</a> to Packagist by entering the public repository URL.</p>
+    <h1>Managing package versions</h1>
+    <p>Package versioning is done automatically based on the tags you create in your repository. You should update the version field in the composer.json file before creating a tag. Tag names should match 'X.Y.Z', or 'vX.Y.Z', with an optional suffix for RC, beta or alpha versions. Here are a few examples of valid tag names:
+<pre>
+1.0.0
+v1.0.0
+1.10.5-RC1
+v4.4.4beta2
+v2.0.0-alpha
+</pre>
+    In your master branch, or any other dev branch, you can use a -dev (e.g. <code>1.1.0-dev</code>) suffix to the version inside the composer.json file to indicate that this is a development branch leading to the future 1.1.0 (in this example) version.</p>
+{% endblock %}

+ 32 - 0
src/Packagist/WebBundle/Resources/views/About/aboutComposer.html.twig

@@ -0,0 +1,32 @@
+{% extends "PackagistWebBundle::layout.html.twig" %}
+
+{% block content %}
+    <h1>What is Composer?</h1>
+    <p>Composer helps you manage your project or libraries' dependencies. You can find the Composer source on <a href="https://github.com/composer/composer">GitHub</a>.</p>
+
+    <h1>Declaring dependencies</h1>
+    <p>To define your project's dependencies, you can use a composer.json file, just like in a library or plugin, but you don't have to specify the package name or most of the other fields.</p>
+    <p>A typical composer.json file for a project looks like this:
+<pre>
+{
+    "require": {
+      "monolog": "1.0.0"
+    }
+}
+</pre>
+    In this example, the project only requires the Monolog library as a dependency.</p>
+    <p>You can add different repositories than Packagist, if needed, by specifying them by hand. For example git repositories can be used as repositories if they contain a composer.json, even if the packages are not available on Packagist. They could also be private repositories that you don't want to make accessible to everyone. Here's how to do it:
+<pre>
+{
+    "repositories": {
+        "MyRepo": {
+            "git": "git://example.org/MyRepo.git"
+        }
+    },
+    "require": {
+        "monolog": "1.0.0",
+        "mypackage": ">=1.0.0"
+    }
+}
+</pre></p>
+{% endblock %}

+ 1 - 0
src/Packagist/WebBundle/Resources/views/Web/submitPackage.html.twig

@@ -6,6 +6,7 @@
 
 {% block content %}
     <h1>Submit package</h1>
+    <p>Please make sure you have read the package <a href="{{ path('about') }}">naming conventions</a> before submitting your package. The authoritative name of your package will be taken from the composer.json file inside the master branch of your repository, and it can not be changed after that.</p>
     <form id="submit-package-form" action="" data-check-url="{{ path('submit.fetch_info') }}" method="POST" {{ form_enctype(form) }}>
         <div>
             <p>

+ 36 - 18
src/Packagist/WebBundle/Resources/views/layout.html.twig

@@ -15,7 +15,7 @@
 
         <script type="text/javascript">
             WebFontConfig = {
-                google: { families: [ 'Neuton', 'PT Sans' ] }
+                google: { families: [ 'PT Sans' ] }
             };
             (function() {
                 var wf = document.createElement('script');
@@ -40,11 +40,11 @@
         <div class="container">
             <div class="user">
                 {% if app.user %}
-                    {{ app.user.username }} | <a href="{{ path('fos_user_security_logout') }}">logout</a>
+                    {{ app.user.username }} | <a href="{{ path('fos_user_security_logout') }}">Logout</a>
                 {% else %}
-		            <a href="{{ path('fos_user_registration_register') }}">Create a new account</a>
-		            |
-		            <a href="{{ path('fos_user_security_login') }}">Login</a>
+                    <a href="{{ path('fos_user_registration_register') }}">Create a new account</a>
+                    |
+                    <a href="{{ path('fos_user_security_login') }}">Login</a>
                 {% endif %}
             </div>
             <header>
@@ -54,26 +54,44 @@
                 <h1><a href="{{ path('home') }}">Packagist</a></h1>
                 <h2>The PHP package archivist.</h2>
                 {% if page is defined and page == 'home' %}
-                <p>Packagist is the main <a href="http://github.com/composer/composer">Composer</a> repository. It aggregates all sorts of PHP libraries that are installable with Composer. Browse packages below and if you have some open-source lib <a href="{{ path('submit') }}">submit it</a>!</p>
+                <p>Packagist is the main <a href="{{ path('about.composer') }}">Composer</a> repository. It aggregates all sorts of PHP packages that are installable with Composer. Browse packages below or <a href="{{ path('submit') }}">submit your own</a> (<a href="{{ path('about') }}">learn how</a>).</p>
                 {% endif %}
             </header>
 
-            {% if app.session.flash('success') %}
-                <div class="flash-message success">
-                    <p>{{ app.session.flash('success') }}</p>
-                </div>
-            {% endif %}
-            {% if app.session.flash('error') %}
-                <div class="flash-message error">
-                    <p>{{ app.session.flash('error') }}</p>
-                </div>
-            {% endif %}
-            {{ app.session.clearFlashes }}
-
             <div class="main" role="main">
+                {% if app.session.flash('success') %}
+                    <div class="flash-message success">
+                        <p>{{ app.session.flash('success') }}</p>
+                    </div>
+                {% endif %}
+                {% if app.session.flash('error') %}
+                    <div class="flash-message error">
+                        <p>{{ app.session.flash('error') }}</p>
+                    </div>
+                {% endif %}
+                {{ app.session.clearFlashes }}
+
                 {% block content %}
                 {% endblock %}
             </div>
+
+            <footer>
+                <ul>
+                    <li><a href="{{ path('about') }}">About Packagist</a></li>
+                    <li><a href="{{ path('about.composer') }}">About Composer</a></li>
+                    <li><a href="{{ path('home') }}">Home</a></li>
+                </ul>
+                <ul>
+                    {% if app.user %}
+                        <li><a href="{{ path('fos_user_profile_show') }}">Profile</a></li>
+                        <li><a href="{{ path('fos_user_security_logout') }}">Logout</a></li>
+                    {% else %}
+                        <li><a href="{{ path('fos_user_registration_register') }}">Register</a></li>
+                        <li><a href="{{ path('fos_user_security_login') }}">Login</a></li>
+                    {% endif %}
+                </ul>
+                <div class="clearfix"></div>
+            </footer>
         </div>
 
         <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>