diff --git a/Gruntfile.js b/Gruntfile.js index e3d1058..d03127a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,7 +5,7 @@ module.exports = function(grunt) { nunjucks: { precompile: { baseDir: 'app/views/', - src: 'app/views/*', + src: 'app/views/**', dest: 'app/js/templates.js', options: { name: function(filename) { diff --git a/app/authentication.html b/app/authentication.html index 050ab15..b2e4aeb 100644 --- a/app/authentication.html +++ b/app/authentication.html @@ -26,38 +26,10 @@ -
-
- - Close - -

Sign In

-
-
-
-

- An account lets you answer questions, track contributions and receive alerts. -

-
    -
    - -
      -
      -
      - -
        -
        -

        - Forgot your password? -

        - -
        - Don't have an account? Register -
        -
        -
        +
        + @@ -69,6 +41,7 @@ + diff --git a/app/email_confirmation.html b/app/email_confirmation.html index 85f79a5..254e351 100644 --- a/app/email_confirmation.html +++ b/app/email_confirmation.html @@ -24,27 +24,15 @@ -
        -
        -

        Confirm Account

        -
        -
        -
        -

        Yay, you're almost done!

        -

        - We've sent a welcome email to: -
        -

        -

        - Click on the link in your email to let us know that it made it to the right place. After that, return to BuddyUp and make other users happy! -

        - -
        +
        + + + + + diff --git a/app/helper_profile.html b/app/helper_profile.html index 3e64618..d94183c 100644 --- a/app/helper_profile.html +++ b/app/helper_profile.html @@ -24,39 +24,25 @@ -
        -
        - - Close - -

        -
        -
        -
        -
        -
        -

        Answered Questions

        -
        -
        -
        -
        +
        - + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + diff --git a/app/home.html b/app/home.html index 862dfbe..2a138ea 100644 --- a/app/home.html +++ b/app/home.html @@ -25,45 +25,10 @@ -
        -
        - - - Settings - - -

        Support

        -
        -
        -
        -

        Have Questions?

        -

        Get a Buddy to help you with your device

        - Ask a Question -
        -
        -

        Have Answers?

        -

        Help other users around the world

        - Answer Questions -
        -
        -
        -

        Top Helpers this Week

        -
        -
        -
        -
        -

        My Questions

        -
        -
        - -
        - All My Questions -
        -
        -
        -
        +
        + @@ -76,6 +41,7 @@ + @@ -83,5 +49,5 @@ - + diff --git a/app/index.html b/app/index.html index 48bbe4b..28c23cb 100644 --- a/app/index.html +++ b/app/index.html @@ -9,17 +9,17 @@ - - - - - - - - - + + + + + + + + + - - - + + + diff --git a/app/js/authentication_controller.js b/app/js/authentication_controller.js index 5934cce..4b1ebf5 100644 --- a/app/js/authentication_controller.js +++ b/app/js/authentication_controller.js @@ -44,6 +44,8 @@ }; exports.AuthenticationController = AuthenticationController; - AuthenticationController.init(); + document.addEventListener('initialize', function() { + AuthenticationController.init(); + }); })(window); diff --git a/app/js/email_confirmation_controller.js b/app/js/email_confirmation_controller.js index 1448efa..00b0328 100644 --- a/app/js/email_confirmation_controller.js +++ b/app/js/email_confirmation_controller.js @@ -64,5 +64,8 @@ }; exports.EmailConfirmationController = EmailConfirmationController; - EmailConfirmationController.init(); + + document.addEventListener('initialize', function() { + EmailConfirmationController.init(); + }); })(window); diff --git a/app/js/error_controller.js b/app/js/error_controller.js index 4beee5f..ee05eed 100644 --- a/app/js/error_controller.js +++ b/app/js/error_controller.js @@ -32,5 +32,8 @@ }; exports.ErrorController = ErrorController; - ErrorController.init(); + + document.addEventListener('initialize', function() { + ErrorController.init(); + }); })(window); diff --git a/app/js/helper_profile_controller.js b/app/js/helper_profile_controller.js index e429696..1ed0490 100644 --- a/app/js/helper_profile_controller.js +++ b/app/js/helper_profile_controller.js @@ -66,5 +66,8 @@ }; exports.HelperProfileController = HelperProfileController; - HelperProfileController.init(); + + document.addEventListener('initialize', function() { + HelperProfileController.init(); + }); })(window); diff --git a/app/js/home_controller.js b/app/js/home_controller.js index 43a0d20..66a8a5b 100644 --- a/app/js/home_controller.js +++ b/app/js/home_controller.js @@ -32,5 +32,8 @@ }; exports.HomeController = HomeController; - HomeController.init(); + + document.addEventListener('initialize', function() { + HomeController.init(); + }); })(window); diff --git a/app/js/i18n.js b/app/js/i18n.js new file mode 100644 index 0000000..360019f --- /dev/null +++ b/app/js/i18n.js @@ -0,0 +1,23 @@ +'use strict'; + +(function(exports) { + exports.gettext = function (msgid) { + return msgid; + }; + + exports.ngettext = function (singular, plural, count) { + return (count === 1) ? singular : plural; + }; + + exports.interpolate = function (fmt, obj, named) { + if (named) { + return fmt.replace(/%\(\w+\)s/g, function(match) { + return String(obj[match.slice(2, -2)]); + }); + } else { + return fmt.replace(/%s/g, function(match) { + return String(obj.shift()); + }); + } + }; +})(window); diff --git a/app/js/loader.js b/app/js/loader.js new file mode 100644 index 0000000..be9c6ba --- /dev/null +++ b/app/js/loader.js @@ -0,0 +1,26 @@ +'use strict'; + +/* global gettext, nunjucks */ + +(function(exports) { + var Loader = { + init: function() { + var env = new nunjucks.Environment(); + env.addGlobal('_', gettext); + + var elems = document.querySelectorAll('[data-template]'); + + for (var i=0; i < elems.length; i++) { + var elem = elems[i]; + var html = nunjucks.render(elem.dataset.template); + elem.innerHTML = html; + } + + var event = new Event('initialize'); + document.dispatchEvent(event); + } + }; + + exports.Loader = Loader; + Loader.init(); +})(window); diff --git a/app/js/loading_indicator.js b/app/js/loading_indicator.js index 40e4ce5..e2b7229 100644 --- a/app/js/loading_indicator.js +++ b/app/js/loading_indicator.js @@ -41,5 +41,8 @@ }; exports.LoadingIndicator = LoadingIndicator; - LoadingIndicator.init(); + + document.addEventListener('initialize', function() { + LoadingIndicator.init(); + }); })(window); diff --git a/app/js/old_versions_controller.js b/app/js/old_versions_controller.js index d43cbcb..65c2e29 100644 --- a/app/js/old_versions_controller.js +++ b/app/js/old_versions_controller.js @@ -13,5 +13,8 @@ }; exports.OldVersionsController = OldVersionsController; - OldVersionsController.init(); + + document.addEventListener('initialize', function() { + OldVersionsController.init(); + }); })(window); diff --git a/app/js/password_reset_controller.js b/app/js/password_reset_controller.js index ecbf6da..5762ca3 100644 --- a/app/js/password_reset_controller.js +++ b/app/js/password_reset_controller.js @@ -34,6 +34,9 @@ }; exports.PasswordResetController = PasswordResetController; - PasswordResetController.init(); + + document.addEventListener('initialize', function() { + PasswordResetController.init(); + }); })(window); diff --git a/app/js/profile_controller.js b/app/js/profile_controller.js index 29aa95a..34a4457 100644 --- a/app/js/profile_controller.js +++ b/app/js/profile_controller.js @@ -105,6 +105,9 @@ }; exports.ProfileController = ProfileController; - ProfileController.init(); + + document.addEventListener('initialize', function() { + ProfileController.init(); + }); })(window); diff --git a/app/js/question_controller.js b/app/js/question_controller.js index 7ad0857..ac4f36c 100644 --- a/app/js/question_controller.js +++ b/app/js/question_controller.js @@ -558,6 +558,9 @@ } }; exports.QuestionController = QuestionController; - QuestionController.init(); + + document.addEventListener('initialize', function() { + QuestionController.init(); + }); })(window); diff --git a/app/js/questions_controller.js b/app/js/questions_controller.js index a1c44c3..2312fe1 100644 --- a/app/js/questions_controller.js +++ b/app/js/questions_controller.js @@ -221,6 +221,9 @@ }; exports.QuestionsController = QuestionsController; - QuestionsController.init(); + + document.addEventListener('initialize', function() { + QuestionsController.init(); + }); })(window); diff --git a/app/js/registration_controller.js b/app/js/registration_controller.js index f15681b..413f4c2 100644 --- a/app/js/registration_controller.js +++ b/app/js/registration_controller.js @@ -49,6 +49,9 @@ }; exports.RegisterationController = RegistrationController; - RegistrationController.init(); + + document.addEventListener('initialize', function() { + RegistrationController.init(); + }); })(window); diff --git a/app/js/unsupported_locale_controller.js b/app/js/unsupported_locale_controller.js index 2aed2ce..7904f0c 100644 --- a/app/js/unsupported_locale_controller.js +++ b/app/js/unsupported_locale_controller.js @@ -1,7 +1,5 @@ 'use strict'; -/* global Use */ - (function(exports) { var UnsupportedLocaleController = { @@ -22,5 +20,8 @@ }; exports.UnsupportedLocaleController = UnsupportedLocaleController; - UnsupportedLocaleController.init(); + + document.addEventListener('initialize', function() { + UnsupportedLocaleController.init(); + }); })(window); diff --git a/app/kb.html b/app/kb.html index 2d8b49e..ca68cb7 100644 --- a/app/kb.html +++ b/app/kb.html @@ -21,18 +21,15 @@ -
        -
        - - Close - -

        Help Article

        -
        - -
        +
        + + + + + + diff --git a/app/old_versions.html b/app/old_versions.html index 398f812..0f4f18e 100644 --- a/app/old_versions.html +++ b/app/old_versions.html @@ -23,15 +23,13 @@ - + + + + + + + diff --git a/app/password_reset.html b/app/password_reset.html index 794811f..f85e6c2 100644 --- a/app/password_reset.html +++ b/app/password_reset.html @@ -26,54 +26,26 @@ -
        -
        - - Close - -

        Reset Password

        -
        -
        -
        -

        - Forgot your password? Don't worry. Enter your username below and we'll - send you instructions for setting a new one. -

        -
          -
          - -
          - -
          -
          -

          - We’ve sent you an email. Just follow the link in the email to reset your password. -

          - -
          -
          -
          +
          - - - - - + + + + + + - - - - - + + + + + + - - - - - + + + + + diff --git a/app/profile.html b/app/profile.html index a741a8f..7e432a8 100644 --- a/app/profile.html +++ b/app/profile.html @@ -29,21 +29,10 @@ -
          -
          - - Close - - - - -

          My Profile

          -
          -
          -
          +
          - + @@ -52,6 +41,7 @@ + @@ -59,5 +49,5 @@ - + diff --git a/app/question.html b/app/question.html index 8c40542..9224684 100644 --- a/app/question.html +++ b/app/question.html @@ -27,75 +27,10 @@ -
          -
          - - Close - - - - Settings - - -

          My Question

          -
          -
          -
          - We can help
          Ask us anything!
          -
          -
          -
            -
          -
          -
          -
            -
            -
            - -
            - - - - - - +
            + @@ -104,6 +39,7 @@ + diff --git a/app/question_list_helpee.html b/app/question_list_helpee.html index 06dea30..3e9aae9 100644 --- a/app/question_list_helpee.html +++ b/app/question_list_helpee.html @@ -24,24 +24,10 @@ -
            -
            - - - - Settings - - -

            My Questions

            -
            -
            -
            -
            -
            +
            + @@ -50,6 +36,7 @@ + diff --git a/app/question_list_helper.html b/app/question_list_helper.html index ed70ef2..6f9e94c 100644 --- a/app/question_list_helper.html +++ b/app/question_list_helper.html @@ -28,54 +28,10 @@ -
            -
            - - Close - - - - Settings - - -

            Answer a Question

            -
            -
            -
            - - - -
            -
            - Load more -
            - - Last sync: - - -
            -
            - -
            -
            - Load more -
            - -
            -
            -
            +
            + @@ -84,6 +40,7 @@ + diff --git a/app/registration.html b/app/registration.html index 1682890..a5ec2bf 100644 --- a/app/registration.html +++ b/app/registration.html @@ -26,54 +26,26 @@ -
            -
            - - Close - -

            Create Account

            -
            -
            -
            -

            - Be aware that you will lose your history when you sign in to your account. -

            -
              -
              - -
                -
                -
                - -
                  -
                  -
                  - -
                    -
                    - -
                    - Already registered? Sign in -
                    -
                    -
                    +
                    - - - - - + + + + + + - - - - - + + + + + + - - - - - + + + + + diff --git a/app/unsupported_locale.html b/app/unsupported_locale.html index 29abf5c..8c42bf9 100644 --- a/app/unsupported_locale.html +++ b/app/unsupported_locale.html @@ -24,28 +24,15 @@ -
                    -
                    -

                    Unsupported Language

                    -
                    -
                    -
                    -

                    - BuddyUp currently doesn't support "". -

                    -

                    - Please ask your questions in English, or go to - http://support.mozilla.org - for more help. -

                    - -
                    +
                    + + + + + diff --git a/app/views/main/authentication.html b/app/views/main/authentication.html new file mode 100644 index 0000000..d56370f --- /dev/null +++ b/app/views/main/authentication.html @@ -0,0 +1,28 @@ +
                    + + {{ _('Close') }} + +

                    {{ _('Sign In') }}

                    +
                    +
                    +
                    +

                    + {{ _('An account lets you answer questions, track contributions and receive alerts.') }} +

                    + +
                    + +
                      +
                      +
                      + +
                        +
                        +

                        + {{ _('Forgot your password?') }} +

                        + +
                        + {{ _("Don't have an account? Register") }} +
                        +
                        diff --git a/app/views/main/email_confirmation.html b/app/views/main/email_confirmation.html new file mode 100644 index 0000000..6cfd37c --- /dev/null +++ b/app/views/main/email_confirmation.html @@ -0,0 +1,18 @@ +
                        +
                        +

                        Confirm Account

                        +
                        +
                        +
                        +

                        Yay, you're almost done!

                        +

                        + We've sent a welcome email to: +
                        +

                        +

                        + Click on the link in your email to let us know that it made it to the right place. After that, return to BuddyUp and make other users happy! +

                        + +
                        \ No newline at end of file diff --git a/app/views/main/helper_profile.html b/app/views/main/helper_profile.html new file mode 100644 index 0000000..92072d8 --- /dev/null +++ b/app/views/main/helper_profile.html @@ -0,0 +1,14 @@ +
                        + + {{ _('Close') }} + +

                        +
                        +
                        +
                        +
                        +
                        +

                        {{ _('Answered Questions') }}

                        +
                        +
                        +
                        diff --git a/app/views/main/home.html b/app/views/main/home.html new file mode 100644 index 0000000..0b2c726 --- /dev/null +++ b/app/views/main/home.html @@ -0,0 +1,35 @@ +
                        + + + {{ _('Settings') }} + + +

                        {{ _('Support') }}

                        +
                        +
                        +
                        +

                        {{ _('Have Questions?') }}

                        +

                        {{ _('Get a Buddy to help you with your device') }}

                        + {{ _('Ask a Question') }} +
                        +
                        +

                        {{ _('Have Answers?') }}

                        +

                        {{ _('Help other users around the world') }}

                        + {{ _('Answer Questions') }} +
                        +
                        +
                        +

                        {{ _('Top Helpers this Week') }}

                        +
                        +
                        +
                        +
                        +

                        {{ _('My Questions') }}

                        +
                        +
                        + +
                        + {{ _('All My Questions') }} +
                        +
                        +
                        diff --git a/app/views/main/kb.html b/app/views/main/kb.html new file mode 100644 index 0000000..2c8057b --- /dev/null +++ b/app/views/main/kb.html @@ -0,0 +1,8 @@ +
                        + + {{ _('Close') }} + +

                        {{ _('Help Article') }}

                        +
                        + diff --git a/app/views/main/old_versions.html b/app/views/main/old_versions.html new file mode 100644 index 0000000..8118732 --- /dev/null +++ b/app/views/main/old_versions.html @@ -0,0 +1,7 @@ +
                        +

                        Incompatible version

                        +

                        We're sorry, but BuddyUp can't be installed on your version of Firefox OS. Please close this window to return to your home screen.

                        +
                        + + + diff --git a/app/views/main/password_reset.html b/app/views/main/password_reset.html new file mode 100644 index 0000000..f8ffb9c --- /dev/null +++ b/app/views/main/password_reset.html @@ -0,0 +1,28 @@ +
                        + + {{ _('Close') }} + +

                        {{ _('Reset Password') }}

                        +
                        +
                        +
                        +

                        + {{ _("Forgot your password? Don't worry. Enter your username below and we'll send you instructions for setting a new one.") }} +

                        + +
                        + +
                        + +
                        +
                        +

                        + {{ _("We've sent you an email. Just follow the link in the email to reset your password.") }} +

                        + +
                        +
                        diff --git a/app/views/main/profile.html b/app/views/main/profile.html new file mode 100644 index 0000000..bc6a6fb --- /dev/null +++ b/app/views/main/profile.html @@ -0,0 +1,10 @@ +
                        + + {{ _('Close') }} + + + + +

                        {{ _('My Profile') }}

                        +
                        +
                        diff --git a/app/views/main/question.html b/app/views/main/question.html new file mode 100644 index 0000000..8bb9190 --- /dev/null +++ b/app/views/main/question.html @@ -0,0 +1,67 @@ +
                        +
                        + + {{ _('Close') }} + + + + {{ _('Settings') }} + + +

                        {{ _('My Question') }}

                        +
                        +
                        +
                        + {{ _('We can help
                        Ask us anything!') }}
                        +
                        +
                        +
                          +
                        +
                        +
                        +
                          +
                          +
                          + +
                          + + + + + + \ No newline at end of file diff --git a/app/views/main/question_list_helpee.html b/app/views/main/question_list_helpee.html new file mode 100644 index 0000000..148628a --- /dev/null +++ b/app/views/main/question_list_helpee.html @@ -0,0 +1,14 @@ +
                          + + + + {{ _('Settings') }} + + +

                          {{ _('My Questions') }}

                          +
                          +
                          +
                          +
                          diff --git a/app/views/main/question_list_helper.html b/app/views/main/question_list_helper.html new file mode 100644 index 0000000..85e8a7c --- /dev/null +++ b/app/views/main/question_list_helper.html @@ -0,0 +1,44 @@ +
                          + + {{ _('Close') }} + + + + {{ _('Settings') }} + + +

                          {{ _('Answer a Question') }}

                          +
                          +
                          +
                          + + + +
                          +
                          + {{ _('Load more') }} +
                          + + {{ _('Last sync:') }} + + +
                          +
                          + + + +
                          +
                          \ No newline at end of file diff --git a/app/views/main/registration.html b/app/views/main/registration.html new file mode 100644 index 0000000..2a53fe0 --- /dev/null +++ b/app/views/main/registration.html @@ -0,0 +1,29 @@ +
                          + + {{ _('Close') }} + +

                          {{ _('Create Account') }}

                          +
                          +
                          +
                          +

                          + {{ _('Be aware that you will lose your history when you sign in to your account.') }} +

                          + +
                          + +
                            +
                            +
                            + +
                              +
                              +
                              + +
                                +
                                + +
                                + {{ _('Already registered? Sign in') }} +
                                +
                                diff --git a/app/views/main/unsupported_locale.html b/app/views/main/unsupported_locale.html new file mode 100644 index 0000000..c617bf5 --- /dev/null +++ b/app/views/main/unsupported_locale.html @@ -0,0 +1,17 @@ +
                                +
                                +

                                {{ _('Unsupported Language') }}

                                +
                                +
                                +
                                +

                                + {{ _('BuddyUp currently doesn\'t support "".') }} +

                                +

                                + {{ _('Please ask your questions in English, or go to http://support.mozilla.org for more help.') }} +

                                + +