Giter VIP home page Giter VIP logo

mozilla / bedrock Goto Github PK

View Code? Open in Web Editor NEW
1.2K 1.2K 912.0 753.54 MB

Making mozilla.org awesome, one pebble at a time

Home Page: https://www.mozilla.org

License: Mozilla Public License 2.0

JavaScript 12.27% Python 24.31% HTML 47.95% CSS 0.18% Shell 0.41% Smarty 0.01% Makefile 0.08% Dockerfile 0.03% SCSS 8.38% Fluent 6.38% Procfile 0.01%
css django firefox html javascript mozilla python

bedrock's Introduction

Bedrock

Bedrock is the code name of mozilla.org. It is as shiny, awesome, and open source as always. Perhaps even a little more.

What's deployed on dev,stage,prod?

Docs

Bedrock is a Django project. Check out the django docs for general technical documentation. In addition, there are project-specific bedrock docs.

Contributing

Patches are welcome! Feel free to fork and contribute to this project on GitHub. If you find a problem and wish to report it, please file a bug.

Looking for a good first bug to work on? Take a look at our contributing doc to get started.

Code of Conduct

This repository is governed by Mozilla's Community Participation Guidelines and Developer Etiquette Guidelines.

License

This software is licensed under the MPL version 2.0. For more information, read this repository's LICENSE.

credit @designerham

bedrock's People

Contributors

alexgibson avatar amychurchwell avatar craigcook avatar davehunt avatar dependabot[bot] avatar dpoirier avatar flodolo avatar gauthierm avatar glogiotatidis avatar hoosteeno avatar icaaq avatar jgmize avatar jlongster avatar jpetto avatar kyoshino avatar malena avatar maureenlholland avatar nathan-barrett avatar pascalchevrel avatar pmac avatar pmclanahan avatar reemhamz avatar retornam avatar rik avatar robhudson avatar sancus avatar sgarrity avatar stephaniehobson avatar stevejalim avatar theochevalier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bedrock's Issues

JS Unit Tests Tracker

This is a WIP so expect lots of edits for a while

The following JS files still require unit tests:

Base

  • media/js/base/mozilla-accordion-gatrack.js
  • media/js/base/mozilla-input-placeholder.js
  • media/js/base/mozilla-modal.js
  • media/js/base/mozilla-share-cta.js
  • media/js/base/mozilla-video-poster.js
  • media/js/base/mozilla-video-tools.js
  • media/js/base/nav-main-resp.js
  • media/js/base/nav-main.js
  • media/js/base/svg-animation-check.js

Add functional tests to improve coverage

The following functional tests/checks have been identified as desirable to improve test coverage:

  • Viewing Mozilla Spaces on a mobile viewport
  • Viewing Mozilla Communities on a mobile viewport
  • Checking page footer is displayed on at least one page
  • Checking 404 page components are displayed
  • Thunderbird download pages
  • Firefox Desktop pages
  • Firefox for iOS page
  • Firefox channel page
  • Firefox installer help page
  • SmartOn pages
  • Android page sent-to-device form test (blocked by #3534)
  • Firefox Products page conditional messaging for Android, iOS, out-of-date Firefox.
  • Plugincheck page tests for both none and one (or more) plugins using Firefox.
  • Sync page conditional messaging for Android, iOS, out-of-date Firefox.
  • Firefox family navigation scroll tests, plus mobile viewport test.
  • Firefox OS 2.5 page news feed is displayed test (pending #3709)
  • Add test for partnerships form (see: https://github.com/mozilla/mcom-tests/blob/master/tests/test_partnerships.py#L33)

locales should fallback to en-US

If a page only exists on the en-US site, accessing it with any other locale should fallback to en-US.

For example: the /en-US/apps/ page exists, and only on en-US. /fr/apps should redirect to /en-US/apps.

Using the universal selector (*) with tabzilla breaks it's layout

So it is becoming pretty common for people to set all elements to box-sizing:border-box using the universal selector by default as it is awesome ;) and does not cause any particular performance overhead @see http://www.paulirish.com/2012/box-sizing-border-box-ftw/

The problem is though. if you do this on a page that includes tabzilla, the tabzilla layout breaks and the image and bullet list is stacked one on top of the other (This page currently shows the behavior http://oneanddone.balwiki.com/en-US/login/?next=/en-US/tasks/available/)

Not sure if this is something we want to fix inside of tabzilla or whether it is just a caveat we want to make people aware of in the docs.

www-dev is auto-prefixing /b/ magically

In the past few weeks, the www-dev site started auto-prefix /b/ to links when the page is served up from /b/. If it's not served from /b/ it doesn't prepend /b/ to the links.

Magic.

And I hate magic! I want to know what's doing this. I had built in the auto-prefixing but it broke when this started happened (urls had TWO /b/ in them).

Port buildPlatformImage() function to Bedrock

There's a helper function on the old PHP site that helps output screenshots for the platform you're currently browsing from. We'll need to port this over to Bedrock.

The current PHP function, buildPlatformImage() takes a filename and a list of (pre-set) platforms (mac, linux, xp). It then outputs inline javascript to write the image for the platform you are currently running.

If the platform can't be determined or doesn't match our pre-set list, we fall-back to the default screenshot, which is for Windows. The function also outputs a tag with the windows image tag.

The inline scripts and the document.write method is to ensure that visitors only load/see the image for their platform, rather than starting a default and interrupting (and maybe visually flashing in) with the detected platform image.

The other fanncy-ish thing the PHP function does is determine the mac/linux image filenames automatically based on the default image filename. The filenames work like this:

Default (win): filename.ext
Mac: filename-mac.ext
Linux: filename-linux.ext

The .ext can be any image extension (.png, .gif, .jpg, etc.).

We basically need a direct port of the existing PHP function.

An example of this function in use can be found on /en-US/firefox/security/

Allow adding/editing of redirects

A very common use case of mozilla.org is to have top-level redirects like mozilla.org/b2g which would redirect to a b2g wiki page.

It would alleviate workload and help engagement if we could allow them to manage these redirects themselves. No idea how this should work, as speed is an issue. I doubt we want to load up all of django just to do a redirect, or do we? Zeus caches them anyway.

License

This says it's tri-licensed but shouldn't it be BSD? Otherwise you need to stick the pre-amble everywhere.

CasperJS Functional Tests Tracker

Below is a list of all (well most) of the pages that make up mozilla.org

The intention here is to keep track of all of the pages and mark those that already have functional tests, written using Casperjs, and those still in need of functional tests.

Mozilla

Community

Firefox OS

Firefox

Persona

Governance

Privacy

Legal

Foundation

Thunderbird

Components

  • Family Navigation

Put all of webtrends into a single, external JS file

Webtrends does a lot of inline JS and onclick="" handlers. All of this does not only violate CSP, this is also a huge mess and a maintainability nightmare.

We should pull out the tracking stuff into a separate file (webtrends.js, perhaps) and subject it to the same minification as all other JS.

For the click handlers, there's no reason why we can't just select elements by tagname and hook tracking up to the click event properly.

If we want more fine-grained control, use a class on the link to opt-in or out, or put data like a tracking token into a data attribute if necessary.

Tabzilla does not have high density mozilla image

When browsing bedrock websites on a high density display (such as a retina MacBook) Tabzilla does not have a high density Mozilla logo. See screenshot below.

Perhaps an SVG can be used for this resource to prevent having to maintain different display density images.

finish download buttons

I haven't looked at the download buttons in a long time, and I really need to flesh them out more and make sure the API is good before they are all over the place.

fix formatting of download buttons for unsupported platforms

The download buttons output some markup if the platform is "other", meaning mac, linux, or windows was not detected. Currently this markup doesn't have good styles. Should be a quick thing to fix.

You can test this by setting site.platform to "other" in site.js.

Simplify hooking up templates without view logic

Currently we're accumulating empty views for no great reason. In the urlconf, we could just use lambda req: render(req, 'mytemplate.html') instead of pointing to a separate view, but this is still quite a bit too wordy and inconvenient.

Two ideas so far:

  • Make a shorthand notation for the lambda thing: t('mytemplate.html') would return a function doing the above.
  • Make a function that will take a path stub and a template directory and will turn all templates it finds into URL patterns automatically:

templatedir_to_url(urlconf, '/firefox', 'mozorg/firefox')
would look for templates in mozorg/firefox and generate URL patterns for those, prepend them with /firefox, and append them to urlconf.

We can of course do both, or either.

Incomplete button in ios page

Have a button with a property over, see there

bug

I delete the property margin-top of the rule {.fxfamilynav-cta-wrapper .send-to} and this works, you need a pull-request or anyone can handle this.

update android system requirements on download button

In https://github.com/mozilla/bedrock/blob/e3f844ae8bb58aed6971db7316f2b2fd6e6b02c8/bedrock/firefox/firefox_details.py we say,

Android Honeycomb (3.x) was supported on Firefox 45 and below

    if int(self.latest_version(channel).split('.', 1)[0]) < 46:
        platforms['android'] = _('Modern devices\n(Android 3.0+)')

I just posted in release notes for 46 aurora that we don't support Honeycomb, but the download button still says "For Android Honeycomb+".

tabzilla "innovations" displaying weird

I'm implementing Tabzilla on the OpenNews site, and noticed that the word "innovations" is dropping the NS down to its own line. This is true in both Aurora (26.0a2) and Chrome (30.0) on a Mac

image below.
innovations

[Vagrant] Locale redirect not working

I've installed bedrock following this doc:

http://bedrock.readthedocs.org/en/latest/vagrant.html

And I have a functional installation, but the problem is that bedrock is redirecting me all the time to /en-US/es-ES/ urls, so it's impossible to test or work on localized pages.

Also if you try loading any locale page such us /fr/ manually, I always get a /en-US/fr/ and a 404.

Am I doing something wrong or it's a bug?

(My browser language preference order is es-ES, es, en-US, en)

Support shorthand notation for short L10n strings in templates

The global site UI (header, footer, download buttons) will be served by gettext. We need to decide what to do about short L10n strings inside page templates. Gettext gives us the power of all its tools, but would divide this part of the page from the longer L10n content in L10n blocks.

mozilla.com currently uses a double underscore function for non-gettext strings, that are then looked up in a manifest file. It might be worth considering this for our purposes too. We could drop these strings into the same file as the l10n blocks (as an {% l10n_manifest %} block or something), but would need to write a home-grown toolchain to handle new/deprecated/changed strings.

gettext, in turn, has a mature toolchain, but suffers from the content split problem. Unless we drop the .po file content directly into a block inside the localizable template, as mentioned above. But then it can't directly be edited with .po tools anymore, just a text editor.

What to do? Discuss!

tabzila.js compareVersion function doesn't recognize jQuery 1.10.x

In

var compareVersion = function (a, b) {
there is a compareVersion function which tries to determine if a new enough jQuery version was already loaded by the site. The minimumJQuery is currently defined as '1.7.1'. My site had already loaded '1.10.2'. The compareVersion doesn't cast the version strings to numbers, but compares strings. Which leads to:

"10" > "7"
false
"10" < "7"
true

where as usually you'd get:

"9" > "7"
true
"9" < "7"
false

Maybe the function should add something like parseInt(a[i], 10) to the comparison.

Alternative way of handling data-attributes

Instead of <div id="strings" data-foo="bar"></div> you could do something like this:

{% block js %}
    {{ js('home') | {
        'close': {{_('Close')}},
        'share': {{_('Share')}}
      }
  }}
{% endblock %}

that generates something like this
<script id="home-js" data-close="Close" data-share="Share" src="//mozorg.cdn.mozilla.net/media/js/home-min.js?build=f446ab8"></script>

Adding body class stops other themes from loading

If you for example have:

{% extends "sand.html" %}

But you then do the following:

{% block body_class %}privacy{% endblock %}

The sandstone theme will not load and will only load the default stone theme. Not sure if this is intended behavior but seems like one should be able to add your own custom body classes even when using a theme other than the default.

Changed link text on Privacy Policy Link

It's difficult for many people to hear/see where long URL's is pointing at, espacially if you are using AT. Therefor, instead of linking the url it's better to link the text before it,

<tr>
  <td>Webtrends</td>
  <td>Website analytics</td>
  <td><a href="http://www.webtrends.com/AboutWebtrends/PrivacyPolicy.aspx">Webtrends Privacy Policy</a></td>
</tr>

Update Selenium to v2.50 in Jenkins & Docker

As per #3772 we are now using Selenium client v2.49.0 for running tests locally in bedrock.

Quoting @davehunt:

To update the server versions used in the pipeline, we must change the value of SELENIUM_VERSION in the global configuration in Jenkins. Note that this will affect both Sauce Labs and Docker jobs, and it appears that 2.49 is not yet available in docker-selenium. To keep Docker pinned, we can set the SELENIUM_VERSION environment variable within the job configuration that uses Docker.

For what it's worth, the 2.49 client should be fully compatible with the 2.48.2 server, so there's no need to block merging this. If for some reason there is an incompatibility, we can simply revert this commit.

Helper to point to old PHP URLs in lieu of URL reversal

To point to a Django URL, you use URL reversal:

{{ url('myapp.page') }}

That won't work for URLs that are still on PHP, like the front page.

I suggest we make a helper that we can give a relative URL to, but that will auto-add the locale, so:

{{ mozorg_url('/') }}

would resolve to /en-US/.

Plus if we use that helper or old-style URLs, they are easier to find once we consider switching off PHP.

Make l10n_check command keep content surrounding l10n blocks

Currently the l10n_check commands parses out all the l10n blocks and blows away all the content outside of them in a localized template. If the localized template has other stuff outside the l10n blocks, it needs to keep it and only update the l10n blocks instead of rewriting the whole file.

modernizer

The modernizer script is inserted in base.html

<script src="/media/js/libs/modernizr-2.5.0.min.js"></script>

Where is this used?

Get basic download button working

A little documentation after reviewing the mozilla.com source:

The download button is an absolute messy mix of PHP and javascript.

Every button calls getNoScriptBlockForLocale on the firefoxDetails object which dumps out markup for people with Javascript disabled.

For javascript users, there are two versions of the download button:

  1. One that uses download.old.js, and simply dumps a block of javascript on the page to render the button (using a large template string and a bunch of document.write's). download.old.js depends on a big javascript object being dumped by the productDetails object containing details about the versions.
  2. The other one uses download.js (which seems to be a newer version) and calls getDownloadBlockForLocale which dumps out javascript that calls into download.js functions. The difference seems to be that it dumps all the needed info into the js inline.

The productDetails class is 1000 lines long with a bunch of functions that mostly just dump HTML to render different ways of downloading Firefox.

This will be one of hardest things to migrate, I think. I don't think it will be possible to do this without cleaning up a lot of it. My hunch is to build a javascript library on top of the json files in product-details (that other projects use). The json can be dumped onto the page and the client-side javascript can take care of the rest. For the javascript disabled, we can build a light jinja helper which dumps out the markup that we do now.

In DEBUG mode, LESS should work without further ado

Currently, LESS CSS files don't seem to work out of the box. When in DEBUG (development) mode, this should just work [TM]. Perhaps we need to add the appropriate script to the script block, only to be loaded if DEBUG = True. Or something.

Bad bedrock URL from url()

This is probably something I have setup wrong in apps/mozorg/urls.py, but:

In the template (apps/mozorg/templates/mozorg/firefox/organizations/organizations.html) for the Firefox for Organizations page (http://www-dev.allizom.org/b/en-US/firefox/organizations), I've got this link on line #43:

{{ url('mozorg.firefox_organizations_faq') }}

but it seems to be outputting the leading /b twice:

href="/b/b/en-US/firefox/organizations/faq/"

Define JSON data model for tasks [kb=#1892928]

Define basic data model for tasks data in JSON. This may or may not be used but it gives us a starting point and a more "codified", if you will, representation of the selected tasks.

Related User Story

STORY #1 As a person who has never contributed to Mozilla before, I see options for how I could contribute to Mozilla, so I can pick a thing to do that will help Mozilla and is the best fit for me.

Separate apps better

mozorg is currently a catch-all for a ton of templates. As we're adding more and more pages, this is not sustainable.

Ideally:

  • mozorg is the app that contains global things, for this app, such as helpers
  • the app structure somewhat follows the feature distinction in this app. I think /firefox /b2g etc. would all qualify as separate apps.
    ** note that these apps can still hook up things to URLs that don't have the same prefix. If b2g has a page under /firefox, that's no problem.

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.