Skip to content

Commit d07b9cd

Browse files
authored
Merge pull request #1259 from SynBioHub/createCollection
Modifications to make create collection more clear
2 parents 0745eee + be6619d commit d07b9cd

12 files changed

+115
-246
lines changed

lib/app.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,11 @@ function App () {
250250
app.get('/searchCount/:query?', views.search)
251251
app.get('/remoteSearch/:query?', forceNoHTML, views.search) /// DEPRECATED, use /search
252252

253-
app.get('/advancedSearch', views.advancedSearch)
254-
app.post('/advancedSearch', views.advancedSearch)
255-
256253
app.get('/sbsearch', views.sbsearch)
257254
app.post('/sbsearch', views.sbsearch)
258255

259-
app.get('/createCollection', views.advancedSearch)
256+
app.get('/advancedSearch', views.advancedSearch)
257+
app.post('/advancedSearch', views.advancedSearch)
260258
app.post('/createCollection', views.advancedSearch)
261259

262260
app.get('/:type/count', api.count)

lib/views/advancedSearch.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module.exports = function (req, res) {
2424
if (req.body.adv.startsWith('Filter')) {
2525
advancedSearchForm(req, res, {}, [])
2626
} else {
27-
if (req.originalUrl.endsWith('/createCollection')) {
27+
if (req.body.adv === 'Create' || req.originalUrl.endsWith('/createCollection')) {
2828
var errors = checkCollectionMeta(req, res)
2929
if (errors.length > 0) {
3030
advancedSearchForm(req, res, {}, errors)
@@ -114,11 +114,7 @@ function advancedSearchForm (req, res, locals, errors) {
114114
objects4: lists.object4List,
115115
objects5: lists.object5List
116116
}, locals)
117-
if (req.originalUrl.endsWith('/createCollection')) {
118-
res.send(pug.renderFile('templates/views/createCollection.jade', locals))
119-
} else {
120-
res.send(pug.renderFile('templates/views/advanced-search.jade', locals))
121-
}
117+
res.send(pug.renderFile('templates/views/advanced-search.jade', locals))
122118
}).catch((err) => {
123119
locals = {
124120
config: config.get(),
@@ -227,15 +223,15 @@ function advancedSearchPost (req, res) {
227223
user: req.user
228224
}
229225

230-
if (req.originalUrl.endsWith('/createCollection')) {
226+
if (req.body.adv === 'Create' || req.originalUrl.endsWith('/createCollection')) {
231227
limit = 10000
232228
}
233229

234230
return search(null, criteria, req.query.offset, limit, req.user).then((searchRes) => {
235231
const count = searchRes.count
236232
const results = searchRes.results
237233

238-
if (req.originalUrl.endsWith('/createCollection')) {
234+
if (req.body.adv === 'Create' || req.originalUrl.endsWith('/createCollection')) {
239235
var sbol = new Sboljs()
240236
var collection = sbol.collection()
241237
collection.displayId = req.body.metaId + '_collection'

templates/views/advanced-search.jade

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,22 @@
22
extends ../layouts/default.jade
33
include ../mixins/advanced-search-filter.jade
44

5-
block head
6-
style.
7-
body {
8-
background-color: #f6f6f6;
9-
}
10-
11-
.grey-page-mark {
12-
background-color: #f6f6f6;
13-
}
14-
15-
.top-search-form {
16-
display: none;
17-
}
18-
19-
.main-search-form input {
20-
width: 60%;
21-
margin-left: 0;
22-
background-color: white;
23-
padding: 14px 16px 13px 32px;
24-
}
25-
26-
.main-search-form .submit {
27-
padding: 12px 21px;
28-
}
29-
30-
.main-search-form label {
31-
color: #7F8C8D;
32-
}
33-
34-
.search-section {
35-
height: 60px;
36-
padding: 20px;
37-
margin: 0 auto;
38-
width: 60%;
39-
margin-bottom: 40px;
40-
text-align: center;
41-
}
42-
435
block breadcrumbs
446
ul
457
li.inactive
468
span.fa.fa-search
47-
| Advanced Search
9+
| Create Collection
4810

4911
block content
5012
div.submission-container(align='center')
5113
form(name="advancedSearch", method="post").submission-form
14+
15+
if errors.length > 0
16+
each error in errors
17+
div.alert.alert-danger
18+
p #{error}
19+
br
20+
5221
div.form-group-50.required
5322
table.table.advanced-search-table
5423
th Property
@@ -119,12 +88,44 @@ block content
11988

12089
div.clearfix
12190

122-
br
123-
br
124-
12591
button(type='submit',name="adv",value="Search").btn.btn-primary.btn-lg
12692
| Search
12793

94+
if locals.user
95+
div.row
96+
div.col-md-12
97+
div.form-group-100.required
98+
label(for="name") Collection Name
99+
a(href="http://wiki.synbiohub.org/wiki/Terms/SynBioHub#Name",title='SynBioHub organizes objects into collections. You can put as many objects as you want into one collection, and then conveniently download them all together or share the collection as a whole with other people.')
100+
span.fa.fa-info-circle
101+
input.form-control(name='metaName',id="metaName",placeholder='A short title for your collection. You can use spaces and symbols here.',value=collectionMeta.name,style="width: 675px;")
102+
div.row
103+
div.col-md-12
104+
div.form-group-100.required
105+
label(for="description") Collection Description
106+
textarea.form-control(name='metaDescription', id="metaDescription" placeholder='The more you say, the easier it will be to find your design.',value=collectionMeta.description,style="width: 675px;")
107+
| #{collectionMeta.description}
108+
109+
div.row
110+
div.col-md-6
111+
div.form-group-100.required
112+
label(for="id") Collection Id
113+
a(href="http://wiki.synbiohub.org/wiki/Terms/SynBioHub#Id",title='An id is a string of characters that MUST be composed of only alphanumeric or underscore characters and MUST NOT begin with a digit.')
114+
span.fa.fa-info-circle
115+
input.form-control(type='text', id="metaId", name='metaId',placeholder='Just letters and numbers, no spaces',value=collectionMeta.id)
116+
div.col-md-6
117+
div.form-group-100.required
118+
label(for='version') Collection Version
119+
a(href="http://wiki.synbiohub.org/wiki/Terms/SynBioHub#Version",title='A version is a string of characters that MUST be composed of only alphanumeric characters, underscores, hyphens, or periods and MUST begin with a digit.')
120+
span.fa.fa-info-circle
121+
input.form-control(type='text', id='metaVersion', name='metaVersion',placeholder='Version',value=collectionMeta.version)
122+
123+
div.clearfix
124+
br
125+
126+
button(type='submit',name="adv",value="Create").btn.btn-primary.btn-lg
127+
| Create Collection
128+
128129

129130

130131

templates/views/createCollection.jade

Lines changed: 0 additions & 129 deletions
This file was deleted.

templates/views/search.jade

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ block content
6060
| |
6161
a(href='/advancedSearch') Advanced Search
6262
| |
63-
if (locals.user)
64-
a(href='/createCollection') Create Collection
65-
| |
6663
a(href='/sparql') SPARQL
6764
br
6865

templates/views/submit.jade

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ block content
2121

2222
ul.nav.nav-tabs(role="tablist")
2323
li.active(role="presentation")
24-
a(data-toggle="tab", href="#new", role="tab", aria-controls="new") Submit to New Collection
24+
a(data-toggle="tab", href="#new", role="tab", aria-controls="new") Create a New Collection
2525
li(role="presentation")
2626
a(data-toggle="tab", href="#existing", role="tab", aria-controls="existing") Submit to Existing Collection
2727

@@ -82,7 +82,7 @@ block content
8282
div.row
8383
div.col-md-12
8484
div.form-group-100
85-
label SBOL/GenBank/FASTA/ZIP File
85+
label SBOL/GenBank/GFF3/FASTA/ZIP File (optional)
8686
br
8787
input(type='file',name='file',value=submission.file)
8888

@@ -130,7 +130,7 @@ block content
130130
div.row
131131
div.col-md-12
132132
div.form-group.required
133-
label SBOL/GenBank/FASTA/ZIP File
133+
label SBOL/GenBank/GFF3/FASTA/ZIP File
134134
input(type='file',name='file',value=submission.file)
135135

136136
div.row

0 commit comments

Comments
 (0)