Skip to content

Commit

Permalink
Add nifty lil badges to identify sponge plugins / forge mods / both
Browse files Browse the repository at this point in the history
They will also show you the dependency version for the current recommended build of the project on hover.

Signed-off-by: Walker Crouse <walkercrouse@hotmail.com>
  • Loading branch information
windy1 committed Nov 21, 2016
1 parent 39fddb3 commit 4ee5eab
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/assets/stylesheets/_project.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import 'pallette';
@import 'utils';
@import 'sponge_variables';

.alert-review {
margin-bottom: 10px;
Expand Down Expand Up @@ -157,7 +158,8 @@
}

.spongeapi {
background-color: #F6CF17;
background-color: $sponge_yellow;
color: black;
}

.forgemod {
Expand Down
24 changes: 24 additions & 0 deletions app/views/projects/list.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@
@import db.impl.access.UserBase
@import models.project.Project
@import ore.OreConfig
@import ore.project.Dependency
@(models: Seq[Project], page: Int, pageSize: Int, call: Int => Call)(implicit messages: Messages, flash: Flash,
service: ModelService, config: OreConfig, users: UserBase)

@spongeVersion(project: Project) = @{
project.recommendedVersion.dependencies.find(_.pluginId.equals(Dependency.SpongeApiId)).get.version
}

@forgeVersion(project: Project) = @{
project.recommendedVersion.dependencies.find(_.pluginId.equals(Dependency.ForgeId)).get.version
}

<ul class="list-group project-list">
@models.map { project =>
<li class="list-group-item @if(!project.isVisible) { project-hidden }">
Expand Down Expand Up @@ -45,12 +54,27 @@
</span>
}
}

<span class="stat" title="Views"><i class="fa fa-eye"></i> @project.viewCount</span>
<span class="stat" title="Download"><i class="fa fa-download"></i> @project.downloadCount</span>
<span class="stat" title="Stars"><i class="fa fa-star"></i> @project.starCount</span>

@defining(project.category) { category =>
<span class="stat fa @category.icon" title="@category.title"></span>
}

@if(project.isSpongePlugin) {
<span class="stat channel channel-sm spongeapi" data-toggle="tooltip" title="@spongeVersion(project)">
@messages("general.sponge")
</span>
}

@if(project.isForgeMod) {
<span class="stat channel channel-sm forgemod" data-toggle="tooltip" title="@forgeVersion(project)">
@messages("general.forge")
</span>
}

</div>
<div class="clearfix"></div>
</li>
Expand Down
1 change: 1 addition & 0 deletions conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ general.learnMore = Learn more
general.optional = optional
general.spongeApi = Sponge API
general.forge = Forge
general.sponge = Sponge
general.spongePlugin = Sponge Plugin
general.spongePlugin.tooltip = To mark your project as a Sponge plugin, add spongeapi as a dependency.
general.forgeMod = Forge Mod
Expand Down
5 changes: 2 additions & 3 deletions public/javascripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ $(function() {
$('.alert-fade').fadeIn('slow');

$('[data-toggle="tooltip"]').tooltip({
delay: {
"show": 500
}
container: "body",
delay: { "show": 500 }
});

$('.authors-icon').click(function() { window.location = '/authors'; });
Expand Down

0 comments on commit 4ee5eab

Please sign in to comment.