Coder Social home page Coder Social logo

elkhorn's People

Contributors

aiboyles avatar davidgljay avatar gabelula avatar impronunciable avatar jde avatar jtnelson avatar kgardnr avatar okbel avatar pablocubico avatar riley avatar ryanponce avatar wyattjoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elkhorn's Issues

Request text submissions from readers

Journalists should be able to select (most likely in a drag and drop interaction style) from a list in order to create their form.

Text fields the list should include are as follows:

  • Name
  • Email
  • DOB
  • Phone number
  • City
  • State
  • Country
  • Select multiple answers (this might manifest as radio buttons and/or a dropdown)
  • Select one answer from a list (for use on a question like "What is your income level?"
  • Text without a character limit
  • Text with a character limit

Project configuration sanity

Some ideas to tidy up this repo:

  • Clean unused dependencies in package.json
  • Rollup needs a slightly different .babelrc to include the es2015-rollup plugin, maybe we can point to a different .babelrc for rollup on build time.
  • Create an NPM task that builds the ask bundle?

Date Field

Make sure date field build works, or remove the third-party dependency and build a simple date picker from scratch.

MVP Field Types

Namely:

  • short text
  • longer text
  • location
  • numbers
  • multiple choice
  • email address
  • date

A note on multiple choice: if allow multiple is checked, it will render checkboxes, otherwise it would render radio buttons.

A check on the list means that we have figured out:

  • General Spec
  • Data structure
  • Validation
  • Keyboard nav
  • Config form

Font support

We are currently importing a hard-coded font directly from Google Fonts.

Embedding fonts will vastly increase the build size, I would suggest either using Google Fonts (very simple) or uploading fonts to a CDN where they can be imported (added complexity).

Elkhorn is not generating S3 URLs correctly

Elkhorn should use the region to generate the S3 url instead of relying on a baseUrl config value.

For example, this is the kind of URL that elkhorn generates:
image

If you try to go to that page (https://s3.amazonaws.com/ask-stg/5811be4bc155900001a0e3c1.html) you get an error.

The correct URL is https://s3-us-west-2.amazonaws.com/ask-stg/5811be4bc155900001a0e3c1.html, according to the docs at http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

Publish full html files alongside js files for forms

Currently we are only publishing the .js packet for each form. In order to see the form in an iframe we need to hit an endpoing with simply generates some html around the js. This puts elkhorn in the critical path for form serving meaning that we would need to scale it.

Publish an .html file alongside the .js files containing everything we need for a form. This will allow us to take full advantage of CDN publish static for all form serving.

Map Field

Make sure the Map field works when building with rollup.

Things for the demo

Deadline needs to be 3pm ET today. If that means reducing the must haves, so be it. But as it stands... (FYI most of these are cosmetic)

Must Haves

Form Creator

  • Saving the form needs to work
  • "Untitled Form" in the top bar is currently a button with mouseover. It shouldn't have mouseover.
  • Is the "Share your story" text in the correct font? Looks like it changed with the recent update.
  • Make the inactive message darker - right now is in a very light, hard to read color
  • remove "(Or Field Label)" from the individual question prompt.
  • add line space below "Required"
  • Change "Custom thank you message (optional)" to "Thank you message" and the text inside to "Thank you for helping us with our journalism. We read all submissions, and will be in touch if we have any more questions."

Preview form view in Form Creator:

  • Change the turquoise bar in Share your Story to Coral colors - use the pale Coral color in the
    sidebar
  • make SUBMIT larger in the button
  • Change the serif font in the headline to the Sans we use elsewhere
  • Increase the leading between the headline and the subhead

Manage Gallery

  • Edit button should work on Gallery submissions
  • Correct spelling mistake: "Embded Code"
  • Remove "Phone" from Submission Author Attribution

View Forms

  • Change Title "Answers" to "Submissions" in the lists

View a single form

  • Remove the Edit Form button from the top bar (it doesn't work and goes to a silly message)
  • Put in dummy text into Submission Author info in View Form submissions (or remove the box -having it blank asks more questions than it should)

Nice to Haves

Form creator

  • The share button brings up a modal for sharing (we have the design already, just needs to be placed there. Doesn't need to work at this stage.)
  • If I make a change to a question text and then hit "X" instead of Save, it saves anyway. No way to abandon your changes unsaved.
  • Make Multiple Choice work!
  • Make Date work!
  • Make PIIs transfer into View Submission mode
  • [ ]

Review submissions

  • if no response was submitted to a question, don't display it as "No Response" in Review Submissions - just don't show it
  • institute the "View All Answers to this Question" mode

Logged user strategy

How are we going to determine which user is logged in the parent site (partner who installed an Ask)?

Maybe we could send some parameters via query string to the embeddable.

withCredentials xhr setting conflicting with allow origin *

There's a cors error when submitting forms.

To reproduce,

  1. go here: https://s3.amazonaws.com/nyt-stage/57c8719f95ae170007b5afff.html
  2. fill out form
  3. Click SUBMIT
  4. open web console, see this error:

7c01504c-7673-11e6-8734-cc5964cd9d35

We need to keep Access-Control-Origin at * or provide another way of letting people host these forms anywhere on the web. This is not allowed "when the credentials flag is true."

set xhr's withCredentials to false as we don't require credentials when posting from a form.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Access-Control-Allow-Credentials

gzip files

We are delivering non-gzipped files. For example the one being consumed by https://coralproject.net/contact.html has a size of 149kb. Applying gzip -9 to that file I get a 34kb file. This results on a percentage increase of 338%

Ask schemas

This epic is for discussing the shape of the ask schemas

Specify an audience for an ask

Readers should be allowed to select whether their submission is just for the journalist vs. ok for the public to see.

Additionally, journalists will need an area in the Ask creator to add this option to the form.

startup script should create widgets folder

should index.js check for the server/widgets directory and create it if it's not there? It seems unnecessary to have to manually create that folder before things work properly.

S3 Uploading and baseURL

It seems that the baseURL is not being observed in the uploader as seen

if (isS3) {
AWS.config.update({
region: config.s3.region,
accessKeyId: config.s3.accessKeyId,
secretAccessKey: config.s3.secretAccessKey
})
s3bucket = new AWS.S3({params: {Bucket: config.s3.bucket}})
}
// set base url
var base = isS3 ? 'https://s3.amazonaws.com/' + config.s3.bucket + '/' : '/widgets/'
which is not consistent with how the rest of the project is handling this option
var base = isS3 ? getS3BaseURL() : getLocalBaseURL()
.

I'd think that the uploader should not have the widgets bucket hardcoded or the baseURL hardcoded and instead use the provided configuration.

Form schema

Schema:

{
    "id": <UUID>,
    "settings": {
        "saveDestination": <String:URL>,
        "showFieldNumbers": <Boolean>
    },
    "header": {
        "title": <String>,
        "description": <String>
    },
    "footer": {
        "conditions": <String>
    },
    "finishedScreen": {
        "title": <String>,
        "description": <String>
    },
    "steps": [
        {
            "id": <Number>,
            "name": <String>,
            "widgets": [
                {
                    "id": <Number>,
                    "type": <String>,
                    "component": <String>,
                    "title": <String>,
                    "wrapper" : <Object>,

                    "props": <Object>
                }
            ]
        }
    ]
}

Example:

{
    "id": 1,
    "settings": {
        "saveDestination": "http://coralasks.theguardian.com/ask/44",
        "showFieldNumbers": true
    },
    "header": {
        "title": "Share Your Story.",
        "description": "As part of our ​Op-Docs ​series​ Conversation​s​ ​on Race​,​​ we ​want to hear your​​ ​​experiences ​confronting issues of race in your life. We invite you to share your stories, some of which we are featuring on a page of readers’ contributions."
    },
    "footer": {
        "conditions": "By submitting to us, you are promising that the content is original, doesn’t plagiarize from anyone or infringe a copyright or trademark, doesn’t violate anybody’s rights and isn’t libelous or otherwise unlawful or misleading. You are agreeing that we can use your submission in all manner and media of The New York Times and that we shall have the right to authorize third parties to do so. And you agree to the rules of our Member Agreement, found online at our website."
    },
    "finishedScreen": {
        "title": "Thanks.",
        "description": "This is a more verbose thank you message."
    },
    "steps": [
        {
            "id": 1,
            "name": "first_page",
            "widgets": [
                {
                    "id": 100,
                    "type": "field",
                    "component": "MultipleChoice",
                    "title": "Select one or several themes for your story",

                    "wrapper" : {
                        "required": true,
                        "pseudoLabel": true                 
                    },

                    "props": {
                        "multipleChoice": true,
                        "options": [
                            {
                                "title": "Family Life"
                            },
                            {
                                "title": "Friendship/Love"
                            },
                            {
                                "title": "School"
                            },
                            {
                                "title": "Law Enforcement"
                            },
                            {
                                "title": "Work"
                            },
                            {
                                "title": "Other"
                            }
                        ]
                    }
                },
                {
                    "id": 101,
                    "type": "field",
                    "component": "TextArea",
                    "title": "Write your story",
                    "required": true,
                    "props": {
                        "maxLength": 400
                    }
                },
                {
                    "id": 102,
                    "type": "field",
                    "component": "TextField",
                    "title": "Name",
                    "required": true,
                    "props": {
                        "maxLength": 100
                    }
                },
                {
                    "id": 103,
                    "type": "field",
                    "component": "TextField",
                    "title": "Age",
                    "validationMessage": "Please type a valid number.",
                    "props": {
                        "validateAs": "number"
                    }
                },
                {
                    "id": 104,
                    "type": "field",
                    "component": "TextField",
                    "title": "E-mail",
                    "validationMessage": "Please type a valid e-mail address.",
                    "props": {
                        "maxLength": 100,
                        "validateAs": "email"
                    }
                }
            ]
        }
    ]
}

Submissions schema

schema:

{
  "id": <UUID>
  "ask_id": <UUID>
  “user”: <Object>
  "header": <Object>,
  "footer": <Object>,
  "replies": [
    {
      "widget_id": <Number>,
      "answer": <String>,
      “edited”: <Boolean>,
      "question": {
        "title": <String>,
    options: <Array>
      }
    }
  ]
}

example:

{
    "id": ObjectId(12312321412),
    "ask_id": ObjectId(12312321ddd),    
    “user”: {
    },

    "header": { ... },
    "footer": { ... },

    "replies": [
        {
            "widget_id": 100,

"answer": "Family Life",
            “edited”: “”,

"question": {
                "title": "blah",
                options: ['hi', 'ho', 'lets go']
            }

        }
    ]


}

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.