This repository has been archived by the owner on Mar 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first attempt at editing an existing field (AJAX)
Proposal.Problem editing (following JavaGuide5)
- Loading branch information
Showing
3 changed files
with
64 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,29 @@ | ||
package controllers; | ||
|
||
import java.util.*; | ||
|
||
import static play.data.Form.form; | ||
import play.mvc.*; | ||
import models.*; | ||
import views.html.snippets.*; | ||
|
||
@Security.Authenticated(Secured.class) | ||
public class Proposals extends Controller { | ||
|
||
public static Result createProposal() { | ||
Proposal newProposal = Proposal.createAndSave("New proposal", | ||
"", "", "", | ||
request().username()); | ||
|
||
return ok(displayProposalDetail.render(newProposal)); | ||
} | ||
// public static Result propose() { | ||
// Proposal newProposal = Proposal.createAndSave(title, problem, solution, benefits, | ||
// request().username()) | ||
// | ||
// | ||
// .create( | ||
// "New project", | ||
// form().bindFromRequest().get("group"), | ||
// request().username() | ||
// ); | ||
// return ok(item.render(newProject)); | ||
// } | ||
|
||
package controllers; | ||
|
||
import static play.data.Form.form; | ||
import play.mvc.*; | ||
import models.*; | ||
import views.html.snippets.*; | ||
|
||
@Security.Authenticated(Secured.class) | ||
public class Proposals extends Controller { | ||
|
||
public static Result createProposal() { | ||
Proposal newProposal = Proposal.createAndSave("New proposal", | ||
"", "", "", | ||
request().username()); | ||
|
||
return ok(displayProposalDetail.render(newProposal)); | ||
} | ||
|
||
public static Result editProblem(Long proposalId) { | ||
if (Secured.isAllowedToEdit(proposalId)) { | ||
return ok( | ||
Proposal.editProblem(proposalId, form().bindFromRequest().get("username")) | ||
); | ||
} else { | ||
return forbidden(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters