Support for studios

Search and Explore now support studios, thought currently the api is
not ready for them.
This commit is contained in:
Rachel Thornton 2016-05-10 08:16:46 -04:00
parent d7c9057cbd
commit 9c6475aed5
12 changed files with 222 additions and 40 deletions

View file

@ -10,27 +10,46 @@ notifications:
secure: ezESiG7JnuSLZc2/PPhOvWUv5BHBCr+g86MsuLLw+S+zz3DUfzWHMQ1g5tUvkeSDTPmfEIX41EnPkaoWtsD3OGO0PGXgseAfA8+6Z4N1rICNZZrhXZB2s6UdwRK1e+0Jol4W3kHmt96BHyN2scLNgJYeWMgSJllVsuPhMTlKBZIXI9u540NH8Nxjl3f2WvoIg64Q1mZvMxkpPbw4xssx6U4HSFE8kTTE6+EFsSxzombFX0cLGjPiJ9QZgGVUk4UkIjyiFLQQDfQlLllCaUpqJ9+qbuCNoMSKA2yty/qyZ8Y+r4OlMberjmBzR9GRLLyXWWcaAfMIgwlRhjtLYIDAUSsGM1iwUWCgyB9maG2IiXuYLSueuMx8DcDwbpUepoDgnqBYnM2AJmT8gcsxqlKYzJpYpHDgZgBlLZQgMXqjrVJHs/Tf9XVcLS6HAn1Ww0OOT01jThfy4gClpAuqLayYexsXOoL+RaFg25E2NzuTtaFWgRfWZgcAeqYNDiUzwun2D4vZ5I+NtdRP0gzpbG2fxhFz05vAqyf1Kp6ZYb17Li3A38dIm6Lsvv3qawAIAgNaZpIZX3f89+uq6jHU8kJy1Iv823JK2Xac3vEz3SHUKJnuXFF0LO07om9AcNEXhP/JrJ617S8nfvDtZRJODMFhz8qQwie+65Ql1I871goBpVs=
env:
global:
- API_HOST_master=https://api.scratch.mit.edu
- API_HOST_STAGING=https://api-staging.scratch.mit.edu
- API_HOST_VAR=API_HOST_$TRAVIS_BRANCH
- API_HOST=${!API_HOST_VAR}
- API_HOST=${API_HOST:-$API_HOST_STAGING}
# EB_AWS_ACCESS_KEY_ID
- secure: A138rYuXDsOmpEwYxZ31WyXEeq5fgr9qyqsQh1nTFsjBKpFtNM+CN9e0QJQFT3PLs4wH/lWT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yvo09YJ2QIn4IFGPvwOVS7Firzi+fLl8GYApeSV9G10e1IzA4pPrKdJMRA4qRMPt9zJGq7ZO1J/d9aW/5KIsJUDnodnl7yXJyDMOyNeljT9I82ciHZcURxRRY080vrW6dgNJE1V9jxBhWEvr2iCeWMMedWaGuC41I7K9L79eW8lmaE+cQ+OZrzpOJP4GbfmIiXrh+0M4ChL/xBpjtiFwpNdkCXXhzWMnjJ4wCrii4yuc=
- CXX=g++-4.8
- AWS_ACCESS_KEY_ID=$EB_AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY=$EB_AWS_SECRET_ACCESS_KEY
- CXX=g++-4.8
- FASTLY_ACTIVATE_CHANGES=true
- S3_BUCKET_NAME_STAGING=scratch-www-staging
- S3_BUCKET_NAME_PRODUCTION=scratch-www-production
- S3_ACL=public_read
- S3_LOCAL_DIR=build
- S3_REGION=us-east-1
- SKIP_CLEANUP=true
- WWW_VERSION=${TRAVIS_COMMIT:0:5}
# FASTLY_API_KEY
- secure: XNWcCnqSAd4MpKg6FVe3WeFmdqfdH753+PBCOEkJrHS+AHmLMuWsjIQFJ3LUR9ylEQRVPR2OyXJW/R8NI9toStREgwE4fwIVo0l4fwYqLStxYpEKlcWfkJ3uNpRZhvcVmUBycelrnjJqXVdrtlxPCKX0tNkpcKH2b98We7A2/r7HxKv13upDxWTQ/qRUv0+SJCRTB4n/QInABi87Ef8Q2rNGrL0WQzQvVBeiEXOP0JSkyYK4+q65gswMKPehgiFagnYVgJN9J9Q1VrBDc06gidbznBcEpPaBAYvsTTY9dWTJxaaKNSrmOIe/OiuJUEHjb+8NL+j6Lp7wX8lzEjbr0FkVlFnxS9VbftS2KFkN7+c3RF57+tsq0xwJ6vgomIVS5FupHgl/oCJicnH/FLfynditOLZhmhF+Ed5GCAoIEamRRzcVHdjvglsEtYsDX1/z2t+HKYtPQuXYOywDRVTSPf88eEbu8ehfgNcYaIAuD6eedyDnKTOIv7owWs3Y7GsxQ2jBLGXq1YoUEkPtB0v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oaWOBplwfY011G0QKq1VNpZrmHJZaHMLruP8rbXLHWnQkkQp/RlT+7+z+Tf+3kB8LBRykRt8WaH717eblUUm5MVPFrZA0A5faCD8o0maN3SA=
- secure: MyT0xGN75v1bVnP1fpKaenx2WijGi2OZCQV5TDeDkgqlkW9n2HOtGa4bWE+cT+hR8UieC176sGg7OvsUCy0nYm5QhR8WJc+8WGa689GsPDUMgw+hUKfk/JYeHQHNKTwAyY6iN6Jo2qQtcBMS/M8xakwYaktB0vcNNId13Fhj7IMUTUEdpSWQLTkaXGB7cHM0ak9KqivH2aqzoncJnhcRNrqVz3FaLKmqAXI8NpQcgz5uAxkBjmniIHWkJPWRvLqr3xRebDaXiMFI7pB+iTSlbzR2lqsZLzZpSBJbqKhPx99KvnHjlSq7LAjP840X5Vj5ZCPlSrZe4IIYp2g863j5nOUHj1MC1Eh6xD3bjmZ+61KaWchSWMp+XOs9grghl9kLexfwZbCNxW0s8uq+WqOY/qcbzm/go5z7WFlDJ1Qmdo2sLhdtwCwcSwyCR8nhoaHqJtKg9PJTyKbr+SWizDVlSyWRccqyJ1jd/vjd1xAG5RRM6YuP4RBqEAWGzOsx+kJMhnOOI3yIZfY7eTntMxb9Gxjyk4IsBX3pyPHJSWeb7x4bzMGCHSewMmdTzcFHvSmRaZ2w50PSqPSagR42mYJqAfaS1/eMSf2oI5kE9RmiQYP4SrLerdYFbYEt0w8/+Hu8glRqpJtMSB42yWanMIvMBahSQH9dun3TzFQKKEljwzA=
- FASTLY_SERVICE_ID_VAR=FASTLY_SERVICE_ID_$TRAVIS_BRANCH
- FASTLY_SERVICE_ID=${!FASTLY_SERVICE_ID_VAR}
- FASTLY_SERVICE_ID=${FASTLY_SERVICE_ID:-$FASTLY_SERVICE_ID_STAGING}
- GA_TRACKER_master=UA-30688952-1
- GA_TRACKER_VAR=GA_TRACKER_$TRAVIS_BRANCH
- GA_TRACKER=${!GA_TRACKER_VAR}
- GA_TRACKER=${GA_TRACKER:-$GA_TRACKER_STAGING}
- S3_BUCKET_NAME_master=scratch-www-production
- S3_BUCKET_NAME_STAGING=scratch-www-staging
- S3_BUCKET_NAME_VAR=S3_BUCKET_NAME_$TRAVIS_BRANCH
- S3_BUCKET_NAME=${!S3_BUCKET_NAME_VAR}
- S3_BUCKET_NAME=${S3_BUCKET_NAME:-$S3_BUCKET_NAME_STAGING}
- S3_LOCAL_DIR=build
- SENTRY_DSN_master=https://6cf7e15e06b24ba48b727910bd9e6d9e@app.getsentry.com/54913
- SENTRY_DSN_STAGING=https://7e69dd3d620e434490f07ef0e60613f9@app.getsentry.com/58289
- SENTRY_DSN_VAR=SENTRY_DSN_$TRAVIS_BRANCH
- SENTRY_DSN=${!SENTRY_DSN_VAR}
- SENTRY_DSN=${SENTRY_DSN:-$SENTRY_DSN_STAGING}
- SKIP_CLEANUP=true
- NODE_ENV=production
- WWW_VERSION=${TRAVIS_COMMIT:0:5}
addons:
apt:
sources:
@ -43,7 +62,7 @@ install:
deploy:
- provider: script
skip_cleanup: $SKIP_CLEANUP
script: env FASTLY_SERVICE_ID=$FASTLY_SERVICE_ID_STAGING S3_BUCKET_NAME=$S3_BUCKET_NAME_STAGING make sync
script: env make sync
on:
repo: LLK/scratch-www
branch:
@ -52,7 +71,7 @@ deploy:
- release/*
- provider: script
skip_cleanup: $SKIP_CLEANUP
script: env FASTLY_SERVICE_ID=$FASTLY_SERVICE_ID_PRODUCTION S3_BUCKET_NAME=$S3_BUCKET_NAME_PRODUCTION make sync
script: env make sync
on:
repo: LLK/scratch-www
branch:

View file

@ -61,12 +61,14 @@ Use `^C` to stop the node process `npm start` starts.
`npm start` can be configured with the following environment variables
| Variable | Default | Description |
| ------------- | ------------------------------------- | ---------------------------------------------- |
| `API_HOST` | `https://api.scratch.mit.edu` | Hostname for API requests |
| `NODE_ENV` | `null` | If not `production`, app acts like development |
| `PORT` | `8333` | Port for devserver (http://localhost:XXXX) |
| `FALLBACK` | `''` | Pass-through location for old site |
| Variable | Default | Description |
| ------------- | ----------------------------- | ---------------------------------------------- |
| `API_HOST` | `https://api.scratch.mit.edu` | Hostname for API requests |
| `SENTRY_DSN` | `''` | DSN for Sentry |
| `FALLBACK` | `''` | Pass-through location for old site |
| `GA_TRACKER` | `''` | Where to log Google Analytics data |
| `NODE_ENV` | `null` | If not `production`, app acts like development |
| `PORT` | `8333` | Port for devserver (http://localhost:XXXX) |
**NOTE:** Because by default `API_HOST=https://api.scratch.mit.edu`, please be aware that, by default, you will be seeing and interacting with real data on the Scratch website.

View file

@ -46,5 +46,85 @@
"thumbnailUrl": "",
"creator": "",
"href": "#"
},
{
"id": 7,
"type": "project",
"title": "Project",
"thumbnailUrl": "",
"creator": "",
"href": "#"
},
{
"id": 8,
"type": "project",
"title": "Project",
"thumbnailUrl": "",
"creator": "",
"href": "#"
},
{
"id": 9,
"type": "project",
"title": "Project",
"thumbnailUrl": "",
"creator": "",
"href": "#"
},
{
"id": 10,
"type": "project",
"title": "Project",
"thumbnailUrl": "",
"creator": "",
"href": "#"
},
{
"id": 11,
"type": "project",
"title": "Project",
"thumbnailUrl": "",
"creator": "",
"href": "#"
},
{
"id": 12,
"type": "project",
"title": "Project",
"thumbnailUrl": "",
"creator": "",
"href": "#"
},
{
"id": 13,
"type": "project",
"title": "Project",
"thumbnailUrl": "",
"creator": "",
"href": "#"
},
{
"id": 14,
"type": "project",
"title": "Project",
"thumbnailUrl": "",
"creator": "",
"href": "#"
},
{
"id": 15,
"type": "project",
"title": "Project",
"thumbnailUrl": "",
"creator": "",
"href": "#"
},
{
"id": 16,
"type": "project",
"title": "Project",
"thumbnailUrl": "",
"creator": "",
"href": "#"
}
]

View file

@ -91,6 +91,12 @@
"pattern": "^/info/donate/?",
"redirect": "https://secure.donationpay.org/scratchfoundation/"
},
{
"name": "dmca",
"pattern": "^/DMCA/?$",
"view": "dmca/dmca",
"title": "DMCA"
},
{
"name": "guidelines",
"pattern": "^/community_guidelines$",

View file

@ -22,7 +22,7 @@ module.exports = {
ga_tracker: process.env.GA_TRACKER || '',
// Error handling
sentry_dsn: process.env.CLIENT_SENTRY_DSN || '',
sentry_dsn: process.env.SENTRY_DSN || '',
// Use minified JS libraries
min: (process.env.NODE_ENV === 'production') ? '.min' : '',

View file

@ -279,6 +279,18 @@ var ConferencePlan = React.createClass({
Proposal submissions are now closed.
</dd>
<dt>
How much does it cost to register?
</dt>
<dd>
Through May 1, registration is $150 per ticket (Early Bird rate).{' '}
After May 1, registration increases to $250 per ticket. You can register{' '}
for the conference through the{' '}
<a href="https://www.eventbrite.com/e/scratchmit-2016-registration-21793477879">
registration form
</a>.
</dd>
<dt>
I can only attend one day of the conference. Do you offer single-day{' '}
registration?

34
src/views/dmca/dmca.jsx Normal file
View file

@ -0,0 +1,34 @@
var React = require('react');
var FormattedMessage = require('react-intl').FormattedMessage;
var render = require('../../lib/render.jsx');
var Page = require('../../components/page/www/page.jsx');
var Box = require('../../components/box/box.jsx');
require('./dmca.scss');
var Dmca = React.createClass({
type: 'Dmca',
render: function () {
return (
<div className="inner">
<Box title={'DMCA'}>
<p><FormattedMessage id='dmca.intro' /></p>
<p>
Copyright Agent / Mitchel Resnick<br/>
MIT Media Laboratory<br/>
77 Massachusetts Ave<br/>
Room E14-445A<br/>
Cambridge, MA 02139<br/>
Tel: (617) 253-9783
</p>
<p><FormattedMessage id='dmca.llkresponse' /></p>
<p><FormattedMessage id='dmca.assessment' /></p>
<p><FormattedMessage id='dmca.eyetoeye' /></p>
<p><FormattedMessage id='dmca.afterfiling' /></p>
</Box>
</div>
);
}
});
render(<Page><Dmca /></Page>, document.getElementById('app'));

2
src/views/dmca/dmca.scss Normal file
View file

@ -0,0 +1,2 @@
@import "../../colors";
@import "../../typography";

7
src/views/dmca/l10n.json Normal file
View file

@ -0,0 +1,7 @@
{
"dmca.intro": "The Lifelong Kindergarten research group respects the intellectual property of others, as well as our users. If you believe that your work has been copied in a way that constitutes copyright infringement, please email copyright@scratch.mit.edu, or mail your complaint to the following:",
"dmca.llkresponse": "The Lifelong Kindergarten Group will promptly process and investigate notices of alleged infringement and will take appropriate actions under the Digital Millennium Copyright Act (“DMCA”) and other applicable intellectual property laws. Upon receipt of notices complying or substantially complying with the DMCA, the Lifelong Kindergarten Group may act expeditiously to remove or disable access to any material claimed to be infringing. Repeat infringers of third-party copyrights are subject to termination in appropriate circumstances.",
"dmca.assessment": "In assessing whether or not a Scratch user has violated your copyrights, please keep in mind that Scratch is an educational and not-for-profit initiative, seeking to aid childrens learning by providing the tools for them to learn and express themselves using digital technology. Please also keep in mind the “Fair Use” doctrine incorporated into the Copyright Act of 1976, 17 U.S.C. § 107.",
"dmca.eyetoeye": "We hope you also see Scratch not only as a good way of popularizing your creations/website but also as an opportunity to do something good for childrens education.",
"dmca.afterfiling": "If you choose to make a copyright infringement complaint, please note that we may post your notification, with personally identifiable information redacted, to a clearinghouse such as chillingeffects.org. Please also note that you may be liable for damages (including costs and attorneys fees) if you materially misrepresent that an activity is infringing your copyright."
}

View file

@ -22,20 +22,25 @@ var Explore = injectIntl(React.createClass({
],
getDefaultProps: function () {
var tabOptions = ['all','animations','art','games','music','stories'];
var typeOptions = ['projects','studios'];
var pathname = window.location.pathname;
var pathname = window.location.pathname.toLowerCase();
if (pathname.substring(pathname.length-1,pathname.length) == '/') {
pathname = pathname.substring(0,pathname.length-1);
}
var slash = pathname.lastIndexOf('/');
var currentTab = pathname.substring(slash+1,pathname.length).toLowerCase();
if (tabOptions.indexOf(currentTab) == -1) {
var currentTab = pathname.substring(slash+1,pathname.length);
var typeStart = pathname.indexOf('explore/');
var type = pathname.substring(typeStart+8,slash);
if (tabOptions.indexOf(currentTab) == -1 || typeOptions.indexOf(type) == -1) {
window.location = window.location.origin + '/explore/projects/all/';
}
return {
tab: currentTab,
acceptableTabs: tabOptions,
acceptableTypes: typeOptions,
itemType: type,
loadNumber: 16
};
},
@ -54,7 +59,8 @@ var Explore = injectIntl(React.createClass({
tabText = '&q=' + this.props.tab;
}
this.api({
uri: '/search/projects?limit=' + this.props.loadNumber + '&offset=' + this.state.offset + tabText
uri: '/search/' + this.props.itemType
+ '?limit=' + this.props.loadNumber + '&offset=' + this.state.offset + tabText
}, function (err, body) {
if (!err) {
var loadedSoFar = this.state.loaded;
@ -65,8 +71,18 @@ var Explore = injectIntl(React.createClass({
}
}.bind(this));
},
changeItemType: function () {
var newType;
for each (var t in this.props.acceptableTypes) {
if (this.props.itemType != t) {
newType = t;
break;
}
}
window.location = window.location.origin + '/explore/'+newType+'/'+this.props.tab;
},
getTab: function (type) {
var allTab = <a href={'/explore/projects/'+type+'/'}>
var allTab = <a href={'/explore/'+this.props.itemType+'/'+type+'/'}>
<li>
<FormattedMessage
id={'explore.' + type}
@ -74,7 +90,7 @@ var Explore = injectIntl(React.createClass({
</li>
</a>;
if (this.props.tab==type) {
allTab = <a href={'/explore/projects/' + type + '/'}>
allTab = <a href={'/explore/'+this.props.itemType+'/' + type + '/'}>
<li className='active'>
<FormattedMessage
id={'explore.' + type}
@ -99,17 +115,17 @@ var Explore = injectIntl(React.createClass({
{this.getTab('games')}
{this.getTab('music')}
{this.getTab('stories')}
<Select name="sort" defaultValue="Projects">
<option value="Projects" key="Projects">
<Select onChange={this.changeItemType} name="sort" defaultValue={this.props.itemType}>
<option value="projects" key="projects">
Projects
</option>
<option value="Studios" key="Studios">
<option value="studios" key="studios">
Studios
</option>
</Select>
</Tabs>
<div id='projectBox' key='projectBox'>
<Grid items={this.state.loaded} itemType='projects'
<Grid items={this.state.loaded} itemType={this.props.itemType}
showLoves={true} showFavorites={true} showViews={true} />
<SubNavigation className='load'>
<button onClick={this.getExploreMore}>

View file

@ -16,10 +16,10 @@ $base-bg: $ui-white;
}
.select {
margin: auto 20px auto auto;
color: $header-gray;
display: inline-block;
margin: auto 20px auto auto;
width:100px;
color: $header-gray;
}
#projectBox {

View file

@ -20,11 +20,14 @@ var Search = injectIntl(React.createClass({
Api
],
getDefaultProps: function () {
var pathname = window.location.search;
var q = pathname.lastIndexOf('q=');
var query = window.location.search;
var pathname = window.location.pathname;
var start = pathname.lastIndexOf('/');
var type = pathname.substring(start+1,pathname.length);
var q = query.lastIndexOf('q=');
var term;
if (q != -1) {
term = pathname.substring(q+2,pathname.length).toLowerCase();
term = query.substring(q+2,query.length).toLowerCase();
}
while (term.indexOf('/') > -1) {
term = term.substring(0,term.indexOf('/'));
@ -35,7 +38,7 @@ var Search = injectIntl(React.createClass({
term = term.split('+').join(' ');
return {
tab: 'projects',
tab: type,
searchTerm: term,
loadNumber: 16
};
@ -56,7 +59,7 @@ var Search = injectIntl(React.createClass({
termText = '&q=' + this.props.searchTerm;
}
this.api({
uri: '/search/projects?limit=' + this.props.loadNumber + '&offset=' + this.state.offset + termText
uri: '/search/'+this.props.tab+'?limit=' + this.props.loadNumber + '&offset=' + this.state.offset + termText
}, function (err, body) {
var loadedSoFar = this.state.loaded;
Array.prototype.push.apply(loadedSoFar,body);
@ -66,7 +69,8 @@ var Search = injectIntl(React.createClass({
}.bind(this));
},
getTab: function (type) {
var allTab = <a href={'/search/'+type+'?q='+this.state.searchTerm+'/'}>
var term = this.props.searchTerm.split(' ').join('+');
var allTab = <a href={'/search/'+type+'?q='+term+'/'}>
<li>
<FormattedMessage
id={'explore.'+type}
@ -74,7 +78,7 @@ var Search = injectIntl(React.createClass({
</li>
</a>;
if (this.props.tab == type) {
allTab = <a href={'/search/'+type+'?q='+this.props.searchTerm+'/'}>
allTab = <a href={'/search/'+type+'?q='+term+'/'}>
<li className='active'>
<FormattedMessage
id={'explore.'+type}
@ -97,7 +101,7 @@ var Search = injectIntl(React.createClass({
{this.getTab('studios')}
</Tabs>
<div id='projectBox' key='projectBox'>
<Grid items={this.state.loaded} itemType='projects'
<Grid items={this.state.loaded} itemType={this.props.tab}
showLoves={true} showFavorites={true} showViews={true} />
<SubNavigation className='load'>
<button onClick={this.getSearchMore}>