use of models.PlayVersion in project modules.playframework.org by playframework.
the class PlayVersions method update.
public static Result update() {
Result result;
Form<PlayVersion> form = form(PlayVersion.class).bindFromRequest();
if (form.hasErrors()) {
result = badRequest(form.errorsAsJson());
} else {
PlayVersion incoming = form.get();
PlayVersion storedVersion = PlayVersion.FIND.byId(incoming.id);
storedVersion.name = incoming.name;
storedVersion.documentationUrl = incoming.documentationUrl;
storedVersion.majorVersion = getMajorVersion(storedVersion);
storedVersion.save();
result = ok(Json.toJson(storedVersion));
}
return result;
}
use of models.PlayVersion in project modules.playframework.org by playframework.
the class Modules method getModulesByPlayVersion.
// e.g. /modules/play-1.2.4
public static Result getModulesByPlayVersion(String version) {
List<PlayVersion> playVersionList = PlayVersion.findByLooseName(version);
Result result;
if (playVersionList.isEmpty()) {
result = notFound("Play version not found: " + version);
} else {
User currentUser = currentUser();
String title = String.format("Play %s.x modules", version);
List<Module> modules = ModuleVersion.findModulesByPlayVersion(playVersionList);
result = ok(genericModuleList.render(currentUser, title, modules));
}
return result;
}
use of models.PlayVersion in project modules.playframework.org by playframework.
the class PlayVersions method addNewPlayVersion.
public static Result addNewPlayVersion() {
Result result;
Form<PlayVersion> form = form(PlayVersion.class).bindFromRequest();
if (form.hasErrors()) {
result = badRequest(playVersions.render(currentUser(), PlayVersion.findByMajorVersion(PlayVersion.MajorVersion.ONE), PlayVersion.findByMajorVersion(PlayVersion.MajorVersion.TWO), form));
} else {
PlayVersion playVersion = form.get();
playVersion.majorVersion = getMajorVersion(playVersion);
playVersion.save();
result = redirect(routes.PlayVersions.showPlayVersions());
}
return result;
}
Aggregations