Skip to content

Commit 8072b42

Browse files
authored
Merge pull request #69 from common-workflow-language/twitter-summary-card
Twitter summary card support
2 parents 026229d + e933d6c commit 8072b42

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

src/main/java/org/commonwl/viewer/services/DotWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void writeGraph(Workflow workflow) throws IOException {
5757

5858
// Overall graph style
5959
writeLine(" graph [");
60-
writeLine(" bgcolor = \"transparent\"");
60+
writeLine(" bgcolor = \"#eeeeee\"");
6161
writeLine(" color = \"black\"");
6262
writeLine(" fontsize = \"10\"");
6363
writeLine(" labeljust = \"left\"");

src/main/java/org/commonwl/viewer/services/WorkflowRepository.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public interface WorkflowRepository extends PagingAndSortingRepository<Workflow,
3333
// Finds a workflow model in the database based on where it was retrieved from
3434
Workflow findByRetrievedFrom(GithubDetails retrievedFrom);
3535

36-
// Get the first 10 workflows
3736
Page<Workflow> findAllByOrderByRetrievedOnDesc(Pageable pageable);
3837

3938
}

src/main/java/org/commonwl/viewer/web/WorkflowController.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ public ModelAndView newWorkflowFromGithubURL(@Valid WorkflowForm workflowForm, B
137137
* @return The workflow view with the workflow as a model
138138
*/
139139
@RequestMapping(value="/workflows/github.com/{owner}/{repoName}/tree/{branch}/**")
140-
public ModelAndView getWorkflowByGithubDetails(@PathVariable("owner") String owner,
140+
public ModelAndView getWorkflowByGithubDetails(@Value("${applicationURL}") String applicationURL,
141+
@PathVariable("owner") String owner,
141142
@PathVariable("repoName") String repoName,
142143
@PathVariable("branch") String branch,
143144
HttpServletRequest request) {
@@ -181,7 +182,7 @@ public ModelAndView getWorkflowByGithubDetails(@PathVariable("owner") String own
181182
}
182183

183184
// Display this model along with the view
184-
return new ModelAndView("workflow", "workflow", workflowModel);
185+
return new ModelAndView("workflow", "workflow", workflowModel).addObject("appURL", applicationURL);
185186

186187
}
187188

@@ -239,7 +240,8 @@ public FileSystemResource getGraphAsSvg(@Value("${graphvizStorage}") String grap
239240
gv.decreaseDpi();
240241
gv.decreaseDpi();
241242
gv.decreaseDpi();
242-
gv.writeGraphToFile(gv.getGraph(workflowModel.getDotGraph(), "svg", "dot"), out.getAbsolutePath());
243+
gv.writeGraphToFile(gv.getGraph(workflowModel.getDotGraph()
244+
.replace("bgcolor = \"#eeeeee\"", "bgcolor = \"transparent\""), "svg", "dot"), out.getAbsolutePath());
243245
}
244246

245247
// Output the graph image

src/main/resources/templates/workflow.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
<head>
2323
<meta charset="UTF-8" />
2424
<meta name="viewport" content="width=device-width, initial-scale=1" />
25+
<meta name="twitter:card" content="summary_large_image" />
26+
<meta name="twitter:site" content="@commonwl" />
27+
<meta name="twitter:title" th:content="${'CWL Workflow: ' + workflow.label}" />
28+
<meta name="twitter:description" th:if="${workflow.doc != null}" th:content="${workflow.doc}" />
29+
<meta name="twitter:image" th:content="${appURL + '/workflows/' + workflow.id + '/graph/png'}" />
2530
<title>Common Workflow Language Viewer</title>
2631
<link rel="stylesheet" type="text/css" th:href="@{/css/main.css}" href="../static/css/main.css" />
2732
<link rel="stylesheet" th:href="@{/bower_components/bootstrap/dist/css/bootstrap.min.css}" href="../static/bower_components/bootstrap/dist/css/bootstrap.min.css" />

0 commit comments

Comments
 (0)