Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Commit

Permalink
Add a last-minute (somewhat ugly) instruction window for the default …
Browse files Browse the repository at this point in the history
…vinumeris.com server, to try and smooth the "hmm let's create a project" path for newbies a little bit. It's not ideal but would require issue #31 to be resolved for a more excellent user experience. But this will suffice for beta.
  • Loading branch information
mikehearn committed Jan 13, 2015
1 parent f051f06 commit 662593d
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 2 deletions.
10 changes: 8 additions & 2 deletions client/src/main/java/lighthouse/subwindows/ExportWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,15 @@ public void saveClicked() {
log.info("Saving {} data to {}", pledge != null ? "pledge" : "project", file);
try (OutputStream outputStream = new FileOutputStream(file)) {
data.writeTo(outputStream);
if (pledge != null)
if (savingPledge) {
pledge.commit(true);
overlayUI.done(); // Only if successful.
} else if (project.getPaymentURL() != null && project.getPaymentURL().getHost().equals("vinumeris.com")) {
// Special last minute usability hack for this server only.
// TODO: either generalise this or implement issue 31 (smoother upload/submit path to servers).
ProjectSubmitInstructionsWindow.open("project-hosting@vinumeris.com");
return;
}
overlayUI.done();
} catch (IOException e) {
GuiUtils.informationalAlert("Failed to save file", e.getLocalizedMessage());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package lighthouse.subwindows;

import javafx.event.*;
import javafx.fxml.*;
import javafx.scene.control.*;
import lighthouse.*;
import org.slf4j.*;

/**
* Quick usability hint for people who don't RTFM and get confused what they do after creating a project :-)
* This will go away at some point once issue 31 (smoother upload/review queue path) is implemented.
*/
public class ProjectSubmitInstructionsWindow {
private static final Logger log = LoggerFactory.getLogger(ProjectSubmitInstructionsWindow.class);

@FXML Label submitEmailAddr;
public Main.OverlayUI<InnerWindow> overlayUI;

public static void open(String submitEmail) {
log.info("Showing project submit instructions: {}", submitEmail);
ProjectSubmitInstructionsWindow window = Main.instance.<ProjectSubmitInstructionsWindow>overlayUI(
"subwindows/project_submit_instructions.fxml", "Information").controller;
window.submitEmailAddr.setText(submitEmail);
window.submitEmailAddr.setOnMouseClicked(ev -> {
Main.instance.getHostServices().showDocument(String.format("mailto:%s", submitEmail));
});
}

@FXML
public void closeClicked(ActionEvent event) {
overlayUI.done();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>


<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.*?>
<?import javafx.scene.layout.*?>
<BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="221.0" prefWidth="562.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="lighthouse.subwindows.ProjectSubmitInstructionsWindow">
<bottom>
<HBox alignment="CENTER_RIGHT" prefHeight="100.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<Button defaultButton="true" mnemonicParsing="false" onAction="#closeClicked" text="Close" />
</children>
<padding>
<Insets bottom="30.0" left="30.0" right="30.0" top="30.0" />
</padding>
</HBox>
</bottom>
<center>
<VBox prefHeight="200.0" prefWidth="100.0" spacing="10.0" BorderPane.alignment="CENTER">
<children>
<Label style="-fx-font-size: 20;" text="To submit your project for hosting, email it to:" />
<Label fx:id="submitEmailAddr" style="-fx-font-size: 30; -fx-text-fill: blue; -fx-underline: true;" text="project-hosting@vinumeris.com">
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
</Label>
</children>
<padding>
<Insets bottom="30.0" left="30.0" right="30.0" top="30.0" />
</padding>
</VBox>
</center>
</BorderPane>

0 comments on commit 662593d

Please sign in to comment.