Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add book language ID fields #305

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8748959
[setup-videos-page] create videos controller and view
Mar 4, 2018
1b6e742
Remove node_modules
andyzg Mar 4, 2018
74b0321
Update package.json, set up starting files
andyzg Mar 4, 2018
26275e2
my bad
andyzg Mar 4, 2018
24c7a2f
Setup stylus
andyzg Mar 4, 2018
50e4932
Added styling
andyzg Mar 11, 2018
68c19eb
Modify CSS
andyzg Mar 11, 2018
7e38139
Added video grids
andyzg Mar 11, 2018
88d0a5e
Remove compiled assets
andyzg Mar 11, 2018
7f3a2cf
Added README
andyzg Mar 11, 2018
6cb70ed
Started video page
andyzg Mar 18, 2018
cbede59
Removed video react, finished video page
andyzg Mar 18, 2018
f8980cb
created video components
Mar 18, 2018
ab65b60
Merge branch 'setup_videos_page'
Mar 18, 2018
f9bb64e
Load data from CSV as placeholder
imruahmed Mar 20, 2018
417beeb
Merge pull request #2 from uwblueprint/load_dummy_data
imruahmed Mar 21, 2018
e2fafde
initial setup
Mar 22, 2018
cccaaf6
render video focus view
Mar 22, 2018
3d030a4
finalize react component
Mar 23, 2018
966fa9e
finalize videos controller
Mar 23, 2018
a979ae5
fix quotation marks
Mar 23, 2018
a85b7a1
remove comments
Mar 23, 2018
6bc2b2a
make sure /videos/index is a valid route
Mar 23, 2018
69e26e1
Merge pull request #3 from uwblueprint/set_up_video_controller
mgyliu Mar 23, 2018
7ab1934
Prepare for demo, modify title, add icon, add navigation between list…
andyzg Mar 23, 2018
d562ace
Add back img
andyzg Mar 23, 2018
b74f9dd
Use proper video thumbnail
andyzg Mar 23, 2018
e620612
Merge pull request #4 from uwblueprint/prep-demo
andyzg Mar 23, 2018
8987b10
Added video urls
andyzg Apr 26, 2018
fd082f0
Add functionality to frontend, comments
andyzg Apr 26, 2018
a1165e7
If SRT url exists, add
andyzg Apr 26, 2018
9a72948
add book's language IDs to DB and controllers
baieric May 21, 2018
a017829
allow glottocode param to be nil
baieric May 21, 2018
2dc2810
Update from wikitongues/master
uti0mnia Jun 3, 2018
d2b949e
Merge pull request #7 from uwblueprint/update-fork
uti0mnia Jun 6, 2018
e37fcd1
Merge branch 'master' into ontology-be
Jun 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ config/initializers/secret_token.rb
bower.json

# Node dependency directories
node_modules
node_modules/

# Ignore pow environment settings
.powenv

# Ignore Byebug command history file.
.byebug_history

*~
*~

public/assets/css/app.css
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ To start the application locally, run:
```shell
rails server
```

You will also need to run `./local_dev.sh` to compile some stylesheets for the archive.

Then, visit the app at [http://localhost:3000](http://localhost:3000).

<!-- ## Alternative Workflow with Convox and Docker
Expand Down
Binary file added app/assets/images/archive/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/archive/landing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions app/assets/javascripts/components/archive/ArchiveApp.es6.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class ArchiveApp extends React.Component {
constructor(props) {
super(props);
}

render() {
var videoComponents = this.props.data.map(function(video) {
var re_url = /https:\/\/.*\.jpg/;
var url = video['Branded Thumbnail'];

// TODO: Refactor repetitive code
var language = video['Languages Used'].split(',')[0];
var speaker = video['Speakers'].split('_'); // Filter any null
speaker.splice(speaker.length - 1);
speaker = speaker.filter(name => !!name)
speaker = speaker.join(' ');

let video_id = video[Object.keys(video)[0]].split('_');
// video_id.splice(video_id.length - 1); // Removes languages at the end of ID
video_id = video_id.join('_');

return (
<ArchiveVideoCard
video_id={video_id}
video_title={speaker+ ' speaking ' + language}
date={video["Date added"]}
iso_codes={video["Languages Used"]}
img_url={url ? url.match(re_url)[0] : null} />
);
})
return (
<ArchiveLanding videos={videoComponents}/>
);
}
}
25 changes: 25 additions & 0 deletions app/assets/javascripts/components/archive/ArchiveLanding.es6.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class ArchiveLanding extends React.Component {
constructor(props) {
super(props);
}

render() {
return (
<div className='archive-page'>
<div className='archive-background'>
<div className='archive-bg-container'>
<img src="/assets/archive/landing.png" />
<h1 className='archive-title'> Wikitongues Archive </h1>
<div className='archive-subtitle'>
{'Empowering community activists, we introduce you the first public archive of every language in the world.'}
</div>
</div>
</div>

<div className="archive-video-container">
{this.props.videos}
</div>
</div>
);
}
}
24 changes: 24 additions & 0 deletions app/assets/javascripts/components/archive/ArchiveVideoApp.es6.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class ArchiveVideoApp extends React.Component {
constructor(props) {
super(props);
}

render() {

return (
<div className='archive-page'>
<div className='archive-background'>
<div className='archive-bg-container'>
<img src="/assets/archive/landing.png" />
</div>
</div>

<div className="archive-watch-container">
<a className="archive-back-home" href="/videos/index">
</a>
{this.props.video}
</div>
</div>
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class ArchiveVideoFocus extends React.Component {
constructor(props) {
super(props);
}

render() {
let video = this.props.data;
let urls = this.props.urls
console.log(urls)

// TODO: Refactor repetitive code
var language = video['Languages Used'].split(',')[0];
var speaker = video['Speakers'].split('_'); // Filter any null
speaker.splice(speaker.length - 1);
speaker = speaker.filter(name => !!name)
speaker = speaker.join(' ');

var videoData =
<WatchVideo
id={this.props.data['IDv2']}
videoUrl={urls.video_url}
srtFile={urls.srt_url}
title={speaker+ ' speaking ' + language}
description={this.props.data['Demographics']}
srtUrl={this.props.data['Caption File Link']}/>;
return (
<ArchiveVideoApp video={ videoData }/>
);
}
jk }
32 changes: 32 additions & 0 deletions app/assets/javascripts/components/archive/WatchVideo.es6.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class WatchVideo extends React.Component {
constructor(props) {
super(props);
}

render() {
let srtElem = null;
if (this.props.srtFile) {
srtElem = <a href={this.props.srtFile}>Download subtitles</a>;
}
return (
<div className='watch-video-container'>
<h2 className='watch-video-title'> {this.props.title} </h2>
<video className="watch-video-component" autoPlay controls>
<source src={this.props.videoUrl} type="video/mp4" />
</video>
<div>{this.props.srtUrl}</div>
<div>{this.props.id}</div>
<div>{srtElem}</div>

<p className='watch-video-description'>
{this.props.description}
</p>
</div>
);
}
}

WatchVideo.propTypes = {
srt_url: React.PropTypes.string,
video_url: React.PropTypes.string,
};
35 changes: 35 additions & 0 deletions app/assets/javascripts/components/archive/video_card.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
class ArchiveVideoCard extends React.Component {
constructor(props) {
super(props);
}

viewVideo() {
window.location = '/videos/' + this.props.video_id;
}

render() {
var defaultThumbnail = '/assets/archive/video_thumbnail_test.jpg';
return (
<div className="archive-video-card" onClick={this.viewVideo.bind(this)}>
<div className="archive-video-card-thumbnail">
<img src={this.props.img_url ? this.props.img_url : defaultThumbnail} />
</div>
<div className="archive-video-metadata">
<div className="archive-video-card-title">{this.props.video_title}</div>
<div className="archive-video-card-details">
<div>{this.props.iso_codes}</div>
<div>{this.props.date}</div>
</div>
</div>
</div>
);
}
}

ArchiveVideoCard.propTypes = {
video_id: React.PropTypes.number,
video_title: React.PropTypes.string,
date: React.PropTypes.string,
iso_codes: React.PropTypes.string,
img_url: React.PropTypes.string,
};
3 changes: 3 additions & 0 deletions app/assets/javascripts/videos.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
2 changes: 1 addition & 1 deletion app/assets/stylesheets/admin.styl
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@
text-decoration none

.right
text-align right
text-align right
3 changes: 3 additions & 0 deletions app/assets/stylesheets/archive/app.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import "./landing.styl"
@import "./video.styl"
@import "./video-card.styl"
79 changes: 79 additions & 0 deletions app/assets/stylesheets/archive/landing.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
.archive-page {
width: 100%;
position: relative;
}

.archive-background {
position: absolute;
left: 0;
right: 0;

.archive-bg-container {
position: relative;
}

img {
position: absolute;
width: 100%;
top: -100px;
left: 0px;
right: 0px;
}

.archive-title {
position: absolute;
margin: 0;
top: 110px;
width: 95%;
right: 5%;

color: #fff;
font-size: 42px;
font-weight: 700;
text-shadow: 0px 2px 4px rgba(82,70,70,.5);
text-align: right;
}

.archive-subtitle {
position: absolute;
width: 46%;
top: 175px;
right: 5%;

color: #fff;
font-size: 20px;
font-weight: 300;
text-shadow: 0px 2px 4px rgba(0,0,0,.64);
text-align: right;
}
}

.archive-video-container {
position: relative;
top: 280px;

flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
align-items: flex-start;
align-content: flex-start;
display: flex;

margin: 0 auto 80px auto;
padding: 100px;
width: 90%;
height: auto;

background-color: white;
box-shadow: 0px 4px 4px rgba(0,0,0,.2);
}

.archive-video {
flex-basis: 200px;
flex-grow: 1;
height: 200px;
margin: 16px;

box-shadow: 0px 2px 4px rgba(0,0,0,.2);
border-radius: 4px;
}
51 changes: 51 additions & 0 deletions app/assets/stylesheets/archive/video-card.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.archive-video-card {
flex-basis: 300px;
flex-grow: 1;
margin: 16px;

box-shadow: 0px 2px 4px rgba(0,0,0,.2);
border-radius: 4px;
cursor: pointer;
transition: box-shadow 0.2s;
}

.archive-video-card:hover {
box-shadow: 0px 6px 6px rgba(0,0,0,.2);
}

.archive-video-card-thumbnail{
height: 230px;
overflow: hidden;

img {
max-width: 100%;
}
}

.archive-video-metadata{
margin-left: 24px;
margin-right: 24px;
padding-bottom: 16px;

.archive-video-card-title {
font-family: HelveticaNeue;
font-size: 24px;
text-align: left;
margin-top: 12px;
margin-bottom: 6px;
}

.archive-video-card-title:link,
.archive-video-card-title:visited {
text-decoration: none;
color: #000;
}



.archive-video-card-details{
font-family: HelveticaNeue;
font-size: 16px;
font-weight: 300;
}
}
Loading