diff --git a/core/controllers/custom_landing_pages_test.py b/core/controllers/custom_landing_pages_test.py index 2002d903e198..a3adbca24e81 100644 --- a/core/controllers/custom_landing_pages_test.py +++ b/core/controllers/custom_landing_pages_test.py @@ -56,7 +56,7 @@ def test_invalid_topic_landing_page_leads_to_404(self): def test_valid_subject_and_topic_loads_correctly(self): response = self.get_html_response('/learn/maths/fractions') - response.mustcontain('students and kids') + response.mustcontain('') class StewardsLandingPageTest(test_utils.GenericTestBase): @@ -67,20 +67,20 @@ def test_nonprofits_landing_page(self): response = self.get_html_response( feconf.CUSTOM_NONPROFITS_LANDING_PAGE_URL) response.mustcontain( - 'Let\'s work together to make compelling educational') + '') def test_parents_landing_page(self): response = self.get_html_response( feconf.CUSTOM_PARENTS_LANDING_PAGE_URL) response.mustcontain( - 'Help your child learn with our free, engaging lessons') + '') def test_teachers_landing_page(self): response = self.get_html_response( feconf.CUSTOM_TEACHERS_LANDING_PAGE_URL) - response.mustcontain('Oppia\'s free, personalized lessons are a great') + response.mustcontain('') def test_volunteers_landing_page(self): response = self.get_html_response( feconf.CUSTOM_VOLUNTEERS_LANDING_PAGE_URL) - response.mustcontain('Help improve access to high-quality education') + response.mustcontain('') diff --git a/core/controllers/pages_test.py b/core/controllers/pages_test.py index 9828ff4c3f4c..736a4299b403 100644 --- a/core/controllers/pages_test.py +++ b/core/controllers/pages_test.py @@ -31,8 +31,7 @@ def test_about_page(self): response = self.get_html_response('/about') self.assertEqual(response.content_type, 'text/html') response.mustcontain( - 'I18N_ABOUT_PAGE_CREDITS_TAB_HEADING', - 'I18N_ABOUT_PAGE_FOUNDATION_TAB_PARAGRAPH_5_LICENSE_HEADING') + '') def test_splash_page_with_valid_c_value(self): response = self.get_html_response('/splash', params={'c': 'at0'}) diff --git a/core/templates/dev/head/pages/about-page/about-page.controller.ts b/core/templates/dev/head/pages/about-page/about-page.controller.ts index 6212e1dc7966..7bdf83a73c71 100644 --- a/core/templates/dev/head/pages/about-page/about-page.controller.ts +++ b/core/templates/dev/head/pages/about-page/about-page.controller.ts @@ -12,91 +12,103 @@ // See the License for the specific language governing permissions and // limitations under the License. -require('base_components/BaseContentDirective.ts'); +/** + * @fileoverview Controllers for the about page. + */ + require( 'components/common-layout-directives/common-elements/' + 'background-banner.directive.ts'); require('domain/utilities/UrlInterpolationService.ts'); -/** - * @fileoverview Controllers for the about page. - */ - -oppia.controller('About', [ - '$scope', '$window', 'UrlInterpolationService', - function($scope, $window, UrlInterpolationService) { - // Define constants - $scope.TAB_ID_ABOUT = 'about'; - $scope.TAB_ID_FOUNDATION = 'foundation'; - $scope.TAB_ID_CREDITS = 'credits'; +oppia.directive('aboutPage', ['UrlInterpolationService', + function(UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/about-page/about-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$window', 'UrlInterpolationService', + function($window, UrlInterpolationService) { + var ctrl = this; + // Define constants + ctrl.TAB_ID_ABOUT = 'about'; + ctrl.TAB_ID_FOUNDATION = 'foundation'; + ctrl.TAB_ID_CREDITS = 'credits'; - var activeTabClass = 'oppia-about-tabs-active'; - var hash = window.location.hash.slice(1); - var visibleContent = 'oppia-about-visible-content'; + var activeTabClass = 'oppia-about-tabs-active'; + var hash = window.location.hash.slice(1); + var visibleContent = 'oppia-about-visible-content'; - var activateTab = function(tabName) { - $("a[id='" + tabName + "']").parent().addClass( - activeTabClass - ).siblings().removeClass(activeTabClass); - $('.' + tabName).addClass(visibleContent).siblings().removeClass( - visibleContent - ); - }; + var activateTab = function(tabName) { + $("a[id='" + tabName + "']").parent().addClass( + activeTabClass + ).siblings().removeClass(activeTabClass); + $('.' + tabName).addClass(visibleContent).siblings().removeClass( + visibleContent + ); + }; - if (hash === $scope.TAB_ID_FOUNDATION || hash === 'license') { - activateTab($scope.TAB_ID_FOUNDATION); - } + if (hash === ctrl.TAB_ID_FOUNDATION || hash === 'license') { + activateTab(ctrl.TAB_ID_FOUNDATION); + } - if (hash === $scope.TAB_ID_CREDITS) { - activateTab($scope.TAB_ID_CREDITS); - } + if (hash === ctrl.TAB_ID_CREDITS) { + activateTab(ctrl.TAB_ID_CREDITS); + } - if (hash === $scope.TAB_ID_ABOUT) { - activateTab($scope.TAB_ID_ABOUT); - } + if (hash === ctrl.TAB_ID_ABOUT) { + activateTab(ctrl.TAB_ID_ABOUT); + } - window.onhashchange = function() { - var hashChange = window.location.hash.slice(1); - if (hashChange === $scope.TAB_ID_FOUNDATION || hashChange === 'license') { - activateTab($scope.TAB_ID_FOUNDATION); - // Ensure page goes to the license section - if (hashChange === 'license') { - $window.location.reload(true); - } - } else if (hashChange === $scope.TAB_ID_CREDITS) { - activateTab($scope.TAB_ID_CREDITS); - } else if (hashChange === $scope.TAB_ID_ABOUT) { - activateTab($scope.TAB_ID_ABOUT); - } - }; + window.onhashchange = function() { + var hashChange = window.location.hash.slice(1); + if (hashChange === ctrl.TAB_ID_FOUNDATION || ( + hashChange === 'license')) { + activateTab(ctrl.TAB_ID_FOUNDATION); + // Ensure page goes to the license section + if (hashChange === 'license') { + $window.reload(true); + } + } else if (hashChange === ctrl.TAB_ID_CREDITS) { + activateTab(ctrl.TAB_ID_CREDITS); + } else if (hashChange === ctrl.TAB_ID_ABOUT) { + activateTab(ctrl.TAB_ID_ABOUT); + } + }; - var listOfNamesToThank = [ - 'Alex Kauffmann', 'Allison Barros', - 'Amy Latten', 'Brett Barros', - 'Crystal Kwok', 'Daniel Hernandez', - 'Divya Siddarth', 'Ilwon Yoon', - 'Jennifer Chen', 'John Cox', - 'John Orr', 'Katie Berlent', - 'Michael Wawszczak', 'Mike Gainer', - 'Neil Fraser', 'Noah Falstein', - 'Nupur Jain', 'Peter Norvig', - 'Philip Guo', 'Piotr Mitros', - 'Rachel Chen', 'Rahim Nathwani', - 'Robyn Choo', 'Tricia Ngoon', - 'Vikrant Nanda', 'Vinamrata Singal', - 'Yarin Feigenbaum']; + var listOfNamesToThank = [ + 'Alex Kauffmann', 'Allison Barros', + 'Amy Latten', 'Brett Barros', + 'Crystal Kwok', 'Daniel Hernandez', + 'Divya Siddarth', 'Ilwon Yoon', + 'Jennifer Chen', 'John Cox', + 'John Orr', 'Katie Berlent', + 'Michael Wawszczak', 'Mike Gainer', + 'Neil Fraser', 'Noah Falstein', + 'Nupur Jain', 'Peter Norvig', + 'Philip Guo', 'Piotr Mitros', + 'Rachel Chen', 'Rahim Nathwani', + 'Robyn Choo', 'Tricia Ngoon', + 'Vikrant Nanda', 'Vinamrata Singal', + 'Yarin Feigenbaum']; - $scope.onTabClick = function(tabName) { - // Update hash - window.location.hash = '#' + tabName; - activateTab(tabName); + ctrl.onTabClick = function(tabName) { + // Update hash + window.location.hash = '#' + tabName; + activateTab(tabName); + }; + ctrl.listOfNames = listOfNamesToThank + .slice(0, listOfNamesToThank.length - 1).join(', ') + + ' & ' + listOfNamesToThank[listOfNamesToThank.length - 1]; + ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + ctrl.aboutPageMascotImgUrl = UrlInterpolationService + .getStaticImageUrl('/general/about_page_mascot.png'); + } + ] }; - $scope.listOfNames = listOfNamesToThank - .slice(0, listOfNamesToThank.length - 1).join(', ') + - ' & ' + listOfNamesToThank[listOfNamesToThank.length - 1]; - $scope.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; - $scope.aboutPageMascotImgUrl = UrlInterpolationService.getStaticImageUrl( - '/general/about_page_mascot.png'); - } -]); + }]); diff --git a/core/templates/dev/head/pages/about-page/about-page.directive.html b/core/templates/dev/head/pages/about-page/about-page.directive.html new file mode 100644 index 000000000000..8c2e21eb2ed2 --- /dev/null +++ b/core/templates/dev/head/pages/about-page/about-page.directive.html @@ -0,0 +1,598 @@ +
+

+
+ +
+
+
+
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+ +
+
+
+

+
+ Oppia "O-pee-yah" (Finnish) - "to learn" +
+ + +

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+ +
+
+ " alt=""> +

+

+

+
+
+ " alt=""> +

+

+

+
+
+ " alt=""> +

+

+

+
+
+
+
+ +
+
+

+

+

+

+

+

+

+

+

+

+ +

+
+

+

+

+

+

+
+ + + + +
+
+
+
+
+

+

+

+
+ A +
    +
  • Aadya Mishra
  • +
  • Aashish Gaba
  • +
  • Aashish Singh
  • +
  • Abeer Khan
  • +
  • Abhay Gupta
  • +
  • Abhay Raizada
  • +
  • Abhijit Suresh
  • +
  • Abhimanyu Thakre
  • +
  • Abhishek Arya
  • +
  • Abhishek Kumar
  • +
  • Abraham Mgowano
  • +
  • acash mkj
  • +
  • Adarsh Kumar
  • +
  • Aditya Jain
  • +
  • Ajay Sharma
  • +
  • Ajo John
  • +
  • Akshay Anand
  • +
  • Alex Gower
  • +
  • Allan Zhou
  • +
  • Amanda Rodriguez
  • +
  • Amey Kudari
  • +
  • Amit Deutsch
  • +
  • Ana Francisca Bernardo
  • +
  • Andrew Low
  • +
  • Andrey Mironyuk
  • +
  • Angela Park
  • +
  • Anggoro Dewanto
  • +
  • Ankita Saxena
  • +
  • Anmol Shukla
  • +
  • Anthony Alridge
  • +
  • Anthony Zheng
  • +
  • Anubhav Sinha
  • +
  • Anurag Thakur
  • +
  • Apurv Bajaj
  • +
  • Areesha Tariq
  • +
  • Arpan Banerjee
  • +
  • Arun Kumar
  • +
  • Arunabh Ghosh
  • +
  • Ashish Verma
  • +
  • Ashmeet Singh
  • +
  • Ashutosh Singla
  • +
  • Assem Yeskabyl
  • +
  • Aubrey Wells
  • +
  • Avijit Gupta
  • +
+ + B +
    +
  • Barnabas Makonda
  • +
  • Ben Henning
  • +
  • Ben Targan
  • +
  • Bill Morrisson
  • +
  • BJ Voth
  • +
  • Bolaji Fatade
  • +
  • Boyd Y. Ching
  • +
  • Brenton Briggs
  • +
  • Brian Rodriguez
  • +
+ + C +
    +
  • Céline Deknop
  • +
  • Charisse De Torres
  • +
  • Chase Albert
  • +
  • Chen Shenyue
  • +
  • Chin Zhan Xiong
  • +
  • Christopher Tao
  • +
  • Cihan Bebek
  • +
  • Connie Chow
  • +
  • Corey Hunter
  • +
+ + D +
    +
  • Dawson Eliasen
  • +
  • Debanshu Bhaumik
  • +
  • Deepank Agarwal
  • +
  • Denis Samokhvalov
  • +
  • Dharmesh Poddar
  • +
  • Diana Chen
  • +
  • Divyadeep Singh
  • +
  • Domenico Vitarella
  • +
+ + E +
    +
  • Edward Allison
  • +
  • Elizabeth Kemp
  • +
  • Eric Lou
  • +
  • Eric Yang
  • +
  • Estelle Lee
  • +
+ + F +
    +
  • Frederik Creemers
  • +
  • Fang You
  • +
+ + G +
    +
  • Gagan Suneja
  • +
  • Geet Choudhary
  • +
  • Grace Guo
  • +
+ + H +
    +
  • Hamza Chandad
  • +
  • Harsh Khajuria
  • +
  • Hema Sundara Rao Ginni
  • +
  • Henry Phu
  • +
  • Hitesh Sharma
  • +
  • Himanshu Aggarwal
  • +
  • Himanshu Dixit
  • +
  • Huong Le
  • +
+ + I +
    +
  • Ian Luttrell
  • +
  • Ishan Singh
  • +
+ + J +
    +
  • Jackson Wu
  • +
  • Jacob Davis
  • +
  • Jacob Li Peng Cheng
  • +
  • Jakub Osika
  • +
  • James James John
  • +
  • Jared Silver
  • +
  • Jasper Deng
  • +
  • Jasmine Rider
  • +
  • Jaysinh Shukla
  • +
  • Jenna Mandel
  • +
  • Jeremy Emerson
  • +
  • Jérôme (zolk232)
  • +
  • Jerry Chen
  • +
  • John Glennon
  • +
  • John Prince Mesape
  • +
  • Jordan Cockles
  • +
  • Jordan Stapinski
  • +
  • Joseph Fedota
  • +
  • Joshua Cano
  • +
  • Joshua Lan
  • +
  • Joshua Lusk
  • +
  • Joydeep Mukherjee
  • +
  • Juan Saba
  • +
  • Justin Du
  • +
+ + K +
    +
  • Karen Rustad
  • +
  • Kartikey Pandey
  • +
  • Kashif Jamal Soofi
  • +
  • Kathryn Patterson
  • +
  • Kefeh Collins
  • +
  • Kenneth Ho
  • +
  • Kerry Wang
  • +
  • Keshav Bathla
  • +
  • Keshav Gupta
  • +
  • Kevin Conner
  • +
  • Kevin Lee
  • +
  • Kevin Thomas
  • +
  • Kiran Konduru
  • +
  • Koji Ashida
  • +
  • Kristin Anthony
  • +
  • Konstantinos Kagkelidis
  • +
  • Kumari Shalini
  • +
  • Kunal Garg
  • +
+ + L +
    +
  • Laura Kinkead
  • +
  • Luis Ulloa
  • +
  • Lunrong Chen
  • +
+ M +
    +
  • Madiyar Aitbayev
  • +
  • Mamat Rahmat
  • +
  • Manas Tungare
  • +
  • Manoj Mohan
  • +
  • Marcel Schmittfull
  • +
  • Mark Cabanero
  • +
  • Mark Halpin
  • +
  • Maurício Meneghini Fauth
  • +
  • Michael Anuzis
  • +
  • Michael Mossey
  • +
  • Michael Orwin
  • +
  • Michael Wagner
  • +
  • Min Tan
  • +
  • Milagro Teruel
  • +
  • Mohammad Shahebaz
  • +
  • Mohammad Zaman
  • +
  • Mohit Gupta
  • +
  • Mohit Musaddi
  • +
  • Mungo Dewar
  • +
+ N +
    +
  • Nalin Bhardwaj
  • +
  • Nalin Chhibber
  • +
  • Namuli Joyce
  • +
  • Naveen Kumar Shukla
  • +
  • Netaji Kancharapu
  • +
  • Nikhil Handa
  • +
  • Nikhil Prakash
  • +
  • Nikhil Sangwan
  • +
  • Nimalen Sivapalan
  • +
  • Nisheal John
  • +
  • Nithesh N. Hariharan
  • +
  • Nitish Bansal
  • +
+ + O +
    +
  • Oskar Cieslik
  • +
  • Oswell Chan
  • +
  • Owen Parry
  • +
  • Ozan Filiz
  • +
+ + P +
    +
  • Parth Bhoiwala
  • +
  • Phil Wagner
  • +
  • Philip Hayes
  • +
  • Phillip Moulton
  • +
  • Piyush Agrawal
  • +
  • Pranav Siddharth S
  • +
  • Prasanna Patil
  • +
  • Pratik Katte
  • +
  • Pulkit Gera
  • +
+ R +
    +
  • Rafał Kaszuba
  • +
  • Rahul Gurung
  • +
  • Rahul Modi
  • +
  • Raine Hoover
  • +
  • Rajan Garg
  • +
  • Rajat Patwa
  • +
  • Rajendra Kadam
  • +
  • Rakshit Kumar
  • +
  • Raymond Tso
  • +
  • Reinaldo Aguiar
  • +
  • Reto Brunner
  • +
  • Richard Cho
  • +
  • Rishav Chakraborty
  • +
  • Ritik Kumar
  • +
  • Rohan Gulati
  • +
  • Ross Strader
  • +
  • Rudra Sadhu
  • +
+ S +
    +
  • Sachin Gopal
  • +
  • Saeed Jassani
  • +
  • Sagar Manohar
  • +
  • Samara Trilling
  • +
  • Sandeep Dubey
  • +
  • Sandeep Patel
  • +
  • Santos Hernandez
  • +
  • Sanyam Khurana
  • +
  • Sasa Cocic-Banjanac
  • +
  • Satish Boggarapu
  • +
  • Satmeet Ubhi
  • +
  • Satyam Bhalla
  • +
  • Satyam Yadav
  • +
  • Satwik Kansal
  • +
  • Scott Junner
  • +
  • Scott Roberts
  • +
  • Sean Anthony Riordan
  • +
  • Sean Lip
  • +
  • Sebastian Zangaro
  • +
  • Seth Beckman
  • +
  • Shafqat Dulal
  • +
  • Shantanu Bhowmik
  • +
  • Sharif Shaker
  • +
  • Shiqi Wu
  • +
  • Shitong Shou
  • +
  • Shiva Krishna Yadav
  • +
  • Shivan Trivedi
  • +
  • Shivansh Bajaj
  • +
  • Shouvik Roy
  • +
  • Shubha Gupta
  • +
  • Shubham Bansal
  • +
  • Shuta Suzuki
  • +
  • Siddhant Khandelwal
  • +
  • Siddhant Srivastav
  • +
  • Soumyo Dey
  • +
  • Sourab Jha
  • +
  • Sourav Badami
  • +
  • Sourav Singh
  • +
  • Sreenivasulu Giritheja
  • +
  • Srikar Ch
  • +
  • Stephanie Federwisch
  • +
  • Stephen Chiang
  • +
  • Sudhanva MG
  • +
  • Sumit Paroothi
  • +
+ + T +
    +
  • Tanmay Mathur
  • +
  • Tarashish Mishra
  • +
  • Tezuesh Varshney
  • +
  • Timothy Cyrus
  • +
  • Tonatiuh Garcia
  • +
  • Tony Afula
  • +
  • Tony Jiang
  • +
  • Tracy Homer
  • +
  • Travis Shafer
  • +
  • Truong Kim
  • +
  • Tuguldur Baigalmaa
  • +
+ + U +
    +
  • Ujjwal Gulecha
  • +
  • Umesh Singla
  • +
  • Utkarsh Dixit
  • +
+ + V +
    +
  • Varun Tandon
  • +
  • Vasu Tomar
  • +
  • Vibhor Agarwal
  • +
  • Viet Tran Quoc Hoang
  • +
  • Vinita Murthi
  • +
  • Viraj Prabhu
  • +
  • Vishal Desai
  • +
  • Vishal Gupta
  • +
  • Vishal Joisar
  • +
  • Vishnu M
  • +
  • Vojtěch Jelínek
  • +
  • Vuyisile Ndlovu
  • +
+ + W +
    +
  • Wilson Hong
  • +
+ + X +
    +
  • Xinyu Wu
  • +
  • Xuân (Sean) Lương
  • +
+ + Y +
    +
  • Yana Malysheva
  • +
  • Yang Lu
  • +
  • Yash Jipkate
  • +
  • Yash Ladha
  • +
  • Yi Yan
  • +
  • Yiming Pan
  • +
  • Yogesh Sharma
  • +
  • Yousef Hamza
  • +
  • Yuan Gu
  • +
+ + Z +
    +
  • Zach Puller
  • +
  • Zachery Vekovius
  • +
  • Zoe Madden-Wood
  • +
+
+

+

+

+

+
+
+
+
+ +
+
+
+ Otter +
+
+
+

+
+
+
+ +
+
+
+ + +
+
+
+
+
+
+ + diff --git a/core/templates/dev/head/pages/about-page/about-page.mainpage.html b/core/templates/dev/head/pages/about-page/about-page.mainpage.html index 67b88bde01d3..a43105bd7318 100644 --- a/core/templates/dev/head/pages/about-page/about-page.mainpage.html +++ b/core/templates/dev/head/pages/about-page/about-page.mainpage.html @@ -20,611 +20,10 @@ -
-

-
- -
-
-
-
-
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
-
- -
-
-
-

-
- Oppia "O-pee-yah" (Finnish) - "to learn" -
- -

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

- -
-
- " alt=""> -

-

-

-
-
- " alt=""> -

-

-

-
-
- " alt=""> -

-

-

-
-
-
-
- -
-
-

-

-

-

-

-

-

-

-

-

- -

-
-

-

-

-

-

-
- - - - -
-
-
-
-
-

-

-

-
- A -
    -
  • Aadya Mishra
  • -
  • Aashish Gaba
  • -
  • Aashish Singh
  • -
  • Abeer Khan
  • -
  • Abhay Gupta
  • -
  • Abhay Raizada
  • -
  • Abhijit Suresh
  • -
  • Abhimanyu Thakre
  • -
  • Abhishek Arya
  • -
  • Abhishek Kumar
  • -
  • Abraham Mgowano
  • -
  • acash mkj
  • -
  • Adarsh Kumar
  • -
  • Aditya Jain
  • -
  • Ajay Sharma
  • -
  • Ajo John
  • -
  • Akshay Anand
  • -
  • Alex Gower
  • -
  • Allan Zhou
  • -
  • Amanda Rodriguez
  • -
  • Amey Kudari
  • -
  • Amit Deutsch
  • -
  • Ana Francisca Bernardo
  • -
  • Andrew Low
  • -
  • Andrey Mironyuk
  • -
  • Angela Park
  • -
  • Anggoro Dewanto
  • -
  • Ankita Saxena
  • -
  • Anmol Shukla
  • -
  • Anthony Alridge
  • -
  • Anthony Zheng
  • -
  • Anubhav Sinha
  • -
  • Anurag Thakur
  • -
  • Apurv Bajaj
  • -
  • Areesha Tariq
  • -
  • Arpan Banerjee
  • -
  • Arun Kumar
  • -
  • Arunabh Ghosh
  • -
  • Ashish Verma
  • -
  • Ashmeet Singh
  • -
  • Ashutosh Singla
  • -
  • Assem Yeskabyl
  • -
  • Aubrey Wells
  • -
  • Avijit Gupta
  • -
- - B -
    -
  • Barnabas Makonda
  • -
  • Ben Henning
  • -
  • Ben Targan
  • -
  • Bill Morrisson
  • -
  • BJ Voth
  • -
  • Bolaji Fatade
  • -
  • Boyd Y. Ching
  • -
  • Brenton Briggs
  • -
  • Brian Rodriguez
  • -
- - C -
    -
  • Céline Deknop
  • -
  • Charisse De Torres
  • -
  • Chase Albert
  • -
  • Chen Shenyue
  • -
  • Chin Zhan Xiong
  • -
  • Christopher Tao
  • -
  • Cihan Bebek
  • -
  • Connie Chow
  • -
  • Corey Hunter
  • -
- - D -
    -
  • Dawson Eliasen
  • -
  • Debanshu Bhaumik
  • -
  • Deepank Agarwal
  • -
  • Denis Samokhvalov
  • -
  • Dharmesh Poddar
  • -
  • Diana Chen
  • -
  • Divyadeep Singh
  • -
  • Domenico Vitarella
  • -
- - E -
    -
  • Edward Allison
  • -
  • Elizabeth Kemp
  • -
  • Eric Lou
  • -
  • Eric Yang
  • -
  • Estelle Lee
  • -
- - F -
    -
  • Frederik Creemers
  • -
  • Fang You
  • -
- - G -
    -
  • Gagan Suneja
  • -
  • Geet Choudhary
  • -
  • Grace Guo
  • -
- - H -
    -
  • Hamza Chandad
  • -
  • Harsh Khajuria
  • -
  • Hema Sundara Rao Ginni
  • -
  • Henry Phu
  • -
  • Hitesh Sharma
  • -
  • Himanshu Aggarwal
  • -
  • Himanshu Dixit
  • -
  • Huong Le
  • -
- - I -
    -
  • Ian Luttrell
  • -
  • Ishan Singh
  • -
- - J -
    -
  • Jackson Wu
  • -
  • Jacob Davis
  • -
  • Jacob Li Peng Cheng
  • -
  • Jakub Osika
  • -
  • James James John
  • -
  • Jared Silver
  • -
  • Jasper Deng
  • -
  • Jasmine Rider
  • -
  • Jaysinh Shukla
  • -
  • Jenna Mandel
  • -
  • Jeremy Emerson
  • -
  • Jérôme (zolk232)
  • -
  • Jerry Chen
  • -
  • John Glennon
  • -
  • John Prince Mesape
  • -
  • Jordan Cockles
  • -
  • Jordan Stapinski
  • -
  • Joseph Fedota
  • -
  • Joshua Cano
  • -
  • Joshua Lan
  • -
  • Joshua Lusk
  • -
  • Joydeep Mukherjee
  • -
  • Juan Saba
  • -
  • Justin Du
  • -
- - K -
    -
  • Karen Rustad
  • -
  • Kartikey Pandey
  • -
  • Kashif Jamal Soofi
  • -
  • Kathryn Patterson
  • -
  • Kefeh Collins
  • -
  • Kenneth Ho
  • -
  • Kerry Wang
  • -
  • Keshav Bathla
  • -
  • Keshav Gupta
  • -
  • Kevin Conner
  • -
  • Kevin Lee
  • -
  • Kevin Thomas
  • -
  • Kiran Konduru
  • -
  • Koji Ashida
  • -
  • Kristin Anthony
  • -
  • Konstantinos Kagkelidis
  • -
  • Kumari Shalini
  • -
  • Kunal Garg
  • -
- - L -
    -
  • Laura Kinkead
  • -
  • Luis Ulloa
  • -
  • Lunrong Chen
  • -
- - M -
    -
  • Madiyar Aitbayev
  • -
  • Mamat Rahmat
  • -
  • Manas Tungare
  • -
  • Manoj Mohan
  • -
  • Marcel Schmittfull
  • -
  • Mark Cabanero
  • -
  • Mark Halpin
  • -
  • Maurício Meneghini Fauth
  • -
  • Michael Anuzis
  • -
  • Michael Mossey
  • -
  • Michael Orwin
  • -
  • Michael Wagner
  • -
  • Min Tan
  • -
  • Milagro Teruel
  • -
  • Mohammad Shahebaz
  • -
  • Mohammad Zaman
  • -
  • Mohit Gupta
  • -
  • Mohit Musaddi
  • -
  • Mungo Dewar
  • -
- - N -
    -
  • Nalin Bhardwaj
  • -
  • Nalin Chhibber
  • -
  • Namuli Joyce
  • -
  • Naveen Kumar Shukla
  • -
  • Netaji Kancharapu
  • -
  • Nikhil Handa
  • -
  • Nikhil Prakash
  • -
  • Nikhil Sangwan
  • -
  • Nimalen Sivapalan
  • -
  • Nisheal John
  • -
  • Nithesh N. Hariharan
  • -
  • Nitish Bansal
  • -
- - O -
    -
  • Oskar Cieslik
  • -
  • Oswell Chan
  • -
  • Owen Parry
  • -
  • Ozan Filiz
  • -
- - P -
    -
  • Parth Bhoiwala
  • -
  • Phil Wagner
  • -
  • Philip Hayes
  • -
  • Phillip Moulton
  • -
  • Piyush Agrawal
  • -
  • Pranav Siddharth S
  • -
  • Prasanna Patil
  • -
  • Pratik Katte
  • -
  • Pulkit Gera
  • -
- - R -
    -
  • Rafał Kaszuba
  • -
  • Rahul Gurung
  • -
  • Rahul Modi
  • -
  • Raine Hoover
  • -
  • Rajan Garg
  • -
  • Rajat Patwa
  • -
  • Rajendra Kadam
  • -
  • Rakshit Kumar
  • -
  • Raymond Tso
  • -
  • Reinaldo Aguiar
  • -
  • Reto Brunner
  • -
  • Richard Cho
  • -
  • Rishav Chakraborty
  • -
  • Ritik Kumar
  • -
  • Rohan Gulati
  • -
  • Ross Strader
  • -
  • Rudra Sadhu
  • -
- - S -
    -
  • Sachin Gopal
  • -
  • Saeed Jassani
  • -
  • Sagar Manohar
  • -
  • Samara Trilling
  • -
  • Sandeep Dubey
  • -
  • Sandeep Patel
  • -
  • Santos Hernandez
  • -
  • Sanyam Khurana
  • -
  • Sasa Cocic-Banjanac
  • -
  • Satish Boggarapu
  • -
  • Satmeet Ubhi
  • -
  • Satyam Bhalla
  • -
  • Satyam Yadav
  • -
  • Satwik Kansal
  • -
  • Scott Junner
  • -
  • Scott Roberts
  • -
  • Sean Anthony Riordan
  • -
  • Sean Lip
  • -
  • Sebastian Zangaro
  • -
  • Seth Beckman
  • -
  • Shafqat Dulal
  • -
  • Shantanu Bhowmik
  • -
  • Sharif Shaker
  • -
  • Shiqi Wu
  • -
  • Shitong Shou
  • -
  • Shiva Krishna Yadav
  • -
  • Shivan Trivedi
  • -
  • Shivansh Bajaj
  • -
  • Shouvik Roy
  • -
  • Shubha Gupta
  • -
  • Shubham Bansal
  • -
  • Shuta Suzuki
  • -
  • Siddhant Khandelwal
  • -
  • Siddhant Srivastav
  • -
  • Soumyo Dey
  • -
  • Sourab Jha
  • -
  • Sourav Badami
  • -
  • Sourav Singh
  • -
  • Sreenivasulu Giritheja
  • -
  • Srikar Ch
  • -
  • Stephanie Federwisch
  • -
  • Stephen Chiang
  • -
  • Sudhanva MG
  • -
  • Sumit Paroothi
  • -
- - T -
    -
  • Tanmay Mathur
  • -
  • Tarashish Mishra
  • -
  • Tezuesh Varshney
  • -
  • Timothy Cyrus
  • -
  • Tonatiuh Garcia
  • -
  • Tony Afula
  • -
  • Tony Jiang
  • -
  • Tracy Homer
  • -
  • Travis Shafer
  • -
  • Truong Kim
  • -
  • Tuguldur Baigalmaa
  • -
- - U -
    -
  • Ujjwal Gulecha
  • -
  • Umesh Singla
  • -
  • Utkarsh Dixit
  • -
- - V -
    -
  • Varun Tandon
  • -
  • Vasu Tomar
  • -
  • Vibhor Agarwal
  • -
  • Viet Tran Quoc Hoang
  • -
  • Vinita Murthi
  • -
  • Viraj Prabhu
  • -
  • Vishal Desai
  • -
  • Vishal Gupta
  • -
  • Vishal Joisar
  • -
  • Vishnu M
  • -
  • Vojtěch Jelínek
  • -
  • Vuyisile Ndlovu
  • -
- - W -
    -
  • Wilson Hong
  • -
- - X -
    -
  • Xinyu Wu
  • -
  • Xuân (Sean) Lương
  • -
- - Y -
    -
  • Yana Malysheva
  • -
  • Yang Lu
  • -
  • Yash Jipkate
  • -
  • Yash Ladha
  • -
  • Yi Yan
  • -
  • Yiming Pan
  • -
  • Yogesh Sharma
  • -
  • Yousef Hamza
  • -
  • Yuan Gu
  • -
- - Z -
    -
  • Zach Puller
  • -
  • Zachery Vekovius
  • -
  • Zoe Madden-Wood
  • -
-
-

-

-

-

-
-
-
-
- -
-
-
- Otter -
-
-
-

-
-
-
- -
-
-
- - -
-
-
-
-
-
- +
- - @require('../footer_js_libs.html') diff --git a/core/templates/dev/head/pages/about-page/about-page.scripts.ts b/core/templates/dev/head/pages/about-page/about-page.scripts.ts new file mode 100644 index 000000000000..32626bf76252 --- /dev/null +++ b/core/templates/dev/head/pages/about-page/about-page.scripts.ts @@ -0,0 +1,21 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for the about page. + */ + +require('base_components/BaseContentDirective.ts'); + +require('pages/about-page/about-page.controller.ts'); diff --git a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.spec.ts b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.spec.ts index 493dd53e1827..fe5a8bf989e5 100644 --- a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.spec.ts +++ b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.spec.ts @@ -21,7 +21,7 @@ require('pages/creator-dashboard-page/creator-dashboard-page.controller.ts'); describe('Creator dashboard controller', function() { describe('CreatorDashboard', function() { - var scope, ctrl, $httpBackend; + var ctrl, $httpBackend, componentController; var CREATOR_DASHBOARD_DATA_URL = '/creatordashboardhandler/data'; var dashboardData = { explorations_list: [{ @@ -61,17 +61,20 @@ describe('Creator dashboard controller', function() { angular.mock.module('oppia'); }); + beforeEach(inject(['$componentController', function( + $componentController) { + componentController = $componentController; + }])); + beforeEach(angular.mock.inject(function($injector) { $httpBackend = $injector.get('$httpBackend'); })); beforeEach(angular.mock.inject( - function($controller, $rootScope, CreatorDashboardBackendApiService) { + function(CreatorDashboardBackendApiService) { $httpBackend.expect('GET', CREATOR_DASHBOARD_DATA_URL).respond( dashboardData); - scope = $rootScope.$new(); - ctrl = $controller('CreatorDashboard', { - $scope: scope, + ctrl = componentController('creatorDashboardPage', null, { AlertsService: null, CreatorDashboardBackendApiService: CreatorDashboardBackendApiService }); @@ -80,10 +83,10 @@ describe('Creator dashboard controller', function() { it('should have the correct data for creator dashboard', function() { $httpBackend.flush(); - expect(scope.explorationsList).toEqual(dashboardData.explorations_list); - expect(scope.collectionsList).toEqual(dashboardData.collections_list); - expect(scope.dashboardStats).toEqual(dashboardData.dashboard_stats); - expect(scope.lastWeekStats).toEqual(dashboardData.last_week_stats); + expect(ctrl.explorationsList).toEqual(dashboardData.explorations_list); + expect(ctrl.collectionsList).toEqual(dashboardData.collections_list); + expect(ctrl.dashboardStats).toEqual(dashboardData.dashboard_stats); + expect(ctrl.lastWeekStats).toEqual(dashboardData.last_week_stats); }); }); }); diff --git a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.ts b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.ts index 27c1b7e6d216..29d93c588b14 100644 --- a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.ts +++ b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.controller.ts @@ -13,7 +13,7 @@ // limitations under the License. /** - * @fileoverview Controllers for the creator dashboard. + * @fileoverview Directive for the creator dashboard. */ // TODO(vojtechjelinek): this block of requires should be removed after we @@ -167,392 +167,423 @@ require('services/UserService.ts'); require('pages/creator-dashboard-page/creator-dashboard-page.constants.ts'); -oppia.controller('CreatorDashboard', [ - '$http', '$log', '$q', '$rootScope', '$scope', '$uibModal', '$window', - 'AlertsService', 'CreatorDashboardBackendApiService', 'DateTimeFormatService', - 'ExplorationCreationService', 'QuestionObjectFactory', - 'RatingComputationService', 'SuggestionModalForCreatorDashboardService', - 'SuggestionObjectFactory', 'SuggestionThreadObjectFactory', - 'ThreadStatusDisplayService', 'TopicsAndSkillsDashboardBackendApiService', - 'UrlInterpolationService', 'UserService', 'EXPLORATIONS_SORT_BY_KEYS', - 'EXPLORATION_DROPDOWN_STATS', 'FATAL_ERROR_CODES', - 'HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS', - 'HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS', 'SUBSCRIPTION_SORT_BY_KEYS', - function( - $http, $log, $q, $rootScope, $scope, $uibModal, $window, - AlertsService, CreatorDashboardBackendApiService, DateTimeFormatService, - ExplorationCreationService, QuestionObjectFactory, - RatingComputationService, SuggestionModalForCreatorDashboardService, - SuggestionObjectFactory, SuggestionThreadObjectFactory, - ThreadStatusDisplayService, TopicsAndSkillsDashboardBackendApiService, - UrlInterpolationService, UserService, EXPLORATIONS_SORT_BY_KEYS, - EXPLORATION_DROPDOWN_STATS, FATAL_ERROR_CODES, - HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS, - HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS, SUBSCRIPTION_SORT_BY_KEYS) { - var EXP_PUBLISH_TEXTS = { - defaultText: ( - 'This exploration is private. Publish it to receive statistics.'), - smText: 'Publish the exploration to receive statistics.' - }; - - var userDashboardDisplayPreference = - constants.ALLOWED_CREATOR_DASHBOARD_DISPLAY_PREFS.CARD; - - $scope.DEFAULT_EMPTY_TITLE = 'Untitled'; - $scope.EXPLORATION_DROPDOWN_STATS = EXPLORATION_DROPDOWN_STATS; - $scope.EXPLORATIONS_SORT_BY_KEYS = EXPLORATIONS_SORT_BY_KEYS; - $scope.HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS = ( - HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS); - $scope.SUBSCRIPTION_SORT_BY_KEYS = SUBSCRIPTION_SORT_BY_KEYS; - $scope.HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS = ( - HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS); - $scope.DEFAULT_TWITTER_SHARE_MESSAGE_DASHBOARD = ( - GLOBALS.DEFAULT_TWITTER_SHARE_MESSAGE_DASHBOARD); - - $scope.canCreateCollections = null; - $rootScope.loadingMessage = 'Loading'; - var userInfoPromise = UserService.getUserInfoAsync(); - userInfoPromise.then(function(userInfo) { - $scope.canCreateCollections = userInfo.canCreateCollections(); - }); - - var dashboardDataPromise = ( - CreatorDashboardBackendApiService.fetchDashboardData()); - dashboardDataPromise.then( - function(response) { - var responseData = response.data; - $scope.currentSortType = EXPLORATIONS_SORT_BY_KEYS.OPEN_FEEDBACK; - $scope.currentSubscribersSortType = SUBSCRIPTION_SORT_BY_KEYS.USERNAME; - $scope.isCurrentSortDescending = true; - $scope.isCurrentSubscriptionSortDescending = true; - $scope.explorationsList = responseData.explorations_list; - $scope.collectionsList = responseData.collections_list; - $scope.subscribersList = responseData.subscribers_list; - $scope.dashboardStats = responseData.dashboard_stats; - $scope.lastWeekStats = responseData.last_week_stats; - $scope.myExplorationsView = responseData.display_preference; - $scope.topicSummaries = responseData.topic_summary_dicts; - var numberOfCreatedSuggestions = ( - responseData.threads_for_created_suggestions_list.length); - var numberOfSuggestionsToReview = ( - responseData.threads_for_suggestions_to_review_list.length); - $scope.mySuggestionsList = []; - for (var i = 0; i < numberOfCreatedSuggestions; i++) { - if (responseData.created_suggestions_list.length !== - numberOfCreatedSuggestions) { - $log.error('Number of suggestions does not match number of ' + - 'suggestion threads'); - } - for (var j = 0; j < numberOfCreatedSuggestions; j++) { - var suggestion = SuggestionObjectFactory.createFromBackendDict( - responseData.created_suggestions_list[j]); - var threadDict = ( - responseData.threads_for_created_suggestions_list[i]); - if (threadDict.thread_id === suggestion.getThreadId()) { - var suggestionThread = ( - SuggestionThreadObjectFactory.createFromBackendDicts( - threadDict, responseData.created_suggestions_list[j])); - $scope.mySuggestionsList.push(suggestionThread); +oppia.directive('creatorDashboardPage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/creator-dashboard-page/creator-dashboard-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$log', '$q', '$rootScope', '$uibModal', '$window', + 'AlertsService', 'CreatorDashboardBackendApiService', + 'DateTimeFormatService', + 'ExplorationCreationService', 'QuestionObjectFactory', + 'RatingComputationService', 'SuggestionModalForCreatorDashboardService', + 'SuggestionObjectFactory', 'SuggestionThreadObjectFactory', + 'ThreadStatusDisplayService', + 'TopicsAndSkillsDashboardBackendApiService', + 'UrlInterpolationService', 'UserService', 'EXPLORATIONS_SORT_BY_KEYS', + 'EXPLORATION_DROPDOWN_STATS', 'FATAL_ERROR_CODES', + 'HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS', + 'HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS', + 'SUBSCRIPTION_SORT_BY_KEYS', + function( + $http, $log, $q, $rootScope, $uibModal, $window, + AlertsService, CreatorDashboardBackendApiService, + DateTimeFormatService, + ExplorationCreationService, QuestionObjectFactory, + RatingComputationService, SuggestionModalForCreatorDashboardService, + SuggestionObjectFactory, SuggestionThreadObjectFactory, + ThreadStatusDisplayService, + TopicsAndSkillsDashboardBackendApiService, + UrlInterpolationService, UserService, EXPLORATIONS_SORT_BY_KEYS, + EXPLORATION_DROPDOWN_STATS, FATAL_ERROR_CODES, + HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS, + HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS, + SUBSCRIPTION_SORT_BY_KEYS) { + var ctrl = this; + var EXP_PUBLISH_TEXTS = { + defaultText: ( + 'This exploration is private. Publish it to receive statistics.'), + smText: 'Publish the exploration to receive statistics.' + }; + + var userDashboardDisplayPreference = + constants.ALLOWED_CREATOR_DASHBOARD_DISPLAY_PREFS.CARD; + + ctrl.DEFAULT_EMPTY_TITLE = 'Untitled'; + ctrl.EXPLORATION_DROPDOWN_STATS = EXPLORATION_DROPDOWN_STATS; + ctrl.EXPLORATIONS_SORT_BY_KEYS = EXPLORATIONS_SORT_BY_KEYS; + ctrl.HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS = ( + HUMAN_READABLE_EXPLORATIONS_SORT_BY_KEYS); + ctrl.SUBSCRIPTION_SORT_BY_KEYS = SUBSCRIPTION_SORT_BY_KEYS; + ctrl.HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS = ( + HUMAN_READABLE_SUBSCRIPTION_SORT_BY_KEYS); + ctrl.DEFAULT_TWITTER_SHARE_MESSAGE_DASHBOARD = ( + GLOBALS.DEFAULT_TWITTER_SHARE_MESSAGE_DASHBOARD); + + ctrl.canCreateCollections = null; + $rootScope.loadingMessage = 'Loading'; + var userInfoPromise = UserService.getUserInfoAsync(); + userInfoPromise.then(function(userInfo) { + ctrl.canCreateCollections = userInfo.canCreateCollections(); + }); + + var dashboardDataPromise = ( + CreatorDashboardBackendApiService.fetchDashboardData()); + dashboardDataPromise.then( + function(response) { + var responseData = response.data; + ctrl.currentSortType = EXPLORATIONS_SORT_BY_KEYS.OPEN_FEEDBACK; + ctrl.currentSubscribersSortType = + SUBSCRIPTION_SORT_BY_KEYS.USERNAME; + ctrl.isCurrentSortDescending = true; + ctrl.isCurrentSubscriptionSortDescending = true; + ctrl.explorationsList = responseData.explorations_list; + ctrl.collectionsList = responseData.collections_list; + ctrl.subscribersList = responseData.subscribers_list; + ctrl.dashboardStats = responseData.dashboard_stats; + ctrl.lastWeekStats = responseData.last_week_stats; + ctrl.myExplorationsView = responseData.display_preference; + ctrl.topicSummaries = responseData.topic_summary_dicts; + var numberOfCreatedSuggestions = ( + responseData.threads_for_created_suggestions_list.length); + var numberOfSuggestionsToReview = ( + responseData.threads_for_suggestions_to_review_list.length); + ctrl.mySuggestionsList = []; + for (var i = 0; i < numberOfCreatedSuggestions; i++) { + if (responseData.created_suggestions_list.length !== + numberOfCreatedSuggestions) { + $log.error('Number of suggestions does not match number of ' + + 'suggestion threads'); + } + for (var j = 0; j < numberOfCreatedSuggestions; j++) { + var suggestion = SuggestionObjectFactory + .createFromBackendDict( + responseData.created_suggestions_list[j]); + var threadDict = ( + responseData.threads_for_created_suggestions_list[i]); + if (threadDict.thread_id === suggestion.getThreadId()) { + var suggestionThread = ( + SuggestionThreadObjectFactory.createFromBackendDicts( + threadDict, responseData.created_suggestions_list[j])); + ctrl.mySuggestionsList.push(suggestionThread); + } + } + } + ctrl.suggestionsToReviewList = []; + for (var i = 0; i < numberOfSuggestionsToReview; i++) { + if (responseData.suggestions_to_review_list.length !== + numberOfSuggestionsToReview) { + $log.error('Number of suggestions does not match number of ' + + 'suggestion threads'); + } + for (var j = 0; j < numberOfSuggestionsToReview; j++) { + var suggestion = SuggestionObjectFactory + .createFromBackendDict( + responseData.suggestions_to_review_list[j]); + var threadDict = ( + responseData.threads_for_suggestions_to_review_list[i]); + if (threadDict.thread_id === suggestion.getThreadId()) { + var suggestionThread = ( + SuggestionThreadObjectFactory.createFromBackendDicts( + threadDict, + responseData.suggestions_to_review_list[j])); + ctrl.suggestionsToReviewList.push(suggestionThread); + } + } + } + + if (ctrl.dashboardStats && ctrl.lastWeekStats) { + ctrl.relativeChangeInTotalPlays = ( + ctrl.dashboardStats.total_plays - ( + ctrl.lastWeekStats.total_plays) + ); + } + + if (ctrl.explorationsList.length === 0 && + ctrl.collectionsList.length > 0) { + ctrl.activeTab = 'myCollections'; + } else if (ctrl.explorationsList.length === 0 && ( + ctrl.mySuggestionsList.length > 0 || + ctrl.suggestionsToReviewList.length > 0)) { + ctrl.activeTab = 'suggestions'; + } else { + ctrl.activeTab = 'myExplorations'; + } + }, + function(errorResponse) { + if (FATAL_ERROR_CODES.indexOf(errorResponse.status) !== -1) { + AlertsService.addWarning('Failed to get dashboard data'); } } - } - $scope.suggestionsToReviewList = []; - for (var i = 0; i < numberOfSuggestionsToReview; i++) { - if (responseData.suggestions_to_review_list.length !== - numberOfSuggestionsToReview) { - $log.error('Number of suggestions does not match number of ' + - 'suggestion threads'); + ); + + $q.all([userInfoPromise, dashboardDataPromise]).then(function() { + $rootScope.loadingMessage = ''; + }); + + ctrl.getAverageRating = RatingComputationService + .computeAverageRating; + ctrl.createNewExploration = ( + ExplorationCreationService.createNewExploration); + ctrl.getLocaleAbbreviatedDatetimeString = ( + DateTimeFormatService.getLocaleAbbreviatedDatetimeString); + ctrl.enableQuestionSuggestions = constants + .ENABLE_NEW_STRUCTURE_PLAYERS; + ctrl.getHumanReadableStatus = ( + ThreadStatusDisplayService.getHumanReadableStatus); + + ctrl.emptyDashboardImgUrl = UrlInterpolationService + .getStaticImageUrl('/general/empty_dashboard.svg'); + ctrl.canReviewActiveThread = null; + + ctrl.setActiveTab = function(newActiveTabName) { + ctrl.activeTab = newActiveTabName; + }; + + ctrl.getExplorationUrl = function(explorationId) { + return '/create/' + explorationId; + }; + + ctrl.getCollectionUrl = function(collectionId) { + return '/collection_editor/create/' + collectionId; + }; + + ctrl.setMyExplorationsView = function(newViewType) { + $http.post('/creatordashboardhandler/data', { + display_preference: newViewType, + }).then(function() { + ctrl.myExplorationsView = newViewType; + }); + userDashboardDisplayPreference = newViewType; + }; + + ctrl.checkMobileView = function() { + return ($window.innerWidth < 500); + }; + + ctrl.showUsernamePopover = function(subscriberUsername) { + // The popover on the subscription card is only shown if the length + // of the subscriber username is greater than 10 and the user hovers + // over the truncated username. + if (subscriberUsername.length > 10) { + return 'mouseenter'; + } else { + return 'none'; } - for (var j = 0; j < numberOfSuggestionsToReview; j++) { - var suggestion = SuggestionObjectFactory.createFromBackendDict( - responseData.suggestions_to_review_list[j]); - var threadDict = ( - responseData.threads_for_suggestions_to_review_list[i]); - if (threadDict.thread_id === suggestion.getThreadId()) { - var suggestionThread = ( - SuggestionThreadObjectFactory.createFromBackendDicts( - threadDict, responseData.suggestions_to_review_list[j])); - $scope.suggestionsToReviewList.push(suggestionThread); - } + }; + + ctrl.updatesGivenScreenWidth = function() { + if (ctrl.checkMobileView()) { + // For mobile users, the view of the creators + // exploration list is shown only in + // the card view and can't be switched to list view. + ctrl.myExplorationsView = ( + constants.ALLOWED_CREATOR_DASHBOARD_DISPLAY_PREFS.CARD); + ctrl.publishText = EXP_PUBLISH_TEXTS.smText; + } else { + // For computer users or users operating in larger screen size + // the creator exploration list will come back to its previously + // selected view (card or list) when resized from mobile view + ctrl.myExplorationsView = userDashboardDisplayPreference; + ctrl.publishText = EXP_PUBLISH_TEXTS.defaultText; } - } + }; - if ($scope.dashboardStats && $scope.lastWeekStats) { - $scope.relativeChangeInTotalPlays = ( - $scope.dashboardStats.total_plays - $scope.lastWeekStats.total_plays - ); - } - - if ($scope.explorationsList.length === 0 && - $scope.collectionsList.length > 0) { - $scope.activeTab = 'myCollections'; - } else if ($scope.explorationsList.length === 0 && ( - $scope.mySuggestionsList.length > 0 || - $scope.suggestionsToReviewList.length > 0)) { - $scope.activeTab = 'suggestions'; - } else { - $scope.activeTab = 'myExplorations'; - } - }, - function(errorResponse) { - if (FATAL_ERROR_CODES.indexOf(errorResponse.status) !== -1) { - AlertsService.addWarning('Failed to get dashboard data'); - } - } - ); - - $q.all([userInfoPromise, dashboardDataPromise]).then(function() { - $rootScope.loadingMessage = ''; - }); - - $scope.getAverageRating = RatingComputationService.computeAverageRating; - $scope.createNewExploration = ( - ExplorationCreationService.createNewExploration); - $scope.getLocaleAbbreviatedDatetimeString = ( - DateTimeFormatService.getLocaleAbbreviatedDatetimeString); - $scope.enableQuestionSuggestions = constants.ENABLE_NEW_STRUCTURE_PLAYERS; - $scope.getHumanReadableStatus = ( - ThreadStatusDisplayService.getHumanReadableStatus); - - $scope.emptyDashboardImgUrl = UrlInterpolationService.getStaticImageUrl( - '/general/empty_dashboard.svg'); - $scope.canReviewActiveThread = null; - - $scope.setActiveTab = function(newActiveTabName) { - $scope.activeTab = newActiveTabName; - }; - - $scope.getExplorationUrl = function(explorationId) { - return '/create/' + explorationId; - }; - - $scope.getCollectionUrl = function(collectionId) { - return '/collection_editor/create/' + collectionId; - }; - - $scope.setMyExplorationsView = function(newViewType) { - $http.post('/creatordashboardhandler/data', { - display_preference: newViewType, - }).then(function() { - $scope.myExplorationsView = newViewType; - }); - userDashboardDisplayPreference = newViewType; - }; - - $scope.checkMobileView = function() { - return ($window.innerWidth < 500); - }; - - $scope.showUsernamePopover = function(subscriberUsername) { - // The popover on the subscription card is only shown if the length of - // the subscriber username is greater than 10 and the user hovers over - // the truncated username. - if (subscriberUsername.length > 10) { - return 'mouseenter'; - } else { - return 'none'; - } - }; - - $scope.updatesGivenScreenWidth = function() { - if ($scope.checkMobileView()) { - // For mobile users, the view of the creators - // exploration list is shown only in - // the card view and can't be switched to list view. - $scope.myExplorationsView = ( - constants.ALLOWED_CREATOR_DASHBOARD_DISPLAY_PREFS.CARD); - $scope.publishText = EXP_PUBLISH_TEXTS.smText; - } else { - // For computer users or users operating in larger screen size - // the creator exploration list will come back to its previously - // selected view (card or list) when resized from mobile view - $scope.myExplorationsView = userDashboardDisplayPreference; - $scope.publishText = EXP_PUBLISH_TEXTS.defaultText; - } - }; - - $scope.updatesGivenScreenWidth(); - angular.element($window).bind('resize', function() { - $scope.updatesGivenScreenWidth(); - }); - - $scope.setExplorationsSortingOptions = function(sortType) { - if (sortType === $scope.currentSortType) { - $scope.isCurrentSortDescending = !$scope.isCurrentSortDescending; - } else { - $scope.currentSortType = sortType; - } - }; - - $scope.setSubscriptionSortingOptions = function(sortType) { - if (sortType === $scope.currentSubscribersSortType) { - $scope.isCurrentSubscriptionSortDescending = ( - !$scope.isCurrentSubscriptionSortDescending); - } else { - $scope.currentSubscribersSortType = sortType; - } - }; - - $scope.sortSubscriptionFunction = function(entity) { - // This function is passed as a custom comparator function to `orderBy`, - // so that special cases can be handled while sorting subscriptions. - var value = entity[$scope.currentSubscribersSortType]; - if ($scope.currentSubscribersSortType === - SUBSCRIPTION_SORT_BY_KEYS.IMPACT) { - value = (value || 0); - } - return value; - }; - - var _fetchMessages = function(threadId) { - $http.get('/threadhandler/' + threadId).then(function(response) { - var allThreads = $scope.mySuggestionsList.concat( - $scope.suggestionsToReviewList); - for (var i = 0; i < allThreads.length; i++) { - if (allThreads[i].threadId === threadId) { - allThreads[i].setMessages(response.data.messages); - break; + ctrl.updatesGivenScreenWidth(); + angular.element($window).bind('resize', function() { + ctrl.updatesGivenScreenWidth(); + }); + + ctrl.setExplorationsSortingOptions = function(sortType) { + if (sortType === ctrl.currentSortType) { + ctrl.isCurrentSortDescending = !ctrl.isCurrentSortDescending; + } else { + ctrl.currentSortType = sortType; } - } - }); - }; - - $scope.clearActiveThread = function() { - $scope.activeThread = null; - }; - - $scope.setActiveThread = function(threadId) { - _fetchMessages(threadId); - for (var i = 0; i < $scope.mySuggestionsList.length; i++) { - if ($scope.mySuggestionsList[i].threadId === threadId) { - $scope.activeThread = $scope.mySuggestionsList[i]; - $scope.canReviewActiveThread = false; - break; - } - } - if (!$scope.activeThread) { - for (var i = 0; i < $scope.suggestionsToReviewList.length; i++) { - if ($scope.suggestionsToReviewList[i].threadId === threadId) { - $scope.activeThread = $scope.suggestionsToReviewList[i]; - $scope.canReviewActiveThread = true; - break; + }; + + ctrl.setSubscriptionSortingOptions = function(sortType) { + if (sortType === ctrl.currentSubscribersSortType) { + ctrl.isCurrentSubscriptionSortDescending = ( + !ctrl.isCurrentSubscriptionSortDescending); + } else { + ctrl.currentSubscribersSortType = sortType; } - } - } - }; - - $scope.showSuggestionModal = function() { - SuggestionModalForCreatorDashboardService.showSuggestionModal( - $scope.activeThread.suggestion.suggestionType, - { - activeThread: $scope.activeThread, - suggestionsToReviewList: $scope.suggestionsToReviewList, - clearActiveThread: $scope.clearActiveThread, - canReviewActiveThread: $scope.canReviewActiveThread - } - ); - }; - - $scope.sortByFunction = function(entity) { - // This function is passed as a custom comparator function to `orderBy`, - // so that special cases can be handled while sorting explorations. - var value = entity[$scope.currentSortType]; - if (entity.status === 'private') { - if ($scope.currentSortType === EXPLORATIONS_SORT_BY_KEYS.TITLE) { - value = (value || $scope.DEFAULT_EMPTY_TITLE); - } else if ($scope.currentSortType !== - EXPLORATIONS_SORT_BY_KEYS.LAST_UPDATED) { - value = 0; - } - } else if ($scope.currentSortType === EXPLORATIONS_SORT_BY_KEYS.RATING) { - var averageRating = $scope.getAverageRating(value); - value = (averageRating || 0); - } - return value; - }; - - $scope.getCompleteThumbnailIconUrl = function(iconUrl) { - return UrlInterpolationService.getStaticImageUrl(iconUrl); - }; - - $scope.showCreateQuestionModal = function() { - var question = QuestionObjectFactory.createDefaultQuestion(); - var topicSummaries = $scope.topicSummaries; - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/creator-dashboard-page/modal-templates/' + - 'create-question-modal.directive.html'), - backdrop: 'static', - keyboard: false, - size: 'lg', - resolve: {}, - controller: [ - '$scope', '$uibModalInstance', function( - $scope, $uibModalInstance) { - $scope.question = question; - $scope.topicId = null; - $scope.topicSummaries = topicSummaries; - $scope.misconceptions = []; - $scope.errorMessage = null; - - $scope.isValidQuestion = function() { - var errorMessage = $scope.question.validate([]); - if (!$scope.topicId) { - $scope.errorMessage = 'Please choose a topic before submitting'; - } else if (errorMessage === false) { - $scope.errorMessage = null; - } else { - $scope.errorMessage = errorMessage; + }; + + ctrl.sortSubscriptionFunction = function(entity) { + // This function is passed as a custom comparator function to + // `orderBy`, so that special cases can be handled while sorting + // subscriptions. + var value = entity[ctrl.currentSubscribersSortType]; + if (ctrl.currentSubscribersSortType === + SUBSCRIPTION_SORT_BY_KEYS.IMPACT) { + value = (value || 0); + } + return value; + }; + + var _fetchMessages = function(threadId) { + $http.get('/threadhandler/' + threadId).then(function(response) { + var allThreads = ctrl.mySuggestionsList.concat( + ctrl.suggestionsToReviewList); + for (var i = 0; i < allThreads.length; i++) { + if (allThreads[i].threadId === threadId) { + allThreads[i].setMessages(response.data.messages); + break; } - return ($scope.question.validate([]) === false); - }; - - $scope.dismissModal = function() { - $uibModalInstance.dismiss(); - }; - - $scope.createQuestion = function() { - var errorMessage = question.validate([]); - if (!$scope.topicId) { - $scope.errorMessage = 'Please choose a topic before submitting'; - } else if (errorMessage === false) { - $scope.errorMessage = null; - $uibModalInstance.close({ - question: question, - topicId: $scope.topicId - }); - } else { - $scope.errorMessage = errorMessage; + } + }); + }; + + ctrl.clearActiveThread = function() { + ctrl.activeThread = null; + }; + + ctrl.setActiveThread = function(threadId) { + _fetchMessages(threadId); + for (var i = 0; i < ctrl.mySuggestionsList.length; i++) { + if (ctrl.mySuggestionsList[i].threadId === threadId) { + ctrl.activeThread = ctrl.mySuggestionsList[i]; + ctrl.canReviewActiveThread = false; + break; + } + } + if (!ctrl.activeThread) { + for (var i = 0; i < ctrl.suggestionsToReviewList.length; i++) { + if (ctrl.suggestionsToReviewList[i].threadId === threadId) { + ctrl.activeThread = ctrl.suggestionsToReviewList[i]; + ctrl.canReviewActiveThread = true; + break; } - }; + } } - ] - }).result.then(function(result) { - var topicVersion = null; - for (var i = 0; i < topicSummaries.length; i++) { - if (topicSummaries[i].id === result.topicId) { - topicVersion = topicSummaries[i].version; - break; + }; + + ctrl.showSuggestionModal = function() { + SuggestionModalForCreatorDashboardService.showSuggestionModal( + ctrl.activeThread.suggestion.suggestionType, + { + activeThread: ctrl.activeThread, + suggestionsToReviewList: ctrl.suggestionsToReviewList, + clearActiveThread: ctrl.clearActiveThread, + canReviewActiveThread: ctrl.canReviewActiveThread + } + ); + }; + + ctrl.sortByFunction = function(entity) { + // This function is passed as a custom comparator function to + // `orderBy`, so that special cases can be handled while sorting + // explorations. + var value = entity[ctrl.currentSortType]; + if (entity.status === 'private') { + if (ctrl.currentSortType === EXPLORATIONS_SORT_BY_KEYS.TITLE) { + value = (value || ctrl.DEFAULT_EMPTY_TITLE); + } else if (ctrl.currentSortType !== + EXPLORATIONS_SORT_BY_KEYS.LAST_UPDATED) { + value = 0; + } + } else if ( + ctrl.currentSortType === EXPLORATIONS_SORT_BY_KEYS.RATING) { + var averageRating = ctrl.getAverageRating(value); + value = (averageRating || 0); } - } - if (!topicVersion) { - $log.error('Unable to match topic id selected with topic choices.'); - } - $http.post('/suggestionhandler/', { - suggestion_type: 'add_question', - target_type: 'topic', - target_id: result.topicId, - target_version_at_submission: topicVersion, - change: { - cmd: 'create_new_fully_specified_question', - question_dict: result.question.toBackendDict(true), - skill_id: null - }, - description: null - }); - }, function() { - $log.error('Error while submitting question'); - }); - }; - } -]); + return value; + }; + + ctrl.getCompleteThumbnailIconUrl = function(iconUrl) { + return UrlInterpolationService.getStaticImageUrl(iconUrl); + }; + + ctrl.showCreateQuestionModal = function() { + var question = QuestionObjectFactory.createDefaultQuestion(); + var topicSummaries = ctrl.topicSummaries; + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/creator-dashboard-page/modal-templates/' + + 'create-question-modal.directive.html'), + backdrop: 'static', + keyboard: false, + size: 'lg', + resolve: {}, + controller: [ + '$scope', '$uibModalInstance', function( + $scope, $uibModalInstance) { + $scope.question = question; + $scope.topicId = null; + $scope.topicSummaries = topicSummaries; + $scope.misconceptions = []; + $scope.errorMessage = null; + + $scope.isValidQuestion = function() { + var errorMessage = $scope.question.validate([]); + if (!$scope.topicId) { + $scope.errorMessage = + 'Please choose a topic before submitting'; + } else if (errorMessage === false) { + $scope.errorMessage = null; + } else { + $scope.errorMessage = errorMessage; + } + return ($scope.question.validate([]) === false); + }; + + $scope.dismissModal = function() { + $uibModalInstance.dismiss(); + }; + + $scope.createQuestion = function() { + var errorMessage = question.validate([]); + if (!$scope.topicId) { + $scope.errorMessage = + 'Please choose a topic before submitting'; + } else if (errorMessage === false) { + $scope.errorMessage = null; + $uibModalInstance.close({ + question: question, + topicId: $scope.topicId + }); + } else { + $scope.errorMessage = errorMessage; + } + }; + } + ] + }).result.then(function(result) { + var topicVersion = null; + for (var i = 0; i < topicSummaries.length; i++) { + if (topicSummaries[i].id === result.topicId) { + topicVersion = topicSummaries[i].version; + break; + } + } + if (!topicVersion) { + $log.error( + 'Unable to match topic id selected with topic choices.'); + } + $http.post('/suggestionhandler/', { + suggestion_type: 'add_question', + target_type: 'topic', + target_id: result.topicId, + target_version_at_submission: topicVersion, + change: { + cmd: 'create_new_fully_specified_question', + question_dict: result.question.toBackendDict(true), + skill_id: null + }, + description: null + }); + }, function() { + $log.error('Error while submitting question'); + }); + }; + } + ] + }; +}]); diff --git a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.directive.html b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.directive.html new file mode 100644 index 000000000000..b83779ad5b59 --- /dev/null +++ b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.directive.html @@ -0,0 +1,842 @@ + +
+
+ +
+

+

<[$ctrl.dashboardStats.average_ratings || 'N/A']>

+

<[$ctrl.dashboardStats.average_ratings || 'N/A']>

+

+

+ (by <[$ctrl.dashboardStats.num_ratings]> user) +

+

+ (by <[$ctrl.dashboardStats.num_ratings]> users) +

+

+
+
+

+

<[$ctrl.dashboardStats.total_plays]>

+

<[$ctrl.dashboardStats.total_plays]>

+

+ (+<[$ctrl.relativeChangeInTotalPlays]> from last week) +

+
+
+

+

<[$ctrl.dashboardStats.total_open_feedback]>

+

<[$ctrl.dashboardStats.total_open_feedback]>

+
+
+

+

<[$ctrl.subscribersList.length]>

+

<[$ctrl.subscribersList.length]>

+
+
+
+
+
+ +
+
+ +
+ +
+ +
+

+
+ +
+
+ +
+

+ + +
+
+ +
+
+
+ +
+ +

Sort By

+ + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
+

+

+

+

+

+ + +
+ + <[exploration.title || $ctrl.DEFAULT_EMPTY_TITLE]> + + + + <[$ctrl.publishText]> + + + + <[($ctrl.getAverageRating(exploration.ratings) | number:1) || 'N/A']> + + + + <[exploration.num_views]> + + + + <[exploration.num_open_threads]> + + + + <[$ctrl.getLocaleAbbreviatedDatetimeString(exploration.last_updated_msec)]> + +
+
+
+ +
+ + +
+ +

+ <[(exploration.title || $ctrl.DEFAULT_EMPTY_TITLE) | truncate:40]> +

+
+
+
+
+
+
+ + +
+ <[$ctrl.publishText]> +
+
    +
  • + + + + + <[($ctrl.getAverageRating(exploration.ratings) | number:1) || 'N/A']> + + +
  • + +
  • + + + + <[exploration.num_open_threads]> + + + <[exploration.num_open_threads]> + +
  • + +
  • + + + + <[exploration.num_views]> + +
  • + +
  • + + + + <[$ctrl.getLocaleAbbreviatedDatetimeString(exploration.last_updated_msec)]> + +
  • +
  • + + +
  • +
+
+
+
+
+ +
+
+ > + + + + +

Sort By

+ + + +
+
+ + + + +
+ + <[subscriber.subscriber_username| truncate:10]> + +
+
+ Impact + <[subscriber.subscriber_impact || 0]> +
+
+
+
+
+ +
+
+ There are no collections to display. +
+ + +
+ +
+ +
+
+

Suggestions created

+ + +
+
+ +
+

Suggestions to review

+ + +
+
+
+ +
+
+
+ + + + Suggestion: <[$ctrl.activeThread.subject]> +
+
+ +
+
+ + + + +
+
+
+ #<[m.message_id]> + by <[m.author_username]> + (anonymously submitted) +
+ +
+ + + Status changed to '<[$ctrl.getHumanReadableStatus(m.updated_status)]>' + + + Subject changed to '<[m.updated_subject]>' + + +
+ +
+ <[$ctrl.getLocaleAbbreviatedDatetimeString(m.created_on)]> +
+
+ +
+
+
<[m.text]>
+
+ +
+
+
+
+
+
+
+
+
+
+ diff --git a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.mainpage.html b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.mainpage.html index c5670af4fd29..fecb3ff763e9 100644 --- a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.mainpage.html +++ b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.mainpage.html @@ -25,848 +25,7 @@ {% endblock navbar_breadcrumb %} {% block content %} - -
-
- -
-

-

<[dashboardStats.average_ratings || 'N/A']>

-

<[dashboardStats.average_ratings || 'N/A']>

-

-

- (by <[dashboardStats.num_ratings]> user) -

-

- (by <[dashboardStats.num_ratings]> users) -

-

-
-
-

-

<[dashboardStats.total_plays]>

-

<[dashboardStats.total_plays]>

-

- (+<[relativeChangeInTotalPlays]> from last week) -

-
-
-

-

<[dashboardStats.total_open_feedback]>

-

<[dashboardStats.total_open_feedback]>

-
-
-

-

<[subscribersList.length]>

-

<[subscribersList.length]>

-
-
-
-
-
- -
-
- -
- -
- -
-

-
- -
-
- -
-

- - -
-
- -
-
-
- -
- -

Sort By

- - - -
-
- -
- - - - - - - - - - - - - - - - - - - - - -
-

-

-

-

-

- - -
- - <[exploration.title || DEFAULT_EMPTY_TITLE]> - - - - <[publishText]> - - - - <[(getAverageRating(exploration.ratings) | number:1) || 'N/A']> - - - - <[exploration.num_views]> - - - - <[exploration.num_open_threads]> - - - - <[getLocaleAbbreviatedDatetimeString(exploration.last_updated_msec)]> - -
-
-
- -
- - -
- -

- <[(exploration.title || DEFAULT_EMPTY_TITLE) | truncate:40]> -

-
-
-
-
-
-
- - -
- <[publishText]> -
-
    -
  • - - - - - <[(getAverageRating(exploration.ratings) | number:1) || 'N/A']> - - -
  • - -
  • - - - - <[exploration.num_open_threads]> - - - <[exploration.num_open_threads]> - -
  • - -
  • - - - - <[exploration.num_views]> - -
  • - -
  • - - - - <[getLocaleAbbreviatedDatetimeString(exploration.last_updated_msec)]> - -
  • -
  • - - -
  • -
-
-
-
-
- -
-
- > - - - - -

Sort By

- - - -
-
- - - - -
- - <[subscriber.subscriber_username| truncate:10]> - -
-
- Impact - <[subscriber.subscriber_impact || 0]> -
-
-
-
-
- -
-
- There are no collections to display. -
- - -
- -
- -
-
-

Suggestions created

- - -
-
- -
-

Suggestions to review

- - -
-
-
- -
-
-
- - - - Suggestion: <[activeThread.subject]> -
-
- -
-
- - - - -
-
-
- #<[m.message_id]> - by <[m.author_username]> - (anonymously submitted) -
- -
- - - Status changed to '<[getHumanReadableStatus(m.updated_status)]>' - - - Subject changed to '<[m.updated_subject]>' - - -
- -
- <[getLocaleAbbreviatedDatetimeString(m.created_on)]> -
-
- -
-
-
<[m.text]>
-
- -
-
-
-
-
-
-
-
-
-
- + {% endblock %} {% block footer_js %} diff --git a/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.scripts.ts b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.scripts.ts new file mode 100644 index 000000000000..f6c9fa5cff7f --- /dev/null +++ b/core/templates/dev/head/pages/creator-dashboard-page/creator-dashboard-page.scripts.ts @@ -0,0 +1,19 @@ +// Copyright 2014 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for the creator dashboard. + */ + +require('pages/creator-dashboard-page/creator-dashboard-page.controller.ts'); diff --git a/core/templates/dev/head/pages/donate-page/donate-page.controller.ts b/core/templates/dev/head/pages/donate-page/donate-page.controller.ts index 1e208f45e8ed..05dd244b252d 100644 --- a/core/templates/dev/head/pages/donate-page/donate-page.controller.ts +++ b/core/templates/dev/head/pages/donate-page/donate-page.controller.ts @@ -13,41 +13,53 @@ // limitations under the License. /** - * @fileoverview Controllers for the donate page. + * @fileoverview Directive for the donate page. */ -require('pages/OppiaFooterDirective.ts'); - require('domain/utilities/UrlInterpolationService.ts'); require('services/SiteAnalyticsService.ts'); require('services/contextual/WindowDimensionsService.ts'); -oppia.controller('Donate', [ - '$http', '$scope', '$timeout', '$window', 'SiteAnalyticsService', - 'UrlInterpolationService', 'WindowDimensionsService', - function( - $http, $scope, $timeout, $window, SiteAnalyticsService, - UrlInterpolationService, WindowDimensionsService) { - $scope.windowIsNarrow = WindowDimensionsService.isWindowNarrow(); - $scope.donateImgUrl = UrlInterpolationService.getStaticImageUrl( - '/general/opp_donate_text.svg'); +oppia.directive('donatePage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/donate-page/donate-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$timeout', '$window', 'SiteAnalyticsService', + 'UrlInterpolationService', 'WindowDimensionsService', + function( + $http, $timeout, $window, SiteAnalyticsService, + UrlInterpolationService, WindowDimensionsService) { + var ctrl = this; + ctrl.windowIsNarrow = WindowDimensionsService.isWindowNarrow(); + ctrl.donateImgUrl = UrlInterpolationService.getStaticImageUrl( + '/general/opp_donate_text.svg'); - $scope.onDonateThroughAmazon = function() { - SiteAnalyticsService.registerGoToDonationSiteEvent('Amazon'); - $timeout(function() { - $window.location = 'https://smile.amazon.com/ch/81-1740068'; - }, 150); - return false; - }; + ctrl.onDonateThroughAmazon = function() { + SiteAnalyticsService.registerGoToDonationSiteEvent('Amazon'); + $timeout(function() { + $window.location = 'https://smile.amazon.com/ch/81-1740068'; + }, 150); + return false; + }; - $scope.onDonateThroughPayPal = function() { - // Redirection to PayPal will be initiated at the same time as this - // function is run, but should be slow enough to allow this function time - // to complete. It is not possible to do $http.post() in javascript after - // a delay because cross-site POSTing is not permitted in scripts; see - // https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS - // for more information. - SiteAnalyticsService.registerGoToDonationSiteEvent('PayPal'); - }; - } -]); + ctrl.onDonateThroughPayPal = function() { + // Redirection to PayPal will be initiated at the same time as this + // function is run, but should be slow enough to allow this function + // time to complete. It is not possible to do $http.post() in + // javascript after a delay because cross-site POSTing is not + // permitted in scripts; see + // https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CO + // RS + // for more information. + SiteAnalyticsService.registerGoToDonationSiteEvent('PayPal'); + }; + } + ] + }; +}]); diff --git a/core/templates/dev/head/pages/donate-page/donate-page.directive.html b/core/templates/dev/head/pages/donate-page/donate-page.directive.html new file mode 100644 index 000000000000..29f5ddb5ac54 --- /dev/null +++ b/core/templates/dev/head/pages/donate-page/donate-page.directive.html @@ -0,0 +1,130 @@ +
+
+
+
+

Donate to the
+ Oppia Foundation

+
+
+

Donate to
+ The Oppia Foundation

+
+
+
+ + + +
+
+
+
+ + + +
+
+
+ Amazon Smile +
+

+ Your generous gift funds: +

+
+ Server costs, student outreach, marketing +
+
+
+
+ +
+

Hear from our Oppia community

+
+

+ In 2012, Oppia started with a simple idea: to improve the education of + students around the world while improving the quality of teaching. + This vision has since turned into an educational platform with over + 11,000 explorations that have been used by more than 430,000 users + worldwide. +

+

+ Please donate to The Oppia Foundation, a registered 501(c)(3) nonprofit, + and join us in bringing the joys of teaching and learning to people + everywhere. +

+
+
+ +
+
+ diff --git a/core/templates/dev/head/pages/donate-page/donate-page.mainpage.html b/core/templates/dev/head/pages/donate-page/donate-page.mainpage.html index fadfacedbbf0..4e07d814068f 100644 --- a/core/templates/dev/head/pages/donate-page/donate-page.mainpage.html +++ b/core/templates/dev/head/pages/donate-page/donate-page.mainpage.html @@ -18,136 +18,7 @@ {% endblock navbar_breadcrumb %} {% block content %} -
-
-
-
-

Donate to the
- Oppia Foundation

-
-
-

Donate to
- The Oppia Foundation

-
-
-
- - - -
-
-
-
- - - -
-
-
- Amazon Smile -
-

- Your generous gift funds: -

-
- Server costs, student outreach, marketing -
-
-
-
- -
-

Hear from our Oppia community

-
-

- In 2012, Oppia started with a simple idea: to improve the education of - students around the world while improving the quality of teaching. - This vision has since turned into an educational platform with over - 11,000 explorations that have been used by more than 430,000 users - worldwide. -

-

- Please donate to The Oppia Foundation, a registered 501(c)(3) nonprofit, - and join us in bringing the joys of teaching and learning to people - everywhere. -

-
-
- -
-
- + {% endblock %} {% block footer_js %} diff --git a/core/templates/dev/head/pages/donate-page/donate-page.scripts.ts b/core/templates/dev/head/pages/donate-page/donate-page.scripts.ts new file mode 100644 index 000000000000..83fe756d77eb --- /dev/null +++ b/core/templates/dev/head/pages/donate-page/donate-page.scripts.ts @@ -0,0 +1,21 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for the donate page. + */ + +require('pages/OppiaFooterDirective.ts'); + +require('pages/donate-page/donate-page.controller.ts'); diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.controller.ts b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.controller.ts index 2c6245ff3e1c..a2f81e324a87 100644 --- a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.controller.ts +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.controller.ts @@ -19,79 +19,90 @@ require('pages/email-dashboard-pages/email-dashboard-data.service.ts'); require('services/UserService.ts'); -oppia.controller('EmailDashboard', [ - '$rootScope', '$scope', 'EmailDashboardDataService', 'UserService', - function($rootScope, $scope, EmailDashboardDataService, UserService) { - $scope.username = ''; - $rootScope.loadingMessage = 'Loading'; - UserService.getUserInfoAsync().then(function(userInfo) { - $scope.username = userInfo.getUsername(); - $rootScope.loadingMessage = ''; - }); +oppia.directive('emailDashboardPage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/email-dashboard-pages/email-dashboard-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$rootScope', 'EmailDashboardDataService', 'UserService', + function($rootScope, EmailDashboardDataService, UserService) { + var ctrl = this; + ctrl.username = ''; + $rootScope.loadingMessage = 'Loading'; + UserService.getUserInfoAsync().then(function(userInfo) { + ctrl.username = userInfo.getUsername(); + $rootScope.loadingMessage = ''; + }); - $scope.currentPageOfQueries = []; + ctrl.currentPageOfQueries = []; - $scope.resetForm = function() { - $scope.has_not_logged_in_for_n_days = null; - $scope.inactive_in_last_n_days = null; - $scope.created_at_least_n_exps = null; - $scope.created_fewer_than_n_exps = null; - $scope.edited_at_least_n_exps = null; - $scope.edited_fewer_than_n_exps = null; - }; + ctrl.resetForm = function() { + ctrl.has_not_logged_in_for_n_days = null; + ctrl.inactive_in_last_n_days = null; + ctrl.created_at_least_n_exps = null; + ctrl.created_fewer_than_n_exps = null; + ctrl.edited_at_least_n_exps = null; + ctrl.edited_fewer_than_n_exps = null; + }; - $scope.submitQuery = function() { - var data = { - has_not_logged_in_for_n_days: $scope.has_not_logged_in_for_n_days, - inactive_in_last_n_days: $scope.inactive_in_last_n_days, - created_at_least_n_exps: $scope.created_at_least_n_exps, - created_fewer_than_n_exps: $scope.created_fewer_than_n_exps, - edited_at_least_n_exps: $scope.edited_at_least_n_exps, - edited_fewer_than_n_exps: $scope.edited_fewer_than_n_exps - }; - EmailDashboardDataService.submitQuery(data).then(function(queries) { - $scope.currentPageOfQueries = queries; - }); - $scope.resetForm(); - $scope.showSuccessMessage = true; - }; + ctrl.submitQuery = function() { + var data = { + has_not_logged_in_for_n_days: ctrl.has_not_logged_in_for_n_days, + inactive_in_last_n_days: ctrl.inactive_in_last_n_days, + created_at_least_n_exps: ctrl.created_at_least_n_exps, + created_fewer_than_n_exps: ctrl.created_fewer_than_n_exps, + edited_at_least_n_exps: ctrl.edited_at_least_n_exps, + edited_fewer_than_n_exps: ctrl.edited_fewer_than_n_exps + }; + EmailDashboardDataService.submitQuery(data).then(function(queries) { + ctrl.currentPageOfQueries = queries; + }); + ctrl.resetForm(); + ctrl.showSuccessMessage = true; + }; - $scope.getNextPageOfQueries = function() { - if (EmailDashboardDataService.isNextPageAvailable()) { - EmailDashboardDataService.getNextQueries().then(function(queries) { - $scope.currentPageOfQueries = queries; - }); - } - }; + ctrl.getNextPageOfQueries = function() { + if (EmailDashboardDataService.isNextPageAvailable()) { + EmailDashboardDataService.getNextQueries().then(function(queries) { + ctrl.currentPageOfQueries = queries; + }); + } + }; - $scope.getPreviousPageOfQueries = function() { - if (EmailDashboardDataService.isPreviousPageAvailable()) { - $scope.currentPageOfQueries = ( - EmailDashboardDataService.getPreviousQueries()); - } - }; + ctrl.getPreviousPageOfQueries = function() { + if (EmailDashboardDataService.isPreviousPageAvailable()) { + ctrl.currentPageOfQueries = ( + EmailDashboardDataService.getPreviousQueries()); + } + }; - $scope.showNextButton = function() { - return EmailDashboardDataService.isNextPageAvailable(); - }; + ctrl.showNextButton = function() { + return EmailDashboardDataService.isNextPageAvailable(); + }; - $scope.showPreviousButton = function() { - return EmailDashboardDataService.isPreviousPageAvailable(); - }; + ctrl.showPreviousButton = function() { + return EmailDashboardDataService.isPreviousPageAvailable(); + }; - $scope.recheckStatus = function(index) { - var queryId = $scope.currentPageOfQueries[index].id; - EmailDashboardDataService.fetchQuery(queryId).then(function(query) { - $scope.currentPageOfQueries[index] = query; - }); - }; + ctrl.recheckStatus = function(index) { + var queryId = ctrl.currentPageOfQueries[index].id; + EmailDashboardDataService.fetchQuery(queryId).then(function(query) { + ctrl.currentPageOfQueries[index] = query; + }); + }; - $scope.showLinkToResultPage = function(submitter, status) { - return (submitter === $scope.username) && (status === 'completed'); - }; + ctrl.showLinkToResultPage = function(submitter, status) { + return (submitter === ctrl.username) && (status === 'completed'); + }; - EmailDashboardDataService.getNextQueries().then(function(queries) { - $scope.currentPageOfQueries = queries; - }); - } -]); + EmailDashboardDataService.getNextQueries().then(function(queries) { + ctrl.currentPageOfQueries = queries; + }); + } + ]}; +}]); diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.directive.html b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.directive.html new file mode 100644 index 000000000000..5d83d07d5ef2 --- /dev/null +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.directive.html @@ -0,0 +1,50 @@ +
+
+ Has not logged in for n days: +
+ Inactive in last n days: +
+ Has created at least n exps: +
+ Has created fewer than n exps: +
+ Has edited at least n exps: +
+ Has edited fewer than n exps: +
+ + +
+

Query has been submitted successfully. Check recent queries below.

+
+

Recent queries:

+ + + + + + + + + + + + + + + + + + + + + +
Query idSubmitted onSubmitted byStatusNo. of qualified users
<[q.id]><[q.created_on]><[q.submitter_username]><[q.status]><[q.num_qualified_users]> + + + +
+ + +
+
diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.mainpage.html b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.mainpage.html index 1bd89d71d093..d7bd56462a67 100644 --- a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.mainpage.html +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.mainpage.html @@ -26,56 +26,7 @@ {% endblock navbar_breadcrumb %} {% block content %} -
-
- Has not logged in for n days: -
- Inactive in last n days: -
- Has created at least n exps: -
- Has created fewer than n exps: -
- Has edited at least n exps: -
- Has edited fewer than n exps: -
- - -
-

Query has been submitted successfully. Check recent queries below.

-
-

Recent queries:

- - - - - - - - - - - - - - - - - - - - - -
Query idSubmitted onSubmitted byStatusNo. of qualified users
<[q.id]><[q.created_on]><[q.submitter_username]><[q.status]><[q.num_qualified_users]> - - - -
- - -
-
+ {% endblock %} {% block footer %} diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.scripts.ts b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.scripts.ts new file mode 100644 index 000000000000..24afdd87d964 --- /dev/null +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-page.scripts.ts @@ -0,0 +1,19 @@ +// Copyright 2016 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for oppia email dashboard page. + */ + +require('pages/email-dashboard-pages/email-dashboard-page.controller.ts'); diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.controller.ts b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.controller.ts index 2758eb8a1764..f59c638f44b9 100644 --- a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.controller.ts +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.controller.ts @@ -18,132 +18,146 @@ require('domain/utilities/UrlInterpolationService.ts'); -oppia.controller('EmailDashboardResult', [ - '$http', '$scope', '$timeout', '$window', 'UrlInterpolationService', - function($http, $scope, $timeout, $window, UrlInterpolationService) { - var RESULT_HANDLER_URL = '/emaildashboardresult/'; - var CANCEL_EMAIL_HANDLER_URL = '/emaildashboardcancelresult/'; - var EMAIL_DASHBOARD_PAGE = '/emaildashboard'; - var TEST_BULK_EMAIL_URL = '/emaildashboardtestbulkemailhandler/'; +oppia.directive('emailDashboardResultPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/email_dashboard/email_dashboard_result_directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$timeout', '$window', 'UrlInterpolationService', + function($http, $timeout, $window, UrlInterpolationService) { + var ctrl = this; + var RESULT_HANDLER_URL = '/emaildashboardresult/'; + var CANCEL_EMAIL_HANDLER_URL = + '/emaildashboardcancelresult/'; + var EMAIL_DASHBOARD_PAGE = '/emaildashboard'; + var TEST_BULK_EMAIL_URL = + '/emaildashboardtestbulkemailhandler/'; - var getQueryId = function() { - return $window.location.pathname.split('/').slice(-1)[0]; - }; + var getQueryId = function() { + return $window.location.pathname.split('/').slice(-1)[0]; + }; - var validateEmailSubjectAndBody = function() { - var dataIsValid = true; - if ($scope.emailSubject.length === 0) { - $scope.invalid.subject = true; - dataIsValid = false; - } - if ($scope.emailBody.length === 0) { - $scope.invalid.body = true; - dataIsValid = false; - } - return dataIsValid; - }; + var validateEmailSubjectAndBody = function() { + var dataIsValid = true; + if (ctrl.emailSubject.length === 0) { + ctrl.invalid.subject = true; + dataIsValid = false; + } + if (ctrl.emailBody.length === 0) { + ctrl.invalid.body = true; + dataIsValid = false; + } + return dataIsValid; + }; - $scope.submitEmail = function() { - var resultHandlerUrl = UrlInterpolationService.interpolateUrl( - RESULT_HANDLER_URL, { - query_id: getQueryId() - }); - var dataIsValid = validateEmailSubjectAndBody(); + ctrl.submitEmail = function() { + var resultHandlerUrl = UrlInterpolationService.interpolateUrl( + RESULT_HANDLER_URL, { + query_id: getQueryId() + }); + var dataIsValid = validateEmailSubjectAndBody(); - if ($scope.emailOption === 'custom' && - $scope.maxRecipients === null) { - $scope.invalid.maxRecipients = true; - dataIsValid = false; - } + if (ctrl.emailOption === 'custom' && + ctrl.maxRecipients === null) { + ctrl.invalid.maxRecipients = true; + dataIsValid = false; + } - if (dataIsValid) { - $scope.submitIsInProgress = true; - var data = { - email_subject: $scope.emailSubject, - email_body: $scope.emailBody, - email_intent: $scope.emailIntent, - max_recipients: ( - $scope.emailOption !== 'all' ? $scope.max_recipients : null) - }; + if (dataIsValid) { + ctrl.submitIsInProgress = true; + var data = { + email_subject: ctrl.emailSubject, + email_body: ctrl.emailBody, + email_intent: ctrl.emailIntent, + max_recipients: ( + ctrl.emailOption !== 'all' ? ctrl.max_recipients : null) + }; - $http.post(resultHandlerUrl, { - data: data - }).success(function() { - $scope.emailSubmitted = true; - $timeout(function() { - $window.location.href = EMAIL_DASHBOARD_PAGE; - }, 4000); - }).error(function() { - $scope.errorHasOccurred = true; - $scope.submitIsInProgress = false; - }); - $scope.invalid.subject = false; - $scope.invalid.body = false; - $scope.invalid.maxRecipients = false; - } - }; + $http.post(resultHandlerUrl, { + data: data + }).success(function() { + ctrl.emailSubmitted = true; + $timeout(function() { + $window.location.href = EMAIL_DASHBOARD_PAGE; + }, 4000); + }).error(function() { + ctrl.errorHasOccurred = true; + ctrl.submitIsInProgress = false; + }); + ctrl.invalid.subject = false; + ctrl.invalid.body = false; + ctrl.invalid.maxRecipients = false; + } + }; - $scope.resetForm = function() { - $scope.emailSubject = ''; - $scope.emailBody = ''; - $scope.emailOption = 'all'; - }; + ctrl.resetForm = function() { + ctrl.emailSubject = ''; + ctrl.emailBody = ''; + ctrl.emailOption = 'all'; + }; - $scope.cancelEmail = function() { - $scope.submitIsInProgress = true; - var cancelUrlHandler = UrlInterpolationService.interpolateUrl( - CANCEL_EMAIL_HANDLER_URL, { - query_id: getQueryId() - }); + ctrl.cancelEmail = function() { + ctrl.submitIsInProgress = true; + var cancelUrlHandler = UrlInterpolationService.interpolateUrl( + CANCEL_EMAIL_HANDLER_URL, { + query_id: getQueryId() + }); - $http.post(cancelUrlHandler).success(function() { - $scope.emailCancelled = true; - $timeout(function() { - $window.location.href = EMAIL_DASHBOARD_PAGE; - }, 4000); - }).error(function() { - $scope.errorHasOccurred = true; - $scope.submitIsInProgress = false; - }); - }; + $http.post(cancelUrlHandler).success(function() { + ctrl.emailCancelled = true; + $timeout(function() { + $window.location.href = EMAIL_DASHBOARD_PAGE; + }, 4000); + }).error(function() { + ctrl.errorHasOccurred = true; + ctrl.submitIsInProgress = false; + }); + }; - $scope.sendTestEmail = function() { - var testEmailHandlerUrl = UrlInterpolationService.interpolateUrl( - TEST_BULK_EMAIL_URL, { - query_id: getQueryId() - }); - var dataIsValid = validateEmailSubjectAndBody(); + ctrl.sendTestEmail = function() { + var testEmailHandlerUrl = UrlInterpolationService.interpolateUrl( + TEST_BULK_EMAIL_URL, { + query_id: getQueryId() + }); + var dataIsValid = validateEmailSubjectAndBody(); - if (dataIsValid) { - $http.post(testEmailHandlerUrl, { - email_subject: $scope.emailSubject, - email_body: $scope.emailBody - }).success(function() { - $scope.testEmailSentSuccesfully = true; - }); - $scope.invalid.subject = false; - $scope.invalid.body = false; - $scope.invalid.maxRecipients = false; - } - }; + if (dataIsValid) { + $http.post(testEmailHandlerUrl, { + email_subject: ctrl.emailSubject, + email_body: ctrl.emailBody + }).success(function() { + ctrl.testEmailSentSuccesfully = true; + }); + ctrl.invalid.subject = false; + ctrl.invalid.body = false; + ctrl.invalid.maxRecipients = false; + } + }; - $scope.emailOption = 'all'; - $scope.emailSubject = ''; - $scope.emailBody = ''; - $scope.invalid = { - subject: false, - body: false, - maxRecipients: false - }; - $scope.maxRecipients = null; - $scope.POSSIBLE_EMAIL_INTENTS = [ - 'bulk_email_marketing', 'bulk_email_improve_exploration', - 'bulk_email_create_exploration', 'bulk_email_creator_reengagement', - 'bulk_email_learner_reengagement']; - $scope.emailIntent = $scope.POSSIBLE_EMAIL_INTENTS[0]; - $scope.emailSubmitted = false; - $scope.submitIsInProgress = false; - $scope.errorHasOccurred = false; - $scope.testEmailSentSuccesfully = false; - } -]); + ctrl.emailOption = 'all'; + ctrl.emailSubject = ''; + ctrl.emailBody = ''; + ctrl.invalid = { + subject: false, + body: false, + maxRecipients: false + }; + ctrl.maxRecipients = null; + ctrl.POSSIBLE_EMAIL_INTENTS = [ + 'bulk_email_marketing', 'bulk_email_improve_exploration', + 'bulk_email_create_exploration', 'bulk_email_creator_reengagement', + 'bulk_email_learner_reengagement']; + ctrl.emailIntent = ctrl.POSSIBLE_EMAIL_INTENTS[0]; + ctrl.emailSubmitted = false; + ctrl.submitIsInProgress = false; + ctrl.errorHasOccurred = false; + ctrl.testEmailSentSuccesfully = false; + } + ]}; + }]); diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.directive.html b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.directive.html new file mode 100644 index 000000000000..26c90d71345f --- /dev/null +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.directive.html @@ -0,0 +1,46 @@ + +
+

Emails sent successfully. Redirecting to the Email Dashboard...

+

Test email sent successfully. Please check your inbox.

+

Emails cancelled. Redirecting to the Email Dashboard...

+

Please enter a valid email subject

+

Please enter a valid email body

+

Please enter valid number of recipients

+

There was an error processing your request. Please report this bug.

+
+ Email subject: +
+ Email body: +
+ Email intent:

+ Email option: Send to all + Send to max N users: +

+ + + + +
+
diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.mainpage.html b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.mainpage.html index a55b7dcbfc46..86a5335ec5fa 100644 --- a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.mainpage.html +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.mainpage.html @@ -18,52 +18,7 @@ {% endblock navbar_breadcrumb %} {% block content %} - -
-

Emails sent successfully. Redirecting to the Email Dashboard...

-

Test email sent successfully. Please check your inbox.

-

Emails cancelled. Redirecting to the Email Dashboard...

-

Please enter a valid email subject

-

Please enter a valid email body

-

Please enter valid number of recipients

-

There was an error processing your request. Please report this bug.

-
- Email subject: -
- Email body: -
- Email intent:

- Email option: Send to all - Send to max N users: -

- - - - -
-
+ {% endblock %} {% block footer_js %} diff --git a/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.scripts.ts b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.scripts.ts new file mode 100644 index 000000000000..31a56d33d028 --- /dev/null +++ b/core/templates/dev/head/pages/email-dashboard-pages/email-dashboard-result.scripts.ts @@ -0,0 +1,19 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for oppia email dashboard page. + */ + +require('pages/email-dashboard-pages/email-dashboard-result.controller.ts'); diff --git a/core/templates/dev/head/pages/error-pages/error-page.controller.ts b/core/templates/dev/head/pages/error-pages/error-page.controller.ts index e57e774dd3b2..eda6cd0ce442 100644 --- a/core/templates/dev/head/pages/error-pages/error-page.controller.ts +++ b/core/templates/dev/head/pages/error-pages/error-page.controller.ts @@ -16,20 +16,29 @@ * @fileoverview Controllers for the error page. */ -require('pages/OppiaFooterDirective.ts'); - require('domain/utilities/UrlInterpolationService.ts'); require('services/PageTitleService.ts'); -oppia.controller('Error', [ - '$scope', 'PageTitleService', 'UrlInterpolationService', - function( - $scope, PageTitleService, UrlInterpolationService) { - $scope.oopsMintImgUrl = UrlInterpolationService.getStaticImageUrl( - '/general/oops_mint.png'); +oppia.directive('errorPage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/error-pages/error-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + 'PageTitleService', 'UrlInterpolationService', + function( + PageTitleService, UrlInterpolationService) { + var ctrl = this; + ctrl.oopsMintImgUrl = UrlInterpolationService.getStaticImageUrl( + '/general/oops_mint.png'); - $scope.statusCode = GLOBALS.status_code; + ctrl.statusCode = GLOBALS.status_code; - PageTitleService.setPageTitle('Error ' + $scope.statusCode + ' - Oppia'); - } -]); + PageTitleService.setPageTitle('Error ' + ctrl.statusCode + ' - Oppia'); + } + ]}; +}]); diff --git a/core/templates/dev/head/pages/error-pages/error-page.directive.html b/core/templates/dev/head/pages/error-pages/error-page.directive.html new file mode 100644 index 000000000000..d34f46810c91 --- /dev/null +++ b/core/templates/dev/head/pages/error-pages/error-page.directive.html @@ -0,0 +1,52 @@ +
+
+ +
+
+

+
+ + - Bad Request +
+
+ + - Unauthorized +
+
+ + - Page Not Found +
+
+ + - System Error +
+

+ +
+ + Oops! +

+

+

+

+

+

+

+
+
+
+ diff --git a/core/templates/dev/head/pages/error-pages/error-page.mainpage.html b/core/templates/dev/head/pages/error-pages/error-page.mainpage.html index 5da99774b700..0411d675d452 100644 --- a/core/templates/dev/head/pages/error-pages/error-page.mainpage.html +++ b/core/templates/dev/head/pages/error-pages/error-page.mainpage.html @@ -4,58 +4,7 @@ {% endblock navbar_breadcrumb %} {% block content %} -
-
- -
-
-

-
- - - Bad Request -
-
- - - Unauthorized -
-
- - - Page Not Found -
-
- - - System Error -
-

- -
- - Oops! -

-

-

-

-

-

-

-
-
-
- + {% endblock %} {% block footer_js %} diff --git a/core/templates/dev/head/pages/error-pages/error-page.scripts.ts b/core/templates/dev/head/pages/error-pages/error-page.scripts.ts new file mode 100644 index 000000000000..0679f9c91e59 --- /dev/null +++ b/core/templates/dev/head/pages/error-pages/error-page.scripts.ts @@ -0,0 +1,20 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for the error page. + */ + +require('pages/OppiaFooterDirective.ts'); +require('pages/error-pages/error-page.controller.ts'); diff --git a/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.controller.ts b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.controller.ts index 64b3ff873046..2d797f7ecb8e 100644 --- a/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.controller.ts +++ b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.controller.ts @@ -21,114 +21,129 @@ require('services/SiteAnalyticsService.ts'); require('services/contextual/UrlService.ts'); require('services/contextual/WindowDimensionsService.ts'); -oppia.controller('Stewards', [ - '$scope', '$timeout', '$window', 'SiteAnalyticsService', - 'UrlInterpolationService', 'UrlService', 'WindowDimensionsService', - function( - $scope, $timeout, $window, SiteAnalyticsService, - UrlInterpolationService, UrlService, WindowDimensionsService) { - $scope.TAB_NAME_PARENTS = 'Parents'; - $scope.TAB_NAME_TEACHERS = 'Teachers'; - $scope.TAB_NAME_NONPROFITS = 'NGOs'; - $scope.TAB_NAME_VOLUNTEERS = 'Volunteers'; +oppia.directive('stewardsLandingPage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/landing-pages/stewards-landing-page/' + + 'stewards-landing-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$scope', '$timeout', '$window', 'SiteAnalyticsService', + 'UrlInterpolationService', 'UrlService', 'WindowDimensionsService', + function( + $scope, $timeout, $window, SiteAnalyticsService, + UrlInterpolationService, UrlService, WindowDimensionsService) { + var ctrl = this; + ctrl.TAB_NAME_PARENTS = 'Parents'; + ctrl.TAB_NAME_TEACHERS = 'Teachers'; + ctrl.TAB_NAME_NONPROFITS = 'NGOs'; + ctrl.TAB_NAME_VOLUNTEERS = 'Volunteers'; - var URL_PATTERNS_TO_TAB_NAMES = { - '/parents': $scope.TAB_NAME_PARENTS, - '/teachers': $scope.TAB_NAME_TEACHERS, - '/partners': $scope.TAB_NAME_NONPROFITS, - '/nonprofits': $scope.TAB_NAME_NONPROFITS, - '/volunteers': $scope.TAB_NAME_VOLUNTEERS - }; + var URL_PATTERNS_TO_TAB_NAMES = { + '/parents': ctrl.TAB_NAME_PARENTS, + '/teachers': ctrl.TAB_NAME_TEACHERS, + '/partners': ctrl.TAB_NAME_NONPROFITS, + '/nonprofits': ctrl.TAB_NAME_NONPROFITS, + '/volunteers': ctrl.TAB_NAME_VOLUNTEERS + }; - $scope.setActiveTabName = function(newActiveTabName) { - $scope.activeTabName = newActiveTabName; - $scope.buttonDefinitions = getButtonDefinitions(newActiveTabName); - }; + ctrl.setActiveTabName = function(newActiveTabName) { + ctrl.activeTabName = newActiveTabName; + ctrl.buttonDefinitions = getButtonDefinitions(newActiveTabName); + }; - $scope.isActiveTab = function(tabName) { - return $scope.activeTabName === tabName; - }; + ctrl.isActiveTab = function(tabName) { + return ctrl.activeTabName === tabName; + }; - $scope.getActiveTabNameInSingularForm = function() { - if ($scope.activeTabName === $scope.TAB_NAME_PARENTS) { - return 'Parent'; - } else if ($scope.activeTabName === $scope.TAB_NAME_TEACHERS) { - return 'Teacher'; - } else if ($scope.activeTabName === $scope.TAB_NAME_NONPROFITS) { - return 'Nonprofit'; - } else if ($scope.activeTabName === $scope.TAB_NAME_VOLUNTEERS) { - return 'Volunteer'; - } else { - throw Error('Invalid active tab name: ' + $scope.activeTabName); - } - }; + ctrl.getActiveTabNameInSingularForm = function() { + if (ctrl.activeTabName === ctrl.TAB_NAME_PARENTS) { + return 'Parent'; + } else if (ctrl.activeTabName === ctrl.TAB_NAME_TEACHERS) { + return 'Teacher'; + } else if (ctrl.activeTabName === ctrl.TAB_NAME_NONPROFITS) { + return 'Nonprofit'; + } else if (ctrl.activeTabName === ctrl.TAB_NAME_VOLUNTEERS) { + return 'Volunteer'; + } else { + throw Error('Invalid active tab name: ' + ctrl.activeTabName); + } + }; - var getButtonDefinitions = function(tabName) { - if (tabName === $scope.TAB_NAME_PARENTS || - tabName === $scope.TAB_NAME_TEACHERS) { - return [{ - text: 'Browse Lessons', - href: '/library' - }, { - text: 'Subscribe to our Newsletter', - href: 'https://tinyletter.com/oppia' - }]; - } else if (tabName === $scope.TAB_NAME_NONPROFITS) { - return [{ - text: 'Get Involved', - href: 'https://www.oppiafoundation.org/partnerships#get-in-touch' - }, { - text: 'Browse Lessons', - href: '/library' - }]; - } else if (tabName === $scope.TAB_NAME_VOLUNTEERS) { - // TODO(sll): Add "Get in Touch" link that points to contact form. - return [{ - text: 'Browse Volunteer Opportunities', - href: 'https://www.oppiafoundation.org/volunteer' - }]; - } else { - throw Error('Invalid tab name: ' + tabName); - } - }; + var getButtonDefinitions = function(tabName) { + if (tabName === ctrl.TAB_NAME_PARENTS || + tabName === ctrl.TAB_NAME_TEACHERS) { + return [{ + text: 'Browse Lessons', + href: '/library' + }, { + text: 'Subscribe to our Newsletter', + href: 'https://tinyletter.com/oppia' + }]; + } else if (tabName === ctrl.TAB_NAME_NONPROFITS) { + return [{ + text: 'Get Involved', + href: 'https://www.oppiafoundation.org/partnerships#get-in-touch' + }, { + text: 'Browse Lessons', + href: '/library' + }]; + } else if (tabName === ctrl.TAB_NAME_VOLUNTEERS) { + // TODO(sll): Add "Get in Touch" link that points to contact form. + return [{ + text: 'Browse Volunteer Opportunities', + href: 'https://www.oppiafoundation.org/volunteer' + }]; + } else { + throw Error('Invalid tab name: ' + tabName); + } + }; - $scope.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; - $scope.getStaticSubjectImageUrl = function(subjectName) { - return UrlInterpolationService.getStaticImageUrl('/subjects/' + - subjectName + '.svg'); - }; + ctrl.getStaticSubjectImageUrl = function(subjectName) { + return UrlInterpolationService.getStaticImageUrl('/subjects/' + + subjectName + '.svg'); + }; - $scope.onClickButton = function(buttonDefinition) { - SiteAnalyticsService.registerStewardsLandingPageEvent( - $scope.activeTabName, buttonDefinition.text); - $timeout(function() { - $window.location = buttonDefinition.href; - }, 150); - }; + ctrl.onClickButton = function(buttonDefinition) { + SiteAnalyticsService.registerStewardsLandingPageEvent( + ctrl.activeTabName, buttonDefinition.text); + $timeout(function() { + $window.location = buttonDefinition.href; + }, 150); + }; - // Note: This should be kept in sync with the CSS media query on - // stewards-landing-page.mainpage.html. - var isWindowNarrow = function(windowWidthPx) { - return windowWidthPx <= 890; - }; + // Note: This should be kept in sync with the CSS media query on + // stewards-landing-page.mainpage.html. + var isWindowNarrow = function(windowWidthPx) { + return windowWidthPx <= 890; + }; - $scope.windowIsNarrow = isWindowNarrow(WindowDimensionsService.getWidth()); - WindowDimensionsService.registerOnResizeHook(function() { - $scope.windowIsNarrow = isWindowNarrow( - WindowDimensionsService.getWidth()); - $scope.$apply(); - }); + ctrl.windowIsNarrow = isWindowNarrow( + WindowDimensionsService.getWidth()); + WindowDimensionsService.registerOnResizeHook(function() { + ctrl.windowIsNarrow = isWindowNarrow( + WindowDimensionsService.getWidth()); + $scope.$apply(); + }); - // Set the initial tab name based on the URL; default to TAB_NAME_PARENTS. - var initialPathname = UrlService.getPathname(); - $scope.activeTabName = $scope.TAB_NAME_PARENTS; - for (var urlPattern in URL_PATTERNS_TO_TAB_NAMES) { - if (initialPathname.indexOf(urlPattern) === 0) { - $scope.activeTabName = URL_PATTERNS_TO_TAB_NAMES[urlPattern]; - break; + // Set the initial tab name based on the URL; default to + // TAB_NAME_PARENTS. + var initialPathname = UrlService.getPathname(); + ctrl.activeTabName = ctrl.TAB_NAME_PARENTS; + for (var urlPattern in URL_PATTERNS_TO_TAB_NAMES) { + if (initialPathname.indexOf(urlPattern) === 0) { + ctrl.activeTabName = URL_PATTERNS_TO_TAB_NAMES[urlPattern]; + break; + } + } + ctrl.buttonDefinitions = getButtonDefinitions(ctrl.activeTabName); } - } - $scope.buttonDefinitions = getButtonDefinitions($scope.activeTabName); - } -]); + ] + }; +}]); diff --git a/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.directive.html b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.directive.html new file mode 100644 index 000000000000..93b4de90769e --- /dev/null +++ b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.directive.html @@ -0,0 +1,569 @@ +
+
+
+
+
+
+ " class="oppia-stewards-landing-image"> +
+
+
+

Get involved.

+

Support from educators, NGOs and student volunteers makes Oppia possible. Help increase student access to Oppia.

+
+ + + +
+
+
+
+
+
+
+ " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> +
+ +
+ " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> +
+ +
+ " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> + " class="oppia-stewards-landing-background-icon" alt=""> +
+
+
+
+ +
+
+ +
+ + +
+
+ I AM A ... +
+ + +
+
+ +
+

Help your child learn with our free, engaging lessons

+

+ Oppia is a digital library of academic lessons that teaches + students the skills they'll need to succeed in life, both + academically and beyond. +

+ +

+ Our guided and interactive lessons empower your child to learn + independently. Or, if you prefer to work together, our content + allows you to guide their learning even if you aren’t an expert + on a given subject. +

+ +

+ Oppia is 100% free and does not contain advertisements or + monetization. Everything at Oppia is built by a community of + professionals and volunteers who believe that a quality + education is an essential right. We are always testing and + refining our approach to create the best possible learning + experience for your child. +

+ +

+ Browse our lessons to learn more about what Oppia has to offer. + If you want to join our community, offer feedback, or have a say + in how our lessons our built, we would welcome your feedback. + Time to get busy learning! +

+
+ +
+

+ Oppia's free, personalized lessons are a great way to support student learning +

+ +

+ Every student learns in a unique way at their own pace. As a + teacher, even in the best circumstances, it can be difficult to + cater to every student's unique needs. Oppia's engaging, + story-driven lessons are a great tool to support student + learning. +

+ +

+ Oppia's personalized feedback and engaging storytelling can + assist students who require additional help outside of the + classroom. Or, Oppia can be used inside your classroom, + allowing every student to work at their own pace and giving + you the opportunity to provide additional support to those that + need a helping hand. +

+ +

+ Our approach to creating lessons has been tested in controlled + trials and shown to result in significant learning gains. We + have designed our content to be relatable, interesting, and + scaffolded in a way that builds on earlier conceptual + understanding. +

+ +

+ And, best of all, as a volunteer-led non-profit, our lessons + are 100% free to use and contain no + advertising or monetization strategies. +

+ +

+ We welcome you to join our community, support the project by + spreading the message to other educators, request lessons + needed by your students, or create new lessons for others. +

+
+ +
+

+ Let's work together to make compelling educational + content available to everyone +

+

+ Oppia is a rapidly-growing, all volunteer non-profit dedicated + to making engaging educational lessons available to students + from every walk of life. +

+ +

+ Oppia’s free and effective digital library of lessons is being + built with an emphasis on scalability and accessibility. Our + lesson builder allows content creators to provide intelligent, + personalized feedback to students based on their responses. + This means even large groups of students can receive the + attention and support of a private tutor without actually + needing close supervision. Lessons are continuously translated + into new languages and available on low-bandwidth mobile + devices to reach students in underserved communities around the + world. +

+ +

+ In controlled trials, Oppia has been shown to result in + significant learning gains in communities that lack access to + effective learning environments. (Learn about one such study + here.) +

+ +

+ At Oppia, we believe that quality education is a fundamental + right. Our mission is to provide every student the tools they + need to achieve basic literacy and numeracy while developing a + lifelong love for learning. That's why we're building a + complete, no-fuss digital classroom capable of teaching + thousands and thousands of students at once. It’s no small + task, but with the help of partners who share our vision, it's + one we are confident can be achieved. +

+ +

+ We invite you to contact us to learn more about our + organization, inquire about partnerships, or arrange a pilot + study. +

+
+ +
+

+ Help improve access to high-quality education for students + around the world +

+

+ Oppia is a volunteer-led nonprofit, which means that our + mission depends entirely on the efforts of people who want to + make a difference in the lives of underserved students. Our + organization is made up of people from all over the world -- + from the United States to India to Cameroon and many places in + between -- who work together to improve access to quality + educational content. +

+ +

+ Not only is volunteering a great way to make a positive impact + on the world, it is a great opportunity to learn, to advance + your skills, and to work with a dedicated team of fellow + volunteers. Committed volunteers are given leadership roles + within the organization, which is a great way to get experience + in that role. +

+ +

+ All sorts of skillsets are needed to make Oppia grow. Visit our + volunteer page at OppiaFoundation.org to learn more about + joining our team. +

+
+ +
+ + + +
+
+
+
+
+
+ + diff --git a/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.mainpage.html b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.mainpage.html index b56d6e38b7e4..1d65360af7ba 100644 --- a/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.mainpage.html +++ b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.mainpage.html @@ -5,575 +5,7 @@ {% endblock maintitle %} {% block content %} -
-
-
-
-
-
- " class="oppia-stewards-landing-image"> -
-
-
-

Get involved.

-

Support from educators, NGOs and student volunteers makes Oppia possible. Help increase student access to Oppia.

-
- - - -
-
-
-
-
-
-
- " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> -
- -
- " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> -
- -
- " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> - " class="oppia-stewards-landing-background-icon" alt=""> -
-
-
-
- -
-
- -
- - -
-
- I AM A ... -
- - -
-
- -
-

Help your child learn with our free, engaging lessons

-

- Oppia is a digital library of academic lessons that teaches - students the skills they'll need to succeed in life, both - academically and beyond. -

- -

- Our guided and interactive lessons empower your child to learn - independently. Or, if you prefer to work together, our content - allows you to guide their learning even if you aren’t an expert - on a given subject. -

- -

- Oppia is 100% free and does not contain advertisements or - monetization. Everything at Oppia is built by a community of - professionals and volunteers who believe that a quality - education is an essential right. We are always testing and - refining our approach to create the best possible learning - experience for your child. -

- -

- Browse our lessons to learn more about what Oppia has to offer. - If you want to join our community, offer feedback, or have a say - in how our lessons our built, we would welcome your feedback. - Time to get busy learning! -

-
- -
-

- Oppia's free, personalized lessons are a great way to support student learning -

- -

- Every student learns in a unique way at their own pace. As a - teacher, even in the best circumstances, it can be difficult to - cater to every student's unique needs. Oppia's engaging, - story-driven lessons are a great tool to support student - learning. -

- -

- Oppia's personalized feedback and engaging storytelling can - assist students who require additional help outside of the - classroom. Or, Oppia can be used inside your classroom, - allowing every student to work at their own pace and giving - you the opportunity to provide additional support to those that - need a helping hand. -

- -

- Our approach to creating lessons has been tested in controlled - trials and shown to result in significant learning gains. We - have designed our content to be relatable, interesting, and - scaffolded in a way that builds on earlier conceptual - understanding. -

- -

- And, best of all, as a volunteer-led non-profit, our lessons - are 100% free to use and contain no - advertising or monetization strategies. -

- -

- We welcome you to join our community, support the project by - spreading the message to other educators, request lessons - needed by your students, or create new lessons for others. -

-
- -
-

- Let's work together to make compelling educational - content available to everyone -

-

- Oppia is a rapidly-growing, all volunteer non-profit dedicated - to making engaging educational lessons available to students - from every walk of life. -

- -

- Oppia’s free and effective digital library of lessons is being - built with an emphasis on scalability and accessibility. Our - lesson builder allows content creators to provide intelligent, - personalized feedback to students based on their responses. - This means even large groups of students can receive the - attention and support of a private tutor without actually - needing close supervision. Lessons are continuously translated - into new languages and available on low-bandwidth mobile - devices to reach students in underserved communities around the - world. -

- -

- In controlled trials, Oppia has been shown to result in - significant learning gains in communities that lack access to - effective learning environments. (Learn about one such study - here.) -

- -

- At Oppia, we believe that quality education is a fundamental - right. Our mission is to provide every student the tools they - need to achieve basic literacy and numeracy while developing a - lifelong love for learning. That's why we're building a - complete, no-fuss digital classroom capable of teaching - thousands and thousands of students at once. It’s no small - task, but with the help of partners who share our vision, it's - one we are confident can be achieved. -

- -

- We invite you to contact us to learn more about our - organization, inquire about partnerships, or arrange a pilot - study. -

-
- -
-

- Help improve access to high-quality education for students - around the world -

-

- Oppia is a volunteer-led nonprofit, which means that our - mission depends entirely on the efforts of people who want to - make a difference in the lives of underserved students. Our - organization is made up of people from all over the world -- - from the United States to India to Cameroon and many places in - between -- who work together to improve access to quality - educational content. -

- -

- Not only is volunteering a great way to make a positive impact - on the world, it is a great opportunity to learn, to advance - your skills, and to work with a dedicated team of fellow - volunteers. Committed volunteers are given leadership roles - within the organization, which is a great way to get experience - in that role. -

- -

- All sorts of skillsets are needed to make Oppia grow. Visit our - volunteer page at OppiaFoundation.org to learn more about - joining our team. -

-
- -
- - - -
-
-
-
-
-
- - + {% endblock %} {% block footer_js %} diff --git a/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.scripts.ts b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.scripts.ts new file mode 100644 index 000000000000..ca352161ec34 --- /dev/null +++ b/core/templates/dev/head/pages/landing-pages/stewards-landing-page/stewards-landing-page.scripts.ts @@ -0,0 +1,21 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for the stewards landing page. + */ + +require( + 'pages/landing-pages/stewards-landing-page/' + + 'stewards-landing-page.controller.ts'); diff --git a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.controller.ts b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.controller.ts index 1a2a83391a21..c4148eeed619 100644 --- a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.controller.ts +++ b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.controller.ts @@ -29,80 +29,95 @@ require('services/SiteAnalyticsService.ts'); require( 'pages/landing-pages/topic-landing-page/topic-landing-page.constants.ts'); -oppia.controller('TopicLandingPage', [ - '$filter', '$scope', '$timeout', '$window', 'PageTitleService', - 'SiteAnalyticsService', 'UrlInterpolationService', 'TOPIC_LANDING_PAGE_DATA', - function( - $filter, $scope, $timeout, $window, PageTitleService, - SiteAnalyticsService, UrlInterpolationService, TOPIC_LANDING_PAGE_DATA) { - var pathArray = $window.location.pathname.split('/'); - $scope.subject = pathArray[2]; - var topic = pathArray[3]; - var topicData = TOPIC_LANDING_PAGE_DATA[$scope.subject][topic]; - var landingPageData = topicData.page_data; - var assetsPathFormat = '/landing///'; - $scope.topicTitle = topicData.topic_title; - $scope.lessons = landingPageData.lessons; - var pageTitle = 'Learn ' + $scope.topicTitle + ' - Oppia'; - PageTitleService.setPageTitle(pageTitle); - $scope.bookImageUrl = UrlInterpolationService.getStaticImageUrl( - '/splash/books.svg'); +oppia.directive('topicLandingPage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/landing-pages/topic-landing-page/' + + 'topic-landing-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$filter', '$timeout', '$window', 'PageTitleService', + 'SiteAnalyticsService', 'UrlInterpolationService', + 'TOPIC_LANDING_PAGE_DATA', + function( + $filter, $timeout, $window, PageTitleService, + SiteAnalyticsService, UrlInterpolationService, + TOPIC_LANDING_PAGE_DATA) { + var ctrl = this; + var pathArray = $window.location.pathname.split('/'); + ctrl.subject = pathArray[2]; + var topic = pathArray[3]; + var topicData = TOPIC_LANDING_PAGE_DATA[ctrl.subject][topic]; + var landingPageData = topicData.page_data; + var assetsPathFormat = '/landing///'; + ctrl.topicTitle = topicData.topic_title; + ctrl.lessons = landingPageData.lessons; + var pageTitle = 'Learn ' + ctrl.topicTitle + ' - Oppia'; + PageTitleService.setPageTitle(pageTitle); + ctrl.bookImageUrl = UrlInterpolationService.getStaticImageUrl( + '/splash/books.svg'); - var getImageData = function(index) { - var imageKey = 'image_' + index; - if (landingPageData[imageKey]) { - var imagePath = UrlInterpolationService.interpolateUrl( - angular.copy(assetsPathFormat), { - subject: $scope.subject, - topic: topic, - file_name: landingPageData[imageKey].file_name - }); - return { - src: UrlInterpolationService.getStaticImageUrl(imagePath), - alt: landingPageData[imageKey].alt + var getImageData = function(index) { + var imageKey = 'image_' + index; + if (landingPageData[imageKey]) { + var imagePath = UrlInterpolationService.interpolateUrl( + angular.copy(assetsPathFormat), { + subject: ctrl.subject, + topic: topic, + file_name: landingPageData[imageKey].file_name + }); + return { + src: UrlInterpolationService.getStaticImageUrl(imagePath), + alt: landingPageData[imageKey].alt + }; + } }; - } - }; - $scope.image1 = getImageData(1); - $scope.image2 = getImageData(2); + ctrl.image1 = getImageData(1); + ctrl.image2 = getImageData(2); - $scope.getVideoUrl = function() { - if (landingPageData.video) { - var videoPath = UrlInterpolationService.interpolateUrl( - angular.copy(assetsPathFormat), { - subject: $scope.subject, - topic: topic, - file_name: landingPageData.video - }); - return UrlInterpolationService.getStaticVideoUrl(videoPath); - } else { - throw Error('There is no video data available for this landing page.'); - } - }; + ctrl.getVideoUrl = function() { + if (landingPageData.video) { + var videoPath = UrlInterpolationService.interpolateUrl( + angular.copy(assetsPathFormat), { + subject: ctrl.subject, + topic: topic, + file_name: landingPageData.video + }); + return UrlInterpolationService.getStaticVideoUrl(videoPath); + } else { + throw Error( + 'There is no video data available for this landing page.'); + } + }; - $scope.onClickGetStartedButton = function() { - var collectionId = topicData.collection_id; - SiteAnalyticsService.registerOpenCollectionFromLandingPageEvent( - collectionId); - $timeout(function() { - $window.location = UrlInterpolationService.interpolateUrl( - '/collection/', { - collection_id: collectionId - }); - }, 150); - }; + ctrl.onClickGetStartedButton = function() { + var collectionId = topicData.collection_id; + SiteAnalyticsService.registerOpenCollectionFromLandingPageEvent( + collectionId); + $timeout(function() { + $window.location = UrlInterpolationService.interpolateUrl( + '/collection/', { + collection_id: collectionId + }); + }, 150); + }; - $scope.onClickLearnMoreButton = function() { - $timeout(function() { - $window.location = '/splash'; - }, 150); - }; + ctrl.onClickLearnMoreButton = function() { + $timeout(function() { + $window.location = '/splash'; + }, 150); + }; - $scope.onClickExploreLessonsButton = function() { - $timeout(function() { - $window.location = '/library'; - }, 150); - }; - } -]); + ctrl.onClickExploreLessonsButton = function() { + $timeout(function() { + $window.location = '/library'; + }, 150); + }; + } + ]}; +}]); diff --git a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.directive.html b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.directive.html new file mode 100644 index 000000000000..6a8d352ad955 --- /dev/null +++ b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.directive.html @@ -0,0 +1,308 @@ +
+
+
+
+ +
+
+ <[$ctrl.image1.alt]> +
+
+
+

<[$ctrl.topicTitle]> just got easier

+

Get your students and kids started with our free, effective <[$ctrl.subject]> lessons.

+
+ + +
+
+
+
+
+ +
+
+
+
+
+ <[$ctrl.image2.alt]> +
+
+
+

Fun storytelling for all

+

Students are guided through explorations with targeted feedback and immersive storytelling. +
+
+ Oppia guides students step-by-step with helpful hints, so they can complete the lessons on their own. +

+
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+

Easy-to-follow lessons

+

By working through lessons on Oppia, your young learners can apply their knowledge to real-world problems. +
+
+ Our lessons also have audio subtitles, to support students with reading difficulties. +

+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+

Topics covered in this lesson

+
+

<[lessonTitle]>

+

... and more!

+
+
+
+
+
+
+ +
+
+
+ +
+
+

Imagine what your students could learn today!

+
+
+
+
+ +
+
+
+
+

+ To see high quality lessons on subjects other than <[$ctrl.topicTitle]>, visit our Library. +

+
+
+
+
+ +
+
+
+
+ +
+
+ + diff --git a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.mainpage.html b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.mainpage.html index 20e8fa0ef832..cd719d2374a4 100644 --- a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.mainpage.html +++ b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.mainpage.html @@ -1,314 +1,7 @@ {% extends 'dist/base.html' %} {% block content %} -
-
-
-
- -
-
- <[image1.alt]> -
-
-
-

<[topicTitle]> just got easier

-

Get your students and kids started with our free, effective <[subject]> lessons.

-
- - -
-
-
-
-
- -
-
-
-
-
- <[image2.alt]> -
-
-
-

Fun storytelling for all

-

Students are guided through explorations with targeted feedback and immersive storytelling. -
-
- Oppia guides students step-by-step with helpful hints, so they can complete the lessons on their own. -

-
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-

Easy-to-follow lessons

-

By working through lessons on Oppia, your young learners can apply their knowledge to real-world problems. -
-
- Our lessons also have audio subtitles, to support students with reading difficulties. -

-
-
-
-
-
- -
-
-
-
-
- -
-
-
-

Topics covered in this lesson

-
-

<[lessonTitle]>

-

... and more!

-
-
-
-
-
-
- -
-
-
- -
-
-

Imagine what your students could learn today!

-
-
-
-
- -
-
-
-
-

- To see high quality lessons on subjects other than <[topicTitle]>, visit our Library. -

-
-
-
-
- -
-
-
-
- -
-
- - + {% endblock %} {% block footer_js %} diff --git a/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.scripts.ts b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.scripts.ts new file mode 100644 index 000000000000..90fb618addec --- /dev/null +++ b/core/templates/dev/head/pages/landing-pages/topic-landing-page/topic-landing-page.scripts.ts @@ -0,0 +1,20 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for landing page. + */ + +require( + 'pages/landing-pages/topic-landing-page/topic-landing-page.controller.ts'); diff --git a/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.controller.ts b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.controller.ts index 5f718aa23fd0..d6a85c8becc0 100644 --- a/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.controller.ts +++ b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.controller.ts @@ -42,520 +42,551 @@ require('services/UserService.ts'); require('pages/learner-dashboard-page/learner-dashboard-page.constants.ts'); -oppia.controller('LearnerDashboard', [ - '$scope', '$rootScope', '$q', '$window', '$http', '$uibModal', - 'AlertsService', 'EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS', - 'SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS', 'FATAL_ERROR_CODES', - 'LearnerDashboardBackendApiService', 'UrlInterpolationService', - 'LEARNER_DASHBOARD_SECTION_I18N_IDS', - 'LEARNER_DASHBOARD_SUBSECTION_I18N_IDS', 'ThreadStatusDisplayService', - 'DateTimeFormatService', 'FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS', - 'FeedbackThreadSummaryObjectFactory', 'FeedbackMessageSummaryObjectFactory', - 'SuggestionModalForLearnerDashboardService', 'UserService', - function( - $scope, $rootScope, $q, $window, $http, $uibModal, - AlertsService, EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS, - SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS, FATAL_ERROR_CODES, - LearnerDashboardBackendApiService, UrlInterpolationService, - LEARNER_DASHBOARD_SECTION_I18N_IDS, - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS, ThreadStatusDisplayService, - DateTimeFormatService, FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS, - FeedbackThreadSummaryObjectFactory, FeedbackMessageSummaryObjectFactory, - SuggestionModalForLearnerDashboardService, UserService) { - $scope.EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS = ( - EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS); - $scope.SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS = ( - SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS); - $scope.FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS = ( - FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS); - $scope.LEARNER_DASHBOARD_SECTION_I18N_IDS = ( - LEARNER_DASHBOARD_SECTION_I18N_IDS); - $scope.LEARNER_DASHBOARD_SUBSECTION_I18N_IDS = ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS); - $scope.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; - $scope.PAGE_SIZE = 8; - $scope.Math = window.Math; - UserService.getProfileImageDataUrlAsync().then(function(dataUrl) { - $scope.profilePictureDataUrl = dataUrl; - }); - - $rootScope.loadingMessage = 'Loading'; - $scope.username = ''; - var userInfoPromise = UserService.getUserInfoAsync(); - userInfoPromise.then(function(userInfo) { - $scope.username = userInfo.getUsername(); - }); - - var dashboardDataPromise = ( - LearnerDashboardBackendApiService.fetchLearnerDashboardData()); - dashboardDataPromise.then( - function(response) { - var responseData = response.data; - $scope.isCurrentExpSortDescending = true; - $scope.isCurrentSubscriptionSortDescending = true; - $scope.isCurrentFeedbackSortDescending = true; - $scope.currentExpSortType = ( - EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS.LAST_PLAYED.key); - $scope.currentSubscribersSortType = ( - SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS.USERNAME.key); - $scope.currentFeedbackThreadsSortType = ( - FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS.LAST_UPDATED.key); - $scope.startIncompleteExpIndex = 0; - $scope.startCompletedExpIndex = 0; - $scope.startIncompleteCollectionIndex = 0; - $scope.startCompletedCollectionIndex = 0; - $scope.completedExplorationsList = ( - responseData.completed_explorations_list - ); - $scope.completedCollectionsList = ( - responseData.completed_collections_list - ); - $scope.incompleteExplorationsList = ( - responseData.incomplete_explorations_list - ); - $scope.incompleteCollectionsList = ( - responseData.incomplete_collections_list - ); - $scope.subscriptionsList = ( - responseData.subscription_list - ); - $scope.numberNonexistentIncompleteExplorations = ( - responseData.number_of_nonexistent_activities.incomplete_explorations - ); - $scope.numberNonexistentIncompleteCollections = ( - responseData.number_of_nonexistent_activities.incomplete_collections - ); - $scope.numberNonexistentCompletedExplorations = ( - responseData.number_of_nonexistent_activities.completed_explorations - ); - $scope.numberNonexistentCompletedCollections = ( - responseData.number_of_nonexistent_activities.completed_collections - ); - $scope.numberNonexistentExplorationsFromPlaylist = ( - responseData.number_of_nonexistent_activities.exploration_playlist - ); - $scope.numberNonexistentCollectionsFromPlaylist = ( - responseData.number_of_nonexistent_activities.collection_playlist - ); - $scope.completedToIncompleteCollections = ( - responseData.completed_to_incomplete_collections - ); - var threadSummaryDicts = responseData.thread_summaries; - $scope.threadSummaries = []; - for (var index = 0; index < threadSummaryDicts.length; index++) { - $scope.threadSummaries.push( - FeedbackThreadSummaryObjectFactory.createFromBackendDict( - threadSummaryDicts[index])); - } - $scope.numberOfUnreadThreads = responseData.number_of_unread_threads; - $scope.explorationPlaylist = responseData.exploration_playlist; - $scope.collectionPlaylist = responseData.collection_playlist; - $scope.activeSection = LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE; - $scope.activeSubsection = ( - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS); - $scope.feedbackThreadActive = false; - - $scope.noExplorationActivity = ( - ($scope.completedExplorationsList.length === 0) && - ($scope.incompleteExplorationsList.length === 0)); - $scope.noCollectionActivity = ( - ($scope.completedCollectionsList.length === 0) && - ($scope.incompleteCollectionsList.length === 0)); - $scope.noActivity = ( - ($scope.noExplorationActivity) && ($scope.noCollectionActivity) && - ($scope.explorationPlaylist.length === 0) && - ($scope.collectionPlaylist.length === 0)); - }, - function(errorResponse) { - if (FATAL_ERROR_CODES.indexOf(errorResponse.status) !== -1) { - AlertsService.addWarning('Failed to get learner dashboard data'); - } - } - ); - - $q.all([userInfoPromise, dashboardDataPromise]).then(function() { - $rootScope.loadingMessage = ''; - }); - - $scope.loadingFeedbacks = false; - var threadIndex = null; - - $scope.newMessage = { - text: '' - }; - - $scope.getLabelClass = ThreadStatusDisplayService.getLabelClass; - $scope.getHumanReadableStatus = ( - ThreadStatusDisplayService.getHumanReadableStatus); - $scope.getLocaleAbbreviatedDatetimeString = ( - DateTimeFormatService.getLocaleAbbreviatedDatetimeString); - - $scope.setActiveSection = function(newActiveSectionName) { - $scope.activeSection = newActiveSectionName; - if ($scope.activeSection === - LEARNER_DASHBOARD_SECTION_I18N_IDS.FEEDBACK && - $scope.feedbackThreadActive === true) { - $scope.feedbackThreadActive = false; - } - }; - - $scope.setActiveSubsection = function(newActiveSubsectionName) { - $scope.activeSubsection = newActiveSubsectionName; - }; - - $scope.getExplorationUrl = function(explorationId) { - return '/explore/' + explorationId; - }; - - $scope.getCollectionUrl = function(collectionId) { - return '/collection/' + collectionId; - }; - - $scope.checkMobileView = function() { - return ($window.innerWidth < 500); - }; - - $scope.getVisibleExplorationList = function(startCompletedExpIndex) { - return $scope.completedExplorationsList.slice( - startCompletedExpIndex, Math.min( - startCompletedExpIndex + $scope.PAGE_SIZE, - $scope.completedExplorationsList.length)); - }; - - $scope.showUsernamePopover = function(subscriberUsername) { - // The popover on the subscription card is only shown if the length of - // the subscriber username is greater than 10 and the user hovers over - // the truncated username. - if (subscriberUsername.length > 10) { - return 'mouseenter'; - } else { - return 'none'; - } - }; - - $scope.goToPreviousPage = function(section, subsection) { - if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { - if (subsection === LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { - $scope.startIncompleteExpIndex = Math.max( - $scope.startIncompleteExpIndex - $scope.PAGE_SIZE, 0); - } else if ( - subsection === LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { - $scope.startIncompleteCollectionIndex = Math.max( - $scope.startIncompleteCollectionIndex - $scope.PAGE_SIZE, 0); - } - } else if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.COMPLETED) { - if (subsection === LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { - $scope.startCompletedExpIndex = Math.max( - $scope.startCompletedExpIndex - $scope.PAGE_SIZE, 0); - } else if ( - subsection === LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { - $scope.startCompletedCollectionIndex = Math.max( - $scope.startCompletedCollectionIndex - $scope.PAGE_SIZE, 0); - } - } - }; - - $scope.goToNextPage = function(section, subsection) { - if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { - if (subsection === LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { - if ($scope.startIncompleteExpIndex + - $scope.PAGE_SIZE <= $scope.incompleteExplorationsList.length) { - $scope.startIncompleteExpIndex += $scope.PAGE_SIZE; - } - } else if ( - subsection === LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { - if ($scope.startIncompleteCollectionIndex + - $scope.PAGE_SIZE <= $scope.startIncompleteCollectionIndex.length) { - $scope.startIncompleteCollectionIndex += $scope.PAGE_SIZE; - } - } - } else if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.COMPLETED) { - if (subsection === LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { - if ($scope.startCompletedExpIndex + - $scope.PAGE_SIZE <= $scope.completedExplorationsList.length) { - $scope.startCompletedExpIndex += $scope.PAGE_SIZE; - } - } else if ( - subsection === LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { - if ($scope.startCompletedCollectionIndex + - $scope.PAGE_SIZE <= $scope.startCompletedCollectionIndex.length) { - $scope.startCompletedCollectionIndex += $scope.PAGE_SIZE; - } - } - } - }; +oppia.directive('learnerDashboardPage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/learner-dashboard-page/learner-dashboard-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$scope', '$rootScope', '$q', '$window', '$http', '$uibModal', + 'AlertsService', 'EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS', + 'SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS', 'FATAL_ERROR_CODES', + 'LearnerDashboardBackendApiService', 'UrlInterpolationService', + 'LEARNER_DASHBOARD_SECTION_I18N_IDS', + 'LEARNER_DASHBOARD_SUBSECTION_I18N_IDS', 'ThreadStatusDisplayService', + 'DateTimeFormatService', 'FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS', + 'FeedbackThreadSummaryObjectFactory', + 'FeedbackMessageSummaryObjectFactory', + 'SuggestionModalForLearnerDashboardService', 'UserService', + function( + $scope, $rootScope, $q, $window, $http, $uibModal, + AlertsService, EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS, + SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS, FATAL_ERROR_CODES, + LearnerDashboardBackendApiService, UrlInterpolationService, + LEARNER_DASHBOARD_SECTION_I18N_IDS, + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS, ThreadStatusDisplayService, + DateTimeFormatService, FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS, + FeedbackThreadSummaryObjectFactory, + FeedbackMessageSummaryObjectFactory, + SuggestionModalForLearnerDashboardService, UserService) { + var ctrl = this; + ctrl.EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS = ( + EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS); + ctrl.SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS = ( + SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS); + ctrl.FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS = ( + FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS); + ctrl.LEARNER_DASHBOARD_SECTION_I18N_IDS = ( + LEARNER_DASHBOARD_SECTION_I18N_IDS); + ctrl.LEARNER_DASHBOARD_SUBSECTION_I18N_IDS = ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS); + ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + ctrl.PAGE_SIZE = 8; + ctrl.Math = window.Math; + UserService.getProfileImageDataUrlAsync().then(function(dataUrl) { + ctrl.profilePictureDataUrl = dataUrl; + }); - $scope.setExplorationsSortingOptions = function(sortType) { - if (sortType === $scope.currentExpSortType) { - $scope.isCurrentExpSortDescending = !$scope.isCurrentExpSortDescending; - } else { - $scope.currentExpSortType = sortType; - } - }; - - $scope.setSubscriptionSortingOptions = function(sortType) { - if (sortType === $scope.currentSubscriptionSortType) { - $scope.isCurrentSubscriptionSortDescending = ( - !$scope.isCurrentSubscriptionSortDescending); - } else { - $scope.currentSubscriptionSortType = sortType; - } - }; - - $scope.setFeedbackSortingOptions = function(sortType) { - if (sortType === $scope.currentFeedbackThreadsSortType) { - $scope.isCurrentFeedbackSortDescending = ( - !$scope.isCurrentFeedbackSortDescending); - } else { - $scope.currentFeedbackThreadsSortType = sortType; - } - }; - - $scope.getValueOfExplorationSortKey = function(exploration) { - // This function is passed as a custom comparator function to `orderBy`, - // so that special cases can be handled while sorting explorations. - if ($scope.currentExpSortType === - EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS.LAST_PLAYED.key) { - return null; - } else { - return exploration[$scope.currentExpSortType]; - } - }; - - $scope.getValueOfSubscriptionSortKey = function(subscription) { - // This function is passed as a custom comparator function to `orderBy`, - // so that special cases can be handled while sorting subscriptions. - var value = subscription[$scope.currentSubscribersSortType]; - if ($scope.currentSubscribersSortType === - SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS.IMPACT.key) { - value = (value || 0); - } - return value; - }; - - $scope.sortFeedbackThreadsFunction = function(feedbackThread) { - return feedbackThread[$scope.currentFeedbackThreadsSortType]; - }; - - var getPlaylistSortableOptions = function(activityType) { - return { - 'ui-floating': 'auto', - start: function(e, ui) { - ui.placeholder.height(ui.item.height()); - $scope.$apply(); - }, - sort: function(e, ui) { - /* eslint-disable quote-props */ - // Making top : 0px to avoid irregular change in position. - ui.helper.css( - {'top': '0 px'}); - /* eslint-enable quote-props */ - }, - update: function(e, ui) { - var insertExpInLearnerPlaylistUrl = ( - UrlInterpolationService.interpolateUrl( - '/learnerplaylistactivityhandler//', { - activityType: activityType, - activityId: ( - $scope.explorationPlaylist[ui.item.sortable.index].id) - })); - - $http.post(insertExpInLearnerPlaylistUrl, { - index: ui.item.sortable.dropindex - }); - $scope.$apply(); - }, - stop: function(e, ui) { - $scope.$apply(); - }, - axis: 'y' - }; - }; - - $scope.collectionPlaylistSortableOptions = getPlaylistSortableOptions( - constants.ACTIVITY_TYPE_COLLECTION); - $scope.explorationPlaylistSortableOptions = getPlaylistSortableOptions( - constants.ACTIVITY_TYPE_EXPLORATION); - - $scope.onClickThread = function( - threadStatus, explorationId, threadId, explorationTitle) { - $scope.loadingFeedbacks = true; - var threadDataUrl = UrlInterpolationService.interpolateUrl( - '/learnerdashboardthreadhandler/', { - threadId: threadId + $rootScope.loadingMessage = 'Loading'; + ctrl.username = ''; + var userInfoPromise = UserService.getUserInfoAsync(); + userInfoPromise.then(function(userInfo) { + ctrl.username = userInfo.getUsername(); }); - $scope.explorationTitle = explorationTitle; - $scope.feedbackThreadActive = true; - $scope.threadStatus = threadStatus; - $scope.explorationId = explorationId; - $scope.threadId = threadId; - - for (var index = 0; index < $scope.threadSummaries.length; index++) { - if ($scope.threadSummaries[index].threadId === threadId) { - threadIndex = index; - var threadSummary = $scope.threadSummaries[index]; - threadSummary.markTheLastTwoMessagesAsRead(); - if (!threadSummary.lastMessageRead) { - $scope.numberOfUnreadThreads -= 1; + + var dashboardDataPromise = ( + LearnerDashboardBackendApiService.fetchLearnerDashboardData()); + dashboardDataPromise.then( + function(response) { + var responseData = response.data; + ctrl.isCurrentExpSortDescending = true; + ctrl.isCurrentSubscriptionSortDescending = true; + ctrl.isCurrentFeedbackSortDescending = true; + ctrl.currentExpSortType = ( + EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS.LAST_PLAYED.key); + ctrl.currentSubscribersSortType = ( + SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS.USERNAME.key); + ctrl.currentFeedbackThreadsSortType = ( + FEEDBACK_THREADS_SORT_BY_KEYS_AND_I18N_IDS.LAST_UPDATED.key); + ctrl.startIncompleteExpIndex = 0; + ctrl.startCompletedExpIndex = 0; + ctrl.startIncompleteCollectionIndex = 0; + ctrl.startCompletedCollectionIndex = 0; + ctrl.completedExplorationsList = ( + responseData.completed_explorations_list + ); + ctrl.completedCollectionsList = ( + responseData.completed_collections_list + ); + ctrl.incompleteExplorationsList = ( + responseData.incomplete_explorations_list + ); + ctrl.incompleteCollectionsList = ( + responseData.incomplete_collections_list + ); + ctrl.subscriptionsList = ( + responseData.subscription_list + ); + ctrl.numberNonexistentIncompleteExplorations = ( + responseData.number_of_nonexistent_activities + .incomplete_explorations + ); + ctrl.numberNonexistentIncompleteCollections = ( + responseData.number_of_nonexistent_activities + .incomplete_collections + ); + ctrl.numberNonexistentCompletedExplorations = ( + responseData.number_of_nonexistent_activities + .completed_explorations + ); + ctrl.numberNonexistentCompletedCollections = ( + responseData.number_of_nonexistent_activities + .completed_collections + ); + ctrl.numberNonexistentExplorationsFromPlaylist = ( + responseData.number_of_nonexistent_activities.exploration_playlist + ); + ctrl.numberNonexistentCollectionsFromPlaylist = ( + responseData.number_of_nonexistent_activities.collection_playlist + ); + ctrl.completedToIncompleteCollections = ( + responseData.completed_to_incomplete_collections + ); + var threadSummaryDicts = responseData.thread_summaries; + ctrl.threadSummaries = []; + for (var index = 0; index < threadSummaryDicts.length; index++) { + ctrl.threadSummaries.push( + FeedbackThreadSummaryObjectFactory.createFromBackendDict( + threadSummaryDicts[index])); + } + ctrl.numberOfUnreadThreads = responseData.number_of_unread_threads; + ctrl.explorationPlaylist = responseData.exploration_playlist; + ctrl.collectionPlaylist = responseData.collection_playlist; + ctrl.activeSection = LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE; + ctrl.activeSubsection = ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS); + ctrl.feedbackThreadActive = false; + + ctrl.noExplorationActivity = ( + (ctrl.completedExplorationsList.length === 0) && + (ctrl.incompleteExplorationsList.length === 0)); + ctrl.noCollectionActivity = ( + (ctrl.completedCollectionsList.length === 0) && + (ctrl.incompleteCollectionsList.length === 0)); + ctrl.noActivity = ( + (ctrl.noExplorationActivity) && (ctrl.noCollectionActivity) && + (ctrl.explorationPlaylist.length === 0) && + (ctrl.collectionPlaylist.length === 0)); + }, + function(errorResponse) { + if (FATAL_ERROR_CODES.indexOf(errorResponse.status) !== -1) { + AlertsService.addWarning('Failed to get learner dashboard data'); + } } - } - } + ); - $http.get(threadDataUrl).then(function(response) { - var messageSummaryDicts = response.data.message_summary_list; - $scope.messageSummaries = []; - for (index = 0; index < messageSummaryDicts.length; index++) { - $scope.messageSummaries.push( - FeedbackMessageSummaryObjectFactory.createFromBackendDict( - messageSummaryDicts[index])); - } - $scope.loadingFeedbacks = false; - }); - }; - - $scope.showAllThreads = function() { - $scope.feedbackThreadActive = false; - threadIndex = null; - }; - - $scope.addNewMessage = function(threadId, newMessage) { - var url = UrlInterpolationService.interpolateUrl( - '/threadhandler/', { - threadId: threadId + $q.all([userInfoPromise, dashboardDataPromise]).then(function() { + $rootScope.loadingMessage = ''; }); - var payload = { - updated_status: null, - updated_subject: null, - text: newMessage - }; - $scope.messageSendingInProgress = true; - $http.post(url, payload).success(function() { - $scope.threadSummary = $scope.threadSummaries[threadIndex]; - $scope.threadSummary.appendNewMessage( - newMessage, $scope.username); - $scope.messageSendingInProgress = false; - $scope.newMessage.text = null; - var newMessageSummary = ( - FeedbackMessageSummaryObjectFactory.createNewMessage( - $scope.threadSummary.totalMessageCount, newMessage, $scope.username, - $scope.profilePictureDataUrl)); - $scope.messageSummaries.push(newMessageSummary); - }); - }; - - $scope.showSuggestionModal = function(newContent, oldContent, description) { - SuggestionModalForLearnerDashboardService.showSuggestionModal( - 'edit_exploration_state_content', - { - newContent: newContent, - oldContent: oldContent, - description: description - } - ); - }; - - $scope.openRemoveActivityModal = function( - sectionNameI18nId, subsectionName, activity) { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/learner-dashboard-page/modal-templates/' + - 'remove-activity-from-learner-dashboard-modal.template.html'), - backdrop: true, - resolve: { - sectionNameI18nId: function() { - return sectionNameI18nId; - }, - subsectionName: function() { - return subsectionName; - }, - activity: function() { - return activity; + + ctrl.loadingFeedbacks = false; + var threadIndex = null; + + ctrl.newMessage = { + text: '' + }; + + ctrl.getLabelClass = ThreadStatusDisplayService.getLabelClass; + ctrl.getHumanReadableStatus = ( + ThreadStatusDisplayService.getHumanReadableStatus); + ctrl.getLocaleAbbreviatedDatetimeString = ( + DateTimeFormatService.getLocaleAbbreviatedDatetimeString); + + ctrl.setActiveSection = function(newActiveSectionName) { + ctrl.activeSection = newActiveSectionName; + if (ctrl.activeSection === + LEARNER_DASHBOARD_SECTION_I18N_IDS.FEEDBACK && + ctrl.feedbackThreadActive === true) { + ctrl.feedbackThreadActive = false; } - }, - controller: [ - '$scope', '$uibModalInstance', '$http', 'sectionNameI18nId', - 'subsectionName', - function( - $scope, $uibModalInstance, $http, sectionNameI18nId, - subsectionName) { - $scope.sectionNameI18nId = sectionNameI18nId; - $scope.subsectionName = subsectionName; - $scope.activityTitle = activity.title; - $scope.remove = function() { - var activityType = ''; - if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { - activityType = constants.ACTIVITY_TYPE_EXPLORATION; - } else if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { - activityType = constants.ACTIVITY_TYPE_COLLECTION; - } else { - throw new Error('Subsection name is not valid.'); + }; + + ctrl.setActiveSubsection = function(newActiveSubsectionName) { + ctrl.activeSubsection = newActiveSubsectionName; + }; + + ctrl.getExplorationUrl = function(explorationId) { + return '/explore/' + explorationId; + }; + + ctrl.getCollectionUrl = function(collectionId) { + return '/collection/' + collectionId; + }; + + ctrl.checkMobileView = function() { + return ($window.innerWidth < 500); + }; + + ctrl.getVisibleExplorationList = function(startCompletedExpIndex) { + return ctrl.completedExplorationsList.slice( + startCompletedExpIndex, Math.min( + startCompletedExpIndex + ctrl.PAGE_SIZE, + ctrl.completedExplorationsList.length)); + }; + + ctrl.showUsernamePopover = function(subscriberUsername) { + // The popover on the subscription card is only shown if the length of + // the subscriber username is greater than 10 and the user hovers over + // the truncated username. + if (subscriberUsername.length > 10) { + return 'mouseenter'; + } else { + return 'none'; + } + }; + + ctrl.goToPreviousPage = function(section, subsection) { + if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { + if (subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { + ctrl.startIncompleteExpIndex = Math.max( + ctrl.startIncompleteExpIndex - ctrl.PAGE_SIZE, 0); + } else if ( + subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { + ctrl.startIncompleteCollectionIndex = Math.max( + ctrl.startIncompleteCollectionIndex - ctrl.PAGE_SIZE, 0); + } + } else if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.COMPLETED) { + if (subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { + ctrl.startCompletedExpIndex = Math.max( + ctrl.startCompletedExpIndex - ctrl.PAGE_SIZE, 0); + } else if ( + subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { + ctrl.startCompletedCollectionIndex = Math.max( + ctrl.startCompletedCollectionIndex - ctrl.PAGE_SIZE, 0); + } + } + }; + + ctrl.goToNextPage = function(section, subsection) { + if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { + if (subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { + if (ctrl.startIncompleteExpIndex + + ctrl.PAGE_SIZE <= ctrl.incompleteExplorationsList.length) { + ctrl.startIncompleteExpIndex += ctrl.PAGE_SIZE; } - - var removeActivityUrlPrefix = ''; - if (sectionNameI18nId === - LEARNER_DASHBOARD_SECTION_I18N_IDS.PLAYLIST) { - removeActivityUrlPrefix = '/learnerplaylistactivityhandler/'; - } else if (sectionNameI18nId === - LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { - removeActivityUrlPrefix = '/learnerincompleteactivityhandler/'; - } else { - throw new Error('Section name is not valid.'); + } else if ( + subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { + if (ctrl.startIncompleteCollectionIndex + + ctrl.PAGE_SIZE <= ctrl.startIncompleteCollectionIndex.length) { + ctrl.startIncompleteCollectionIndex += ctrl.PAGE_SIZE; + } + } + } else if (section === LEARNER_DASHBOARD_SECTION_I18N_IDS.COMPLETED) { + if (subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS)) { + if (ctrl.startCompletedExpIndex + + ctrl.PAGE_SIZE <= ctrl.completedExplorationsList.length) { + ctrl.startCompletedExpIndex += ctrl.PAGE_SIZE; } + } else if ( + subsection === ( + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS)) { + if (ctrl.startCompletedCollectionIndex + + ctrl.PAGE_SIZE <= ctrl.startCompletedCollectionIndex.length) { + ctrl.startCompletedCollectionIndex += ctrl.PAGE_SIZE; + } + } + } + }; - var removeActivityUrl = ( + ctrl.setExplorationsSortingOptions = function(sortType) { + if (sortType === ctrl.currentExpSortType) { + ctrl.isCurrentExpSortDescending = !ctrl.isCurrentExpSortDescending; + } else { + ctrl.currentExpSortType = sortType; + } + }; + + ctrl.setSubscriptionSortingOptions = function(sortType) { + if (sortType === ctrl.currentSubscriptionSortType) { + ctrl.isCurrentSubscriptionSortDescending = ( + !ctrl.isCurrentSubscriptionSortDescending); + } else { + ctrl.currentSubscriptionSortType = sortType; + } + }; + + ctrl.setFeedbackSortingOptions = function(sortType) { + if (sortType === ctrl.currentFeedbackThreadsSortType) { + ctrl.isCurrentFeedbackSortDescending = ( + !ctrl.isCurrentFeedbackSortDescending); + } else { + ctrl.currentFeedbackThreadsSortType = sortType; + } + }; + + ctrl.getValueOfExplorationSortKey = function(exploration) { + // This function is passed as a custom comparator function to + // `orderBy`, so that special cases can be handled while sorting + // explorations. + if (ctrl.currentExpSortType === + EXPLORATIONS_SORT_BY_KEYS_AND_I18N_IDS.LAST_PLAYED.key) { + return null; + } else { + return exploration[ctrl.currentExpSortType]; + } + }; + + ctrl.getValueOfSubscriptionSortKey = function(subscription) { + // This function is passed as a custom comparator function to + // `orderBy`, so that special cases can be handled while sorting + // subscriptions. + var value = subscription[ctrl.currentSubscribersSortType]; + if (ctrl.currentSubscribersSortType === + SUBSCRIPTION_SORT_BY_KEYS_AND_I18N_IDS.IMPACT.key) { + value = (value || 0); + } + return value; + }; + + ctrl.sortFeedbackThreadsFunction = function(feedbackThread) { + return feedbackThread[ctrl.currentFeedbackThreadsSortType]; + }; + + var getPlaylistSortableOptions = function(activityType) { + return { + 'ui-floating': 'auto', + start: function(e, ui) { + ui.placeholder.height(ui.item.height()); + $scope.$apply(); + }, + sort: function(e, ui) { + /* eslint-disable quote-props */ + // Making top : 0px to avoid irregular change in position. + ui.helper.css( + {'top': '0 px'}); + /* eslint-enable quote-props */ + }, + update: function(e, ui) { + var insertExpInLearnerPlaylistUrl = ( UrlInterpolationService.interpolateUrl( - removeActivityUrlPrefix + '/', { + ('/learnerplaylistactivityhandler//' + + ''), { activityType: activityType, - activityId: activity.id + activityId: ( + ctrl.explorationPlaylist[ui.item.sortable.index].id) })); - $http['delete'](removeActivityUrl); - $uibModalInstance.close(); - }; - - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); - }; - } - ] - }).result.then(function() { - if (sectionNameI18nId === - LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { - if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { - var index = $scope.incompleteExplorationsList.indexOf(activity); - if (index !== -1) { - $scope.incompleteExplorationsList.splice(index, 1); - } - } else if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { - var index = $scope.incompleteCollectionsList.indexOf(activity); - if (index !== -1) { - $scope.incompleteCollectionsList.splice(index, 1); + $http.post(insertExpInLearnerPlaylistUrl, { + index: ui.item.sortable.dropindex + }); + $scope.$apply(); + }, + stop: function(e, ui) { + $scope.$apply(); + }, + axis: 'y' + }; + }; + + ctrl.collectionPlaylistSortableOptions = getPlaylistSortableOptions( + constants.ACTIVITY_TYPE_COLLECTION); + ctrl.explorationPlaylistSortableOptions = getPlaylistSortableOptions( + constants.ACTIVITY_TYPE_EXPLORATION); + + ctrl.onClickThread = function( + threadStatus, explorationId, threadId, explorationTitle) { + ctrl.loadingFeedbacks = true; + var threadDataUrl = UrlInterpolationService.interpolateUrl( + '/learnerdashboardthreadhandler/', { + threadId: threadId + }); + ctrl.explorationTitle = explorationTitle; + ctrl.feedbackThreadActive = true; + ctrl.threadStatus = threadStatus; + ctrl.explorationId = explorationId; + ctrl.threadId = threadId; + + for (var index = 0; index < ctrl.threadSummaries.length; index++) { + if (ctrl.threadSummaries[index].threadId === threadId) { + threadIndex = index; + var threadSummary = ctrl.threadSummaries[index]; + threadSummary.markTheLastTwoMessagesAsRead(); + if (!threadSummary.lastMessageRead) { + ctrl.numberOfUnreadThreads -= 1; + } } } - } else if (sectionNameI18nId === - LEARNER_DASHBOARD_SECTION_I18N_IDS.PLAYLIST) { - if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { - var index = $scope.explorationPlaylist.indexOf(activity); - if (index !== -1) { - $scope.explorationPlaylist.splice(index, 1); + + $http.get(threadDataUrl).then(function(response) { + var messageSummaryDicts = response.data.message_summary_list; + ctrl.messageSummaries = []; + for (index = 0; index < messageSummaryDicts.length; index++) { + ctrl.messageSummaries.push( + FeedbackMessageSummaryObjectFactory.createFromBackendDict( + messageSummaryDicts[index])); } - } else if (subsectionName === - LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { - var index = $scope.collectionPlaylist.indexOf(activity); - if (index !== -1) { - $scope.collectionPlaylist.splice(index, 1); + ctrl.loadingFeedbacks = false; + }); + }; + + ctrl.showAllThreads = function() { + ctrl.feedbackThreadActive = false; + threadIndex = null; + }; + + ctrl.addNewMessage = function(threadId, newMessage) { + var url = UrlInterpolationService.interpolateUrl( + '/threadhandler/', { + threadId: threadId + }); + var payload = { + updated_status: null, + updated_subject: null, + text: newMessage + }; + ctrl.messageSendingInProgress = true; + $http.post(url, payload).success(function() { + ctrl.threadSummary = ctrl.threadSummaries[threadIndex]; + ctrl.threadSummary.appendNewMessage( + newMessage, ctrl.username); + ctrl.messageSendingInProgress = false; + ctrl.newMessage.text = null; + var newMessageSummary = ( + FeedbackMessageSummaryObjectFactory.createNewMessage( + ctrl.threadSummary.totalMessageCount, newMessage, ctrl.username, + ctrl.profilePictureDataUrl)); + ctrl.messageSummaries.push(newMessageSummary); + }); + }; + + ctrl.showSuggestionModal = function( + newContent, oldContent, description) { + SuggestionModalForLearnerDashboardService.showSuggestionModal( + 'edit_exploration_state_content', + { + newContent: newContent, + oldContent: oldContent, + description: description } - } - } - }); - }; - } -]).animation('.menu-sub-section', function() { + ); + }; + + ctrl.openRemoveActivityModal = function( + sectionNameI18nId, subsectionName, activity) { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/learner-dashboard-page/modal-templates/' + + 'remove-activity-from-learner-dashboard-modal.template.html'), + backdrop: true, + resolve: { + sectionNameI18nId: function() { + return sectionNameI18nId; + }, + subsectionName: function() { + return subsectionName; + }, + activity: function() { + return activity; + } + }, + controller: [ + '$scope', '$uibModalInstance', '$http', 'sectionNameI18nId', + 'subsectionName', + function( + $scope, $uibModalInstance, $http, sectionNameI18nId, + subsectionName) { + $scope.sectionNameI18nId = sectionNameI18nId; + $scope.subsectionName = subsectionName; + $scope.activityTitle = activity.title; + $scope.remove = function() { + var activityType = ''; + if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { + activityType = constants.ACTIVITY_TYPE_EXPLORATION; + } else if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { + activityType = constants.ACTIVITY_TYPE_COLLECTION; + } else { + throw new Error('Subsection name is not valid.'); + } + + var removeActivityUrlPrefix = ''; + if (sectionNameI18nId === + LEARNER_DASHBOARD_SECTION_I18N_IDS.PLAYLIST) { + removeActivityUrlPrefix = + '/learnerplaylistactivityhandler/'; + } else if (sectionNameI18nId === + LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { + removeActivityUrlPrefix = + '/learnerincompleteactivityhandler/'; + } else { + throw new Error('Section name is not valid.'); + } + + var removeActivityUrl = ( + UrlInterpolationService.interpolateUrl( + removeActivityUrlPrefix + '/', { + activityType: activityType, + activityId: activity.id + })); + + $http['delete'](removeActivityUrl); + $uibModalInstance.close(); + }; + + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + }; + } + ] + }).result.then(function() { + if (sectionNameI18nId === + LEARNER_DASHBOARD_SECTION_I18N_IDS.INCOMPLETE) { + if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { + var index = ctrl.incompleteExplorationsList.indexOf(activity); + if (index !== -1) { + ctrl.incompleteExplorationsList.splice(index, 1); + } + } else if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { + var index = ctrl.incompleteCollectionsList.indexOf(activity); + if (index !== -1) { + ctrl.incompleteCollectionsList.splice(index, 1); + } + } + } else if (sectionNameI18nId === + LEARNER_DASHBOARD_SECTION_I18N_IDS.PLAYLIST) { + if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.EXPLORATIONS) { + var index = ctrl.explorationPlaylist.indexOf(activity); + if (index !== -1) { + ctrl.explorationPlaylist.splice(index, 1); + } + } else if (subsectionName === + LEARNER_DASHBOARD_SUBSECTION_I18N_IDS.COLLECTIONS) { + var index = ctrl.collectionPlaylist.indexOf(activity); + if (index !== -1) { + ctrl.collectionPlaylist.splice(index, 1); + } + } + } + }); + }; + } + ]}; +}]).animation('.menu-sub-section', function() { var NG_HIDE_CLASS = 'ng-hide'; return { beforeAddClass: function(element, className, done) { diff --git a/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.directive.html b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.directive.html new file mode 100644 index 000000000000..2c0bfa0c7ee8 --- /dev/null +++ b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.directive.html @@ -0,0 +1,1160 @@ + +
+
+

+

+
+ +
+ +
+

Completed Explorations

+

<[$ctrl.completedExplorationsList.length]>

+
+
+

Completed Collections

+

<[$ctrl.completedCollectionsList.length]>

+
+
+

Subscriptions

+

<[$ctrl.subscriptionsList.length]>

+
+
+
+ +
+
+
+ " + ng-class="{'oppia-learner-dashboard-mascot-mobile': $ctrl.checkMobileView()}" + class="oppia-learner-dashboard-mascot"> +
+ +
+
+

+

+

+

+ + +
+
+ +
+ +
+
+ +
+
+ +

+ + +

+ +

+ + +

+ +

+ + +

+ +

+ +

+

+ + (<[$ctrl.numberOfUnreadThreads]>) +

+
+
+ +
+
+ + + + + + + info + + + + + +

Sort By

+ + + +
+ + +

Sort By

+ + + +
+ + +

Sort By

+ + + +
+
+
+
+ + + + ☹ + + + +
+

+

+ + + +
+
+ +
+ + + +
+ +
+  + + Showing <[$ctrl.startIncompleteExpIndex + 1]> - <[$ctrl.Math.min($ctrl.startIncompleteExpIndex + $ctrl.PAGE_SIZE, $ctrl.incompleteExplorationsList.length)]> of <[$ctrl.incompleteExplorationsList.length]> + +
+
+ +
+ + + + ☹ + + + +
+

+ + + +
+
+ +
+ + +
+ +
+  + + Showing <[$ctrl.startCompletedExpIndex + 1]> - <[$ctrl.Math.min($ctrl.startCompletedExpIndex + $ctrl.PAGE_SIZE, $ctrl.completedExplorationsList.length)]> of <[$ctrl.completedExplorationsList.length]> + +
+
+ +
+ + + + + + + ☹ + + + +
+

+ + + +
+
+ +
+
+ + + +
+
+ +
+ +
+ + + + ☹ + + + +
+

+

+ + + +
+
+ +
+ + + +
+ +
+  + + Showing <[$ctrl.startIncompleteCollectionIndex + 1]> - <[$ctrl.Math.min($ctrl.startIncompleteCollectionIndex + $ctrl.PAGE_SIZE, $ctrl.incompleteCollectionsList.length)]> of <[$ctrl.incompleteCollectionsList.length]> + +
+
+ +
+ + + + + + + ☹ + + + +
+

+ + + +
+
+ +
+
+ + + +
+
+
+ +
+ + + + +
    +
  • <[title]>
  • +
+
+
+ + + + + ☹ + + + +
+

+ + + +
+
+ +
+ + +
+ +
+  + + Showing <[$ctrl.startCompletedCollectionIndex + 1]> - <[$ctrl.Math.min($ctrl.startCompletedCollectionIndex + $ctrl.PAGE_SIZE, $ctrl.completedCollectionsList.length)]> of <[$ctrl.completedCollectionsList.length]> + +
+
+ + + +
+ +
+

+ + + +
+
+ + + + + + + + +
+ <[$ctrl.getHumanReadableStatus(thread.status)]> + + + + <[thread.authorSecondLastMessage | truncate:7]>, + + <[thread.authorSecondLastMessage | truncate:7]>, + + + + + , + + + + + <[thread.authorLastMessage | truncate:7]> + + <[thread.authorLastMessage | truncate:7]> + + + + + + + + <[thread.explorationTitle]> - + <[thread.explorationTitle]> - + + <[thread.explorationTitle]> - + + + <[thread.explorationTitle]> - + + <[thread.lastMessageText | truncate:50]> + + + + + + + <[$ctrl.getLocaleAbbreviatedDatetimeString(thread.lastUpdated)]> +
+ + + + + + + + + + + + + + + +
+ + <[$ctrl.explorationTitle]> +
+ + Loading + + +
+
+
+ + + + + + + + +
+
+ <[$ctrl.getLocaleAbbreviatedDatetimeString(message.createdOn)]> +
+
+ +
+ + +
+
+
+ + +
+ +
+ +
+
+
+
+ +
+
+
+ +
+ +
+
+
+ diff --git a/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.mainpage.html b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.mainpage.html index 53b940b25943..df746094b3a1 100644 --- a/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.mainpage.html +++ b/core/templates/dev/head/pages/learner-dashboard-page/learner-dashboard-page.mainpage.html @@ -14,1166 +14,7 @@ {% endblock navbar_breadcrumb %} {% block content %} - -
-
-

-

-
- -
- -
-

Completed Explorations

-

<[completedExplorationsList.length]>

-
-
-

Completed Collections

-

<[completedCollectionsList.length]>

-
-
-

Subscriptions

-

<[subscriptionsList.length]>

-
-
-
- -
-
-
- " - ng-class="{'oppia-learner-dashboard-mascot-mobile': checkMobileView()}" - class="oppia-learner-dashboard-mascot"> -
- -
-
-

-

-

-

- - -
-
- -
- -
-
- -
-
- -

- - -

- -

- - -

- -

- - -

- -

- -

-

- - (<[numberOfUnreadThreads]>) -

-
-
- -
-
- - - - - - - info - - - - - -

Sort By

- - - -
- - -

Sort By

- - - -
- - -

Sort By

- - - -
-
-
-
- - - - ☹ - - - -
-

-

- - - -
-
- -
- - - -
- -
-  - - Showing <[startIncompleteExpIndex + 1]> - <[Math.min(startIncompleteExpIndex + PAGE_SIZE, incompleteExplorationsList.length)]> of <[incompleteExplorationsList.length]> - -
-
- -
- - - - ☹ - - - -
-

- - - -
-
- -
- - -
- -
-  - - Showing <[startCompletedExpIndex + 1]> - <[Math.min(startCompletedExpIndex + PAGE_SIZE, completedExplorationsList.length)]> of <[completedExplorationsList.length]> - -
-
- -
- - - - - - - ☹ - - - -
-

- - - -
-
- -
-
- - - -
-
- -
- -
- - - - ☹ - - - -
-

-

- - - -
-
- -
- - - -
- -
-  - - Showing <[startIncompleteCollectionIndex + 1]> - <[Math.min(startIncompleteCollectionIndex + PAGE_SIZE, incompleteCollectionsList.length)]> of <[incompleteCollectionsList.length]> - -
-
- -
- - - - - - - ☹ - - - -
-

- - - -
-
- -
-
- - - -
-
-
- -
- - - - -
    -
  • <[title]>
  • -
-
-
- - - - - ☹ - - - -
-

- - - -
-
- -
- - -
- -
-  - - Showing <[startCompletedCollectionIndex + 1]> - <[Math.min(startCompletedCollectionIndex + PAGE_SIZE, completedCollectionsList.length)]> of <[completedCollectionsList.length]> - -
-
- - - -
- -
-

- - - -
-
- - - - - - - - -
- <[getHumanReadableStatus(thread.status)]> - - - - <[thread.authorSecondLastMessage | truncate:7]>, - - <[thread.authorSecondLastMessage | truncate:7]>, - - - - - , - - - - - <[thread.authorLastMessage | truncate:7]> - - <[thread.authorLastMessage | truncate:7]> - - - - - - - - <[thread.explorationTitle]> - - <[thread.explorationTitle]> - - - <[thread.explorationTitle]> - - - - <[thread.explorationTitle]> - - - <[thread.lastMessageText | truncate:50]> - - - - - - - <[getLocaleAbbreviatedDatetimeString(thread.lastUpdated)]> -
- - - - - - - - - - - - - - - -
- - <[explorationTitle]> -
- - Loading - - -
-
-
- - - - - - - - -
-
- <[getLocaleAbbreviatedDatetimeString(message.createdOn)]> -
-
- -
- - -
-
-
- - -
- -
- -
-
-
-
- -
-
-
- -
- -
-
-
- + {% endblock %} {% block footer_js %} diff --git a/core/templates/dev/head/pages/moderator-page/moderator-page.controller.ts b/core/templates/dev/head/pages/moderator-page/moderator-page.controller.ts index 58b780bba895..1c763b4d738a 100644 --- a/core/templates/dev/head/pages/moderator-page/moderator-page.controller.ts +++ b/core/templates/dev/head/pages/moderator-page/moderator-page.controller.ts @@ -51,98 +51,111 @@ require( require('services/AlertsService.ts'); require('services/DateTimeFormatService.ts'); -oppia.controller('Moderator', [ - '$http', '$rootScope', '$scope', 'AlertsService', 'DateTimeFormatService', - function($http, $rootScope, $scope, AlertsService, DateTimeFormatService) { - $rootScope.loadingMessage = 'Loading'; - $scope.getDatetimeAsString = function(millisSinceEpoch) { - return DateTimeFormatService.getLocaleAbbreviatedDatetimeString( - millisSinceEpoch); - }; +oppia.directive('moderatorPage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/moderator-page/moderator-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$rootScope', 'AlertsService', 'DateTimeFormatService', + function($http, $rootScope, AlertsService, DateTimeFormatService) { + var ctrl = this; + $rootScope.loadingMessage = 'Loading'; + ctrl.getDatetimeAsString = function(millisSinceEpoch) { + return DateTimeFormatService.getLocaleAbbreviatedDatetimeString( + millisSinceEpoch); + }; - $scope.getExplorationCreateUrl = function(explorationId) { - return '/create/' + explorationId; - }; + ctrl.getExplorationCreateUrl = function(explorationId) { + return '/create/' + explorationId; + }; - $scope.getActivityCreateUrl = function(reference) { - return ( - (reference.type === 'exploration' ? '/create' : '/create_collection') + - '/' + reference.id); - }; + ctrl.getActivityCreateUrl = function(reference) { + return ( + (reference.type === ( + 'exploration' ? '/create' : '/create_collection')) + + '/' + reference.id); + }; - $scope.allCommits = []; - $scope.allFeedbackMessages = []; - // Map of exploration ids to objects containing a single key: title. - $scope.explorationData = {}; + ctrl.allCommits = []; + ctrl.allFeedbackMessages = []; + // Map of exploration ids to objects containing a single key: title. + ctrl.explorationData = {}; - $scope.displayedFeaturedActivityReferences = []; - $scope.lastSavedFeaturedActivityReferences = []; - $scope.FEATURED_ACTIVITY_REFERENCES_SCHEMA = { - type: 'list', - items: { - type: 'dict', - properties: [{ - name: 'type', - schema: { - type: 'unicode', - choices: ['exploration', 'collection'] + ctrl.displayedFeaturedActivityReferences = []; + ctrl.lastSavedFeaturedActivityReferences = []; + ctrl.FEATURED_ACTIVITY_REFERENCES_SCHEMA = { + type: 'list', + items: { + type: 'dict', + properties: [{ + name: 'type', + schema: { + type: 'unicode', + choices: ['exploration', 'collection'] + } + }, { + name: 'id', + schema: { + type: 'unicode' + } + }] } - }, { - name: 'id', - schema: { - type: 'unicode' - } - }] - } - }; + }; - var RECENT_COMMITS_URL = ( - '/recentcommitshandler/recent_commits' + - '?query_type=all_non_private_commits'); - // TODO(sll): Update this to also support collections. - $http.get(RECENT_COMMITS_URL).then(function(response) { - // Update the explorationData object with information about newly- - // discovered explorations. - var data = response.data; - var explorationIdsToExplorationData = data.exp_ids_to_exp_data; - for (var expId in explorationIdsToExplorationData) { - if (!$scope.explorationData.hasOwnProperty(expId)) { - $scope.explorationData[expId] = ( - explorationIdsToExplorationData[expId]); - } - } - $scope.allCommits = data.results; - $rootScope.loadingMessage = ''; - }); + var RECENT_COMMITS_URL = ( + '/recentcommitshandler/recent_commits' + + '?query_type=all_non_private_commits'); + // TODO(sll): Update this to also support collections. + $http.get(RECENT_COMMITS_URL).then(function(response) { + // Update the explorationData object with information about newly- + // discovered explorations. + var data = response.data; + var explorationIdsToExplorationData = data.exp_ids_to_exp_data; + for (var expId in explorationIdsToExplorationData) { + if (!ctrl.explorationData.hasOwnProperty(expId)) { + ctrl.explorationData[expId] = ( + explorationIdsToExplorationData[expId]); + } + } + ctrl.allCommits = data.results; + $rootScope.loadingMessage = ''; + }); - $http.get('/recent_feedback_messages').then(function(response) { - $scope.allFeedbackMessages = response.data.results; - }); + $http.get('/recent_feedback_messages').then(function(response) { + ctrl.allFeedbackMessages = response.data.results; + }); - $http.get('/moderatorhandler/featured').then(function(response) { - $scope.displayedFeaturedActivityReferences = ( - response.data.featured_activity_references); - $scope.lastSavedFeaturedActivityReferences = angular.copy( - $scope.displayedFeaturedActivityReferences); - }); + $http.get('/moderatorhandler/featured').then(function(response) { + ctrl.displayedFeaturedActivityReferences = ( + response.data.featured_activity_references); + ctrl.lastSavedFeaturedActivityReferences = angular.copy( + ctrl.displayedFeaturedActivityReferences); + }); - $scope.isSaveFeaturedActivitiesButtonDisabled = function() { - return angular.equals( - $scope.displayedFeaturedActivityReferences, - $scope.lastSavedFeaturedActivityReferences); - }; + ctrl.isSaveFeaturedActivitiesButtonDisabled = function() { + return angular.equals( + ctrl.displayedFeaturedActivityReferences, + ctrl.lastSavedFeaturedActivityReferences); + }; - $scope.saveFeaturedActivityReferences = function() { - AlertsService.clearWarnings(); + ctrl.saveFeaturedActivityReferences = function() { + AlertsService.clearWarnings(); - var activityReferencesToSave = angular.copy( - $scope.displayedFeaturedActivityReferences); - $http.post('/moderatorhandler/featured', { - featured_activity_reference_dicts: activityReferencesToSave - }).then(function() { - $scope.lastSavedFeaturedActivityReferences = activityReferencesToSave; - AlertsService.addSuccessMessage('Featured activities saved.'); - }); - }; - } -]); + var activityReferencesToSave = angular.copy( + ctrl.displayedFeaturedActivityReferences); + $http.post('/moderatorhandler/featured', { + featured_activity_reference_dicts: activityReferencesToSave + }).then(function() { + ctrl.lastSavedFeaturedActivityReferences = activityReferencesToSave; + AlertsService.addSuccessMessage('Featured activities saved.'); + }); + }; + } + ] + }; +}]); diff --git a/core/templates/dev/head/pages/moderator-page/moderator-page.directive.html b/core/templates/dev/head/pages/moderator-page/moderator-page.directive.html new file mode 100644 index 000000000000..bc93741a7bed --- /dev/null +++ b/core/templates/dev/head/pages/moderator-page/moderator-page.directive.html @@ -0,0 +1,88 @@ +
+
+
+ + +

Recent Commits (all non-private explorations)

+
+ + + + + + + + + + + + + + + + + +
TimestampExplorationCategoryUsernameCommit messageCommunity-owned?
<[$ctrl.getDatetimeAsString(commit.last_updated)]> + + <[$ctrl.explorationData[commit.exploration_id].title]> + + + <[$ctrl.explorationData[commit.exploration_id].category]> + <[commit.username]><[commit.commit_message]><[commit.post_commit_community_owned]>
+
+
+ + +

Recent Feedback Messages

+ (Note that some of these links may be to private explorations, and thus result in authorization errors.) +
+
+
+ + + + + + + + + + + +
TimestampExploration IDUsername
<[$ctrl.getDatetimeAsString(message.created_on)]> + + <[message.exploration_id]> + + <[message.author_username]>
+
+
+ + +

Activities to feature in the library

+
+
+ + + +
+
+ + +
+
+
+
+ diff --git a/core/templates/dev/head/pages/moderator-page/moderator-page.mainpage.html b/core/templates/dev/head/pages/moderator-page/moderator-page.mainpage.html index 25f916a99bc6..d15e5ae9b862 100644 --- a/core/templates/dev/head/pages/moderator-page/moderator-page.mainpage.html +++ b/core/templates/dev/head/pages/moderator-page/moderator-page.mainpage.html @@ -14,94 +14,7 @@ {% endblock navbar_breadcrumb %} {% block content %} -
-
-
- - -

Recent Commits (all non-private explorations)

-
- - - - - - - - - - - - - - - - - -
TimestampExplorationCategoryUsernameCommit messageCommunity-owned?
<[getDatetimeAsString(commit.last_updated)]> - - <[explorationData[commit.exploration_id].title]> - - - <[explorationData[commit.exploration_id].category]> - <[commit.username]><[commit.commit_message]><[commit.post_commit_community_owned]>
-
-
- - -

Recent Feedback Messages

- (Note that some of these links may be to private explorations, and thus result in authorization errors.) -
-
-
- - - - - - - - - - - -
TimestampExploration IDUsername
<[getDatetimeAsString(message.created_on)]> - - <[message.exploration_id]> - - <[message.author_username]>
-
-
- - -

Activities to feature in the library

-
-
- - - -
-
- - -
-
-
-
- + {% endblock %} {% block footer_js %} diff --git a/core/templates/dev/head/pages/moderator-page/moderator-page.scripts.ts b/core/templates/dev/head/pages/moderator-page/moderator-page.scripts.ts new file mode 100644 index 000000000000..867b3e8f14de --- /dev/null +++ b/core/templates/dev/head/pages/moderator-page/moderator-page.scripts.ts @@ -0,0 +1,19 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Scripts for the Oppia moderator page. + */ + +require('pages/moderator-page/moderator-page.controller.ts'); diff --git a/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.controller.ts b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.controller.ts index ca04d5c7465f..8d93da1df8e3 100644 --- a/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.controller.ts +++ b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.controller.ts @@ -18,33 +18,48 @@ require('services/DateTimeFormatService.ts'); -oppia.controller('NotificationsDashboard', [ - '$http', '$rootScope', '$scope', 'DateTimeFormatService', - function($http, $rootScope, $scope, DateTimeFormatService) { - $scope.getItemUrl = function(activityId, notificationType) { - return ( - '/create/' + activityId + ( - notificationType === 'feedback_thread' ? '#/feedback' : '')); - }; +oppia.directive('notificationsDashboardPage', [ + 'UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/notifications-dashboard-page/' + + 'notifications-dashboard-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$rootScope', 'DateTimeFormatService', + function($http, $rootScope, DateTimeFormatService) { + var ctrl = this; + ctrl.getItemUrl = function(activityId, notificationType) { + return ( + '/create/' + activityId + ( + notificationType === 'feedback_thread' ? '#/feedback' : '')); + }; - $scope.navigateToProfile = function($event, username) { - $event.stopPropagation(); - window.location.href = '/profile/' + username; - }; + ctrl.navigateToProfile = function($event, username) { + $event.stopPropagation(); + window.location.href = '/profile/' + username; + }; - $scope.getLocaleAbbreviatedDatetimeString = function(millisSinceEpoch) { - return DateTimeFormatService.getLocaleAbbreviatedDatetimeString( - millisSinceEpoch); - }; + ctrl.getLocaleAbbreviatedDatetimeString = function(millisSinceEpoch) { + return DateTimeFormatService.getLocaleAbbreviatedDatetimeString( + millisSinceEpoch); + }; - $rootScope.loadingMessage = 'Loading'; - $http.get('/notificationsdashboardhandler/data').then(function(response) { - var data = response.data; - $scope.recentNotifications = data.recent_notifications; - $scope.jobQueuedMsec = data.job_queued_msec; - $scope.lastSeenMsec = data.last_seen_msec || 0.0; - $scope.currentUsername = data.username; - $rootScope.loadingMessage = ''; - }); - } -]); + $rootScope.loadingMessage = 'Loading'; + $http.get('/notificationsdashboardhandler/data').then(function( + response) { + var data = response.data; + ctrl.recentNotifications = data.recent_notifications; + ctrl.jobQueuedMsec = data.job_queued_msec; + ctrl.lastSeenMsec = data.last_seen_msec || 0.0; + ctrl.currentUsername = data.username; + $rootScope.loadingMessage = ''; + }); + } + ] + }; + }]); diff --git a/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.directive.html b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.directive.html new file mode 100644 index 000000000000..3b97f13eac42 --- /dev/null +++ b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.directive.html @@ -0,0 +1,94 @@ + + diff --git a/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.mainpage.html b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.mainpage.html index aca44d970aea..9950b511ec6d 100644 --- a/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.mainpage.html +++ b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.mainpage.html @@ -14,100 +14,7 @@ {% endblock navbar_breadcrumb %} {% block content %} - - + {% endblock %} {% block footer_js %} diff --git a/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.scripts.ts b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.scripts.ts new file mode 100644 index 000000000000..ed7548ac8c21 --- /dev/null +++ b/core/templates/dev/head/pages/notifications-dashboard-page/notifications-dashboard-page.scripts.ts @@ -0,0 +1,21 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for the user's notifications dashboard. + */ + +require( + 'pages/notifications-dashboard-page/' + + 'notifications-dashboard-page.controller.ts'); diff --git a/core/templates/dev/head/pages/practice-session-page/practice-session-page.controller.ts b/core/templates/dev/head/pages/practice-session-page/practice-session-page.controller.ts index 1af5dcf8420e..72ce4ed18121 100644 --- a/core/templates/dev/head/pages/practice-session-page/practice-session-page.controller.ts +++ b/core/templates/dev/head/pages/practice-session-page/practice-session-page.controller.ts @@ -31,29 +31,41 @@ require('services/contextual/UrlService.ts'); require('pages/practice-session-page/practice-session-page.constants.ts'); require('pages/interaction-specs.constants.ts'); -oppia.controller('PracticeSession', [ - '$http', '$rootScope', '$scope', 'AlertsService', - 'UrlInterpolationService', 'UrlService', - 'FATAL_ERROR_CODES', 'PRACTICE_SESSIONS_DATA_URL', 'TOTAL_QUESTIONS', - function( - $http, $rootScope, $scope, AlertsService, - UrlInterpolationService, UrlService, - FATAL_ERROR_CODES, PRACTICE_SESSIONS_DATA_URL, TOTAL_QUESTIONS - ) { - $scope.topicName = UrlService.getTopicNameFromLearnerUrl(); - var _fetchSkillDetails = function() { - var practiceSessionsDataUrl = UrlInterpolationService.interpolateUrl( - PRACTICE_SESSIONS_DATA_URL, { - topic_name: $scope.topicName - }); - $http.get(practiceSessionsDataUrl).then(function(result) { - var questionPlayerConfig = { - skillList: result.data.skill_list, - questionCount: TOTAL_QUESTIONS +oppia.directive('practiceSessionPage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/practice-session-page/practice-session-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$rootScope', 'AlertsService', + 'UrlInterpolationService', 'UrlService', + 'FATAL_ERROR_CODES', 'PRACTICE_SESSIONS_DATA_URL', 'TOTAL_QUESTIONS', + function( + $http, $rootScope, AlertsService, + UrlInterpolationService, UrlService, + FATAL_ERROR_CODES, PRACTICE_SESSIONS_DATA_URL, TOTAL_QUESTIONS + ) { + var ctrl = this; + ctrl.topicName = UrlService.getTopicNameFromLearnerUrl(); + var _fetchSkillDetails = function() { + var practiceSessionsDataUrl = UrlInterpolationService.interpolateUrl( + PRACTICE_SESSIONS_DATA_URL, { + topic_name: ctrl.topicName + }); + $http.get(practiceSessionsDataUrl).then(function(result) { + var questionPlayerConfig = { + skillList: result.data.skill_list, + questionCount: TOTAL_QUESTIONS + }; + ctrl.questionPlayerConfig = questionPlayerConfig; + }); }; - $scope.questionPlayerConfig = questionPlayerConfig; - }); - }; - _fetchSkillDetails(); - } -]); + _fetchSkillDetails(); + } + ] + }; +}]); diff --git a/core/templates/dev/head/pages/practice-session-page/practice-session-page.directive.html b/core/templates/dev/head/pages/practice-session-page/practice-session-page.directive.html new file mode 100644 index 000000000000..b76376cf4504 --- /dev/null +++ b/core/templates/dev/head/pages/practice-session-page/practice-session-page.directive.html @@ -0,0 +1,33 @@ + +
+
+ Practice Session +
+ + +
+ diff --git a/core/templates/dev/head/pages/practice-session-page/practice-session-page.mainpage.html b/core/templates/dev/head/pages/practice-session-page/practice-session-page.mainpage.html index 5899ca632960..62f726d47498 100644 --- a/core/templates/dev/head/pages/practice-session-page/practice-session-page.mainpage.html +++ b/core/templates/dev/head/pages/practice-session-page/practice-session-page.mainpage.html @@ -22,40 +22,7 @@ {% endblock navbar_breadcrumb %} {% block content %} - -
-
- Practice Session -
- - -
- - + {% endblock %} {% block footer_js %} diff --git a/core/templates/dev/head/pages/practice-session-page/practice-session-page.scripts.ts b/core/templates/dev/head/pages/practice-session-page/practice-session-page.scripts.ts new file mode 100644 index 000000000000..37a7ed5523d2 --- /dev/null +++ b/core/templates/dev/head/pages/practice-session-page/practice-session-page.scripts.ts @@ -0,0 +1,19 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for the practice session. + */ + +require('pages/practice-session-page/practice-session-page.controller.ts'); diff --git a/core/templates/dev/head/pages/preferences-page/preferences-page.controller.spec.ts b/core/templates/dev/head/pages/preferences-page/preferences-page.controller.spec.ts index edc4fc2fe61c..37d548fb22ac 100644 --- a/core/templates/dev/head/pages/preferences-page/preferences-page.controller.spec.ts +++ b/core/templates/dev/head/pages/preferences-page/preferences-page.controller.spec.ts @@ -20,7 +20,8 @@ require('pages/preferences-page/preferences-page.controller.ts'); describe('Preferences Controller', function() { describe('PreferencesCtrl', function() { - var scope, ctrl, $httpBackend, mockAlertsService, SUPPORTED_AUDIO_LANGUAGES; + var ctrl, $httpBackend, mockAlertsService, SUPPORTED_AUDIO_LANGUAGES; + var $componentController; beforeEach(function() { angular.mock.module('oppia'); @@ -30,7 +31,8 @@ describe('Preferences Controller', function() { angular.mock.module('oppia', GLOBALS.TRANSLATOR_PROVIDER_FOR_TESTS)); beforeEach(angular.mock.inject(function( - $controller, $http, _$httpBackend_, $rootScope) { + _$componentController_, $http, _$httpBackend_, $rootScope) { + $componentController = _$componentController_; $httpBackend = _$httpBackend_; $httpBackend.expectGET('/preferenceshandler/data').respond({ can_receive_email_updates: false, @@ -40,10 +42,7 @@ describe('Preferences Controller', function() { mockAlertsService = {}; - scope = $rootScope.$new(); - - ctrl = $controller('Preferences', { - $scope: scope, + ctrl = $componentController('preferencesPage', null, { $http: $http, $rootScope: $rootScope, AlertsService: mockAlertsService @@ -53,23 +52,23 @@ describe('Preferences Controller', function() { it('should show that editor role notifications checkbox is true by default', function() { $httpBackend.flush(); - expect(scope.canReceiveEditorRoleEmail).toBe(true); + expect(ctrl.canReceiveEditorRoleEmail).toBe(true); }); it('should show that feedback message notifications checkbox is true' + 'by default', function() { $httpBackend.flush(); - expect(scope.canReceiveFeedbackMessageEmail).toBe(true); + expect(ctrl.canReceiveFeedbackMessageEmail).toBe(true); }); it('should map SUPPORTED_AUDIO_LANGUAGES correctly to ' + 'AUDIO_LANGUAGE_CHOICES to support select2 plugin', function() { - var numberOfAudioLanguageChoices = scope.AUDIO_LANGUAGE_CHOICES.length; + var numberOfAudioLanguageChoices = ctrl.AUDIO_LANGUAGE_CHOICES.length; expect(numberOfAudioLanguageChoices > 0).toBe(true); for (var index = 0; index < numberOfAudioLanguageChoices; index++) { - expect(Object.keys(scope.AUDIO_LANGUAGE_CHOICES[index])).toEqual( + expect(Object.keys(ctrl.AUDIO_LANGUAGE_CHOICES[index])).toEqual( ['id', 'text']); } }); diff --git a/core/templates/dev/head/pages/preferences-page/preferences-page.controller.ts b/core/templates/dev/head/pages/preferences-page/preferences-page.controller.ts index 79907685bd1a..966a6df805f5 100644 --- a/core/templates/dev/head/pages/preferences-page/preferences-page.controller.ts +++ b/core/templates/dev/head/pages/preferences-page/preferences-page.controller.ts @@ -22,8 +22,8 @@ require('components/forms/custom-forms-directives/image-uploader.directive.ts'); require( 'components/common-layout-directives/common-elements/' + 'background-banner.directive.ts'); -require('filters/string-utility-filters/truncate.filter.ts'); require('pages/OppiaFooterDirective.ts'); +require('filters/string-utility-filters/truncate.filter.ts'); require('domain/utilities/LanguageUtilService.ts'); require('domain/utilities/UrlInterpolationService.ts'); @@ -31,232 +31,253 @@ require('services/AlertsService.ts'); require('services/UserService.ts'); require('services/UtilsService.ts'); -oppia.controller('Preferences', [ - '$http', '$q', '$rootScope', '$scope', '$timeout', '$translate', '$uibModal', - '$window', 'AlertsService', 'LanguageUtilService', 'UrlInterpolationService', - 'UserService', 'UtilsService', 'DASHBOARD_TYPE_CREATOR', - 'DASHBOARD_TYPE_LEARNER', 'SUPPORTED_AUDIO_LANGUAGES', - 'SUPPORTED_SITE_LANGUAGES', - function( - $http, $q, $rootScope, $scope, $timeout, $translate, $uibModal, - $window, AlertsService, LanguageUtilService, UrlInterpolationService, - UserService, UtilsService, DASHBOARD_TYPE_CREATOR, - DASHBOARD_TYPE_LEARNER, SUPPORTED_AUDIO_LANGUAGES, - SUPPORTED_SITE_LANGUAGES) { - var _PREFERENCES_DATA_URL = '/preferenceshandler/data'; - $scope.profilePictureDataUrl = ''; - $scope.DASHBOARD_TYPE_CREATOR = DASHBOARD_TYPE_CREATOR; - $scope.DASHBOARD_TYPE_LEARNER = DASHBOARD_TYPE_LEARNER; +oppia.directive('preferencesPage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: { + subjectInterests: '=', + preferredLanguageCodes: '=', + preferredSiteLanguageCode: '=', + preferredAudioLanguageCode: '=' + }, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/preferences-page/preferences-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$http', '$q', '$rootScope', '$scope', '$timeout', '$translate', + '$window', '$uibModal', 'AlertsService', 'LanguageUtilService', + 'UrlInterpolationService', 'UserService', 'UtilsService', + 'DASHBOARD_TYPE_CREATOR', 'DASHBOARD_TYPE_LEARNER', + 'SUPPORTED_AUDIO_LANGUAGES', 'SUPPORTED_SITE_LANGUAGES', + function( + $http, $q, $rootScope, $scope, $timeout, $translate, + $window, $uibModal, AlertsService, LanguageUtilService, + UrlInterpolationService, UserService, UtilsService, + DASHBOARD_TYPE_CREATOR, DASHBOARD_TYPE_LEARNER, + SUPPORTED_AUDIO_LANGUAGES, SUPPORTED_SITE_LANGUAGES) { + var ctrl = this; + var _PREFERENCES_DATA_URL = '/preferenceshandler/data'; + ctrl.profilePictureDataUrl = ''; + ctrl.DASHBOARD_TYPE_CREATOR = DASHBOARD_TYPE_CREATOR; + ctrl.DASHBOARD_TYPE_LEARNER = DASHBOARD_TYPE_LEARNER; - $scope.username = ''; - $rootScope.loadingMessage = 'Loading'; - var userInfoPromise = UserService.getUserInfoAsync(); - userInfoPromise.then(function(userInfo) { - $scope.username = userInfo.getUsername(); - }); + ctrl.username = ''; + $rootScope.loadingMessage = 'Loading'; + var userInfoPromise = UserService.getUserInfoAsync(); + userInfoPromise.then(function(userInfo) { + ctrl.username = userInfo.getUsername(); + }); - $scope.hasPageLoaded = false; - var preferencesPromise = $http.get(_PREFERENCES_DATA_URL); - preferencesPromise.then(function(response) { - var data = response.data; - $scope.userBio = data.user_bio; - $scope.subjectInterests = data.subject_interests; - $scope.preferredLanguageCodes = data.preferred_language_codes; - $scope.profilePictureDataUrl = data.profile_picture_data_url; - $scope.defaultDashboard = data.default_dashboard; - $scope.canReceiveEmailUpdates = data.can_receive_email_updates; - $scope.canReceiveEditorRoleEmail = data.can_receive_editor_role_email; - $scope.canReceiveSubscriptionEmail = data.can_receive_subscription_email; - $scope.canReceiveFeedbackMessageEmail = ( - data.can_receive_feedback_message_email); - $scope.preferredSiteLanguageCode = data.preferred_site_language_code; - $scope.preferredAudioLanguageCode = data.preferred_audio_language_code; - $scope.subscriptionList = data.subscription_list; - $scope.hasPageLoaded = true; - _forceSelect2Refresh(); - }); + ctrl.hasPageLoaded = false; + var preferencesPromise = $http.get(_PREFERENCES_DATA_URL); + preferencesPromise.then(function(response) { + var data = response.data; + ctrl.userBio = data.user_bio; + ctrl.subjectInterests = data.subject_interests; + ctrl.preferredLanguageCodes = data.preferred_language_codes; + ctrl.profilePictureDataUrl = data.profile_picture_data_url; + ctrl.defaultDashboard = data.default_dashboard; + ctrl.canReceiveEmailUpdates = data.can_receive_email_updates; + ctrl.canReceiveEditorRoleEmail = data.can_receive_editor_role_email; + ctrl.canReceiveSubscriptionEmail = + data.can_receive_subscription_email; + ctrl.canReceiveFeedbackMessageEmail = ( + data.can_receive_feedback_message_email); + ctrl.preferredSiteLanguageCode = data.preferred_site_language_code; + ctrl.preferredAudioLanguageCode = + data.preferred_audio_language_code; + ctrl.subscriptionList = data.subscription_list; + ctrl.hasPageLoaded = true; + _forceSelect2Refresh(); + }); - $q.all([userInfoPromise, preferencesPromise]).then(function() { - $rootScope.loadingMessage = ''; - }); + $q.all([userInfoPromise, preferencesPromise]).then(function() { + $rootScope.loadingMessage = ''; + }); - $scope.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; - var _saveDataItem = function(updateType, data) { - $http.put(_PREFERENCES_DATA_URL, { - update_type: updateType, - data: data - }); - }; + var _saveDataItem = function(updateType, data) { + $http.put(_PREFERENCES_DATA_URL, { + update_type: updateType, + data: data + }); + }; - // Select2 dropdown cannot automatically refresh its display - // after being translated. - // Use $scope.select2DropdownIsShown in its ng-if attribute - // and this function to force it to reload - var _forceSelect2Refresh = function() { - $scope.select2DropdownIsShown = false; - $timeout(function() { - $scope.select2DropdownIsShown = true; - }, 100); - }; + // Select2 dropdown cannot automatically refresh its display + // after being translated. + // Use ctrl.select2DropdownIsShown in its ng-if attribute + // and this function to force it to reload + var _forceSelect2Refresh = function() { + ctrl.select2DropdownIsShown = false; + $timeout(function() { + ctrl.select2DropdownIsShown = true; + }, 100); + }; - $scope.saveUserBio = function(userBio) { - _saveDataItem('user_bio', userBio); - }; + ctrl.saveUserBio = function(userBio) { + _saveDataItem('user_bio', userBio); + }; - $scope.subjectInterestsChangedAtLeastOnce = false; - $scope.subjectInterestsWarningText = null; - $scope.TAG_REGEX_STRING = '^[a-z ]+$'; + ctrl.subjectInterestsChangedAtLeastOnce = false; + ctrl.subjectInterestsWarningText = null; + ctrl.TAG_REGEX_STRING = '^[a-z ]+$'; - $scope.updateSubjectInterestsWarning = function(subjectInterests) { - var TAG_REGEX = new RegExp($scope.TAG_REGEX_STRING); + ctrl.updateSubjectInterestsWarning = function(subjectInterests) { + var TAG_REGEX = new RegExp(ctrl.TAG_REGEX_STRING); - if (subjectInterests instanceof Array) { - for (var i = 0; i < subjectInterests.length; i++) { - if (UtilsService.isString(subjectInterests[i])) { - if (!TAG_REGEX.test(subjectInterests[i])) { - $scope.subjectInterestsWarningText = ( - 'Subject interests should use only lowercase letters.'); + if (subjectInterests instanceof Array) { + for (var i = 0; i < subjectInterests.length; i++) { + if (UtilsService.isString(subjectInterests[i])) { + if (!TAG_REGEX.test(subjectInterests[i])) { + ctrl.subjectInterestsWarningText = ( + 'Subject interests should use only lowercase letters.'); + } + } else { + console.error( + 'Error: received bad value for a subject interest. Expected' + + ' a string, got ', subjectInterests[i]); + throw Error( + 'Error: received bad value for a subject interest.'); + } } } else { console.error( - 'Error: received bad value for a subject interest. Expected a ' + - 'string, got ', subjectInterests[i]); - throw Error('Error: received bad value for a subject interest.'); + 'Error: received bad value for subject interests. Expected list' + + ' of strings, got ', subjectInterests); + throw Error('Error: received bad value for subject interests.'); } - } - } else { - console.error( - 'Error: received bad value for subject interests. Expected list of ' + - 'strings, got ', subjectInterests); - throw Error('Error: received bad value for subject interests.'); - } - }; - - $scope.onSubjectInterestsSelectionChange = function(subjectInterests) { - AlertsService.clearWarnings(); - $scope.subjectInterestsChangedAtLeastOnce = true; - $scope.subjectInterestsWarningText = null; - $scope.updateSubjectInterestsWarning(subjectInterests); - if ($scope.subjectInterestsWarningText === null) { - _saveDataItem('subject_interests', subjectInterests); - } - }; + }; - $scope.savePreferredSiteLanguageCodes = function( - preferredSiteLanguageCode) { - $translate.use(preferredSiteLanguageCode); - _forceSelect2Refresh(); - _saveDataItem( - 'preferred_site_language_code', preferredSiteLanguageCode); - }; + ctrl.onSubjectInterestsSelectionChange = function(subjectInterests) { + AlertsService.clearWarnings(); + ctrl.subjectInterestsChangedAtLeastOnce = true; + ctrl.subjectInterestsWarningText = null; + ctrl.updateSubjectInterestsWarning(subjectInterests); + if (ctrl.subjectInterestsWarningText === null) { + _saveDataItem('subject_interests', subjectInterests); + } + }; - $scope.savePreferredAudioLanguageCode = function( - preferredAudioLanguageCode) { - _saveDataItem( - 'preferred_audio_language_code', preferredAudioLanguageCode); - }; + ctrl.savePreferredSiteLanguageCodes = function( + preferredSiteLanguageCode) { + $translate.use(preferredSiteLanguageCode); + _forceSelect2Refresh(); + _saveDataItem( + 'preferred_site_language_code', preferredSiteLanguageCode); + }; - $scope.showUsernamePopover = function(creatorUsername) { - // The popover on the subscription card is only shown if the length of - // the creator username is greater than 10 and the user hovers over - // the truncated username. - if (creatorUsername.length > 10) { - return 'mouseenter'; - } else { - return 'none'; - } - }; + ctrl.savePreferredAudioLanguageCode = function( + preferredAudioLanguageCode) { + _saveDataItem( + 'preferred_audio_language_code', preferredAudioLanguageCode); + }; - $scope.saveEmailPreferences = function( - canReceiveEmailUpdates, canReceiveEditorRoleEmail, - canReceiveFeedbackMessageEmail, canReceiveSubscriptionEmail) { - var data = { - can_receive_email_updates: canReceiveEmailUpdates, - can_receive_editor_role_email: canReceiveEditorRoleEmail, - can_receive_feedback_message_email: canReceiveFeedbackMessageEmail, - can_receive_subscription_email: canReceiveSubscriptionEmail - }; - _saveDataItem('email_preferences', data); - }; + ctrl.showUsernamePopover = function(creatorUsername) { + // The popover on the subscription card is only shown if the length of + // the creator username is greater than 10 and the user hovers over + // the truncated username. + if (creatorUsername.length > 10) { + return 'mouseenter'; + } else { + return 'none'; + } + }; - $scope.savePreferredLanguageCodes = function(preferredLanguageCodes) { - _saveDataItem('preferred_language_codes', preferredLanguageCodes); - }; + ctrl.saveEmailPreferences = function( + canReceiveEmailUpdates, canReceiveEditorRoleEmail, + canReceiveFeedbackMessageEmail, canReceiveSubscriptionEmail) { + var data = { + can_receive_email_updates: canReceiveEmailUpdates, + can_receive_editor_role_email: canReceiveEditorRoleEmail, + can_receive_feedback_message_email: canReceiveFeedbackMessageEmail, + can_receive_subscription_email: canReceiveSubscriptionEmail + }; + _saveDataItem('email_preferences', data); + }; - $scope.saveDefaultDashboard = function(defaultDashboard) { - _saveDataItem('default_dashboard', defaultDashboard); - }; + ctrl.savePreferredLanguageCodes = function(preferredLanguageCodes) { + _saveDataItem('preferred_language_codes', preferredLanguageCodes); + }; - $scope.showEditProfilePictureModal = function() { - $uibModal.open({ - templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( - '/pages/preferences-page/modal-templates/' + - 'edit-profile-picture-modal.directive.html'), - backdrop: true, - controller: [ - '$scope', '$uibModalInstance', function($scope, $uibModalInstance) { - $scope.uploadedImage = null; - $scope.croppedImageDataUrl = ''; - $scope.invalidImageWarningIsShown = false; + ctrl.saveDefaultDashboard = function(defaultDashboard) { + _saveDataItem('default_dashboard', defaultDashboard); + }; - $scope.onFileChanged = function(file) { - $('.oppia-profile-image-uploader').fadeOut(function() { + ctrl.showEditProfilePictureModal = function() { + $uibModal.open({ + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/preferences-page/modal-templates/' + + 'edit-profile-picture-modal.directive.html'), + backdrop: true, + controller: [ + '$scope', '$uibModalInstance', function( + $scope, $uibModalInstance) { + $scope.uploadedImage = null; + $scope.croppedImageDataUrl = ''; $scope.invalidImageWarningIsShown = false; - var reader = new FileReader(); - reader.onload = function(e) { - $scope.$apply(function() { - $scope.uploadedImage = (e.target).result; + $scope.onFileChanged = function(file) { + $('.oppia-profile-image-uploader').fadeOut(function() { + $scope.invalidImageWarningIsShown = false; + + var reader = new FileReader(); + reader.onload = function(e) { + $scope.$apply(function() { + $scope.uploadedImage = (e.target).result; + }); + }; + reader.readAsDataURL(file); + + $timeout(function() { + $('.oppia-profile-image-uploader').fadeIn(); + }, 100); }); }; - reader.readAsDataURL(file); - $timeout(function() { - $('.oppia-profile-image-uploader').fadeIn(); - }, 100); - }); - }; + $scope.reset = function() { + $scope.uploadedImage = null; + $scope.croppedImageDataUrl = ''; + }; - $scope.reset = function() { - $scope.uploadedImage = null; - $scope.croppedImageDataUrl = ''; - }; + $scope.onInvalidImageLoaded = function() { + $scope.uploadedImage = null; + $scope.croppedImageDataUrl = ''; + $scope.invalidImageWarningIsShown = true; + }; - $scope.onInvalidImageLoaded = function() { - $scope.uploadedImage = null; - $scope.croppedImageDataUrl = ''; - $scope.invalidImageWarningIsShown = true; - }; + $scope.confirm = function() { + $uibModalInstance.close($scope.croppedImageDataUrl); + }; - $scope.confirm = function() { - $uibModalInstance.close($scope.croppedImageDataUrl); - }; + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + }; + } + ] + }).result.then(function(newProfilePictureDataUrl) { + UserService.setProfileImageDataUrlAsync(newProfilePictureDataUrl) + .then(function() { + // The reload is needed in order to update the profile picture + // in the top-right corner. + $window.reload(); + }); + }); + }; - $scope.cancel = function() { - $uibModalInstance.dismiss('cancel'); + ctrl.LANGUAGE_CHOICES = LanguageUtilService.getLanguageIdsAndTexts(); + ctrl.SITE_LANGUAGE_CHOICES = SUPPORTED_SITE_LANGUAGES; + ctrl.AUDIO_LANGUAGE_CHOICES = SUPPORTED_AUDIO_LANGUAGES.map( + function(languageItem) { + return { + id: languageItem.id, + text: languageItem.description }; } - ] - }).result.then(function(newProfilePictureDataUrl) { - UserService.setProfileImageDataUrlAsync(newProfilePictureDataUrl) - .then(function() { - // The reload is needed in order to update the profile picture in - // the top-right corner. - $window.location.reload(); - }); - }); - }; - - $scope.LANGUAGE_CHOICES = LanguageUtilService.getLanguageIdsAndTexts(); - $scope.SITE_LANGUAGE_CHOICES = SUPPORTED_SITE_LANGUAGES; - $scope.AUDIO_LANGUAGE_CHOICES = SUPPORTED_AUDIO_LANGUAGES.map( - function(languageItem) { - return { - id: languageItem.id, - text: languageItem.description - }; + ); } - ); - } -]); + ] + }; +}]); diff --git a/core/templates/dev/head/pages/preferences-page/preferences-page.directive.html b/core/templates/dev/head/pages/preferences-page/preferences-page.directive.html new file mode 100644 index 000000000000..37ed9d8c0954 --- /dev/null +++ b/core/templates/dev/head/pages/preferences-page/preferences-page.directive.html @@ -0,0 +1,255 @@ + +
+

+

+
+ +
+
+
+ + +
+
+ +
+
+ +
+
+
+ + + " class="img-thumbnail"> +
+
+
+
+ +
+
+ +
+ + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ + +
+ +
+ + <[$ctrl.subjectInterestsWarningText]> + +
+
+
+
+ + + +
+
+ +
+ +
+ + +
+ + +
+
+
+ +
+
+ +
+ +
+ + +
+ +
+
+
+ +
+
+ +
+ +
+ + +
+ +
+
+
+ + +
+ +
+
+ +
+ {{user_email}} + +
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+ +
+
+ diff --git a/core/templates/dev/head/pages/preferences-page/preferences-page.mainpage.html b/core/templates/dev/head/pages/preferences-page/preferences-page.mainpage.html index dad2d5deeb5f..aec0dda91355 100644 --- a/core/templates/dev/head/pages/preferences-page/preferences-page.mainpage.html +++ b/core/templates/dev/head/pages/preferences-page/preferences-page.mainpage.html @@ -14,261 +14,11 @@ {% endblock navbar_breadcrumb %} {% block content %} - -
-

-

-
- -
-
-
- -
- <[username]> - -
-
-
- -
-
- -
-
-
- - - " class="img-thumbnail"> -
-
-
-
- -
-
- -
- - -
-
-
- -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
- - -
- -
- - <[subjectInterestsWarningText]> - -
-
-
-
- - - -
-
- -
- -
- - -
- - -
-
-
- -
-
- -
- -
- - -
- -
-
-
- -
-
- -
- -
- - -
- -
-
-
- - -
- -
-
- -
- {{user_email}} - -
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
- -
-
- + + {% endblock %} {% block footer %} diff --git a/core/templates/dev/head/pages/preferences-page/preferences-page.scripts.ts b/core/templates/dev/head/pages/preferences-page/preferences-page.scripts.ts new file mode 100644 index 000000000000..825cda323dfb --- /dev/null +++ b/core/templates/dev/head/pages/preferences-page/preferences-page.scripts.ts @@ -0,0 +1,21 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for the Oppia 'edit preferences' page. + */ + +require('pages/OppiaFooterDirective.ts'); + +require('pages/preferences-page/preferences-page.controller.ts'); diff --git a/core/templates/dev/head/pages/splash-page/splash-page.controller.ts b/core/templates/dev/head/pages/splash-page/splash-page.controller.ts index a966b50cbc5a..af29dbee11ee 100644 --- a/core/templates/dev/head/pages/splash-page/splash-page.controller.ts +++ b/core/templates/dev/head/pages/splash-page/splash-page.controller.ts @@ -22,46 +22,58 @@ require('domain/utilities/UrlInterpolationService.ts'); require('services/SiteAnalyticsService.ts'); require('services/UserService.ts'); -oppia.controller('Splash', [ - '$rootScope', '$scope', '$timeout', '$window', 'SiteAnalyticsService', - 'UrlInterpolationService', 'UserService', - function($rootScope, $scope, $timeout, $window, SiteAnalyticsService, - UrlInterpolationService, UserService) { - $scope.userIsLoggedIn = null; - $rootScope.loadingMessage = 'Loading'; - UserService.getUserInfoAsync().then(function(userInfo) { - $scope.userIsLoggedIn = userInfo.isLoggedIn(); - $rootScope.loadingMessage = ''; - }); - $scope.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; - $scope.getStaticSubjectImageUrl = function(subjectName) { - return UrlInterpolationService.getStaticImageUrl('/subjects/' + - subjectName + '.svg'); - }; +oppia.directive('splashPage', ['UrlInterpolationService', function( + UrlInterpolationService) { + return { + restrict: 'E', + scope: {}, + bindToController: {}, + templateUrl: UrlInterpolationService.getDirectiveTemplateUrl( + '/pages/splash-page/splash-page.directive.html'), + controllerAs: '$ctrl', + controller: [ + '$rootScope', '$timeout', '$window', 'SiteAnalyticsService', + 'UrlInterpolationService', 'UserService', + function($rootScope, $timeout, $window, SiteAnalyticsService, + UrlInterpolationService, UserService) { + var ctrl = this; + ctrl.userIsLoggedIn = null; + $rootScope.loadingMessage = 'Loading'; + UserService.getUserInfoAsync().then(function(userInfo) { + ctrl.userIsLoggedIn = userInfo.isLoggedIn(); + $rootScope.loadingMessage = ''; + }); + ctrl.getStaticImageUrl = UrlInterpolationService.getStaticImageUrl; + ctrl.getStaticSubjectImageUrl = function(subjectName) { + return UrlInterpolationService.getStaticImageUrl('/subjects/' + + subjectName + '.svg'); + }; - $scope.onRedirectToLogin = function(destinationUrl) { - SiteAnalyticsService.registerStartLoginEvent( - 'splashPageCreateExplorationButton'); - $timeout(function() { - $window.location = destinationUrl; - }, 150); - return false; - }; + ctrl.onRedirectToLogin = function(destinationUrl) { + SiteAnalyticsService.registerStartLoginEvent( + 'splashPageCreateExplorationButton'); + $timeout(function() { + $window.location = destinationUrl; + }, 150); + return false; + }; - $scope.onClickBrowseLibraryButton = function() { - SiteAnalyticsService.registerClickBrowseLibraryButtonEvent(); - $timeout(function() { - $window.location = '/library'; - }, 150); - return false; - }; + ctrl.onClickBrowseLibraryButton = function() { + SiteAnalyticsService.registerClickBrowseLibraryButtonEvent(); + $timeout(function() { + $window.location = '/library'; + }, 150); + return false; + }; - $scope.onClickCreateExplorationButton = function() { - SiteAnalyticsService.registerClickCreateExplorationButtonEvent(); - $timeout(function() { - $window.location = '/creator_dashboard?mode=create'; - }, 150); - return false; - }; - } -]); + ctrl.onClickCreateExplorationButton = function() { + SiteAnalyticsService.registerClickCreateExplorationButtonEvent(); + $timeout(function() { + $window.location = '/creator_dashboard?mode=create'; + }, 150); + return false; + }; + } + ] + }; +}]); diff --git a/core/templates/dev/head/pages/splash-page/splash-page.directive.html b/core/templates/dev/head/pages/splash-page/splash-page.directive.html new file mode 100644 index 000000000000..ca39722bc685 --- /dev/null +++ b/core/templates/dev/head/pages/splash-page/splash-page.directive.html @@ -0,0 +1,165 @@ +
+
+

+
+
+
+ " class="oppia-splash-books" style="margin-left: -250px; width: 500px; top: 95px;" alt=""> + + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> +
+ +
+ " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> +
+ +
+ " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> + " class="oppia-splash-background-icon" alt=""> +
+
+ +
+ + + + + +
+
+ +
+

+
+
+ +
+
+
+
+ " class="oppia-splash-overlapping-image-1" alt=""> +
+
+
+
+ +
+
+ " alt=""> +
+
+
+
+ +
+
+ " alt=""> +
+
+
+
+
+
+
diff --git a/core/templates/dev/head/pages/splash-page/splash-page.mainpage.html b/core/templates/dev/head/pages/splash-page/splash-page.mainpage.html index a0bbd476d03f..f3eeec6fe527 100644 --- a/core/templates/dev/head/pages/splash-page/splash-page.mainpage.html +++ b/core/templates/dev/head/pages/splash-page/splash-page.mainpage.html @@ -7,171 +7,7 @@ -
-
-

-
-
-
- " class="oppia-splash-books" style="margin-left: -250px; width: 500px; top: 95px;" alt=""> - - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> -
- -
- " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> -
- -
- " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> - " class="oppia-splash-background-icon" alt=""> -
-
- -
- - - - - -
-
- -
-

-
-
- -
-
-
-
- " class="oppia-splash-overlapping-image-1" alt=""> -
-
-
-
- -
-
- " alt=""> -
-
-
-
- -
-
- " alt=""> -
-
-
-
-
-
-
+
diff --git a/core/templates/dev/head/pages/splash-page/splash-page.scripts.ts b/core/templates/dev/head/pages/splash-page/splash-page.scripts.ts new file mode 100644 index 000000000000..c0b26a4db781 --- /dev/null +++ b/core/templates/dev/head/pages/splash-page/splash-page.scripts.ts @@ -0,0 +1,19 @@ +// Copyright 2019 The Oppia Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Directive scripts for the Oppia splash page. + */ + +require('pages/splash-page/splash-page.controller.ts'); diff --git a/webpack.config.ts b/webpack.config.ts index 2eeebeac47d0..bfdb1d0bc4f6 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -31,7 +31,7 @@ var commonPrefix = './core/templates/dev/head'; module.exports = { entries: { - about: commonPrefix + '/pages/about-page/about-page.controller.ts', + about: commonPrefix + '/pages/about-page/about-page.scripts.ts', admin: commonPrefix + '/pages/admin-page/admin-page.scripts.ts', app: commonPrefix + '/App.ts', collection_editor: @@ -43,15 +43,15 @@ module.exports = { contact: commonPrefix + '/pages/contact-page/contact-page.scripts.ts', creator_dashboard: commonPrefix + '/pages/creator-dashboard-page/' + - 'creator-dashboard-page.controller.ts', - donate: commonPrefix + '/pages/donate-page/donate-page.controller.ts', + 'creator-dashboard-page.scripts.ts', + donate: commonPrefix + '/pages/donate-page/donate-page.scripts.ts', email_dashboard: commonPrefix + - '/pages/email-dashboard-pages/email-dashboard-page.controller.ts', + '/pages/email-dashboard-pages/email-dashboard-page.scripts.ts', email_dashboard_result: commonPrefix + - '/pages/email-dashboard-pages/email-dashboard-result.controller.ts', - error: commonPrefix + '/pages/error-pages/error-page.controller.ts', + '/pages/email-dashboard-pages/email-dashboard-result.scripts.ts', + error: commonPrefix + '/pages/error-pages/error-page.scripts.ts', exploration_editor: commonPrefix + '/pages/exploration-editor-page/' + 'exploration-editor-page.controller.ts', @@ -62,7 +62,7 @@ module.exports = { commonPrefix + '/pages/get-started-page/get-started-page.scripts.ts', landing: commonPrefix + '/pages/landing-pages/topic-landing-page/' + - 'topic-landing-page.controller.ts', + 'topic-landing-page.scripts.ts', learner_dashboard: commonPrefix + '/pages/learner-dashboard-page/' + 'learner-dashboard-page.controller.ts', @@ -70,26 +70,24 @@ module.exports = { maintenance: commonPrefix + '/pages/maintenance-page/maintenance-page.controller.ts', moderator: - commonPrefix + '/pages/moderator-page/moderator-page.controller.ts', + commonPrefix + '/pages/moderator-page/moderator-page.scripts.ts', notifications_dashboard: commonPrefix + '/pages/notifications-dashboard-page/' + - 'notifications-dashboard-page.controller.ts', + 'notifications-dashboard-page.scripts.ts', practice_session: commonPrefix + '/pages/practice-session-page/' + - 'practice-session-page.controller.ts', + 'practice-session-page.scripts.ts', privacy: commonPrefix + '/pages/privacy-page/privacy-page.controller.ts', preferences: - commonPrefix + '/pages/preferences-page/preferences-page.controller.ts', + commonPrefix + '/pages/preferences-page/preferences-page.scripts.ts', profile: commonPrefix + '/pages/profile-page/profile-page.controller.ts', signup: commonPrefix + '/pages/signup-page/signup-page.controller.ts', skill_editor: commonPrefix + '/pages/skill-editor-page/skill-editor-page.controller.ts', - splash: commonPrefix + '/pages/splash-page/splash-page.controller.ts', - stewards: ( - commonPrefix + - '/pages/landing-pages/stewards-landing-page/' + - 'stewards-landing-page.controller.ts' - ), + splash: commonPrefix + '/pages/splash-page/splash-page.scripts.ts', + stewards: + commonPrefix + '/pages/landing-pages/stewards-landing-page/' + + 'stewards-landing-page.scripts.ts', story_editor: commonPrefix + '/pages/story-editor-page/story-editor-page.controller.ts', teach: commonPrefix + '/pages/teach-page/teach-page.controller.ts',