GithubHelp home page GithubHelp logo

decypher's Introduction

DECYPHER README

Description

Decypher allows users to upload and annotate song lyrics.

Technologies Used

Ruby on Rails backend with PostgreSQL database and React-Redux frontend. Javascript's built-in getSelection method was used for annotations.

getSelection()

Unfortunately, the method had some shortcomings and some workarounds had to be implemented in order to get annotations working properly. For example, highlighting an area and calling window.getSelection() provides you with the start and end indices of your selection, but only within the confines of the parent HTML Element.

getSelection

Therefore, having the full lyrics in one <p> tag gives the proper indices for whatever is highlighted, but once links to the annotations are nested in as <a> tags, this disrupts the API's ability to grab the proper indices. After an inserted <a> tag, the next immediate index doesn't pick up where it left off, and instead resets back to 0. The method doesn't know to ignore HTML tags and can only accurately grab selections that are confined to one set of tags.

Annotations

The workaround here was to separate each line of the lyrics into it's own <div> tag with an id corresponding to the line number. This way the index will always start at 0 for each line, and line numbers can be used to accurately map annotations to lyrics.

AnnotationHTML

Once a selected text is highlighted, the "Start Annotation" button will appear which, when clicked, will show the annotation form. The annotation form contains placeholder text that is equal to the highlighted portion of lyrics. After saving, they appear as a link that will direct the user to that annotation's url.

AnnotationForm

Comments and Upvotes

Users can submit comments on song show pages and upvote or dowvote comments. Comments can also be submitted on annotations to suggest improvements. Users may delete comments that they have authored.

song-commentsanno-comments

decypher's People

Watchers

 avatar

decypher's Issues

Review 11/14

  • Make sure errors don't persist when switching between log in and sign up
  • Add ability to click out of modal
  • Styling

All the functionality looks great, now it's time to focus 100% on styling. Obviously we won't be able to style everything perfectly since we'll need artists, albums, etc, but we should style everything we can without that content. Keep up the good work!

Proposal Review 11/7/18

Schema

  • Everything looks good. Considerer making comments (and maybe even upvotes) polymorphic associations as a bonus so you can comment and upvote on both annotations and comments.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.