Search in sources :

Example 1 with PlayVersion

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;
}
Also used : PlayVersion(models.PlayVersion) Result(play.mvc.Result)

Example 2 with PlayVersion

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;
}
Also used : CurrentUser.currentUser(actions.CurrentUser.currentUser) CurrentUser(actions.CurrentUser) User(models.User) PlayVersion(models.PlayVersion) Module(models.Module) Result(play.mvc.Result)

Example 3 with PlayVersion

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;
}
Also used : PlayVersion(models.PlayVersion) Result(play.mvc.Result)

Aggregations

PlayVersion (models.PlayVersion)3 Result (play.mvc.Result)3 CurrentUser (actions.CurrentUser)1 CurrentUser.currentUser (actions.CurrentUser.currentUser)1 Module (models.Module)1 User (models.User)1