MiniDigger/Hangar

View on GitHub
ore/app/views/projects/helper/inputSettings.scala.html

Summary

Maintainability
Test Coverage
@import ore.data.project.Category
@(form: String,
  homepage: Option[String] = None,
  issues: Option[String] = None,
  source: Option[String] = None,
  support: Option[String] = None,
  licenseName: Option[String] = None,
  licenseUrl: Option[String] = None,
  selected: Option[Category] = None,
  forumSync: Boolean = true,
  keywords: List[String] = Nil)(implicit messages: Messages)

<script type="text/javascript" src="@routes.Assets.versioned("javascripts/projectManage.js")"></script>

<div class="setting">
    <div class="setting-description">
        <h4>Category</h4>
        <p>
            Categorize your project into one of @Category.visible.size categories. Appropriately categorizing your
            project makes it easier for people to find.
        </p>
    </div>
    <div class="setting-content">
        <select class="form-control" id="category" name="category" form="@form">
            @for(category <- Category.values) {
                @if(category.isVisible) {
                    <option @if(selected.isDefined && selected.get.equals(category)) { selected } >
                        @category.title
                    </option>
                }
            }
        </select>
    </div>
    <div class="clearfix"></div>
</div>

<div class="setting">
    <div class="setting-description">
        <h4>Keywords <i>(optional)</i></h4>
        <p>
            These are special words that will return your project when people add them to their searches. Max 5.
        </p>
    </div>
    <input @if(keywords.nonEmpty) { value="@keywords.mkString(" ")" } form="@form" type="text" class="form-control" id="keywords"
    name="keywords" placeholder="sponge server plugins mods" />
    <div class="clearfix"></div>
</div>

<div class="setting">
    <div class="setting-description">
        <h4>Homepage <i>(optional)</i></h4>
        <p>
            Having a custom homepage for your project helps you look more proper, official, and gives you another place
            to gather information about your project.
        </p>
    </div>
    <input @if(homepage.isDefined) { value="@homepage.get" } form="@form" type="url" class="form-control" id="homepage"
    name="homepage" placeholder="https://spongepowered.org" />
    <div class="clearfix"></div>
</div>

<div class="setting">
    <div class="setting-description">
        <h4>Issue tracker <i>(optional)</i></h4>
        <p>
            Providing an issue tracker helps your users get support more easily and provides you with an easy way to
            track bugs.
        </p>
    </div>
    <input @if(issues.isDefined) { value="@issues.get" } form="@form" type="url" class="form-control" id="issues"
           name="issues" placeholder="https://github.com/SpongePowered/SpongeAPI/issues" />
    <div class="clearfix"></div>
</div>

<div class="setting">
    <div class="setting-description">
        <h4>Source code <i>(optional)</i></h4>
        <p>Support the community of developers by making your project open source!</p>
    </div>
    <input @if(source.isDefined) { value="@source.get" } form="@form" type="url" class="form-control" id="source"
           name="source" placeholder="https://github.com/SpongePowered/SpongeAPI" />
</div>

<div class="setting">
    <div class="setting-description">
        <h4>External support <i>(optional)</i></h4>
        <p>
            An external place where you can offer support to your users. Could be a forum, a Discord server, or
            somewhere else.
        </p>
    </div>
    <input @if(support.isDefined) { value="@support.get" } form="@form" type="url" class="form-control" id="support"
    name="support" placeholder="https://discord.gg/sponge" />
    <div class="clearfix"></div>
</div>

<div class="setting">
    <div class="setting-description">
        <h4>@messages("project.settings.license") <i>(@messages("general.optional"))</i></h4>
        <p>@messages("project.settings.license.info")</p>
    </div>
    <div class="input-group pull-left">
        <div class="input-group-btn">
            <button type="button" class="btn btn-default btn-license dropdown-toggle" data-toggle="dropdown"
                    aria-haspopup="true" aria-expanded="false">
                <span class="license">@licenseName.getOrElse(messages("licenses.mit"))</span>
                <span class="caret"></span>
            </button>
            <input type="text" class="form-control" style="display: none;" name="license-name" form="@form"
                   value="@licenseName.getOrElse(messages("licenses.mit"))" />
            <ul class="dropdown-menu dropdown-license">
                <li><a>@messages("licenses.mit")</a></li>
                <li><a>@messages("licenses.apache2.0")</a></li>
                <li><a>@messages("licenses.gpl")</a></li>
                <li><a>@messages("licenses.lgpl")</a></li>
                <li role="separator" class="divider"></li>
                <li><a class="license-custom">@messages("licenses.custom")&hellip;</a></li>
            </ul>
        </div>
        <input type="text" name="license-url" class="form-control" form="@form"
               placeholder="https://github.com/SpongePowered/SpongeAPI/LICENSE.md" value="@licenseUrl">
    </div>
    <div class="clearfix"></div>
</div>

<div class="setting">
    <div class="setting-description">
        <h4>@messages("project.settings.forumSync")</h4>
        <p>@messages("project.settings.forumSync.info")</p>
    </div>
    <div class="setting-content">
        <label>
            <input @if(forumSync) { checked } value="true" form="@form" type="checkbox" id="forum-sync" name="forum-sync">
            Make forum posts
        </label>
    </div>
    <div class="clearfix"></div>
</div>